[CRIU] test/zdtm: add -g option to generate binary only

Yicheng Qin yichengq at google.com
Fri Aug 9 11:05:44 EDT 2013


From: Yicheng Qin <yichengq at google.com>
Subject: [PATCH] test/zdtm: add -g option to generate binary only

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>
---
 test/zdtm.sh | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index f640cd7..9e72fa3 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -156,10 +156,11 @@ TMP_TREE=""
 SCRIPTDIR=`dirname $CRIU`/test
 POSTDUMP="--action-script $SCRIPTDIR/post-dump.sh"

-test -x $CRIU || {
+# it doesn't need criu binary for compiling test programs
+if [[ "$1" != "-g" && ! -x $CRIU ]]; then
  echo "$CRIU is unavailable"
  exit 1
-}
+fi

 ARGS=""

@@ -538,6 +539,19 @@ checkout()
  make -C $TMP_TREE -j 32
 }

+compile_test()
+{
+ local test=$1
+
+ test=${ZP}/${test#ns/}
+ local tname=`basename $test`
+ local tdir=`dirname $test`
+
+ echo "Compile $test"
+
+ make -C $tdir $tname || return 1
+}
+
 cd `dirname $0` || exit 1

 while :; do
@@ -621,6 +635,16 @@ if [ $# -eq 0 ]; then
  done
 elif [ "$1" = "-l" ]; then
  echo $TEST_LIST $UTS_TEST_LIST $MNT_TEST_LIST $IPC_TEST_LIST | tr ' ' '\n'
+elif [ "$1" = "-g" ]; then
+ shift
+ if [ $# -eq 0 ]; then
+ for t in $TEST_LIST $UTS_TEST_LIST \
+ $MNT_TEST_LIST $IPC_TEST_LIST; do
+ compile_test $t || case_error $t
+ done
+ else
+ compile_test $1 || case_error $1
+ fi
 elif [ "$1" = "-h" ]; then
  cat >&2 <<EOF
 This script is used for executing unit tests.
@@ -637,6 +661,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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20130809/49a53391/attachment.html>


More information about the CRIU mailing list