Skip to content

Commit efe57b6

Browse files
DilumAluthgestaticfloat
authored andcommitted
choosetests: add the --force-net option, which will throw an error if networking is unavailable (#42889)
(cherry picked from commit 31b9fd2)
1 parent 5d507cd commit efe57b6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/choosetests.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function choosetests(choices = [])
6565
exit_on_error = false
6666
use_revise = false
6767
seed = rand(RandomDevice(), UInt128)
68+
force_net = false
6869
dryrun = false
6970

7071
for (i, t) in enumerate(choices)
@@ -77,6 +78,8 @@ function choosetests(choices = [])
7778
use_revise = true
7879
elseif startswith(t, "--seed=")
7980
seed = parse(UInt128, t[8:end])
81+
elseif t == "--force-net"
82+
force_net = true
8083
elseif t == "--help-list"
8184
dryrun = true
8285
elseif t == "--help"
@@ -148,7 +151,12 @@ function choosetests(choices = [])
148151
net_on = true
149152
try
150153
ipa = getipaddr()
151-
catch
154+
catch ex
155+
if force_net
156+
msg = "Networking is unavailable, and the `--force-net` option was passed"
157+
@error msg
158+
rethrow()
159+
end
152160
@warn "Networking unavailable: Skipping tests [" * join(net_required_for, ", ") * "]"
153161
net_on = false
154162
end

0 commit comments

Comments
 (0)