commit 548d9762027d1b13465dc36e0f7c1b591db6d363 from: Neels Hofmeyr date: Sun Oct 11 05:31:05 2020 UTC verify_all.sh: run all tests, then list all errors commit - 3e6df9167632c7a43900965b3e2e81b47629bb40 commit + 548d9762027d1b13465dc36e0f7c1b591db6d363 blob - 48cae69f971a565907eb605d105619ea79357981 blob + 8f3824136c9686f424da3433dee3d613f052f35a --- test/verify_all.sh +++ test/verify_all.sh @@ -12,6 +12,8 @@ fi diff_type=unidiff +rm errors + verify_diff_script() { orig_left="$1" orig_right="$2" @@ -30,7 +32,7 @@ verify_diff_script() { if [ -e "$expected_diff" ]; then echo cmp "$got_diff" "$expected_diff" if ! cmp "$got_diff" "$expected_diff" ; then - echo "FAIL: $got_diff != $expected_diff" + echo "FAIL: $got_diff != $expected_diff" | tee -a errors return 1 fi fi @@ -38,14 +40,14 @@ verify_diff_script() { cp "$orig_left" "$verify_right" $patch_prog --quiet -u "$verify_right" "$the_diff" if ! cmp "$orig_right" "$verify_right" ; then - echo "FAIL: $orig_right != $verify_right" + echo "FAIL: $orig_right != $verify_right" | tee -a errors return 1 fi cp "$orig_right" "$verify_left" $patch_prog --quiet -u -R "$verify_left" "$the_diff" if ! cmp "$orig_left" "$verify_left" ; then - echo "FAIL: $orig_left != $verify_left" + echo "FAIL: $orig_left != $verify_left" | tee -a errors return 1 fi elif [ -z "$ignore_whitespace" ]; then @@ -53,11 +55,11 @@ verify_diff_script() { tail -n +3 "$the_diff" | grep -v "^-" | sed 's/^.//' > "$verify_right" if ! cmp "$orig_left" "$verify_left" ; then - echo "FAIL: $orig_left != $verify_left" + echo "FAIL: $orig_left != $verify_left" | tee -a errors return 1 fi if ! cmp "$orig_right" "$verify_right" ; then - echo "FAIL: $orig_right != $verify_right" + echo "FAIL: $orig_right != $verify_right" | tee -a errors return 1 fi fi @@ -73,22 +75,27 @@ for left in test*.left* ; do "$diff_prog" $diff_opts "$left" "$right" > "$got_diff" - set -e verify_diff_script "$left" "$right" "$got_diff" "$expected_diff" "$diff_opts" - set +e done for ctest in *_test.c ; do prog="$(echo "$ctest" | sed 's/.c//')" expect_output="expect.${prog}" prog_output="verify.$expect_output" - set -e - "$prog" > "$prog_output" - set +e + ./"$prog" > "$prog_output" if ! cmp "$prog_output" "$expect_output" ; then - echo "FAIL: $prog_output != $expect_output" - return 1 + echo "FAIL: $prog_output != $expect_output" | tee -a errors else echo "OK: $prog" fi done + +echo +if [ -f errors ]; then + echo "Tests failed:" + cat errors + exit 1 +else + echo "All tests OK" + echo +fi