Files
clang-p2996/lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.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

50 lines
2.0 KiB
Python

import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from gdbclientutils import *
class TestThreadSelectionBug(GDBRemoteTestBase):
def test(self):
class MyResponder(MockGDBServerResponder):
def cont(self):
# Simulate process stopping due to a raise(SIGINT)
return "T01reason:signal"
self.server.responder = MyResponder()
target = self.createTarget("a.yaml")
process = self.connect(target)
python_os_plugin_path = os.path.join(self.getSourceDir(),
'operating_system.py')
command = "settings set target.process.python-os-plugin-path '{}'".format(
python_os_plugin_path)
self.dbg.HandleCommand(command)
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetNumThreads(), 3)
# Verify our OS plug-in threads showed up
thread = process.GetThreadByID(0x1)
self.assertTrue(
thread.IsValid(),
"Make sure there is a thread 0x1 after we load the python OS plug-in")
thread = process.GetThreadByID(0x2)
self.assertTrue(
thread.IsValid(),
"Make sure there is a thread 0x2 after we load the python OS plug-in")
thread = process.GetThreadByID(0x3)
self.assertTrue(
thread.IsValid(),
"Make sure there is a thread 0x3 after we load the python OS plug-in")
# Verify that a thread other than 3 is selected.
thread = process.GetSelectedThread()
self.assertNotEqual(thread.GetThreadID(), 0x3)
# Verify that we select the thread backed by physical thread 1, rather
# than virtual thread 1. The mapping comes from the OS plugin, where we
# specified that thread 3 is backed by real thread 1.
process.Continue()
thread = process.GetSelectedThread()
self.assertEqual(thread.GetThreadID(), 0x3)