diff --git a/experimental/FTheoryTools/test/tate.jl b/experimental/FTheoryTools/test/tate.jl index 7e97626f0cf3..e054dfa5b3f9 100644 --- a/experimental/FTheoryTools/test/tate.jl +++ b/experimental/FTheoryTools/test/tate.jl @@ -30,9 +30,13 @@ t = global_tate_model(base; completeness_check = false) @test is_smooth(ambient_space(t)) == false @test toric_variety(calabi_yau_hypersurface(t)) == ambient_space(t) + isdefined(Main, :test_save_load_roundtrip) || include( + joinpath(Oscar.oscardir, "test", "Serialization", "test_save_load_roundtrip.jl") + ) + mktempdir() do path test_save_load_roundtrip(path, t) do loaded - @test tate_polynomial(loaded) == tate_polynomial(t) + @test tate_polynomial(t) == tate_polynomial(loaded) @test tate_section_a1(t) == tate_section_a1(loaded) @test tate_section_a2(t) == tate_section_a2(loaded) @test tate_section_a3(t) == tate_section_a3(loaded) diff --git a/experimental/QuadFormAndIsom/test/runtests.jl b/experimental/QuadFormAndIsom/test/runtests.jl index 6c9790523d02..bfe04fb2edad 100644 --- a/experimental/QuadFormAndIsom/test/runtests.jl +++ b/experimental/QuadFormAndIsom/test/runtests.jl @@ -77,6 +77,10 @@ end Lf = integer_lattice_with_isometry(L; neg = true) @test order_of_isometry(Lf) == -1 + isdefined(Main, :test_save_load_roundtrip) || include( + joinpath(Oscar.oscardir, "test", "Serialization", "test_save_load_roundtrip.jl") + ) + mktempdir() do path test_save_load_roundtrip(path, Lf) do loaded @test Lf == loaded diff --git a/test/Serialization/basic_types.jl b/test/Serialization/basic_types.jl index f36fa320c9c4..349d3b069ceb 100644 --- a/test/Serialization/basic_types.jl +++ b/test/Serialization/basic_types.jl @@ -1,46 +1,3 @@ -function test_save_load_roundtrip(func, path, original::T; params=nothing) where T - # save and load from a file - filename = joinpath(path, "original.json") - save(filename, original) - loaded = load(filename; params=params) - if T <: Vector - @test loaded isa Vector - else - @test loaded isa T - end - func(loaded) - - # save and load from an IO buffer - io = IOBuffer() - save(io, original) - seekstart(io) - loaded = load(io; params=params) - - if T <: Vector - @test loaded isa Vector - else - @test loaded isa T - end - func(loaded) - - # save and load from an IO buffer, with prescribed type - io = IOBuffer() - save(io, original) - seekstart(io) - loaded = load(io, type=T, params=params) - if T <: Vector - @test loaded isa Vector - else - @test loaded isa T - end - func(loaded) - - # test loading on a empty state - save(filename, original) - reset_global_serializer_state() - loaded = load(filename; params=params) -end - @testset "basic_types" begin mktempdir() do path diff --git a/test/Serialization/runtests.jl b/test/Serialization/runtests.jl index 7a1479b70b15..c3be92b4e358 100644 --- a/test/Serialization/runtests.jl +++ b/test/Serialization/runtests.jl @@ -1,5 +1,8 @@ using Oscar +isdefined(Main, :test_save_load_roundtrip) || + include(joinpath(Oscar.oscardir, "test", "Serialization", "test_save_load_roundtrip.jl")) + include("basic_types.jl") include("PolyhedralGeometry.jl") include("containers.jl") @@ -13,4 +16,3 @@ include("TropicalGeometry.jl") include("QuadForm.jl") include("polymake/runtests.jl") include("upgrades/runtests.jl") - diff --git a/test/Serialization/test_save_load_roundtrip.jl b/test/Serialization/test_save_load_roundtrip.jl new file mode 100644 index 000000000000..f267de31999d --- /dev/null +++ b/test/Serialization/test_save_load_roundtrip.jl @@ -0,0 +1,45 @@ +# This code is needed for multiple test files that may end up on different workers. +# Thus, this needs to be conditionally included in each of these test files. + +function test_save_load_roundtrip(func, path, original::T; params=nothing) where {T} + # save and load from a file + filename = joinpath(path, "original.json") + save(filename, original) + loaded = load(filename; params=params) + if T <: Vector + @test loaded isa Vector + else + @test loaded isa T + end + func(loaded) + + # save and load from an IO buffer + io = IOBuffer() + save(io, original) + seekstart(io) + loaded = load(io; params=params) + + if T <: Vector + @test loaded isa Vector + else + @test loaded isa T + end + func(loaded) + + # save and load from an IO buffer, with prescribed type + io = IOBuffer() + save(io, original) + seekstart(io) + loaded = load(io; type=T, params=params) + if T <: Vector + @test loaded isa Vector + else + @test loaded isa T + end + func(loaded) + + # test loading on a empty state + save(filename, original) + reset_global_serializer_state() + loaded = load(filename; params=params) +end diff --git a/test/runtests.jl b/test/runtests.jl index 325a834eaa01..f6de72fc7f94 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -104,8 +104,6 @@ end Base.cumulative_compile_timing(true) end -println("Making test list") - testlist = [ "Aqua.jl",