Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

hnrklssn
Copy link

This cherry-picks a series of commits implementing the --update-tests feature in llvm-lit. It makes it a lot more convenient to fix certain types of test cases when they fail, and I plan to make extensive use of those types of test cases in Swift.

hnrklssn and others added 10 commits September 12, 2025 15:31
This reverts commit
llvm@e495231
to reland
the --update-tests feature, originally landed in
llvm#108425.

(cherry picked from commit e1ff432)
The early exit we relied on to only invoke test updaters for failing
tests requires that there was no output to stdout or stderr, and that
timeouts weren't enabled. When these conditions weren't fulfilled, test
updaters would be invoked even on passing or XFAILed tests.

(cherry picked from commit 58996c0)
…155303)

This test case matches against python traceback output, which seems to
vary slightly between versions. This relaxes the constraints a bit to
make the test pass on buildbots.

(cherry picked from commit 31948b3)
…vm#154147)

This adds an updater to lit's --update-tests flag with support for
`diff`. If a RUN line containing the `diff` command fails, this function
will use heuristics to try to deduce which file is the "reference" file,
and copy the contents of the other file to the reference. If it cannot
deduce which file is the reference file, it does nothing.

The heuristics are currently:
 - does one of the files end in .expected while the other does not? Then
   the .expected file is the reference.
 - does one of the file paths contain the substring ".tmp" while the
   other does not? Then the file not containing ".tmp" is the reference.
   This matches cases where one file path is constructed using the `%t`
   substitution.

(cherry picked from commit 6c3f18e)
Previously this test case would `touch %S/empty.txt` to create and empty
file. The test case then copies contents to that file, so if run a
second time the `touch` command would not create an empty file.

`llvm/utils/lit/tests/diff-test-update.py` also no longer matches against file
paths other than the final bit of the file name. This prevents test failures
on Windows due to different path separators.

(cherry picked from commit 82ef4ee)
llvm#155354)

Should fix Windows build bot failures such as
https://lab.llvm.org/buildbot/#/builders/46/builds/22281.

The test (and the followup fix in llvm#155303) did not properly account for
Windows style path separators.

(cherry picked from commit 7d35e29)
)

Previously we compared paths by string manipulation, however Windows
paths can use both '\' and '/' as path separators, which made this
fragile. This uses the pathlib.Path.samefile API instead.

(cherry picked from commit b018151)
@hnrklssn hnrklssn requested a review from a team as a code owner September 12, 2025 22:35
@hnrklssn
Copy link
Author

@swift-ci please test

@hnrklssn hnrklssn requested a review from jroelofs September 12, 2025 22:38
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