Files
clang-p2996/lldb/test/API/functionalities/dead-strip/TestDeadStrip.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

59 lines
2.0 KiB
Python

"""
Test that breakpoint works correctly in the presence of dead-code stripping.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class DeadStripTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44429")
def test(self):
"""Test breakpoint works correctly with dead-code stripping."""
self.build()
exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name f1 (live code).
lldbutil.run_break_set_by_symbol(
self, "f1", num_expected_locations=1, module_name="a.out")
# Break by function name f2 (dead code).
lldbutil.run_break_set_by_symbol(
self, "f2", num_expected_locations=0, module_name="a.out")
# Break by function name f3 (live code).
lldbutil.run_break_set_by_symbol(
self, "f3", num_expected_locations=1, module_name="a.out")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint (breakpoint #1).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
'a.out`f1',
'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 1", BREAKPOINT_HIT_ONCE,
substrs=[' resolved, hit count = 1'])
self.runCmd("continue")
# The stop reason of the thread should be breakpoint (breakpoint #3).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
'a.out`f3',
'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 3", BREAKPOINT_HIT_ONCE,
substrs=[' resolved, hit count = 1'])