diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-08-25 08:33:35 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-08-25 08:34:45 -0400 |
commit | eafd6ec70693c18c4dd264ac65ce0b236057c7e3 (patch) | |
tree | e7ddad782c2e829c47aa042653241ce283ceb9ea | |
parent | fix minor regression in config.status output (diff) | |
download | sandbox-eafd6ec70693c18c4dd264ac65ce0b236057c7e3.tar.gz sandbox-eafd6ec70693c18c4dd264ac65ce0b236057c7e3.tar.bz2 sandbox-eafd6ec70693c18c4dd264ac65ce0b236057c7e3.zip |
tests: fix vfork-1 failurev2.1
The vfork-1 test was a little broken and didn't test the results quite
right.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/sb_true.c | 1 | ||||
-rw-r--r-- | tests/sb_true_static.c | 1 | ||||
-rw-r--r-- | tests/vfork-0.c | 12 | ||||
-rwxr-xr-x | tests/vfork-1.sh | 2 |
7 files changed, 17 insertions, 6 deletions
@@ -64,6 +64,8 @@ core /tests/atlocal /tests/get-group /tests/get-user +/tests/sb_true +/tests/sb_true_static /tests/package.m4 /tests/testsuite /tests/testsuite.dir/ @@ -24,3 +24,6 @@ threaded apps conflict with shared state: - sandbox_on - trace_pid - etc... + +doesnt seem to work quite right: + echo $(./vfork-0 ./mkdir_static-0 2>&1) diff --git a/tests/Makefile.am b/tests/Makefile.am index 51f2800..a5ebd8b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,6 +10,8 @@ AM_CPPFLAGS = -I$(top_srcdir) check_PROGRAMS = \ get-group \ get-user \ + sb_true \ + sb_true_static \ \ access-0 \ chmod-0 \ diff --git a/tests/sb_true.c b/tests/sb_true.c new file mode 100644 index 0000000..2c99a52 --- /dev/null +++ b/tests/sb_true.c @@ -0,0 +1 @@ +int main(){return 0;} diff --git a/tests/sb_true_static.c b/tests/sb_true_static.c new file mode 100644 index 0000000..9d9cdfb --- /dev/null +++ b/tests/sb_true_static.c @@ -0,0 +1 @@ +#include "sb_true.c" diff --git a/tests/vfork-0.c b/tests/vfork-0.c index bdfe540..5924357 100644 --- a/tests/vfork-0.c +++ b/tests/vfork-0.c @@ -2,7 +2,6 @@ int main(int argc, char *argv[]) { - int ret = 0; size_t i; if (argc == 1) { @@ -27,14 +26,17 @@ int main(int argc, char *argv[]) errp("vfork() failed"); case 0: - _exit(execvp(new_argv[0], new_argv)); + execvp(new_argv[0], new_argv); + errp("execvp() failed"); default: { int status; if (wait(&status) == -1) - ret |= 1; - else if (!WIFEXITED(status) || WEXITSTATUS(status)) - ret |= 1; + errp("wait() failed"); + else if (!WIFEXITED(status)) + err("child did not exit properly"); + else if (WEXITSTATUS(status)) + err("child exited with %i", WEXITSTATUS(status)); } } } diff --git a/tests/vfork-1.sh b/tests/vfork-1.sh index c53cdca..0f3381a 100755 --- a/tests/vfork-1.sh +++ b/tests/vfork-1.sh @@ -5,7 +5,7 @@ trace-0 ; test $? -eq 77 && exit 77 # the exact binary we run doesnt matter, it just needs to be # static so that the trace code works -output=$(vfork-0 openat_static-0 openat_static-0 openat_static-0 2>&1) +output=$(vfork-0 sb_true_static sb_true_static sb_true_static 2>&1 || echo fail) echo "$output" exec test -z "$output" |