[CRIU] [RFC PATCHv2 28/32] zdtm: lib: write our own assert()

Ivan Shapovalov intelfx at intelfx.name
Sat Mar 12 00:42:27 PST 2016


Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
---
 test/zdtm/lib/zdtmtst.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index 57ebba2..5b3a0c8 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -128,6 +128,19 @@ extern int zdtm_seccomp;
 		 __FILE__, __LINE__, ## arg)
 #define pass()	test_msg("PASS\n")
 
+#ifndef NDEBUG
+#define assert(expr) \
+	do { \
+		if (!(expr)) { \
+			pr_err("Assertion failed: " #expr "\n"); \
+			abort(); \
+		} \
+	} while (0)
+#else
+#define assert(expr) \
+	do { } while (0)
+#endif
+
 typedef struct {
 	unsigned long	seed;
 	int		pipes[2];
-- 
2.7.2



More information about the CRIU mailing list