[Lldb-commits] [lldb] a58bd0e - [lldb][tests] Platform triple can be None

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 26 07:49:58 PST 2019


Author: Tatyana Krasnukha
Date: 2019-12-26T18:49:35+03:00
New Revision: a58bd0e42cf21a80c0f2c69bddf8fe32b6e99a40

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

LOG: [lldb][tests] Platform triple can be None

If a remote target is not connected, SBPlatform's GetTriple function returns None.

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 3515bc812ac5..02946f0398b4 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -129,7 +129,12 @@ def getDarwinOSTriples():
 
 def getPlatform():
     """Returns the target platform which the tests are running on."""
-    platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+    triple = lldb.DBG.GetSelectedPlatform().GetTriple()
+    if triple is None:
+      # It might be an unconnected remote platform.
+      return ''
+
+    platform = triple.split('-')[2]
     if platform.startswith('freebsd'):
         platform = 'freebsd'
     elif platform.startswith('netbsd'):


        


More information about the lldb-commits mailing list