From 2709d8eabe38cc3bee835495b689ce2251bf0b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Tue, 6 Aug 2024 20:08:45 +0200 Subject: [PATCH] Always set `JULIA_BINDIR` when running `mpiexecjl` tests --- test/mpiexecjl.jl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/mpiexecjl.jl b/test/mpiexecjl.jl index 4d40bef18..3ee397bba 100644 --- a/test/mpiexecjl.jl +++ b/test/mpiexecjl.jl @@ -15,20 +15,16 @@ using MPI # Test a run of mpiexec nprocs_str = get(ENV, "JULIA_MPI_TEST_NPROCS", "") nprocs = nprocs_str == "" ? clamp(Sys.CPU_THREADS, 2, 4) : parse(Int, nprocs_str) - mpiexecjl = joinpath(dir, "mpiexecjl") + env = ["JULIA_BINDIR" => Sys.BINDIR] + mpiexecjl = addenv(`$(joinpath(dir, "mpiexecjl"))`, env...) # `Base.julia_cmd()` ensures keeping consistent flags when running subprocesses. julia = Base.julia_cmd() example = joinpath(@__DIR__, "..", "docs", "examples", "01-hello.jl") - env = ["JULIA_BINDIR" => Sys.BINDIR] - p = withenv(env...) do - run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -q $(example)`) - end + p = run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -q $(example)`) @test success(p) # Test help messages for help_flag in ("-h", "--help") - help_message = withenv(env...) do - read(`$(mpiexecjl) --project=$(dir) --help`, String) - end + help_message = read(`$(mpiexecjl) --project=$(dir) --help`, String) @test occursin(r"Usage:.*MPIEXEC_ARGUMENTS", help_message) end # Without arguments, or only with the `--project` option, the wrapper will fail