]> Savannah Git Hosting - gnulib.git/commitdiff
dfa tests: Fix test failure on mingw differently.
authorBruno Haible <bruno@clisp.org>
Sat, 22 Apr 2023 11:47:15 +0000 (13:47 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 22 Apr 2023 11:47:15 +0000 (13:47 +0200)
Suggested by Paul Eggert.

* tests/test-dfa-invalid-char-class.sh: Revert last change.
* tests/test-dfa-match-aux.c: Include binary-io.h.
(main): Put stdout into binary mode.
* modules/dfa-tests (Depends-on): Add binary-io.

ChangeLog
modules/dfa-tests
tests/test-dfa-invalid-char-class.sh
tests/test-dfa-match-aux.c

index 5bdc213a32c4a529268d65071e0e987c29d72b60..a8631ac595622934c93b4e091e32b82c6e212772 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-04-22  Bruno Haible  <bruno@clisp.org>
+
+       dfa tests: Fix test failure on mingw differently.
+       Suggested by Paul Eggert.
+       * tests/test-dfa-invalid-char-class.sh: Revert last change.
+       * tests/test-dfa-match-aux.c: Include binary-io.h.
+       (main): Put stdout into binary mode.
+       * modules/dfa-tests (Depends-on): Add binary-io.
+
 2023-04-20  Bruno Haible  <bruno@clisp.org>
 
        getumask: Make it work on native Windows.
index afa317acdf66e31ad25632d08740d3f60ca5ecc2..c4585fdf45c4acff27efe71fc637c95fe8fa7b22 100644 (file)
@@ -5,6 +5,7 @@ tests/test-dfa-invalid-char-class.sh
 tests/test-dfa-invalid-merge.sh
 
 Depends-on:
+binary-io
 stdio
 stdlib
 string
index b9b18980b60e3dfd815efba836eef201ea286358..1428d7966ad0fa8c7ad775810299a68a3589fff1 100755 (executable)
@@ -24,8 +24,7 @@ path_prepend_ .
 fail=0
 
 echo 'dfaerror: invalid character class' > exp
-LC_ALL=C ${CHECKER} test-dfa-match-aux '[[:foo:]]' a > tmp 2>&1
-LC_ALL=C tr -d '\r' < tmp > out
+LC_ALL=C ${CHECKER} test-dfa-match-aux '[[:foo:]]' a > out 2>&1
 compare exp out || fail=1
 
 Exit $fail
index b39bb6da862892e5e2104dad92ce249749c6132a..cef29e6a83d985c1f713e76025c47a2f3546995e 100644 (file)
@@ -26,6 +26,8 @@
 #include <dfa.h>
 #include <localeinfo.h>
 
+#include "binary-io.h"
+
 _Noreturn void
 dfaerror (char const *mesg)
 {
@@ -53,6 +55,11 @@ main (int argc, char **argv)
   if (argc < 3)
     exit (EXIT_FAILURE);
 
+  /* This test's fixture needs to compare this program's output with an expected
+     output.  On native Windows, the CR-LF newlines would cause this comparison
+     to fail.  But we don't want to postprocess this program's output.  */
+  set_binary_mode (STDOUT_FILENO, O_BINARY);
+
   setlocale (LC_ALL, "");
   init_localeinfo (&localeinfo);