From c9d1bb353cd965d054b370918e01630112eb7436 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 9 Jan 2026 06:03:46 -0500 Subject: [PATCH] Finalize nopre test group structure and rebase on main --- .github/workflows/Tests.yml | 7 + Project.toml | 3 +- test/basictests.jl | 96 +++++++++++++ test/nopre/Manifest.toml | 261 ++++++++++++++++++++++++++++++++++++ test/nopre/Project.toml | 4 + test/nopre/jet_tests.jl | 30 +++++ test/runtests.jl | 84 ++---------- 7 files changed, 411 insertions(+), 74 deletions(-) create mode 100644 test/basictests.jl create mode 100644 test/nopre/Manifest.toml create mode 100644 test/nopre/Project.toml create mode 100644 test/nopre/jet_tests.jl diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 121b594..b7473b9 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -23,14 +23,21 @@ jobs: strategy: fail-fast: false matrix: + group: + - Core + - nopre version: - '1' - 'lts' - 'nightly' arch: - x64 + exclude: + - version: 'nightly' + group: 'nopre' uses: "SciML/.github/.github/workflows/tests.yml@v1" with: + group: "${{ matrix.group }}" julia-version: "${{ matrix.version }}" julia-arch: "${{ matrix.arch }}" secrets: "inherit" diff --git a/Project.toml b/Project.toml index 4a74e50..f551b93 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,8 @@ TruncatedStacktraces = "1" julia = "1.6" [extras] +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test"] +test = ["Pkg", "Test"] diff --git a/test/basictests.jl b/test/basictests.jl new file mode 100644 index 0000000..b8ecfaa --- /dev/null +++ b/test/basictests.jl @@ -0,0 +1,96 @@ +using FunctionWrappersWrappers +using Test + +@testset "FunctionWrappersWrappers.jl" begin + fwplus = FunctionWrappersWrapper( + +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( + Float64, Int, + ) + ) + @test fwplus(4.0, 8.0) === 12.0 + @test fwplus(4, 8) === 12 + + fwexp2 = FunctionWrappersWrapper( + exp2, (Tuple{Float64}, Tuple{Float32}, Tuple{Int}), (Float64, Float32, Float64) + ) + @test fwexp2(4.0) === 16.0 + @test fwexp2(4.0f0) === 16.0f0 + @test fwexp2(4) === 16.0 +end + +@testset "Type inference" begin + # Test return type inference + fwplus = FunctionWrappersWrapper( + +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( + Float64, Int, + ) + ) + @test @inferred(fwplus(4.0, 8.0)) === 12.0 + @test @inferred(fwplus(4, 8)) === 12 + + fwexp2 = FunctionWrappersWrapper( + exp2, (Tuple{Float64}, Tuple{Float32}, Tuple{Int}), (Float64, Float32, Float64) + ) + @test @inferred(fwexp2(4.0)) === 16.0 + @test @inferred(fwexp2(4.0f0)) === 16.0f0 + @test @inferred(fwexp2(4)) === 16.0 +end + +@testset "Introspection functions" begin + # Test with a simple function + fwsin = FunctionWrappersWrapper(sin, (Tuple{Float64},), (Float64,)) + + @testset "unwrap" begin + f = unwrap(fwsin) + @test f === sin + @test f(0.5) == sin(0.5) + end + + @testset "wrapped_signatures" begin + sigs = wrapped_signatures(fwsin) + @test sigs == (Tuple{Float64},) + end + + @testset "wrapped_return_types" begin + rets = wrapped_return_types(fwsin) + @test rets == (Float64,) + end + + # Test with multiple signatures + fwplus = FunctionWrappersWrapper( + +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( + Float64, Int, + ) + ) + + @testset "unwrap with multiple signatures" begin + f = unwrap(fwplus) + @test f === + + @test f(1, 2) == 3 + end + + @testset "wrapped_signatures with multiple signatures" begin + sigs = wrapped_signatures(fwplus) + @test sigs == (Tuple{Float64, Float64}, Tuple{Int, Int}) + end + + @testset "wrapped_return_types with multiple signatures" begin + rets = wrapped_return_types(fwplus) + @test rets == (Float64, Int) + end + + # Test with a custom function + my_func(x) = x^2 + fwcustom = FunctionWrappersWrapper( + my_func, (Tuple{Float64}, Tuple{Int}), ( + Float64, Int, + ) + ) + + @testset "unwrap with custom function" begin + f = unwrap(fwcustom) + @test f === my_func + @test f(3) == 9 + @test f(2.5) == 6.25 + end +end diff --git a/test/nopre/Manifest.toml b/test/nopre/Manifest.toml new file mode 100644 index 0000000..b801b1b --- /dev/null +++ b/test/nopre/Manifest.toml @@ -0,0 +1,261 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.12.4" +manifest_format = "2.0" +project_hash = "fc7db7725f4c12cf05bc39dfb6855e7476e54e38" + +[[deps.ArgTools]] +uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.2" + +[[deps.Artifacts]] +uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +version = "1.11.0" + +[[deps.Base64]] +uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +version = "1.11.0" + +[[deps.CodeTracking]] +deps = ["InteractiveUtils", "UUIDs"] +git-tree-sha1 = "b7231a755812695b8046e8471ddc34c8268cbad5" +uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" +version = "3.0.0" + +[[deps.Compiler]] +git-tree-sha1 = "382d79bfe72a406294faca39ef0c3cef6e6ce1f1" +uuid = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1" +version = "0.1.1" + +[[deps.CompilerSupportLibraries_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" +version = "1.3.0+1" + +[[deps.Dates]] +deps = ["Printf"] +uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +version = "1.11.0" + +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.7.0" + +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +version = "1.11.0" + +[[deps.FunctionWrappers]] +git-tree-sha1 = "d62485945ce5ae9c0c48f124a84998d755bae00e" +uuid = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" +version = "1.1.3" + +[[deps.FunctionWrappersWrappers]] +deps = ["FunctionWrappers", "PrecompileTools", "TruncatedStacktraces"] +path = "/home/crackauc/sandbox/tmp_20260108_090820_85201" +uuid = "77dc65aa-8811-40c2-897b-53d922fa7daf" +version = "0.1.4" + +[[deps.InteractiveUtils]] +deps = ["Markdown"] +uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +version = "1.11.0" + +[[deps.JET]] +deps = ["CodeTracking", "Compiler", "InteractiveUtils", "JuliaInterpreter", "JuliaSyntax", "LoweredCodeUtils", "MacroTools", "Pkg", "PrecompileTools", "Preferences", "Revise", "Test"] +git-tree-sha1 = "3642228b0d4ab0b263a5946f60ace6c2b5616256" +uuid = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +version = "0.11.3" + +[[deps.JuliaInterpreter]] +deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] +git-tree-sha1 = "80580012d4ed5a3e8b18c7cd86cebe4b816d17a6" +uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" +version = "0.10.9" + +[[deps.JuliaSyntax]] +git-tree-sha1 = "0d4b3dab95018bcf3925204475693d9f09dc45b8" +uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4" +version = "1.0.2" + +[[deps.JuliaSyntaxHighlighting]] +deps = ["StyledStrings"] +uuid = "ac6e5ff7-fb65-4e79-a425-ec3bc9c03011" +version = "1.12.0" + +[[deps.LibCURL]] +deps = ["LibCURL_jll", "MozillaCACerts_jll"] +uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.4" + +[[deps.LibCURL_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll", "Zlib_jll", "nghttp2_jll"] +uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "8.15.0+0" + +[[deps.LibGit2]] +deps = ["LibGit2_jll", "NetworkOptions", "Printf", "SHA"] +uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" +version = "1.11.0" + +[[deps.LibGit2_jll]] +deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll"] +uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" +version = "1.9.0+0" + +[[deps.LibSSH2_jll]] +deps = ["Artifacts", "Libdl", "OpenSSL_jll"] +uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.11.3+1" + +[[deps.Libdl]] +uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +version = "1.11.0" + +[[deps.Logging]] +uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +version = "1.11.0" + +[[deps.LoweredCodeUtils]] +deps = ["CodeTracking", "Compiler", "JuliaInterpreter"] +git-tree-sha1 = "65ae3db6ab0e5b1b5f217043c558d9d1d33cc88d" +uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" +version = "3.5.0" + +[[deps.MacroTools]] +git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522" +uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" +version = "0.5.16" + +[[deps.Markdown]] +deps = ["Base64", "JuliaSyntaxHighlighting", "StyledStrings"] +uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +version = "1.11.0" + +[[deps.MozillaCACerts_jll]] +uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2025.11.4" + +[[deps.NetworkOptions]] +uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.3.0" + +[[deps.OpenSSL_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" +version = "3.5.4+0" + +[[deps.OrderedCollections]] +git-tree-sha1 = "05868e21324cede2207c6f0f466b4bfef6d5e7ee" +uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +version = "1.8.1" + +[[deps.Pkg]] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] +uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.12.1" +weakdeps = ["REPL"] + + [deps.Pkg.extensions] + REPLExt = "REPL" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "07a921781cab75691315adc645096ed5e370cb77" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.3.3" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "522f093a29b31a93e34eaea17ba055d850edea28" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.5.1" + +[[deps.Printf]] +deps = ["Unicode"] +uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" +version = "1.11.0" + +[[deps.REPL]] +deps = ["InteractiveUtils", "JuliaSyntaxHighlighting", "Markdown", "Sockets", "StyledStrings", "Unicode"] +uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" +version = "1.11.0" + +[[deps.Random]] +deps = ["SHA"] +uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +version = "1.11.0" + +[[deps.Revise]] +deps = ["CodeTracking", "FileWatching", "InteractiveUtils", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Preferences", "REPL", "UUIDs"] +git-tree-sha1 = "dfd6fab9aa325b382773b8930998ce84c2918e5e" +uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" +version = "3.13.1" + + [deps.Revise.extensions] + DistributedExt = "Distributed" + + [deps.Revise.weakdeps] + Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" + +[[deps.SHA]] +uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" + +[[deps.Serialization]] +uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +version = "1.11.0" + +[[deps.Sockets]] +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" +version = "1.11.0" + +[[deps.StyledStrings]] +uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" +version = "1.11.0" + +[[deps.TOML]] +deps = ["Dates"] +uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.3" + +[[deps.Tar]] +deps = ["ArgTools", "SHA"] +uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.0" + +[[deps.Test]] +deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] +uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +version = "1.11.0" + +[[deps.TruncatedStacktraces]] +deps = ["InteractiveUtils", "MacroTools", "Preferences"] +git-tree-sha1 = "ea3e54c2bdde39062abf5a9758a23735558705e1" +uuid = "781d530d-4396-4725-bb49-402e4bee1e77" +version = "1.4.0" + +[[deps.UUIDs]] +deps = ["Random", "SHA"] +uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" +version = "1.11.0" + +[[deps.Unicode]] +uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +version = "1.11.0" + +[[deps.Zlib_jll]] +deps = ["Libdl"] +uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.3.1+2" + +[[deps.nghttp2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.64.0+1" + +[[deps.p7zip_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] +uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.7.0+0" diff --git a/test/nopre/Project.toml b/test/nopre/Project.toml new file mode 100644 index 0000000..0b4fbf6 --- /dev/null +++ b/test/nopre/Project.toml @@ -0,0 +1,4 @@ +[deps] +FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf" +JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/nopre/jet_tests.jl b/test/nopre/jet_tests.jl new file mode 100644 index 0000000..42a3ee7 --- /dev/null +++ b/test/nopre/jet_tests.jl @@ -0,0 +1,30 @@ +using FunctionWrappersWrappers +using JET: JET, @test_opt +using Test + +@testset "JET static analysis" begin + # Test that the main call path is type-stable (no fallback) + fwplus = FunctionWrappersWrapper( + +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( + Float64, Int, + ) + ) + + # Core functionality should be type-stable + @test_opt target_modules = (FunctionWrappersWrappers,) fwplus(4.0, 8.0) + @test_opt target_modules = (FunctionWrappersWrappers,) fwplus(4, 8) + + # Test single-argument wrapper + fwexp2 = FunctionWrappersWrapper( + exp2, (Tuple{Float64}, Tuple{Float32}, Tuple{Int}), (Float64, Float32, Float64) + ) + @test_opt target_modules = (FunctionWrappersWrappers,) fwexp2(4.0) + @test_opt target_modules = (FunctionWrappersWrappers,) fwexp2(4.0f0) + @test_opt target_modules = (FunctionWrappersWrappers,) fwexp2(4) + + # Verify no errors detected by JET.report_call for core paths + rep = JET.report_call(fwplus, (Float64, Float64)) + @test length(JET.get_reports(rep)) == 0 + rep = JET.report_call(fwplus, (Int, Int)) + @test length(JET.get_reports(rep)) == 0 +end diff --git a/test/runtests.jl b/test/runtests.jl index 20dc19d..3a62b62 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,78 +1,16 @@ -using FunctionWrappersWrappers -using Test +using Test, Pkg -@testset "FunctionWrappersWrappers.jl" begin - fwplus = FunctionWrappersWrapper( - +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( - Float64, Int, - ) - ) - @test fwplus(4.0, 8.0) === 12.0 - @test fwplus(4, 8) === 12 +const GROUP = get(ENV, "GROUP", "All") - fwexp2 = FunctionWrappersWrapper( - exp2, (Tuple{Float64}, Tuple{Float32}, Tuple{Int}), (Float64, Float32, Float64) - ) - @test fwexp2(4.0) === 16.0 - @test fwexp2(4.0f0) === 16.0f0 - @test fwexp2(4) === 16.0 -end - -@testset "Introspection functions" begin - # Test with a simple function - fwsin = FunctionWrappersWrapper(sin, (Tuple{Float64},), (Float64,)) - - @testset "unwrap" begin - f = unwrap(fwsin) - @test f === sin - @test f(0.5) == sin(0.5) - end - - @testset "wrapped_signatures" begin - sigs = wrapped_signatures(fwsin) - @test sigs == (Tuple{Float64},) +if GROUP == "All" || GROUP == "Core" + @testset "FunctionWrappersWrappers.jl" begin + include("basictests.jl") end +end - @testset "wrapped_return_types" begin - rets = wrapped_return_types(fwsin) - @test rets == (Float64,) - end - - # Test with multiple signatures - fwplus = FunctionWrappersWrapper( - +, (Tuple{Float64, Float64}, Tuple{Int, Int}), ( - Float64, Int, - ) - ) - - @testset "unwrap with multiple signatures" begin - f = unwrap(fwplus) - @test f === + - @test f(1, 2) == 3 - end - - @testset "wrapped_signatures with multiple signatures" begin - sigs = wrapped_signatures(fwplus) - @test sigs == (Tuple{Float64, Float64}, Tuple{Int, Int}) - end - - @testset "wrapped_return_types with multiple signatures" begin - rets = wrapped_return_types(fwplus) - @test rets == (Float64, Int) - end - - # Test with a custom function - my_func(x) = x^2 - fwcustom = FunctionWrappersWrapper( - my_func, (Tuple{Float64}, Tuple{Int}), ( - Float64, Int, - ) - ) - - @testset "unwrap with custom function" begin - f = unwrap(fwcustom) - @test f === my_func - @test f(3) == 9 - @test f(2.5) == 6.25 - end +if GROUP == "nopre" + Pkg.activate("nopre") + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.instantiate() + include("nopre/jet_tests.jl") end