[CRIU] [PATCH] zdtm: Add binfmt_misc.hook

Kirill Tkhai ktkhai at virtuozzo.com
Fri Dec 16 03:13:26 PST 2016


A hook to cleanup test temporary files

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 test/zdtm/static/binfmt_misc.hook |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 test/zdtm/static/binfmt_misc.hook

diff --git a/test/zdtm/static/binfmt_misc.hook b/test/zdtm/static/binfmt_misc.hook
new file mode 100755
index 0000000..efeeefc
--- /dev/null
+++ b/test/zdtm/static/binfmt_misc.hook
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+[ "$1" == "--clean" ] || exit 0
+
+name=$(basename -s .hook $0).test
+
+tname=$(mktemp -d binfmt_misc.XXXXXX)
+mount -t binfmt_misc none $tname
+
+echo "Cleaning $name: $@"
+set +e
+if [ -e $tname/${name}_magic ]; then
+	echo -1 > $tname/${name}_magic
+fi
+
+if [ -e $tname/${name}_extention ]; then
+	echo -1 > $tname/${name}_extention
+fi
+set -e
+
+umount "$tname"
+rmdir "$tname"



More information about the CRIU mailing list