Skip to content

Commit ddd1b02

Browse files
committed
Don't bail out on test errors by default
Adds check for JL_TESTFAILURE_STOP environment variable to control fail-on-error.
1 parent 0752339 commit ddd1b02

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

test/runtests.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ cd(dirname(@__FILE__)) do
1010

1111
@everywhere include("testdefs.jl")
1212

13-
reduce(propagate_errors, nothing, pmap(runtests, tests; err_retry=false, err_stop=true))
13+
err_stop = haskey(ENV, "JL_TESTFAILURE_STOP")
14+
results = reduce(propagate_errors, nothing, pmap(runtests, tests; err_retry=false, err_stop=err_stop))
1415

1516
@unix_only n > 1 && rmprocs(workers(), waitfor=5.0)
17+
18+
# exit(1) if any test raised an error so that travis knows the build failed.
19+
if any(x -> x==true, results)
20+
exit(1)
21+
end
22+
1623
println(" \033[32;1mSUCCESS\033[0m")
1724
end

test/testdefs.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ function runtests(name)
88
end
99

1010
function propagate_errors(a,b)
11-
if isa(a,Exception)
11+
err_stop = haskey(ENV, "JL_TESTFAILURE_STOP")
12+
err = false
13+
if isa(a, Exception) || isa(b, Exception)
14+
err = true
15+
end
16+
if isa(a,Exception) && err_stop
1217
rethrow(a)
1318
end
14-
if isa(b,Exception)
19+
if isa(b,Exception) && err_stop
1520
rethrow(b)
1621
end
17-
nothing
22+
err
1823
end
1924

2025
# looking in . messes things up badly

0 commit comments

Comments
 (0)