Skip to content

Commit d455e1b

Browse files
committed
Create error_path_intentionally_fail.jl
1 parent 2638f9d commit d455e1b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/error_path_intentionally_fail.jl

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
3+
mktempdir() do tmpdir
4+
fake_bindir = joinpath(tmpdir, "bin")
5+
fake_srun = joinpath(tmpdir, "bin", "srun")
6+
mkpath(fake_bindir)
7+
open(fake_srun, "w") do io
8+
println("#!/usr/bin/env bash")
9+
println("set -euf -o pipefail")
10+
println("set -x")
11+
println("echo INTENTIONALLY ERROR-ING")
12+
println("exit 1")
13+
end
14+
15+
16+
directory_separator = Sys.iswindows() ? ';' : ':'
17+
new_env = Dict()
18+
new_env["SLURM_NTASKS"] = "8"
19+
new_env["SLURM_JOB_ID"] = "1234"
20+
if haskey(ENV, "PATH")
21+
old_path = ENV["PATH"]
22+
new_env["PATH"] = fake_bindir * directory_separator * old_path
23+
else
24+
new_env["PATH"] = fake_bindir
25+
end
26+
27+
withenv(new_env...) do
28+
mgr = SlurmClusterManager.SlurmManager()
29+
@test_throws ErrorException Distributed.addprocs(mgr)
30+
end
31+
end

0 commit comments

Comments
 (0)