tests: beware of portability issues with diff -u

AIX 7.1 supports diff -u, but its output does not match the expected
one.
Reported by Bruno Haible.
https://lists.gnu.org/r/bug-bison/2020-05/msg00049.html

* tests/atlocal.in (DIFF_U_WORKS): New.
* tests/local.at (AT_DIFF_U_CHECK): New.
* tests/existing.at (_AT_TEST_EXISTING_GRAMMAR): Use AT_DIFF_U_CHECK.
This commit is contained in:
Akim Demaille
2020-05-04 06:06:33 +02:00
parent 1429569362
commit f1497356e8
3 changed files with 53 additions and 7 deletions

View File

@@ -83,6 +83,16 @@ set x `LC_ALL=C ls -l '$1'` &&
## ------------- ##
# AT_DIFF_U_CHECK(DIFF-ARGS, EXPECTED-DIFF)
# -----------------------------------------
# If diff -u works as we expect, use it, with headers stripped.
m4_define([AT_DIFF_U_CHECK],
[if $DIFF_U_WORKS; then
AT_CHECK([diff -u $1 | sed -n '/^@@/,$p' | sed 's/^ $//'], [0], [$2])
fi
])
# AT_PERL_CHECK(PERL-ARGS, ...)
# -----------------------------
# If Perl is available, run this test.