catchorg / catchorg/Catch2

CMake integration: CTest test list does not work when cross-compiling without CROSSCOMPILING_EMULATOR

Open
#2,223 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Describe the bug**
If I run `ctest --show-only` inside the build dir of a cross-compiled project that uses `catch_discover_tests`, it doesn't print any tests but the failed `execute_process` does not fail the build (it just prints `cannot execute binary file` and continues because the output is not equal to `0`.

I can see that the documentation states:
> it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set in order to function in a cross-compiling environment.

However, I think it would be good if `CatchAddTests.cmake` could just add a single `add_test()` that invokes the Catch2 binary without any filtering if the listing fails.

**Reproduction steps**

Cross-compile any project that uses the Catch2 CMake integration without CMAKE_CROSS_COMPILING_EMULATOR and then run ctest --show-only in the build directory.

**Platform information:**

- Catch version: **v2.13.6**
- Cross-compiling for FreeBSD from macOS.

**Additional context**
In order to build and run tests I don't (can't) use CMAKE_CROSS_COMPILING_EMULATOR. Instead I build the tests, start a QEMU VM, mount the build directory via SMBFS and run them manually (well I have a [set of python scripts that do all of this](https://github.com/CTSRD-CHERI/cheribuild/pull/192/files)).
Ideally I'd like ctest to drive that process rather than having to hardcode the list of tests.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.