Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2022-04-16 01:46:34 +0300
committerAndrei Vagin <avagin@gmail.com>2022-08-23 03:05:34 +0300
commitedb3e522657971caa7efe0050bb58d6fe2969109 (patch)
tree31bbc94f2c020f8783e10906ffd1fd4421c52f6c
parent6e35c5922e4dc689ff6f6ee5eba8e1013a875e8a (diff)
zdtm: return 1 from pr_err, pr_perror, fail
This allows to make test code more compact: if (ret == -1) { pr_perror("XXX"); return 1; } vs if (ret == -1) return pr_perror("XXX"); Signed-off-by: Andrei Vagin <avagin@gmail.com>
-rw-r--r--test/zdtm/lib/zdtmtst.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index ed7c23ee2..d91886d25 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -126,11 +126,25 @@ extern int write_pidfile(int pid);
/* message helpers */
extern int test_log_init(const char *outfile, const char *suffix);
extern int zdtm_seccomp;
-#define pr_err(format, arg...) test_msg("ERR: %s:%d: " format, __FILE__, __LINE__, ##arg)
-#define pr_perror(format, arg...) \
- test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno))
-#define fail(format, arg...) \
- test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, strerror(errno))
+#define pr_err(format, arg...) \
+ ({ \
+ test_msg("ERR: %s:%d: " format, __FILE__, __LINE__, ##arg); \
+ 1; \
+ })
+
+#define pr_perror(format, arg...) \
+ ({ \
+ test_msg("ERR: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, \
+ strerror(errno)); \
+ 1; \
+ })
+
+#define fail(format, arg...) \
+ ({ \
+ test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", __FILE__, __LINE__, ##arg, errno, \
+ strerror(errno)); \
+ 1; \
+ })
#define skip(format, arg...) test_msg("SKIP: %s:%d: " format "\n", __FILE__, __LINE__, ##arg)
#define pass() test_msg("PASS\n")