summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-22 13:47:15 +0200
committerBruno Haible <bruno@clisp.org>2023-04-22 13:47:15 +0200
commiteddc3474ec1fdd1856b24b37806bc92a700c0cb9 (patch)
treee6be71a607802141a9a7eaa298707ad7385d8941
parentdd0a48f50a97ca1185c957b0846e715be7777bcb (diff)
downloadgnulib-eddc3474ec1fdd1856b24b37806bc92a700c0cb9.tar.gz
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.
-rw-r--r--ChangeLog9
-rw-r--r--modules/dfa-tests1
-rwxr-xr-xtests/test-dfa-invalid-char-class.sh3
-rw-r--r--tests/test-dfa-match-aux.c7
4 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bdc213a32..a8631ac595 100644
--- 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.
diff --git a/modules/dfa-tests b/modules/dfa-tests
index afa317acdf..c4585fdf45 100644
--- a/modules/dfa-tests
+++ b/modules/dfa-tests
@@ -5,6 +5,7 @@ tests/test-dfa-invalid-char-class.sh
tests/test-dfa-invalid-merge.sh
Depends-on:
+binary-io
stdio
stdlib
string
diff --git a/tests/test-dfa-invalid-char-class.sh b/tests/test-dfa-invalid-char-class.sh
index b9b18980b6..1428d7966a 100755
--- a/tests/test-dfa-invalid-char-class.sh
+++ b/tests/test-dfa-invalid-char-class.sh
@@ -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
diff --git a/tests/test-dfa-match-aux.c b/tests/test-dfa-match-aux.c
index b39bb6da86..cef29e6a83 100644
--- a/tests/test-dfa-match-aux.c
+++ b/tests/test-dfa-match-aux.c
@@ -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);