[Lldb-commits] [lldb] 7d70b1a - [lldb] Fixup af921006d3792f for non-linux platforms

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 13 06:38:54 PDT 2022


Author: Pavel Labath
Date: 2022-04-13T15:38:36+02:00
New Revision: 7d70b1a4058cc07e527a3b16eef000b892e29797

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

LOG: [lldb] Fixup af921006d3792f for non-linux platforms

Added: 
    

Modified: 
    lldb/test/API/python_api/debugger/TestDebuggerAPI.py
    lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index f0ba1d1e20aae..ff1ebd96d401b 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -108,7 +108,8 @@ def test_CreateTarget_platform(self):
                 False, error)
         self.assertSuccess(error)
         platform2 = target2.GetPlatform()
-        self.assertEqual(platform2.GetWorkingDirectory(), "/foo/bar")
+        self.assertTrue(platform2.GetWorkingDirectory().endswith("bar"),
+                platform2.GetWorkingDirectory())
 
         # ... but create a new one if it doesn't.
         self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-windows"))
@@ -123,9 +124,11 @@ def test_CreateTarget_arch(self):
         if lldbplatformutil.getHostPlatform() == 'linux':
             self.yaml2obj("macho.yaml", exe)
             arch = "x86_64-apple-macosx"
+            expected_platform = "remote-macosx"
         else:
             self.yaml2obj("elf.yaml", exe)
             arch = "x86_64-pc-linux"
+            expected_platform = "remote-linux"
 
         fbsd = lldb.SBPlatform("remote-freebsd")
         self.dbg.SetSelectedPlatform(fbsd)
@@ -134,7 +137,7 @@ def test_CreateTarget_arch(self):
         target1 = self.dbg.CreateTarget(exe, arch, None, False, error)
         self.assertSuccess(error)
         platform1 = target1.GetPlatform()
-        self.assertEqual(platform1.GetName(), "remote-macosx")
+        self.assertEqual(platform1.GetName(), expected_platform)
         platform1.SetWorkingDirectory("/foo/bar")
 
         # Reuse a platform even if it is not currently selected.
@@ -142,5 +145,6 @@ def test_CreateTarget_arch(self):
         target2 = self.dbg.CreateTarget(exe, arch, None, False, error)
         self.assertSuccess(error)
         platform2 = target2.GetPlatform()
-        self.assertEqual(platform2.GetName(), "remote-macosx")
-        self.assertEqual(platform2.GetWorkingDirectory(), "/foo/bar")
+        self.assertEqual(platform2.GetName(), expected_platform)
+        self.assertTrue(platform2.GetWorkingDirectory().endswith("bar"),
+                platform2.GetWorkingDirectory())

diff  --git a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
index 410c104299cbe..7cb07cbe55d35 100644
--- a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
+++ b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -25,8 +25,7 @@ class PlatformAppleSimulatorTest : public ::testing::Test {
 #ifdef __APPLE__
 
 static void testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
-  Status error;
-  auto platform_sp = Platform::Create(ConstString(name), error);
+  auto platform_sp = Platform::Create(name);
   ASSERT_TRUE(platform_sp);
   int num_arches = 0;
 
@@ -55,12 +54,12 @@ TEST_F(PlatformAppleSimulatorTest, TestHostPlatformToSim) {
   };
 
   for (auto sim : sim_platforms) {
+    PlatformList list;
     ArchSpec arch = platform_arch;
     arch.GetTriple().setOS(sim);
     arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
 
-    Status error;
-    auto platform_sp = Platform::Create(arch, {}, nullptr, error);
+    auto platform_sp = list.GetOrCreate(arch, {}, nullptr);
     EXPECT_TRUE(platform_sp);
   }
 }


        


More information about the lldb-commits mailing list