[CRIU] [RFC PATCH 16/21] zdtm: write our own assert()

Ivan Shapovalov intelfx at intelfx.name
Fri Feb 19 06:50:39 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 37bc0e9..1ccc2f2 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -126,6 +126,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.1



More information about the CRIU mailing list