* [LTP] [PATCH 1/3] pidns16: split test condition and result judge
@ 2012-12-25 7:26 Monson Shao
2012-12-26 6:11 ` Wanlong Gao
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Monson Shao @ 2012-12-25 7:26 UTC (permalink / raw)
To: ltp-list
Make it easy to read.
Signed-off-by: Monson Shao <jshao@redhat.com>
---
testcases/kernel/containers/pidns/pidns16.c | 24 ++++++++++++++++--------
1 个文件被修改,插入 16 行(+),删除 8 行(-)
diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
index 8a232c6..9a1219a 100644
--- a/testcases/kernel/containers/pidns/pidns16.c
+++ b/testcases/kernel/containers/pidns/pidns16.c
@@ -70,17 +70,25 @@ 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);
+ if (c == 1)
+ expected_pid = globalpid;
+ else if (c == 2)
+ expected_pid = CHILD_PID;
+ else {
+ tst_resm(TBROK, "child should NOT be signalled 3+ times");
+ return;
+ }
+
+ if (si->si_pid == expected_pid)
+ tst_resm(TINFO, "child is signalled from pid %d", expected_pid);
else
- tst_resm(TBROK, "Unexpected value for Sending-ProcessID"
- " when signal handler called %d\n", si->si_pid);
+ tst_resm(TBROK, "child is signalled from unexpected pid %d,"
+ " expecting pid %d", si->si_pid, expected_pid);
+
c++;
}
--
1.7.11.7
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCH 1/3] pidns16: split test condition and result judge
2012-12-25 7:26 [LTP] [PATCH 1/3] pidns16: split test condition and result judge Monson Shao
@ 2012-12-26 6:11 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 " Monson Shao
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2012-12-26 6:11 UTC (permalink / raw)
To: Monson Shao; +Cc: ltp-list
On 12/25/2012 03:26 PM, Monson Shao wrote:
> Make it easy to read.
>
> Signed-off-by: Monson Shao <jshao@redhat.com>
> ---
> testcases/kernel/containers/pidns/pidns16.c | 24 ++++++++++++++++--------
> 1 个文件被修改,插入 16 行(+),删除 8 行(-)
>
> diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
> index 8a232c6..9a1219a 100644
> --- a/testcases/kernel/containers/pidns/pidns16.c
> +++ b/testcases/kernel/containers/pidns/pidns16.c
> @@ -70,17 +70,25 @@ 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);
> + if (c == 1)
> + expected_pid = globalpid;
> + else if (c == 2)
> + expected_pid = CHILD_PID;
> + else {
> + tst_resm(TBROK, "child should NOT be signalled 3+ times");
> + return;
> + }
Please add braces in both branches here.
Thanks,
Wanlong Gao
> +
> + if (si->si_pid == expected_pid)
> + tst_resm(TINFO, "child is signalled from pid %d", expected_pid);
> else
> - tst_resm(TBROK, "Unexpected value for Sending-ProcessID"
> - " when signal handler called %d\n", si->si_pid);
> + tst_resm(TBROK, "child is signalled from unexpected pid %d,"
> + " expecting pid %d", si->si_pid, expected_pid);
> +
> c++;
> }
>
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* [LTP] [PATCHv2 1/3] pidns16: split test condition and result judge
2012-12-25 7:26 [LTP] [PATCH 1/3] pidns16: split test condition and result judge Monson Shao
2012-12-26 6:11 ` Wanlong Gao
@ 2012-12-26 8:48 ` Monson Shao
2013-01-03 3:12 ` Wanlong Gao
2013-01-03 3:14 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 2/3] pidns16: modified test results Monson Shao
2012-12-26 8:48 ` [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS Monson Shao
3 siblings, 2 replies; 9+ messages in thread
From: Monson Shao @ 2012-12-26 8:48 UTC (permalink / raw)
To: ltp-list
Make it easy to read.
Signed-off-by: Monson Shao <jshao@redhat.com>
---
testcases/kernel/containers/pidns/pidns16.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
index 8a232c6..04a1641 100644
--- a/testcases/kernel/containers/pidns/pidns16.c
+++ b/testcases/kernel/containers/pidns/pidns16.c
@@ -70,17 +70,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 = globalpid;
+ 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(TINFO, "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(TBROK, "child is signalled from unexpected pid %d,"
+ " expecting pid %d", si->si_pid, expected_pid);
+
c++;
}
--
1.7.11.7
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCHv2 2/3] pidns16: modified test results
2012-12-25 7:26 [LTP] [PATCH 1/3] pidns16: split test condition and result judge Monson Shao
2012-12-26 6:11 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 " Monson Shao
@ 2012-12-26 8:48 ` Monson Shao
2013-01-03 3:12 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS Monson Shao
3 siblings, 1 reply; 9+ messages in thread
From: Monson Shao @ 2012-12-26 8:48 UTC (permalink / raw)
To: ltp-list
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 <jshao@redhat.com>
---
testcases/kernel/containers/pidns/pidns16.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
index 04a1641..debc8d2 100644
--- a/testcases/kernel/containers/pidns/pidns16.c
+++ b/testcases/kernel/containers/pidns/pidns16.c
@@ -53,7 +53,7 @@
#define PARENT_PID 0
char *TCID = "pidns16";
-int TST_TOTAL = 1;
+int TST_TOTAL = 3;
pid_t globalpid;
/*
@@ -87,10 +87,10 @@ void child_signal_handler(int sig, siginfo_t * si, void *unused)
}
if (si->si_pid == expected_pid)
- tst_resm(TINFO, "child is signalled from expected pid %d",
+ tst_resm(TPASS, "child is signalled from expected pid %d",
expected_pid);
else
- tst_resm(TBROK, "child is signalled from unexpected pid %d,"
+ tst_resm(TFAIL, "child is signalled from unexpected pid %d,"
" expecting pid %d", si->si_pid, expected_pid);
c++;
--
1.7.11.7
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS
2012-12-25 7:26 [LTP] [PATCH 1/3] pidns16: split test condition and result judge Monson Shao
` (2 preceding siblings ...)
2012-12-26 8:48 ` [LTP] [PATCHv2 2/3] pidns16: modified test results Monson Shao
@ 2012-12-26 8:48 ` Monson Shao
2013-01-03 3:12 ` Wanlong Gao
3 siblings, 1 reply; 9+ messages in thread
From: Monson Shao @ 2012-12-26 8:48 UTC (permalink / raw)
To: ltp-list
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 <jshao@redhat.com>
---
testcases/kernel/containers/pidns/pidns16.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
index debc8d2..5b8247b 100644
--- a/testcases/kernel/containers/pidns/pidns16.c
+++ b/testcases/kernel/containers/pidns/pidns16.c
@@ -54,7 +54,6 @@
char *TCID = "pidns16";
int TST_TOTAL = 3;
-pid_t globalpid;
/*
* cleanup() - performs all ONE TIME cleanup for this test at
@@ -76,7 +75,7 @@ void child_signal_handler(int sig, siginfo_t * si, void *unused)
switch (c) {
case 1:
- expected_pid = globalpid;
+ expected_pid = PARENT_PID;
break;
case 2:
expected_pid = CHILD_PID;
@@ -138,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) {
--
1.7.11.7
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCHv2 1/3] pidns16: split test condition and result judge
2012-12-26 8:48 ` [LTP] [PATCHv2 " Monson Shao
@ 2013-01-03 3:12 ` Wanlong Gao
2013-01-03 3:14 ` Wanlong Gao
1 sibling, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2013-01-03 3:12 UTC (permalink / raw)
To: Monson Shao; +Cc: ltp-list
On 12/26/2012 04:48 PM, Monson Shao wrote:
> Make it easy to read.
>
> Signed-off-by: Monson Shao <jshao@redhat.com>
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCHv2 2/3] pidns16: modified test results
2012-12-26 8:48 ` [LTP] [PATCHv2 2/3] pidns16: modified test results Monson Shao
@ 2013-01-03 3:12 ` Wanlong Gao
0 siblings, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2013-01-03 3:12 UTC (permalink / raw)
To: Monson Shao; +Cc: ltp-list
On 12/26/2012 04:48 PM, Monson Shao wrote:
> 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 <jshao@redhat.com>
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS
2012-12-26 8:48 ` [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS Monson Shao
@ 2013-01-03 3:12 ` Wanlong Gao
0 siblings, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2013-01-03 3:12 UTC (permalink / raw)
To: Monson Shao; +Cc: ltp-list
On 12/26/2012 04:48 PM, Monson Shao wrote:
> 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 <jshao@redhat.com>
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [LTP] [PATCHv2 1/3] pidns16: split test condition and result judge
2012-12-26 8:48 ` [LTP] [PATCHv2 " Monson Shao
2013-01-03 3:12 ` Wanlong Gao
@ 2013-01-03 3:14 ` Wanlong Gao
1 sibling, 0 replies; 9+ messages in thread
From: Wanlong Gao @ 2013-01-03 3:14 UTC (permalink / raw)
To: Monson Shao; +Cc: ltp-list
On 12/26/2012 04:48 PM, Monson Shao wrote:
> Make it easy to read.
>
> Signed-off-by: Monson Shao <jshao@redhat.com>
> ---
> testcases/kernel/containers/pidns/pidns16.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/testcases/kernel/containers/pidns/pidns16.c b/testcases/kernel/containers/pidns/pidns16.c
> index 8a232c6..04a1641 100644
> --- a/testcases/kernel/containers/pidns/pidns16.c
> +++ b/testcases/kernel/containers/pidns/pidns16.c
> @@ -70,17 +70,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 = globalpid;
> + break;
> + case 2:
> + expected_pid = CHILD_PID;
> + break;
> + default:
> + tst_resm(TBROK, "child should NOT be signalled 3+ times");
> + return;
These two lines added spaces before TAB, I edit on site, please take care next time.
Thanks,
Wanlong Gao
> + }
> +
> + if (si->si_pid == expected_pid)
> + tst_resm(TINFO, "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(TBROK, "child is signalled from unexpected pid %d,"
> + " expecting pid %d", si->si_pid, expected_pid);
> +
> c++;
> }
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-03 3:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-25 7:26 [LTP] [PATCH 1/3] pidns16: split test condition and result judge Monson Shao
2012-12-26 6:11 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 " Monson Shao
2013-01-03 3:12 ` Wanlong Gao
2013-01-03 3:14 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 2/3] pidns16: modified test results Monson Shao
2013-01-03 3:12 ` Wanlong Gao
2012-12-26 8:48 ` [LTP] [PATCHv2 3/3] pidns16: child should not get parent pid in parent NS Monson Shao
2013-01-03 3:12 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox