Add run-before / run-after hooks for system tests#849
Merged
Conversation
Fixes precice#827. Per-test shell commands run in the copied tutorial directory before Docker build (run-before) or after simulation (run-after). Wire water-hammer and partitioned-pipe-multiscale with ./set-case.sh 1d3d.
MakisH
reviewed
Jun 23, 2026
MakisH
left a comment
Member
There was a problem hiding this comment.
Thanks for implementing! Here are some comments before testing on GHA.
…ecice#849) Integrate develop (build_timeout, tolerance, iterations logs). Fix changelog wording, use str | None for hooks, simplify hook logging, and drop redundant hook validation.
MakisH
approved these changes
Jun 30, 2026
MakisH
left a comment
Member
There was a problem hiding this comment.
Thanks for the updates! This seems to be doing what it needs to.
- Test with
1d3d: https://github.com/precice/tutorials/actions/runs/28460562953/attempts/1 - Test with
3d1d(fails, as it should): https://github.com/precice/tutorials/actions/runs/28460562953/attempts/2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #827.
Some tutorials like
water-hammerandpartitioned-pipe-multiscalehave more than one coupling setup. We pick which one to use with./set-case.sh 1d3d- it switches theprecice-config.xmlsymlink. System tests already copy the tutorial and run Docker, but we had no way to run that script automatically before the test.This PR adds optional
run-beforeandrun-afterintests.yaml. These are shell commands that run on your machine, inside the copied tutorial folder, as part of the normal system test flow.What runs when:
copy tutorial -> run-before -> max_time override -> docker build -> docker run -> run-after -> fieldcompare
I have put
run-beforebefore the Docker build (and beforemax_time) so all host-side file setup happens in one place. Forset-case.shit does not matter if we run it before build or before run - build does not read the precice config. Butmax_timehas to come afterrun-before, because it edits whichever config file the symlink points to.In this PR we wire
water-hammerandpartitioned-pipe-multiscalewithrun-before: ./set-case.sh 1d3d.run-afteris there too, but nothing uses it yet.Test plan
tests.yamlstill parses with the new fieldsrun-beforeswitches the symlink, andmax_timeruns after itwater-hammerlocally with Docker: build and run passed, saw the run-before logdevelopand addressed the review (changelog, typing, hook logging, validation)