From 48df75fc656569033b7990514583b620c8847db0 Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Wed, 9 Aug 2017 15:49:15 +0000 Subject: Fix PlatformPythonTestCase.test_platform_list for the build bots llvm-svn: 310488 --- .../functionalities/platform/TestPlatformPython.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py index 8ea18ea5970..54ea33ad24a 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformPython.py @@ -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 -- cgit v1.2.3