Files
clang-p2996/lldb/test/API/functionalities/gdb_remote_client/TestFork.py
Dave Lee 4cc8f2a017 [lldb][tests] Automatically call compute_mydir (NFC)
Eliminate boilerplate of having each test manually assign to `mydir` by calling
`compute_mydir` in lldbtest.py.

Differential Revision: https://reviews.llvm.org/D128077
2022-06-17 14:34:49 -07:00

55 lines
1.8 KiB
Python

from __future__ import print_function
import lldb
import unittest
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test.gdbclientutils import *
from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
class TestMultiprocess(GDBRemoteTestBase):
def base_test(self, variant):
class MyResponder(MockGDBServerResponder):
def __init__(self):
super().__init__()
self.first = True
self.detached = None
self.property = "{}-events+".format(variant)
def qSupported(self, client_supported):
assert "multiprocess+" in client_supported
assert self.property in client_supported
return "{};multiprocess+;{}".format(
super().qSupported(client_supported), self.property)
def qfThreadInfo(self):
return "mp400.10200"
def cont(self):
if self.first:
self.first = False
return ("T0fthread:p400.10200;reason:{0};{0}:p401.10400;"
.format(variant))
return "W00"
def D(self, packet):
self.detached = packet
return "OK"
self.server.responder = MyResponder()
target = self.dbg.CreateTarget('')
if self.TraceOn():
self.runCmd("log enable gdb-remote packets")
self.addTearDownHook(
lambda: self.runCmd("log disable gdb-remote packets"))
process = self.connect(target)
process.Continue()
self.assertRegex(self.server.responder.detached, r"D;0*401")
def test_fork(self):
self.base_test("fork")
def test_vfork(self):
self.base_test("vfork")