/
runtests.jl
60 lines (52 loc) · 1.62 KB
/
runtests.jl
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
# Copyright (c) 2017: Miles Lubin and contributors
# Copyright (c) 2017: Google Inc.
#
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
# To try and speed up the tests, MOI uses a `MOI_TEST_MODULES` environment
# variable. This environment variable may be missing, or it may be a subset of
# the following, concatenated with `;` as a separator:
#
# * General
# * Benchmarks
# * Bridges
# * FileFormats
# * Nonlinear
# * Test
# * Utilities
#
# If present, the tests run only those submodules defined above. `General` is
# not a submodule, but it runs all of the top-level tests in MOI.
using Test
# This file gets called first. If it doesn't crash, all is well.
include("issue980.jl")
import MathOptInterface as MOI
MODULES_TO_TEST = get(
ENV,
"MOI_TEST_MODULES",
"General;Benchmarks;Bridges;FileFormats;Nonlinear;Test;Utilities",
)
if occursin("General", MODULES_TO_TEST)
@test isempty(Test.detect_ambiguities(MOI; recursive = true))
for file in readdir(@__DIR__)
if file in ["issue980.jl", "dummy.jl", "hygiene.jl", "runtests.jl"]
continue
elseif !endswith(file, ".jl")
continue
end
@testset "$(file)" begin
include(file)
end
end
end
for submodule in split(MODULES_TO_TEST, ";")
if submodule == "General"
continue
end
include("$(submodule)/$(submodule).jl")
GC.gc() # Force GC run here to reduce memory pressure
end
if occursin("General", MODULES_TO_TEST)
# Test hygiene of @model macro
include("hygiene.jl")
end