[Lldb-commits] [lldb] r310488 - Fix PlatformPythonTestCase.test_platform_list for the build bots

Vadim Macagon via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 9 08:49:15 PDT 2017


Author: enlight
Date: Wed Aug  9 08:49:15 2017
New Revision: 310488

URL: http://llvm.org/viewvc/llvm-project?rev=310488&view=rev
Log:
Fix PlatformPythonTestCase.test_platform_list for the build bots

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py?rev=310488&r1=310487&r2=310488&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py Wed Aug  9 08:49:15 2017
@@ -21,12 +21,13 @@ class PlatformPythonTestCase(TestBase):
     @no_debug_info_test
     def test_platform_list(self):
         """Test SBDebugger::GetNumPlatforms() & GetPlatformAtIndex() API"""
-        # Verify there's only the host platform present by default.
-        self.assertEqual(self.dbg.GetNumPlatforms(), 1)
+        # Verify the host platform is present by default.
+        initial_num_platforms = self.dbg.GetNumPlatforms()
+        self.assertGreater(initial_num_platforms, 0)
         host_platform = self.dbg.GetPlatformAtIndex(0)
         self.assertTrue(host_platform.IsValid() and
                         host_platform.GetName() == 'host',
-                        'Only the host platform is available')
+                        'The host platform is present')
         # Select another platform and verify that the platform is added to
         # the platform list.
         platform_idx = self.dbg.GetNumAvailablePlatforms() - 1
@@ -39,9 +40,14 @@ class PlatformPythonTestCase(TestBase):
         selected_platform = self.dbg.GetSelectedPlatform()
         self.assertTrue(selected_platform.IsValid())
         self.assertEqual(selected_platform.GetName(), platform_name)
-        self.assertEqual(self.dbg.GetNumPlatforms(), 2)
-        platform = self.dbg.GetPlatformAtIndex(1)
-        self.assertEqual(platform.GetName(), platform_name)
+        self.assertEqual(self.dbg.GetNumPlatforms(), initial_num_platforms + 1)
+        platform_found = False
+        for platform_idx in range(self.dbg.GetNumPlatforms()):
+            platform = self.dbg.GetPlatformAtIndex(platform_idx)
+            if platform.GetName() == platform_name:
+                platform_found = True
+                break
+        self.assertTrue(platform_found)
 
     @add_test_categories(['pyapi'])
     @no_debug_info_test




More information about the lldb-commits mailing list