test: Leave tmp.<testname> for broken tests
authorCarl Worth <cworth@cworth.org>
Tue, 7 Dec 2010 22:24:00 +0000 (14:24 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 8 Dec 2010 00:23:20 +0000 (16:23 -0800)
Previously, this directory was only preserved for failing tests. But
it's important to be able to easily debug known-broken tests, so
preserve the actual vs. expected output for those as well.

test/basic
test/test-lib.sh

index 309779ca7f1573a5c5528073f6579b4a127d6bff..b4410f2a3fa5509f4c656c1f3179fafae98df0aa 100755 (executable)
@@ -71,6 +71,7 @@ output=$(cd ..; ./test-verbose -v 2>&1 | suppress_diff_date)
 expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
 # Do not include the results of test-verbose in totals
 rm $TEST_DIRECTORY/test-results/test-verbose-*
+rm -r $TEST_DIRECTORY/tmp.test-verbose
 test_expect_equal "$output" "$expected"
 
 
index da91de8d25e1db346ecca2b682ba54910f20c71e..a1978279e5b46cf0d9a62f257f4efaaa68b2d71f 100755 (executable)
@@ -454,6 +454,9 @@ test_expect_equal_failure ()
                        test_known_broken_ok_ "$test_subtest_name"
                else
                        test_known_broken_failure_ "$test_subtest_name"
+                       testname=$this_test.$test_count
+                       echo "$expected" > $testname.expected
+                       echo "$output" > $testname.output
                fi
     fi
 }
@@ -754,7 +757,9 @@ test_done () {
        echo
 
        if [ "$test_failure" = "0" ]; then
-           rm -rf "$remove_tmp"
+           if [ "$test_broken" = "0" ]; then       
+               rm -rf "$remove_tmp"
+           fi
            exit 0
        else
            exit 1