Skip to content

Commit 1a06987

Browse files
authored
Run CI on latest released 1.x version (#928)
* Run CI on latest released 1.x version * fix broken tests on v1.6+ * disable `svd` kwarg const-prop test on v1.6 and later * mark `svd` test as broken on v1.6 and later & swap between `@test` and `@test_broken` for `abstractarray.jl` tests
1 parent 52f2f96 commit 1a06987

File tree

6 files changed

+59
-16
lines changed

6 files changed

+59
-16
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
version:
16+
- '1'
1617
- '1.0'
1718
- '1.1'
1819
- '1.2'

test/abstractarray.jl

+9-7
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,21 @@ using StaticArrays, Test, LinearAlgebra
185185
@test @inferred(convert(AbstractArray{Float64}, diag)) isa Diagonal{Float64,SVector{2,Float64}}
186186
@test convert(AbstractArray{Float64}, diag) == diag
187187
# The following cases currently convert the SMatrix into an MMatrix, because
188-
# the constructor in Base invokes `similar`, rather than `convert`, on the static array
188+
# the constructor in Base invokes `similar`, rather than `convert`, on the static
189+
# array. This was fixed in https://github.com/JuliaLang/julia/pull/40831; so should
190+
# work from Julia v1.8.0-DEV.55
189191
trans = Transpose(SVector(1,2))
190-
@test_broken @inferred(convert(AbstractArray{Float64}, trans)) isa Transpose{Float64,SVector{2,Float64}}
192+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, trans)) isa Transpose{Float64,SVector{2,Float64}}
191193
adj = Adjoint(SVector(1,2))
192-
@test_broken @inferred(convert(AbstractArray{Float64}, adj)) isa Adjoint{Float64,SVector{2,Float64}}
194+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, adj)) isa Adjoint{Float64,SVector{2,Float64}}
193195
uptri = UpperTriangular(SA[1 2; 0 3])
194-
@test_broken @inferred(convert(AbstractArray{Float64}, uptri)) isa UpperTriangular{Float64,SMatrix{2,2,Float64,4}}
196+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, uptri)) isa UpperTriangular{Float64,SMatrix{2,2,Float64,4}}
195197
lotri = LowerTriangular(SA[1 0; 2 3])
196-
@test_broken @inferred(convert(AbstractArray{Float64}, lotri)) isa LowerTriangular{Float64,SMatrix{2,2,Float64,4}}
198+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, lotri)) isa LowerTriangular{Float64,SMatrix{2,2,Float64,4}}
197199
unituptri = UnitUpperTriangular(SA[1 2; 0 1])
198-
@test_broken @inferred(convert(AbstractArray{Float64}, unituptri)) isa UnitUpperTriangular{Float64,SMatrix{2,2,Float64,4}}
200+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, unituptri)) isa UnitUpperTriangular{Float64,SMatrix{2,2,Float64,4}}
199201
unitlotri = UnitLowerTriangular(SA[1 0; 2 1])
200-
@test_broken @inferred(convert(AbstractArray{Float64}, unitlotri)) isa UnitLowerTriangular{Float64,SMatrix{2,2,Float64,4}}
202+
@test_was_once_broken v"1.8.0-DEV.55" @inferred(convert(AbstractArray{Float64}, unitlotri)) isa UnitLowerTriangular{Float64,SMatrix{2,2,Float64,4}}
201203
end
202204
end
203205

test/ambiguities.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const allowable_ambiguities =
1010
0
1111
end
1212

13-
if v"1.6.0-DEV.816" <= VERSION < v"1.6.0-rc"
14-
# Revisit in 1.6.0-rc1 or before. See
13+
if VERSION v"1.6.0"
14+
# TODO: Revisit and fix. See
1515
# https://github.com/JuliaLang/julia/pull/36962
1616
# https://github.com/JuliaLang/julia/issues/36951
1717
@test_broken length(detect_ambiguities(#=LinearAlgebra, =#StaticArrays)) <= allowable_ambiguities

test/arraymath.jl

+21-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,27 @@ import StaticArrays.arithmetic_closure
8686
@test (t-t) isa T
8787
@test (t*t) isa T
8888
@test (t/t) isa T
89+
end
8990

90-
if isbitstype(T0)
91-
@test @allocated(arithmetic_closure(T0)) == 0
92-
end
91+
@testset "arithmetic_closure allocation" begin
92+
# a little icky, but `@allocated` seems to be too fragile to use in a loop with
93+
# types assigned in variables (see #924); so we write out a test explicitly for
94+
# every `isbitstype` type of interest
95+
@test (@allocated arithmetic_closure(UInt128)) == 0
96+
@test (@allocated arithmetic_closure(UInt16)) == 0
97+
@test (@allocated arithmetic_closure(UInt32)) == 0
98+
@test (@allocated arithmetic_closure(UInt64)) == 0
99+
@test (@allocated arithmetic_closure(UInt8)) == 0
100+
@test (@allocated arithmetic_closure(Int128)) == 0
101+
@test (@allocated arithmetic_closure(Int16)) == 0
102+
@test (@allocated arithmetic_closure(Int32)) == 0
103+
@test (@allocated arithmetic_closure(Int64)) == 0
104+
@test (@allocated arithmetic_closure(Int8)) == 0
105+
@test (@allocated arithmetic_closure(Float16)) == 0
106+
@test (@allocated arithmetic_closure(Float32)) == 0
107+
@test (@allocated arithmetic_closure(Float64)) == 0
108+
@test (@allocated arithmetic_closure(Bool)) == 0
109+
@test (@allocated arithmetic_closure(Complex{Int64})) == 0
110+
@test (@allocated arithmetic_closure(ComplexF64)) == 0
93111
end
94112
end

test/svd.jl

+9-4
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,18 @@ using StaticArrays, Test, LinearAlgebra
7171
@testinf svd(m_sing2'; full=Val(true)) \ v2 svd(Matrix(m_sing2'); full=true) \ Vector(v2)
7272
@testinf svd(m_sing2; full=Val(true)) \ m23' svd(Matrix(m_sing2); full=true) \ Matrix(m23')
7373
@testinf svd(m_sing2'; full=Val(true)) \ m23 svd(Matrix(m_sing2'); full=true) \ Matrix(m23)
74-
if VERSION >= v"1.5-DEV"
74+
if VERSION >= v"1.5"
7575
# Test that svd of rectangular matrix is inferred.
7676
# Note the placement of @inferred brackets is important.
7777
#
78-
# This only seems to work on >= v"1.5" due to unknown compiler improvements.
79-
svd_full_false(A) = svd(m_sing2, full=false)
80-
@test @inferred(svd_full_false(m_sing2)).S svd(Matrix(m_sing2)).S
78+
# This only seems to work on v"1.5" due to unknown compiler improvements; seems
79+
# to have stopped working again on v"1.6" and later?
80+
svd_full_false(A) = svd(A, full=false)
81+
if VERSION < v"1.6"
82+
@test @inferred(svd_full_false(m_sing2)).S svd(Matrix(m_sing2)).S
83+
else
84+
@test_broken @inferred(svd_full_false(m_sing2)).S svd(Matrix(m_sing2)).S
85+
end
8186
end
8287

8388
@testinf svd(mc_sing) \ v svd(Matrix(mc_sing)) \ Vector(v)

test/testutil.jl

+17
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ macro inferred_maybe_allow(allow, ex)
9292
end
9393
end
9494

95+
"""
96+
@test_was_once_broken good_version ex
97+
98+
Expands to `@test ex` if `VERSION ≥ good_version` and to `@test_broken ex` if
99+
`VERSION ≥ good_version`. Useful for tests that are broken on earlier versions of Julia
100+
that are fixed on later versions.
101+
"""
102+
macro test_was_once_broken(good_version, ex)
103+
esc(quote
104+
if VERSION < $good_version
105+
@test_broken $ex
106+
else
107+
@test $ex
108+
end
109+
end)
110+
end
111+
95112
@testset "test utils" begin
96113
@testset "@testinf" begin
97114
@testinf [1,2] == [1,2]

0 commit comments

Comments
 (0)