xref: /llvm-project/llvm/utils/lit/tests/unique-output-file.py (revision 8507dbaec3f644b8a0c6291f097800d82a4f4b16)
1## Check that lit will not overwrite existing result files when given
2## --use-unique-output-file-name.
3
4## Files are overwritten without the option.
5# RUN: rm -f %t.xunit*.xml
6# RUN: echo "test" > %t.xunit.xml
7# RUN: not %{lit} --xunit-xml-output %t.xunit.xml %{inputs}/xunit-output
8# RUN: FileCheck < %t.xunit.xml %s --check-prefix=NEW
9# NEW:      <?xml version="1.0" encoding="UTF-8"?>
10# NEW-NEXT: <testsuites time="{{[0-9.]+}}">
11## (other tests will check the contents of the whole file)
12
13# RUN: rm -f %t.xunit*.xml
14# RUN: echo "test" > %t.xunit.xml
15## Files should not be overwritten with the option.
16# RUN: not %{lit} --xunit-xml-output %t.xunit.xml --use-unique-output-file-name %{inputs}/xunit-output
17# RUN: FileCheck < %t.xunit.xml %s --check-prefix=EXISTING
18# EXISTING: test
19## Results in a new file with some discriminator added.
20# RUN: ls -l %t.xunit*.xml | wc -l | FileCheck %s --check-prefix=NUMFILES
21# NUMFILES: 2
22# RUN: FileCheck < %t.xunit.*.xml %s --check-prefix=NEW
23