mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
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>
This commit is contained in:
parent
6e35c5922e
commit
edb3e52265
1 changed files with 19 additions and 5 deletions
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue