From 31b9fd2d5960d1e24348235bb2a8d36e6d194612 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Mon, 1 Nov 2021 13:46:21 -0400 Subject: [PATCH] `choosetests`: add the `--force-net` option, which will throw an error if networking is unavailable (#42889) --- test/choosetests.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/choosetests.jl b/test/choosetests.jl index 79ae94a6277a0..bb21e244a26fe 100644 --- a/test/choosetests.jl +++ b/test/choosetests.jl @@ -65,6 +65,7 @@ function choosetests(choices = []) exit_on_error = false use_revise = false seed = rand(RandomDevice(), UInt128) + force_net = false dryrun = false for (i, t) in enumerate(choices) @@ -77,6 +78,8 @@ function choosetests(choices = []) use_revise = true elseif startswith(t, "--seed=") seed = parse(UInt128, t[8:end]) + elseif t == "--force-net" + force_net = true elseif t == "--help-list" dryrun = true elseif t == "--help" @@ -149,7 +152,12 @@ function choosetests(choices = []) net_on = true try ipa = getipaddr() - catch + catch ex + if force_net + msg = "Networking is unavailable, and the `--force-net` option was passed" + @error msg + rethrow() + end @warn "Networking unavailable: Skipping tests [" * join(net_required_for, ", ") * "]" net_on = false end