Commit f6111769 authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Introduce per-test criu options

Some tests require custom options for dump and restore. Instead
of hard-coding test names into zdth.sh, introduce the $test.opts
file from which zdtm would pick the needed options.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 6021378c
...@@ -434,21 +434,11 @@ diff_fds() ...@@ -434,21 +434,11 @@ diff_fds()
run_test() run_test()
{ {
local test=$1 local test=$1
local linkremap=
local snappdir= local snappdir=
local ps_pid= local ps_pid=
[ -n "$EXCLUDE_PATTERN" ] && echo $test | grep "$EXCLUDE_PATTERN" && return 0 [ -n "$EXCLUDE_PATTERN" ] && echo $test | grep "$EXCLUDE_PATTERN" && return 0
#
# add option for unlinked files test
if [[ $1 =~ "unlink_" ]]; then
linkremap="--link-remap"
fi
if [[ $1 =~ "write_read10" ]]; then
linkremap="--link-remap"
fi
if [ -n "$MAINSTREAM_KERNEL" ] && [ $COMPILE_ONLY -eq 0 ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/}; then if [ -n "$MAINSTREAM_KERNEL" ] && [ $COMPILE_ONLY -eq 0 ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/}; then
echo "Skip $test" echo "Skip $test"
return 0 return 0
...@@ -483,6 +473,10 @@ run_test() ...@@ -483,6 +473,10 @@ run_test()
return 1 return 1
fi fi
if [ -f "${test}.opts" ]; then
gen_args="$gen_args $(cat "${test}.opts")"
fi
if [ -n "$PIDNS" ]; then if [ -n "$PIDNS" ]; then
[ -z "$CR_IP_TOOL" ] && CR_IP_TOOL=ip [ -z "$CR_IP_TOOL" ] && CR_IP_TOOL=ip
if ! $CR_IP_TOOL a help 2>&1 | grep -q showdump; then if ! $CR_IP_TOOL a help 2>&1 | grep -q showdump; then
...@@ -544,8 +538,7 @@ EOF ...@@ -544,8 +538,7 @@ EOF
save_fds $PID $ddump/dump.fd save_fds $PID $ddump/dump.fd
save_maps $PID $ddump/dump.maps save_maps $PID $ddump/dump.maps
setsid $CRIU_CPT $dump_cmd --file-locks --tcp-established $linkremap \ setsid $CRIU_CPT $dump_cmd -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
-x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
retcode=$? retcode=$?
# #
...@@ -583,10 +576,7 @@ EOF ...@@ -583,10 +576,7 @@ EOF
diff_maps $ddump/dump.maps $ddump/dump.maps.after || return 1 diff_maps $ddump/dump.maps $ddump/dump.maps.after || return 1
} }
if [[ $linkremap ]]; then rm -f ./$tdir/link_remap.*
echo "remove ./$tdir/link_remap.*"
rm -f ./$tdir/link_remap.*
fi
else else
# Wait while tasks are dying, otherwise PIDs would be busy. # Wait while tasks are dying, otherwise PIDs would be busy.
for i in $ddump/core-*.img; do for i in $ddump/core-*.img; do
...@@ -603,7 +593,7 @@ EOF ...@@ -603,7 +593,7 @@ EOF
done done
echo Restore echo Restore
setsid $CRIU restore --file-locks --tcp-established -x -D $ddump -o restore.log -v4 -d $gen_args || return 2 setsid $CRIU restore -D $ddump -o restore.log -v4 -d $gen_args || return 2
[ -n "$PIDNS" ] && PID=`cat $TPID` [ -n "$PIDNS" ] && PID=`cat $TPID`
for i in `seq 5`; do for i in `seq 5`; do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment