Skip to content

Commit 5960dff

Browse files
committed
Toolchains: Fix tests
`ld64` targeting macOS uses `-v` instead of `--version`, sadly. But if either passes, we're satisfied.
1 parent 9d37f2c commit 5960dff

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

BinaryBuilderToolchains.jl/src/toolchains/HostToolsToolchain.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function toolchain_sources(toolchain::HostToolsToolchain)
227227
end
228228
if any(jll.package.name == "Vim_jll" for jll in toolchain.deps)
229229
# Teach `vim` how to find `defaults.vim`
230-
for name in ("vim", "vimdiff", "vimtutor")
230+
for name in ("vim", "vimdiff")
231231
compiler_wrapper(joinpath(out_dir, name), "$(toolchain_prefix)/bin/$(name)") do io
232232
println(io, """
233233
# Ensure vim tools can find their data files

BinaryBuilderToolchains.jl/test/CToolchainTests.jl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using BinaryBuilderToolchains: path_appending_merge
55
const verbose = false
66

77
using BinaryBuilderToolchains: get_vendor
8+
const htt_toolchain = HostToolsToolchain(BBHostPlatform())
89
@testset "CToolchain" begin
910
# Use native compilers so that we can run the output.
1011
platform = CrossPlatform(BBHostPlatform() => HostPlatform())
@@ -29,7 +30,7 @@ using BinaryBuilderToolchains: get_vendor
2930
# Download the toolchain, make sure it runs
3031
println()
3132
@info("CToolchain tests", use_ccache, config...)
32-
with_toolchains([toolchain, HostToolsToolchain(BBHostPlatform())]) do prefix, env
33+
with_toolchains([toolchain, htt_toolchain]) do prefix, env
3334
env["CCACHE_DIR"] = ccache_dir
3435
# We build with _all_ of the C++ stdlib choices here, so we need to ensure that
3536
# we have the appropriate libraries on our `LD_LIBRARY_PATH` for testing, so
@@ -45,14 +46,14 @@ using BinaryBuilderToolchains: get_vendor
4546
# Do the same, but with `GCCBootstrap`
4647
toolchain = CToolchain(platform; vendor=:gcc_bootstrap, use_ccache=false)
4748
@info("CToolchain tests", vendor=:gcc_bootstrap, use_ccache=false)
48-
with_toolchains([toolchain]) do prefix, env
49+
with_toolchains([toolchain, htt_toolchain]) do prefix, env
4950
toolchain_tests(prefix, env, platform, "CToolchain"; do_cxxabi_tests=true)
5051
end
5152

5253
# Do the same again, but with `LLVMBootstrap_Clang`
5354
toolchain = CToolchain(platform; vendor=:clang_bootstrap, use_ccache=false)
5455
@info("CToolchain tests", vendor=:clang_bootstrap, use_ccache=false)
55-
with_toolchains([toolchain]) do prefix, env
56+
with_toolchains([toolchain, htt_toolchain]) do prefix, env
5657
toolchain_tests(prefix, env, platform, "CToolchain"; do_cxxabi_tests=true)
5758
end
5859

@@ -83,15 +84,12 @@ using BinaryBuilderToolchains: get_vendor
8384
use_ccache=false,
8485
)
8586

86-
# We'll need things like `make` etc...
87-
hosttools_toolchain = HostToolsToolchain(platform)
88-
8987
# Use each toolchain to build a `libfoo` with a different version embedded within:
9088
host_version = 1
9189
target_version = 2
9290
for (toolchains, install_prefix, cc, libfoo_version) in (
93-
([host_ctoolchain, hosttools_toolchain], host_prefix, "\${HOST_CC}", host_version),
94-
([target_ctoolchain, hosttools_toolchain], target_prefix, "\${CC}", target_version))
91+
([host_ctoolchain, htt_toolchain], host_prefix, "\${HOST_CC}", host_version),
92+
([target_ctoolchain, htt_toolchain], target_prefix, "\${CC}", target_version))
9593
with_toolchains(toolchains) do prefix, env
9694
cd(joinpath(@__DIR__, "testsuite", "CToolchainHostIsolation", "libfoo")) do
9795
@test success(setenv(Cmd(["/bin/bash", "-c", "make install CC=$(cc) prefix=$(install_prefix) VERSION=$(libfoo_version)"]), env))
@@ -105,7 +103,7 @@ using BinaryBuilderToolchains: get_vendor
105103

106104
# Next, within a single shell with _both_ toolchains installed, verify that the
107105
# include path searched by the preprocessor and linker is correct:
108-
with_toolchains([host_ctoolchain, hosttools_toolchain]) do _, host_env
106+
with_toolchains([host_ctoolchain, htt_toolchain]) do _, host_env
109107
with_toolchains([target_ctoolchain]) do _, target_env
110108
env = path_appending_merge(host_env, target_env)
111109
cd(joinpath(@__DIR__, "testsuite", "CToolchainHostIsolation")) do
@@ -139,12 +137,12 @@ using BinaryBuilderToolchains: get_vendor
139137
target_platform = CrossPlatform(BBHostPlatform() => target)
140138
for vendor in (:auto, :gcc, :clang, :gcc_bootstrap, :clang_bootstrap)
141139
toolchain = CToolchain(target_platform; vendor, use_ccache=false)
142-
with_toolchains([toolchain, HostToolsToolchain(target_platform)]) do prefix, env
140+
with_toolchains([toolchain, htt_toolchain]) do prefix, env
143141
@testset "$(triplet(target)) - $(vendor)" begin
144142
# First, run `$CC --version` for everything
145143
for tool_name in ("CC", "LD", "AS")
146144
@testset "$(tool_name)" begin
147-
p, output = capture_output(setenv(`bash -c "\$$(tool_name) --version"`, env))
145+
p, output = capture_output(setenv(`bash -c "\$$(tool_name) --version || \$$(tool_name) -v"`, env))
148146
if !success(p)
149147
println(output)
150148
end
@@ -167,7 +165,7 @@ using BinaryBuilderToolchains: get_vendor
167165

168166
# Ensure that `strip` works for macOS without needing to resign
169167
macos_cp = CrossPlatform(BBHostPlatform() => Platform("aarch64", "macos"))
170-
toolchains = [HostToolsToolchain(macos_cp), CToolchain(macos_cp)]
168+
toolchains = [CToolchain(macos_cp), htt_toolchain]
171169
with_toolchains(toolchains) do prefix, env
172170
cd(joinpath(@__DIR__, "testsuite", "CToolchain", "08_strip_resigning")) do
173171
@test success(setenv(Cmd(["/bin/bash", "-c", "make clean; make check"]), env))

0 commit comments

Comments
 (0)