-
Notifications
You must be signed in to change notification settings - Fork 94
tests: Fix execution of testrunner for out-of-source builds #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
We should also add an out-of-source build to the CI to make sure this does not break in the future. |
|
The out-of-source build should be a single additional step and not all of the builds. |
Let me re-phrase that - it should not affect all of the steps. This unnecessary taints the workflows. It is also enough to just test it for a single os and compiler (i.e. |
6a2a43d to
5a942c7
Compare
|
Et voila. All comments have been addressed:
|
This changes the testrunner configuration to correctly handle out-of-source builds by setting the SIMPLECPP_SOURCE_DIR definition. This ensures that the source directory is available to the test runner, allowing it to find include paths correctly.
The `SIMPLECPP_SOURCE_DIR` define was changed to `SIMPLECPP_TEST_SOURCE_DIR` to remove ambiguity about its purpose. This change clarifies that the variable is intended to be used in the context of testing. Suggested-by: Oliver Stöneberg <firewave@users.noreply.github.com>
This updates the GitHub Actions workflow to execute `testrunner` twice, but only for the CMake build case: - Once from the repository root (default case). - Once from within the `cmake.output` build directory to ensure the `SIMPLECPP_TEST_SOURCE_DIR` definition is correctly set and resolved. Note that this is not yet supported for the Makefile-based build. Suggested-by: Oliver Stöneberg <firewave@users.noreply.github.com>
This updates the Makefile so that `test.o` is compiled with `-DSIMPLECPP_TEST_SOURCE_DIR="$(CURDIR)"`, ensuring the test suite can locate headers and sources consistently with the CMake build.
5a942c7 to
49a8a16
Compare
Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>
49a8a16 to
d3b0ba1
Compare
This ensures that preprocessor flags are managed separately from compiler flags, avoiding confusion with user-provided CXXOPTS. Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>
|
Hey, that also fixes the test failures I was seeing locally since forever. I always attributed those to some EOL issues since they never reproduced anywhere else. |
|
Awesome! |
This pull request fixes the execution of the
testrunnerin out-of-source builds by setting theSIMPLECPP_SOURCE_DIRdefinition. This change ensures that the test runner can correctly find include paths by using the source directory.The
CMakeLists.txtfile is updated to defineSIMPLECPP_SOURCE_DIR, and the test cases intest.cppare modified to conditionally add this directory to the include paths ifdefined.