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

@@ -35,14 +35,9 @@ dnl time comes, just use sed to drop the line numbers. For now, as LR(1)
dnl support is rapidly evolving, let's keep that information to be careful.
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
m4_pushdef([AT_LALR1_DIFF_CHECK],
[dnl We need diff -u, which is not portable.
AT_CHECK([diff -u /dev/null /dev/null || exit 77], [0], [ignore])
AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
AT_CHECK([[diff -u input-lalr.output input.output \
| sed -n '/^@@/,$p' | sed 's/^ $//']],
[[0]], [$1])])
AT_DIFF_U_CHECK([[input-lalr.output input.output]], [$1])])
AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
[[%define lr.type lalr