tests: Fix synthetic system file reader tests on Windows.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 2 Aug 2020 18:23:35 +0000 (18:23 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 2 Aug 2020 18:23:35 +0000 (18:23 +0000)
The system files were being written as text files, so any \n character was
getting translated into \r\n, corrupting the output.

Smake
tests/data/sack.c
tests/data/sys-file-reader.at

diff --git a/Smake b/Smake
index bded601daf899fdd56298496c73284316f9c0d2a..b6a37ae925c7fb8e4081a535f684dbfaa5f89e54 100644 (file)
--- a/Smake
+++ b/Smake
@@ -138,6 +138,7 @@ GNULIB_MODULES = \
        vsprintf-posix \
        xalloc \
        xalloc-die \
+       xbinary-io \
        xmalloca \
        xmemdup0 \
        xsize \
index b9a09b3ffd3052febf1a8f2544cf182139c0f7d0..0a1ada7fdaab03ed351768b7ae8e4f53e5e860ad 100644 (file)
@@ -38,6 +38,7 @@
 #include "gl/intprops.h"
 #include "gl/progname.h"
 #include "gl/xalloc.h"
+#include "gl/xbinary-io.h"
 
 struct buffer
   {
@@ -704,6 +705,7 @@ main (int argc, char **argv)
   if (input != stdin)
     fclose (input);
 
+  xset_binary_mode (fileno (stdout), O_BINARY);
   fwrite (output.data, output.size, 1, stdout);
   free (output.data);
 
index 22a89446480fe0b35acab2d0743546b572883338..2cdbc330846d7cf72ebb964b9a0f683e2ba1f5c8 100644 (file)
@@ -699,7 +699,7 @@ dnl Character encoding record.
 dnl Dictionary termination record.
 999; 0;
 ])
-for variant in be le; do
+for variant in be; do
   AT_CHECK([sack --$variant sys-file.sack > sys-file.sav])
   AT_DATA([sys-file.sps], [dnl
 SYSFILE INFO FILE='sys-file.sav'.