From 717660eb791c8c4b9a03e8fa4f1f51bd5e4b1037 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 10 Sep 2024 00:18:08 +0200 Subject: [PATCH 1/2] Fix test setup https://github.com/SciML/ModelingToolkit.jl/pull/3035 accidentally reverted fixes to the test setup and checks that the error is thrown --- .github/workflows/Tests.yml | 2 ++ test/runtests.jl | 35 ++++++++++++---------- test/structural_transformation/errors.jl | 19 ++++++++++++ test/structural_transformation/runtests.jl | 3 ++ 4 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 test/structural_transformation/errors.jl diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 6598488122..93db3ac518 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -28,6 +28,8 @@ jobs: group: - InterfaceI - InterfaceII + - SymbolicIndexingInterface + - Extended - Extensions - Downstream - RegressionI diff --git a/test/runtests.jl b/test/runtests.jl index 183113e82c..e45e2dfe42 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -32,22 +32,14 @@ end @safetestset "Dynamic Quantities Test" include("dq_units.jl") @safetestset "Unitful Quantities Test" include("units.jl") @safetestset "Mass Matrix Test" include("mass_matrix.jl") - @safetestset "SteadyStateSystem Test" include("steadystatesystems.jl") - @safetestset "SDESystem Test" include("sdesystem.jl") - @safetestset "DDESystem Test" include("dde.jl") - @safetestset "NonlinearSystem Test" include("nonlinearsystem.jl") @safetestset "InitializationSystem Test" include("initializationsystem.jl") @safetestset "Guess Propagation" include("guess_propagation.jl") @safetestset "Hierarchical Initialization Equations" include("hierarchical_initialization_eqs.jl") - @safetestset "PDE Construction Test" include("pde.jl") - @safetestset "JumpSystem Test" include("jumpsystem.jl") - @safetestset "Constraints Test" include("constraints.jl") @safetestset "Reduction Test" include("reduction.jl") @safetestset "Split Parameters Test" include("split_parameters.jl") @safetestset "StaticArrays Test" include("static_arrays.jl") @safetestset "Components Test" include("components.jl") @safetestset "Model Parsing Test" include("model_parsing.jl") - @safetestset "print_tree" include("print_tree.jl") @safetestset "Error Handling" include("error_handling.jl") @safetestset "StructuralTransformations" include("structural_transformation/runtests.jl") @safetestset "State Selection Test" include("state_selection.jl") @@ -55,34 +47,47 @@ end @safetestset "Stream Connect Test" include("stream_connectors.jl") @safetestset "Domain Connect Test" include("domain_connectors.jl") @safetestset "Lowering Integration Test" include("lowering_solving.jl") - @safetestset "Test Big System Usage" include("bigsystem.jl") @safetestset "Dependency Graph Test" include("dep_graphs.jl") @safetestset "Function Registration Test" include("function_registration.jl") @safetestset "Precompiled Modules Test" include("precompile_test.jl") - @safetestset "Variable Utils Test" include("variable_utils.jl") - @safetestset "Variable Metadata Test" include("test_variable_metadata.jl") @safetestset "DAE Jacobians Test" include("dae_jacobian.jl") @safetestset "Jacobian Sparsity" include("jacobiansparsity.jl") @safetestset "Modelingtoolkitize Test" include("modelingtoolkitize.jl") - @safetestset "OptimizationSystem Test" include("optimizationsystem.jl") @safetestset "FuncAffect Test" include("funcaffect.jl") @safetestset "Constants Test" include("constants.jl") @safetestset "Parameter Dependency Test" include("parameter_dependencies.jl") @safetestset "Generate Custom Function Test" include("generate_custom_function.jl") @safetestset "Initial Values Test" include("initial_values.jl") - @safetestset "Discrete System" include("discrete_system.jl") @safetestset "Equation Type Accessors Test" include("equation_type_accessors.jl") @safetestset "Equations with complex values" include("complex.jl") end end - if GROUP == "All" || GROUP == "InterfaceI" || GROUP == "SymbolicIndexingInterface" + if GROUP == "All" || GROUP == "InterfaceII" + @testset "InterfaceII" begin + @safetestset "Variable Utils Test" include("variable_utils.jl") + @safetestset "Variable Metadata Test" include("test_variable_metadata.jl") + @safetestset "OptimizationSystem Test" include("optimizationsystem.jl") + @safetestset "Discrete System" include("discrete_system.jl") + @safetestset "SteadyStateSystem Test" include("steadystatesystems.jl") + @safetestset "SDESystem Test" include("sdesystem.jl") + @safetestset "DDESystem Test" include("dde.jl") + @safetestset "NonlinearSystem Test" include("nonlinearsystem.jl") + @safetestset "PDE Construction Test" include("pde.jl") + @safetestset "JumpSystem Test" include("jumpsystem.jl") + @safetestset "print_tree" include("print_tree.jl") + @safetestset "Constraints Test" include("constraints.jl") + end + end + + if GROUP == "All" || GROUP == "SymbolicIndexingInterface" @safetestset "SymbolicIndexingInterface test" include("symbolic_indexing_interface.jl") @safetestset "SciML Problem Input Test" include("sciml_problem_inputs.jl") @safetestset "MTKParameters Test" include("mtkparameters.jl") end - if GROUP == "All" || GROUP == "InterfaceII" + if GROUP == "All" || GROUP == "Extended" + @safetestset "Test Big System Usage" include("bigsystem.jl") println("C compilation test requires gcc available in the path!") @safetestset "C Compilation Test" include("ccompile.jl") @testset "Distributed Test" include("distributed.jl") diff --git a/test/structural_transformation/errors.jl b/test/structural_transformation/errors.jl new file mode 100644 index 0000000000..c44623c45e --- /dev/null +++ b/test/structural_transformation/errors.jl @@ -0,0 +1,19 @@ +using ModelingToolkit +using ModelingToolkit: t_nounits as t, D_nounits as D +using Test + +@mtkmodel FOL begin + @parameters begin + τ = 3.0 # parameters + end + @variables begin + x(t) = 0.0 # dependent variables + end + @equations begin + D(x) ~ (1 - x) / τ + end +end + +@named rc_model = FOL() +sys = structural_simplify(rc_model) +@test_throws ModelingToolkit.RepeatedStructuralSimplificationError structural_simplify(sys) diff --git a/test/structural_transformation/runtests.jl b/test/structural_transformation/runtests.jl index 316026c92a..ad15709d00 100644 --- a/test/structural_transformation/runtests.jl +++ b/test/structural_transformation/runtests.jl @@ -12,3 +12,6 @@ end @safetestset "Bareiss" begin include("bareiss.jl") end +@safetestset "Errors" begin + include("errors.jl") +end From 46cfdc5e68d419c03f9beb9f2c44f543fa0016cf Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 10 Sep 2024 00:27:06 +0200 Subject: [PATCH 2/2] remove extra errors test --- test/structural_transformation/errors.jl | 19 ------------------- test/structural_transformation/runtests.jl | 3 --- 2 files changed, 22 deletions(-) delete mode 100644 test/structural_transformation/errors.jl diff --git a/test/structural_transformation/errors.jl b/test/structural_transformation/errors.jl deleted file mode 100644 index c44623c45e..0000000000 --- a/test/structural_transformation/errors.jl +++ /dev/null @@ -1,19 +0,0 @@ -using ModelingToolkit -using ModelingToolkit: t_nounits as t, D_nounits as D -using Test - -@mtkmodel FOL begin - @parameters begin - τ = 3.0 # parameters - end - @variables begin - x(t) = 0.0 # dependent variables - end - @equations begin - D(x) ~ (1 - x) / τ - end -end - -@named rc_model = FOL() -sys = structural_simplify(rc_model) -@test_throws ModelingToolkit.RepeatedStructuralSimplificationError structural_simplify(sys) diff --git a/test/structural_transformation/runtests.jl b/test/structural_transformation/runtests.jl index ad15709d00..316026c92a 100644 --- a/test/structural_transformation/runtests.jl +++ b/test/structural_transformation/runtests.jl @@ -12,6 +12,3 @@ end @safetestset "Bareiss" begin include("bareiss.jl") end -@safetestset "Errors" begin - include("errors.jl") -end