Skip to content

[roottest] Fix test dependencies using fixtures#21708

Merged
hageboeck merged 3 commits intoroot-project:masterfrom
hageboeck:roottest_fixtures
Mar 27, 2026
Merged

[roottest] Fix test dependencies using fixtures#21708
hageboeck merged 3 commits intoroot-project:masterfrom
hageboeck:roottest_fixtures

Conversation

@hageboeck
Copy link
Copy Markdown
Member

@hageboeck hageboeck commented Mar 26, 2026

When running a subset of tests in roottest, one can end up in a forever-broken state when using ctest --rerun-failed. This is caused by test dependencies being specified with DEPENDS instead of using a test fixture. DEPENDS is order only, so it does not start the tests that a selected test depends on.

In pseudo-CMake:

set_property(TEST B PROPERTY DEPENDS A)
$ ctest 
A
B

The order is stable. But:

set_property(TEST B PROPERTY DEPENDS A)
$ ctest -R B
B (this will fail now)
$ ctest --rerun-failed
B (fails again)

And with fixtures:

set_property(TEST A PROPERTY FIXTURES_SETUP A-fixture)
set_property(TEST B PROPERTY FIXTURES_REQUIRED A-fixture)
$ ctest -R B
A
B
$ ctest --rerun-failed
A
B

Because of the above, this PR labels every macro compilation triggered by DEPENDS <macro> and every reflex dictionary generation with an automatic fixture name:

set_property(TEST ${testname} FIXTURES_SETUP ${testname}-fixture

Subsequently, in ROOTTEST_ADD_TEST, all DEPENDS arguments are scanned for these fixtures, and if found, they are added as FIXTURES_REQUIRED to the test being defined. This should fix the problem described above.

Furthermore, there was a typo in a fixture name that was corrected.

Lastly, ROOTTEST_COMPILE_MACRO was converted into a function. As a macro, its local variables were overriding the fixture names of the calling code.

@hageboeck hageboeck requested a review from pcanal March 26, 2026 15:48
@hageboeck hageboeck self-assigned this Mar 26, 2026
@hageboeck hageboeck requested a review from bellenot as a code owner March 26, 2026 15:48
@hageboeck hageboeck added the clean build Ask CI to do non-incremental build on PR label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Test Results

    22 files      22 suites   3d 8h 18m 49s ⏱️
 3 833 tests  3 832 ✅  1 💤 0 ❌
76 578 runs  76 560 ✅ 18 💤 0 ❌

Results for commit eefc996.

♻️ This comment has been updated with latest results.

When COMPILE_MACRO was a macro, setting test fixtures broke variables
such as ARG_FIXTURES_REQUIRED in the "calling" macro or function,
because macro invocations overwrite variables in the current scope.
By making it a function, local definitions don't affect the calling
code.
…ent.

Many setup macros or reflex dictionaries were added to ROOTTEST tests
using DEPENDS. This is, however, only an order relationship. If the
setup tests are selected, they run before the main test.
However, if they are not selected (e.g. due to --rerun-failed or -R
xxx), the setup tests won't run.
Here, reflex dictionaries and macro compilation are all marked with
FIXTURES_SETUP, so they are understood by CMake as tests that run some
kind of setup. When ROOTTEST_ADD_TEST is used with DEPENDS <testname>,
the setup fixture names from all dependencies (dictionaries or macros)
are read and added to the test with FIXTURES_REQUIRED.
This leads CTest to start these tests before starting the main tests,
even if they are not selected.
The "readNew" test reads an old file with a new class definition. By
mistake, its fixture was however causing the creation of the root file
with the new class version that is used in a different test.
Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thank you, very nice!

@hageboeck hageboeck merged commit 22e0298 into root-project:master Mar 27, 2026
30 checks passed
@hageboeck hageboeck deleted the roottest_fixtures branch March 27, 2026 17:27
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants