diff options
| author | Jordan Rupprecht <rupprecht@google.com> | 2020-02-11 10:01:16 -0800 |
|---|---|---|
| committer | Jordan Rupprecht <rupprecht@google.com> | 2020-02-11 10:03:53 -0800 |
| commit | 99451b4453688a94c6014cac233d371ab4cc342d (patch) | |
| tree | 5f388465c19360723e2311c105c8f66e944c8d68 /lldb/test/API/functionalities/tty | |
| parent | 29bc5dd19407c4d7cad1c059dea26ee216ddc7ca (diff) | |
[lldb][test] Remove symlink for API tests.
Summary: Moves lldbsuite tests to lldb/test/API.
This is a largely mechanical change, moved with the following steps:
```
rm lldb/test/API/testcases
mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}
mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner
for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done
```
lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.
Reviewers: labath, JDevlieghere
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71151
Diffstat (limited to 'lldb/test/API/functionalities/tty')
| -rw-r--r-- | lldb/test/API/functionalities/tty/Makefile | 3 | ||||
| -rw-r--r-- | lldb/test/API/functionalities/tty/TestTerminal.py | 51 | ||||
| -rw-r--r-- | lldb/test/API/functionalities/tty/main.c | 10 |
3 files changed, 64 insertions, 0 deletions
diff --git a/lldb/test/API/functionalities/tty/Makefile b/lldb/test/API/functionalities/tty/Makefile new file mode 100644 index 000000000000..10495940055b --- /dev/null +++ b/lldb/test/API/functionalities/tty/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/functionalities/tty/TestTerminal.py b/lldb/test/API/functionalities/tty/TestTerminal.py new file mode 100644 index 000000000000..bf5f1200ace8 --- /dev/null +++ b/lldb/test/API/functionalities/tty/TestTerminal.py @@ -0,0 +1,51 @@ +""" +Test lldb command aliases. +""" + +from __future__ import print_function + + +import unittest2 +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class LaunchInTerminalTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + # Darwin is the only platform that I know of that supports optionally launching + # a program in a separate terminal window. It would be great if other platforms + # added support for this. + @skipUnlessDarwin + # If the test is being run under sudo, the spawned terminal won't retain that elevated + # privilege so it can't open the socket to talk back to the test case + @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid() + == 0, "test cannot be run as root") + # Do we need to disable this test if the testsuite is being run on a remote system? + # This env var is only defined when the shell is running in a local mac + # terminal window + @unittest2.skipUnless( + 'TERM_PROGRAM' in os.environ, + "test must be run on local system") + @no_debug_info_test + def test_launch_in_terminal(self): + self.build() + exe = self.getBuildArtifact("a.out") + + target = self.dbg.CreateTarget(exe) + launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"]) + launch_info.SetLaunchFlags( + lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit) + error = lldb.SBError() + process = target.Launch(launch_info, error) + print("Error was: %s."%(error.GetCString())) + self.assertTrue( + error.Success(), + "Make sure launch happened successfully in a terminal window") + # Running in synchronous mode our process should have run and already + # exited by the time target.Launch() returns + self.assertTrue(process.GetState() == lldb.eStateExited) diff --git a/lldb/test/API/functionalities/tty/main.c b/lldb/test/API/functionalities/tty/main.c new file mode 100644 index 000000000000..71c854b5bf40 --- /dev/null +++ b/lldb/test/API/functionalities/tty/main.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int +main(int argc, char** argv) +{ + for (int i = 0; i < argc; i++) { + printf("%d: %s.\n", i, argv[i]); + } + return 0; +} |
