From: Cyril H. <su...@li...> - 2013-01-03 05:56:48
|
The branch, master, has been updated via 38bf6cde3f7b91ed25aeebaae3a1f64664a4b0d4 (commit) via a5eeee9e760c15b653573fed8106a7a5d8761475 (commit) via c19b2108f60458996ef817be4ad533b4c30c1fc3 (commit) from 0ea93795469c7c1364e7f343c21df5745bf3154c (commit) - Log ----------------------------------------------------------------- commit 38bf6cde3f7b91ed25aeebaae3a1f64664a4b0d4 Author: Monson Shao <js...@re...> Date: Wed Dec 26 16:48:37 2012 +0800 pidns16: child should not get parent pid in parent NS parent pid in parent NS is invisible to child, even when child got signalled from parent, the signaller process should be fake parent (PID 0). Signed-off-by: Monson Shao <js...@re...> Signed-off-by: Wanlong Gao <gao...@cn...> commit a5eeee9e760c15b653573fed8106a7a5d8761475 Author: Monson Shao <js...@re...> Date: Wed Dec 26 16:48:36 2012 +0800 pidns16: modified test results The test should result TFAIL if child is signalled from unexpected pid, instead of TBROK. The same as TPASS/TINFO . Signed-off-by: Monson Shao <js...@re...> Signed-off-by: Wanlong Gao <gao...@cn...> commit c19b2108f60458996ef817be4ad533b4c30c1fc3 Author: Monson Shao <js...@re...> Date: Wed Dec 26 16:48:35 2012 +0800 pidns16: split test condition and result judge Make it easy to read. Signed-off-by: Monson Shao <js...@re...> Signed-off-by: Wanlong Gao <gao...@cn...> ----------------------------------------------------------------------- Summary of changes: testcases/kernel/containers/pidns/pidns16.c | 33 +++++++++++++++++--------- 1 files changed, 21 insertions(+), 12 deletions(-) diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c index 8a232c6..3a077c9 100644 --- a/testcases/kernel/containers/pidns/pidns16.c +++ b/testcases/kernel/containers/pidns/pidns16.c @@ -53,8 +53,7 @@ #define PARENT_PID 0 char *TCID = "pidns16"; -int TST_TOTAL = 1; -pid_t globalpid; +int TST_TOTAL = 3; /* * cleanup() - performs all ONE TIME cleanup for this test at @@ -70,17 +69,29 @@ void cleanup() void child_signal_handler(int sig, siginfo_t * si, void *unused) { static int c = 1; + pid_t expected_pid; + /* Verifying from which process the signal handler is signalled */ - if ((c == 1) && (si->si_pid == globalpid)) - tst_resm(TINFO, "sig_handler is signalled from pid %d", - globalpid); - else if ((c == 2) && (si->si_pid == CHILD_PID)) - tst_resm(TINFO, "sig_handler is signalled from pid %d", - CHILD_PID); + switch (c) { + case 1: + expected_pid = PARENT_PID; + break; + case 2: + expected_pid = CHILD_PID; + break; + default: + tst_resm(TBROK, "child should NOT be signalled 3+ times"); + return; + } + + if (si->si_pid == expected_pid) + tst_resm(TPASS, "child is signalled from expected pid %d", + expected_pid); else - tst_resm(TBROK, "Unexpected value for Sending-ProcessID" - " when signal handler called %d\n", si->si_pid); + tst_resm(TFAIL, "child is signalled from unexpected pid %d," + " expecting pid %d", si->si_pid, expected_pid); + c++; } @@ -126,8 +137,6 @@ int main(int argc, char *argv[]) int status; pid_t cpid; - globalpid = getpid(); - cpid = ltp_clone_quick(CLONE_NEWPID | SIGCHLD, child_fn, NULL); if (cpid < 0) { hooks/post-receive -- ltp |