3 diff_prog="../diff/diff"
5 # At present, test015 only passes with GNU patch.
6 # Larry's patch has a bug with empty files in combination with -R...
7 if which gpatch > /dev/null; then
17 verify_diff_script() {
24 if echo -- $diff_opts | grep -q -- 'w'; then
25 ignore_whitespace="true"
29 verify_left="verify.$orig_left"
30 verify_right="verify.$orig_right"
32 if [ -e "$expected_diff" ]; then
33 echo cmp "$got_diff" "$expected_diff"
34 if ! cmp "$got_diff" "$expected_diff" ; then
35 echo "FAIL: $got_diff != $expected_diff" | tee -a errors
39 if [ -z "$ignore_whitespace" -a "x$diff_type" = "xunidiff" ]; then
40 cp "$orig_left" "$verify_right"
41 $patch_prog --quiet -u "$verify_right" "$the_diff"
42 if ! cmp "$orig_right" "$verify_right" ; then
43 echo "FAIL: $orig_right != $verify_right" | tee -a errors
47 cp "$orig_right" "$verify_left"
48 $patch_prog --quiet -u -R "$verify_left" "$the_diff"
49 if ! cmp "$orig_left" "$verify_left" ; then
50 echo "FAIL: $orig_left != $verify_left" | tee -a errors
53 elif [ -z "$ignore_whitespace" ]; then
54 tail -n +3 "$the_diff" | grep -v "^+" | sed 's/^.//' > "$verify_left"
55 tail -n +3 "$the_diff" | grep -v "^-" | sed 's/^.//' > "$verify_right"
57 if ! cmp "$orig_left" "$verify_left" ; then
58 echo "FAIL: $orig_left != $verify_left" | tee -a errors
61 if ! cmp "$orig_right" "$verify_right" ; then
62 echo "FAIL: $orig_right != $verify_right" | tee -a errors
66 echo "OK: $diff_prog $orig_left $orig_right"
70 for left in test*.left* ; do
71 right="$(echo "$left" | sed 's/\.left/\.right/')"
72 diff_opts="$(echo "$left" | sed 's/test[0-9]*\.left\([-a-zA-Z0-9]*\).txt/\1/')"
73 expected_diff="$(echo "$left" | sed 's/test\([-0-9a-zA-Z]*\)\..*/expect\1.diff/')"
74 got_diff="verify.$expected_diff"
76 "$diff_prog" $diff_opts "$left" "$right" > "$got_diff"
78 verify_diff_script "$left" "$right" "$got_diff" "$expected_diff" "$diff_opts"
81 # XXX required to keep GNU make completely silent during 'make regress'
82 if make -h 2>/dev/null | grep -q no-print-directory; then
83 make_opts="--no-print-directory"
85 for ctest in *_test.c ; do
86 prog="$(echo "$ctest" | sed 's/.c//')"
87 expect_output="expect.${prog}"
88 prog_output="verify.$expect_output"
89 make $make_opts -s -C "$prog" regress > "$prog_output"
90 if ! cmp "$prog_output" "$expect_output" ; then
91 echo "FAIL: $prog_output != $expect_output" | tee -a errors
98 if [ -f errors ]; then