diff --git a/test/libcriu/run_sub.sh b/test/libcriu/run_sub.sh old mode 100644 new mode 100755 index 9e14a49eb..ff9930bee --- a/test/libcriu/run_sub.sh +++ b/test/libcriu/run_sub.sh @@ -2,26 +2,43 @@ source ../env.sh || exit 1 -LOOP_PID=0 - echo "== Clean" make clean rm -rf wdir rm -f ./libcriu.so.1 echo "== Prepare" -make test_sub || { echo "FAIL"; exit 1; } - mkdir -p wdir/s/ -mkdir -p wdir/i/ +mkdir wdir/i/ echo "== Start service" -${CRIU} service -v4 -o service.log --address cs.sk -d --pidfile pidfile -W wdir/s/ || { echo "FAIL"; exit 1; } +${CRIU} service -v4 -o service.log --address cs.sk -d --pidfile pidfile -W wdir/s/ || { echo "FAIL service start"; exit 1; } -echo "== Run test_sub" +echo "== Run tests" ln -s ../../lib/libcriu.so libcriu.so.1 export LD_LIBRARY_PATH=. export PATH="`dirname ${BASH_SOURCE[0]}`/../../:$PATH" -./test_sub wdir/s/cs.sk wdir/i/ + +RESULT=0 + +function run_test { + echo "== Build $1" + if ! make $1; then + echo "FAIL build $1" + RESULT=1; + else + echo "== Test $1" + mkdir wdir/i/$1/ + if ! ./$1 wdir/s/cs.sk wdir/i/$1/; then + echo "$1: FAIL" + RESULT=1 + fi + fi +} + +run_test test_sub +run_test test_self echo "== Stopping service" kill -TERM $(cat wdir/s/pidfile) +[ $RESULT -eq 0 ] && echo "Success" || echo "FAIL" +exit $RESULT