[CRIU] [PATCH 3/3] test: add manual test for criu-coredump
Ruslan Kuprieiev
kupruser at gmail.com
Sat May 21 06:38:31 PDT 2016
Convert criu images to coredumps and check if they are
readable by readelf.
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
test/others/criu-coredump/.gitignore | 6 +++++
test/others/criu-coredump/Makefile | 5 ++++
test/others/criu-coredump/loop.sh | 4 +++
test/others/criu-coredump/test.sh | 50 ++++++++++++++++++++++++++++++++++++
test/others/env.sh | 2 ++
5 files changed, 67 insertions(+)
create mode 100644 test/others/criu-coredump/.gitignore
create mode 100644 test/others/criu-coredump/Makefile
create mode 100755 test/others/criu-coredump/loop.sh
create mode 100755 test/others/criu-coredump/test.sh
diff --git a/test/others/criu-coredump/.gitignore b/test/others/criu-coredump/.gitignore
new file mode 100644
index 0000000..a2b70d8
--- /dev/null
+++ b/test/others/criu-coredump/.gitignore
@@ -0,0 +1,6 @@
+*.img
+*.log
+*.txt
+stats-*
+*.json
+core.*
diff --git a/test/others/criu-coredump/Makefile b/test/others/criu-coredump/Makefile
new file mode 100644
index 0000000..aa684a9
--- /dev/null
+++ b/test/others/criu-coredump/Makefile
@@ -0,0 +1,5 @@
+run: clean
+ ./test.sh
+
+clean:
+ rm -f *.img stats-* core.*
diff --git a/test/others/criu-coredump/loop.sh b/test/others/criu-coredump/loop.sh
new file mode 100755
index 0000000..0ab34ce
--- /dev/null
+++ b/test/others/criu-coredump/loop.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+while :; do
+ sleep 1
+done
diff --git a/test/others/criu-coredump/test.sh b/test/others/criu-coredump/test.sh
new file mode 100755
index 0000000..1830b9d
--- /dev/null
+++ b/test/others/criu-coredump/test.sh
@@ -0,0 +1,50 @@
+source ../env.sh
+
+function _exit {
+ if [ $? -ne 0 ]; then
+ echo "FAIL"
+ exit 1
+ fi
+}
+
+function gen_imgs {
+ setsid ./loop.sh < /dev/null &> /dev/null &
+ PID=$!
+ $CRIU dump -v4 -o dump.log -D ./ -t $PID
+ if [ $? -ne 0 ]; then
+ kill -9 $PID
+ _exit 1
+ fi
+
+ images_list=$(ls -1 *.img)
+ if [ -z "$images_list" ]; then
+ echo "Failed to generate images"
+ _exit 1
+ fi
+}
+
+function run_test {
+ echo "= Test core dump"
+
+ echo "=== img to core dump"
+ $CRIU_COREDUMP -i ./ -o ./ || _exit $?
+ echo "=== done"
+
+ cores=$(ls -1 core.*)
+ if [ -z "$cores" ]; then
+ echo "Failed to generate coredumps"
+ _exit 1
+ fi
+
+ for x in $cores
+ do
+ echo "=== try readelf $x"
+ readelf -a $x || _exit $?
+ echo "=== done"
+ done
+
+ echo "= done"
+}
+
+gen_imgs
+run_test
diff --git a/test/others/env.sh b/test/others/env.sh
index ee0a748..73369ad 100755
--- a/test/others/env.sh
+++ b/test/others/env.sh
@@ -4,3 +4,5 @@ CRIU=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu/criu)
criu=$CRIU
CRIT=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../crit/crit)
crit=$CRIT
+CRIU_COREDUMP=$(readlink -f `dirname ${BASH_SOURCE[0]}`/../../criu-coredump/criu-coredump)
+criu_coredump=$CRIU_COREDUMP
--
2.5.5
More information about the CRIU
mailing list