]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[test] Add okx() macro taking an explicit file name and line number
authorMichael Brown <mcb30@ipxe.org>
Fri, 3 Jan 2014 23:35:45 +0000 (00:35 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 6 Jan 2014 02:09:37 +0000 (03:09 +0100)
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>
src/include/ipxe/test.h

index 6b74ff007e776e33c74f1e454bceb84573d6c805..028ee29fbe4c9855b93d2906fb72de4ab6a4899d 100644 (file)
@@ -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 */