44
55from lldbsuite .test .decorators import *
66from lldbsuite .test .lldbtest import *
7+ import json
78import os
89import time
910
@@ -18,7 +19,6 @@ def test_output(self):
1819 progress_emitter = os .path .join (os .getcwd (), "Progress_emitter.py" )
1920 print (f"Progress emitter path: { progress_emitter } " )
2021 source = "main.cpp"
21- # Set breakpoint in the thread function so we can step the threads
2222 breakpoint_ids = self .set_source_breakpoints (
2323 source , [line_number (source , "// break here" )]
2424 )
@@ -52,3 +52,128 @@ def test_output(self):
5252
5353 self .assertTrue (start_found )
5454 self .assertTrue (update_found )
55+
56+ @skipIfWindows
57+ def test_output_nodetails (self ):
58+ program = self .getBuildArtifact ("a.out" )
59+ self .build_and_launch (program )
60+ progress_emitter = os .path .join (os .getcwd (), "Progress_emitter.py" )
61+ print (f"Progress emitter path: { progress_emitter } " )
62+ source = "main.cpp"
63+ breakpoint_ids = self .set_source_breakpoints (
64+ source , [line_number (source , "// break here" )]
65+ )
66+ self .continue_to_breakpoints (breakpoint_ids )
67+ self .dap_server .request_evaluate (
68+ f"`command script import { progress_emitter } " , context = "repl"
69+ )
70+ self .dap_server .request_evaluate (
71+ "`test-progress --total 3 --seconds 1 --no-details" , context = "repl"
72+ )
73+
74+ self .dap_server .wait_for_event ("progressEnd" , 15 )
75+ # Expect at least a start, an update, and end event
76+ # However because the underlying Progress instance is an RAII object and we can't guaruntee
77+ # it's deterministic destruction in the python API, we verify just start and update
78+ # otherwise this test could be flakey.
79+ self .assertTrue (len (self .dap_server .progress_events ) > 0 )
80+ start_found = False
81+ update_found = False
82+ for event in self .dap_server .progress_events :
83+ event_type = event ["event" ]
84+ if "progressStart" in event_type :
85+ title = event ["body" ]["title" ]
86+ self .assertIn ("Progress tester" , title )
87+ start_found = True
88+ if "progressUpdate" in event_type :
89+ message = event ["body" ]["message" ]
90+ # We send an update on first message to set the details, so ignore the first update
91+ if not update_found :
92+ self .assertTrue (message == "" , message )
93+ update_found = True
94+
95+ self .assertTrue (start_found )
96+ self .assertTrue (update_found )
97+
98+ @skipIfWindows
99+ def test_output_indeterminate (self ):
100+ program = self .getBuildArtifact ("a.out" )
101+ self .build_and_launch (program )
102+ progress_emitter = os .path .join (os .getcwd (), "Progress_emitter.py" )
103+ print (f"Progress emitter path: { progress_emitter } " )
104+ source = "main.cpp"
105+ breakpoint_ids = self .set_source_breakpoints (
106+ source , [line_number (source , "// break here" )]
107+ )
108+ self .continue_to_breakpoints (breakpoint_ids )
109+ self .dap_server .request_evaluate (
110+ f"`command script import { progress_emitter } " , context = "repl"
111+ )
112+ self .dap_server .request_evaluate (
113+ "`test-progress --total -1 --seconds 1" , context = "repl"
114+ )
115+
116+ self .dap_server .wait_for_event ("progressEnd" , 15 )
117+ # Expect at least a start, an update, and end event
118+ # However because the underlying Progress instance is an RAII object and we can't guaruntee
119+ # it's deterministic destruction in the python API, we verify just start and update
120+ # otherwise this test could be flakey.
121+ self .assertTrue (len (self .dap_server .progress_events ) > 0 )
122+ start_found = False
123+ update_found = False
124+ for event in self .dap_server .progress_events :
125+ event_type = event ["event" ]
126+ if "progressStart" in event_type :
127+ title = event ["body" ]["title" ]
128+ self .assertIn ("Progress tester" , title )
129+ start_found = True
130+ if "progressUpdate" in event_type :
131+ message = event ["body" ]["message" ]
132+ print (f"Progress update: { message } " )
133+ self .assertNotIn ("Progres tester" , message )
134+ update_found = True
135+
136+ self .assertTrue (start_found )
137+ self .assertTrue (update_found )
138+
139+ @skipIfWindows
140+ def test_output_nodetails_indeterminate (self ):
141+ program = self .getBuildArtifact ("a.out" )
142+ self .build_and_launch (program )
143+ progress_emitter = os .path .join (os .getcwd (), "Progress_emitter.py" )
144+ print (f"Progress emitter path: { progress_emitter } " )
145+ source = "main.cpp"
146+ breakpoint_ids = self .set_source_breakpoints (
147+ source , [line_number (source , "// break here" )]
148+ )
149+ self .dap_server .request_evaluate (
150+ f"`command script import { progress_emitter } " , context = "repl"
151+ )
152+
153+ self .dap_server .request_evaluate (
154+ "`test-progress --total -1 --seconds 1 --no-details" , context = "repl"
155+ )
156+
157+ self .dap_server .wait_for_event ("progressEnd" , 15 )
158+ # Expect at least a start, an update, and end event
159+ # However because the underlying Progress instance is an RAII object and we can't guaruntee
160+ # it's deterministic destruction in the python API, we verify just start and update
161+ # otherwise this test could be flakey.
162+ self .assertTrue (len (self .dap_server .progress_events ) > 0 )
163+ start_found = False
164+ update_found = False
165+ for event in self .dap_server .progress_events :
166+ event_type = event ["event" ]
167+ if "progressStart" in event_type :
168+ title = event ["body" ]["title" ]
169+ self .assertIn ("Progress tester" , title )
170+ start_found = True
171+ if "progressUpdate" in event_type :
172+ message = event ["body" ]["message" ]
173+ # We send an update on first message to set the details, so ignore the first update
174+ if not update_found :
175+ self .assertTrue (message == "" , message )
176+ update_found = True
177+
178+ self .assertTrue (start_found )
179+ self .assertTrue (update_found )
0 commit comments