Przeglądaj źródła

[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 lat temu
rodzic
commit
23f17f7972
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6
    3
      src/include/ipxe/test.h

+ 6
- 3
src/include/ipxe/test.h Wyświetl plik

@@ -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 */

Ładowanie…
Anuluj
Zapisz