2 Test lldb command aliases.
5 from __future__ import print_function
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
16 class LaunchInTerminalTestCase(TestBase):
18 mydir = TestBase.compute_mydir(__file__)
20 # Darwin is the only platform that I know of that supports optionally launching
21 # a program in a separate terminal window. It would be great if other platforms
22 # added support for this.
24 @expectedFailureDarwin("llvm.org/pr25484")
25 # If the test is being run under sudo, the spawned terminal won't retain that elevated
26 # privilege so it can't open the socket to talk back to the test case
27 @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "test cannot be run as root")
28 # Do we need to disable this test if the testsuite is being run on a remote system?
29 # This env var is only defined when the shell is running in a local mac terminal window
30 @unittest2.skipUnless('TERM_PROGRAM' in os.environ, "test must be run on local system")
32 def test_launch_in_terminal (self):
34 target = self.dbg.CreateTarget(exe)
35 launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"])
36 launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit)
37 error = lldb.SBError()
38 process = target.Launch (launch_info, error)
39 self.assertTrue(error.Success(), "Make sure launch happened successfully in a terminal window")
40 # Running in synchronous mode our process should have run and already exited by the time target.Launch() returns
41 self.assertTrue(process.GetState() == lldb.eStateExited)