Skip to content

[lldb][test] Use tools from llvm instead of compiler tools #109961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lldb/packages/Python/lldbsuite/test/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def getToolchainSpec(self, compiler):
if not cc:
return []

exe_ext = ""
if lldbplatformutil.getHostPlatform() == "windows":
exe_ext = ".exe"

cc = cc.strip()
cc_path = pathlib.Path(cc)

Expand Down Expand Up @@ -149,9 +153,9 @@ def getToolchainSpec(self, compiler):
cc_dir = cc_path.parent

def getToolchainUtil(util_name):
return cc_dir / (cc_prefix + util_name + cc_ext)
return os.path.join(configuration.llvm_tools_dir, util_name + exe_ext)

cxx = getToolchainUtil(cxx_type)
cxx = cc_dir / (cc_prefix + cxx_type + cc_ext)

util_names = {
"OBJCOPY": "objcopy",
Expand All @@ -161,6 +165,10 @@ def getToolchainUtil(util_name):
}
utils = []

# Required by API TestBSDArchives.py tests.
if not os.getenv("LLVM_AR"):
utils.extend(["LLVM_AR=%s" % getToolchainUtil("llvm-ar")])

if not lldbplatformutil.platformIsDarwin():
if cc_type in ["clang", "cc", "gcc"]:
util_paths = {}
Expand Down
3 changes: 3 additions & 0 deletions lldb/packages/Python/lldbsuite/test/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
# same base name.
all_tests = set()

# Path to LLVM tools to be used by tests.
llvm_tools_dir = None

# LLDB library directory.
lldb_libs_dir = None
lldb_obj_root = None
Expand Down
1 change: 1 addition & 0 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def parseOptionsAndInitTestdirs():
"xcrun -find -toolchain default dsymutil"
)
if args.llvm_tools_dir:
configuration.llvm_tools_dir = args.llvm_tools_dir
configuration.filecheck = shutil.which("FileCheck", path=args.llvm_tools_dir)
configuration.yaml2obj = shutil.which("yaml2obj", path=args.llvm_tools_dir)

Expand Down
2 changes: 0 additions & 2 deletions lldb/test/API/functionalities/archives/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ libfoo.a: a.o b.o

# This tests whether lldb can load a thin archive
libbar.a: c.o
$(eval LLVM_AR := $(LLVM_TOOLS_DIR)/llvm-ar)
$(eval LLVM_ARFLAGS := -rcsDT)
$(LLVM_AR) $(LLVM_ARFLAGS) $@ $^

libfoo-thin.a: a.o b.o
$(eval LLVM_AR := $(LLVM_TOOLS_DIR)/llvm-ar)
$(eval LLVM_ARFLAGS := -rcsUT)
$(LLVM_AR) $(LLVM_ARFLAGS) $@ $^

Expand Down
Loading