[llvm] 3cd6e02 - [lit] Push computation of workers into run_tests

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 13:49:36 PDT 2020


Author: Julian Lettner
Date: 2020-04-30T13:49:30-07:00
New Revision: 3cd6e02920c0f8de5cab95b79bc3032900028d33

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

LOG: [lit] Push computation of workers into run_tests

This also avoids assigning to the option object.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index 17382da52bfb..ab8d74a74bf7 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/llvm/utils/lit/lit/main.py
@@ -83,8 +83,6 @@ def main(builtin_params={}):
 
     filtered_tests = filtered_tests[:opts.max_tests]
 
-    opts.workers = min(len(filtered_tests), opts.workers)
-
     start = time.time()
     run_tests(filtered_tests, lit_config, opts, len(discovered_tests))
     elapsed = time.time() - start
@@ -190,14 +188,16 @@ def filter_by_shard(tests, run, shards, lit_config):
 
 
 def run_tests(tests, lit_config, opts, discovered_tests):
+    workers = min(len(tests), opts.workers)
     display = lit.display.create_display(opts, len(tests), discovered_tests,
-                                         opts.workers)
+                                         workers)
+
     def progress_callback(test):
         display.update(test)
         if opts.order == 'failing-first':
             touch_file(test)
 
-    run = lit.run.Run(tests, lit_config, opts.workers, progress_callback,
+    run = lit.run.Run(tests, lit_config, workers, progress_callback,
                       opts.max_failures, opts.timeout)
 
     display.print_header()


        


More information about the llvm-commits mailing list