[Lldb-commits] [lldb] r316244 - lldb-server tests: Propagate environment variables (pr34192)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 20 15:39:18 PDT 2017


Author: labath
Date: Fri Oct 20 15:39:18 2017
New Revision: 316244

URL: http://llvm.org/viewvc/llvm-project?rev=316244&view=rev
Log:
lldb-server tests: Propagate environment variables (pr34192)

Summary:
Without this, the launching of the test inferior may fail if it depends
on some component of the environment (most likely LD_LIBRARY_PATH). This
makes sure we propagate the environment variable to the inferior
process.

Reviewers: eugene

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D39010

Modified:
    lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp

Modified: lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp?rev=316244&r1=316243&r2=316244&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/TestClient.cpp Fri Oct 20 15:39:18 2017
@@ -101,6 +101,14 @@ bool TestClient::StopDebugger() {
 }
 
 bool TestClient::SetInferior(llvm::ArrayRef<std::string> inferior_args) {
+  StringList env;
+  Host::GetEnvironment(env);
+  for (size_t i = 0; i < env.GetSize(); ++i) {
+    if (SendEnvironmentPacket(env[i].c_str()) != 0) {
+      GTEST_LOG_(ERROR) << "failed to set environment variable `" << env[i] << "`";
+      return false;
+    }
+  }
   std::stringstream command;
   command << "A";
   for (size_t i = 0; i < inferior_args.size(); i++) {




More information about the lldb-commits mailing list