Add a sanity check for inline testcases.
When writing an inline test, there is no way to make sure that any of the inline commands are actually executed, so this patch adds a sanity check that at least one breakpoint was hit. This avoids a test with no breakpoints being hit passing. Differential Revision: https://reviews.llvm.org/D43694 llvm-svn: 326140
This commit is contained in:
parent
6ebb0792b0
commit
87a000dae3
|
@ -21,4 +21,5 @@ void test1(int a) {
|
||||||
int main() {
|
int main() {
|
||||||
test2(42);
|
test2(42);
|
||||||
test1(23);
|
test1(23);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,14 +182,23 @@ class InlineTest(TestBase):
|
||||||
parser.set_breakpoints(target)
|
parser.set_breakpoints(target)
|
||||||
|
|
||||||
process = target.LaunchSimple(None, None, self.getBuildDir())
|
process = target.LaunchSimple(None, None, self.getBuildDir())
|
||||||
|
hit_breakpoints = 0
|
||||||
|
|
||||||
while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
|
while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
|
||||||
|
hit_breakpoints += 1
|
||||||
thread = lldbutil.get_stopped_thread(
|
thread = lldbutil.get_stopped_thread(
|
||||||
process, lldb.eStopReasonBreakpoint)
|
process, lldb.eStopReasonBreakpoint)
|
||||||
breakpoint_id = thread.GetStopReasonDataAtIndex(0)
|
breakpoint_id = thread.GetStopReasonDataAtIndex(0)
|
||||||
parser.handle_breakpoint(self, breakpoint_id)
|
parser.handle_breakpoint(self, breakpoint_id)
|
||||||
process.Continue()
|
process.Continue()
|
||||||
|
|
||||||
|
self.assertTrue(hit_breakpoints > 0,
|
||||||
|
"inline test did not hit a single breakpoint")
|
||||||
|
# Either the process exited or the stepping plan is complete.
|
||||||
|
self.assertTrue(process.GetState() in [lldb.eStateStopped,
|
||||||
|
lldb.eStateExited],
|
||||||
|
PROCESS_EXITED)
|
||||||
|
|
||||||
# Utilities for testcases
|
# Utilities for testcases
|
||||||
|
|
||||||
def check_expression(self, expression, expected_result, use_summary=True):
|
def check_expression(self, expression, expected_result, use_summary=True):
|
||||||
|
|
Loading…
Reference in New Issue