mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
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: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
827a86287c
commit
5e55b71b93
@@ -1,4 +1,4 @@
|
|||||||
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
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
PID=
|
PID=
|
||||||
|
|
||||||
function run_as {
|
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 {
|
|||||||
|
|
||||||
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
|
||||||
|
Reference in New Issue
Block a user