Skip to content

Conversation

@guitargeek
Copy link
Contributor

If a test added with ROOT_ADD_TEST uses a command that can't be found on the system and that is not an absolute path, the ROOT_ADD_TEST macro will implicitly prefix $CMAKE_CURRENT_BINARY_DIR/, assimum that the executable is supposed to be found in the current binary dir.

However, that is not always a reasonable fallback, and can be even wrong if the executable was supposed to be found in the PATH that is set in the ENVIRONMENT for that test.

So I think it's better to remove that fallback, requiring the tests to be explicit about which executable should be called.

@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Test Results

    22 files      22 suites   3d 22h 45m 33s ⏱️
 3 785 tests  3 784 ✅ 0 💤 1 ❌
81 252 runs  81 251 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit a802b4b.

@hageboeck
Copy link
Member

As discussed in person, only removing the path won't be enough.

root <xxx>

Would use a system-installed ROOT if present. We either need to retain the path, rewrite the tests to use $<TARGET_FILE:root> or alter PATH for the tests to succeed. The generator expression seems the safest and most easy to read.

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but maybe you could rephrase the first commit message:

  • There's a typo assimum
  • And part of the explanation should be that target names already get expanded. The change therefore only concerns executables that are not targets, and here it makes sense to not prefix them with the current binary directory.

And maybe you could rebuild "clean" because I would like to see the debian tests pass, too.

@hageboeck hageboeck added the clean build Ask CI to do non-incremental build on PR label Dec 3, 2025
If a test added with `ROOT_ADD_TEST` uses a command that can't be found
on the system and that is not an absolute path, the `ROOT_ADD_TEST`
macro will implicitly prefix `$CMAKE_CURRENT_BINARY_DIR/`, assuming that
the executable is supposed to be found in the current binary dir.

However, that is not always a reasonable fallback, and can be even
wrong if the executable was supposed to be found in the `PATH` that is
set in the `ENVIRONMENT` for that test.

So I think it's better to remove that fallback, requiring the tests to
be explicit about which executable should be called.

Note that this doesn't apply to the case when the command is a CMake
target name, because then it will already be expanded to an absolute
path by CMake.
The `root` executable should not be used directly in the test command,
because if there was no `root` CMake target, it might use the literal
string "root" in the command, potentially resolving to a ROOT install on
the system and not the ROOT from the build directory.

It is safer to use a `TARGET_FILE` generator expression here.
@guitargeek
Copy link
Contributor Author

Thanks! The first commit message is now updated.

@guitargeek guitargeek merged commit c021767 into root-project:master Dec 3, 2025
29 checks passed
@guitargeek guitargeek deleted the prefix_current_path branch December 3, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean build Ask CI to do non-incremental build on PR in:Build System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants