[Lldb-commits] [PATCH] D43694: Add a sanity check for inline tests

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 23 14:00:14 PST 2018


aprantl created this revision.
aprantl added reviewers: vsk, labath, jingham.
Herald added a subscriber: eraman.

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.


https://reviews.llvm.org/D43694

Files:
  packages/Python/lldbsuite/test/lldbinline.py


Index: packages/Python/lldbsuite/test/lldbinline.py
===================================================================
--- packages/Python/lldbsuite/test/lldbinline.py
+++ packages/Python/lldbsuite/test/lldbinline.py
@@ -182,14 +182,20 @@
         parser.set_breakpoints(target)
 
         process = target.LaunchSimple(None, None, self.getBuildDir())
+        hit_breakpoints = 0
 
         while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
+            hit_breakpoints += 1
             thread = lldbutil.get_stopped_thread(
                 process, lldb.eStopReasonBreakpoint)
             breakpoint_id = thread.GetStopReasonDataAtIndex(0)
             parser.handle_breakpoint(self, breakpoint_id)
             process.Continue()
 
+        self.assertTrue(hit_breakpoints > 0,
+                        "inline test did not hit a single breakpoint")
+        
+
     # Utilities for testcases
 
     def check_expression(self, expression, expected_result, use_summary=True):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43694.135693.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180223/52319860/attachment.bin>


More information about the lldb-commits mailing list