test: When a test fails, show diff only (save complete output to a file)

We're starting to get test output that's fairly long, so it's much
kinder to just show a diff rather than displaying the complete
expected and actual output. To allow the user to investigate things
after the fact, we save the expected and actual output to files named
test-${test_number}.expected and test-${test_number}.output .
This commit is contained in:
Carl Worth 2010-04-22 13:22:08 -07:00
parent 9a3d4a0f2a
commit 01f03cf098

View file

@ -168,8 +168,10 @@ pass_if_equal ()
echo " PASS"
else
echo " FAIL"
echo " Expected output: $expected"
echo " Actual output: $output"
testname=test-$(printf "%03d" $tests)
echo "$expected" > $testname.expected
echo "$output" > $testname.output
diff -u $testname.expected $testname.output || true
test_failures=$((test_failures + 1))
fi
}