|
| 1 | +tests = [ |
| 2 | + ("Thunk", "thunk.jl"), |
| 3 | + ("Scheduler", "scheduler.jl"), |
| 4 | + ("Processors", "processors.jl"), |
| 5 | + ("Memory Spaces", "memory-spaces.jl"), |
| 6 | + ("Logging", "logging.jl"), |
| 7 | + ("Checkpointing", "checkpoint.jl"), |
| 8 | + ("Scopes", "scopes.jl"), |
| 9 | + ("Options", "options.jl"), |
| 10 | + ("Mutation", "mutation.jl"), |
| 11 | + ("Task Queues", "task-queues.jl"), |
| 12 | + ("Datadeps", "datadeps.jl"), |
| 13 | + ("Domain Utilities", "domain.jl"), |
| 14 | + ("Array", "array.jl"), |
| 15 | + ("Linear Algebra", "linalg.jl"), |
| 16 | + ("Caching", "cache.jl"), |
| 17 | + ("Disk Caching", "diskcaching.jl"), |
| 18 | + ("File IO", "file-io.jl"), |
| 19 | + #("Fault Tolerance", "fault-tolerance.jl"), |
| 20 | +] |
| 21 | +all_test_names = map(test -> replace(last(test), ".jl"=>""), tests) |
| 22 | +if PROGRAM_FILE != "" && realpath(PROGRAM_FILE) == @__FILE__ |
| 23 | + push!(LOAD_PATH, joinpath(@__DIR__, "..")) |
| 24 | + push!(LOAD_PATH, @__DIR__) |
| 25 | + using Pkg |
| 26 | + Pkg.activate(@__DIR__) |
| 27 | + |
| 28 | + using ArgParse |
| 29 | + s = ArgParseSettings(description = "Dagger Testsuite") |
| 30 | + @eval begin |
| 31 | + @add_arg_table! s begin |
| 32 | + "--test" |
| 33 | + nargs = '*' |
| 34 | + default = all_test_names |
| 35 | + help = "Enables the specified test to run in the testsuite" |
| 36 | + "-s", "--simulate" |
| 37 | + action = :store_true |
| 38 | + help = "Don't actually run the tests" |
| 39 | + end |
| 40 | + end |
| 41 | + parsed_args = parse_args(s) |
| 42 | + to_test = String[] |
| 43 | + for test in parsed_args["test"] |
| 44 | + if isdir(joinpath(@__DIR__, test)) |
| 45 | + for (_, other_test) in tests |
| 46 | + if startswith(other_test, test) |
| 47 | + push!(to_test, other_test) |
| 48 | + continue |
| 49 | + end |
| 50 | + end |
| 51 | + elseif test in all_test_names |
| 52 | + push!(to_test, test) |
| 53 | + else |
| 54 | + println(stderr, "Unknown test: $test") |
| 55 | + println(stderr, "Available tests:") |
| 56 | + for ((test_title, _), test_name) in zip(tests, all_test_names) |
| 57 | + println(stderr, " $test_name: $test_title") |
| 58 | + end |
| 59 | + exit(1) |
| 60 | + end |
| 61 | + end |
| 62 | + @info "Running tests: $(join(to_test, ", "))" |
| 63 | + parsed_args["simulate"] && exit(0) |
| 64 | +else |
| 65 | + to_test = all_test_names |
| 66 | + @info "Running all tests" |
| 67 | +end |
| 68 | + |
| 69 | + |
1 | 70 | using Distributed
|
2 | 71 | addprocs(3)
|
3 | 72 |
|
| 73 | +include("util.jl") |
| 74 | +include("fakeproc.jl") |
| 75 | + |
4 | 76 | using Test
|
5 | 77 | using Dagger
|
6 | 78 | using UUIDs
|
7 | 79 | import MemPool
|
8 | 80 |
|
9 |
| -include("util.jl") |
10 |
| -include("fakeproc.jl") |
11 |
| - |
12 |
| -include("thunk.jl") |
13 |
| - |
14 |
| -#= FIXME: Unreliable, and some thunks still get retained |
15 |
| -# N.B. We need a few of these probably because of incremental WeakRef GC |
16 |
| -@everywhere GC.gc() |
17 |
| -@everywhere GC.gc() |
18 |
| -@everywhere GC.gc() |
19 |
| -@everywhere GC.gc() |
20 |
| -sleep(1) |
21 |
| -@test isempty(Dagger.Sch.EAGER_ID_MAP) |
22 |
| -state = Dagger.Sch.EAGER_STATE[] |
23 |
| -@test isempty(state.waiting) |
24 |
| -@test_broken length(keys(state.waiting_data)) == 1 |
25 |
| -# Ensure that all cache entries have expired |
26 |
| -@test_broken isempty(state.cache) |
27 |
| -=# |
28 |
| - |
29 |
| -include("scheduler.jl") |
30 |
| -include("processors.jl") |
31 |
| -include("memory-spaces.jl") |
32 |
| -include("logging.jl") |
33 |
| -include("checkpoint.jl") |
34 |
| -include("scopes.jl") |
35 |
| -include("options.jl") |
36 |
| -include("mutation.jl") |
37 |
| -include("task-queues.jl") |
38 |
| -include("datadeps.jl") |
39 |
| -include("domain.jl") |
40 |
| -include("array.jl") |
41 |
| -include("linalg.jl") |
42 |
| -include("cache.jl") |
43 |
| -include("diskcaching.jl") |
44 |
| -include("file-io.jl") |
45 |
| - |
46 |
| -try # TODO: Fault tolerance is sometimes unreliable |
47 |
| -#include("fault-tolerance.jl") |
| 81 | +try |
| 82 | + for test in to_test |
| 83 | + test_title = tests[findfirst(x->x[2]==test * ".jl", tests)][1] |
| 84 | + test_name = all_test_names[findfirst(x->x==test, all_test_names)] |
| 85 | + println() |
| 86 | + @info "Testing $test_title ($test_name)" |
| 87 | + @testset "$test_title" include(test * ".jl") |
| 88 | + end |
48 | 89 | catch
|
| 90 | + printstyled(stderr, "Tests Failed!\n"; color=:red) |
| 91 | + rethrow() |
| 92 | +finally |
| 93 | + state = Dagger.Sch.EAGER_STATE[] |
| 94 | + if state !== nothing |
| 95 | + notify(state.halt) |
| 96 | + end |
| 97 | + sleep(1) |
| 98 | + rmprocs(workers()) |
49 | 99 | end
|
50 |
| -println(stderr, "tests done. cleaning up...") |
51 |
| -Dagger.cleanup() |
52 |
| -println(stderr, "all done.") |
| 100 | + |
| 101 | +printstyled(stderr, "Tests Completed!\n"; color=:green) |
0 commit comments