2 Test some lldb platform commands.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
16 class PlatformCommandTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
21 def test_help_platform(self):
22 self.runCmd("help platform")
26 self.expect("platform list",
27 patterns=['^Available platforms:'])
30 def test_process_list(self):
31 self.expect("platform process list",
32 substrs=['PID', 'TRIPLE', 'NAME'])
35 def test_process_info_with_no_arg(self):
36 """This is expected to fail and to return a proper error message."""
37 self.expect("platform process info", error=True,
38 substrs=['one or more process id(s) must be specified'])
41 def test_status(self):
53 """ Test that the platform shell command can invoke ls. """
54 triple = self.dbg.GetSelectedPlatform().GetTriple()
55 if re.match(".*-.*-windows", triple):
57 "platform shell dir c:\\", substrs=[
58 "Windows", "Program Files"])
59 elif re.match(".*-.*-.*-android", triple):
61 "platform shell ls /",
67 self.expect("platform shell ls /", substrs=["dev", "tmp", "usr"])
70 def test_shell_builtin(self):
71 """ Test a shell built-in command (echo) """
72 self.expect("platform shell echo hello lldb",
73 substrs=["hello lldb"])
75 # FIXME: re-enable once platform shell -t can specify the desired timeout
77 def test_shell_timeout(self):
78 """ Test a shell built-in command (sleep) that times out """
79 self.skipTest("due to taking too long to complete.")
80 self.expect("platform shell sleep 15", error=True, substrs=[
81 "error: timed out waiting for shell command to complete"])