[Lldb-commits] [lldb] 49cffe3 - [lldb] Fix TestDebuggerAPI on windows (broken by D120810)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 9 07:54:30 PST 2022


Author: Pavel Labath
Date: 2022-03-09T16:54:24+01:00
New Revision: 49cffe3c7fab74252d4b6a073303c803dc1659f0

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

LOG: [lldb] Fix TestDebuggerAPI on windows (broken by D120810)

Added: 
    

Modified: 
    lldb/test/API/python_api/debugger/TestDebuggerAPI.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
index f0ba1d1e20aae..79619c8fa1d7b 100644
--- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
+++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -108,7 +108,9 @@ def test_CreateTarget_platform(self):
                 False, error)
         self.assertSuccess(error)
         platform2 = target2.GetPlatform()
-        self.assertEqual(platform2.GetWorkingDirectory(), "/foo/bar")
+        # On windows, the path will come back as \foo\bar. That's most likely a
+        # bug, but this is not related to what we're testing here.
+        self.assertIn(platform2.GetWorkingDirectory(), ["/foo/bar", r"\foo\bar"])
 
         # ... but create a new one if it doesn't.
         self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-windows"))
@@ -123,9 +125,11 @@ def test_CreateTarget_arch(self):
         if lldbplatformutil.getHostPlatform() == 'linux':
             self.yaml2obj("macho.yaml", exe)
             arch = "x86_64-apple-macosx"
+            platform_name = "remote-macosx"
         else:
             self.yaml2obj("elf.yaml", exe)
             arch = "x86_64-pc-linux"
+            platform_name = "remote-linux"
 
         fbsd = lldb.SBPlatform("remote-freebsd")
         self.dbg.SetSelectedPlatform(fbsd)
@@ -134,7 +138,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(), platform_name)
         platform1.SetWorkingDirectory("/foo/bar")
 
         # Reuse a platform even if it is not currently selected.
@@ -142,5 +146,7 @@ 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(), platform_name)
+        # On windows, the path will come back as \foo\bar. That's most likely a
+        # bug, but this is not related to what we're testing here.
+        self.assertIn(platform2.GetWorkingDirectory(), ["/foo/bar", r"\foo\bar"])


        


More information about the lldb-commits mailing list