From 25727a458ce42292d73af5c692d6e12d06500e68 Mon Sep 17 00:00:00 2001 From: Adrian McCarthy Date: Wed, 21 Feb 2018 18:08:23 +0000 Subject: [PATCH] Fix TestBreakpointInGlobalConstructor for Windows Summary: This test was failing on Windows because it expected the breakpoint in the dynamic library to be resolved before the process is launched. Since the DLL isn't loaded until the process is launched this didn't work. The fix creates a special value (-2) for num_expected_locations that ignores the actual number of breakpoint locations found. Reviewers: jasonmolenda Subscribers: sanjoy, lldb-commits Differential Revision: https://reviews.llvm.org/D43419 llvm-svn: 325704 --- .../global_constructor/TestBreakpointInGlobalConstructor.py | 3 ++- lldb/packages/Python/lldbsuite/test/lldbutil.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py index 5f0e7a058a41..9551ab278ebf 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py @@ -29,8 +29,9 @@ class TestBreakpointInGlobalConstructors(TestBase): bp_main = lldbutil.run_break_set_by_file_and_line( self, 'main.cpp', self.line_main) + bp_foo = lldbutil.run_break_set_by_file_and_line( - self, 'foo.cpp', self.line_foo) + self, 'foo.cpp', self.line_foo, num_expected_locations=-2) process = target.LaunchSimple( None, env, self.get_process_working_directory()) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 047a98b5daed..faa1c83757e1 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -343,7 +343,8 @@ def run_break_set_by_file_and_line( If extra_options is not None, then we append it to the breakpoint set command. - If num_expected_locations is -1 we check that we got AT LEAST one location, otherwise we check that num_expected_locations equals the number of locations. + If num_expected_locations is -1, we check that we got AT LEAST one location. If num_expected_locations is -2, we don't + check the actual number at all. Otherwise, we check that num_expected_locations equals the number of locations. If loc_exact is true, we check that there is one location, and that location must be at the input file and line number.""" @@ -563,7 +564,7 @@ def check_breakpoint_result( if num_locations == -1: test.assertTrue(out_num_locations > 0, "Expecting one or more locations, got none.") - else: + elif num_locations != -2: test.assertTrue( num_locations == out_num_locations, "Expecting %d locations, got %d." %