Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / test.h
1 #ifndef _IPXE_TEST_H
2 #define _IPXE_TEST_H
3
4 FILE_LICENCE ( GPL2_OR_LATER );
5
6 /** @file
7  *
8  * Self-test infrastructure
9  *
10  */
11
12 #include <ipxe/tables.h>
13
14 /** A self-test set */
15 struct self_test {
16         /** Test set name */
17         const char *name;
18         /** Run self-tests */
19         void ( * exec ) ( void );
20         /** Number of tests run */
21         unsigned int total;
22         /** Number of test failures */
23         unsigned int failures;
24         /** Number of assertion failures */
25         unsigned int assertion_failures;
26 };
27
28 /** Self-test table */
29 #define SELF_TESTS __table ( struct self_test, "self_tests" )
30
31 /** Declare a self-test */
32 #define __self_test __table_entry ( SELF_TESTS, 01 )
33
34 extern void test_ok ( int success, const char *file, unsigned int line,
35                       const char *test );
36
37 /**
38  * Report test result
39  *
40  * @v success           Test succeeded
41  * @v file              File name
42  * @v line              Line number
43  */
44 #define okx( success, file, line ) \
45         test_ok ( success, file, line, #success )
46 #define ok( success ) \
47         okx ( success, __FILE__, __LINE__ )
48
49 #endif /* _IPXE_TEST_H */