2020-03-31 10:47:20 +02:00
|
|
|
"""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
|
|
|
|
|
|
2020-08-04 14:00:30 -07:00
|
|
|
@skipIfRemote # Remote environment not supported.
|
2020-03-31 10:47:20 +02:00
|
|
|
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"))
|
2022-02-11 21:23:16 -08:00
|
|
|
self.assertSuccess(plat.Run(cmd))
|
2020-03-31 10:47:20 +02:00
|
|
|
self.assertIn("MY_TEST_ENV_VAR=SBPlatformAPICase.test_run", cmd.GetOutput())
|
2022-01-18 11:26:07 +01:00
|
|
|
|
|
|
|
|
def test_SetSDKRoot(self):
|
|
|
|
|
plat = lldb.SBPlatform("remote-linux") # arbitrary choice
|
|
|
|
|
self.assertTrue(plat)
|
|
|
|
|
plat.SetSDKRoot(self.getBuildDir())
|
2022-03-09 18:12:28 +01:00
|
|
|
self.dbg.SetCurrentPlatform("remote-linux")
|
2022-01-18 11:26:07 +01:00
|
|
|
self.expect("platform status",
|
|
|
|
|
substrs=["Sysroot:", self.getBuildDir()])
|