mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +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:
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_CPT=$CRIU
|
||||
TMP_TREE=""
|
||||
SCRIPTDIR=`dirname $CRIU`/test
|
||||
POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"
|
||||
|
||||
test -x $CRIU || {
|
||||
echo "$CRIU is unavailable"
|
||||
@ -378,12 +380,15 @@ EOF
|
||||
}
|
||||
|
||||
for i in `seq $ITERATIONS`; do
|
||||
|
||||
local dump_only=
|
||||
local postdump=
|
||||
ddump=dump/$tname/$PID/$i
|
||||
DUMP_PATH=`pwd`/$ddump
|
||||
echo Dump $PID
|
||||
mkdir -p $ddump
|
||||
|
||||
[ -n "$DUMP_ONLY" ] && dump_only=1
|
||||
|
||||
if [ $PAGE_SERVER -eq 1 ]; then
|
||||
$CRIU page-server -D $ddump -o page_server.log -v4 --port $PS_PORT --daemon
|
||||
PS_PID=$!
|
||||
@ -392,16 +397,28 @@ EOF
|
||||
|
||||
if [ -n "$SNAPSHOT" ]; then
|
||||
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"
|
||||
fi
|
||||
|
||||
[ -n "$dump_only" ] && postdump=$POSTDUMP
|
||||
|
||||
save_fds $PID $ddump/dump.fd
|
||||
setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \
|
||||
-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt || {
|
||||
echo WARNING: process $tname is left running for your debugging needs
|
||||
-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt $postdump
|
||||
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
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -n "$SNAPSHOT" ]; then
|
||||
snappdir=../`basename $ddump`
|
||||
@ -412,10 +429,9 @@ EOF
|
||||
wait $PS_PID
|
||||
fi
|
||||
|
||||
if expr " $ARGS" : ' -s' > /dev/null; then
|
||||
if [ -n "$dump_only" ]; then
|
||||
save_fds $PID $ddump/dump.fd.after
|
||||
diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
|
||||
killall -CONT $tname
|
||||
if [[ $linkremap ]]; then
|
||||
echo "remove ./$tdir/link_remap.*"
|
||||
rm -f ./$tdir/link_remap.*
|
||||
@ -512,7 +528,7 @@ cd `dirname $0` || exit 1
|
||||
|
||||
while :; do
|
||||
if [ "$1" = "-d" ]; then
|
||||
ARGS="-s"
|
||||
DUMP_ONLY=1
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user