]> git.ipfire.org Git - thirdparty/glibc.git/blob - posix/tst-execvp3.c
tst-gnuglob64: New test for glob64 based on tst-gnuglob
[thirdparty/glibc.git] / posix / tst-execvp3.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <unistd.h>
5 #include <sys/stat.h>
6
7
8 static void do_prepare (void);
9 #define PREPARE(argc, argv) do_prepare ()
10 static int do_test (void);
11 #define TEST_FUNCTION do_test ()
12
13 #include "../test-skeleton.c"
14
15 #ifndef EXECVP
16 # define EXECVP(file, argv) execvp (file, argv)
17 #endif
18
19 static char *fname;
20
21 static void
22 do_prepare (void)
23 {
24 int fd = create_temp_file ("testscript", &fname);
25 dprintf (fd, "echo foo\n");
26 fchmod (fd, 0700);
27 close (fd);
28 }
29
30
31 static int
32 do_test (void)
33 {
34 if (setenv ("PATH", test_dir, 1) != 0)
35 {
36 puts ("setenv failed");
37 return 1;
38 }
39
40 char *argv[] = { fname, NULL };
41 EXECVP (basename (fname), argv);
42
43 /* If we come here, the execvp call failed. */
44 return 1;
45 }