[Lldb-commits] [lldb] Disable TestUseSourceCache on Windows (PR #97324)

Kendal Harland via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 1 10:22:09 PDT 2024


https://github.com/kendalharland created https://github.com/llvm/llvm-project/pull/97324

This test also fails on Windows amd64, although it is only disabled for aarch64.

>From 1d2c11e18e833104279fa6a005e4a64bb7be6216 Mon Sep 17 00:00:00 2001
From: kendal <kendal at thebrowser.company>
Date: Mon, 24 Jun 2024 13:42:20 -0700
Subject: [PATCH 1/2] Fix flake in TestZerothFrame.py

This test is relying on the order of `process.threads` which is
nondeterministic. By selecting the thread based on whether it is
stopped at our breakpoint we can reliably select the correct one.
---
 .../unwind/zeroth_frame/TestZerothFrame.py    | 23 ++++++++-----------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
index f4e883d314644..deb30669cc40e 100644
--- a/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
+++ b/lldb/test/API/functionalities/unwind/zeroth_frame/TestZerothFrame.py
@@ -40,28 +40,24 @@ def test(self):
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 
-        bp1_line = line_number("main.c", "// Set breakpoint 1 here")
-        bp2_line = line_number("main.c", "// Set breakpoint 2 here")
-
-        lldbutil.run_break_set_by_file_and_line(
-            self, "main.c", bp1_line, num_expected_locations=1
-        )
-        lldbutil.run_break_set_by_file_and_line(
-            self, "main.c", bp2_line, num_expected_locations=1
-        )
+        main_dot_c = lldb.SBFileSpec("main.c")
+        bp1 = target.BreakpointCreateBySourceRegex("// Set breakpoint 1 here", main_dot_c)
+        bp2 = target.BreakpointCreateBySourceRegex("// Set breakpoint 2 here", main_dot_c)
 
         process = target.LaunchSimple(None, None, self.get_process_working_directory())
         self.assertTrue(process, VALID_PROCESS)
 
-        thread = process.GetThreadAtIndex(0)
+        thread = self.thread()
+
         if self.TraceOn():
             print("Backtrace at the first breakpoint:")
             for f in thread.frames:
                 print(f)
+
         # Check that we have stopped at correct breakpoint.
         self.assertEqual(
-            process.GetThreadAtIndex(0).frame[0].GetLineEntry().GetLine(),
-            bp1_line,
+            thread.frame[0].GetLineEntry().GetLine(),
+            bp1.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
             "LLDB reported incorrect line number.",
         )
 
@@ -70,7 +66,6 @@ def test(self):
         # 'continue' command.
         process.Continue()
 
-        thread = process.GetThreadAtIndex(0)
         if self.TraceOn():
             print("Backtrace at the second breakpoint:")
             for f in thread.frames:
@@ -78,7 +73,7 @@ def test(self):
         # Check that we have stopped at the breakpoint
         self.assertEqual(
             thread.frame[0].GetLineEntry().GetLine(),
-            bp2_line,
+            bp2.GetLocationAtIndex(0).GetAddress().GetLineEntry().GetLine(),
             "LLDB reported incorrect line number.",
         )
         # Double-check with GetPCAddress()

>From e0c2a42a215948a9f77524cc101e76d7c0eddb56 Mon Sep 17 00:00:00 2001
From: kendal <kendal at thebrowser.company>
Date: Mon, 1 Jul 2024 10:20:08 -0700
Subject: [PATCH 2/2] Disable TestUseSourceCache on Windows amd64

This test also fails on Windows amd64, although it is only
disabled for aarch64.
---
 .../commands/settings/use_source_cache/TestUseSourceCache.py    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
index c54345af4994c..421599080a9e5 100644
--- a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
+++ b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
@@ -18,7 +18,7 @@ def test_set_use_source_cache_false(self):
         self.set_use_source_cache_and_test(False)
 
     @skipIf(hostoslist=no_match(["windows"]))
-    @skipIf(oslist=["windows"], archs=["aarch64"])  # Fails on windows 11
+    @skipIf(oslist=["windows"])  # Fails on windows 11
     def test_set_use_source_cache_true(self):
         """Test that after 'set use-source-cache false', files are locked."""
         self.set_use_source_cache_and_test(True)



More information about the lldb-commits mailing list