1"""
2Test some lldb platform commands.
3"""
4
5import os, time
6import unittest2
7import lldb
8from lldbtest import *
9
10class PlatformCommandTestCase(TestBase):
11
12    mydir = os.path.join("functionalities", "platform")
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
21    @expectedFailureFreeBSD('llvm.org/pr16699') # FreeBSD Host.cpp does not support process list
22    def test_process_list(self):
23        self.expect("platform process list",
24            substrs = ['PID', 'ARCH', 'NAME'])
25
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
31    def test_status(self):
32        self.expect("platform status",
33            substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname'])
34
35
36if __name__ == '__main__':
37    import atexit
38    lldb.SBDebugger.Initialize()
39    atexit.register(lambda: lldb.SBDebugger.Terminate())
40    unittest2.main()
41