Skip to content

Commit be8a4c3

Browse files
committed
fix verbosity tests
1 parent dbf28e6 commit be8a4c3

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

test/verbosity.jl

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using LinearSolve
2-
using LinearSolve: LinearVerbosity, option_group, group_options, BLISLUFactorization
2+
using LinearSolve: LinearVerbosity, option_group, group_options, BLISLUFactorization,
3+
__appleaccelerate_isavailable, __mkl_isavailable, __openblas_isavailable
34
using SciMLLogging
45
using Test
56

@@ -8,7 +9,7 @@ using Test
89
v1 = LinearVerbosity()
910
@test v1 isa LinearVerbosity
1011
@test v1.default_lu_fallback isa SciMLLogging.WarnLevel
11-
@test v1.KrylovKit_verbosity isa SciMLLogging.WarnLevel
12+
@test v1.KrylovKit_verbosity == SciMLLogging.CustomLevel(1)
1213
end
1314
@testset "LinearVerbosity constructors" begin
1415
v3_none = LinearVerbosity(SciMLLogging.None())
@@ -17,10 +18,10 @@ using Test
1718
v3_standard = LinearVerbosity(SciMLLogging.Standard())
1819
v3_detailed = LinearVerbosity(SciMLLogging.Detailed())
1920

20-
@test v3_all.default_lu_fallback isa SciMLLogging.InfoLevel
21-
@test v3_minimal.default_lu_fallback isa SciMLLogging.ErrorLevel
21+
@test v3_all.default_lu_fallback isa SciMLLogging.WarnLevel
22+
@test v3_minimal.default_lu_fallback isa SciMLLogging.Silent
2223
@test v3_minimal.KrylovKit_verbosity isa SciMLLogging.Silent
23-
@test v3_detailed.KrylovKit_verbosity isa SciMLLogging.WarnLevel
24+
@test v3_detailed.KrylovKit_verbosity == SciMLLogging.CustomLevel(2)
2425
end
2526

2627
@testset "Group-level keyword constructors" begin
@@ -116,7 +117,7 @@ using Test
116117

117118
# Individual field access should still work
118119
@test v.default_lu_fallback isa SciMLLogging.WarnLevel
119-
@test v.KrylovKit_verbosity isa SciMLLogging.WarnLevel
120+
@test v.KrylovKit_verbosity == SciMLLogging.CustomLevel(1)
120121
end
121122
end
122123

@@ -302,7 +303,7 @@ end
302303
@testset "OpenBLAS Verbosity Integration Tests" begin
303304
@testset "OpenBLAS solver with verbosity logging" begin
304305
# Test basic OpenBLAS solver functionality with verbosity
305-
try
306+
if __openblas_isavailable()
306307
# Test successful solve with success logging enabled
307308
A_good = [2.0 1.0; 1.0 2.0]
308309
b_good = [3.0, 4.0]
@@ -361,20 +362,16 @@ end
361362

362363
@test_logs (:info, r"Matrix condition number:.*for.*matrix") match_mode=:any solve(
363364
prob_good, OpenBLASLUFactorization(); verbose = verbose_with_cond)
364-
catch e
365-
if isa(e, ErrorException) && occursin("OpenBLAS binary is missing", string(e))
366-
@info "Skipping OpenBLAS tests - OpenBLAS not available"
367-
else
368-
rethrow(e)
369-
end
365+
else
366+
@info "Skipping OpenBLAS tests - OpenBLAS not available"
370367
end
371368
end
372369
end
373370

374371
@testset "AppleAccelerate Verbosity Integration Tests" begin
375372
@testset "AppleAccelerate solver with verbosity logging" begin
376373
# Test basic AppleAccelerate solver functionality with verbosity
377-
try
374+
if __appleaccelerate_isavailable()
378375
# Test successful solve with success logging enabled
379376
A_good = [2.0 1.0; 1.0 2.0]
380377
b_good = [3.0, 4.0]
@@ -433,20 +430,16 @@ end
433430

434431
@test_logs (:info, r"Matrix condition number:.*for.*matrix") match_mode=:any solve(
435432
prob_good, AppleAccelerateLUFactorization(); verbose = verbose_with_cond)
436-
catch e
437-
if isa(e, ErrorException) && occursin("AppleAccelerate binary is missing", string(e))
438-
@info "Skipping AppleAccelerate tests - AppleAccelerate not available"
439-
else
440-
rethrow(e)
441-
end
433+
else
434+
@info "Skipping AppleAccelerate tests - AppleAccelerate not available"
442435
end
443436
end
444437
end
445438

446439
@testset "MKL Verbosity Integration Tests" begin
447440
@testset "MKL solver with verbosity logging" begin
448441
# Test basic MKL solver functionality with verbosity
449-
try
442+
if __mkl_isavailable()
450443
# Test successful solve with success logging enabled
451444
A_good = [2.0 1.0; 1.0 2.0]
452445
b_good = [3.0, 4.0]
@@ -505,12 +498,8 @@ end
505498

506499
@test_logs (:info, r"Matrix condition number:.*for.*matrix") match_mode=:any solve(
507500
prob_good, MKLLUFactorization(); verbose = verbose_with_cond)
508-
catch e
509-
if isa(e, ErrorException) && occursin("MKL binary is missing", string(e))
510-
@info "Skipping MKL tests - MKL not available"
511-
else
512-
rethrow(e)
513-
end
501+
else
502+
@info "Skipping MKL tests - MKL not available"
514503
end
515504
end
516505
end

0 commit comments

Comments
 (0)