[Lldb-commits] [lldb] r121802 - in /lldb/trunk/test: lldbtest.py load_unload/TestLoadUnload.py

Johnny Chen johnny.chen at apple.com
Tue Dec 14 15:13:03 PST 2010


Author: johnny
Date: Tue Dec 14 17:13:03 2010
New Revision: 121802

URL: http://llvm.org/viewvc/llvm-project?rev=121802&view=rev
Log:
Execute the test case teardown hooks in a LIFO (last in, first out) order.
ALso add a teardown hook to the LoadUnloadTestCase.test_dyld_library_path()
test case to have it restore the DYLD_LIBRARY_PATH environment variable.

Modified:
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/load_unload/TestLoadUnload.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=121802&r1=121801&r2=121802&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Dec 14 17:13:03 2010
@@ -648,7 +648,7 @@
         #traceback.print_stack()
 
         # Check and run any hook functions.
-        for hook in self.hooks:
+        for hook in reversed(self.hooks):
             with recording(self, traceAlways) as sbuf:
                 print >> sbuf, "Executing tearDown hook:", getsource_if_available(hook)
             hook()

Modified: lldb/trunk/test/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=121802&r1=121801&r2=121802&view=diff
==============================================================================
--- lldb/trunk/test/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/load_unload/TestLoadUnload.py Tue Dec 14 17:13:03 2010
@@ -38,7 +38,7 @@
         new_dir = os.path.join(os.getcwd(), "dyld_path")
 
         # This is the function to remove the dyld_path directory after the test.
-        def remove_dyld_path():
+        def remove_dyld_dir():
             import shutil
             shutil.rmtree(new_dir)
 
@@ -51,7 +51,7 @@
         os.rename(old_dylib, new_dylib)
         if dsymName:
             os.rename(old_dSYM, new_dSYM)
-        self.addTearDownHook(remove_dyld_path)
+        self.addTearDownHook(remove_dyld_dir)
         #system(["ls", "-lR", "."])
 
         # With libd.dylib moved, a.out run should fail.
@@ -71,6 +71,7 @@
 
         # Try again with the DYLD_LIBRARY_PATH environment variable properly set.
         os.environ[dylibPath] = new_dir
+        self.addTearDownHook(lambda: os.environ.pop(dylibPath))
         self.runCmd("run")
         self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
             patterns = ["frame #0.*d_function.*at d.c:%d" % self.line_d_function])





More information about the lldb-commits mailing list