[PATCH] D58196: [lit][NFC] Small cleanup

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 11:05:35 PST 2019


yln created this revision.
Herald added subscribers: llvm-commits, delcypher.
Herald added a reviewer: serge-sans-paille.
Herald added a project: LLVM.

Remove if since `parallelism_semaphores[pg]` already raises `KeyError`.

Remove `result = None`, so it does not mask programming error in case
the code evolves.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58196

Files:
  llvm/utils/lit/lit/run.py


Index: llvm/utils/lit/lit/run.py
===================================================================
--- llvm/utils/lit/lit/run.py
+++ llvm/utils/lit/lit/run.py
@@ -186,17 +186,14 @@
             self.hit_max_failures = True
 
 def _execute_test_impl(test, lit_config, parallelism_semaphores):
-    """Execute one test"""
+    """Execute one test with the appropriate level of parallelism"""
     pg = test.config.parallelism_group
     if callable(pg):
         pg = pg(test)
 
-    result = None
-    semaphore = None
     try:
         if pg:
             semaphore = parallelism_semaphores[pg]
-        if semaphore:
             semaphore.acquire()
         start_time = time.time()
         result = test.config.test_format.execute(test, lit_config)
@@ -218,7 +215,7 @@
         output += '\n'
         result = lit.Test.Result(lit.Test.UNRESOLVED, output)
     finally:
-        if semaphore:
+        if pg:
             semaphore.release()
 
     test.setResult(result)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58196.186702.patch
Type: text/x-patch
Size: 979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190213/e770180c/attachment.bin>


More information about the llvm-commits mailing list