Add the LD_LIBRARY_PATH to target.env-vars for tests expecting libimf.so when testing with ICC.

Patch from Andy Kaylor.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187520 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lang/c/global_variables/TestGlobalVariables.py b/test/lang/c/global_variables/TestGlobalVariables.py
index 32a1501..3366526 100644
--- a/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/test/lang/c/global_variables/TestGlobalVariables.py
@@ -30,7 +30,10 @@
         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())
+            if "LD_LIBRARY_PATH" in os.environ:
+                self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+            else:
+                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):
@@ -43,6 +46,8 @@
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        self.runCmd("process status", "Get process status")
+
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
             substrs = ['stopped',
diff --git a/test/lang/c/shared_lib/TestSharedLib.py b/test/lang/c/shared_lib/TestSharedLib.py
index f51f8c1..7316706 100644
--- a/test/lang/c/shared_lib/TestSharedLib.py
+++ b/test/lang/c/shared_lib/TestSharedLib.py
@@ -40,7 +40,10 @@
         # Find the line number to break inside main().
         self.line = line_number('main.c', '// Set breakpoint 0 here.')
         if sys.platform.startswith("linux"):
-            self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
+            if "LD_LIBRARY_PATH" in os.environ:
+                self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+            else:
+                self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
             self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
 
     def common_setup(self):
diff --git a/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index 9cf59da..391058a 100644
--- a/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -40,7 +40,10 @@
         # Find the line number to break inside main().
         self.line = line_number('main.c', '// Set breakpoint 0 here.')
         if sys.platform.startswith("linux"):
-            self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
+            if "LD_LIBRARY_PATH" in os.environ:
+                self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+            else:
+                self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
             self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
 
     def common_setup(self):