[CRIU] [PATCH] test/app-emu: dump/restore of VNC server

Andrey Vagin avagin at openvz.org
Wed Nov 21 13:40:20 EST 2012


* Execute VNC server and glxgears
* Dump/restore
* Check, that VNC server accepts connections

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/app-emu/vnc/run.sh        | 28 ++++++++++++++++++++++++++++
 test/app-emu/vnc/vnc-server.sh | 13 +++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100755 test/app-emu/vnc/run.sh
 create mode 100755 test/app-emu/vnc/vnc-server.sh

diff --git a/test/app-emu/vnc/run.sh b/test/app-emu/vnc/run.sh
new file mode 100755
index 0000000..9de6379
--- /dev/null
+++ b/test/app-emu/vnc/run.sh
@@ -0,0 +1,28 @@
+set -m
+
+crtools="../../../crtools"
+
+mkdir data
+
+./vnc-server.sh 25 &> data/vnc.log
+pid=`jobs -p %1`
+bg
+
+$crtools dump -j --tcp-established -D data/ -o dump.log -v 4 -t $pid || {
+	echo "Dump failed"
+	exit 1
+}
+
+$crtools restore -j --tcp-established -D data/ -d -o restore.log -v 4 -t $pid || {
+	echo "Restore failed"
+	exit 1
+}
+
+nc -w 1 localhost 5925 | grep -am 1 RFB
+ret=$?
+
+kill $pid
+
+[ "$ret" -eq 0 ] && echo PASS || echo FAIL;
+
+exit $ret
diff --git a/test/app-emu/vnc/vnc-server.sh b/test/app-emu/vnc/vnc-server.sh
new file mode 100755
index 0000000..7c8168a
--- /dev/null
+++ b/test/app-emu/vnc/vnc-server.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+#set -x
+set -m
+Xvnc :25 -v -geometry 500x500 -i 0.0.0.0 -SecurityTypes none &
+pid=$!
+trap "kill $pid; wait" EXIT
+for i in `seq 10`; do
+	nc -w 1 localhost 5925 | grep -am 1 RFB && break || echo Waiting
+	kill -0 $pid || exit 1
+	sleep 1
+done
+kill -STOP $$
+DISPLAY=:25 glxgears
-- 
1.7.11.7



More information about the CRIU mailing list