Skip to content

Commit e877d7b

Browse files
Merge pull request #57 from ChrisRackauckas-Claude/skip-alloccheck-macos
Skip AllocCheck tests on macOS due to ARM compatibility issues
2 parents db8e8b1 + f98bf00 commit e877d7b

File tree

1 file changed

+48
-43
lines changed

1 file changed

+48
-43
lines changed

test/alloccheck/alloc_tests.jl

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,62 @@ using SciMLStructures: Tunable, Constants, Caches, Discrete, Initials, Input,
44
using AllocCheck
55
using Test
66

7-
@testset "AllocCheck - Zero Allocations" begin
8-
@testset "hasportion checks" begin
9-
arr = rand(10)
10-
11-
@check_allocs check_hasportion_tunable(a) = hasportion(Tunable(), a)
12-
@check_allocs check_hasportion_constants(a) = hasportion(Constants(), a)
13-
@check_allocs check_hasportion_caches(a) = hasportion(Caches(), a)
14-
@check_allocs check_hasportion_discrete(a) = hasportion(Discrete(), a)
15-
@check_allocs check_hasportion_initials(a) = hasportion(Initials(), a)
16-
17-
@test check_hasportion_tunable(arr) == true
18-
@test check_hasportion_constants(arr) == false
19-
@test check_hasportion_caches(arr) == false
20-
@test check_hasportion_discrete(arr) == false
21-
@test check_hasportion_initials(arr) == false
22-
end
7+
# AllocCheck has compatibility issues on macOS ARM
8+
if !Sys.isapple()
239

24-
@testset "isscimlstructure checks" begin
25-
arr = rand(10)
26-
arr_int = [1, 2, 3]
27-
arr_any = Any[1, 2, 3]
10+
@testset "AllocCheck - Zero Allocations" begin
11+
@testset "hasportion checks" begin
12+
arr = rand(10)
2813

29-
@check_allocs check_isscimlstructure(a::Vector{Float64}) = isscimlstructure(a)
30-
@check_allocs check_isscimlstructure_int(a::Vector{Int}) = isscimlstructure(a)
14+
@check_allocs check_hasportion_tunable(a) = hasportion(Tunable(), a)
15+
@check_allocs check_hasportion_constants(a) = hasportion(Constants(), a)
16+
@check_allocs check_hasportion_caches(a) = hasportion(Caches(), a)
17+
@check_allocs check_hasportion_discrete(a) = hasportion(Discrete(), a)
18+
@check_allocs check_hasportion_initials(a) = hasportion(Initials(), a)
3119

32-
@test check_isscimlstructure(arr) == true
33-
@test check_isscimlstructure_int(arr_int) == true
34-
@test isscimlstructure(arr_any) == false
35-
end
20+
@test check_hasportion_tunable(arr) == true
21+
@test check_hasportion_constants(arr) == false
22+
@test check_hasportion_caches(arr) == false
23+
@test check_hasportion_discrete(arr) == false
24+
@test check_hasportion_initials(arr) == false
25+
end
3626

37-
@testset "canonicalize for Vector (aliased, zero alloc)" begin
38-
arr = rand(10)
27+
@testset "isscimlstructure checks" begin
28+
arr = rand(10)
29+
arr_int = [1, 2, 3]
30+
arr_any = Any[1, 2, 3]
3931

40-
@check_allocs function check_canonicalize_vec(a::Vector{Float64})
41-
canonicalize(Tunable(), a)
32+
@check_allocs check_isscimlstructure(a::Vector{Float64}) = isscimlstructure(a)
33+
@check_allocs check_isscimlstructure_int(a::Vector{Int}) = isscimlstructure(a)
34+
35+
@test check_isscimlstructure(arr) == true
36+
@test check_isscimlstructure_int(arr_int) == true
37+
@test isscimlstructure(arr_any) == false
4238
end
4339

44-
vals, repack, aliases = check_canonicalize_vec(arr)
45-
@test vals === arr
46-
@test aliases == true
47-
end
40+
@testset "canonicalize for Vector (aliased, zero alloc)" begin
41+
arr = rand(10)
4842

49-
@testset "canonicalize returns for other portions" begin
50-
arr = rand(10)
43+
@check_allocs function check_canonicalize_vec(a::Vector{Float64})
44+
canonicalize(Tunable(), a)
45+
end
5146

52-
@check_allocs check_canon_constants(a::Vector{Float64}) = canonicalize(Constants(), a)
53-
@check_allocs check_canon_caches(a::Vector{Float64}) = canonicalize(Caches(), a)
54-
@check_allocs check_canon_discrete(a::Vector{Float64}) = canonicalize(Discrete(), a)
47+
vals, repack, aliases = check_canonicalize_vec(arr)
48+
@test vals === arr
49+
@test aliases == true
50+
end
51+
52+
@testset "canonicalize returns for other portions" begin
53+
arr = rand(10)
54+
55+
@check_allocs check_canon_constants(a::Vector{Float64}) = canonicalize(Constants(), a)
56+
@check_allocs check_canon_caches(a::Vector{Float64}) = canonicalize(Caches(), a)
57+
@check_allocs check_canon_discrete(a::Vector{Float64}) = canonicalize(Discrete(), a)
5558

56-
@test check_canon_constants(arr) == (nothing, nothing, nothing)
57-
@test check_canon_caches(arr) == (nothing, nothing, nothing)
58-
@test check_canon_discrete(arr) == (nothing, nothing, nothing)
59+
@test check_canon_constants(arr) == (nothing, nothing, nothing)
60+
@test check_canon_caches(arr) == (nothing, nothing, nothing)
61+
@test check_canon_discrete(arr) == (nothing, nothing, nothing)
62+
end
5963
end
60-
end
64+
65+
end # if !Sys.isapple()

0 commit comments

Comments
 (0)