On Mon, 2008-06-02 at 17:11 +0200, Louis Rilling wrote:
> plain text document attachment
> (execve05-make-execve-success-report-explicit-error.patch)
> execve05 checks that execve() fails if a process has opened the file with 
> write
> access. However, in case the test fails and execve() succeeds, the default
> binary (test3) has return code 0, which is interpreted as test success. We get
> output like that:
> 
> <output>
> Hello World
> </output>
> with return code 0 (success)
> 
> instead of:
> 
> <output>
> execve05    1  FAIL  :  Failures reported above
> </output>
> with return code matching FAIL.
> 
> This patch simply changes the success return code from 0 to 3, so that 
> execve()
> success, and thus test failure, can be properly reported.
> 
> Signed-off-by: Louis Rilling <[EMAIL PROTECTED]>
Applied.

Regards--
Subrata
> ---
>  testcases/kernel/syscalls/execve/execve05.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> Index: b/testcases/kernel/syscalls/execve/execve05.c
> ===================================================================
> --- a/testcases/kernel/syscalls/execve/execve05.c     2008-06-02 
> 14:20:50.000000000 +0200
> +++ b/testcases/kernel/syscalls/execve/execve05.c     2008-06-02 
> 15:21:04.000000000 +0200
> @@ -87,7 +87,7 @@ main(int ac, char **av)
>       int lc;                         /* loop counter */
>       char *msg;                      /* message returned from parse_opts */
>       pid_t pid, pid1;
> -     int e_code, status, retval=0;
> +     int e_code, status, retval=3;
>       char *argv[1], *env[1];
> 
>       /* parse standard options */
> @@ -174,7 +174,11 @@ main(int ac, char **av)
>                          waitpid(pid1,&status,0);
>                          /* make sure the child returned a good exit status */
>                          e_code = status >> 8;
> -                        if ((e_code != 0) || (retval != 0)) {
> +                     /* If execve() succeeds, child cannot report the error 
> */
> +                     if (status == 0)
> +                             tst_resm(TFAIL, "execve succeeded, "
> +                                      "expected failure");
> +                        if ((e_code != 3) || (retval != 3)) {
>                            tst_resm(TFAIL, "Failures reported above");
>                          }
>                       cleanup();
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to