瀏覽代碼

[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 年之前
父節點
當前提交
23f17f7972
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6
    3
      src/include/ipxe/test.h

+ 6
- 3
src/include/ipxe/test.h 查看文件

@@ -38,9 +38,12 @@ extern void test_ok ( int success, const char *file, unsigned int line,
38 38
  * Report test result
39 39
  *
40 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 49
 #endif /* _IPXE_TEST_H */

Loading…
取消
儲存