summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2014-01-04 00:35:45 +0100
committerMichael Brown2014-01-06 03:09:37 +0100
commit23f17f7972c34fc96249ffd2d58004ab048dcba0 (patch)
tree2a305f3a9d5cb108e917c86169e4a7454197606a
parent[libc] Add isprint() (diff)
downloadipxe-23f17f7972c34fc96249ffd2d58004ab048dcba0.tar.gz
ipxe-23f17f7972c34fc96249ffd2d58004ab048dcba0.tar.xz
ipxe-23f17f7972c34fc96249ffd2d58004ab048dcba0.zip
[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>
-rw-r--r--src/include/ipxe/test.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/include/ipxe/test.h b/src/include/ipxe/test.h
index 6b74ff007..028ee29fb 100644
--- a/src/include/ipxe/test.h
+++ b/src/include/ipxe/test.h
@@ -38,9 +38,12 @@ extern void test_ok ( int success, const char *file, unsigned int line,
* Report test result
*
* @v success Test succeeded
+ * @v file File name
+ * @v line Line number
*/
-#define ok( success ) do { \
- test_ok ( (success), __FILE__, __LINE__, #success ); \
- } while ( 0 )
+#define okx( success, file, line ) \
+ test_ok ( success, file, line, #success )
+#define ok( success ) \
+ okx ( success, __FILE__, __LINE__ )
#endif /* _IPXE_TEST_H */