aboutsummaryrefslogtreecommitdiffstats
path: root/test/test-reexec-chroot.sh
blob: bde93f16265a2446a1f935c6ac543dfb65da4b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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