Browse Source

[test] Add okx() macro taking an explicit file name and line number

Allow test reports to specify an explicit file name and line number
using the extended okx() macro.  This allows large blocks of test
report code such as tcpip_random_ok() to be implemented as functions
rather than macros.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
23f17f7972
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/include/ipxe/test.h

+ 6
- 3
src/include/ipxe/test.h View File

38
  * Report test result
38
  * Report test result
39
  *
39
  *
40
  * @v success		Test succeeded
40
  * @v success		Test succeeded
41
+ * @v file		File name
42
+ * @v line		Line number
41
  */
43
  */
42
-#define ok( success ) do {					\
43
-	test_ok ( (success), __FILE__, __LINE__, #success );	\
44
-	} while ( 0 )
44
+#define okx( success, file, line ) \
45
+	test_ok ( success, file, line, #success )
46
+#define ok( success ) \
47
+	okx ( success, __FILE__, __LINE__ )
45
 
48
 
46
 #endif /* _IPXE_TEST_H */
49
 #endif /* _IPXE_TEST_H */

Loading…
Cancel
Save