-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.jl
More file actions
82 lines (65 loc) · 1.88 KB
/
main.jl
File metadata and controls
82 lines (65 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using TestItemRunnerCore, JSON, Logging
using JuliaWorkspaces.URIs2: URI
if ARGS[1] == "nodebug"
global_logger(ConsoleLogger(Warn))
elseif ARGS[1] == "debug"
ENV["JULIA_DEBUG"] = "Main,TestItemRunnerCore,TestItemControllers"
else
error("Unknown command line argument $(ARGS[1]).")
end
env_dict = Dict{String,Any}()
test_env_str = get(ENV, "TEST_ENV", "")
if test_env_str != ""
for (k,v) in JSON.parse(test_env_str)
env_dict[k] = v
end
end
juliaup_channel = get(ENV, "TEST_JULIAUP_CHANNEL", "release")
if isempty(juliaup_channel)
juliaup_channel = "release"
end
env_dict["JULIAUP_CHANNEL"] = juliaup_channel
env_dict["JULIA_DEPOT_PATH"] = nothing
filter_func = nothing
filter_expr_str = get(ENV, "TEST_FILTER", "")
if !isempty(filter_expr_str)
filter_expr = Meta.parse(filter_expr_str)
filter_func = eval(:(i -> let name=i.name, tags=i.tags, filename=realpath(i.filename), package_name=i.package_name
$filter_expr
end))
end
testitem_timeout = parse(Int, get(ENV, "TEST_TIMEOUT", "1200"))
profile_name = get(ENV, "TEST_PROFILE_NAME", "")
if isempty(profile_name)
profile_name = "Default"
end
results = run_tests(
pwd(),
filter=filter_func,
fail_on_detection_error=false,
return_results=true,
print_failed_results=true,
progress_ui=:log,
timeout=testitem_timeout,
environments=[RunProfile(profile_name, false, env_dict)]
)
at_least_one_fail = false
for ti in results.testitems
for p in ti.profiles
if p.status != :passed
global at_least_one_fail = true
break
end
end
end
JSON.lower(uri::URI) = string(uri)
results_path = get(ENV, "RESULTS_PATH", "")
if !isempty(results_path)
open(results_path, "w") do f
JSON.print(f, results)
end
end
@debug "Before kill_test_processes()"
kill_test_processes()
@debug "Before final exit call"
exit(at_least_one_fail ? 1 : 0)