From acf63d27166e34ccf9c1730ce948ee8cd78846a1 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 19 Jun 2026 10:22:12 -0400 Subject: [PATCH] Skip AllocCheck tests on prerelease Julia The folder-based SciMLTesting harness (PR #36) runs test/alloc_tests.jl as part of the Core group across the full version x OS matrix, including the `pre` channel (currently 1.13.0-rc1). The original alloc test was deliberately scoped to GROUP=nopre on a single x86_64-linux runner, because AllocCheck builds on GPUCompiler/LLVM compiler internals that are unstable on Julia prereleases. On 1.13.0-rc1 / aarch64-macOS, `@check_allocs` reports a spurious 1 allocation (0 dynamic dispatches) for the surrogate call, failing CI. The same test passes on lts (1.10), 1 (1.12), and even 1.13.0-rc1 on x86_64-linux. Verified locally: file is a clean no-op on 1.13.0-rc1, and the AllocCheck tests still run and pass (3/3, 1/1) on 1.10 and 1.12. Gate the AllocCheck testsets on `isempty(VERSION.prerelease)`, restoring the original nopre intent while keeping full coverage on released Julia. Co-Authored-By: Chris Rackauckas Co-Authored-By: Claude Opus 4.8 (1M context) --- test/alloc_tests.jl | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/test/alloc_tests.jl b/test/alloc_tests.jl index e907946..99bafd6 100644 --- a/test/alloc_tests.jl +++ b/test/alloc_tests.jl @@ -32,39 +32,45 @@ function (s::AllocTestSurrogate)(x::Vector{Float64}) return @inbounds s.ys[min_idx] end -@testset "AllocCheck - Surrogate Operations" begin - # Create surrogate with test data - xs = [Float64[1.0, 2.0], Float64[3.0, 4.0], Float64[5.0, 6.0]] - ys = [1, 2, 3] - s = AllocTestSurrogate(xs, ys) +# AllocCheck builds on GPUCompiler/LLVM compiler internals, which are unstable on +# Julia prereleases (the RC codegen reports a spurious allocation that does not appear +# on released Julia). Only run these checks on released Julia, matching the original +# GROUP=nopre scoping of this file. +if isempty(VERSION.prerelease) + @testset "AllocCheck - Surrogate Operations" begin + # Create surrogate with test data + xs = [Float64[1.0, 2.0], Float64[3.0, 4.0], Float64[5.0, 6.0]] + ys = [1, 2, 3] + s = AllocTestSurrogate(xs, ys) - # Test that calling the surrogate is allocation-free - x_test = Float64[2.0, 3.0] + # Test that calling the surrogate is allocation-free + x_test = Float64[2.0, 3.0] - # Verify correctness first - @test s(x_test) == 1 # Closest to [1.0, 2.0] + # Verify correctness first + @test s(x_test) == 1 # Closest to [1.0, 2.0] - # Check that the call is allocation-free after warmup - s(x_test) # warmup - allocs = @allocated s(x_test) - @test allocs == 0 + # Check that the call is allocation-free after warmup + s(x_test) # warmup + allocs = @allocated s(x_test) + @test allocs == 0 - # Test with @check_allocs macro - @check_allocs function test_surrogate_call(surr::AllocTestSurrogate{Vector{Float64}, Int}, x::Vector{Float64}) - return surr(x) + # Test with @check_allocs macro + @check_allocs function test_surrogate_call(surr::AllocTestSurrogate{Vector{Float64}, Int}, x::Vector{Float64}) + return surr(x) + end + @test test_surrogate_call(s, x_test) == 1 end - @test test_surrogate_call(s, x_test) == 1 -end -@testset "AllocCheck - Type Stability" begin - # Verify that abstract type checks are allocation-free - xs = [Float64[1.0, 2.0]] - ys = [1] - s = AllocTestSurrogate(xs, ys) + @testset "AllocCheck - Type Stability" begin + # Verify that abstract type checks are allocation-free + xs = [Float64[1.0, 2.0]] + ys = [1] + s = AllocTestSurrogate(xs, ys) - @check_allocs function check_type(surr::AllocTestSurrogate) - return surr isa AbstractDeterministicSurrogate - end + @check_allocs function check_type(surr::AllocTestSurrogate) + return surr isa AbstractDeterministicSurrogate + end - @test check_type(s) == true + @test check_type(s) == true + end end