Skip to content

Commit

Permalink
test: fix test runner on MinGW
Browse files Browse the repository at this point in the history
MinGW does not export the _set_fmode function via its
libmsvcrt.a import library unless on an ARM platform. This
causes the test target build to fail without manually
adjusting the link parameters.

It is safe to assume that _fmode is available in all stable
releases, and it should be preferred unless using MSVC. This
is unrelated to #2407, but when both are fixed, MinGW builds
should complete successfully.

PR-URL: #2411
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
  • Loading branch information
Crunkle authored and cjihrig committed Aug 7, 2019
1 parent b144695 commit be1e719
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/runner-win.c
Expand Up @@ -55,7 +55,12 @@ int platform_init(int argc, char **argv) {
_setmode(0, _O_BINARY);
_setmode(1, _O_BINARY);
_setmode(2, _O_BINARY);

#ifdef _MSC_VER
_set_fmode(_O_BINARY);
#else
_fmode = _O_BINARY;
#endif

/* Disable stdio output buffering. */
setvbuf(stdout, NULL, _IONBF, 0);
Expand Down

0 comments on commit be1e719

Please sign in to comment.