[CRIU] [PATCH 1/2] test/mem-snap: wait util a zdtm test isn't stopped

Andrey Vagin avagin at openvz.org
Tue Aug 18 16:50:10 PDT 2015


before checking results.

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/mem-snap/run-predump-2.sh             |  3 +--
 test/mem-snap/run-predump.sh               |  2 +-
 test/mem-snap/run-snap-auto-dedup.sh       |  2 +-
 test/mem-snap/run-snap-dedup-on-restore.sh |  2 +-
 test/mem-snap/run-snap-dedup.sh            |  2 +-
 test/mem-snap/run-snap-maps04.sh           |  2 +-
 test/mem-snap/run-snap.sh                  |  2 +-
 test/zdtm/live/static/Makefile             | 12 ++++++++++++
 8 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/test/mem-snap/run-predump-2.sh b/test/mem-snap/run-predump-2.sh
index a15f987..2717cde 100755
--- a/test/mem-snap/run-predump-2.sh
+++ b/test/mem-snap/run-predump-2.sh
@@ -27,8 +27,7 @@ function launch_test {
 function stop_test {
 	wtime=1
 	cd ../zdtm/live/static/
-	make maps04.out
-	while [ ! -f maps04.out ]; do echo "Wait for maps04.out"; sleep $wtime; ((wtime++)); done
+	make maps04.stop
 	cat maps04.out | fgrep PASS || fail "Test failed"
 	echo "OK"
 }
diff --git a/test/mem-snap/run-predump.sh b/test/mem-snap/run-predump.sh
index c861952..e25ccfd 100755
--- a/test/mem-snap/run-predump.sh
+++ b/test/mem-snap/run-predump.sh
@@ -71,7 +71,7 @@ echo "Restoring"
 ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v4 || fail "Fail to restore server"
 
 cd ../zdtm/live/static/
-make mem-touch.out
+make mem-touch.stop
 cat mem-touch.out | fgrep PASS || fail "Test failed"
 
 echo "Test PASSED"
diff --git a/test/mem-snap/run-snap-auto-dedup.sh b/test/mem-snap/run-snap-auto-dedup.sh
index a1cfb22..f4eb119 100755
--- a/test/mem-snap/run-snap-auto-dedup.sh
+++ b/test/mem-snap/run-snap-auto-dedup.sh
@@ -83,7 +83,7 @@ echo "Restoring"
 ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v4 || fail "Fail to restore server"
 
 cd ../zdtm/live/static/
-make mem-touch.out
+make mem-touch.stop
 cat mem-touch.out | fgrep PASS || fail "Test failed"
 
 if [[ $dedup_ok_2 -ne 0 || $dedup_ok_1 -ne 0 ]]; then
diff --git a/test/mem-snap/run-snap-dedup-on-restore.sh b/test/mem-snap/run-snap-dedup-on-restore.sh
index 0335280..7bfdf0e 100755
--- a/test/mem-snap/run-snap-dedup-on-restore.sh
+++ b/test/mem-snap/run-snap-dedup-on-restore.sh
@@ -77,7 +77,7 @@ if [[ $size_last1 -ne 0 || $size_last2 -ne 0 || $size_last3 -ne 0 ]]; then
 fi
 
 cd ../zdtm/live/static/
-make mem-touch.out
+make mem-touch.stop
 cat mem-touch.out | fgrep PASS || fail "Test failed"
 
 if [ $restore_dedup_ok -ne 0 ]; then
diff --git a/test/mem-snap/run-snap-dedup.sh b/test/mem-snap/run-snap-dedup.sh
index 815c70e..762e202 100755
--- a/test/mem-snap/run-snap-dedup.sh
+++ b/test/mem-snap/run-snap-dedup.sh
@@ -89,7 +89,7 @@ echo "Restoring"
 ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v4 || fail "Fail to restore server"
 
 cd ../zdtm/live/static/
-make mem-touch.out
+make mem-touch.stop
 cat mem-touch.out | fgrep PASS || fail "Test failed"
 
 if [[ $dedup_ok_2 -ne 0 || $dedup_ok_1 -ne 0 ]]; then
diff --git a/test/mem-snap/run-snap-maps04.sh b/test/mem-snap/run-snap-maps04.sh
index 6db9d4d..5bd75f3 100755
--- a/test/mem-snap/run-snap-maps04.sh
+++ b/test/mem-snap/run-snap-maps04.sh
@@ -55,7 +55,7 @@ fi
 echo "Restoring"
 ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log --auto-dedup -d -v4 || fail "Fail to restore"
 
-make -C ../zdtm/live/static/ maps04.out
+make -C ../zdtm/live/static/ maps04.stop
 sleep 1
 
 cat "../zdtm/live/static/maps04.out" | fgrep PASS || fail "Test failed"
diff --git a/test/mem-snap/run-snap.sh b/test/mem-snap/run-snap.sh
index 6e0b0f8..38496a2 100755
--- a/test/mem-snap/run-snap.sh
+++ b/test/mem-snap/run-snap.sh
@@ -68,7 +68,7 @@ echo "Restoring"
 ${CRIU} restore -D "${IMGDIR}/$NRSNAP/" -o restore.log -d -v4 || fail "Fail to restore server"
 
 cd ../zdtm/live/static/
-make mem-touch.out
+make mem-touch.stop
 cat mem-touch.out | fgrep PASS || fail "Test failed"
 
 echo "Test PASSED"
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index c573088..dcf0076 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -279,6 +279,18 @@ stop:	$(STATE_OUT)
 	-kill -TERM `cat *.pid`
 
 WAIT_TIME=240
+%.stop:	%.pid %
+	kill -TERM `cat $<`; \
+	i=0; \
+	while [ $$i -lt $(WAIT_TIME) ] ; do \
+		kill -0 `cat $< 2>/dev/null` 2>/dev/null || break; \
+		sleep 1; \
+		echo -n .; \
+		i=`expr $$i + 1`; \
+	done; \
+	echo; \
+	[ $$i -lt $(WAIT_TIME) ]
+
 wait_stop:
 		i=0; \
 		while [ $$i -lt $(WAIT_TIME) ] ; do \
-- 
2.1.0



More information about the CRIU mailing list