catch_discover_tests fails for Windows test executables run under Wine since v3.15.2
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cmake, cpp
- Domain
- build-system, testing
Research direction
Start with extras/CatchAddTests.cmake, where the issue says the listing path is passed to the test executable as a separate argument. Check how catch_discover_tests constructs the --out argument and how the failing Wine invocation parses it. Update the argument so the path is accepted, then verify discovery succeeds for Windows test executables run under Wine.
Written by the indexing model from the issue text.
Description
Describe the bug
Since 9ec44dd (the fix for #3162), CatchAddTests.cmake passes the listing temp file as a separate argument: --out "${listing_output_path}". The temp path comes from XDG_RUNTIME_DIR, TMPDIR, TMP or TEMP, so on a Linux host it starts with /.
When the test executable is a Windows binary run through CMAKE_CROSSCOMPILING_EMULATOR (Wine), Clara treats / as an option prefix on Windows (isOptPrefix in catch_clara.cpp). The path is then parsed as a new option rather than the value of --out, and discovery fails:
Error(s) in input:
Expected argument following --out
CMake Error at .../build/x64/_deps/catch2-src/extras/CatchAddTests.cmake:307 (message):
Error listing tests from executable
'.../build/x64/tests/Release/PatchFix.Tests.exe':
Passing the value in the same argument works: wine tests.exe --list-tests --reporter json --out=/tmp/x.json writes the listing, while --out /tmp/x.json fails with the error above.
Expected behavior
Discovery works for Windows executables run under Wine, as it did up to v3.15.1.
Reproduction steps
Reproduced with https://github.com/playday3008/PatchFix at commit 2e2763aae1e57ddb304333fc22a5f741bdc7c2a8, which pins Catch2 v3.15.0 in cmake/deps/catch2.cmake and registers its tests with catch_discover_tests(... DISCOVERY_MODE PRE_TEST). The commands below follow its Linux CI job runs; the toolchain needs LLVM, Ninja, Wine and msvc-wine installed to ~/.msvc.
git clone https://github.com/playday3008/PatchFix && cd PatchFix
git checkout 2e2763aae1e57ddb304333fc22a5f741bdc7c2a8
sed -i 's/v3.15.0/v3.16.1/' cmake/deps/catch2.cmake
cmake --preset wine-x64
cmake --build --preset wine-x64-release --target PatchFix.Tests
ctest --test-dir build/x64 -C Release --output-on-failure --no-tests=error
With v3.15.0 or v3.15.1, ctest passes. With v3.15.2, v3.15.3, v3.16.0 or v3.16.1, it fails with the error above.
Possible fix
Pass the path in one argument in CatchAddTests.cmake, for example "--out=${listing_output_path}", so parsing no longer depends on the first character of the path.
Platform information:
- OS: Linux host (Fedora), Windows x64 target run under Wine 11.0 (Staging)
- Compiler+version: clang-cl 22.1.8 with MSVC headers and libraries via msvc-wine
- Catch version: v3.15.2 through v3.16.1 fail; v3.15.1 works
Additional context
Same origin as #3241 (Emscripten), but a different cause; the stdout options proposed there would not fix this by default.
- Dominant language
- C++
- Stars
- 21.6k
- Forks
- 3.4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from catchorg/Catch2
-
catch_discover_tests passes all EXTRA_ARGS as one argumentPossibly taken @CyberKun claimed this 11 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
catchorg/Catch2#3239 · 1 comment ·
Maintainers usually reply within 2 days
-
Not seeing some error messages from fakeit in jetbrains riderPossibly taken @Amanpal9 claimed this 21 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
catchorg/Catch2#3228 · 1 comment ·
Maintainers usually reply within 2 days
-
catch_discover_tests fails for Emscripten/WASM tests since v3.16.0Possibly taken @nafiurahman00 claimed this 8 days ago. OpenExtras
Difficulty 3/5 1-2 days Newbie friendliness 72/100
catchorg/Catch2#3241 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
Commit `b710039` breaks tests with overloaded `operator==`Possibly taken @michaelbawuah claimed this 45 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 75/100
catchorg/Catch2#3221 · 1 reaction ·
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cp-algorithms/cp-algorithms#1774 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
telefonicaid/fiware-orion#4836 ·
Maintainers usually reply within 1 day
-
nixd exits at startup when its parent process belongs to another userPossibly taken @conao3 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nix-community/nixd#930 ·
Maintainers usually reply within 2 days
-
refactor topic-ui topic-weather
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Command-Install Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
microsoft/winget-cli#6718 ·
Maintainers usually reply within 2 days