2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 21:07:43 +00:00

test: Tune libcriu tests launcher (v2)

v2:
* introduce the run_test helper
* fix overall result detection

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2014-06-26 16:51:19 +04:00
parent fd214e0031
commit afa47b23aa

33
test/libcriu/run_sub.sh Normal file → Executable file
View File

@ -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