Repository navigation
Read the EXPECT lines in the xfail driver, when the test runs - #112
Merged
steve-downey merged 1 commit intoNov 2, 2026
Merged
Conversation
The regex for a negative compile test was read from the source at configure time and baked into the test command. ctest loads the test definitions when it starts, so after editing an EXPECT line the first bare `ctest` run still matched the old regex: the nested build regenerated the test file, but under a ctest that had already read it. Only a build before ctest, as `make test` does, got the new one first time. The driver now receives the source path (-DBEMAN_XFAIL_EXPECT_FILE) and reads the EXPECT lines itself when the test runs, so an edit takes effect on the next run with neither a reconfigure nor a rebuild, and the source is no longer a configure dependency. The scan lives in cmake/beman-xfail-compile-expect.cmake, shared by the driver and by the registration function, which still rejects a source with no EXPECT line at configure time. The scan also stops going through file(STRINGS) and a list. A regex may contain an unbalanced "[" (as in "\[with R = .+foo"), and CMake does not split a list at a ";" that follows an unmatched "[", so two EXPECT lines merged into one that the module then rejected for containing a semicolon. beman.transcode hit this on its first use of the module. String operations over the file contents have no such rule. An EXPECT passed as an argument still travels as -DBEMAN_XFAIL_EXPECT and keeps its no-semicolon rule; a regex read from the source may contain one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-DBEMAN_XFAIL_EXPECT_FILE) and reads the// EXPECT: "<regex>"lines when the test runs, instead of the regex being read at configure time and baked into the test command. ctest loads test definitions at startup, so after editing an EXPECT line the first barectestrun matched the old regex even though the nested build regenerated the test file. Edits now take effect on the next run with no reconfigure or rebuild, and the source is no longer a configure dependency.cmake/beman-xfail-compile-expect.cmake, shared by the driver and bybeman_add_xfail_compile_test(), which still rejects a source with no EXPECT line at configure time.file(STRINGS)and a list. A regex with an unbalanced[(such as\[with R = .+foo) stops CMake splitting the list at the next;, so two EXPECT lines merged and the module rejected them for containing a semicolon. beman.transcode hit this on its first use of the module (Register negative compile tests through beman_add_xfail_compile_test steve-downey/transcode#138).;.No registration in
tests/beman/expected/CMakeLists.txtchanges. The three files are identical to the copies now in beman.transcode.Test plan
ctest -L xfail-compileunder gcc-16 (Asan): 59/59 passctest -L xfail-compileunder clang-23 (Asan): 59/59 passctestrun without a reconfigurepre-commit run -apasses (gersemi 0.29.2)