@@ -15,25 +15,21 @@ using MPI
15
15
# Test a run of mpiexec
16
16
nprocs_str = get (ENV , " JULIA_MPI_TEST_NPROCS" , " " )
17
17
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... )
19
20
# `Base.julia_cmd()` ensures keeping consistent flags when running subprocesses.
20
21
julia = Base. julia_cmd ()
21
22
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) ` )
26
24
@test success (p)
27
25
# Test help messages
28
26
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)
32
28
@test occursin (r" Usage:.*MPIEXEC_ARGUMENTS" , help_message)
33
29
end
34
30
# 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)
37
33
# Test that the wrapper exits with the same exit code as the MPI process
38
34
exit_code = 10
39
35
p = run (` $(mpiexecjl) -n $(nprocs) --project=$(dir) $(julia) --startup-file=no -e "exit($(exit_code) )"` ; wait= false )
0 commit comments