Repository navigation
tests: make test_search_cpp robust to header paths containing "xxx" - #432
Open
limeytexan wants to merge 1 commit into
Open
limeytexan wants to merge 1 commit into
limeytexan wants to merge 1 commit into
Conversation
The test asserts that the preprocessor strips the comment `/* xxx */`
by searching every line of the preprocessed output for `xxx`. That
includes the line markers emitted for implicitly included headers, e.g.
# 1 "/nix/store/9sfgm5hh368klnp22aa9xxx9an4wqnsk-glibc-2.42-67-dev/include/stdc-predef.h" 1 3 4
so an include path that happens to contain the token makes the test
fail even though the comment was stripped correctly. Anchor the pattern
so lines beginning with `#` are ignored; the second assertion, which
deliberately matches the `_configtest` line marker, is unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
TestConfig.test_search_cppasserts that the preprocessor strips the comment/* xxx */by searching the preprocessed output for the regexxxx. That search runs over every line of the output, including the line markers the preprocessor emits for implicitly included headers, e.g.On Nix, store paths carry a content hash whose base-32 alphabet includes
x, so any glibc build whose hash containsxxxmakes the test fail even though the comment was stripped correctly:The same thing can happen on any system where an include path contains the token. This change anchors the first pattern so that lines starting with
#are ignored, which keeps the test's intent (comments are removed from the code) without depending on the contents of header paths. The second assertion, which deliberately matches the_configtestline marker, is unchanged.Observed with distutils 83.0.0 on aarch64-linux, Python 3.14.6, gcc, glibc 2.42-67.
🤖 Generated with Claude Code