Skip to content

Commit 2c14fec

Browse files
committed
[Runner] Generate CSL paths only for target and host platforms
Having all Intel Linux platforms in the CSL paths was a mess hard to deal with. The simplest thing to do is to generate the paths only for target and host, and sort them correctly: if they have same architecture, have the host first, if the have different architectures, have the target first.
1 parent bc7c7ca commit 2c14fec

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

src/Runner.jl

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -895,22 +895,14 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
895895
end
896896
end
897897

898-
function csl_paths(p::AbstractPlatform)
899-
libcs = if Sys.islinux(p) && proc_family(p) == "intel" && libc(p) == "musl"
900-
# We need to push musl directories before glibc ones
901-
("musl", "glibc")
902-
else
903-
("glibc", "musl")
904-
end
905-
906-
archs = if Sys.islinux(p) && proc_family(p) == "intel" && arch(p) == "i686"
907-
# We need to push i686 directories before x86_64 ones
908-
("i686", "x86_64")
909-
else
910-
("x86_64", "i686")
911-
end
912-
913-
return join(["/usr/lib/csl-$(libc)-$(arch)" for libc in libcs, arch in archs], ":")
898+
# Generate CSL paths for target and host platforms, but only if these are platforms for
899+
# which we can run executables, i.e. Intel penguins.
900+
function csl_paths(target::AbstractPlatform, host::AbstractPlatform)
901+
# Ok, this is incredibly finicky: if the target has the same architecture as the
902+
# host, we should have the host first then the target, otherwise we need to have
903+
# target first.
904+
platforms = arch(target) == arch(host) ? (host, target) : (target, host)
905+
return join(unique("/usr/lib/csl-$(libc(p))-$(arch(p))" for p in platforms if Sys.islinux(p) && proc_family(p) == "intel"), ":")
914906
end
915907

916908
merge!(mapping, Dict(
@@ -931,8 +923,8 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString;
931923
), ":"),
932924

933925
"LD_LIBRARY_PATH" => join((
934-
# Start with our CSL libraries for all architectures that can natively run within this environment
935-
csl_paths(host_platform),
926+
# Start with our CSL libraries for target/host, but only for architectures that can natively run within this environment
927+
csl_paths(platform, host_platform),
936928
# Then add default system paths
937929
"/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib",
938930
# Add our loader directories

test/runners.jl

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,10 @@ end
169169
./test
170170
"""
171171
cmd = `/bin/bash -c "$(test_script)"`
172-
if arch(platform) == "i686" && libc(platform) == "musl"
173-
# We can't run this program for this platform
174-
@test_broken run(ur, cmd, iobuff; tee_stream=devnull)
175-
else
176-
@test run(ur, cmd, iobuff; tee_stream=devnull)
177-
seekstart(iobuff)
178-
# Test that we get the output we expect
179-
@test endswith(readchomp(iobuff), "Hello World!")
180-
end
172+
@test run(ur, cmd, iobuff; tee_stream=devnull)
173+
seekstart(iobuff)
174+
# Test that we get the output we expect
175+
@test endswith(readchomp(iobuff), "Hello World!")
181176
cleanup_dependencies(prefix, artifact_paths, concrete_platform)
182177
end
183178
end
@@ -223,15 +218,10 @@ end
223218
./test
224219
"""
225220
cmd = `/bin/bash -c "$(test_script)"`
226-
if arch(platform) == "i686" && libc(platform) == "musl"
227-
# We can't run C++ programs for this platform
228-
@test_broken run(ur, cmd, iobuff; tee_stream=devnull)
229-
else
230-
@test run(ur, cmd, iobuff; tee_stream=devnull)
231-
seekstart(iobuff)
232-
# Test that we get the output we expect
233-
@test endswith(readchomp(iobuff), "Hello World!")
234-
end
221+
@test run(ur, cmd, iobuff; tee_stream=devnull)
222+
seekstart(iobuff)
223+
# Test that we get the output we expect
224+
@test endswith(readchomp(iobuff), "Hello World!")
235225
cleanup_dependencies(prefix, artifact_paths, concrete_platform)
236226
end
237227
end

0 commit comments

Comments
 (0)