[lldb/Reproducers] Update macosx remote tests for passive replay

Skip tests or part thereof that are not supposed to work with replay.
This commit is contained in:
Jonas Devlieghere 2020-05-19 14:01:23 -07:00
parent e8f6b0e583
commit 667be3319d
4 changed files with 33 additions and 25 deletions

View File

@ -15,7 +15,7 @@ class DyldTrieSymbolsTestCase(TestBase):
@skipIfRemote
@skipUnlessDarwin
def test_dyld_trie_symbols(self):
"""Test that we make create symbol table entries from the dyld trie data structure."""
self.build()
@ -89,20 +89,24 @@ class DyldTrieSymbolsTestCase(TestBase):
# stripped off the objc prefix from the symbol names.
syms_ctx = stripped_target.FindSymbols("SourceBase")
self.assertEqual(syms_ctx.GetSize(), 2)
sym1 = syms_ctx.GetContextAtIndex(0).GetSymbol()
sym2 = syms_ctx.GetContextAtIndex(1).GetSymbol()
# one of these should be a lldb.eSymbolTypeObjCClass, the other
# should be lldb.eSymbolTypeObjCMetaClass.
if sym1.GetType() == lldb.eSymbolTypeObjCMetaClass:
self.assertEqual(sym2.GetType(), lldb.eSymbolTypeObjCClass)
else:
if sym1.GetType() == lldb.eSymbolTypeObjCClass:
self.assertEqual(sym2.GetType(), lldb.eSymbolTypeObjCMetaClass)
# The next part if not deterministic and potentially causes replay to
# fail when the order is different during capture and replay.
if not configuration.is_reproducer():
sym1 = syms_ctx.GetContextAtIndex(0).GetSymbol()
sym2 = syms_ctx.GetContextAtIndex(1).GetSymbol()
# one of these should be a lldb.eSymbolTypeObjCClass, the other
# should be lldb.eSymbolTypeObjCMetaClass.
if sym1.GetType() == lldb.eSymbolTypeObjCMetaClass:
self.assertEqual(sym2.GetType(), lldb.eSymbolTypeObjCClass)
else:
self.assertTrue(sym1.GetType() == lldb.eSymbolTypeObjCMetaClass or sym1.GetType() == lldb.eSymbolTypeObjCClass)
if sym1.GetType() == lldb.eSymbolTypeObjCClass:
self.assertEqual(sym2.GetType(), lldb.eSymbolTypeObjCMetaClass)
else:
self.assertTrue(sym1.GetType() == lldb.eSymbolTypeObjCMetaClass or sym1.GetType() == lldb.eSymbolTypeObjCClass)
syms_ctx = stripped_target.FindSymbols("SourceDerived._derivedValue")
self.assertEqual(syms_ctx.GetSize(), 1)
sym = syms_ctx.GetContextAtIndex(0).GetSymbol()
self.assertEqual(sym.GetType(), lldb.eSymbolTypeObjCIVar)
syms_ctx = stripped_target.FindSymbols("SourceDerived._derivedValue")
self.assertEqual(syms_ctx.GetSize(), 1)
sym = syms_ctx.GetContextAtIndex(0).GetSymbol()
self.assertEqual(sym.GetType(), lldb.eSymbolTypeObjCIVar)

View File

@ -19,6 +19,7 @@ class FunctionStartsTestCase(TestBase):
@skipIfRemote
@skipUnlessDarwin
@skipIfReproducer # File synchronization is not supported during replay.
def test_function_starts_binary(self):
"""Test that we make synthetic symbols when we have the binary."""
self.build()
@ -26,13 +27,14 @@ class FunctionStartsTestCase(TestBase):
@skipIfRemote
@skipUnlessDarwin
@skipIfReproducer # File synchronization is not supported during replay.
def test_function_starts_no_binary(self):
"""Test that we make synthetic symbols when we don't have the binary"""
self.build()
self.do_function_starts(True)
def do_function_starts(self, in_memory):
"""Run the binary, stop at our unstripped function,
"""Run the binary, stop at our unstripped function,
make sure the caller has synthetic symbols"""
exe = self.getBuildArtifact(exe_name)
@ -57,7 +59,7 @@ class FunctionStartsTestCase(TestBase):
pid = lldbutil.wait_for_file_on_target(self, pid_file_path)
if in_memory:
remove_file(exe)
remove_file(exe)
target = self.dbg.CreateTarget(None)
self.assertTrue(target.IsValid(), "Got a vaid empty target.")
@ -67,10 +69,10 @@ class FunctionStartsTestCase(TestBase):
attach_info.SetIgnoreExisting(False)
process = target.Attach(attach_info, error)
self.assertTrue(error.Success(), "Didn't attach successfully to %d: %s"%(popen.pid, error.GetCString()))
bkpt = target.BreakpointCreateByName("dont_strip_me", exe)
self.assertTrue(bkpt.GetNumLocations() > 0, "Didn't set the dont_strip_me bkpt.")
threads = lldbutil.continue_to_breakpoint(process, bkpt)
self.assertEqual(len(threads), 1, "Didn't hit my breakpoint.")
@ -81,6 +83,6 @@ class FunctionStartsTestCase(TestBase):
name = thread.frame[1].GetFunctionName()
self.assertTrue(name.startswith("___lldb_unnamed_symbol"))
self.assertTrue(name.endswith("$$StripMe"))

View File

@ -3,7 +3,7 @@ debugserver used to block replying to the 'D' packet
till it had joined the profiling thread. If the profiling interval
was too long, that would mean it would take longer than the packet
timeout to reply, and the detach would time out. Make sure that doesn't
happen.
happen.
"""
@ -23,6 +23,7 @@ class TestDetachVrsProfile(TestBase):
@skipUnlessDarwin
@skipIfOutOfTreeDebugserver
@skipIfReproducer
def test_profile_and_detach(self):
"""There can be many tests in a test case - describe this test here."""
self.build()
@ -55,14 +56,14 @@ class TestDetachVrsProfile(TestBase):
# We don't want to hit our breakpoint anymore.
bkpt.SetEnabled(False)
# Record our process pid so we can kill it since we are going to detach...
self.pid = process.GetProcessID()
def cleanup():
self.dbg.SetAsync(False)
os.kill(self.pid, signal.SIGKILL)
self.addTearDownHook(cleanup)
process.Continue()
event = lldb.SBEvent()
@ -70,7 +71,7 @@ class TestDetachVrsProfile(TestBase):
self.assertTrue(success, "Got an event which should be running.")
event_state = process.GetStateFromEvent(event)
self.assertEqual(event_state, lldb.eStateRunning, "Got the running event")
# Now detach:
error = process.Detach()
self.assertTrue(error.Success(), "Detached successfully")

View File

@ -14,6 +14,7 @@ class TestInterruptThreadNames(TestBase):
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@skipIfReproducer # While loop with non fixed number of iterations.
def test_with_python_api(self):
"""Test that we get thread names when interrupting a process."""
self.build()