Blob Blame History Raw
From 43bac63e33a31f4d86ca8f16b439dd33336a374b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 9 Jul 2012 20:44:48 +0200
Subject: [PATCH] TEST-99-RPM test trap

---
 test/TEST-99-RPM/test.sh |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh
index 25c1895..66f0beb 100755
--- a/test/TEST-99-RPM/test.sh
+++ b/test/TEST-99-RPM/test.sh
@@ -14,6 +14,9 @@ test_run() {
     mkdir -p "$rootdir/sys"
     mkdir -p "$rootdir/dev"
 
+trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit $ret;' EXIT
+trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit 1;' SIGINT
+
     mount --bind /proc "$rootdir/proc"
     mount --bind /sys "$rootdir/sys"
     mount -t devtmpfs devtmpfs "$rootdir/dev"