~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/include/ipxe/test.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _IPXE_TEST_H
 
2
#define _IPXE_TEST_H
 
3
 
 
4
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 
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 */