Commit 5e55b71b authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

test/other: save logs in the test directory

If a test fails, we save the criu directory and expect to have
all logs and images there.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 827a8628
DIR := /tmp/criu-test DIR := $(shell pwd)/data
LOOP := $(DIR)/loop.sh LOOP := $(DIR)/loop.sh
PIDFILE := $(DIR)/loop.pid PIDFILE := $(DIR)/loop.pid
IMGS := $(DIR)/imgs IMGS := $(DIR)/imgs
......
#!/bin/bash #!/bin/bash
set -x
PID= PID=
function run_as { function run_as {
...@@ -9,12 +11,15 @@ function run_as { ...@@ -9,12 +11,15 @@ function run_as {
su $1 -c "setsid ${LOOP} ${PIDFILE} $2 < /dev/null &> /dev/null &" su $1 -c "setsid ${LOOP} ${PIDFILE} $2 < /dev/null &> /dev/null &"
for i in `seq 100`; do for i in `seq 100`; do
test -f ${PIDFILE} && break test -f ${PIDFILE} && break
sleep 1
done done
PID=`cat ${PIDFILE}` PID=`cat ${PIDFILE}`
echo ${PID} echo ${PID}
} }
function dump_as { function dump_as {
test -d ${IMGS} && rm -rf ${IMGS}
mkdir -p ${IMGS}
echo "== Dump ${PID} as $@" echo "== Dump ${PID} as $@"
su $@ -c "${CRIU} dump --tree ${PID} --images-dir ${IMGS}" su $@ -c "${CRIU} dump --tree ${PID} --images-dir ${IMGS}"
return $? return $?
...@@ -33,6 +38,7 @@ function result { ...@@ -33,6 +38,7 @@ function result {
if [ $1 -ne 0 ]; then if [ $1 -ne 0 ]; then
echo -e "${BGRED}FAIL${NORMAL}" echo -e "${BGRED}FAIL${NORMAL}"
exit 1
else else
echo -e "${BGGREEN}PASS${NORMAL}" echo -e "${BGGREEN}PASS${NORMAL}"
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment