[llvm] aae10a9 - [NFC][lit] discovery: find_tests_for_inputs: avoid py warning when no suites found

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 05:26:20 PDT 2021


Author: Roman Lebedev
Date: 2021-03-22T15:25:32+03:00
New Revision: aae10a94ff12d1766e7d5a3ef743ae5fd7b0b60d

URL: https://github.com/llvm/llvm-project/commit/aae10a94ff12d1766e7d5a3ef743ae5fd7b0b60d
DIFF: https://github.com/llvm/llvm-project/commit/aae10a94ff12d1766e7d5a3ef743ae5fd7b0b60d.diff

LOG: [NFC][lit] discovery: find_tests_for_inputs: avoid py warning when no suites found

If lit was run on a directory that contained no suites,
then naturally suite[0] will not be there,
and that line would cause python warnings.

So just predicate it with a check that it is there in the first place.

Added: 
    

Modified: 
    llvm/utils/lit/lit/discovery.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py
index 43481d8bd3b3..22d6d8520283 100644
--- a/llvm/utils/lit/lit/discovery.py
+++ b/llvm/utils/lit/lit/discovery.py
@@ -284,7 +284,8 @@ def find_tests_for_inputs(lit_config, inputs, indirectlyRunCheck):
     # This data is no longer needed but keeping it around causes awful
     # performance problems while the test suites run.
     for k, suite in test_suite_cache.items():
-      suite[0].test_times = None
+      if suite[0]:
+        suite[0].test_times = None
 
     # If there were any errors during test discovery, exit now.
     if lit_config.numErrors:


        


More information about the llvm-commits mailing list