mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
zdtm: return non-zero code in a error case
Signed-off-by: Andrew Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
4e5e106778
commit
ae6294f4d2
@@ -189,15 +189,18 @@ void test_init(int argc, char **argv)
|
||||
|
||||
if (futex_get(&sig_received) == SIGCHLD) {
|
||||
int ret;
|
||||
waitpid(pid, &ret, 0);
|
||||
if (waitpid(pid, &ret, 0) != pid) {
|
||||
pr_perror("Unable to wait %d, pid");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (WIFEXITED(ret)) {
|
||||
pr_perror("Test exited unexpectedly with code %d", WEXITSTATUS(ret));
|
||||
exit(0);
|
||||
pr_err("Test exited unexpectedly with code %d\n", WEXITSTATUS(ret));
|
||||
exit(1);
|
||||
}
|
||||
if (WIFSIGNALED(ret)) {
|
||||
pr_perror("Test exited on unexpected signal %d", WTERMSIG(ret));
|
||||
exit(0);
|
||||
pr_err("Test exited on unexpected signal %d\n", WTERMSIG(ret));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,15 +324,18 @@ void test_init_ns(int argc, char **argv, unsigned long clone_flags,
|
||||
|
||||
if (futex_get(&sig_received) == SIGCHLD) {
|
||||
int ret;
|
||||
waitpid(pid, &ret, 0);
|
||||
if (waitpid(pid, &ret, 0) != pid) {
|
||||
pr_perror("Unable to wait %d", pid);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (WIFEXITED(ret)) {
|
||||
pr_perror("Test exited unexpectedly with code %d", WEXITSTATUS(ret));
|
||||
exit(0);
|
||||
pr_err("Test exited unexpectedly with code %d\n", WEXITSTATUS(ret));
|
||||
exit(1);
|
||||
}
|
||||
if (WIFSIGNALED(ret)) {
|
||||
pr_perror("Test exited on unexpected signal %d", WTERMSIG(ret));
|
||||
exit(0);
|
||||
pr_err("Test exited on unexpected signal %d\n", WTERMSIG(ret));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -102,6 +102,8 @@ extern int parse_opt_string(char *param, void *arg);
|
||||
extern void setup_outfile(void);
|
||||
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))
|
||||
|
Reference in New Issue
Block a user