[Lldb-commits] [lldb] r145466 - /lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Johnny Chen
johnny.chen at apple.com
Tue Nov 29 17:34:00 PST 2011
Author: johnny
Date: Tue Nov 29 19:33:59 2011
New Revision: 145466
URL: http://llvm.org/viewvc/llvm-project?rev=145466&view=rev
Log:
rdar://problem/9211445
Fix wrong test logic in test_modules_search_paths(). Add additional exercising of 'target modules search-paths list/query".
There is a reproducible crash if 'target modules search-paths clear' is exercised during test teardown.
So we currently comment out the stmt as follows:
# Add teardown hook to clear image-search-paths after the test.
# rdar://problem/10501020
# Uncomment the following to reproduce 10501020.
#self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))
Modified:
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=145466&r1=145465&r2=145466&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Tue Nov 29 19:33:59 2011
@@ -21,7 +21,6 @@
self.line_d_function = line_number('d.c',
'// Find this line number within d_dunction().')
- @unittest2.expectedFailure
def test_modules_search_paths(self):
"""Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'."""
@@ -30,8 +29,9 @@
if sys.platform.startswith("darwin"):
dylibName = 'libd.dylib'
+ dylibPath = 'DYLD_LIBRARY_PATH'
- # The directory with the the dynamic library we did not link to.
+ # The directory with the dynamic library we did not link to.
new_dir = os.path.join(os.getcwd(), "hidden")
old_dylib = os.path.join(os.getcwd(), dylibName)
@@ -44,13 +44,33 @@
substrs = [old_dylib])
self.expect("target modules list -t 3",
patterns = ["%s-[^-]*-[^-]*" % self.getArchitecture()])
+ # Add an image search path substitution pair.
self.runCmd("target modules search-paths add %s %s" % (os.getcwd(), new_dir))
+ # Add teardown hook to clear image-search-paths after the test.
+ # rdar://problem/10501020
+ # Uncomment the following to reproduce 10501020.
+ #self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))
self.expect("target modules search-paths list",
substrs = [os.getcwd(), new_dir])
- # Add teardown hook to clear image-search-paths after the test.
- self.addTearDownHook(lambda: self.runCmd("target modules search-paths clear"))
+ self.expect("target modules search-paths query %s" % os.getcwd(), "Image search path successfully transformed",
+ substrs = [new_dir])
+
+ # Obliterate traces of libd from the old location.
+ os.remove(old_dylib)
+ # Inform dyld of the new path, too.
+ env_cmd_string = "settings set target.env-vars " + dylibPath + "=" + new_dir
+ if self.TraceOn():
+ print "Set environment to: ", env_cmd_string
+ self.runCmd(env_cmd_string)
+ self.runCmd("settings show target.env-vars")
+
+ remove_dyld_path_cmd = "settings remove target.env-vars " + dylibPath
+ self.addTearDownHook(lambda: self.runCmd(remove_dyld_path_cmd))
+
+ self.runCmd("run")
+
self.expect("target modules list", "LLDB successfully locates the relocated dynamic library",
substrs = [new_dylib])
More information about the lldb-commits
mailing list