Browse Source

[trac976] Consistently remove temporary files created by the tests

Stephen Morris 14 years ago
parent
commit
8a83c13c20

+ 3 - 2
src/lib/log/tests/console_test.sh.in

@@ -55,8 +55,6 @@ rm -f $tempfile
 ./logger_example -c stderr -s error 1> $tempfile
 passfail 0
 
-rm -f $tempfile
-
 if [ $failcount -eq 0 ]; then
     echo "PASS: $testname"
 elif [ $failcount -eq 1 ]; then
@@ -65,4 +63,7 @@ else
     echo "FAIL: $testname - $failcount tests failed"
 fi
 
+# Tidy up
+rm -f $tempfile
+
 exit $failcount

+ 3 - 0
src/lib/log/tests/destination_test.sh.in

@@ -82,4 +82,7 @@ else
     echo "FAIL: $testname - $failcount tests failed"
 fi
 
+# Tidy up.
+rm -f $tempfile $destfile1 $destfile2
+
 exit $failcount

+ 3 - 4
src/lib/log/tests/local_file_test.sh.in

@@ -72,10 +72,6 @@ rm -f $localmes
 ./logger_example -c stdout -s warn $localmes | cut -d' ' -f3- | diff $tempfile -
 passfail $?
 
-# Tidy up.
-
-rm -f $tempfile
-
 if [ $failcount -eq 0 ]; then
     echo "PASS: $testname"
 elif [ $failcount -eq 1 ]; then
@@ -84,4 +80,7 @@ else
     echo "FAIL: $testname - $failcount tests failed"
 fi
 
+# Tidy up.
+rm -f $tempfile
+
 exit $failcount

+ 3 - 2
src/lib/log/tests/severity_test.sh.in

@@ -77,8 +77,6 @@ DEBUG [example.beta] MSG_BADSEVERITY, unrecognized log severity: beta/25
 ./logger_example -c stdout -s debug -d 25 | cut -d' ' -f3- | diff $tempfile -
 passfail $?
 
-rm -f $tempfile
-
 if [ $failcount -eq 0 ]; then
     echo "PASS: $testname"
 elif [ $failcount -eq 1 ]; then
@@ -87,4 +85,7 @@ else
     echo "FAIL: $testname - $failcount tests failed"
 fi
 
+# Tidy up
+rm -f $tempfile
+
 exit $failcount