Summary: On most hosts we were running shell commands with an empty environment. The only exception was windows, which was inheriting the host enviroment mostly by accident. Running the commands in an empty environment does not sound like a sensible default, so this patch changes Host::RunShellCommand to inherit the host environment. This impacts both commands run via SBPlatform::Run (in case of host platforms), as well as the "platform shell" CLI command. Reviewers: jingham, friss Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D77123
23 lines
741 B
Python
23 lines
741 B
Python
"""Test the SBPlatform APIs."""
|
|
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
class SBPlatformAPICase(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
@add_test_categories(['pyapi'])
|
|
def test_run(self):
|
|
self.build()
|
|
plat = lldb.SBPlatform.GetHostPlatform()
|
|
|
|
os.environ["MY_TEST_ENV_VAR"]="SBPlatformAPICase.test_run"
|
|
def cleanup():
|
|
del os.environ["MY_TEST_ENV_VAR"]
|
|
self.addTearDownHook(cleanup)
|
|
cmd = lldb.SBPlatformShellCommand(self.getBuildArtifact("a.out"))
|
|
self.assertTrue(plat.Run(cmd).Success())
|
|
self.assertIn("MY_TEST_ENV_VAR=SBPlatformAPICase.test_run", cmd.GetOutput())
|