Commit a19cf2be authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm.sh: use another directory for a temporary crtools tree

It's more convinient for a few reasons
* don't need to recompile sources for each test case
* don't change the current tree
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 07f5c3fe
...@@ -133,7 +133,7 @@ $IPC_TEST_LIST ...@@ -133,7 +133,7 @@ $IPC_TEST_LIST
" "
CRTOOLS=$(readlink -f `dirname $0`/../crtools) CRTOOLS=$(readlink -f `dirname $0`/../crtools)
CPT_CRTOOLS=$CRTOOLS CRTOOLS_CPT=$CRTOOLS
TMP_TREE="" TMP_TREE=""
test -x $CRTOOLS || { test -x $CRTOOLS || {
...@@ -147,8 +147,6 @@ PID="" ...@@ -147,8 +147,6 @@ PID=""
PIDNS="" PIDNS=""
ITERATIONS=1 ITERATIONS=1
COMMIT=""
HEAD=""
check_mainstream() check_mainstream()
{ {
...@@ -280,13 +278,6 @@ run_test() ...@@ -280,13 +278,6 @@ run_test()
local tdir=`dirname $test` local tdir=`dirname $test`
DUMP_PATH="" DUMP_PATH=""
if [ -n "$COMMIT" ]; then
echo "The current HEAD is $HEAD"
git clean -fx --exclude=test `dirname "$CRTOOLS"`
git checkout $COMMIT &&
make -C `dirname "$CRTOOLS"` clean all || return 1
fi
echo "Execute $test" echo "Execute $test"
start_test $tdir $tname || return 1 start_test $tdir $tname || return 1
...@@ -318,17 +309,11 @@ EOF ...@@ -318,17 +309,11 @@ EOF
mkdir -p $ddump mkdir -p $ddump
save_fds $PID $ddump/dump.fd save_fds $PID $ddump/dump.fd
setsid $CRTOOLS dump --tcp-established --link-remap -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || { setsid $CRTOOLS_CPT dump --tcp-established --link-remap -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
echo WARNING: process $tname is left running for your debugging needs echo WARNING: process $tname is left running for your debugging needs
return 1 return 1
} }
if [ -n "$COMMIT" ]; then
git clean -fx --exclude=test `dirname "$CRTOOLS"`
git checkout $HEAD &&
make -C `dirname "$CRTOOLS"` all || return 1
fi
if expr " $ARGS" : ' -s' > /dev/null; then if expr " $ARGS" : ' -s' > /dev/null; then
save_fds $PID $ddump/dump.fd.after save_fds $PID $ddump/dump.fd.after
diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1 diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
...@@ -400,6 +385,15 @@ case_error() ...@@ -400,6 +385,15 @@ case_error()
exit 1 exit 1
} }
checkout()
{
local commit=`git describe $1` &&
TMP_TREE=`dirname $CRTOOLS`/crtools.$commit &&
mkdir -p $TMP_TREE &&
git --git-dir `dirname $CRTOOLS`/.git archive $commit . | tar -x -C $TMP_TREE &&
make -C $TMP_TREE -j 32
}
cd `dirname $0` || exit 1 cd `dirname $0` || exit 1
while :; do while :; do
...@@ -416,11 +410,8 @@ while :; do ...@@ -416,11 +410,8 @@ while :; do
fi fi
if [ "$1" = "-b" ]; then if [ "$1" = "-b" ]; then
shift shift
COMMIT=$1 checkout $1 || exit 1
HEAD=`git rev-parse --abbrev-ref HEAD` && [ HEAD != $HEAD ] || { CRTOOLS_CPT=$TMP_TREE/crtools
echo "Can't get a name of the current branch"
exit 1
}
shift shift
continue continue
fi fi
...@@ -470,3 +461,5 @@ else ...@@ -470,3 +461,5 @@ else
run_test $1 || case_error $1 run_test $1 || case_error $1
fi fi
fi fi
[ -n "$TMP_TREE" ] && rm -rf $TMP_TREE
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