Skip to content

Conversation

@hnrklssn
Copy link
Member

@hnrklssn hnrklssn commented Nov 6, 2025

This adds clang's update-verify-tests.py, which can be used to automatically update failing tests that use -verify, and makes adjustments as necessary where clang and Swift differ.

This script is used to automatically update test cases using -verify in
clang's test suite. Swift also has a similar -verify test functionality,
and while it can automatically fix some of them using -verify-apply-all,
this functionality only updates existing checks - it doesn't add or
remove any, and it doesn't handle newer and more complex things like
expected-expansion. Handling that type of complexity feels out of scope
to embed in the compiler, so let's copy clang's approach.

This commit adds this script as is from clang. It doesn't work at all
for Swift in its current form, as the output from Swift's -verify is
formatted differently than in clang. This will be fixed in subsequent
commits.

This could have been done by adapting the script as-is in the
llvm-project repository (since it only exists in the Swift fork, not
upstream), but tests using swift-frontend would have to reside in the
swift repo, and modifying a script in one repo with tests in a different
repo sounds like a recipe for endless CI issues.
This ports clang's test suite for update-verify-tests from C to Swift,
and adjusts update-verify-tests as needed. The main differences are the
Swift -verify output format being quite different, as well as Swift's
'-verify-additional-prefix foo' working differently than clang's
'-verify=foo'.
This updates the documentation to reflect the Swift port of this script,
rather than the original clang version.
@hnrklssn
Copy link
Member Author

hnrklssn commented Nov 6, 2025

@swift-ci please smoke test

@hnrklssn hnrklssn enabled auto-merge November 6, 2025 02:48
@hnrklssn hnrklssn merged commit 27a7334 into swiftlang:main Nov 6, 2025
3 checks passed
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.

2 participants