[CRIU] [PATCH 5/7] test: add crit test

Ruslan Kuprieiev kupruser at gmail.com
Tue Oct 28 21:02:46 PDT 2014


Test steps:
1) generate img files by dumping loop.sh
2) convert img files to txt files
3) convert txt files to img files
4) cmp original and produces img files

It also uses i/o redirection and --format nice options to
check if they work properly.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 test/Makefile        |  1 +
 test/crit/.gitignore |  4 ++++
 test/crit/Makefile   |  9 +++++++++
 test/crit/loop.sh    |  4 ++++
 test/crit/test.sh    | 25 +++++++++++++++++++++++++
 5 files changed, 43 insertions(+)
 create mode 100644 test/crit/.gitignore
 create mode 100644 test/crit/Makefile
 create mode 100755 test/crit/loop.sh
 create mode 100755 test/crit/test.sh

diff --git a/test/Makefile b/test/Makefile
index 9ab8f3d..fa9af0d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -55,6 +55,7 @@ clean:
 	$(Q) $(MAKE) -C zdtm cleandep clean cleanout
 	$(Q) $(MAKE) -C libcriu clean
 	$(Q) $(MAKE) -C rpc clean
+	$(Q) $(MAKE) -C crit clean
 
 mount_cgroups: .FORCE
 	flock zdtm_mount_cgroups ./zdtm_mount_cgroups
diff --git a/test/crit/.gitignore b/test/crit/.gitignore
new file mode 100644
index 0000000..d589bec
--- /dev/null
+++ b/test/crit/.gitignore
@@ -0,0 +1,4 @@
+*.img
+*.log
+*.txt
+stats-*
diff --git a/test/crit/Makefile b/test/crit/Makefile
new file mode 100644
index 0000000..731c0e3
--- /dev/null
+++ b/test/crit/Makefile
@@ -0,0 +1,9 @@
+images:
+	setsid ./loop.sh < /dev/null &> /dev/null & \
+	../../criu dump -v4 -o dump.log -D ./ -t $${!} --shell-job
+
+run: images
+	./test.sh
+
+clean:
+	rm -f *.img *.log *.txt stats-*
diff --git a/test/crit/loop.sh b/test/crit/loop.sh
new file mode 100755
index 0000000..0ab34ce
--- /dev/null
+++ b/test/crit/loop.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+while :; do
+	sleep 1
+done
diff --git a/test/crit/test.sh b/test/crit/test.sh
new file mode 100755
index 0000000..1c12d07
--- /dev/null
+++ b/test/crit/test.sh
@@ -0,0 +1,25 @@
+images_list=$(ls -1 *.img)
+
+function _exit {
+	if [ $? -ne 0 ]; then
+		echo "FAIL"
+		exit -1
+	fi
+}
+
+for x in $images_list
+do
+	echo "=== $x"
+	if [[ $x == pages* ]]; then
+		echo "skip"
+		continue
+	fi
+
+	echo "  -- to text"
+	../../crit convert -o "$x"".txt" --format nice < $x || _exit $?
+	echo "  -- to img"
+	../../crit convert -i "$x"".txt" > "$x"".txt.img" || _exit $?
+	echo "  -- cmp"
+	cmp $x "$x"".txt.img" || _exit $?
+	echo "=== done"
+done
-- 
1.9.3



More information about the CRIU mailing list