syscalls/keyctl07: new test for oops when reading negative key
Hi!
I've pushed all patches but this one, since it actually looks like a test bug when we oops the kernel since the test gets SIGKILL, which is the same signal the library uses for a timeout:
$ ./keyctl07 tst_test.c:958: INFO: Timeout per run is 0h 05m 00s keyctl07.c:72: INFO: trying to read from the negative key... tst_test.c:1008: INFO: If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 tst_test.c:1009: BROK: Test killed! (timeout?)
Can we, pretty please, run the test in a child process and wait it in the test function and report a failure instead? I fear that kind of test output will confuse people into thinking that this is a test problem rather than a kernel bug.
Signature · 2 lines
Cyril Hrubis [email protected]
Quoted 12 lines · Cyril Hrubis
Hi!
I've pushed all patches but this one, since it actually looks like a test bug when we oops the kernel since the test gets SIGKILL, which is the same signal the library uses for a timeout:$ ./keyctl07 tst_test.c:958: INFO: Timeout per run is 0h 05m 00s keyctl07.c:72: INFO: trying to read from the negative key... tst_test.c:1008: INFO: If you are running on slow machine, try exporting LTP_TIMEOUT_MUL > 1 tst_test.c:1009: BROK: Test killed! (timeout?)
Quoted 5 lines
Can we, pretty please, run the test in a child process and wait it in the test function and report a failure instead? I fear that kind of test output will confuse people into thinking that this is a test problem rather than a kernel bug.
Hi Cyril, I'll send out a new version that does that. But please check that I'm handling the exit status from the child process correctly because I wasn't 100% sure how to do it. (And I'm surprised more tests haven't run into this problem. Maybe there should be something in the library for this, like being able to set '.fail_on_sigkill = 1' in the 'struct tst_test'? Or at least a different version of tst_reap_children().)
Eric
Hi!
Quoted 6 lines
Hi Cyril, I'll send out a new version that does that. But please check that I'm handling the exit status from the child process correctly because I wasn't 100% sure how to do it. (And I'm surprised more tests haven't run into this problem. Maybe there should be something in the library for this, like being able to set '.fail_on_sigkill = 1' in the 'struct
tst_test'? Or at least a different version oftst_reap_children().)
Agree that the current state of the API for waiting child is indeed suboptimal. The problem is that some tests should succeed on SIGKILL, some fail, etc. So the interface would have to be quite flexible. Rather than that I've decided to add new tst_strstatus() function so that we can easily print what happened to the child. With that you can pick the specific cases that should be mapped to TPASS and TFAIL first, then handle the rest with TBROK.
Generally it's supposed to be used as:
SAFE_WAIT(&status);
if (WIFEXITED(status) && WEXITSTATUS(status) = 0) {
tst_res(TPASS, ...);
return;
}
if (WIFSIGNALED(status) && WTERMSIG(status) = SIGKILL) {
tst_res(TFAIL, ...);
return;
}
tst_brk(TBROK, "Child ", tst_strstatus(status);I guess that additional macros that would simplify the if conditions would be helpful as well, something as TST_EXITEDWITH(status, 0) and TST_SIGNALEDBY(status, SIGKILL).
We may as well try some kind of data driven approach with an array of structures describing the exit-status to result mapping, howerever I think that it would be an overkill in this case.
Signature · 2 lines
Cyril Hrubis [email protected]