-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm][llvm-lit] Add option to create unique result file names if res…
…ults already exist (#112729) When running a build like: ``` ninja check-clang check-llvm ``` Prior to my changes you ended up with one results file, in this specific case Junit XML: ``` results.xml ``` This would only include the last set of tests lit ran, which were for llvm. To get around this, many CI systems will run one check target, move the file away, then run another, somehow propgating the return code as well. ``` rectode=0 for target in targets: ninja target retcode=$? mv results.xml results-${target}.xml <report the overall return code> ``` I want to use something like this Buildkite reporting plugin in CI, which needs to have all the results available: https://buildkite.com/docs/agent/v3/cli-annotate#using-annotations-to-report-test-results Modifying CI's build scripts for Windows and Linux is a lot of work. So my changes instead make lit detect an existing result file and modify the file name to find a new file to write to. Now you will get: ``` results.xml results.<tempfile generated value>.xml ``` This will work for all result file types since I'm doing it in the base Report class. Now you've got separate files, it's easy to collect them with `<path>/*.xml`. Note that the `<tempfile generated value>` is not ordered.
- Loading branch information
1 parent
4f06f79
commit 8507dba
Showing
3 changed files
with
89 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Check that lit will not overwrite existing result files when given | ||
## --use-unique-output-file-name. | ||
|
||
## 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. | ||
# 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 some discriminator added. | ||
# RUN: ls -l %t.xunit*.xml | wc -l | FileCheck %s --check-prefix=NUMFILES | ||
# NUMFILES: 2 | ||
# RUN: FileCheck < %t.xunit.*.xml %s --check-prefix=NEW |