Commit c4a06a2a authored by Konstantin Neumoin's avatar Konstantin Neumoin Committed by Pavel Emelyanov

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: 's avatarKonstantin Neumoin <kneumoin@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ffe3d5cf
......@@ -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();
// Return immediately if child run or stopped(by SIGSTOP)
if (waitpid(pid, &status, WUNTRACED | WCONTINUED) == -1) {
err("Unable to wait child");
goto out;
}
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, WCONTINUED) == -1) {
if (waitpid(pid, &status, 0) == -1) {
err("Unable to wait child");
goto out;
}
if (WIFCONTINUED(status))
if (WIFEXITED(status))
pass();
else
fail("The process doesn't continue");
out:
close(p[1]);
waitpid(pid, &status, 0);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment