Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Aqua = "0.8"
BenchmarkTools = "1"
ExprTools = "0.1"
Pkg = "1"
SHA = "0.7, 1"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
Serialization = "1.10"
Test = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "BenchmarkTools", "Pkg", "Test"]
test = ["Aqua", "BenchmarkTools", "SafeTestsets", "SciMLTesting", "Test"]
7 changes: 6 additions & 1 deletion test/core_tests.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using Test
using RuntimeGeneratedFunctions, BenchmarkTools
using Serialization

RuntimeGeneratedFunctions.init(@__MODULE__)

function f(_du, _u, _p, _t)
Expand Down Expand Up @@ -199,7 +203,8 @@ ex = :(x -> [2i for i in 1:x])
# Serialization

proj = dirname(Base.active_project())
buf = IOBuffer(read(`$(Base.julia_cmd()) --startup-file=no --project=$proj "serialize_rgf.jl"`))
serialize_script = joinpath(@__DIR__, "shared", "serialize_rgf.jl")
buf = IOBuffer(read(`$(Base.julia_cmd()) --startup-file=no --project=$proj $serialize_script`))
deserialized_f, deserialized_g = deserialize(buf)
@test deserialized_f(11) == "Hi from a separate process. x=11"
@test deserialized_f.body isa Expr
Expand Down
4 changes: 4 additions & 0 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
RuntimeGeneratedFunctions = {path = ".."}

[compat]
Aqua = "0.8"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
Test = "1"
julia = "1.10"
27 changes: 11 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using Test
using RuntimeGeneratedFunctions, BenchmarkTools
using Serialization
using SciMLTesting

const GROUP = get(ENV, "GROUP", "All")

if GROUP == "QA"
using Pkg
Pkg.activate(joinpath(@__DIR__, "qa"))
Pkg.develop(PackageSpec(path = joinpath(@__DIR__, "..")))
Pkg.instantiate()
include(joinpath(@__DIR__, "qa", "qa.jl"))
end

if GROUP == "All" || GROUP == "Core"
include(joinpath(@__DIR__, "core_tests.jl"))
end
# core_tests.jl must run in `Main` (not an isolated @safetestset module): it
# deserializes RuntimeGeneratedFunctions produced by a separate process whose
# module tag is `Main.#_RGF_ModTag`, so the body must be evaluated where
# `RuntimeGeneratedFunctions.init(@__MODULE__)` initializes `Main`. A thunk runs
# in the caller's (Main) scope; folder-discovery's @safetestset isolation cannot
# express this, so Core is an explicit thunk while QA uses the standard sub-env.
run_tests(;
core = () -> include(joinpath(@__DIR__, "core_tests.jl")),
qa = (; env = joinpath(@__DIR__, "qa"), body = joinpath(@__DIR__, "qa", "qa.jl")),
)
File renamed without changes.
Loading