spdlog icon indicating copy to clipboard operation
spdlog copied to clipboard

[MSVC][Windows] spdlog-utests failed on MSVC

Open QuellaZhang opened this issue 1 month ago • 2 comments

Hi,

The MSVC team regularly builds popular open-source projects (including spdlog) in order to find and fix regressions. Recently the spdlog-utests test has been consistently failing, it’s a falky test. I noticed https://github.com/gabime/spdlog/issues/3483, it looks like the same issue.

Environment:

  • Windows
  • spdlog version: 3f03542
  • Build type: default

Build Steps:

  1. Open VS2026 x64 Native tools command prompt
  2. git clone https://github.com/gabime/spdlog.git C:\gitP\gabime\spdlog
  3. mkdir C:\gitP\gabime\spdlog\build_amd64 && cd /d C:\gitP\gabime\spdlog\build_amd64
  4. cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_TESTS=ON ..
  5. msbuild /m /p:Platform=x64 /p:Configuration=Release spdlog.sln /t:Rebuild
  6. ctest -C Release --output-on-failure

Error message:

Test project C:/gitP/gabime/spdlog/build_amd64
    Start 1: spdlog-utests
1/1 Test #1: spdlog-utests ....................***Failed    7.22 sec
The system cannot find the file specified.
The system cannot find the file specified.
Randomness seeded to: 3888847016

spdlog-utests.exe is a Catch2 v3.5.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
GMT offset 
-------------------------------------------------------------------------------
C:\gitP\gabime\spdlog\tests\test_pattern_formatter.cpp(80)
...............................................................................

C:\gitP\gabime\spdlog\tests\test_pattern_formatter.cpp(86): FAILED:
  REQUIRE( log_to_str_with_time(yesterday, "Some message", "%z", spdlog::pattern_time_type::utc, "\n") == "+00:00\n" )
with expansion:
  "-08:00
  "
  ==
  "+00:00
  "

The system cannot find the file specified.
[*** LOG ERROR #0001 ***] [2025-12-03 04:10:38] [as] async log: thread pool doesn't exist anymore
[2025-12-03 04:10:38.567] [test] [trace] Test stdout_st
[2025-12-03 04:10:38.567] [test] [debug] Test stdout_mt
[2025-12-03 04:10:38.567] [test] [info] Test stderr_st
[2025-12-03 04:10:38.567] [test] [info] Test stderr_mt
[2025-12-03 04:10:38.567] [test] [warning] Test stderr_mt
[2025-12-03 04:10:38.567] [test] [error] Test stderr_mt
[2025-12-03 04:10:38.567] [test] [critical] Test stderr_mt
[2025-12-03 04:10:38.567] [test] [info] Test stdout_color_st
[2025-12-03 04:10:38.567] [test] [trace] Test stdout_color_mt
[2025-12-03 04:10:38.567] [test] [debug] Test stderr_color_st
[2025-12-03 04:10:38.567] [test] [info] Test stderr_color_mt
[2025-12-03 04:10:38.567] [test] [warning] Test stderr_color_mt
[2025-12-03 04:10:38.567] [test] [error] Test stderr_color_mt
[2025-12-03 04:10:38.567] [test] [critical] Test stderr_color_mt
The system cannot find the file specified.
[*** LOG ERROR #0002 ***] [2025-12-03 04:10:40] [test-error] argument not found
===============================================================================
test cases: 176 | 175 passed | 1 failed
assertions: 661 | 660 passed | 1 failed



0% tests passed, 1 tests failed out of 1

Total Test time (real) =   7.23 sec

The following tests FAILED:
	  1 - spdlog-utests (Failed)
Errors while running CTest`

QuellaZhang avatar Dec 05 '25 07:12 QuellaZhang

As a workaround, the CMake option variable SPDLOG_NO_TZ_OFFSET has been added: #3491 Windows also calculates time zone offsets, so there may be issues that simply went unnoticed until now. Please enable this option in environments where the issue occurs.

https://github.com/gabime/spdlog/blob/3f03542d2eb4952e3b279d9cad9098d370b7be57/include/spdlog/details/os-inl.h#L249-L265

tt4g avatar Dec 05 '25 10:12 tt4g

Thank you for the workaround. I will add it to the CMake command line.

QuellaZhang avatar Dec 09 '25 02:12 QuellaZhang