[PATCH] D94766: Add lit env variable to disable indirect checks

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 04:52:23 PST 2021


thopre created this revision.
thopre added reviewers: bd1976llvm, ddunbar, rnk, yln, thakis, pcc, chapuni.
Herald added a subscriber: delcypher.
thopre requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Lit does not offer an easy way to query whether a command-line option is
available in a given release. This causes problem for tests
intentionally not part of a testsuite since newer version of lit would
error out without --no-indirectly-run-check but old versions of lit
would error out if passed --no-indirectly-run-check.

This commit adds a new environment variable LIT_NO_INDIRECT_CHECK which
is an alias for --no-indirectly-run-check but is ignored by old version
of lit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94766

Files:
  llvm/docs/CommandGuide/lit.rst
  llvm/utils/lit/lit/cl_arguments.py
  llvm/utils/lit/tests/discovery.py


Index: llvm/utils/lit/tests/discovery.py
===================================================================
--- llvm/utils/lit/tests/discovery.py
+++ llvm/utils/lit/tests/discovery.py
@@ -143,11 +143,22 @@
 #
 # CHECK-ERROR-INDIRECT-RUN-CHECK: error: 'top-level-suite :: test.not-txt' would not be run indirectly
 
+# Check an error is emitted with empty LIT_NO_INDIRECT_CHECK.
+#
+# RUN: env LIT_NO_INDIRECT_CHECK='' not %{lit} \
+# RUN:     %{inputs}/discovery/test.not-txt -j 1 2>%t.err
+# RUN: FileCheck --check-prefix=CHECK-ERROR-INDIRECT-RUN-CHECK < %t.err %s
+
 # Check that no error is emitted with --no-indirectly-run-check.
 #
 # RUN: %{lit} \
 # RUN:     %{inputs}/discovery/test.not-txt -j 1 --no-indirectly-run-check
 
+# Check that no error is emitted with LIT_NO_INDIRECT_CHECK set.
+#
+# RUN: env LIT_NO_INDIRECT_CHECK='TRUE' %{lit} \
+# RUN:     %{inputs}/discovery/test.not-txt -j 1 --no-indirectly-run-check
+
 # Check that we don't recurse infinitely when loading an site specific test
 # suite located inside the test source root.
 #
Index: llvm/utils/lit/lit/cl_arguments.py
===================================================================
--- llvm/utils/lit/lit/cl_arguments.py
+++ llvm/utils/lit/lit/cl_arguments.py
@@ -128,6 +128,7 @@
             help="Do not error if a test would not be run if the user had "
                  "specified the containing directory instead of naming the "
                  "test directly.",
+            default=not bool(os.environ.get("LIT_NO_INDIRECT_CHECK", False)),
             action="store_false")
 
     selection_group = parser.add_argument_group("Test Selection")
Index: llvm/docs/CommandGuide/lit.rst
===================================================================
--- llvm/docs/CommandGuide/lit.rst
+++ llvm/docs/CommandGuide/lit.rst
@@ -154,6 +154,12 @@
  suite take the most time to execute.  Note that this option is most useful
  with ``-j 1``.
 
+.. option:: --no-indirectly-run-check
+
+ Do not error if a test would not be run if the user had specified the
+ containing directory instead of naming the test directly. The environment
+ variable ``LIT_NO_INDIRECT_CHECK`` can also be used in place of this option.
+
 .. _selection-options:
 
 SELECTION OPTIONS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94766.316906.patch
Type: text/x-patch
Size: 2246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210115/29d44a9c/attachment.bin>


More information about the llvm-commits mailing list