Lines Matching full:test

39 static void ttm_tt_init_basic(struct kunit *test)  in ttm_tt_init_basic()  argument
41 const struct ttm_tt_test_case *params = test->param_value; in ttm_tt_init_basic()
50 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_init_basic()
51 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_init_basic()
53 bo = ttm_bo_kunit_init(test, test->priv, params->size, NULL); in ttm_tt_init_basic()
56 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_init_basic()
58 KUNIT_ASSERT_EQ(test, tt->num_pages, num_pages + extra_pages); in ttm_tt_init_basic()
60 KUNIT_ASSERT_EQ(test, tt->page_flags, page_flags); in ttm_tt_init_basic()
61 KUNIT_ASSERT_EQ(test, tt->caching, caching); in ttm_tt_init_basic()
63 KUNIT_ASSERT_NULL(test, tt->dma_address); in ttm_tt_init_basic()
64 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_init_basic()
67 static void ttm_tt_init_misaligned(struct kunit *test) in ttm_tt_init_misaligned() argument
76 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_init_misaligned()
77 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_init_misaligned()
79 bo = ttm_bo_kunit_init(test, test->priv, size, NULL); in ttm_tt_init_misaligned()
85 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_init_misaligned()
87 KUNIT_ASSERT_EQ(test, tt->num_pages, num_pages); in ttm_tt_init_misaligned()
90 static void ttm_tt_fini_basic(struct kunit *test) in ttm_tt_fini_basic() argument
97 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_fini_basic()
98 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_fini_basic()
100 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_basic()
103 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_fini_basic()
104 KUNIT_ASSERT_NOT_NULL(test, tt->pages); in ttm_tt_fini_basic()
107 KUNIT_ASSERT_NULL(test, tt->pages); in ttm_tt_fini_basic()
110 static void ttm_tt_fini_sg(struct kunit *test) in ttm_tt_fini_sg() argument
117 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_fini_sg()
118 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_fini_sg()
120 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_sg()
123 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_fini_sg()
124 KUNIT_ASSERT_NOT_NULL(test, tt->dma_address); in ttm_tt_fini_sg()
127 KUNIT_ASSERT_NULL(test, tt->dma_address); in ttm_tt_fini_sg()
130 static void ttm_tt_fini_shmem(struct kunit *test) in ttm_tt_fini_shmem() argument
138 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_fini_shmem()
139 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_fini_shmem()
141 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_fini_shmem()
144 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_fini_shmem()
150 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_fini_shmem()
153 static void ttm_tt_create_basic(struct kunit *test) in ttm_tt_create_basic() argument
158 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_basic()
165 KUNIT_EXPECT_EQ(test, err, 0); in ttm_tt_create_basic()
166 KUNIT_EXPECT_NOT_NULL(test, bo->ttm); in ttm_tt_create_basic()
172 static void ttm_tt_create_invalid_bo_type(struct kunit *test) in ttm_tt_create_invalid_bo_type() argument
177 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_invalid_bo_type()
184 KUNIT_EXPECT_EQ(test, err, -EINVAL); in ttm_tt_create_invalid_bo_type()
185 KUNIT_EXPECT_NULL(test, bo->ttm); in ttm_tt_create_invalid_bo_type()
188 static void ttm_tt_create_ttm_exists(struct kunit *test) in ttm_tt_create_ttm_exists() argument
195 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_create_ttm_exists()
196 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_create_ttm_exists()
198 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_ttm_exists()
201 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_create_ttm_exists()
209 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_create_ttm_exists()
210 KUNIT_ASSERT_PTR_EQ(test, tt, bo->ttm); in ttm_tt_create_ttm_exists()
223 static void ttm_tt_create_failed(struct kunit *test) in ttm_tt_create_failed() argument
225 const struct ttm_test_devices *devs = test->priv; in ttm_tt_create_failed()
229 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_create_failed()
238 KUNIT_ASSERT_EQ(test, err, -ENOMEM); in ttm_tt_create_failed()
241 static void ttm_tt_destroy_basic(struct kunit *test) in ttm_tt_destroy_basic() argument
243 const struct ttm_test_devices *devs = test->priv; in ttm_tt_destroy_basic()
247 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_destroy_basic()
253 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_destroy_basic()
254 KUNIT_ASSERT_NOT_NULL(test, bo->ttm); in ttm_tt_destroy_basic()
259 static void ttm_tt_populate_null_ttm(struct kunit *test) in ttm_tt_populate_null_ttm() argument
261 const struct ttm_test_devices *devs = test->priv; in ttm_tt_populate_null_ttm()
266 KUNIT_ASSERT_EQ(test, err, -EINVAL); in ttm_tt_populate_null_ttm()
269 static void ttm_tt_populate_populated_ttm(struct kunit *test) in ttm_tt_populate_populated_ttm() argument
271 const struct ttm_test_devices *devs = test->priv; in ttm_tt_populate_populated_ttm()
278 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_populate_populated_ttm()
280 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_populate_populated_ttm()
281 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_populate_populated_ttm()
284 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_populate_populated_ttm()
287 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_populate_populated_ttm()
291 KUNIT_ASSERT_PTR_EQ(test, populated_page, *tt->pages); in ttm_tt_populate_populated_ttm()
294 static void ttm_tt_unpopulate_basic(struct kunit *test) in ttm_tt_unpopulate_basic() argument
296 const struct ttm_test_devices *devs = test->priv; in ttm_tt_unpopulate_basic()
302 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_unpopulate_basic()
304 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_unpopulate_basic()
305 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_unpopulate_basic()
308 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_unpopulate_basic()
311 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_unpopulate_basic()
312 KUNIT_ASSERT_TRUE(test, ttm_tt_is_populated(tt)); in ttm_tt_unpopulate_basic()
315 KUNIT_ASSERT_FALSE(test, ttm_tt_is_populated(tt)); in ttm_tt_unpopulate_basic()
318 static void ttm_tt_unpopulate_empty_ttm(struct kunit *test) in ttm_tt_unpopulate_empty_ttm() argument
320 const struct ttm_test_devices *devs = test->priv; in ttm_tt_unpopulate_empty_ttm()
325 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_unpopulate_empty_ttm()
327 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_unpopulate_empty_ttm()
328 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_unpopulate_empty_ttm()
331 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_unpopulate_empty_ttm()
337 static void ttm_tt_swapin_basic(struct kunit *test) in ttm_tt_swapin_basic() argument
339 const struct ttm_test_devices *devs = test->priv; in ttm_tt_swapin_basic()
346 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_tt_swapin_basic()
348 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL); in ttm_tt_swapin_basic()
349 KUNIT_ASSERT_NOT_NULL(test, tt); in ttm_tt_swapin_basic()
352 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_swapin_basic()
355 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_swapin_basic()
356 KUNIT_ASSERT_TRUE(test, ttm_tt_is_populated(tt)); in ttm_tt_swapin_basic()
359 KUNIT_ASSERT_EQ(test, num_pages, expected_num_pages); in ttm_tt_swapin_basic()
360 KUNIT_ASSERT_NOT_NULL(test, tt->swap_storage); in ttm_tt_swapin_basic()
361 KUNIT_ASSERT_TRUE(test, tt->page_flags & TTM_TT_FLAG_SWAPPED); in ttm_tt_swapin_basic()
365 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_swapin_basic()
368 KUNIT_ASSERT_EQ(test, err, 0); in ttm_tt_swapin_basic()
369 KUNIT_ASSERT_NULL(test, tt->swap_storage); in ttm_tt_swapin_basic()
370 KUNIT_ASSERT_FALSE(test, tt->page_flags & TTM_TT_FLAG_SWAPPED); in ttm_tt_swapin_basic()