mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +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:
parent
fd214e0031
commit
afa47b23aa
33
test/libcriu/run_sub.sh
Normal file → Executable file
33
test/libcriu/run_sub.sh
Normal file → Executable file
@ -2,26 +2,43 @@
|
|||||||
|
|
||||||
source ../env.sh || exit 1
|
source ../env.sh || exit 1
|
||||||
|
|
||||||
LOOP_PID=0
|
|
||||||
|
|
||||||
echo "== Clean"
|
echo "== Clean"
|
||||||
make clean
|
make clean
|
||||||
rm -rf wdir
|
rm -rf wdir
|
||||||
rm -f ./libcriu.so.1
|
rm -f ./libcriu.so.1
|
||||||
|
|
||||||
echo "== Prepare"
|
echo "== Prepare"
|
||||||
make test_sub || { echo "FAIL"; exit 1; }
|
|
||||||
|
|
||||||
mkdir -p wdir/s/
|
mkdir -p wdir/s/
|
||||||
mkdir -p wdir/i/
|
mkdir wdir/i/
|
||||||
echo "== Start service"
|
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
|
ln -s ../../lib/libcriu.so libcriu.so.1
|
||||||
export LD_LIBRARY_PATH=.
|
export LD_LIBRARY_PATH=.
|
||||||
export PATH="`dirname ${BASH_SOURCE[0]}`/../../:$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"
|
echo "== Stopping service"
|
||||||
kill -TERM $(cat wdir/s/pidfile)
|
kill -TERM $(cat wdir/s/pidfile)
|
||||||
|
[ $RESULT -eq 0 ] && echo "Success" || echo "FAIL"
|
||||||
|
exit $RESULT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user