]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / tty / TestTerminal.py
1 """
2 Test lldb command aliases.
3 """
4
5 from __future__ import print_function
6
7
8
9 import unittest2
10 import os, time
11 import lldb
12 from lldbsuite.test.decorators import *
13 from lldbsuite.test.lldbtest import *
14 from lldbsuite.test import lldbutil
15
16 class LaunchInTerminalTestCase(TestBase):
17
18     mydir = TestBase.compute_mydir(__file__)
19
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.
23     @skipUnlessDarwin
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")
31     @no_debug_info_test
32     def test_launch_in_terminal (self):
33         exe = "/bin/ls"
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)