
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.
23 lines
985 B
Python
23 lines
985 B
Python
## 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
|