aboutsummaryrefslogtreecommitdiffstats
path: root/test/test-reexec-chroot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-reexec-chroot.sh')
-rwxr-xr-xtest/test-reexec-chroot.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test-reexec-chroot.sh b/test/test-reexec-chroot.sh
new file mode 100755
index 0000000..bde93f1
--- /dev/null
+++ b/test/test-reexec-chroot.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Test if we re-invoke pseudo that chroot still works
+
+# Return vals: 2 - invalid arg list
+# 1 - chroot failed
+# 0 - chroot succeeded
+cat > chroot_test.c << EOF
+#include <unistd.h>
+int main(int argc, char *argv[]) {
+ if (argc != 2)
+ return 2;
+ return (chroot(argv[1]) == -1);
+}
+EOF
+
+gcc -o chroot_test chroot_test.c
+
+# The following should just run chroot_test since pseudo is already loaded
+./bin/pseudo ./chroot_test `pwd`
+
+if [ "$?" = "0" ]
+then
+ #echo "Passed."
+ rm -f chroot_test chroot_test.c
+ exit 0
+fi
+#echo "Failed"
+rm -f chroot_test chroot_test.c
+exit 1