Skip to content

Commit 82ef4ee

Browse files
authored
[Utils] Ensure that empty.txt is always empty (#157576)
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.
1 parent 00b13c4 commit 82ef4ee

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.txt
1+
; diff-tmp-dir.test clobbers this file
2+
empty.txt

llvm/utils/lit/tests/Inputs/diff-test-update/diff-tmp-dir.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# RUN: mkdir %t
2-
# RUN: touch %S/empty.txt
2+
# Tests that if file A is in the %t directory and file B is not,
3+
# the diff test updater copies from file A to B.
4+
# RUN: echo "" > %S/empty.txt
35
# RUN: cp %S/1.in %t/1.txt
46

57
# RUN: diff %t/1.txt %S/empty.txt
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# RUN: not %{lit} --update-tests -v %S/Inputs/diff-test-update | FileCheck %s
22

3-
# CHECK: # update-diff-test: could not deduce source and target from {{.*}}/Inputs/diff-test-update/1.in and {{.*}}/Inputs/diff-test-update/2.in
4-
# CHECK: # update-diff-test: could not deduce source and target from {{.*}}/diff-test-update/Output/diff-bail2.test.tmp/1.txt and {{.*}}/diff-test-update/Output/diff-bail2.test.tmp/2.txt
5-
# CHECK: # update-diff-test: copied {{.*}}/Output/diff-expected.test.tmp/my-file.txt to {{.*}}/Output/diff-expected.test.tmp/my-file.expected
6-
# CHECK: # update-diff-test: copied {{.*}}/Output/diff-tmp-dir.test.tmp/1.txt to {{.*}}/Inputs/diff-test-update/empty.txt
7-
# CHECK: # update-diff-test: copied {{.*}}/Inputs/diff-test-update/Output/diff-tmp.test.tmp.txt to {{.*}}/Inputs/diff-test-update/diff-t-out.txt
3+
# CHECK: # update-diff-test: could not deduce source and target from {{.*}}1.in and {{.*}}2.in
4+
# CHECK: # update-diff-test: could not deduce source and target from {{.*}}1.txt and {{.*}}2.txt
5+
# CHECK: # update-diff-test: copied {{.*}}my-file.txt to {{.*}}my-file.expected
6+
# CHECK: # update-diff-test: copied {{.*}}1.txt to {{.*}}empty.txt
7+
# CHECK: # update-diff-test: copied {{.*}}diff-tmp.test.tmp.txt to {{.*}}diff-t-out.txt
88

99

1010
# CHECK: Failed: 5 (100.00%)

0 commit comments

Comments
 (0)