fjricci updated this revision to Diff 61717.
fjricci added a comment.
This revision is now accepted and ready to land.

Disconnect from existing platform connection to prevent extra hanging 
connections

This is good practice on all debug servers, and required for debug servers which
can't handle more than one simultaneous platform mode connection.


http://reviews.llvm.org/D21648

Files:
  
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Index: 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===================================================================
--- 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ 
packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -23,6 +23,10 @@
     @no_debug_info_test
     def test_image_list_shows_multiple_architectures(self):
         """Test that image list properly shows the correct architecture for a 
set of different architecture object files."""
+        # Don't leave residual open platform connections
+        if lldb.remote_platform:
+            lldb.remote_platform.DisconnectRemote()
+
         images = {
             "hello-freebsd-10.0-x86_64-clang-3.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
             "hello-freebsd-10.0-x86_64-gcc-4.7.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
@@ -39,5 +43,11 @@
 
             self.runCmd("file {}".format(file_name))
             self.match("image list -t -A", [expected_triple_and_arch_regex])
-        # Revert to the host platform after all of this is done
-        self.runCmd("platform select host")
+
+        # Revert to the original platform after all of this is done
+        if lldb.remote_platform:
+            platform_connect_options = 
lldb.SBPlatformConnectOptions(configuration.lldb_platform_url)
+            err = lldb.remote_platform.ConnectRemote(platform_connect_options)
+            self.assertTrue(err.Success())
+        else:
+            self.runCmd("platform select host")


Index: packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -23,6 +23,10 @@
     @no_debug_info_test
     def test_image_list_shows_multiple_architectures(self):
         """Test that image list properly shows the correct architecture for a set of different architecture object files."""
+        # Don't leave residual open platform connections
+        if lldb.remote_platform:
+            lldb.remote_platform.DisconnectRemote()
+
         images = {
             "hello-freebsd-10.0-x86_64-clang-3.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
             "hello-freebsd-10.0-x86_64-gcc-4.7.3": re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
@@ -39,5 +43,11 @@
 
             self.runCmd("file {}".format(file_name))
             self.match("image list -t -A", [expected_triple_and_arch_regex])
-        # Revert to the host platform after all of this is done
-        self.runCmd("platform select host")
+
+        # Revert to the original platform after all of this is done
+        if lldb.remote_platform:
+            platform_connect_options = lldb.SBPlatformConnectOptions(configuration.lldb_platform_url)
+            err = lldb.remote_platform.ConnectRemote(platform_connect_options)
+            self.assertTrue(err.Success())
+        else:
+            self.runCmd("platform select host")
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to