>>> On 3/10/2011 at 02:11 AM, in message <[email protected]>, Peng
Haitao <[email protected]> wrote: 

> waitpid() should be called after kill() in function 
> kill_nested_containers(),
> otherwise the case will suspend.
> 
> exit(status) should be replaced with exit(WEXITSTATUS(status)).
> 
> Signed-off-by: Peng Haitao <[email protected]>
> ---
>  testcases/kernel/containers/pidns/pidns05.c |   16 +++++++---------
>  1 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/testcases/kernel/containers/pidns/pidns05.c 
> b/testcases/kernel/containers/pidns/pidns05.c
> index 8a08dce..9ffc946 100644
> --- a/testcases/kernel/containers/pidns/pidns05.c
> +++ b/testcases/kernel/containers/pidns/pidns05.c
> @@ -186,13 +186,8 @@ void kill_nested_containers()
>  
>       /* Loops through the containers created to exit from sleep() */
>       for (i = 0; i < MAX_DEPTH; i++) {
> -             if (waitpid(pids[i], &status, 0) == -1)
> -                     tst_resm(TFAIL|TERRNO, "waitpid(%d, ...) failed",
> -                         pids[i]);
> -             else {
> -                     kill(pids[i], SIGKILL);
> -                     waitpid(pids[i], &status, 0);
> -             }
> +             kill(pids[i], SIGKILL);
> +             waitpid(pids[i], &status, 0);
>       }
>  }
>  
> @@ -222,7 +217,10 @@ int main(int argc, char *argv[])
>               if (waitpid(pid, &status, 0) == -1) {
>                       perror("wait failed");
>               }
> -             exit(status);
> +             if (WIFEXITED(status))
> +                     exit(WEXITSTATUS(status));
> +             else
> +                     exit(status);
>       }
>  
>       /* To make all the containers share the same PGID as its parent */
> @@ -255,4 +253,4 @@ int main(int argc, char *argv[])
>       cleanup();
>  
>       tst_exit();
> -}
> \ No newline at end of file
> +}


I applied this patch to 20110228 release and the 'containers' test now runs 
without hanging.  There are several 'TBROK' and 'TFAIL' errors, but at least 
the test runs to completion now.

Murlin


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to