Johnny Chen | c640179 | 2011-03-30 21:19:59 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test some lldb platform commands. |
| 3 | """ |
| 4 | |
| 5 | import os, time |
| 6 | import unittest2 |
| 7 | import lldb |
| 8 | from lldbtest import * |
| 9 | |
| 10 | class PlatformCommandTestCase(TestBase): |
| 11 | |
Johnny Chen | fd70999 | 2011-06-27 18:25:00 +0000 | [diff] [blame] | 12 | mydir = os.path.join("functionalities", "platform") |
Johnny Chen | c640179 | 2011-03-30 21:19:59 +0000 | [diff] [blame] | 13 | |
| 14 | def test_help_platform(self): |
| 15 | self.runCmd("help platform") |
| 16 | |
| 17 | def test_list(self): |
| 18 | self.expect("platform list", |
| 19 | patterns = ['^Available platforms:']) |
| 20 | |
Daniel Malea | 939ec18 | 2013-01-05 00:25:12 +0000 | [diff] [blame] | 21 | @expectedFailureLinux # due to bugzilla 14541 -- Cannot list processes on Linux |
Johnny Chen | c640179 | 2011-03-30 21:19:59 +0000 | [diff] [blame] | 22 | def test_process_list(self): |
| 23 | self.expect("platform process list", |
Johnny Chen | 7d90b1f | 2011-04-01 00:48:40 +0000 | [diff] [blame] | 24 | substrs = ['PID', 'ARCH', 'NAME']) |
Johnny Chen | c640179 | 2011-03-30 21:19:59 +0000 | [diff] [blame] | 25 | |
Johnny Chen | fa92ecc | 2011-05-09 20:51:47 +0000 | [diff] [blame] | 26 | def test_process_info_with_no_arg(self): |
| 27 | """This is expected to fail and to return a proper error message.""" |
| 28 | self.expect("platform process info", error=True, |
| 29 | substrs = ['one or more process id(s) must be specified']) |
| 30 | |
Daniel Malea | 939ec18 | 2013-01-05 00:25:12 +0000 | [diff] [blame] | 31 | @expectedFailureLinux # due to bugzilla 14806 -- "platform status" prints more information on Mac OS X than on Linux |
Johnny Chen | c640179 | 2011-03-30 21:19:59 +0000 | [diff] [blame] | 32 | def test_status(self): |
| 33 | self.expect("platform status", |
| 34 | substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname']) |
| 35 | |
| 36 | |
| 37 | if __name__ == '__main__': |
| 38 | import atexit |
| 39 | lldb.SBDebugger.Initialize() |
| 40 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 41 | unittest2.main() |