aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/configuration.py5
-rw-r--r--lldb/packages/Python/lldbsuite/test/decorators.py8
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py22
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest_args.py11
4 files changed, 45 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index ce6f46a..9d69438 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -87,7 +87,6 @@ session_file_format = 'fnmac'
# Set this flag if there is any session info dumped during the test run.
sdir_has_content = False
-
# svn_info stores the output from 'svn info lldb.base.dir'.
svn_info = ''
@@ -124,6 +123,10 @@ results_formatter_object = None
results_formatter_options = None
test_result = None
+# Reproducers
+capture_path = None
+replay_path = None
+
# Test rerun configuration vars
rerun_all_issues = False
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index cc28ae9..65b63b4 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -854,3 +854,11 @@ def skipIfAsan(func):
return "ASAN unsupported"
return None
return skipTestIfFn(is_asan)(func)
+
+def skipIfReproducer(func):
+ """Skip this test if the environment is set up to run LLDB with reproducers."""
+ def is_reproducer():
+ if configuration.capture_path or configuration.replay_path:
+ return "reproducers unsupported"
+ return None
+ return skipTestIfFn(is_reproducer)(func)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 31c617c..b5666ec 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -429,6 +429,17 @@ def parseOptionsAndInitTestdirs():
configuration.results_formatter_name = (
"lldbsuite.test_event.formatter.results_formatter.ResultsFormatter")
+ # Reproducer arguments
+ if args.capture_path and args.replay_path:
+ logging.error('Cannot specify both a capture and a replay path.')
+ sys.exit(-1)
+
+ if args.capture_path:
+ configuration.capture_path = args.capture_path
+
+ if args.replay_path:
+ configuration.replay_path = args.replay_path
+
# rerun-related arguments
configuration.rerun_all_issues = args.rerun_all_issues
@@ -955,8 +966,19 @@ def run_suite():
setupSysPath()
import lldbconfig
+ if configuration.capture_path or configuration.replay_path:
+ lldbconfig.INITIALIZE = False
import lldb
+ if configuration.capture_path:
+ lldb.SBReproducer.Capture(configuration.capture_path)
+ lldb.SBReproducer.SetAutoGenerate(True)
+ elif configuration.replay_path:
+ lldb.SBReproducer.PassiveReplay(configuration.replay_path)
+
+ if not lldbconfig.INITIALIZE:
+ lldb.SBDebugger.Initialize()
+
# Use host platform by default.
lldb.selected_platform = lldb.SBPlatform.GetHostPlatform()
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 385f65f..ad9508d 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -196,6 +196,17 @@ def create_parser():
metavar='platform-working-dir',
help='The directory to use on the remote platform.')
+ # Reproducer options
+ group = parser.add_argument_group('Reproducer options')
+ group.add_argument(
+ '--capture-path',
+ metavar='reproducer path',
+ help='The reproducer capture path')
+ group.add_argument(
+ '--replay-path',
+ metavar='reproducer path',
+ help='The reproducer replay path')
+
# Test-suite behaviour
group = parser.add_argument_group('Runtime behaviour options')
X('-d', 'Suspend the process after launch to wait indefinitely for a debugger to attach')