This is an archive of the discontinued LLVM Phabricator instance.

[lldb][test] Add check for Xcode binutils version to test-runner
Needs ReviewPublic

Authored by Michael137 on Feb 12 2023, 2:29 AM.

Details

Summary

Some tests in LLDB require the use of binutils tools. On Darwin,
we need to use the tools that ship with Xcode. Otherwise we risk
crashing in unpredictable ways.

This patch adds a check for this and bails early if the user has
a non-Xcode binutils in their path before the Xcode ones.

Diff Detail

Event Timeline

Michael137 created this revision.Feb 12 2023, 2:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 2:29 AM
Michael137 requested review of this revision.Feb 12 2023, 2:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 12 2023, 2:29 AM
tschuett added inline comments.
lldb/packages/Python/lldbsuite/test/dotest.py
889

Did you mean xcrun -f strip?

Michael137 added inline comments.Feb 12 2023, 2:37 AM
lldb/packages/Python/lldbsuite/test/dotest.py
889

yup! good catch

Michael137 added a comment.EditedFeb 12 2023, 5:13 AM

My preference would be to check explicitly whether the tool is from the xcode toolchain. But the tools dont really have a distinguishable version (in fact the strip from Xcode doesnt have a version commandline flag. Perhaps that’s deliberate and a good way to disambiguate homebrew vs xcode?)

Another option would be to check that homebrew/binutils only appears after xcode in the user path

Should we put something like

#if DARWIN
STRIP=$(shell xcrun -find strip)
#else
STRIP=strip
#fi

in Makefile.rules instead?

lldb/packages/Python/lldbsuite/test/dotest.py
889

I would use xcrun -find strip for more clarity