Skip to content

Commit 182346f

Browse files
Fix test assertions and make MKL tests conditional
- Changed tests to check solution values instead of retcode - Made MKL tests conditional on MKL availability - This fixes CI failures when MKL is not available 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a13d97b commit 182346f

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

test/trim/runtests.jl

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
using SafeTestsets
22

33
@safetestset "LUFactorization implementation" begin
4-
using SciMLBase: successful_retcode
4+
using LinearAlgebra
55
include("linear_lu.jl")
6-
@test successful_retcode(TestLUFactorization.solve_linear(1.0).retcode)
6+
sol = TestLUFactorization.solve_linear(1.0)
7+
@test sol.u [0.09090909090909091, 0.6363636363636364]
78
end
89

910
@safetestset "MKLLUFactorization implementation" begin
10-
using SciMLBase: successful_retcode
11-
include("linear_mkl.jl")
12-
@test successful_retcode(TestMKLLUFactorization.solve_linear(1.0).retcode)
11+
using LinearAlgebra
12+
using LinearSolve
13+
# Only test if MKL is available
14+
if LinearSolve.usemkl(nothing)
15+
include("linear_mkl.jl")
16+
sol = TestMKLLUFactorization.solve_linear(1.0)
17+
@test sol.u [0.09090909090909091, 0.6363636363636364]
18+
else
19+
@test_skip "MKL not available"
20+
end
1321
end
1422

1523
@safetestset "RFLUFactorization implementation" begin
16-
using SciMLBase: successful_retcode
24+
using LinearAlgebra
1725
include("linear_rf.jl")
18-
@test successful_retcode(TestRFLUFactorization.solve_linear(1.0).retcode)
26+
sol = TestRFLUFactorization.solve_linear(1.0)
27+
@test sol.u [0.09090909090909091, 0.6363636363636364]
1928
end
2029

2130
@safetestset "Run trim" begin
@@ -44,11 +53,17 @@ end
4453
)
4554
@test isfile(JULIAC)
4655

47-
for (mainfile, expectedtopass) in [
56+
using LinearSolve
57+
# Build list of tests to run, conditionally including MKL
58+
test_files = [
4859
("main_lu.jl", true),
49-
("main_mkl.jl", true),
5060
("main_rf.jl", true)
5161
]
62+
if LinearSolve.usemkl(nothing)
63+
push!(test_files, ("main_mkl.jl", true))
64+
end
65+
66+
for (mainfile, expectedtopass) in test_files
5267
binpath = tempname()
5368
cmd = `$(Base.julia_cmd()) --project=. --depwarn=error $(JULIAC) --experimental --trim=unsafe-warn --output-exe $(binpath) $(mainfile)`
5469

0 commit comments

Comments
 (0)