test: drive suites via topic runners and ARGS filtering

Replace hand-inlined topic tests with `TOPICS` discovery, optional ARGS-based
filtering, and interface smoke checks required by the new mesh stack.

- SPDX-header the runner and assert `AbstractInterfaceMesh` / `InterfaceMesh` exist.
- `include(joinpath(topic, \"runtests.jl\"))` for every mirrored topic directory.
- Drop obsolete inline includes for retired paths; note legacy tests live outside CI.
This commit is contained in:
Jukka Aho
2026-05-09 18:40:23 +03:00
parent aec9383974
commit d6514f2195
+58 -54
View File
@@ -1,12 +1,63 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
# SPDX-FileCopyrightText: 2015-2026 Jukka Aho
# SPDX-License-Identifier: MIT
using JuliaFEM, Test
# The active test tree mirrors `src/`. Every subdirectory below has its
# own `runtests.jl` that bundles the topic into a single `@testset`.
# Adding a new topic = adding the directory to `topics` below.
const TOPICS = [
"basis",
"fields",
"physics",
"elements",
"materials",
"topology",
"geometry",
"mesh",
"quadrature",
"domains/continuum",
"domains/heat",
"domains/darcy",
"domains/thermo_elastic",
"dofs",
"interface",
"assemblers",
"sparse",
"io",
"validation",
"reference",
"docs",
]
# If ARGS has no positional topic names, run every entry in `TOPICS`.
# Otherwise run only listed topics (in `TOPICS` order). Unknown names warn;
# if none match, run the full suite with a warning.
#
# `Pkg.test(; test_args=["assemblers", ...])` forwards those strings to ARGS.
function _topics_from_args()
requested = String[s for s in ARGS if !startswith(s, '-')]
isempty(requested) && return TOPICS
known = Set(TOPICS)
unknown = filter(!in(known), requested)
if !isempty(unknown)
@warn "Unknown test topics (skipped): $(collect(unknown))"
end
want = Set(requested)
chosen = filter(in(want), TOPICS)
if isempty(chosen)
@warn "No valid topics in ARGS $(requested); running full suite"
return TOPICS
end
return chosen
end
@testset "JuliaFEM.jl" begin
@testset "Package loads" begin
@test isdefined(JuliaFEM, :AbstractBasis)
@test isdefined(JuliaFEM, :AbstractMesh)
@test isdefined(JuliaFEM, :AbstractInterfaceMesh)
@test isdefined(JuliaFEM, :InterfaceMesh)
@test isdefined(JuliaFEM, :AbstractTopology)
@test isdefined(JuliaFEM, :AbstractMaterial)
@test isdefined(JuliaFEM, :AbstractPhysics)
@@ -15,9 +66,9 @@ using JuliaFEM, Test
end
@testset "Basic types instantiate" begin
# Test that basic types can be referenced
@test AbstractBasis isa Type
@test AbstractMesh isa Type
@test AbstractInterfaceMesh isa Type
@test AbstractTopology isa Type
@test AbstractMaterial isa Type
@test AbstractPhysics isa Type
@@ -26,7 +77,6 @@ using JuliaFEM, Test
end
@testset "Concrete types exist" begin
# Test that concrete implementations exist
@test Mesh isa Type
@test LinearElastic isa Type
@test Hex8 isa Type
@@ -34,56 +84,10 @@ using JuliaFEM, Test
@test LocalField isa Type
end
# Field tests
@testset "Fields" begin
include("fields/test_local_field.jl")
for topic in _topics_from_args()
include(joinpath(topic, "runtests.jl"))
end
# Physics tests
@testset "Physics" begin
include("physics/test_strain.jl")
end
# Element interpolation tests
@testset "Element Interpolation" begin
include("elements/test_interpolate_local_fields.jl")
end
# Material tests
@testset "Materials" begin
include("materials/test_state_variables.jl")
include("materials/test_traits.jl")
include("materials/test_global_material_cache.jl")
include("materials/test_plasticity_integration.jl")
include("materials/test_cantilever_material_cache_zero_allocations.jl")
include("materials/test_assembly_workspace_refactor.jl")
end
# Topology tests
@testset "Topology" begin
include("topology/test_segments.jl")
include("topology/test_triangles.jl")
include("topology/test_quadrilaterals.jl")
include("topology/test_topology_entities_tetrahedron.jl")
include("topology/test_hexahedra.jl")
include("topology/test_pyramids.jl")
include("topology/test_wedges.jl")
# include("topology/test_topology_type_extraction.jl") # DISABLED: obsolete API (entities don't carry topology)
include("topology/test_topological_invariance.jl")
include("topology/test_entity_dimensions.jl")
end
# Domain-specific tests
@testset "Continuum Domain" begin
include("domains/continuum/runtests.jl")
end
# Validation tests
include("validation/test_cantilever_regression.jl")
include("validation/test_plasticity_simple.jl")
end
# Note: All legacy tests have been moved to test/broken/
# They need to be updated to work with the new modular architecture.
# To run a specific test, use:
# include("test/broken/test_name.jl")
# Tests that target the older / Legacy API or experimental specs live under
# `llm/design/legacy-tests/` and are not picked up by this runner.