mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
zdtm: Use "post-dump" script for "-d" and "-s" option
v2: - Use special opcode 32 to distinguish error cases - Use --scripts for snapshot testings v3: - test for both 32 and 0 for error code v4: (by avagin@) - restore from the last snapshot v5: - update comment https://bugzilla.openvz.org/show_bug.cgi?id=2583 Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> 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
73c5a0f965
commit
ff0e96dcf9
9
test/post-dump.sh
Executable file
9
test/post-dump.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ $CRTOOLS_SCRIPT_ACTION == post-dump ] && {
|
||||||
|
#
|
||||||
|
# Special code to inform zdtm that we're
|
||||||
|
# done and should proceed testing treating
|
||||||
|
# non-zero return as known case.
|
||||||
|
exit 32
|
||||||
|
}
|
32
test/zdtm.sh
32
test/zdtm.sh
@@ -153,6 +153,8 @@ sk-netlink
|
|||||||
CRIU=$(readlink -f `dirname $0`/../criu)
|
CRIU=$(readlink -f `dirname $0`/../criu)
|
||||||
CRIU_CPT=$CRIU
|
CRIU_CPT=$CRIU
|
||||||
TMP_TREE=""
|
TMP_TREE=""
|
||||||
|
SCRIPTDIR=`dirname $CRIU`/test
|
||||||
|
POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"
|
||||||
|
|
||||||
test -x $CRIU || {
|
test -x $CRIU || {
|
||||||
echo "$CRIU is unavailable"
|
echo "$CRIU is unavailable"
|
||||||
@@ -378,12 +380,15 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i in `seq $ITERATIONS`; do
|
for i in `seq $ITERATIONS`; do
|
||||||
|
local dump_only=
|
||||||
|
local postdump=
|
||||||
ddump=dump/$tname/$PID/$i
|
ddump=dump/$tname/$PID/$i
|
||||||
DUMP_PATH=`pwd`/$ddump
|
DUMP_PATH=`pwd`/$ddump
|
||||||
echo Dump $PID
|
echo Dump $PID
|
||||||
mkdir -p $ddump
|
mkdir -p $ddump
|
||||||
|
|
||||||
|
[ -n "$DUMP_ONLY" ] && dump_only=1
|
||||||
|
|
||||||
if [ $PAGE_SERVER -eq 1 ]; then
|
if [ $PAGE_SERVER -eq 1 ]; then
|
||||||
$CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT --daemon
|
$CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT --daemon
|
||||||
PS_PID=$!
|
PS_PID=$!
|
||||||
@@ -392,16 +397,28 @@ EOF
|
|||||||
|
|
||||||
if [ -n "$SNAPSHOT" ]; then
|
if [ -n "$SNAPSHOT" ]; then
|
||||||
snapopt=""
|
snapopt=""
|
||||||
[ "$i" -ne "$ITERATIONS" ] && snapopt="$snapopt -R --track-mem"
|
[ "$i" -ne "$ITERATIONS" ] && {
|
||||||
|
snapopt="$snapopt -R --track-mem"
|
||||||
|
dump_only=1
|
||||||
|
}
|
||||||
[ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir"
|
[ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -n "$dump_only" ] && postdump=$POSTDUMP
|
||||||
|
|
||||||
save_fds $PID $ddump/dump.fd
|
save_fds $PID $ddump/dump.fd
|
||||||
setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \
|
setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \
|
||||||
-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt || {
|
-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt $postdump
|
||||||
echo WARNING: process $tname is left running for your debugging needs
|
retcode=$?
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here we may have two cases: either checkpoint is failed
|
||||||
|
# with some error code, or checkpoint is complete but return
|
||||||
|
# code is non-zero because of post dump action.
|
||||||
|
if [ "$retcode" -ne 0 ] && [[ "$retcode" -ne 32 || -z "$dump_only" ]]; then
|
||||||
|
echo WARNING: $tname returned $retcode and left running for debug needs
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
if [ -n "$SNAPSHOT" ]; then
|
if [ -n "$SNAPSHOT" ]; then
|
||||||
snappdir=../`basename $ddump`
|
snappdir=../`basename $ddump`
|
||||||
@@ -412,10 +429,9 @@ EOF
|
|||||||
wait $PS_PID
|
wait $PS_PID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if expr " $ARGS" : ' -s' > /dev/null; then
|
if [ -n "$dump_only" ]; then
|
||||||
save_fds $PID $ddump/dump.fd.after
|
save_fds $PID $ddump/dump.fd.after
|
||||||
diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
|
diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
|
||||||
killall -CONT $tname
|
|
||||||
if [[ $linkremap ]]; then
|
if [[ $linkremap ]]; then
|
||||||
echo "remove ./$tdir/link_remap.*"
|
echo "remove ./$tdir/link_remap.*"
|
||||||
rm -f ./$tdir/link_remap.*
|
rm -f ./$tdir/link_remap.*
|
||||||
@@ -512,7 +528,7 @@ cd `dirname $0` || exit 1
|
|||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
if [ "$1" = "-d" ]; then
|
if [ "$1" = "-d" ]; then
|
||||||
ARGS="-s"
|
DUMP_ONLY=1
|
||||||
shift
|
shift
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user