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
|
||||
PIDFILE := $(DIR)/loop.pid
|
||||
IMGS := $(DIR)/imgs
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user