tests: add expected-failing test for minor subopimality

In some unusual cases, diff -u prints suboptimal output.
* tests/large-subopt: New test script.
* tests/Makefile.am (TESTS): Add it.
(XFAIL_TESTS): Add it here, too, to record that this test is
currently expected to fail.
* tests/large-subopt.in1, tests/large-subopt.in2: Inputs derived from
those in http://bugs.gnu.org/28796
This commit is contained in:
Jim Meyering 2017-10-20 23:13:54 -07:00
parent 7ba026cae3
commit b50ab11f23
4 changed files with 12514 additions and 1 deletions

View File

@ -14,6 +14,7 @@ TESTS = \
function-line-vs-leading-space \
ignore-matching-lines \
label-vs-func \
large-subopt \
new-file \
no-dereference \
no-newline-at-eof \
@ -22,8 +23,12 @@ TESTS = \
filename-quoting \
colors
XFAIL_TESTS = large-subopt
EXTRA_DIST = \
$(TESTS) init.sh t-local.sh envvar-check
$(TESTS) init.sh t-local.sh envvar-check \
large-subopt.in1 \
large-subopt.in2
# Note that the first lines are statements. They ensure that environment
# variables that can perturb tests are unset or set to expected values.

25
tests/large-subopt Normal file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# This test is expected to fail at least with diffutils-3.6.
# Demonstrate how diff can produce suboptimal output.
# With these two files, diff -u prints output including this:
# -2
# +L: 361
# +L: 361
# +2
# The trouble is that "2" line that is both added and removed.
# This smaller patch could induce the same change:
# +L: 361
# +L: 361
. "${srcdir=.}/init.sh"; path_prepend_ ../src
fail=0
diff -u \
"$abs_top_srcdir/tests/large-subopt.in1" \
"$abs_top_srcdir/tests/large-subopt.in2" \
| perl -n0 -e \
'/\n-2\n(\+L: 361\n){2}\+2\n/ and do {$e=1; last}; END{exit !$e}' \
&& fail=1
Exit $fail

6706
tests/large-subopt.in1 Normal file

File diff suppressed because it is too large Load Diff

5777
tests/large-subopt.in2 Normal file

File diff suppressed because it is too large Load Diff