Skip to content

Commit 1872411

Browse files
authored
Always set JULIA_BINDIR when running mpiexecjl tests (#858)
1 parent 6a1b182 commit 1872411

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

test/mpiexecjl.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,21 @@ using MPI
1515
# Test a run of mpiexec
1616
nprocs_str = get(ENV, "JULIA_MPI_TEST_NPROCS", "")
1717
nprocs = nprocs_str == "" ? clamp(Sys.CPU_THREADS, 2, 4) : parse(Int, nprocs_str)
18-
mpiexecjl = joinpath(dir, "mpiexecjl")
18+
env = ["JULIA_BINDIR" => Sys.BINDIR]
19+
mpiexecjl = addenv(`$(joinpath(dir, "mpiexecjl"))`, env...)
1920
# `Base.julia_cmd()` ensures keeping consistent flags when running subprocesses.
2021
julia = Base.julia_cmd()
2122
example = joinpath(@__DIR__, "..", "docs", "examples", "01-hello.jl")
22-
env = ["JULIA_BINDIR" => Sys.BINDIR]
23-
p = withenv(env...) do
24-
run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -q $(example)`)
25-
end
23+
p = run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -q $(example)`)
2624
@test success(p)
2725
# Test help messages
2826
for help_flag in ("-h", "--help")
29-
help_message = withenv(env...) do
30-
read(`$(mpiexecjl) --project=$(dir) --help`, String)
31-
end
27+
help_message = read(`$(mpiexecjl) --project=$(dir) --help`, String)
3228
@test occursin(r"Usage:.*MPIEXEC_ARGUMENTS", help_message)
3329
end
3430
# Without arguments, or only with the `--project` option, the wrapper will fail
35-
@test !withenv(() -> success(`$(mpiexecjl) --project=$(dir)`), env...)
36-
@test !withenv(() -> success(`$(mpiexecjl)`), env...)
31+
@test !success(`$(mpiexecjl) --project=$(dir)`)
32+
@test !success(mpiexecjl)
3733
# Test that the wrapper exits with the same exit code as the MPI process
3834
exit_code = 10
3935
p = run(`$(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -e "exit($(exit_code))"`; wait=false)

0 commit comments

Comments
 (0)