aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2010-01-04 12:28:07 +0100
committerLoïc Minier <lool@dooz.org>2010-01-04 12:28:07 +0100
commit8b530641d545d072cfaa8fb6d29a6273f5b4aba0 (patch)
tree4139581d9280aadf3e493ff012d3351f11d1e554
parenta81bf5c2b08cab1d83407fd3f96997eac5aee7fd (diff)
downloadpbuilder-8b530641d545d072cfaa8fb6d29a6273f5b4aba0.tar
pbuilder-8b530641d545d072cfaa8fb6d29a6273f5b4aba0.tar.gz
trap exit to run a cleanup() function
test_pbuilder-satisfydepends-funcs: trap exit to run a cleanup() function; this avoid leaving files behind if the script is killed at the wrong time.
-rwxr-xr-xtest_pbuilder-satisfydepends-funcs17
1 files changed, 14 insertions, 3 deletions
diff --git a/test_pbuilder-satisfydepends-funcs b/test_pbuilder-satisfydepends-funcs
index b961367..564fdd4 100755
--- a/test_pbuilder-satisfydepends-funcs
+++ b/test_pbuilder-satisfydepends-funcs
@@ -5,9 +5,15 @@
# testsuite to test pbuilder-satisfydepends-checkparams.
+DEBIAN_CONTROL=""
+
+cleanup() {
+ if [ -n "$DEBIAN_CONTROL" ]; then
+ rm -f "$DEBIAN_CONTROL"
+ fi
+}
+
test_get_control_re() {
- # TODO move to build dir
- DEBIAN_CONTROL=$(tempfile)
cat <<EOF > "$DEBIAN_CONTROL"
Source: amule
XXXX:
@@ -28,8 +34,13 @@ Desctiption: test
wow
EOF
get_control_re "$DEBIAN_CONTROL" "build-(depends|depends-indep)"
- rm -f "$DEBIAN_CONTROL"
}
+
+trap cleanup sigpipe sighup exit
+
+# TODO move to build dir
+DEBIAN_CONTROL="$(tempfile)"
+
expect_output " autotools-dev, debhelper, quilt, libwxgtk2.8-dev
test, test1, test2, test3 | test4, test5" test_get_control_re