Skip to content

Commit

Permalink
add upstream tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickersing committed Jan 15, 2024
1 parent 5fc3c36 commit aa21b7f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ const TRIXI_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
@test !(name in names(TrixiShallowWater))
end
end

# Run upstream tests for each mesh and dimension to test compatibility with Trixi.jl
include("test_upstream.jl")
end
end
51 changes: 51 additions & 0 deletions test/test_upstream.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module TestExamplesUpstream

using Test
using TrixiShallowWater

include("test_trixi.jl")

EXAMPLES_DIR = pkgdir(TrixiShallowWater, "examples")

# Start with a clean environment: remove output directory if it exists
outdir = "out"
isdir(outdir) && rm(outdir, recursive = true)

# Run upstream tests for each mesh and dimension to test compatibility with Trixi.jl
@testset "Upstream tests" begin
#! format: noindent

# Run tests for TreeMesh
@testset "TreeMesh" begin
# Shallow water wet/dry 1D
@trixi_testset "1D-Test: elixir_shallowwater_well_balanced_nonperiodic.jl with wall boundary" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_1d_dgsem",
"elixir_shallowwater_well_balanced_nonperiodic.jl"),
l2=[
1.7259643614361866e-8,
3.5519018243195145e-16,
1.7259643530442137e-8,
],
linf=[
3.844551010878661e-8,
9.846474508971374e-16,
3.844551077492042e-8,
],
tspan=(0.0, 0.25),
boundary_condition=boundary_condition_slip_wall)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end
end

# Clean up afterwards: delete output directory
@test_nowarn rm(outdir, recursive = true)
end # Upstream tests

end # module

0 comments on commit aa21b7f

Please sign in to comment.