fmt
fmt copied to clipboard
Failing tests on MSYS2/MinGW x64
Hello, these are some test failures of a clean build of fmt under MSYS2/MinGW x64 on Windows 10 x64. Not sure what's going on here, I will investigate further -- for now I'm capturing the test output for awareness.
chrono-test:
C:/msys64/home/vromeo5/fmt/test/chrono-test.cc:132: Failure
Expected equality of these values:
system_strftime(iso_week_spec, &tm)
Which is: "1975-12-29: "
fmt::format(fmt::runtime(fmt_spec), tm)
Which is: "1975-12-29: 1976 76 01"
C:/msys64/home/vromeo5/fmt/test/chrono-test.cc:132: Failure
Expected equality of these values:
system_strftime(iso_week_spec, &tm)
Which is: "1977-01-02: "
fmt::format(fmt::runtime(fmt_spec), tm)
Which is: "1977-01-02: 1976 76 53"
...
format-test:
...
←[0;32m[ RUN ] ←[mformat_test.to_string
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff7ae1eb756 in __netf2 ()
format-impl-test:
...
←[0;32m[ RUN ] ←[mformat_impl_test.write_float128
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff7916b7696 in __netf2 ()
xchar-test:
C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:295: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, t1)
Which is: L"\n"
With diff:
@@ -1,1 +1,2 @@
-L""
+L"
+"
warning: C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:295: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, t1)
Which is: L"\n"
With diff:
@@ -1,1 +1,2 @@
-L""
+L"
+"
warning:
C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:296: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, tm)
Which is: L"\n"
With diff:
@@ -1,1 +1,2 @@
-L""
+L"
+"
warning: C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:296: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, tm)
Which is: L"\n"
With diff:
@@ -1,1 +1,2 @@
-L""
+L"
+"
warning:
warning: Invalid parameter passed to C runtime function.
C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:295: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, t1)
Which is: L"\t"
warning: C:/msys64/home/vromeo5/fmt/test/xchar-test.cc:295: Failure
Expected equality of these values:
sys_output
Which is: L""
fmt::format(fmt_spec, t1)
Which is: L"\t"
IIRC std::locale is broken in MinGW so I don't think we can do much about the first issue other than disabling the test (a PR would be welcome). Not sure about the other ones.
MinGW comes in different flavours now, see https://www.msys2.org/docs/environments/
The test failure appears if you compile for the target platform MINGW64 or MINGW32 which uses the old Microsoft C standard library called "msvcrt" which is C89 and also uses some MinGW functions that implement some C99 functionality. strftime is part of msvcrt which means it conforms only to C89 and it does not have the new conversion specifiers like %G or %g.
The fix is to upgrade to MinGW+UCRT and just use the new C standard library which properly conforms to new standards. To fix testing failures, one should somehow detect if the new UCRT is used or not and skip all calls to strftime() or std::time_put::put() that use the new conversion specifiers from C99. Unfortunately, I can not find if UCRT provides some predefined macros.
The failure in xchar-test.cc is because it has very similar test like in chrono-test but with wide characters (wchar_t). That test calls std::time_put<wchar_t>::put() which eventually calls wcftime and the same story applies.