2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

test: add manual test for criu-coredump

Convert criu images to coredumps and check if they are
readable by readelf.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Ruslan Kuprieiev 2016-05-21 16:38:31 +03:00 committed by Pavel Emelyanov
parent e569e46b31
commit 947358a9ed
5 changed files with 67 additions and 0 deletions

6
test/others/criu-coredump/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
*.img
*.log
*.txt
stats-*
*.json
core.*

View File

@ -0,0 +1,5 @@
run: clean
./test.sh
clean:
rm -f *.img stats-* core.*

View File

@ -0,0 +1,4 @@
#!/bin/bash
while :; do
sleep 1
done

View File

@ -0,0 +1,50 @@
source ../env.sh
function _exit {
if [ $? -ne 0 ]; then
echo "FAIL"
exit 1
fi
}
function gen_imgs {
setsid ./loop.sh < /dev/null &> /dev/null &
PID=$!
$CRIU dump -v4 -o dump.log -D ./ -t $PID
if [ $? -ne 0 ]; then
kill -9 $PID
_exit 1
fi
images_list=$(ls -1 *.img)
if [ -z "$images_list" ]; then
echo "Failed to generate images"
_exit 1
fi
}
function run_test {
echo "= Test core dump"
echo "=== img to core dump"
$CRIU_COREDUMP -i ./ -o ./ || _exit $?
echo "=== done"
cores=$(ls -1 core.*)
if [ -z "$cores" ]; then
echo "Failed to generate coredumps"
_exit 1
fi
for x in $cores
do
echo "=== try readelf $x"
readelf -a $x || _exit $?
echo "=== done"
done
echo "= done"
}
gen_imgs
run_test

View File

@ -4,3 +4,5 @@ CRIU=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu/criu)
criu=$CRIU
CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit)
crit=$CRIT
CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/criu-coredump)
criu_coredump=$CRIU_COREDUMP