1 #include "tests/threads/tests.h"
12 static const struct test tests[] =
14 {"alarm-single", test_alarm_single},
15 {"alarm-multiple", test_alarm_multiple},
16 {"alarm-simultaneous", test_alarm_simultaneous},
17 {"alarm-priority", test_alarm_priority},
18 {"alarm-zero", test_alarm_zero},
19 {"alarm-negative", test_alarm_negative},
20 {"priority-change", test_priority_change},
21 {"priority-donate-one", test_priority_donate_one},
22 {"priority-donate-multiple", test_priority_donate_multiple},
23 {"priority-donate-multiple2", test_priority_donate_multiple2},
24 {"priority-donate-nest", test_priority_donate_nest},
25 {"priority-donate-sema", test_priority_donate_sema},
26 {"priority-fifo", test_priority_fifo},
27 {"priority-preempt", test_priority_preempt},
28 {"priority-sema", test_priority_sema},
29 {"priority-condvar", test_priority_condvar},
30 {"mlfqs-load-1", test_mlfqs_load_1},
31 {"mlfqs-load-60", test_mlfqs_load_60},
32 {"mlfqs-load-avg", test_mlfqs_load_avg},
33 {"mlfqs-recent-1", test_mlfqs_recent_1},
34 {"mlfqs-fair-2", test_mlfqs_fair_2},
35 {"mlfqs-fair-20", test_mlfqs_fair_20},
36 {"mlfqs-nice-2", test_mlfqs_nice_2},
37 {"mlfqs-nice-10", test_mlfqs_nice_10},
38 {"mlfqs-block", test_mlfqs_block},
41 static const char *test_name;
43 /* Runs the test named NAME. */
45 run_test (const char *name)
49 for (t = tests; t < tests + sizeof tests / sizeof *tests; t++)
50 if (!strcmp (name, t->name))
58 PANIC ("no test named \"%s\"", name);
61 /* Prints FORMAT as if with printf(),
62 prefixing the output by the name of the test
63 and following it with a new-line character. */
65 msg (const char *format, ...)
69 printf ("(%s) ", test_name);
70 va_start (args, format);
71 vprintf (format, args);
76 /* Prints failure message FORMAT as if with printf(),
77 prefixing the output by the name of the test and FAIL:
78 and following it with a new-line character,
79 and then panics the kernel. */
81 fail (const char *format, ...)
85 printf ("(%s) FAIL: ", test_name);
86 va_start (args, format);
87 vprintf (format, args);
91 PANIC ("test failed");
94 /* Prints a message indicating the current test passed. */
98 printf ("(%s) PASS\n", test_name);