[debian-edu-commits] debian-edu/ 01/01: Make test code more robust against errors, umount proc and sys when something go wrong.

Petter Reinholdtsen pere at moszumanska.debian.org
Sat Jul 19 14:36:58 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository debian-edu.

commit 0624f557bf6f5993fedc621a964469597ad36edd
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sat Jul 19 16:36:52 2014 +0200

    Make test code more robust against errors, umount proc and sys when something go wrong.
---
 debian/tests/test-metapkgs | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/debian/tests/test-metapkgs b/debian/tests/test-metapkgs
index 40a7ec9..2979660 100644
--- a/debian/tests/test-metapkgs
+++ b/debian/tests/test-metapkgs
@@ -1,6 +1,14 @@
 #!/bin/sh
 set -e
 
+at_exit() {
+    for m in $umount ; do
+	umount "$m"
+    done
+}
+
+trap at_exit INT TERM EXIT
+
 chroot_test() {
     cd $ADTTMP
     target=test-chroot
@@ -9,15 +17,23 @@ chroot_test() {
     printf "#!/bin/sh\nexit 101\n" > $target/usr/sbin/policy-rc.d
     chmod a+rx $target/usr/sbin/policy-rc.d
     mount -t proc proc $target/proc
+    umount="$target/proc"
+    mount -t sysfs sysfs $target/sys
+    umount="$target/proc $target/sys"
+
+
 
     # The bless script is not yet part of any binary package
     apt-get source debian-edu-config 2>&1
     cp debian-edu-config-*/share/debian-edu-config/tools/debian-edu-bless \
 	$target/root/.
     PROFILE=$PROFILE DESKTOP=$DESKTOP chroot $target \
-	sh -x /root/debian-edu-bless
+	sh -x /root/debian-edu-bless 2>&1
 
     umount $target/proc
+    umount="$target/sys"
+    umount $target/sys
+    umount=""
     rm -rf $target
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/debian-edu.git



More information about the debian-edu-commits mailing list