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:
parent
e569e46b31
commit
947358a9ed
6
test/others/criu-coredump/.gitignore
vendored
Normal file
6
test/others/criu-coredump/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
*.img
|
||||
*.log
|
||||
*.txt
|
||||
stats-*
|
||||
*.json
|
||||
core.*
|
5
test/others/criu-coredump/Makefile
Normal file
5
test/others/criu-coredump/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
run: clean
|
||||
./test.sh
|
||||
|
||||
clean:
|
||||
rm -f *.img stats-* core.*
|
4
test/others/criu-coredump/loop.sh
Executable file
4
test/others/criu-coredump/loop.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
while :; do
|
||||
sleep 1
|
||||
done
|
50
test/others/criu-coredump/test.sh
Executable file
50
test/others/criu-coredump/test.sh
Executable 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
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user