This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix test TestBSDArchives.py properly
ClosedPublic

Authored by kusmour on Jul 28 2023, 11:54 AM.

Details

Summary

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

Diff Detail

Event Timeline

kusmour created this revision.Jul 28 2023, 11:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2023, 11:54 AM
kusmour requested review of this revision.Jul 28 2023, 11:54 AM
bulbazord accepted this revision.Jul 31 2023, 10:28 AM

Makes sense to me. Thanks for looking into this!

This revision is now accepted and ready to land.Jul 31 2023, 10:28 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2023, 1:39 PM