Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / test.h
blobb83bdb14ee0bbcf35a35da340a64a71a1aea4ec3
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 #ifndef GRUB_TEST_HEADER
20 #define GRUB_TEST_HEADER
22 #include <grub/dl.h>
23 #include <grub/list.h>
24 #include <grub/misc.h>
25 #include <grub/types.h>
26 #include <grub/symbol.h>
28 #include <grub/video.h>
29 #include <grub/video_fb.h>
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 struct grub_test
37 /* The next test. */
38 struct grub_test *next;
39 struct grub_test **prev;
41 /* The test name. */
42 char *name;
44 /* The test main function. */
45 void (*main) (void);
47 typedef struct grub_test *grub_test_t;
49 extern grub_test_t grub_test_list;
51 void grub_test_register (const char *name, void (*test) (void));
52 void grub_test_unregister (const char *name);
54 /* Execute a test and print results. */
55 int grub_test_run (grub_test_t test);
57 /* Test `cond' for nonzero; log failure otherwise. */
58 void grub_test_nonzero (int cond, const char *file,
59 const char *func, grub_uint32_t line,
60 const char *fmt, ...)
61 __attribute__ ((format (GNU_PRINTF, 5, 6)));
63 /* Macro to fill in location details and an optional error message. */
64 void grub_test_assert_helper (int cond, const char *file,
65 const char *func, grub_uint32_t line,
66 const char *condstr, const char *fmt, ...)
67 __attribute__ ((format (GNU_PRINTF, 6, 7)));
69 #define grub_test_assert(cond, ...) \
70 grub_test_assert_helper(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
71 #cond, ## __VA_ARGS__);
73 void grub_unit_test_init (void);
74 void grub_unit_test_fini (void);
76 /* Macro to define a unit test. */
77 #define GRUB_UNIT_TEST(name, funp) \
78 void grub_unit_test_init (void) \
79 { \
80 grub_test_register (name, funp); \
81 } \
83 void grub_unit_test_fini (void) \
84 { \
85 grub_test_unregister (name); \
88 /* Macro to define a functional test. */
89 #define GRUB_FUNCTIONAL_TEST(name, funp) \
90 GRUB_MOD_INIT(name) \
91 { \
92 grub_test_register (#name, funp); \
93 } \
95 GRUB_MOD_FINI(name) \
96 { \
97 grub_test_unregister (#name); \
100 void
101 grub_video_checksum (const char *basename_in);
102 void
103 grub_video_checksum_end (void);
104 void
105 grub_terminal_input_fake_sequence (int *seq_in, int nseq_in);
106 void
107 grub_terminal_input_fake_sequence_end (void);
108 const char *
109 grub_video_checksum_get_modename (void);
112 #define GRUB_TEST_VIDEO_SMALL_N_MODES 7
113 #define GRUB_TEST_VIDEO_ALL_N_MODES 31
115 extern struct grub_video_mode_info grub_test_video_modes[GRUB_TEST_VIDEO_ALL_N_MODES];
118 grub_test_use_gfxterm (void);
119 void grub_test_use_gfxterm_end (void);
121 #ifdef __cplusplus
123 #endif
125 #endif /* ! GRUB_TEST_HEADER */