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-priority", test_alarm_priority},
17 {"alarm-zero", test_alarm_zero},
18 {"alarm-negative", test_alarm_negative},
19 {"priority-change", test_priority_change},
20 {"priority-donate-one", test_priority_donate_one},
21 {"priority-donate-multiple", test_priority_donate_multiple},
22 {"priority-donate-multiple2", test_priority_donate_multiple2},
23 {"priority-donate-nest", test_priority_donate_nest},
24 {"priority-fifo", test_priority_fifo},
25 {"priority-preempt", test_priority_preempt},
26 {"priority-sema", test_priority_sema},
27 {"priority-condvar", test_priority_condvar},
28 {"mlfqs-load-1", test_mlfqs_load_1},
29 {"mlfqs-load-60", test_mlfqs_load_60},
30 {"mlfqs-load-avg", test_mlfqs_load_avg},
31 {"mlfqs-recent-1", test_mlfqs_recent_1},
32 {"mlfqs-fair-2", test_mlfqs_fair_2},
33 {"mlfqs-fair-20", test_mlfqs_fair_20},
34 {"mlfqs-nice-2", test_mlfqs_nice_2},
35 {"mlfqs-nice-10", test_mlfqs_nice_10},
38 static const char *test_name;
40 /* Runs the test named NAME. */
42 run_test (const char *name)
46 for (t = tests; t < tests + sizeof tests / sizeof *tests; t++)
47 if (!strcmp (name, t->name))
55 PANIC ("no test named \"%s\"", name);
58 /* Prints FORMAT as if with printf(),
59 prefixing the output by the name of the test
60 and following it with a new-line character. */
62 msg (const char *format, ...)
66 printf ("(%s) ", test_name);
67 va_start (args, format);
68 vprintf (format, args);
73 /* Prints failure message FORMAT as if with printf(),
74 prefixing the output by the name of the test and FAIL:
75 and following it with a new-line character,
76 and then panics the kernel. */
78 fail (const char *format, ...)
82 printf ("(%s) FAIL: ", test_name);
83 va_start (args, format);
84 vprintf (format, args);
88 PANIC ("test failed");
91 /* Prints a message indicating the current test passed. */
95 printf ("(%s) PASS\n", test_name);