[Lldb-commits] [lldb] 37028d3 - [lldb] Update TestMultithreaded to report FAIL for a non-zero exit code

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 8 08:58:22 PDT 2022


Author: Jonas Devlieghere
Date: 2022-06-08T08:58:15-07:00
New Revision: 37028d3ea7fc9fa7e640c91faa9c347808598dd6

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

LOG: [lldb] Update TestMultithreaded to report FAIL for a non-zero exit code

A non-zero exit code from the test binary results in a
CalledProcessError. Without catching the exception, that would result in
a error (unresolved test) instead of a failure. This patch fixes that.

Added: 
    

Modified: 
    lldb/test/API/api/multithreaded/TestMultithreaded.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/api/multithreaded/TestMultithreaded.py b/lldb/test/API/api/multithreaded/TestMultithreaded.py
index 60c2c3b372cb3..71bc5db287296 100644
--- a/lldb/test/API/api/multithreaded/TestMultithreaded.py
+++ b/lldb/test/API/api/multithreaded/TestMultithreaded.py
@@ -108,12 +108,15 @@ def build_and_test(self, sources, test_name, args=None):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
         if 'LLDB_DEBUGSERVER_PATH' in os.environ:
             env['LLDB_DEBUGSERVER_PATH'] = os.environ['LLDB_DEBUGSERVER_PATH']
-        if self.TraceOn():
-            print("Running test %s" % " ".join(exe))
-            check_call(exe, env=env)
-        else:
-            with open(os.devnull, 'w') as fnull:
-                check_call(exe, env=env, stdout=fnull, stderr=fnull)
+        try:
+            if self.TraceOn():
+                print("Running test %s" % " ".join(exe))
+                check_call(exe, env=env)
+            else:
+                with open(os.devnull, 'w') as fnull:
+                    check_call(exe, env=env, stdout=fnull, stderr=fnull)
+        except subprocess.CalledProcessError as e:
+            self.fail(e)
 
     def build_program(self, sources, program):
         return self.buildDriver(sources, program)


        


More information about the lldb-commits mailing list