Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/runtests.jl
2055 views
1
using Test
2
using MPI: mpiexec
3
4
# We run tests in parallel with CI jobs setting the `TRIXI_TEST` environment
5
# variable to determine the subset of tests to execute.
6
# By default, we just run the threaded tests since they are relatively cheap
7
# and test a good amount of different functionality.
8
const TRIXI_TEST = get(ENV, "TRIXI_TEST", "threaded")
9
const TRIXI_MPI_NPROCS = clamp(Sys.CPU_THREADS, 2, 3)
10
const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
11
12
@time @testset "Trixi.jl tests" begin
13
# This is placed first since tests error out otherwise if `TRIXI_TEST == "all"`,
14
# at least on some systems.
15
@time if TRIXI_TEST == "all" || TRIXI_TEST == "mpi"
16
# Do a dummy `@test true`:
17
# If the process errors out the testset would error out as well,
18
# cf. https://github.com/JuliaParallel/MPI.jl/pull/391
19
@test true
20
21
# We provide a `--heap-size-hint` to avoid/reduce out-of-memory errors during CI testing
22
mpiexec() do cmd
23
run(`$cmd -n $TRIXI_MPI_NPROCS $(Base.julia_cmd()) --threads=1 --check-bounds=yes --heap-size-hint=0.5G $(abspath("test_mpi.jl"))`)
24
end
25
end
26
27
@time if TRIXI_TEST == "all" || TRIXI_TEST == "threaded" ||
28
TRIXI_TEST == "threaded_legacy"
29
# Do a dummy `@test true`:
30
# If the process errors out the testset would error out as well,
31
# cf. https://github.com/JuliaParallel/MPI.jl/pull/391
32
@test true
33
34
run(`$(Base.julia_cmd()) --threads=$TRIXI_NTHREADS --check-bounds=yes --code-coverage=none $(abspath("test_threaded.jl"))`)
35
end
36
37
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part1"
38
include("test_tree_1d.jl")
39
include("test_tree_2d_part1.jl")
40
end
41
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part2"
42
include("test_tree_2d_part2.jl")
43
end
44
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part3"
45
include("test_tree_2d_part3.jl")
46
end
47
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part4"
48
include("test_tree_3d_part1.jl")
49
end
50
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part5"
51
include("test_tree_3d_part2.jl")
52
end
53
@time if TRIXI_TEST == "all" || TRIXI_TEST == "tree_part6"
54
include("test_tree_3d_part3.jl")
55
end
56
57
@time if TRIXI_TEST == "all" || TRIXI_TEST == "structured"
58
include("test_structured_1d.jl")
59
include("test_structured_2d.jl")
60
include("test_structured_3d.jl")
61
end
62
63
@time if TRIXI_TEST == "all" || TRIXI_TEST == "p4est_part1"
64
include("test_p4est_2d.jl")
65
end
66
@time if TRIXI_TEST == "all" || TRIXI_TEST == "p4est_part2"
67
include("test_p4est_3d.jl")
68
end
69
70
@time if TRIXI_TEST == "all" || TRIXI_TEST == "t8code_part1"
71
include("test_t8code_2d.jl")
72
end
73
@time if TRIXI_TEST == "all" || TRIXI_TEST == "t8code_part2"
74
include("test_t8code_3d.jl")
75
end
76
77
@time if TRIXI_TEST == "all" || TRIXI_TEST == "unstructured_dgmulti"
78
include("test_unstructured_2d.jl")
79
include("test_dgmulti_1d.jl")
80
include("test_dgmulti_2d.jl")
81
include("test_dgmulti_3d.jl")
82
end
83
84
@time if TRIXI_TEST == "all" || TRIXI_TEST == "parabolic_part1"
85
include("test_parabolic_1d.jl")
86
include("test_parabolic_2d.jl")
87
end
88
@time if TRIXI_TEST == "all" || TRIXI_TEST == "parabolic_part2"
89
include("test_parabolic_3d.jl")
90
end
91
92
@time if TRIXI_TEST == "all" || TRIXI_TEST == "misc_part1"
93
include("test_unit.jl")
94
include("test_type.jl")
95
include("test_visualization.jl")
96
end
97
@time if TRIXI_TEST == "all" || TRIXI_TEST == "misc_part2"
98
include("test_special_elixirs.jl")
99
include("test_aqua.jl")
100
end
101
102
@time if TRIXI_TEST == "all" || TRIXI_TEST == "performance_specializations_part1"
103
include("test_performance_specializations_2d.jl")
104
end
105
@time if TRIXI_TEST == "all" || TRIXI_TEST == "performance_specializations_part2"
106
include("test_performance_specializations_3d.jl")
107
end
108
109
@time if TRIXI_TEST == "all" || TRIXI_TEST == "paper_self_gravitating_gas_dynamics"
110
include("test_paper_self_gravitating_gas_dynamics.jl")
111
end
112
113
@time if TRIXI_TEST == "all" || TRIXI_TEST == "CUDA"
114
import CUDA
115
if CUDA.functional()
116
include("test_cuda.jl")
117
else
118
@warn "Unable to run CUDA tests on this machine"
119
end
120
end
121
end
122
123