summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2019-07-25 03:14:32 +0000
committerJoel E. Denny <jdenny.ornl@gmail.com>2019-11-06 16:25:25 -0500
commit6cecd3c3dbef48eca6c4cf2dcc2df3290ab91488 (patch)
tree4a3fcfdbe2dcbbc09704bdd28b290af1057e939e
parent641d2e5232b423a7dd81afac94dd3db4412a4971 (diff)
downloadbcm5719-llvm-6cecd3c3dbef48eca6c4cf2dcc2df3290ab91488.tar.gz
bcm5719-llvm-6cecd3c3dbef48eca6c4cf2dcc2df3290ab91488.zip
[lit] Protect full test suite from FILECHECK_OPTS
lit's test suite calls lit multiple times for various sample test suites. `FILECHECK_OPTS` is safe for FileCheck calls in lit's test suite. It's not safe for FileCheck calls in the sample test suites, whose output affects the results of lit's test suite. Without this patch, only one such sample test suite is protected from `FILECHECK_OPTS`, and currently `shtest-shell.py` breaks with `FILECHECK_OPTS=-vv`. Moreover, it's hard to predict the future, especially false passes. Thus, this patch protects all existing and future sample test suites from `FILECHECK_OPTS` (and the deprecated `FILECHECK_DUMP_INPUT_ON_FAILURE`). Reviewed By: probinson Differential Revision: https://reviews.llvm.org/D65156
-rw-r--r--llvm/utils/lit/tests/lit.cfg11
-rw-r--r--llvm/utils/lit/tests/shtest-run-at-line.py2
2 files changed, 10 insertions, 3 deletions
diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index 6205615f013..ba9cb4da9cf 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -52,10 +52,17 @@ for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
if directory:
llvm_config.with_environment('PATH', directory, append_path=True)
+# This test suite calls %{lit} to test lit's behavior for the sample test
+# suites in %{inputs}. This test suite's results are then determined in part
+# by %{lit}'s textual output, which includes the output of FileCheck calls
+# within %{inputs}'s test suites. Thus, %{lit} clears environment variables
+# that can affect FileCheck's output.
config.substitutions.append(('%{inputs}', os.path.join(
config.test_source_root, 'Inputs')))
-config.substitutions.append(('%{lit}', "%%{python} %s" % (
- os.path.join(lit_path, 'lit.py'),)))
+config.substitutions.append(('%{lit}',
+ "{env} %{{python}} {lit}".format(
+ env="env -u FILECHECK_OPTS -u FILECHECK_DUMP_INPUT_ON_FAILURE",
+ lit=os.path.join(lit_path, 'lit.py'))))
config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
# Enable coverage.py reporting, assuming the coverage module has been installed
diff --git a/llvm/utils/lit/tests/shtest-run-at-line.py b/llvm/utils/lit/tests/shtest-run-at-line.py
index 7e5d53b8e26..cd0e08137ee 100644
--- a/llvm/utils/lit/tests/shtest-run-at-line.py
+++ b/llvm/utils/lit/tests/shtest-run-at-line.py
@@ -1,7 +1,7 @@
# Check that -vv makes the line number of the failing RUN command clear.
# (-v is actually sufficient in the case of the internal shell.)
#
-# RUN: env -u FILECHECK_OPTS not %{lit} -j 1 -vv %{inputs}/shtest-run-at-line > %t.out
+# RUN: not %{lit} -j 1 -vv %{inputs}/shtest-run-at-line > %t.out
# RUN: FileCheck --input-file %t.out %s
#
# END.
OpenPOWER on IntegriCloud