Skip to content

Commit

Permalink
[lldb/Reproducers] Skip or fix the remaining tests.
Browse files Browse the repository at this point in the history
After this patch all remaining tests should pass on macOS when replayed
from a reproducer.

To capture the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=capture

To replay the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=replay
  • Loading branch information
JDevlieghere committed May 28, 2020
1 parent 12cd4a5 commit 5238b80
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 9 deletions.
Expand Up @@ -6,6 +6,7 @@

class TestWriteMemory(GDBRemoteTestBase):

@skipIfReproducer # SBProcess::WriteMemory is not instrumented.
def test(self):

class MyResponder(MockGDBServerResponder):
Expand Down
Expand Up @@ -223,6 +223,7 @@ def test_lldb_process_load_and_unload_commands_with_svr4(self):
self.setSvr4Support(True)
self.run_lldb_process_load_and_unload_commands()

@skipIfReproducer # FIXME: Unexpected packet during (passive) replay
def run_lldb_process_load_and_unload_commands(self):
"""Test that lldb process load/unload command work correctly."""
self.copy_shlibs_to_remote()
Expand Down
Expand Up @@ -41,6 +41,7 @@ def setUp(self):
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
@expectedFlakeyNetBSD
@expectedFailureAll(oslist=["linux"], archs=['arm'], bugnumber="llvm.org/pr45894")
@skipIfReproducer # FIXME: Unexpected packet during (passive) replay
def test_load_using_paths(self):
"""Test that we can load a module by providing a set of search paths."""
if self.platformIsDarwin():
Expand Down
Expand Up @@ -344,6 +344,7 @@ def test_deeper_stack_in_minidump(self):
"linux-x86_64_not_crashed.dmp",
self._linux_x86_64_not_crashed_pid)

@skipIfReproducer # VFS is a snapshot.
def do_change_pid_in_minidump(self, core, newcore, offset, oldpid, newpid):
""" This assumes that the minidump is breakpad generated on Linux -
meaning that the PID in the file will be an ascii string part of
Expand Down
Expand Up @@ -24,6 +24,7 @@ def setUp(self):
@skipIfWindows # setpgid call does not exist on Windows
@expectedFailureAndroid("http://llvm.org/pr23762", api_levels=[16])
@expectedFailureNetBSD
@skipIfReproducer # File synchronization is not supported during replay.
def test_setpgid(self):
self.build()
exe = self.getBuildArtifact("a.out")
Expand Down
Expand Up @@ -33,20 +33,21 @@ def test_exit_after_one_thread_unwind(self):
def test_exit_after_one_thread_no_unwind(self):
"""Test the case where we exit within the one thread timeout"""
self.exiting_expression_test(False, False)

def setUp(self):
TestBase.setUp(self)
self.main_source_file = lldb.SBFileSpec("main.c")
self.build()


@skipIfReproducer # Timeouts are not currently modeled.
def exiting_expression_test(self, before_one_thread_timeout , unwind):
"""function_to_call sleeps for g_timeout microseconds, then calls pthread_exit.
This test calls function_to_call with an overall timeout of 500
microseconds, and a one_thread_timeout as passed in.
It also sets unwind_on_exit for the call to the unwind passed in.
This allows you to have the thread exit either before the one thread
timeout is passed. """

(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
"Break here and cause the thread to exit", self.main_source_file)

Expand All @@ -59,15 +60,15 @@ def exiting_expression_test(self, before_one_thread_timeout , unwind):
var_options.SetIncludeArguments(False)
var_options.SetIncludeLocals(False)
var_options.SetIncludeStatics(True)

value_list = frame.GetVariables(var_options)
g_timeout = value_list.GetFirstValueByName("g_timeout")
self.assertTrue(g_timeout.IsValid(), "Found g_timeout")

error = lldb.SBError()
timeout_value = g_timeout.GetValueAsUnsigned(error)
self.assertTrue(error.Success(), "Couldn't get timeout value: %s"%(error.GetCString()))

one_thread_timeout = 0
if (before_one_thread_timeout):
one_thread_timeout = timeout_value * 2
Expand All @@ -78,7 +79,7 @@ def exiting_expression_test(self, before_one_thread_timeout , unwind):
options.SetUnwindOnError(unwind)
options.SetOneThreadTimeoutInMicroSeconds(one_thread_timeout)
options.SetTimeoutInMicroSeconds(4 * timeout_value)

result = frame.EvaluateExpression("function_to_call()", options)

# Make sure the thread actually exited:
Expand All @@ -103,4 +104,4 @@ def exiting_expression_test(self, before_one_thread_timeout , unwind):
ret_val_value = ret_val.GetValueAsSigned(error)
self.assertTrue(error.Success(), "Got ret_val's value")
self.assertEqual(ret_val_value, 10, "We put the right value in ret_val")

17 changes: 16 additions & 1 deletion lldb/test/API/lang/cpp/thread_local/TestThreadLocal.py
Expand Up @@ -30,10 +30,25 @@ def test_thread_local(self):
self.expect_expr("*tl_global_ptr",
result_type="int", result_value="45")

# Create the filespec by which to locate our a.out module.
#
# - Use the absolute path to get the module for the current variant.
# - Use the relative path for reproducers. The modules are never
# orphaned because the SB objects are leaked intentionally. This
# causes LLDB to reuse the same module for every variant, because the
# UUID is the same for all the inferiors. FindModule below only
# compares paths and is oblivious to the fact that the UUIDs are the
# same.
if configuration.is_reproducer():
filespec = lldb.SBFileSpec('a.out', False)
else:
filespec = lldb.SBFileSpec(exe, False)

# Now see if we emit the correct error when the TLS is not yet
# initialized. Let's set a breakpoint on the first instruction
# of main.
main_module = target.FindModule(lldb.SBFileSpec(exe))
main_module = target.FindModule(filespec)
self.assertTrue(main_module, VALID_MODULE)
main_address = main_module.FindSymbol("main").GetStartAddress()
main_bkpt = target.BreakpointCreateBySBAddress(main_address)

Expand Down
Expand Up @@ -19,6 +19,7 @@ class TestGetVersionForZero(TestBase):
# each debug info format.
NO_DEBUG_INFO_TESTCASE = True

@skipIfReproducer # FIXME: Unexpected packet during (passive) replay
def test_get_version_zero(self):
"""Read in a library with a version of 0.0.0. Test SBModule::GetVersion"""
self.yaml2obj("libDylib.dylib.yaml", self.getBuildArtifact("libDylib.dylib"))
Expand Down
Expand Up @@ -23,6 +23,7 @@ def setUp(self):

@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@skipIfReproducer # FIXME: Unexpected packet during (passive) replay
def test(self):
"""Exercise SBSymbolContext API extensively."""
self.build()
Expand Down

0 comments on commit 5238b80

Please sign in to comment.