[PATCH] D115338: [dexter] Fix source-root-dir unittests on Windows

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 07:43:21 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c781621f8e3: [dexter] Fix source-root-dir unittests on Windows (authored by TWeaver, committed by Orlando).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115338/new/

https://reviews.llvm.org/D115338

Files:
  cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py


Index: cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py
===================================================================
--- cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py
+++ cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py
@@ -274,39 +274,46 @@
     def test_add_breakpoint_no_source_root_dir(self):
         self.options.debugger_use_relative_paths = True
         self.options.source_root_dir = ''
-        self.dbg.add_breakpoint('/root/some_file', 12)
-        self.assertEqual('/root/some_file', self.dbg.breakpoint_file)
+        path = os.path.join(os.path.sep + 'root', 'some_file')
+        self.dbg.add_breakpoint(path, 12)
+        self.assertEqual(path, self.dbg.breakpoint_file)
 
     def test_add_breakpoint_with_source_root_dir(self):
         self.options.debugger_use_relative_paths = True
-        self.options.source_root_dir = '/my_root'
-        self.dbg.add_breakpoint('/my_root/some_file', 12)
+        self.options.source_root_dir = os.path.sep + 'my_root'
+        path = os.path.join(self.options.source_root_dir, 'some_file')
+        self.dbg.add_breakpoint(path, 12)
         self.assertEqual('some_file', self.dbg.breakpoint_file)
 
     def test_add_breakpoint_with_source_root_dir_slash_suffix(self):
         self.options.debugger_use_relative_paths = True
-        self.options.source_root_dir = '/my_root/'
-        self.dbg.add_breakpoint('/my_root/some_file', 12)
+        self.options.source_root_dir = os.path.sep + 'my_root' + os.path.sep
+        path = os.path.join(self.options.source_root_dir, 'some_file')
+        self.dbg.add_breakpoint(path, 12)
         self.assertEqual('some_file', self.dbg.breakpoint_file)
 
     def test_get_step_info_no_source_root_dir(self):
         self.options.debugger_use_relative_paths = True
-        self.dbg.step_info = self._new_step(['/root/some_file'])
-        self.assertEqual(['/root/some_file'],
+        path = os.path.join(os.path.sep + 'root', 'some_file')
+        self.dbg.step_info = self._new_step([path])
+        self.assertEqual([path],
             self._step_paths(self.dbg.get_step_info([], 0)))
 
     def test_get_step_info_no_frames(self):
         self.options.debugger_use_relative_paths = True
-        self.options.source_root_dir = '/my_root'
+        self.options.source_root_dir = os.path.sep + 'my_root'
         self.dbg.step_info = self._new_step([])
         self.assertEqual([],
             self._step_paths(self.dbg.get_step_info([], 0)))
 
     def test_get_step_info(self):
         self.options.debugger_use_relative_paths = True
-        self.options.source_root_dir = '/my_root'
-        self.options.source_files = ['/my_root/some_file']
+        self.options.source_root_dir = os.path.sep + 'my_root'
+        path = os.path.join(self.options.source_root_dir, 'some_file')
+        self.options.source_files = [path]
+        other_path = os.path.join(os.path.sep + 'other', 'file')
+        dbg_path = os.path.join(os.path.sep + 'dbg', 'some_file')
         self.dbg.step_info = self._new_step(
-            [None, '/other/file', '/dbg/some_file'])
-        self.assertEqual([None, '/other/file', '/my_root/some_file'],
+            [None, other_path, dbg_path])
+        self.assertEqual([None, other_path, path],
             self._step_paths(self.dbg.get_step_info([], 0)))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115338.392779.patch
Type: text/x-patch
Size: 3381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/afdd8a23/attachment.bin>


More information about the llvm-commits mailing list