Commit 3c6180ac authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

Use criu instead of crtools in test scripts

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f7b9f0a2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source ../../../functions.sh || exit 1 source ../../../functions.sh || exit 1
crtools="../../../../crtools" criu="../../../../criu"
cleanup_class() { cleanup_class() {
rm -f ./*.class rm -f ./*.class
...@@ -21,7 +21,7 @@ pid=${!} ...@@ -21,7 +21,7 @@ pid=${!}
echo Lanuched java application with pid $pid in background echo Lanuched java application with pid $pid in background
${crtools} dump -D dump -o dump.log -v 4 --shell-job -t ${pid} || { ${criu} dump -D dump -o dump.log -v 4 --shell-job -t ${pid} || {
echo "Dump failed" echo "Dump failed"
exit 1 exit 1
} }
...@@ -30,7 +30,7 @@ wait_tasks dump ...@@ -30,7 +30,7 @@ wait_tasks dump
echo "Dumped, restoring and waiting for completion" echo "Dumped, restoring and waiting for completion"
${crtools} restore -D dump -o restore.log -v 4 --shell-job || { ${criu} restore -D dump -o restore.log -v 4 --shell-job || {
echo "Restore failed" echo "Restore failed"
exit 1 exit 1
} }
......
...@@ -21,7 +21,7 @@ switch $current { ...@@ -21,7 +21,7 @@ switch $current {
puts "FAIL: Timed out on ready" puts "FAIL: Timed out on ready"
exit -1 exit -1
} }
system ../../../crtools dump -v 4 -D ./dump -o dump.log -j -t $pid system ../../../criu dump -v 4 -D ./dump -o dump.log -j -t $pid
system echo "$pid" > ./dump/pid.pid system echo "$pid" > ./dump/pid.pid
exit 0 exit 0
} }
...@@ -37,7 +37,7 @@ switch $current { ...@@ -37,7 +37,7 @@ switch $current {
exit -1 exit -1
} }
spawn ../../../crtools restore -v 4 -D ./dump -o restore.log -j spawn ../../../criu restore -v 4 -D ./dump -o restore.log -j
# #
# spawn doesn't wait for restore to complete, so # spawn doesn't wait for restore to complete, so
# add some sleep here. Still better would be to # add some sleep here. Still better would be to
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
cd `dirname $0` cd `dirname $0`
crtools="../../../crtools" criu="../../../criu"
name=$1 name=$1
[ -z "$name" ] && { cat <<EOF [ -z "$name" ] && { cat <<EOF
...@@ -34,7 +34,7 @@ $CR_IP_TOOL netns exec $name ip a || exit 1 ...@@ -34,7 +34,7 @@ $CR_IP_TOOL netns exec $name ip a || exit 1
mkdir data mkdir data
echo "Dump the CT $name ($pid)" echo "Dump the CT $name ($pid)"
${crtools} dump --evasive-devices \ ${criu} dump --evasive-devices \
--tcp-established \ --tcp-established \
--file-locks \ --file-locks \
-n net -n mnt -n ipc -n pid \ -n net -n mnt -n ipc -n pid \
...@@ -46,7 +46,7 @@ echo Press Enter for restoring CT ...@@ -46,7 +46,7 @@ echo Press Enter for restoring CT
read read
echo "Restore the CT $name" echo "Restore the CT $name"
${crtools} restore --evasive-devices \ ${criu} restore --evasive-devices \
--tcp-established \ --tcp-established \
--file-locks \ --file-locks \
-n net -n mnt -n ipc -n pid \ -n net -n mnt -n ipc -n pid \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source ../../functions.sh || exit 1 source ../../functions.sh || exit 1
crtools="../../../crtools" criu="../../../criu"
cleanup_wd() { cleanup_wd() {
rm -f "ref-*" rm -f "ref-*"
...@@ -32,7 +32,7 @@ pid=${!} ...@@ -32,7 +32,7 @@ pid=${!}
echo Lanuched make in $pid background echo Lanuched make in $pid background
sleep 2 sleep 2
${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || { ${criu} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || {
echo "Dump failed" echo "Dump failed"
exit 1 exit 1
} }
...@@ -41,7 +41,7 @@ wait_tasks dump ...@@ -41,7 +41,7 @@ wait_tasks dump
echo "Dumped, restoring and waiting for completion" echo "Dumped, restoring and waiting for completion"
${crtools} restore --shell-job -D dump -o restore.log -v 4 || { ${criu} restore --shell-job -D dump -o restore.log -v 4 || {
echo "Restore failed" echo "Restore failed"
exit 1 exit 1
} }
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
source ../../functions.sh || exit 1 source ../../functions.sh || exit 1
crtools="../../../crtools" criu="../../../criu"
set -x set -x
echo "Creating reference objects" echo "Creating reference objects"
screen -d -m -S crtools-zdtm screen -d -m -S criu-zdtm
pid=$(screen -list | grep '\<crtools-zdtm\>.*Detached' | sed 's/\s*\([0-9]*\).*/\1/'); pid=$(screen -list | grep '\<criu-zdtm\>.*Detached' | sed 's/\s*\([0-9]*\).*/\1/');
echo PID=$pid echo PID=$pid
mkdir dump mkdir dump
${crtools} dump -D dump -o dump.log -v 4 -t ${pid} || { ${criu} dump -D dump -o dump.log -v 4 -t ${pid} || {
echo "Dump failed" echo "Dump failed"
exit 1 exit 1
} }
...@@ -23,7 +23,7 @@ wait_tasks dump ...@@ -23,7 +23,7 @@ wait_tasks dump
echo "Dumped, restoring and waiting for completion" echo "Dumped, restoring and waiting for completion"
${crtools} restore -d -D dump -o restore.log -v 4 || { ${criu} restore -d -D dump -o restore.log -v 4 || {
echo "Restore failed" echo "Restore failed"
exit 1 exit 1
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
source ../../functions.sh || exit 1 source ../../functions.sh || exit 1
crtools="../../../crtools" criu="../../../criu"
DEPTH=3 DEPTH=3
SPAN=5 SPAN=5
archref="arch-ref.tar.bz2" archref="arch-ref.tar.bz2"
...@@ -47,7 +47,7 @@ pid=${!} ...@@ -47,7 +47,7 @@ pid=${!}
echo "Started tar in $pid background" echo "Started tar in $pid background"
sleep 3 sleep 3
${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || { ${criu} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || {
echo "Dump failed" echo "Dump failed"
exit 1 exit 1
} }
...@@ -55,7 +55,7 @@ ${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || { ...@@ -55,7 +55,7 @@ ${crtools} dump --shell-job -D dump -o dump.log -v 4 -t ${pid} || {
wait_tasks dump wait_tasks dump
echo "Dump OK, restoring" echo "Dump OK, restoring"
${crtools} restore --shell-job -D dump -o restore.log -v 4 || { ${criu} restore --shell-job -D dump -o restore.log -v 4 || {
echo "Restore failed" echo "Restore failed"
exit 1 exit 1
} }
......
...@@ -2,7 +2,7 @@ set -m ...@@ -2,7 +2,7 @@ set -m
source ../../functions.sh || exit 1 source ../../functions.sh || exit 1
crtools="../../../crtools" criu="../../../criu"
mkdir data mkdir data
...@@ -10,14 +10,14 @@ mkdir data ...@@ -10,14 +10,14 @@ mkdir data
pid=`jobs -p %1` pid=`jobs -p %1`
bg bg
$crtools dump -j --tcp-established -D data/ -o dump.log -v 4 -t $pid || { $criu dump -j --tcp-established -D data/ -o dump.log -v 4 -t $pid || {
echo "Dump failed" echo "Dump failed"
exit 1 exit 1
} }
wait_tasks dump wait_tasks dump
$crtools restore -j --tcp-established -D data/ -d -o restore.log -v 4 || { $criu restore -j --tcp-established -D data/ -d -o restore.log -v 4 || {
echo "Restore failed" echo "Restore failed"
exit 1 exit 1
} }
......
...@@ -6,7 +6,7 @@ function fail { ...@@ -6,7 +6,7 @@ function fail {
} }
set -x set -x
CRTOOLS="../../crtools" CRIU="../../criu"
IMGDIR="dump/" IMGDIR="dump/"
rm -rf "$IMGDIR" rm -rf "$IMGDIR"
...@@ -37,11 +37,11 @@ launch_test ...@@ -37,11 +37,11 @@ launch_test
echo "Taking plain dump" echo "Taking plain dump"
mkdir "$IMGDIR/dump-1/" mkdir "$IMGDIR/dump-1/"
${CRTOOLS} dump -D "$IMGDIR/dump-1/" -o dump.log -t ${PID} -v 4 || fail "Fail to dump" ${CRIU} dump -D "$IMGDIR/dump-1/" -o dump.log -t ${PID} -v 4 || fail "Fail to dump"
sleep 1 sleep 1
echo "Restore to check it works" echo "Restore to check it works"
${CRTOOLS} restore -D "${IMGDIR}/dump-1/" -o restore.log -d -v 4 || fail "Fail to restore server" ${CRIU} restore -D "${IMGDIR}/dump-1/" -o restore.log -d -v 4 || fail "Fail to restore server"
stop_test stop_test
...@@ -53,14 +53,14 @@ echo "Taking pre and plain dumps" ...@@ -53,14 +53,14 @@ echo "Taking pre and plain dumps"
echo "Pre-dump" echo "Pre-dump"
mkdir "$IMGDIR/dump-2/" mkdir "$IMGDIR/dump-2/"
mkdir "$IMGDIR/dump-2/pre/" mkdir "$IMGDIR/dump-2/pre/"
${CRTOOLS} pre-dump -D "$IMGDIR/dump-2/pre/" -o dump.log -t ${PID} -v 4 || fail "Fail to pre-dump" ${CRIU} pre-dump -D "$IMGDIR/dump-2/pre/" -o dump.log -t ${PID} -v 4 || fail "Fail to pre-dump"
echo "Plain dump" echo "Plain dump"
mkdir "$IMGDIR/dump-2/plain/" mkdir "$IMGDIR/dump-2/plain/"
${CRTOOLS} dump -D "$IMGDIR/dump-2/plain/" -o dump.log -t ${PID} -v 4 --prev-images-dir=../pre/ || fail "Fail to dump" ${CRIU} dump -D "$IMGDIR/dump-2/plain/" -o dump.log -t ${PID} -v 4 --prev-images-dir=../pre/ || fail "Fail to dump"
sleep 1 sleep 1
echo "Restore" echo "Restore"
${CRTOOLS} restore -D "${IMGDIR}/dump-2/plain/" -o restore.log -d -v 4 || fail "Fail to restore server" ${CRIU} restore -D "${IMGDIR}/dump-2/plain/" -o restore.log -d -v 4 || fail "Fail to restore server"
stop_test stop_test
...@@ -18,7 +18,7 @@ function fail { ...@@ -18,7 +18,7 @@ function fail {
} }
set -x set -x
CRTOOLS="../../crtools" CRIU="../../criu"
IMGDIR="dump/" IMGDIR="dump/"
rm -rf "$IMGDIR" rm -rf "$IMGDIR"
...@@ -53,21 +53,21 @@ for SNAP in $(seq 1 $NRSNAP); do ...@@ -53,21 +53,21 @@ for SNAP in $(seq 1 $NRSNAP); do
fi fi
if [ $USEPS -eq 1 ]; then if [ $USEPS -eq 1 ]; then
${CRTOOLS} page-server -D "${IMGDIR}/$SNAP/" -o ps.log --port ${PORT} -v 4 & ${CRIU} page-server -D "${IMGDIR}/$SNAP/" -o ps.log --port ${PORT} -v 4 &
PS_PID=$! PS_PID=$!
ps_args="--page-server --address 127.0.0.1 --port=${PORT}" ps_args="--page-server --address 127.0.0.1 --port=${PORT}"
else else
ps_args="" ps_args=""
fi fi
${CRTOOLS} $cmd -D "${IMGDIR}/$SNAP/" -o dump.log -t ${PID} -v 4 $args $ps_args || fail "Fail to dump" ${CRIU} $cmd -D "${IMGDIR}/$SNAP/" -o dump.log -t ${PID} -v 4 $args $ps_args || fail "Fail to dump"
if [ $USEPS -eq 1 ]; then if [ $USEPS -eq 1 ]; then
wait $PS_PID wait $PS_PID
fi fi
done done
echo "Restoring" echo "Restoring"
${CRTOOLS} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v 4 || fail "Fail to restore server" ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v 4 || fail "Fail to restore server"
cd ../zdtm/live/static/ cd ../zdtm/live/static/
make mem-touch.out make mem-touch.out
......
...@@ -18,7 +18,7 @@ function fail { ...@@ -18,7 +18,7 @@ function fail {
} }
set -x set -x
CRTOOLS="../../crtools" CRIU="../../criu"
IMGDIR="dump/" IMGDIR="dump/"
rm -rf "$IMGDIR" rm -rf "$IMGDIR"
...@@ -50,21 +50,21 @@ for SNAP in $(seq 1 $NRSNAP); do ...@@ -50,21 +50,21 @@ for SNAP in $(seq 1 $NRSNAP); do
fi fi
if [ $USEPS -eq 1 ]; then if [ $USEPS -eq 1 ]; then
${CRTOOLS} page-server -D "${IMGDIR}/$SNAP/" -o ps.log --port ${PORT} -v 4 & ${CRIU} page-server -D "${IMGDIR}/$SNAP/" -o ps.log --port ${PORT} -v 4 &
PS_PID=$! PS_PID=$!
ps_args="--page-server --address 127.0.0.1 --port=${PORT}" ps_args="--page-server --address 127.0.0.1 --port=${PORT}"
else else
ps_args="" ps_args=""
fi fi
${CRTOOLS} dump -D "${IMGDIR}/$SNAP/" -o dump.log -t ${PID} -v 4 $args $ps_args || fail "Fail to dump" ${CRIU} dump -D "${IMGDIR}/$SNAP/" -o dump.log -t ${PID} -v 4 $args $ps_args || fail "Fail to dump"
if [ $USEPS -eq 1 ]; then if [ $USEPS -eq 1 ]; then
wait $PS_PID wait $PS_PID
fi fi
done done
echo "Restoring" echo "Restoring"
${CRTOOLS} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v 4 || fail "Fail to restore server" ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v 4 || fail "Fail to restore server"
cd ../zdtm/live/static/ cd ../zdtm/live/static/
make mem-touch.out make mem-touch.out
......
...@@ -7,7 +7,7 @@ CLN_PIPE="./clnt_pipe" ...@@ -7,7 +7,7 @@ CLN_PIPE="./clnt_pipe"
SRV_LOG="./srv.log" SRV_LOG="./srv.log"
CLN_LOG="./cln.log" CLN_LOG="./cln.log"
DDIR="dump" DDIR="dump"
CRTOOLS="../../crtools" CRIU="../../criu"
TEXT=$(hexdump -C /dev/urandom | head -n 1) TEXT=$(hexdump -C /dev/urandom | head -n 1)
...@@ -41,10 +41,10 @@ function fail { ...@@ -41,10 +41,10 @@ function fail {
} }
echo "Suspend server" echo "Suspend server"
${CRTOOLS} dump -D ${DDIR} -o dump.log -t ${SRV_PID} --tcp-established -vvvv || fail "Fail to dump server" ${CRIU} dump -D ${DDIR} -o dump.log -t ${SRV_PID} --tcp-established -vvvv || fail "Fail to dump server"
sleep 1 sleep 1
echo "Resume server" echo "Resume server"
${CRTOOLS} restore -D ${DDIR} -o restore.log -d --tcp-established -vvvv --close 3 || fail "Fail to restore server" ${CRIU} restore -D ${DDIR} -o restore.log -d --tcp-established -vvvv --close 3 || fail "Fail to restore server"
echo "Make client run again" echo "Make client run again"
echo "${TEXT}" >&3 echo "${TEXT}" >&3
......
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