mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
zdtm/stopped: fix stopped test
The main problem with the test that it's never 'fail'. Test can only 'pass' or hangs. Signed-off-by: Konstantin Neumoin <kneumoin@parallels.com> Acked-by: Andrew Vagin <avagin@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
ffe3d5cfda
commit
c4a06a2a26
@@ -33,35 +33,42 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
ret = read(p[0], &c, 1);
|
||||
if (ret != 0) {
|
||||
err("Unable to read: %d", ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
close(p[0]);
|
||||
|
||||
kill(pid, SIGSTOP);
|
||||
|
||||
write(p[1], "0", 1);
|
||||
close(p[1]);
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
kill(pid, SIGCONT);
|
||||
if (waitpid(pid, &status, WCONTINUED) == -1) {
|
||||
// Return immediately if child run or stopped(by SIGSTOP)
|
||||
if (waitpid(pid, &status, WUNTRACED | WCONTINUED) == -1) {
|
||||
err("Unable to wait child");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (WIFCONTINUED(status))
|
||||
if (WIFSTOPPED(status))
|
||||
test_msg("The procces stopped\n");
|
||||
else{
|
||||
fail("The process doesn't stopped");
|
||||
goto out;
|
||||
}
|
||||
|
||||
kill(pid, SIGCONT);
|
||||
|
||||
if (waitpid(pid, &status, 0) == -1) {
|
||||
err("Unable to wait child");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (WIFEXITED(status))
|
||||
pass();
|
||||
else
|
||||
fail("The process doesn't continue");
|
||||
out:
|
||||
close(p[1]);
|
||||
waitpid(pid, &status, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user