Remove list_iterate usage tests/

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-26 19:35:34 +01:00
parent 3f8ae91c09
commit 41e1209827
2 changed files with 11 additions and 21 deletions

View file

@ -134,23 +134,17 @@ grub_test_unregister (const char *name)
int int
grub_test_run (grub_test_t test) grub_test_run (grub_test_t test)
{ {
auto int print_failure (grub_test_failure_t item); grub_test_failure_t failure;
int print_failure (grub_test_failure_t item)
{
grub_test_failure_t failure = (grub_test_failure_t) item;
grub_printf (" %s:%s:%u: %s\n",
(failure->file ? : "<unknown_file>"),
(failure->funp ? : "<unknown_function>"),
failure->line, (failure->message ? : "<no message>"));
return 0;
}
test->main (); test->main ();
grub_printf ("%s:\n", test->name); grub_printf ("%s:\n", test->name);
grub_list_iterate (GRUB_AS_LIST (failure_list), FOR_LIST_ELEMENTS (failure, failure_list)
(grub_list_hook_t) print_failure); grub_printf (" %s:%s:%u: %s\n",
(failure->file ? : "<unknown_file>"),
(failure->funp ? : "<unknown_function>"),
failure->line, (failure->message ? : "<no message>"));
if (!failure_list) if (!failure_list)
grub_printf ("%s: PASS\n", test->name); grub_printf ("%s: PASS\n", test->name);
else else

View file

@ -34,16 +34,12 @@ main (int argc __attribute__ ((unused)),
extern void grub_unit_test_init (void); extern void grub_unit_test_init (void);
extern void grub_unit_test_fini (void); extern void grub_unit_test_fini (void);
auto int run_test (grub_test_t test); grub_test_t test;
int run_test (grub_test_t test)
{
status = grub_test_run (test) ? : status;
return 0;
}
grub_unit_test_init (); grub_unit_test_init ();
grub_list_iterate (GRUB_AS_LIST (grub_test_list), FOR_LIST_ELEMENTS (test, grub_test_list)
(grub_list_hook_t) run_test); status = grub_test_run (test) ? : status;
grub_unit_test_fini (); grub_unit_test_fini ();
exit (status); exit (status);