2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

test: add crit test

Test steps:
1) generate img files by dumping loop.sh
2) convert img files to json files
3) convert json files to img files
4) cmp original and produces img files

It also uses i/o redirection and --format nice options to
check if they work properly.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Ruslan Kuprieiev
2014-12-31 14:06:53 +02:00
committed by Pavel Emelyanov
parent ec9ab827b1
commit 12db8f23f5
5 changed files with 45 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ clean:
$(Q) $(MAKE) -C zdtm cleandep clean cleanout
$(Q) $(MAKE) -C libcriu clean
$(Q) $(MAKE) -C rpc clean
$(Q) $(MAKE) -C crit clean
mount_cgroups: .FORCE
flock zdtm_mount_cgroups ./zdtm_mount_cgroups

5
test/crit/.gitignore vendored Normal file
View File

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

9
test/crit/Makefile Normal file
View File

@@ -0,0 +1,9 @@
images:
setsid ./loop.sh < /dev/null &> /dev/null & \
../../criu dump -v4 -o dump.log -D ./ -t $${!} --shell-job
run: images
./test.sh
clean:
rm -f *.img *.log *.txt stats-* *.json

4
test/crit/loop.sh Executable file
View File

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

26
test/crit/test.sh Executable file
View File

@@ -0,0 +1,26 @@
images_list=$(ls -1 *.img)
function _exit {
if [ $? -ne 0 ]; then
echo "FAIL"
exit -1
fi
}
for x in $images_list
do
echo "=== $x"
if [[ $x == pages* ]]; then
echo "skip"
continue
fi
echo " -- to json"
../../crit convert -o "$x"".json" --format nice < $x || _exit $?
echo " -- to img"
../../crit convert -i "$x"".json" > "$x"".json.img" || _exit $?
echo " -- cmp"
cmp $x "$x"".json.img" || _exit $?
echo "=== done"
done