diff options
| author | Josh Triplett <josh@freedesktop.org> | 2007-07-22 20:27:57 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@freedesktop.org> | 2007-07-22 20:27:57 -0700 |
| commit | 33683d9fd2b3d6d240c539e50e61af0fca0fe5aa (patch) | |
| tree | 6f8a3daae8586ba1976c461cdd2d524d1ec89e35 /validation/test-suite | |
| parent | 3a38b8db6d5ffa9d19c08c854c71c7a5f03e3934 (diff) | |
| download | sparse-dev-33683d9fd2b3d6d240c539e50e61af0fca0fe5aa.tar.gz | |
Fix test-suite to handle stdout and stderr separately, and fix up tests
test-suite merged stdout and stderr, which relied on the ordering of data from
the two streams in the merged stream. This made test-suite frequently fail on
tests with both output and errors, when the ordering didn't happen to match
what the test assumed. Handle each of the streams separately, and update the
tests accordingly.
Also clean up the output of "test-suite format" to avoid outputting values
equal to the defaults.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'validation/test-suite')
| -rwxr-xr-x | validation/test-suite | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/validation/test-suite b/validation/test-suite index 6b9d1b71..1a357030 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -116,18 +116,22 @@ do_test() # grab the expected output sed -n '/check-output-start/,/check-output-end/p' $file \ - | grep -v check-output > "$file".expected + | grep -v check-output > "$file".output.expected + sed -n '/check-error-start/,/check-error-end/p' $file \ + | grep -v check-error > "$file".error.expected # grab the actual output & exit value - $cmd 1> $file.got 2>&1 + $cmd 1> $file.output.got 2> $file.error.got actual_exit_value=$? - diff -u "$file".expected "$file".got > "$file".diff - if [ "$?" -ne "0" ]; then - error "actual output does not match the expected one." - error "see $file.* for further investigation." - test_failed=1 - fi + for stream in output error; do + diff -u "$file".$stream.expected "$file".$stream.got > "$file".$stream.diff + if [ "$?" -ne "0" ]; then + error "actual $stream text does not match expected $stream text." + error "see $file.$stream.* for further investigation." + test_failed=1 + fi + done if [ "$actual_exit_value" -ne "$expected_exit_value" ]; then error "Actual exit value does not match the expected one." @@ -177,36 +181,27 @@ do_format() fi file="$1" cmd=`eval echo $default_path/$fcmd` - $cmd 1> $file.got 2>&1 + $cmd 1> $file.output.got 2> $file.error.got fexit_value=$? - #foutput=`sed -e "s/^\(.*\)/ * check-output:\1/" $file.got` - foutput=`cat $file.got` - if [ -z "$foutput" ]; then - format=`cat <<_EOF + cat <<_EOF /* * check-name: $fname - * - * check-command: $fcmd - * check-exit-value: $fexit_value - */ _EOF -` - else - format=`cat <<_EOF -/* - * check-name: $fname - * - * check-command: $fcmd - * check-exit-value: $fexit_value - * - * check-output-start -$foutput - * check-output-end - */ -_EOF -` + if [ "$fcmd" != "$default_cmd" ]; then + echo " * check-command: $fcmd" fi - echo "$format" + if [ "$fexit_value" -ne "0" ]; then + echo " * check-exit-value: $fexit_value" + fi + for stream in output error; do + if [ -s "$file.$stream.got" ]; then + echo " *" + echo " * check-$stream-start" + cat "$file.$stream.got" + echo " * check-$stream-end" + fi + done + echo " */" return 0 } |
