@@ -23,13 +23,15 @@ Upon return:
23
23
- `seed` is a seed which will be used to initialize the global RNG for each
24
24
test to be run.
25
25
26
- Three options can be passed to `choosetests` by including a special token
26
+ Several options can be passed to `choosetests` by including a special token
27
27
in the `choices` argument:
28
28
- "--skip", which makes all tests coming after be skipped,
29
29
- "--exit-on-error" which sets the value of `exit_on_error`,
30
30
- "--seed=SEED", which sets the value of `seed` to `SEED`
31
31
(parsed as an `UInt128`); `seed` is otherwise initialized randomly.
32
32
This option can be used to reproduce failed tests.
33
+ - "--help", which prints a help message and then skips all tests.
34
+ - "--help-list", which prints the options computed without running them.
33
35
"""
34
36
function choosetests (choices = [])
35
37
testnames = [
@@ -59,26 +61,52 @@ function choosetests(choices = [])
59
61
]
60
62
61
63
tests = []
62
- skip_tests = []
64
+ skip_tests = Set ()
63
65
exit_on_error = false
64
66
use_revise = false
65
67
seed = rand (RandomDevice (), UInt128)
68
+ dryrun = false
66
69
67
70
for (i, t) in enumerate (choices)
68
71
if t == " --skip"
69
- skip_tests = choices[i + 1 : end ]
72
+ union! ( skip_tests, choices[i + 1 : end ])
70
73
break
71
74
elseif t == " --exit-on-error"
72
75
exit_on_error = true
73
76
elseif t == " --revise"
74
77
use_revise = true
75
78
elseif startswith (t, " --seed=" )
76
79
seed = parse (UInt128, t[8 : end ])
80
+ elseif t == " --help-list"
81
+ dryrun = true
82
+ elseif t == " --help"
83
+ println ("""
84
+ USAGE: ./julia runtests.jl [options] [tests]
85
+ OPTIONS:
86
+ --exit-on-error : stop tests immediately when a test group fails
87
+ --help : prints this help message
88
+ --help-list : prints the options computed without running them
89
+ --revise : load Revise
90
+ --seed=<SEED> : set the initial seed for all testgroups (parsed as a UInt128)
91
+ --skip <NAMES>... : skip test or collection tagged with <NAMES>
92
+ TESTS:
93
+ Can be special tokens, such as "all", "unicode", "stdlib", the names of stdlib \
94
+ modules, or the names of any file in the TESTNAMES array (defaults to "all").
95
+
96
+ Or prefix a name with `-` (such as `-core`) to skip a particular test.
97
+ """ )
98
+ return [], false , false , false , UInt128 (0 )
99
+ elseif startswith (t, " --" )
100
+ error (" unknown option: $t " )
101
+ elseif startswith (t, " -" )
102
+ push! (skip_tests, t[2 : end ])
77
103
else
78
104
push! (tests, t)
79
105
end
80
106
end
81
107
108
+ unhandled = copy (skip_tests)
109
+
82
110
if tests == [" all" ] || isempty (tests)
83
111
tests = testnames
84
112
end
@@ -87,6 +115,7 @@ function choosetests(choices = [])
87
115
flt = x -> (x != name && ! (x in files))
88
116
if name in skip_tests
89
117
filter! (flt, tests)
118
+ pop! (unhandled, name)
90
119
elseif name in tests
91
120
filter! (flt, tests)
92
121
prepend! (tests, files)
@@ -133,6 +162,7 @@ function choosetests(choices = [])
133
162
filter! (x -> x != " rounding" , tests)
134
163
end
135
164
165
+ filter! (! in (tests), unhandled)
136
166
filter! (! in (skip_tests), tests)
137
167
138
168
new_tests = String[]
@@ -154,7 +184,26 @@ function choosetests(choices = [])
154
184
explicit_libgit2 || filter! (x -> x != " LibGit2/online" , tests)
155
185
156
186
# Filter out tests from the test groups in the stdlibs
187
+ filter! (! in (tests), unhandled)
157
188
filter! (! in (skip_tests), tests)
158
189
190
+ if ! isempty (unhandled)
191
+ @warn " Not skipping tests: $(join (unhandled, " , " )) "
192
+ end
193
+
194
+ if dryrun
195
+ print (" Tests enabled to run:" )
196
+ foreach (t -> print (" \n " , t), tests)
197
+ if ! isempty (skip_tests)
198
+ print (" \n\n Tests skipped:" )
199
+ foreach (t -> print (" \n " , t), skip_tests)
200
+ end
201
+ print (" \n " )
202
+ exit_on_error && (print (" \n with option " ); printstyled (" exit_on_error" , bold= true ))
203
+ use_revise && (print (" \n with option " ); printstyled (" use_revise" , bold= true ); print (" (Revise.jl)" ))
204
+ print (" \n\n " )
205
+ empty! (tests)
206
+ end
207
+
159
208
tests, net_on, exit_on_error, use_revise, seed
160
209
end
0 commit comments