Lines Matching refs:test
42 static void print_test_preamble(const struct scx_test *test, bool quiet) in print_test_preamble() argument
45 printf("TEST: %s\n", test->name); in print_test_preamble()
47 printf("DESCRIPTION: %s\n", test->description); in print_test_preamble()
64 static void print_test_result(const struct scx_test *test, in print_test_result() argument
71 printf("%s %u %s # %s\n", result, testnum, test->name, directive); in print_test_result()
75 static bool should_skip_test(const struct scx_test *test, const char * filter) in should_skip_test() argument
77 return !strstr(test->name, filter); in should_skip_test()
80 static enum scx_test_status run_test(const struct scx_test *test) in run_test() argument
85 if (test->setup) { in run_test()
86 status = test->setup(&context); in run_test()
91 status = test->run(context); in run_test()
93 if (test->cleanup) in run_test()
94 test->cleanup(context); in run_test()
99 static bool test_valid(const struct scx_test *test) in test_valid() argument
101 if (!test) { in test_valid()
106 if (!test->name) { in test_valid()
112 if (!test->description) { in test_valid()
113 fprintf(stderr, "Test %s requires description.\n", test->name); in test_valid()
117 if (!test->run) { in test_valid()
118 fprintf(stderr, "Test %s has no run() callback\n", test->name); in test_valid()
159 struct scx_test *test = &__scx_tests[i]; in main() local
162 printf("%s\n", test->name); in main()
168 if (filter && should_skip_test(test, filter)) { in main()
176 print_test_preamble(test, quiet); in main()
177 print_test_result(test, SCX_TEST_SKIP, ++testnum); in main()
182 print_test_preamble(test, quiet); in main()
183 status = run_test(test); in main()
184 print_test_result(test, status, ++testnum); in main()
206 void scx_test_register(struct scx_test *test) in scx_test_register() argument
208 SCX_BUG_ON(!test_valid(test), "Invalid test found"); in scx_test_register()
211 __scx_tests[__scx_num_tests++] = *test; in scx_test_register()