diff options
author | Jim Ingham <jingham@apple.com> | 2018-07-20 01:20:18 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2018-07-20 01:20:18 +0000 |
commit | 40fa4a1a559765ada93268c4d45c54b62779166b (patch) | |
tree | fd7506f1dd9ce7ecab13cce6a8278f09e49d95b6 /lldb/packages/Python/lldbsuite | |
parent | c03b04d53305de01ee28ffe80be17cfaeca24cec (diff) | |
download | bcm5719-llvm-40fa4a1a559765ada93268c4d45c54b62779166b.tar.gz bcm5719-llvm-40fa4a1a559765ada93268c4d45c54b62779166b.zip |
Defend LoadImageUsingPaths against a path list
with empty paths on it.
llvm-svn: 337515
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py b/lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py index ba85039be8b..2050586adfa 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_using_paths/TestLoadUsingPaths.py @@ -103,10 +103,27 @@ class LoadUsingPathsTestCase(TestBase): out_spec = lldb.SBFileSpec() token = process.LoadImageUsingPaths(relative_spec, paths, out_spec, error) - self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token") - self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library") + self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token with relative path") + self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library with relative path") process.UnloadImage(token) + + # Make sure the presence of an empty path doesn't mess anything up: + paths.Clear() + paths.AppendString("") + paths.AppendString(os.path.join(self.wd, "no_such_dir")) + paths.AppendString(self.wd) + relative_spec = lldb.SBFileSpec(os.path.join("hidden", self.lib_name)) + + out_spec = lldb.SBFileSpec() + token = process.LoadImageUsingPaths(relative_spec, paths, out_spec, error) + + self.assertNotEqual(token, lldb.LLDB_INVALID_IMAGE_TOKEN, "Got a valid token with included empty path") + self.assertEqual(out_spec, lldb.SBFileSpec(self.hidden_lib), "Found the expected library with included empty path") + + process.UnloadImage(token) + + # Finally, passing in an absolute path should work like the basename: # This should NOT work because we've taken hidden_dir off the paths: |