Skip to content

Commit 62b1d01

Browse files
committed
Cleanup playgrounds test driver
1 parent a40de57 commit 62b1d01

File tree

1 file changed

+7
-27
lines changed

1 file changed

+7
-27
lines changed

lldb/packages/Python/lldbsuite/test/lldbplaygroundrepl.py

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,16 @@ def execute_command(self, command):
3939

4040
def setUp(self):
4141
TestBase.setUp(self)
42-
self.PlaygroundStub_source = "PlaygroundStub.swift"
43-
self.PlaygroundStub_source_spec = lldb.SBFileSpec(
44-
self.PlaygroundStub_source)
4542

4643
def repl_set_up(self):
4744
"""
4845
Playgrounds REPL test specific setup that must happen after class setup
4946
"""
50-
exe_name = "PlaygroundStub"
51-
exe = self.getBuildArtifact(exe_name)
47+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
48+
self, 'Set breakpoint here', lldb.SBFileSpec('PlaygroundStub.swift'),
49+
exe_name='PlaygroundStub', extra_images=['libPlaygroundsRuntime.dylib'])
5250

53-
# Create the target
54-
target = self.dbg.CreateTarget(exe)
55-
self.assertTrue(target, VALID_TARGET)
56-
57-
self.registerSharedLibrariesWithTarget(target, ['libPlaygroundsRuntime.dylib'])
58-
59-
# Set the breakpoints
60-
breakpoint = target.BreakpointCreateBySourceRegex(
61-
'Set breakpoint here', self.PlaygroundStub_source_spec)
62-
self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
63-
64-
process = target.LaunchSimple(None, None, self.getBuildDir())
65-
self.assertTrue(process, PROCESS_IS_VALID)
66-
67-
threads = lldbutil.get_threads_stopped_at_breakpoint(
68-
process, breakpoint)
69-
70-
self.assertTrue(len(threads) == 1)
71-
self.thread = threads[0]
72-
self.frame = self.thread.frames[0]
51+
self.frame = thread.frames[0]
7352
self.assertTrue(self.frame, "Frame 0 is valid.")
7453

7554
# Configure lldb
@@ -100,9 +79,10 @@ def execute_code(self, inputFile):
10079
contents = contents_file.read()
10180

10281
result = self.frame.EvaluateExpression(contents, self.options)
103-
ouput = self.frame.EvaluateExpression("get_output()")
82+
output = self.frame.EvaluateExpression("get_output()")
83+
self.assertSuccess(output.GetError())
10484

105-
return result, ouput
85+
return result, output
10686

10787
def is_compile_or_runtime_error(self, result):
10888
"""

0 commit comments

Comments
 (0)