-
-
Notifications
You must be signed in to change notification settings - Fork 151
Add system test coverage for partitioned-heat-conduction + fix issues #404, #674, #402 #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
4956383
41a6df8
a109ef3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Partitioned heat conduction | ||
| path: partitioned-heat-conduction | ||
| url: https://precice.org/tutorials-partitioned-heat-conduction.html | ||
|
|
||
| participants: | ||
| - Dirichlet | ||
| - Neumann | ||
|
|
||
| cases: | ||
| dirichlet-fenics: | ||
| participant: Dirichlet | ||
| directory: ./dirichlet-fenics | ||
| run: ./run.sh | ||
| component: fenics-adapter | ||
|
|
||
| dirichlet-nutils: | ||
| participant: Dirichlet | ||
| directory: ./dirichlet-nutils | ||
| run: ./run.sh | ||
| component: nutils-adapter | ||
|
|
||
| dirichlet-openfoam: | ||
| participant: Dirichlet | ||
| directory: ./dirichlet-openfoam | ||
| run: ./run.sh | ||
| component: openfoam-adapter | ||
|
|
||
| neumann-fenics: | ||
| participant: Neumann | ||
| directory: ./neumann-fenics | ||
| run: ./run.sh | ||
| component: fenics-adapter | ||
|
|
||
| neumann-nutils: | ||
| participant: Neumann | ||
| directory: ./neumann-nutils | ||
| run: ./run.sh | ||
| component: nutils-adapter | ||
|
|
||
| neumann-openfoam: | ||
| participant: Neumann | ||
| directory: ./neumann-openfoam | ||
| run: ./run.sh | ||
| component: openfoam-adapter |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Reference results for partitioned-heat-conduction are stored as Git LFS archives. | ||
| # | ||
| # To generate them locally, run from tutorials/tools/tests: | ||
| # | ||
| # python generate_reference_results.py --tutorial partitioned-heat-conduction \ | ||
| # --case-combination dirichlet-fenics neumann-fenics | ||
| # | ||
| # Expected archives (one per registered case combination in tests.yaml): | ||
| # dirichlet-fenics_neumann-fenics.tar.gz | ||
| # dirichlet-nutils_neumann-nutils.tar.gz | ||
| # dirichlet-openfoam_neumann-openfoam.tar.gz | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| import argparse | ||
| from pathlib import Path | ||
| from systemtests.SystemtestArguments import SystemtestArguments | ||
| from systemtests.Systemtest import Systemtest, display_systemtestresults_as_table | ||
| from systemtests.Systemtest import Systemtest, display_systemtestresults_as_table, GLOBAL_TIMEOUT | ||
| from systemtests.TestSuite import TestSuites | ||
| from metadata_parser.metdata import Tutorials, Case | ||
| import logging | ||
|
|
@@ -26,13 +26,27 @@ def main(): | |
| parser.add_argument('--log-level', choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'], | ||
| default='INFO', help='Set the logging level') | ||
|
|
||
| parser.add_argument( | ||
| '--timeout', | ||
| type=int, | ||
| default=GLOBAL_TIMEOUT, | ||
| help=( | ||
| f'Maximum number of seconds to wait for each docker-compose process ' | ||
| f'(build, run, or field-compare) before killing it and marking the ' | ||
| f'test as failed. Defaults to {GLOBAL_TIMEOUT} seconds. ' | ||
| f'Increase this value for slow machines or large simulations; ' | ||
| f'decrease it to catch hanging tests faster.' | ||
| ) | ||
| ) | ||
|
Comment on lines
+29
to
+40
|
||
|
|
||
| # Parse the command-line arguments | ||
| args = parser.parse_args() | ||
|
|
||
| # Configure logging based on the provided log level | ||
| logging.basicConfig(level=args.log_level, format='%(levelname)s: %(message)s') | ||
|
|
||
| print(f"Using log-level: {args.log_level}") | ||
| print(f"Using timeout: {args.timeout} seconds") | ||
|
|
||
| systemtests_to_run = [] | ||
| available_tutorials = Tutorials.from_path(PRECICE_TUTORIAL_DIR) | ||
|
|
@@ -61,7 +75,7 @@ def main(): | |
| for case, reference_result in zip( | ||
| test_suite.cases_of_tutorial[tutorial], test_suite.reference_results[tutorial]): | ||
| systemtests_to_run.append( | ||
| Systemtest(tutorial, build_args, case, reference_result)) | ||
| Systemtest(tutorial, build_args, case, reference_result, timeout=args.timeout)) | ||
|
|
||
| if not systemtests_to_run: | ||
| raise RuntimeError("Did not find any Systemtests to execute.") | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -74,47 +74,83 @@ class SystemtestResult: | |||||
| fieldcompare_time: float # in seconds | ||||||
|
|
||||||
|
|
||||||
| def _escape_markdown_cell(text: str) -> str: | ||||||
| """ | ||||||
| Escape content for use inside a GitHub Flavored Markdown table cell. | ||||||
|
|
||||||
| The pipe character must be escaped as ``\\|`` because it is the column | ||||||
| delimiter in GFM tables. Other characters that can trigger unwanted | ||||||
| inline formatting (backtick, asterisk, underscore, tilde) are also | ||||||
| escaped so that e.g. a tutorial path like ``fluid_openfoam`` is not | ||||||
| rendered as italic text. | ||||||
| """ | ||||||
| text = str(text) | ||||||
| # Order matters: backslash first to avoid double-escaping | ||||||
| for char in ('\\', '|', '`', '*', '_', '~'): | ||||||
| text = text.replace(char, f'\\{char}') | ||||||
| return text | ||||||
|
|
||||||
|
|
||||||
| def display_systemtestresults_as_table(results: List[SystemtestResult]): | ||||||
| """ | ||||||
| Prints the result in a nice tabluated way to get an easy overview | ||||||
| Prints the result in a nice tabluated way to get an easy overview. | ||||||
|
||||||
| Prints the result in a nice tabluated way to get an easy overview. | |
| Prints the result in a nice tabulated way to get an easy overview. |
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using tarfile.extractall() on an archive without validating member paths can allow path traversal (e.g., entries with "../") and overwrite files outside the target directory. Please implement a safe extraction that rejects absolute paths and parent-directory traversals before extracting.
Copilot
AI
Mar 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception handling around this docker compose execution appears broken because the outer error path later in this method calls logging.CRITICAL(...) (CRITICAL is an int constant, not a logger function). That would raise a TypeError and hide the real failure. Please change it to logging.critical(...) (or logging.exception(...)) so errors are reported correctly.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,6 +71,24 @@ test_suites: | |||||||||||||||||||||||||||||||||||
| - solid-upstream-dealii | ||||||||||||||||||||||||||||||||||||
| - solid-downstream-dealii | ||||||||||||||||||||||||||||||||||||
| reference_result: ./perpendicular-flap/reference-results/fluid-openfoam_solid-upstream-dealii_solid-downstream-dealii.tar.gz | ||||||||||||||||||||||||||||||||||||
| partitioned_heat_conduction_test: | ||||||||||||||||||||||||||||||||||||
| tutorials: | ||||||||||||||||||||||||||||||||||||
| - path: partitioned-heat-conduction | ||||||||||||||||||||||||||||||||||||
| case_combination: | ||||||||||||||||||||||||||||||||||||
| - dirichlet-fenics | ||||||||||||||||||||||||||||||||||||
| - neumann-fenics | ||||||||||||||||||||||||||||||||||||
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-fenics_neumann-fenics.tar.gz | ||||||||||||||||||||||||||||||||||||
| - path: partitioned-heat-conduction | ||||||||||||||||||||||||||||||||||||
| case_combination: | ||||||||||||||||||||||||||||||||||||
| - dirichlet-nutils | ||||||||||||||||||||||||||||||||||||
| - neumann-nutils | ||||||||||||||||||||||||||||||||||||
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-nutils_neumann-nutils.tar.gz | ||||||||||||||||||||||||||||||||||||
| - path: partitioned-heat-conduction | ||||||||||||||||||||||||||||||||||||
| case_combination: | ||||||||||||||||||||||||||||||||||||
| - dirichlet-openfoam | ||||||||||||||||||||||||||||||||||||
| - neumann-openfoam | ||||||||||||||||||||||||||||||||||||
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-openfoam_neumann-openfoam.tar.gz | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+74
to
+90
|
||||||||||||||||||||||||||||||||||||
| partitioned_heat_conduction_test: | |
| tutorials: | |
| - path: partitioned-heat-conduction | |
| case_combination: | |
| - dirichlet-fenics | |
| - neumann-fenics | |
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-fenics_neumann-fenics.tar.gz | |
| - path: partitioned-heat-conduction | |
| case_combination: | |
| - dirichlet-nutils | |
| - neumann-nutils | |
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-nutils_neumann-nutils.tar.gz | |
| - path: partitioned-heat-conduction | |
| case_combination: | |
| - dirichlet-openfoam | |
| - neumann-openfoam | |
| reference_result: ./partitioned-heat-conduction/reference-results/dirichlet-openfoam_neumann-openfoam.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instructions say to run from "tutorials/tools/tests", but in this repository the path is just "tools/tests" from the repo root. Please update this path to avoid confusing users.