[CRIU] [PATCH 1/2] zdtm.sh: use tmpfs for dump files

Andrey Vagin avagin at openvz.org
Thu May 23 09:05:44 EDT 2013


It's optional. It's going to be used in jenkins.

time bash -x test//zdtm.sh  static/maps04
real	0m40.220s
user	0m0.096s
sys	0m12.822s

time bash -x test//zdtm.sh -t static/maps04
real	0m9.904s
user	0m0.074s
sys	0m1.630s

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm.sh | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index ace17b6..919b922 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -192,13 +192,16 @@ EOF
 	return 1;
 }
 
-umount_zdtm_root()
+exit_callback()
 {
-	[ -z "$ZDTM_ROOT" ] && return;
-	umount -l "$ZDTM_ROOT"
-	rmdir "$ZDTM_ROOT"
+	[ -n "$ZDTM_ROOT" ] && {
+		umount -l "$ZDTM_ROOT"
+		rmdir "$ZDTM_ROOT"
+	}
+	[ -n "$TMPFS_DUMP" ] &&
+		umount -l "$TMPFS_DUMP"
 }
-trap umount_zdtm_root EXIT
+trap exit_callback EXIT
 
 construct_root()
 {
@@ -496,6 +499,13 @@ while :; do
 		shift
 		continue;
 	fi
+	if [ "$1" = "-t" ]; then
+		shift
+		TMPFS_DUMP=dump
+		[ -d dump ] || mkdir $TMPFS_DUMP
+		mount -t tmpfs none $TMPFS_DUMP || exit 1
+		continue;
+	fi
 	break;
 done
 
@@ -531,6 +541,7 @@ Options:
 	-C : Delete dump files if a test completed successfully
 	-b <commit> : Check backward compatibility
 	-x <PATTERN>: Exclude pattern
+	-t : mount tmpfs for dump files
 EOF
 elif [ "${1:0:1}" = '-' ]; then
 	echo "unrecognized option $1"
-- 
1.8.2



More information about the CRIU mailing list