[CRIU] [PATCH v3] test/zdtm: add -g option to generate binary only
Yicheng Qin
yichengq at google.com
Mon Aug 12 19:48:44 EDT 2013
Add -g option in zdtm.sh.
Using -g option can just generate binaries of all
tests to run in zdtm. Moreover, appending test name after
-g option can just generate the binary for the test.
Signed-off-by: Yicheng Qin <yichengq at google.com>
---
Changelog since v2:
- fix wrong code
Changelog since v1:
- integrate compile logic in run_test()
test/zdtm.sh | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index f640cd7..1f18765 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -156,11 +156,6 @@ TMP_TREE=""
SCRIPTDIR=`dirname $CRIU`/test
POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"
-test -x $CRIU || {
- echo "$CRIU is unavailable"
- exit 1
-}
-
ARGS=""
PID=""
@@ -172,6 +167,15 @@ CLEANUP=0
PAGE_SERVER=0
PS_PORT=12345
TCPDUMP_PID=
+COMPILE_ONLY=0
+
+check_criu()
+{
+ if [ ! -x $CRIU ]; then
+ echo "$CRIU is unavailable"
+ return 1
+ fi
+}
check_mainstream()
{
@@ -343,7 +347,7 @@ run_test()
linkremap="--link-remap"
fi
- [ -n "$MAINSTREAM_KERNEL" ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && {
+ [ -n "$MAINSTREAM_KERNEL" ] && [ $COMPILE_ONLY -eq 0 ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && {
echo "Skip $test"
return 0
}
@@ -357,6 +361,11 @@ run_test()
local tdir=`dirname $test`
DUMP_PATH=""
+ if [ $COMPILE_ONLY -eq 1 ]; then
+ echo "Compile $test"
+ make -C $tdir $tname && return 0 || return 1
+ fi
+
echo "Execute $test"
start_test $tdir $tname || return 1
@@ -600,12 +609,23 @@ while :; do
shift
continue
fi
+ if [ "$1" = "-g" ]; then
+ COMPILE_ONLY=1
+ shift
+ continue
+ fi
break;
done
+if [ $COMPILE_ONLY -eq 0 ]; then
+ check_criu || exit 1
+fi
+
if [ $# -eq 0 ]; then
- check_mainstream || exit 1
+ if [ $COMPILE_ONLY -eq 0 ]; then
+ check_mainstream || exit 1
+ fi
for t in $TEST_LIST; do
run_test $t || case_error $t
@@ -637,6 +657,7 @@ Options:
-x <PATTERN>: Exclude pattern
-t : mount tmpfs for dump files
-a <FILE>.tar.gz : save archive with dump files and logs
+ -g : Generate executables only
EOF
elif [ "${1:0:1}" = '-' ]; then
echo "unrecognized option $1"
--
1.8.3
More information about the CRIU
mailing list