From 7b9b30ab56054ba1158f522108d716e705480961 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 20 Oct 2017 22:39:18 +0000 Subject: [PATCH] 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 llvm-svn: 316244 --- lldb/unittests/tools/lldb-server/tests/TestClient.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp index 67fff20..12b9420 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -101,6 +101,14 @@ bool TestClient::StopDebugger() { } bool TestClient::SetInferior(llvm::ArrayRef 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++) { -- 2.7.4