[PATCH] tests: Fix test failures of Java tests on Cygwin
Bruno Haible via "Bug reports for Bison, the GNU parser generator" <[email protected]> Tue, 05 Aug 2025 01:53:04 +0200
| Newsgroups | gmane.comp.parsers.bison.bugs |
|---|---|
| Organization | GNU |
| Message-ID | <27084395.RjEADstKbi@nimes> |
This is a multi-part message in MIME format. --nextPart4818604.9fHWaBTJ5E Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, Building GNU Bison on Cygwin, I see many Java tests fail. The cause is that the Java implementation is a native Windows one (since there is no Cygwin build of any Java implementation [1]), and it standard output and standard error contains newlines in CRLF format. Whereas the test suite expects certain output _exactly_. For instance, one of the tests fails like this: # -*- compilation -*- 216. conflicts.at:523: testing parse.error=verbose and consistent errors: lr.type=ielr java ... ../../tests/conflicts.at:523: COLUMNS=1000; export COLUMNS; NO_TERM_HYPERLINKS=1; export NO_TERM_HYPERLINKS; bison --color=no -fno-caret -o input.java input.y ../../tests/conflicts.at:523: $SHELL ../../../javacomp.sh input.java stderr: stdout: ../../tests/conflicts.at:523: $SHELL ../../../javaexec.sh input --- - 2025-07-30 15:07:58.710199100 +0000 +++ /cygdrive/d/a/ci-check/ci-check/bison-3.8.2.56-2cea-2025-07-30/build/tests/testsuite.dir/at-groups/216/stderr 2025-07-30 15:07:58.669423700 +0000 @@ -1,2 +1,2 @@ -syntax error, unexpected end of file +syntax error, unexpected end of file^M 216. conflicts.at:523: 216. parse.error=verbose and consistent errors: lr.type=ielr java (conflicts.at:523): FAILED (conflicts.at:523) Note the CR (Ctrl-M) at the end of the actual stderr line. Since the AT_CHECK macro does not allow customizing the way it captures and then compares the stdout and stderr contents, the only possibly fix is to change the command to be executed. This patch does it, using a program 'nlcanon' that was added to Gnulib today. So, here's the fix: 1) Update gnulib to latest. 2) Apply the attached patch. With this fix, the Cygwin build now succeeds, including "make check". [1] https://cygwin.com/packages/package_list.html --nextPart4818604.9fHWaBTJ5E Content-Disposition: attachment; filename="0001-tests-Fix-test-failures-of-Java-tests-on-Cygwin.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="x-UTF_8J"; name="0001-tests-Fix-test-failures-of-Java-tests-on-Cygwin.patch" From 8d3228b8ac9580d6813edd8fe429fca391d6854c Mon Sep 17 00:00:00 2001 From: Bruno Haible <[email protected]> Date: Mon, 4 Aug 2025 14:22:03 +0200 Subject: [PATCH] tests: Fix test failures of Java tests on Cygwin. * bootstrap.conf (gnulib_modules): Add nlcanon. * tests/local.at (AT_JAVA_PARSER_CHECK): Add an nlcanon.sh invocation. --- bootstrap.conf | 1 + tests/local.at | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf index 2e9513c3..8a924973 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -35,6 +35,7 @@ gnulib_modules=' linked-list malloc-gnu mbfile mbswidth + nlcanon obstack obstack-printf perror progname diff --git a/tests/local.at b/tests/local.at index ee542f9e..e5f6adb1 100644 --- a/tests/local.at +++ b/tests/local.at @@ -1599,7 +1599,11 @@ AT_CHECK([sed >&2 -e '/^profiling:.*:Merge mismatch for summaries/d' stderr], # AT_JAVA_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) # ----------------------------------------------------------------- m4_define([AT_JAVA_PARSER_CHECK], -[AT_CHECK([$5[ $SHELL ../../../javaexec.sh ]$1], [$2], [$3], [$4])]) +[m4_pushdef([AT_JAVA_NLCANON], + [$SHELL ../../../nlcanon.sh windows-based stdout,stderr ])dnl +AT_CHECK([$5[ ]AT_JAVA_NLCANON[$SHELL ../../../javaexec.sh ]$1], + [$2], [$3], [$4])dnl +m4_popdef([AT_JAVA_NLCANON])]) # AT_PARSER_CHECK(COMMAND, EXIT-STATUS, EXPOUT, EXPERR, [PRE]) -- 2.50.1 --nextPart4818604.9fHWaBTJ5E--