Skip to content

Commit 32ce231

Browse files
Save results from workers, then collate into jsons at end of Base.runtests
1 parent 8301633 commit 32ce231

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

test/runtests.jl

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ include("choosetests.jl")
1313
include("testenv.jl")
1414
include("buildkitetestjson.jl")
1515

16-
using .BuildkiteTestJSON
17-
1816
(; tests, net_on, exit_on_error, use_revise, seed) = choosetests(ARGS)
1917
tests = unique(tests)
2018

@@ -344,6 +342,8 @@ cd(@__DIR__) do
344342
end
345343
end
346344

345+
BuildkiteTestJSON.write_testset_json_files(@__DIR__)
346+
347347
#=
348348
` Construct a testset on the master node which will hold results from all the
349349
test files run on workers and on node1. The loop goes through the results,
@@ -418,11 +418,6 @@ cd(@__DIR__) do
418418
Test.pop_testset()
419419
end
420420

421-
if Base.get_bool_env("CI", false)
422-
@info "Writing test result data to $(@__DIR__)"
423-
write_testset_json_files(@__DIR__, o_ts)
424-
end
425-
426421
Test.TESTSET_PRINT_ENABLE[] = true
427422
println()
428423
# o_ts.verbose = true # set to true to show all timings when successful

test/testdefs.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
using Test, Random
44

5+
include("buildkitetestjson.jl")
6+
57
function runtests(name, path, isolate=true; seed=nothing)
68
old_print_setting = Test.TESTSET_PRINT_ENABLE[]
79
Test.TESTSET_PRINT_ENABLE[] = false
810
# remove all hint_handlers, so that errorshow tests are not changed by which packages have been loaded on this worker already
911
# packages that call register_error_hint should also call this again, and then re-add any hooks they want to test
1012
empty!(Base.Experimental._hint_handlers)
13+
withenv("JULIA_TEST_RECORD_PASSES" => Base.get_bool_env("CI", false)) do
1114
try
1215
if isolate
1316
# Simple enough to type and random enough so that no one will hard
@@ -30,7 +33,13 @@ function runtests(name, path, isolate=true; seed=nothing)
3033
original_env = copy(ENV)
3134
original_project = Base.active_project()
3235

33-
Base.include(m, "$path.jl")
36+
try
37+
Base.include(m, "$path.jl")
38+
finally
39+
if Base.get_bool_env("CI", false)
40+
BuildkiteTestJSON.serialize_testset_result_file(@__DIR__, Test.get_testset())
41+
end
42+
end
3443

3544
if Base.DEPOT_PATH != original_depot_path
3645
msg = "The `$(name)` test set mutated Base.DEPOT_PATH and did not restore the original values"
@@ -98,6 +107,7 @@ function runtests(name, path, isolate=true; seed=nothing)
98107
ex isa TestSetException || rethrow()
99108
return Any[ex]
100109
end
110+
end # withenv
101111
end
102112

103113
# looking in . messes things up badly

0 commit comments

Comments
 (0)