diff options
author | Tom Weaver <Tom.Weaver@Sony.com> | 2021-12-08 18:35:48 +0300 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2021-12-08 18:43:02 +0300 |
commit | 7c781621f8e3dbcb8f3b5452e32a5c6dfd121089 (patch) | |
tree | f83fa340c6be0fe66d9996e1a8cb318788a04b04 /cross-project-tests | |
parent | d43c801d136e2a0bf8002b82ab08c2bec08b3d74 (diff) |
[dexter] Fix source-root-dir unittests on Windows
These tests were spuriously failing on Windows due to path separators getting
flipped from `/` to `\\` in various parts of dexter:
test_add_breakpoint_with_source_root_dir
test_get_step_info
test_get_step_info_no_source_root_dir
Tested on Windows and Linux.
Patch written by @TWeaver.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D115338
Diffstat (limited to 'cross-project-tests')
-rw-r--r-- | cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py index f329a7e6f7dc..efb23899b77e 100644 --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py @@ -274,39 +274,46 @@ class TestDebuggerBase(unittest.TestCase): 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))) |