public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] pidns17 testcase bugfix/cleanup
@ 2009-06-17 23:26 Sukadev Bhattiprolu
  2009-06-18 17:31 ` Subrata Modak
  0 siblings, 1 reply; 2+ messages in thread
From: Sukadev Bhattiprolu @ 2009-06-17 23:26 UTC (permalink / raw)
  To: subrata; +Cc: mohankumar, ssant, sukadev, ltp-list


Fix minor bugs in the test case that cause the test to fail intermittently.
Also, print more debug info when test fails.

This fixes a bug reported by Sachin P. Sant.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
 testcases/kernel/containers/pidns/pidns17.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Index: ltp-full-20090331/testcases/kernel/containers/pidns/pidns17.c
===================================================================
--- ltp-full-20090331.orig/testcases/kernel/containers/pidns/pidns17.c	2009-06-10 23:52:44.022094621 -0700
+++ ltp-full-20090331/testcases/kernel/containers/pidns/pidns17.c	2009-06-11 00:09:37.454753439 -0700
@@ -74,8 +74,10 @@ int child_fn(void *arg)
 
 	/* Spawn many children */
 	for (i = 0; i < 10; i++)
-		if ((children[i] = fork()) == 0)
-			sleep(10);
+		if ((children[i] = fork()) == 0) {
+			pause();
+			exit(2);
+		}
 
 	/* wait for last child to get scheduled */
 	sleep(1);
@@ -86,13 +88,16 @@ int child_fn(void *arg)
 	}
 
 	for (i = 0; i < 10; i++) {
-		if (waitpid(children[i], &status, WNOHANG) == -1) {
+		if (waitpid(children[i], &status, 0) == -1) {
 			tst_resm(TBROK, "cinit: waitpid() failed(%s)",\
 					strerror(errno));
 			cleanup();
 		}
-		if (!(WIFSIGNALED(&status) && WTERMSIG(status) == SIGUSR1)) {
-			tst_resm(TFAIL, "cinit: found a child alive still.");
+		if (!(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1)) {
+			tst_resm(TFAIL, "cinit: found a child alive still "
+					"%d exit: %d, %d, signal %d, %d", i,
+					WIFEXITED(status), WEXITSTATUS(status),
+					WIFSIGNALED(status), WTERMSIG(status));
 			cleanup();
 		}
 	}
@@ -125,7 +130,7 @@ int main(int argc, char *argv[])
 	}
 
 	sleep(1);
-	if (wait(&status) < 0)
+	if (waitpid(-1, &status, __WALL) < 0)
 		tst_resm(TWARN, "parent: waitpid() failed.");
 
 	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH] pidns17 testcase bugfix/cleanup
  2009-06-17 23:26 [LTP] [PATCH] pidns17 testcase bugfix/cleanup Sukadev Bhattiprolu
@ 2009-06-18 17:31 ` Subrata Modak
  0 siblings, 0 replies; 2+ messages in thread
From: Subrata Modak @ 2009-06-18 17:31 UTC (permalink / raw)
  To: Sukadev Bhattiprolu; +Cc: mohankumar, ssant, ltp-list

On Wed, 2009-06-17 at 16:26 -0700, Sukadev Bhattiprolu wrote: 
> Fix minor bugs in the test case that cause the test to fail intermittently.
> Also, print more debug info when test fails.
> 
> This fixes a bug reported by Sachin P. Sant.
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>

Thanks. Merged.

Regards--
Subrata

> ---
>  testcases/kernel/containers/pidns/pidns17.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> Index: ltp-full-20090331/testcases/kernel/containers/pidns/pidns17.c
> ===================================================================
> --- ltp-full-20090331.orig/testcases/kernel/containers/pidns/pidns17.c	2009-06-10 23:52:44.022094621 -0700
> +++ ltp-full-20090331/testcases/kernel/containers/pidns/pidns17.c	2009-06-11 00:09:37.454753439 -0700
> @@ -74,8 +74,10 @@ int child_fn(void *arg)
> 
>  	/* Spawn many children */
>  	for (i = 0; i < 10; i++)
> -		if ((children[i] = fork()) == 0)
> -			sleep(10);
> +		if ((children[i] = fork()) == 0) {
> +			pause();
> +			exit(2);
> +		}
> 
>  	/* wait for last child to get scheduled */
>  	sleep(1);
> @@ -86,13 +88,16 @@ int child_fn(void *arg)
>  	}
> 
>  	for (i = 0; i < 10; i++) {
> -		if (waitpid(children[i], &status, WNOHANG) == -1) {
> +		if (waitpid(children[i], &status, 0) == -1) {
>  			tst_resm(TBROK, "cinit: waitpid() failed(%s)",\
>  					strerror(errno));
>  			cleanup();
>  		}
> -		if (!(WIFSIGNALED(&status) && WTERMSIG(status) == SIGUSR1)) {
> -			tst_resm(TFAIL, "cinit: found a child alive still.");
> +		if (!(WIFSIGNALED(status) && WTERMSIG(status) == SIGUSR1)) {
> +			tst_resm(TFAIL, "cinit: found a child alive still "
> +					"%d exit: %d, %d, signal %d, %d", i,
> +					WIFEXITED(status), WEXITSTATUS(status),
> +					WIFSIGNALED(status), WTERMSIG(status));
>  			cleanup();
>  		}
>  	}
> @@ -125,7 +130,7 @@ int main(int argc, char *argv[])
>  	}
> 
>  	sleep(1);
> -	if (wait(&status) < 0)
> +	if (waitpid(-1, &status, __WALL) < 0)
>  		tst_resm(TWARN, "parent: waitpid() failed.");
> 
>  	if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-18 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17 23:26 [LTP] [PATCH] pidns17 testcase bugfix/cleanup Sukadev Bhattiprolu
2009-06-18 17:31 ` Subrata Modak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox