From 42c03d3135bd3b05f5e829436adefbc16a9b0a1a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 17 Nov 1994 17:37:22 +0000 Subject: . --- tests/join/Makefile | 4 ++-- tests/join/build-script | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/join/Makefile b/tests/join/Makefile index 683b343a8..d37029055 100644 --- a/tests/join/Makefile +++ b/tests/join/Makefile @@ -9,11 +9,11 @@ join-tests: main build-script test.data.pl .PHONY: distclean distclean: - rm -f t*.out + rm -f t*.out core .PHONY: clean clean: distclean .PHONY: realclean realclean: clean - rm -f join-tests t*.in t*.exp + rm -f join-tests t*.[12] t*.exp t*.log diff --git a/tests/join/build-script b/tests/join/build-script index 1dd2ed32f..98908b279 100755 --- a/tests/join/build-script +++ b/tests/join/build-script @@ -27,6 +27,7 @@ while (<>) $seen{$test_name} = 1; $in1 = "t$test_name.1"; $in2 = "t$test_name.2"; + $log = "t$test_name.log"; $exp_name = 't' . $test_name . '.exp'; $out = "t$test_name.out"; @@ -42,22 +43,33 @@ while (<>) close(EXP); $cmd = "$join $flags $in1 $in2 > $out"; print < /dev/null +$cmd 2> $log code=\$? +fail=yes if test \$code != $e_ret_code ; then - echo Test $test_name failed: join return code \$code differs from expected value $e_ret_code 1>&2 - errors=`expr \$errors + 1` + err_msg="Test $test_name failed: join return code \$code differs from expected value $e_ret_code" else - cmp $out $exp_name + cmp $out $exp_name >> $log 2>&1 case \$? in - 0) if test "\$verbose" ; then echo passed $test_name; fi ;; # equal files - 1) echo Test $test_name failed: files $out and $exp_name differ 1>&2; - errors=`expr \$errors + 1` ;; - 2) echo Test $test_name may have failed. 1>&2; - echo The command \"cmp $out $exp_name\" failed. 1>&2 ; - errors=`expr \$errors + 1` ;; + 0) # equal files + if test "\$verbose" ; then + echo passed $test_name + fi + fail=no + ;; + 1) err_msg="Test $test_name failed: files $out and $exp_name differ" + ;; + 2) err_msg="Test $test_name may have failed. +echo The command \"cmp $out $exp_name\" failed." + ;; esac fi +if test \$fail = yes; then + errors=`expr \$errors + 1` + echo "Failing command: $cmd" >> $log + echo "\$err_msg" >> $log +fi +test -s $log || rm -f $log EOF } print <