[CRIU] [PATCH 4/4] RFC: Make ZDTM run on embedded root filesystems
Christopher Covington
cov at codeaurora.org
Thu Jul 10 08:09:07 PDT 2014
Modify the ZDTM script so that it can run on minimalistic root
filesystems without much more than busybox.
Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
test/zdtm.sh | 63 ++++++++++++++++++++++++++----------------------------------
1 file changed, 27 insertions(+), 36 deletions(-)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 479427a..517f2a4 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -255,30 +255,7 @@ check_criu()
check_mainstream()
{
- local -a ver_arr
- local ver_str=`uname -r`
-
- zdtm_sep "CRIU CHECK"
-
- $CRIU check && return 0
- MAINSTREAM_KERNEL=1
-
- cat >&2 <<EOF
-============================= WARNING =============================
-Not all features needed for CRIU are merged to upstream kernel yet,
-so for now we maintain our own branch which can be cloned from:
-git://git.kernel.org/pub/scm/linux/kernel/git/gorcunov/linux-cr.git
-===================================================================
-EOF
-
- ver_arr=(`echo ${ver_str//./ }`)
-
- [ "${ver_arr[0]}" -gt 3 ] && return 0
- [[ "${ver_arr[0]}" -eq 3 && "${ver_arr[1]}" -ge 11 ]] && return 0
-
- echo "A version of kernel should be greater or equal to 3.11" >&2
-
- return 1
+ return 0
}
exit_callback()
@@ -364,10 +341,15 @@ start_test()
{
local tdir=$1
local tname=$2
+ local test=$tdir/$tname
export ZDTM_ROOT
killall -9 $tname > /dev/null 2>&1
- make -C $tdir $tname.cleanout
+ rm -fr $test.pid \
+ $test.out* \
+ $test.test* \
+ $test.*.test \
+ $test.state
unset ZDTM_UID
unset ZDTM_GID
@@ -389,25 +371,34 @@ start_test()
ZDTM_ROOT=`readlink -f $ZDTM_ROOT`
mount --bind . $ZDTM_ROOT || return 1
fi
- construct_root $ZDTM_ROOT $tdir/$tname || return 1
+ construct_root $ZDTM_ROOT $test || return 1
export ZDTM_NEWNS=1
export ZDTM_PIDFILE=$TPID
cd $ZDTM_ROOT
rm -f $ZDTM_PIDFILE
fi
- if ! make -C $tdir $tname.pid; then
- echo ERROR: fail to start $tdir/$tname
+ local args=`$test --help 2>&1 | sed -nr \
+ -e "s%.*(--pidfile=).*%\1$test.pid%p" \
+ -e "s%.*(--outfile=).*%\1$test.out%p" \
+ -e "s%.*(--dirname=).*%\1$test.dir.test%p" \
+ -e "s%.*(--envname=).*%\1ENV_00_TEST%p" \
+ -e "s%.*(--filename=).*%\1$test.test%p"`
+
+ $test $args
+ local retcode=$?
+ [ $retcode -eq 0 ] || {
+ echo ERROR: $test returned $retcode
return 1
- fi
+ }
[ -z "$ZDTM_ROOT" ] || cd -
PID=`cat "$TPID"` || return 1
- if ! ps -p $PID ; then
- echo "Test failed to start"
+ kill -0 $PID || {
+ echo ERROR: $test failed to start
return 1
- fi
+ }
}
stop_test()
@@ -423,7 +414,7 @@ save_fds()
save_maps()
{
- cat /proc/$1/maps | python maps.py > $2
+ cat /proc/$1/maps > $2
}
diff_maps()
@@ -519,7 +510,7 @@ EOF
local cpt_args=
local dump_only=
local dump_cmd="dump"
- ddump=`readlink -fm dump/$tname/$PID/$i`
+ ddump=dump/$tname/$PID/$i
DUMP_PATH=$ddump
echo Dump $PID
mkdir -p $ddump
@@ -611,7 +602,7 @@ EOF
for i in `seq 5`; do
save_fds $PID $ddump/restore.fd
diff_fds $ddump/dump.fd $ddump/restore.fd && break
- sleep 0.2
+ sleep 2
done
[ $i -eq 5 ] && return 2
@@ -889,7 +880,7 @@ else
pattern=$1
fi
- for t in $(echo "$TEST_LIST" | grep -x "$pattern"); do
+ for t in $(echo "$TEST_LIST" | grep "^$pattern$"); do
run_test $t || case_error $t
done
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.
More information about the CRIU
mailing list