[Lldb-commits] [lldb] r222501 - Rework parallel test process count logic

Ed Maste emaste at freebsd.org
Thu Nov 20 18:41:25 PST 2014


Author: emaste
Date: Thu Nov 20 20:41:25 2014
New Revision: 222501

URL: http://llvm.org/viewvc/llvm-project?rev=222501&view=rev
Log:
Rework parallel test process count logic

The default value for opt.thread_count was multiprocessing.cpu_count(),
which meant the LLDB_TEST_THREADS environment variable was never used.
It's not easy to pass the -t option to the test run when invoking it
from e.g. 'ninja check-lldb', so having the environment variable as an
option is useful.

Change the logic so that the thread count is set by the first one of:

  1. The -t option to test/dosep.py
  2. The LLDB_TEST_THREADS environment variable
  3. The machine's CPU count from multiprocessing.cpu_count()

Modified:
    lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=222501&r1=222500&r2=222501&view=diff
==============================================================================
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Thu Nov 20 20:41:25 2014
@@ -90,20 +90,21 @@ Run lldb test suite using a separate pro
     parser.add_option('-t', '--threads',
                       type='int',
                       dest='num_threads',
-                      help="""The number of threads to use when running tests separately.""",
-                      default=multiprocessing.cpu_count())
+                      help="""The number of threads to use when running tests separately.""")
 
     opts, args = parser.parse_args()
     dotest_options = opts.dotest_options
-    num_threads = opts.num_threads
-    if num_threads < 1:
+
+    if opts.num_threads:
+        num_threads = opts.num_threads
+    else:
         num_threads_str = os.environ.get("LLDB_TEST_THREADS")
         if num_threads_str:
             num_threads = int(num_threads_str)
-            if num_threads < 1:
-                num_threads = 1
         else:
-            num_threads = 1
+            num_threads = multiprocessing.cpu_count()
+    if num_threads < 1:
+        num_threads = 1
 
     system_info = " ".join(platform.uname())
     (failed, passed) = walk_and_invoke(test_root, dotest_options, num_threads)





More information about the lldb-commits mailing list