Skip to content

Commit f2878eb

Browse files
timholyavik-pal
authored andcommitted
Use @test_broken instead of skipping (JuliaNLSolvers#1105)
A global flag, test_broken (default false), determines whether this runs during CI. Locally it's useful to be able to tally the failures, e.g., JuliaNLSolvers#1104 Also: - Fix one failure in L-BFGS that causes CI to fail - Remove several tests from the exclusions lists that now pass
1 parent 960dfeb commit f2878eb

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

test/multivariate/solvers/first_order/cg.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
run_optim_tests(ConjugateGradient(),
77
skip=skip,
88
convergence_exceptions = (("Powell", 1), ("Powell", 2), ("Polynomial", 1),
9-
("Extended Rosenbrock", 1),
109
("Extended Powell", 1),
1110
("Extended Powell", 2)),
1211
minimum_exceptions = (("Paraboloid Diagonal", 1)),
13-
minimizer_exceptions = (("Paraboloid Diagonal", 1),
14-
("Extended Powell", 1),
12+
minimizer_exceptions = (("Extended Powell", 1),
1513
("Extended Powell", 2)),
1614
f_increase_exceptions = (("Hosaki"),),
1715
iteration_exceptions = (("Paraboloid Diagonal", 10000),),

test/multivariate/solvers/first_order/l_bfgs.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
# Trigonometric gets stuck in a local minimum?
33
skip = ("Trigonometric",)
44

5-
if Sys.WORD_SIZE == 32
6-
iteration_exceptions = (("Extended Powell", 2000),)
7-
else
8-
iteration_exceptions = ()
9-
end
5+
iteration_exceptions = (("Extended Powell", 2000),)
106

117
run_optim_tests(LBFGS(),
128
f_increase_exceptions = ("Extended Rosenbrock",),

test/multivariate/solvers/first_order/momentum_gradient_descent.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
"Trigonometric", "Penalty Function I", "Beale","Paraboloid Random Matrix")
55
run_optim_tests(MomentumGradientDescent(),
66
skip = skip,
7-
convergence_exceptions = (("Large Polynomial",1), ("Himmelblau",1),
8-
("Fletcher-Powell", 1),("Fletcher-Powell", 2),
9-
("Powell", 1)),
10-
minimum_exceptions = (("Large Polynomial", 1), ("Large Polynomial", 2)),
7+
convergence_exceptions = (("Fletcher-Powell", 1), ("Fletcher-Powell", 2),),
118
iteration_exceptions = (("Paraboloid Diagonal", 10000),
129
("Powell", 10000)),
1310
f_increase_exceptions = ("Exponential", "Polynomial",

test/runtests.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import LinearAlgebra: norm, diag, I, Diagonal, dot, eigen, issymmetric, mul!
1414
import SparseArrays: normalize!, spdiagm
1515

1616
debug_printing = false
17+
test_broken = false
1718

1819
special_tests = [
1920
"bigfloat/initial_convergence",
@@ -155,15 +156,22 @@ function run_optim_tests(method; convergence_exceptions = (),
155156
printstyled(name, " did not converge with i = ", i, "\n", color=:red)
156157
printstyled(results, "\n", color=:red)
157158
end
159+
elseif test_broken
160+
@test_broken Optim.converged(results)
158161
end
159162
if !((name, i) in minimum_exceptions)
160163
@test Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
164+
elseif test_broken
165+
@test_broken Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
161166
end
162167
if !((name, i) in minimizer_exceptions)
163168
@test norm(Optim.minimizer(results) - prob.solutions) < 1e-2
169+
elseif test_broken
170+
@test_broken norm(Optim.minimizer(results) - prob.solutions) < 1e-2
164171
end
165172
end
166173
else
174+
@test_broken false # marked skipped tests as broken
167175
debug_printing && printstyled("Skipping $name\n", color=:blue)
168176
end
169177
end
@@ -216,14 +224,21 @@ function run_optim_tests_constrained(method; convergence_exceptions = (),
216224
printstyled(name, "did not converge\n", color=:red)
217225
printstyled(results, "\n", color=:red)
218226
end
227+
elseif test_broken
228+
@test_broken Optim.converged(results)
219229
end
220230
if !(name in minimum_exceptions)
221231
@test Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
232+
elseif test_broken
233+
@test_broken Optim.minimum(results) < prob.minimum + sqrt(eps(typeof(prob.minimum)))
222234
end
223235
if !(name in minimizer_exceptions)
224236
@test norm(Optim.minimizer(results) - prob.solutions) < 1e-2
237+
elseif test_broken
238+
@test_broken norm(Optim.minimizer(results) - prob.solutions) < 1e-2
225239
end
226240
else
241+
@test_broken false
227242
debug_printing && printstyled("Skipping $name\n", color=:blue)
228243
end
229244
end

0 commit comments

Comments
 (0)