From 87c456bf6fb9453144890f0941c118a49b20fda5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 15 Feb 2017 15:33:17 -0800 Subject: [PATCH] tests: Adjust to recent SET_BINARY change * tests/test-binary-io.c (main): * tests/test-binary-io.sh: Remove test for SET_BINARY. * tests/test-closein.c, tests/test-fflush2.c, tests/test-ftell.c: * tests/test-ftello.c, tests/test-nonblocking-pipe-child.c: * tests/test-yesno.c: Use set_binary_mode, not SET_BINARY. --- ChangeLog | 7 +++++++ tests/test-binary-io.c | 6 ------ tests/test-binary-io.sh | 2 -- tests/test-closein.c | 2 +- tests/test-fflush2.c | 2 +- tests/test-ftell.c | 2 +- tests/test-ftello.c | 2 +- tests/test-nonblocking-pipe-child.c | 2 +- tests/test-yesno.c | 2 +- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 756858d85d..f7bccee8ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2017-02-15 Paul Eggert + tests: Adjust to recent SET_BINARY change + * tests/test-binary-io.c (main): + * tests/test-binary-io.sh: Remove test for SET_BINARY. + * tests/test-closein.c, tests/test-fflush2.c, tests/test-ftell.c: + * tests/test-ftello.c, tests/test-nonblocking-pipe-child.c: + * tests/test-yesno.c: Use set_binary_mode, not SET_BINARY. + xsetmode: new module This is to fix a problem noted by Eric Blake. Code was using xfreopen to change files to binary mode, but this diff --git a/tests/test-binary-io.c b/tests/test-binary-io.c index f53a1aee66..46ccce588e 100644 --- a/tests/test-binary-io.c +++ b/tests/test-binary-io.c @@ -55,12 +55,6 @@ main (int argc, char *argv[]) fputs ("Hello\n", stdout); break; - case '2': - /* Test the SET_BINARY macro. */ - SET_BINARY (1); - fputs ("Hello\n", stdout); - break; - default: break; } diff --git a/tests/test-binary-io.sh b/tests/test-binary-io.sh index c4dd6e9295..3af53c6b8b 100755 --- a/tests/test-binary-io.sh +++ b/tests/test-binary-io.sh @@ -6,8 +6,6 @@ trap 'rm -fr $tmpfiles' 1 2 3 15 tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp t-bin-out2.tmp" ./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1 cmp t-bin-out0.tmp t-bin-out1.tmp > /dev/null || exit 1 -./test-binary-io${EXEEXT} 2 > t-bin-out2.tmp || exit 1 -cmp t-bin-out0.tmp t-bin-out2.tmp > /dev/null || exit 1 rm -fr $tmpfiles diff --git a/tests/test-closein.c b/tests/test-closein.c index 7e3ffa0fde..bd2b33ee04 100644 --- a/tests/test-closein.c +++ b/tests/test-closein.c @@ -38,7 +38,7 @@ main (int argc, char **argv) /* close_stdin currently relies on ftell, but mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); + set_binary_mode (0, O_BINARY); if (argc > 2) close (0); diff --git a/tests/test-fflush2.c b/tests/test-fflush2.c index 2d8d33a080..4d1237bee2 100644 --- a/tests/test-fflush2.c +++ b/tests/test-fflush2.c @@ -28,7 +28,7 @@ main (int argc, char **argv) /* Avoid the well-known bugs of fflush() on streams in O_TEXT mode on native Windows platforms. */ - SET_BINARY (0); + set_binary_mode (0, O_BINARY); if (argc > 1) switch (argv[1][0]) diff --git a/tests/test-ftell.c b/tests/test-ftell.c index 7df08fd4a5..33077023c7 100644 --- a/tests/test-ftell.c +++ b/tests/test-ftell.c @@ -45,7 +45,7 @@ main (int argc, char **argv) } /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); + set_binary_mode (0, O_BINARY); /* Simple tests. */ ASSERT (ftell (stdin) == 0); diff --git a/tests/test-ftello.c b/tests/test-ftello.c index 9ea92400b8..1e9f400204 100644 --- a/tests/test-ftello.c +++ b/tests/test-ftello.c @@ -46,7 +46,7 @@ main (int argc, char **argv _GL_UNUSED) } /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); + set_binary_mode (0, O_BINARY); /* Simple tests. For each test, make sure ftell and ftello agree. */ ASSERT (ftell (stdin) == 0); diff --git a/tests/test-nonblocking-pipe-child.c b/tests/test-nonblocking-pipe-child.c index c965231291..421bfc97fd 100644 --- a/tests/test-nonblocking-pipe-child.c +++ b/tests/test-nonblocking-pipe-child.c @@ -42,7 +42,7 @@ main (int argc, char *argv[]) /* STDIN_FILENO was created as binary in the parent process. But since an fd's mode is stored in the process, not in the kernel, on native Windows we need to set it as binary in the child process again. */ - SET_BINARY (STDIN_FILENO); + set_binary_mode (STDIN_FILENO, O_BINARY); main_reader_loop (test, PIPE_DATA_BLOCK_SIZE, STDIN_FILENO); diff --git a/tests/test-yesno.c b/tests/test-yesno.c index 417d007e05..fdfd3b5bdb 100644 --- a/tests/test-yesno.c +++ b/tests/test-yesno.c @@ -47,7 +47,7 @@ main (int argc, char **argv) position and the last filled buffer end position. (I.e. the repositioning from the end-of-buffer to the expected position does not work if the input file contains end-of-line markers in Unix convention.) */ - SET_BINARY (0); + set_binary_mode (0, O_BINARY); if (1 < argc) i = atoi (argv[1]); -- 2.39.5