Skip to content

Conversation

@jcfr
Copy link
Contributor

@jcfr jcfr commented Aug 26, 2025

This pull request fixes the execution of the testrunner in out-of-source builds by setting the SIMPLECPP_SOURCE_DIR definition. This change ensures that the test runner can correctly find include paths by using the source directory.

The CMakeLists.txt file is updated to define SIMPLECPP_SOURCE_DIR, and the test cases in test.cpp are modified to conditionally add this directory to the include paths if
defined.

@firewave
Copy link
Collaborator

We should also add an out-of-source build to the CI to make sure this does not break in the future.

@jcfr
Copy link
Contributor Author

jcfr commented Aug 26, 2025

Thanks for the taking the time to review 🙏

All the review comments have been addressed. Once the GitHub workflow have been enabled and the test pass, I believe this will be ready for integration 🚀

cc: @danmar @firewave

@firewave
Copy link
Collaborator

The out-of-source build should be a single additional step and not all of the builds.

@firewave
Copy link
Collaborator

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. ubuntu-24.04 and g++). It is also fine to use a single step for it.

@jcfr jcfr force-pushed the fix-testrunner-out-of-source branch 3 times, most recently from 6a2a43d to 5a942c7 Compare August 27, 2025 14:37
@jcfr
Copy link
Contributor Author

jcfr commented Aug 27, 2025

Et voila. All comments have been addressed:

  • Simple update of the GitHub workflow
  • Rename of the define to remove ambiguity
  • Update of Makefile to also pass the expected define

jcfr added 4 commits August 28, 2025 14:11
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.
@jcfr jcfr force-pushed the fix-testrunner-out-of-source branch from 5a942c7 to 49a8a16 Compare August 28, 2025 18:11
Co-authored-by: Oliver Stöneberg <firewave@users.noreply.github.com>
@jcfr jcfr force-pushed the fix-testrunner-out-of-source branch from 49a8a16 to d3b0ba1 Compare August 28, 2025 20:28
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>
@danmar danmar merged commit cd2dd49 into danmar:master Aug 29, 2025
13 checks passed
@firewave
Copy link
Collaborator

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.

@hjmjohnson
Copy link

Awesome!

@jcfr jcfr deleted the fix-testrunner-out-of-source branch August 30, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants