diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-05-13 19:17:48 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-05-13 19:17:48 +0000 |
| commit | ae54fc9f0422ed541e4f3197fb2a3538af7f1ab9 (patch) | |
| tree | 15b93292f5778394b6805dbaa540b596d666e170 /lldb/lit/Process | |
| parent | 6c86f7d75e12cdbe85f4395c261875be635df5de (diff) | |
| download | bcm5719-llvm-ae54fc9f0422ed541e4f3197fb2a3538af7f1ab9.tar.gz bcm5719-llvm-ae54fc9f0422ed541e4f3197fb2a3538af7f1ab9.zip | |
Merge target and launch info environments
Before this change we were overriding the launch info environment with
the target environment. This meant that the environment variables passed
to `process launch --environment <>` were lost. Instead of replacing the
environment, we should merge them.
Differential revision: https://reviews.llvm.org/D61864
llvm-svn: 360612
Diffstat (limited to 'lldb/lit/Process')
| -rw-r--r-- | lldb/lit/Process/Inputs/env.cpp | 7 | ||||
| -rw-r--r-- | lldb/lit/Process/TestEnvironment.test | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lldb/lit/Process/Inputs/env.cpp b/lldb/lit/Process/Inputs/env.cpp new file mode 100644 index 00000000000..cbf671ccd2f --- /dev/null +++ b/lldb/lit/Process/Inputs/env.cpp @@ -0,0 +1,7 @@ +#include <cstdlib> +#include <iostream> + +int main() { + if (const char *env_p = std::getenv("FOO")) + std::cout << "FOO=" << env_p << '\n'; +} diff --git a/lldb/lit/Process/TestEnvironment.test b/lldb/lit/Process/TestEnvironment.test new file mode 100644 index 00000000000..8bbf8767f33 --- /dev/null +++ b/lldb/lit/Process/TestEnvironment.test @@ -0,0 +1,7 @@ +The double quotes around "BAR" ensure we don't match the command. + +RUN: %clangxx -std=c++11 %p/Inputs/env.cpp -o %t +RUN: %lldb %t -o 'process launch --environment FOO="BAR"' | FileCheck %s +RUN: %lldb %t -o 'env FOO="BAR"' -o 'process launch' | FileCheck %s + +CHECK: FOO=BAR |

