On Tue, Dec 2, 2008 at 6:42 AM, Roy Lee <[EMAIL PROTECTED]> wrote:

> This test case requires write permission for the dummy program. It would
> fail for those who put LTP on an read-only environment. So this patch
> copies the dummy test program to and performs the test in a private
> directory.


Thanks. I would take some time to take care of this.

Regards--
Subrata


>
> p.s. this patch copy the one Renaud Lottiaux sent for execve02.c.
> ---
>  testcases/kernel/syscalls/execve/execve05.c |   47
> +++++++++++++++++++++++++++
>  1 files changed, 47 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/execve/execve05.c
> b/testcases/kernel/syscalls/execve/execve05.c
> index 8952d6f..ec23a43 100644
> --- a/testcases/kernel/syscalls/execve/execve05.c
> +++ b/testcases/kernel/syscalls/execve/execve05.c
> @@ -55,6 +55,7 @@
>  #include <fcntl.h>
>  #include <sys/types.h>
>  #include <sys/wait.h>
> +#include <libgen.h>
>  #include "test.h"
>  #include "usctest.h"
>  #include "libtestsuite.h"
> @@ -212,9 +213,52 @@ help()
>  void
>  setup()
>  {
> +       char *cmd, *dirc, *basec, *bname, *dname, *path, *pwd = NULL;
> +       int res;
> +
>        /* capture signals */
>        tst_sig(FORK, DEF_HANDLER, cleanup);
>
> +       /* Get file name of the passed test file and the absolute path to
> it.
> +        * We will need these informations to copy the test file in the
> temp
> +        * directory.
> +        */
> +       dirc = strdup(test_name);
> +       basec = strdup(test_name);
> +       dname = dirname(dirc);
> +       bname = basename(basec);
> +
> +       if (dname[0] == '/')
> +               path = dname;
> +       else {
> +               if ((pwd = getcwd(NULL, 0)) == NULL) {
> +                       tst_brkm(TBROK, tst_exit, "Could not get current
> directory");
> +               }
> +               path = malloc (strlen(pwd) + strlen(dname) +  2);
> +               if (path == NULL) {
> +                       tst_brkm(TBROK, tst_exit, "Cannot alloc path
> string");
> +               }
> +               sprintf (path, "%s/%s", pwd, dname);
> +       }
> +
> +       /* make a temp dir and cd to it */
> +       tst_tmpdir();
> +
> +       /* Copy the given test file to the private temp directory.
> +       */
> +       cmd = malloc (strlen(path) + strlen(bname) + 15);
> +       if (cmd == NULL){
> +               tst_brkm(TBROK, tst_exit, "Cannot alloc command string");
> +       }
> +
> +       sprintf (cmd, "cp -p %s/%s .", path, bname);
> +       res = system (cmd);
> +       free (cmd);
> +       if (res == -1) {
> +               tst_brkm(TBROK, tst_exit, "Cannot copy file %s",
> test_name);
> +       }
> +
> +       test_name = bname;
>        /* Pause if that option was specified */
>        TEST_PAUSE;
>  }
> @@ -233,6 +277,9 @@ cleanup()
>         */
>        TEST_CLEANUP;
>
> +       /* Remove the temporary directory */
> +       tst_rmdir();
> +
>        /* exit with return code appropriate for results */
>        tst_exit();
>  }
> --
> 1.5.6.5
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>



-- 
Regards & Thanks--
Subrata
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to