Lines Matching refs:test

11 static void kfree_at_end(struct kunit *test, const void *to_free);
12 static void free_subsuite_at_end(struct kunit *test,
14 static struct kunit_suite *alloc_fake_suite(struct kunit *test,
18 static void dummy_test(struct kunit *test) {} in dummy_test() argument
27 static void parse_filter_test(struct kunit *test) in parse_filter_test() argument
32 KUNIT_EXPECT_STREQ(test, filter.suite_glob, "suite"); in parse_filter_test()
33 KUNIT_EXPECT_FALSE(test, filter.test_glob); in parse_filter_test()
38 KUNIT_EXPECT_STREQ(test, filter.suite_glob, "suite"); in parse_filter_test()
39 KUNIT_EXPECT_STREQ(test, filter.test_glob, "test"); in parse_filter_test()
44 static void filter_subsuite_test(struct kunit *test) in filter_subsuite_test() argument
53 subsuite[0] = alloc_fake_suite(test, "suite1", dummy_test_cases); in filter_subsuite_test()
54 subsuite[1] = alloc_fake_suite(test, "suite2", dummy_test_cases); in filter_subsuite_test()
58 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered); in filter_subsuite_test()
59 free_subsuite_at_end(test, filtered); in filter_subsuite_test()
62 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered[0]); in filter_subsuite_test()
63 KUNIT_EXPECT_STREQ(test, (const char *)filtered[0]->name, "suite2"); in filter_subsuite_test()
64 KUNIT_EXPECT_FALSE(test, filtered[1]); in filter_subsuite_test()
67 static void filter_subsuite_test_glob_test(struct kunit *test) in filter_subsuite_test_glob_test() argument
76 subsuite[0] = alloc_fake_suite(test, "suite1", dummy_test_cases); in filter_subsuite_test_glob_test()
77 subsuite[1] = alloc_fake_suite(test, "suite2", dummy_test_cases); in filter_subsuite_test_glob_test()
81 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered); in filter_subsuite_test_glob_test()
82 free_subsuite_at_end(test, filtered); in filter_subsuite_test_glob_test()
85 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered[0]); in filter_subsuite_test_glob_test()
86 KUNIT_EXPECT_STREQ(test, (const char *)filtered[0]->name, "suite2"); in filter_subsuite_test_glob_test()
87 KUNIT_EXPECT_FALSE(test, filtered[1]); in filter_subsuite_test_glob_test()
90 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered[0]->test_cases); in filter_subsuite_test_glob_test()
91 KUNIT_EXPECT_STREQ(test, (const char *)filtered[0]->test_cases[0].name, "test2"); in filter_subsuite_test_glob_test()
92 KUNIT_EXPECT_FALSE(test, filtered[0]->test_cases[1].name); in filter_subsuite_test_glob_test()
95 static void filter_subsuite_to_empty_test(struct kunit *test) in filter_subsuite_to_empty_test() argument
104 subsuite[0] = alloc_fake_suite(test, "suite1", dummy_test_cases); in filter_subsuite_to_empty_test()
105 subsuite[1] = alloc_fake_suite(test, "suite2", dummy_test_cases); in filter_subsuite_to_empty_test()
108 free_subsuite_at_end(test, filtered); /* just in case */ in filter_subsuite_to_empty_test()
110 KUNIT_EXPECT_FALSE_MSG(test, filtered, in filter_subsuite_to_empty_test()
114 static void kfree_subsuites_at_end(struct kunit *test, struct suite_set *suite_set) in kfree_subsuites_at_end() argument
118 kfree_at_end(test, suite_set->start); in kfree_subsuites_at_end()
120 free_subsuite_at_end(test, *suites); in kfree_subsuites_at_end()
123 static void filter_suites_test(struct kunit *test) in filter_suites_test() argument
143 subsuites[0][0] = alloc_fake_suite(test, "suite0", dummy_test_cases); in filter_suites_test()
144 subsuites[1][0] = alloc_fake_suite(test, "suite1", dummy_test_cases); in filter_suites_test()
148 kfree_subsuites_at_end(test, &filtered); /* let us use ASSERTs without leaking */ in filter_suites_test()
149 KUNIT_EXPECT_EQ(test, err, 0); in filter_suites_test()
150 KUNIT_ASSERT_EQ(test, filtered.end - filtered.start, (ptrdiff_t)1); in filter_suites_test()
152 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered.start); in filter_suites_test()
153 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered.start[0]); in filter_suites_test()
154 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, filtered.start[0][0]); in filter_suites_test()
155 KUNIT_EXPECT_STREQ(test, (const char *)filtered.start[0][0]->name, "suite0"); in filter_suites_test()
184 static void kfree_at_end(struct kunit *test, const void *to_free) in kfree_at_end() argument
189 kunit_alloc_resource(test, NULL, kfree_res_free, GFP_KERNEL, in kfree_at_end()
198 static void free_subsuite_at_end(struct kunit *test, in free_subsuite_at_end() argument
203 kunit_alloc_resource(test, NULL, free_subsuite_res_free, in free_subsuite_at_end()
207 static struct kunit_suite *alloc_fake_suite(struct kunit *test, in alloc_fake_suite() argument
214 suite = kunit_kzalloc(test, sizeof(*suite), GFP_KERNEL); in alloc_fake_suite()