10815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen""" 20815031982a0461fd4466cdcdd15d9220a93ca26Johnny ChenTest some lldb platform commands. 30815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen""" 40815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 50815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenimport os, time 60815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenimport unittest2 70815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenimport lldb 80815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenfrom lldbtest import * 90815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 100815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenclass PlatformCommandTestCase(TestBase): 110815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 1217a1399a7e7fbc4d2adb4186cd472f7e72d8d161Johnny Chen mydir = os.path.join("functionalities", "platform") 130815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 140815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen def test_help_platform(self): 150815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen self.runCmd("help platform") 160815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 170815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen def test_list(self): 180815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen self.expect("platform list", 190815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen patterns = ['^Available platforms:']) 200815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 216bd7f0ded258fb0691da9090156910e156261933Ed Maste @expectedFailureFreeBSD('llvm.org/pr16699') # FreeBSD Host.cpp does not support process list 220815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen def test_process_list(self): 230815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen self.expect("platform process list", 240cd8be8ce3b11fe9c2591591c12cad5b688e6d0eJohnny Chen substrs = ['PID', 'ARCH', 'NAME']) 250815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 262ba5ef672f714dbfbf60483878641b2a0f5c6129Johnny Chen def test_process_info_with_no_arg(self): 272ba5ef672f714dbfbf60483878641b2a0f5c6129Johnny Chen """This is expected to fail and to return a proper error message.""" 282ba5ef672f714dbfbf60483878641b2a0f5c6129Johnny Chen self.expect("platform process info", error=True, 292ba5ef672f714dbfbf60483878641b2a0f5c6129Johnny Chen substrs = ['one or more process id(s) must be specified']) 302ba5ef672f714dbfbf60483878641b2a0f5c6129Johnny Chen 310815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen def test_status(self): 320815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen self.expect("platform status", 330815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname']) 340815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 350815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen 360815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chenif __name__ == '__main__': 370815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen import atexit 380815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen lldb.SBDebugger.Initialize() 390815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen atexit.register(lambda: lldb.SBDebugger.Terminate()) 400815031982a0461fd4466cdcdd15d9220a93ca26Johnny Chen unittest2.main() 41