Files
clang-p2996/lldb/test/API/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py
Jordan Rupprecht 99451b4453 [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
2020-02-11 10:03:53 -08:00

79 lines
2.7 KiB
Python

"""
Test DarwinLog "source include debug-level" functionality provided by the
StructuredDataDarwinLog plugin.
These tests are currently only supported when running against Darwin
targets.
"""
import lldb
from lldbsuite.test import decorators
from lldbsuite.test import lldbtest
from lldbsuite.test import darwin_log
class TestDarwinLogSourceDebug(darwin_log.DarwinLogTestBase):
mydir = lldbtest.TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
super(TestDarwinLogSourceDebug, self).setUp()
# Source filename.
self.source = 'main.c'
# Output filename.
self.exe_name = self.getBuildArtifact("a.out")
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
# Locate breakpoint.
self.line = lldbtest.line_number(self.source, '// break here')
# Indicate we want strict-sources behavior.
self.strict_sources = True
def tearDown(self):
# Shut down the process if it's still running.
if self.child:
self.runCmd('process kill')
self.expect_prompt()
self.runCmd('quit')
# Let parent clean up
super(TestDarwinLogSourceDebug, self).tearDown()
# ==========================================================================
# source include/exclude debug filter tests
# ==========================================================================
@decorators.skipUnlessDarwin
def test_source_default_exclude_debug(self):
"""Test that default excluding of debug-level log messages works."""
self.do_test([])
# We should only see the second log message as the first is a
# debug-level message and we're not including debug-level messages.
self.assertIsNotNone(self.child.match)
self.assertTrue(
(len(
self.child.match.groups()) > 1) and (
self.child.match.group(2) == "cat2"),
"first log line should not be present, second log line "
"should be")
@decorators.skipUnlessDarwin
def test_source_explicitly_include_debug(self):
"""Test that explicitly including debug-level log messages works."""
self.do_test(["--debug"])
# We should only see the second log message as the first is a
# debug-level message and we're not including debug-level messages.
self.assertIsNotNone(self.child.match)
self.assertTrue((len(self.child.match.groups()) > 1) and
(self.child.match.group(2) == "cat1"),
"first log line should be present since we're "
"including debug-level log messages")