diff --git a/test/security/Makefile b/test/security/Makefile index 6d5110b9e..4945fd84d 100644 --- a/test/security/Makefile +++ b/test/security/Makefile @@ -1,4 +1,4 @@ -DIR := /tmp/criu-test +DIR := $(shell pwd)/data LOOP := $(DIR)/loop.sh PIDFILE := $(DIR)/loop.pid IMGS := $(DIR)/imgs diff --git a/test/security/run.sh b/test/security/run.sh index 5b559966c..e75ab4406 100755 --- a/test/security/run.sh +++ b/test/security/run.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -x + PID= function run_as { @@ -9,12 +11,15 @@ function run_as { su $1 -c "setsid ${LOOP} ${PIDFILE} $2 < /dev/null &> /dev/null &" for i in `seq 100`; do test -f ${PIDFILE} && break + sleep 1 done PID=`cat ${PIDFILE}` echo ${PID} } function dump_as { + test -d ${IMGS} && rm -rf ${IMGS} + mkdir -p ${IMGS} echo "== Dump ${PID} as $@" su $@ -c "${CRIU} dump --tree ${PID} --images-dir ${IMGS}" return $? @@ -33,6 +38,7 @@ function result { if [ $1 -ne 0 ]; then echo -e "${BGRED}FAIL${NORMAL}" + exit 1 else echo -e "${BGGREEN}PASS${NORMAL}" fi