[Lldb-commits] [lldb] ca76281 - [lldb] Fix test TestBSDArchives.py properly
Wanyi Ye via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 1 13:39:40 PDT 2023
Author: Wanyi Ye
Date: 2023-08-01T16:38:58-04:00
New Revision: ca76281917d0d5aa40472d237584fd983a19d246
URL: https://github.com/llvm/llvm-project/commit/ca76281917d0d5aa40472d237584fd983a19d246
DIFF: https://github.com/llvm/llvm-project/commit/ca76281917d0d5aa40472d237584fd983a19d246.diff
LOG: [lldb] Fix test TestBSDArchives.py properly
The previous patch D156367 introduced a test debugging thin archive with one of the linked object file missing. It actually failed on green dragon build bots. I put up a speculative fix (https://github.com/llvm/llvm-project/commit/4520cc066b2ffe5ac261e3aca887cba3f113b1ff) that only fixed the symptom of it.
The actual root cause was that the timestamps were set to 0 when creating the thin archive
Makefile command
```
llvm-ar -rcsDT libfoo-thin.a a.o b.o
```
Where the flag "[D] - use zero for timestamps and uids/gids (default)" according to the llvm-ar help
Use "[U] - use actual timestamps and uids/gids" fixed the timestamp
Now the test is actually getting error from missing object file linked to the thin archive instead of the mismatched timestamp.
This means removing one of the object file a.o should only result in failure breaking at `a()`; breaking at `b()` should work just fine.
Test Plan:
All 4 test cases passed
```
▶ ./bin/llvm-lit -vv ../llvm-project/lldb/test/API/functionalities/archives/TestBSDArchives.py
llvm-lit: /Users/wanyi/local/llvm-project/lldb/test/API/lit.cfg.py:173: warning: Could not set a default per-test timeout. Requires the Python psutil module but it could not be found. Try installing it via pip or via your operating system's package manager.
-- Testing: 1 tests, 1 workers --
PASS: lldb-api :: functionalities/archives/TestBSDArchives.py (1 of 1)
Testing Time: 8.07s
Passed: 1
1 warning(s) in tests
```
Differential Revision: https://reviews.llvm.org/D156564
Added:
Modified:
lldb/test/API/functionalities/archives/Makefile
lldb/test/API/functionalities/archives/TestBSDArchives.py
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/archives/Makefile b/lldb/test/API/functionalities/archives/Makefile
index 22cec82538bf42..c4c593e6db0519 100644
--- a/lldb/test/API/functionalities/archives/Makefile
+++ b/lldb/test/API/functionalities/archives/Makefile
@@ -18,7 +18,7 @@ libbar.a: c.o
libfoo-thin.a: a.o b.o
$(eval LLVM_AR := $(LLVM_TOOLS_DIR)/llvm-ar)
- $(eval LLVM_ARFLAGS := -rcsDT)
+ $(eval LLVM_ARFLAGS := -rcsUT)
$(LLVM_AR) $(LLVM_ARFLAGS) $@ $^
include Makefile.rules
diff --git a/lldb/test/API/functionalities/archives/TestBSDArchives.py b/lldb/test/API/functionalities/archives/TestBSDArchives.py
index 22394762847d5f..b196ad8a7793ec 100644
--- a/lldb/test/API/functionalities/archives/TestBSDArchives.py
+++ b/lldb/test/API/functionalities/archives/TestBSDArchives.py
@@ -167,6 +167,20 @@ def test_frame_var_errors_when_thin_archive_malformed(self):
") of the .o file doesn't match",
]
self.check_frame_variable_errors(thread, error_strings)
+
+ # Break at b() should succeed
+ (target, process, thread, bkpt) = lldbutil.run_to_name_breakpoint(
+ self, "b", bkpt_module=exe
+ )
+ self.expect(
+ "thread list",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=["stopped", "stop reason = breakpoint"],
+ )
+ self.expect(
+ "frame variable", VARIABLES_DISPLAYED_CORRECTLY, substrs=["(int) arg = 2"]
+ )
+
@skipIfRemote
@skipUnlessDarwin
More information about the lldb-commits
mailing list