Skip to content

Add run-before / run-after hooks for system tests#849

Merged
MakisH merged 4 commits into
precice:developfrom
PranjalManhgaye:feature/827-run-before
Jun 30, 2026
Merged

Add run-before / run-after hooks for system tests#849
MakisH merged 4 commits into
precice:developfrom
PranjalManhgaye:feature/827-run-before

Conversation

@PranjalManhgaye

@PranjalManhgaye PranjalManhgaye commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #827.

Some tutorials like water-hammer and partitioned-pipe-multiscale have more than one coupling setup. We pick which one to use with ./set-case.sh 1d3d - it switches the precice-config.xml symlink. 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-before and run-after in tests.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-before before the Docker build (and before max_time) so all host-side file setup happens in one place. For set-case.sh it does not matter if we run it before build or before run - build does not read the precice config. But max_time has to come after run-before, because it edits whichever config file the symlink points to.

In this PR we wire water-hammer and partitioned-pipe-multiscale with run-before: ./set-case.sh 1d3d. run-after is there too, but nothing uses it yet.

Test plan

  • tests.yaml still parses with the new fields
  • Smoke test: run-before switches the symlink, and max_time runs after it
  • water-hammer locally with Docker: build and run passed, saw the run-before log
  • Tests without hooks behave the same as before
  • Merged latest develop and addressed the review (changelog, typing, hook logging, validation)

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 MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing! Here are some comments before testing on GHA.

Comment thread changelog-entries/849.md Outdated
Comment thread tools/tests/systemtests/Systemtest.py Outdated
Comment thread tools/tests/systemtests/Systemtest.py
Comment thread tools/tests/systemtests/Systemtest.py Outdated
Comment thread tools/tests/systemtests/TestSuite.py Outdated
Comment thread tools/tests/README.md
…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.
@PranjalManhgaye PranjalManhgaye requested a review from MakisH June 30, 2026 04:09

@MakisH MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! This seems to be doing what it needs to.

@MakisH MakisH merged commit 7fd5fef into precice:develop Jun 30, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run a command before starting a test

2 participants