Skip to content

Cleanup playgrounds test driver #3923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 7 additions & 27 deletions lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,16 @@ def execute_command(self, command):

def setUp(self):
TestBase.setUp(self)
self.PlaygroundStub_source = "PlaygroundStub.swift"
self.PlaygroundStub_source_spec = lldb.SBFileSpec(
self.PlaygroundStub_source)

def repl_set_up(self):
"""
Playgrounds REPL test specific setup that must happen after class setup
"""
exe_name = "PlaygroundStub"
exe = self.getBuildArtifact(exe_name)
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, 'Set breakpoint here', lldb.SBFileSpec('PlaygroundStub.swift'),
exe_name='PlaygroundStub', extra_images=['libPlaygroundsRuntime.dylib'])

# Create the target
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)

self.registerSharedLibrariesWithTarget(target, ['libPlaygroundsRuntime.dylib'])

# Set the breakpoints
breakpoint = target.BreakpointCreateBySourceRegex(
'Set breakpoint here', self.PlaygroundStub_source_spec)
self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)

process = target.LaunchSimple(None, None, self.getBuildDir())
self.assertTrue(process, PROCESS_IS_VALID)

threads = lldbutil.get_threads_stopped_at_breakpoint(
process, breakpoint)

self.assertTrue(len(threads) == 1)
self.thread = threads[0]
self.frame = self.thread.frames[0]
self.frame = thread.frames[0]
self.assertTrue(self.frame, "Frame 0 is valid.")

# Configure lldb
Expand Down Expand Up @@ -100,9 +79,10 @@ def execute_code(self, inputFile):
contents = contents_file.read()

result = self.frame.EvaluateExpression(contents, self.options)
ouput = self.frame.EvaluateExpression("get_output()")
output = self.frame.EvaluateExpression("get_output()")
self.assertSuccess(output.GetError())

return result, ouput
return result, output

def is_compile_or_runtime_error(self, result):
"""
Expand Down