labath created this revision.

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.


https://reviews.llvm.org/D39010

Files:
  unittests/tools/lldb-server/tests/TestClient.cpp


Index: unittests/tools/lldb-server/tests/TestClient.cpp
===================================================================
--- unittests/tools/lldb-server/tests/TestClient.cpp
+++ unittests/tools/lldb-server/tests/TestClient.cpp
@@ -101,6 +101,14 @@
 }
 
 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++) {


Index: unittests/tools/lldb-server/tests/TestClient.cpp
===================================================================
--- unittests/tools/lldb-server/tests/TestClient.cpp
+++ unittests/tools/lldb-server/tests/TestClient.cpp
@@ -101,6 +101,14 @@
 }
 
 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++) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D3901... Pavel Labath via Phabricator via lldb-commits

Reply via email to