[llvm] [llvm][llvm-lit] Add option to create unique result file names if results already exist (PR #112729)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 08:43:15 PDT 2024


================
@@ -1,28 +1,20 @@
-# Check that lit will not overwrite existing result files when given
-# --use-unique-output-file-name.
+## Check that lit will not overwrite existing result files when given
+## --use-unique-output-file-name.
 
-# Files are overwritten without the option.
+## Files are overwritten without the option.
 # RUN: rm -f %t.xunit*.xml
 # RUN: echo "test" > %t.xunit.xml
 # RUN: not %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/xunit-output
 # RUN: FileCheck < %t.xunit.xml %s --check-prefix=NEW
+# NEW:      <?xml version="1.0" encoding="UTF-8"?>
+# NEW-NEXT: <testsuites time="{{[0-9.]+}}">
+## (other tests will check the contents of the whole file)
 
 # RUN: rm -f %t.xunit*.xml
 # RUN: echo "test" > %t.xunit.xml
-# Files should not be overwritten with the option.
+## Files should not be overwritten with the option.
 # RUN: not %{lit} --xunit-xml-output %t.xunit.xml --use-unique-output-file-name %{inputs}/xunit-output
 # RUN: FileCheck < %t.xunit.xml %s --check-prefix=EXISTING
 # EXISTING: test
-# Results in a new file with "1" added.
-# RUN: FileCheck < %t.xunit.1.xml %s --check-prefix=NEW
-# NEW:      <?xml version="1.0" encoding="UTF-8"?>
-# NEW-NEXT: <testsuites time="{{[0-9.]+}}">
-# (assuming that other tests check the whole contents of the file)
-
-# The number should increment as many times as needed.
-# RUN: touch %t.xunit.2.xml
-# RUN: touch %t.xunit.3.xml
-# RUN: touch %t.xunit.4.xml
-
-# RUN: not %{lit} --xunit-xml-output %t.xunit.xml --use-unique-output-file-name %{inputs}/xunit-output
-# RUN: FileCheck < %t.xunit.5.xml %s --check-prefix=NEW
\ No newline at end of file
+## Results in a new file with some discriminator added.
+# RUN: FileCheck < %t.xunit.*.xml %s --check-prefix=NEW
----------------
DavidSpickett wrote:

It will fail in an unintuitive way if there is more than one file picked up. I will see if there's a way to precheck that.

https://github.com/llvm/llvm-project/pull/112729


More information about the llvm-commits mailing list