[Lldb-commits] [lldb] r168613 - /lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py

Daniel Malea daniel.malea at intel.com
Mon Nov 26 13:23:12 PST 2012


Author: dmalea
Date: Mon Nov 26 15:23:12 2012
New Revision: 168613

URL: http://llvm.org/viewvc/llvm-project?rev=168613&view=rev
Log:
Improvement to TestGlobalVariables fix
- use lldb settings command instead of os.environ
- use dyldPath fixture variable instead of hardcoding LD_LIBRARY_PATH
- add tear-down hook to restore environment after testcase is run


Modified:
    lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py

Modified: lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py?rev=168613&r1=168612&r2=168613&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/lang/c/global_variables/TestGlobalVariables.py Mon Nov 26 15:23:12 2012
@@ -24,14 +24,14 @@
         self.global_variables()
 
     def setUp(self):
-        if sys.platform.startswith("linux"):
-            # On Linux, environment variable must be set so the shared library is loaded correctly
-            os.environ["LD_LIBRARY_PATH"] = os.getcwd()
-
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line number to break inside main().
         self.line = line_number('main.c', '// Set break point at this line.')
+        if sys.platform.startswith("linux"):
+            # On Linux, LD_LIBRARY_PATH must be set so the shared libraries are found on startup
+            self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
+            self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
 
     def global_variables(self):
         """Test 'frame variable -s -a' which omits args and shows scopes."""





More information about the lldb-commits mailing list