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
15 class PlatformCommandTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 def test_help_platform(self):
21 self.runCmd("help platform")
25 self.expect("platform list",
26 patterns = ['^Available platforms:'])
29 def test_process_list(self):
30 self.expect("platform process list",
31 substrs = ['PID', 'TRIPLE', 'NAME'])
34 def test_process_info_with_no_arg(self):
35 """This is expected to fail and to return a proper error message."""
36 self.expect("platform process info", error=True,
37 substrs = ['one or more process id(s) must be specified'])
40 def test_status(self):
41 self.expect("platform status",
42 substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname'])
46 """ Test that the platform shell command can invoke ls. """
47 triple = self.dbg.GetSelectedPlatform().GetTriple()
48 if re.match(".*-.*-windows", triple):
49 self.expect("platform shell dir c:\\", substrs = ["Windows", "Program Files"])
50 elif re.match(".*-.*-.*-android", triple):
51 self.expect("platform shell ls /", substrs = ["cache", "dev", "system"])
53 self.expect("platform shell ls /", substrs = ["dev", "tmp", "usr"])
56 def test_shell_builtin(self):
57 """ Test a shell built-in command (echo) """
58 self.expect("platform shell echo hello lldb",
59 substrs = ["hello lldb"])
61 #FIXME: re-enable once platform shell -t can specify the desired timeout
63 def test_shell_timeout(self):
64 """ Test a shell built-in command (sleep) that times out """
65 self.skipTest("due to taking too long to complete.")
66 self.expect("platform shell sleep 15", error=True,
67 substrs = ["error: timed out waiting for shell command to complete"])