[lldb][Windows] Fix TestLocateModuleCallback
authorKazuki Sakamoto <kaz@meta.com>
Wed, 12 Jul 2023 21:48:13 +0000 (14:48 -0700)
committerKazuki Sakamoto <kaz@meta.com>
Fri, 14 Jul 2023 17:36:57 +0000 (10:36 -0700)
D153735 added the tests but it is failing due to POSIX path vs Windows path.
https://lab.llvm.org/buildbot/#/builders/219/builds/4084

Fix it.
- MODULE_PLATFORM_PATH is POSIX path.
- Normalize self.input_dir, FileSpec and SymbolFileSpec fullpath.

Differential Revision: https://reviews.llvm.org/D155124

lldb/test/API/python_api/sbplatform/TestLocateModuleCallback.py

index 672795f..0e3bdf5 100644 (file)
@@ -49,7 +49,9 @@ class LocateModuleCallbackTestCase(TestBase):
 
         self.assertEqual(MODULE_TRIPLE, module_spec.GetTriple())
 
-        self.assertEqual(MODULE_PLATFORM_PATH, module_spec.GetFileSpec().fullpath)
+        self.assertEqual(
+            MODULE_PLATFORM_PATH, Path(module_spec.GetFileSpec().fullpath).as_posix()
+        )
 
     def check_module(self, module: lldb.SBModule, symbol_file: str, symbol_kind: str):
         self.assertTrue(module.IsValid())
@@ -61,16 +63,20 @@ class LocateModuleCallbackTestCase(TestBase):
 
         self.assertEqual(MODULE_RESOLVED_TRIPLE, module.GetTriple())
 
-        self.assertEqual(MODULE_PLATFORM_PATH, module.GetPlatformFileSpec().fullpath)
-
         self.assertEqual(
-            str(self.input_dir / MODULE_FILE),
-            module.GetFileSpec().fullpath,
+            MODULE_PLATFORM_PATH, Path(module.GetPlatformFileSpec().fullpath).as_posix()
         )
 
-        self.assertEqual(
-            str(self.input_dir / symbol_file),
-            module.GetSymbolFileSpec().fullpath,
+        self.assertTrue(
+            (self.input_dir / MODULE_FILE)
+            .resolve()
+            .samefile(Path(module.GetFileSpec().fullpath).resolve())
+        )
+
+        self.assertTrue(
+            (self.input_dir / symbol_file)
+            .resolve()
+            .samefile(Path(module.GetSymbolFileSpec().fullpath).resolve())
         )
 
         sc_list = module.FindFunctions(MODULE_FUNCTION, lldb.eSymbolTypeCode)