GRUB-1.98 changes
[grub2/jjazz.git] / tests / lib / unit_test.c
blobe461150deec8386725da2c3ebf670915387a7a34
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <stdarg.h>
22 #include <string.h>
24 #include <grub/list.h>
25 #include <grub/test.h>
26 #include <grub/handler.h>
28 int
29 main (int argc __attribute__ ((unused)),
30 char *argv[] __attribute__ ((unused)))
32 int status = 0;
34 extern void grub_unit_test_init (void);
35 extern void grub_unit_test_fini (void);
37 auto int run_test (grub_test_t test);
38 int run_test (grub_test_t test)
40 status = grub_test_run (test) ? : status;
41 return 0;
44 grub_unit_test_init ();
45 grub_list_iterate (GRUB_AS_LIST (grub_test_list),
46 (grub_list_hook_t) run_test);
47 grub_unit_test_fini ();
49 exit (status);
52 /* Other misc. functions necessary for successful linking. */
54 void
55 grub_free (void *ptr)
57 free (ptr);
60 char *
61 grub_env_get (const char *name __attribute__ ((unused)))
63 return NULL;
66 grub_err_t
67 grub_error (grub_err_t n, const char *fmt, ...)
69 va_list ap;
71 va_start (ap, fmt);
72 vfprintf (stderr, fmt, ap);
73 va_end (ap);
75 return n;
78 void *
79 grub_malloc (grub_size_t size)
81 return malloc (size);
84 void
85 grub_refresh (void)
87 fflush (stdout);
90 void
91 grub_putchar (int c)
93 putchar (c);
96 int
97 grub_getkey (void)
99 return -1;
102 void
103 grub_exit (void)
105 exit (1);
108 struct grub_handler_class grub_term_input_class;
109 struct grub_handler_class grub_term_output_class;