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]>
---
 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();

-- 
Dr Louis Rilling                        Kerlabs
Skype: louis.rilling                    Batiment Germanium
Phone: (+33|0) 6 80 89 08 23            80 avenue des Buttes de Coesmes
http://www.kerlabs.com/                 35700 Rennes


-------------------------------------------------------------------------
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