Skip to content

Run a command before starting a test #827

@MakisH

Description

@MakisH

Most tutorials work as system tests by navigating into each and running ./run.sh.

However, some tutorials provide alternatives that we should also test, and which require running some script to modify configuration files before starting the simulation.

In the following tutorials:

we have a set-case.sh script, which we want to standardize. This script can take arguments. For example, ./set-case.sh 3d1d switches the precice-config.xml symlink to point to precice-config-3d-1d.xml.

It would be nice to be able to write the following in the [tests.yaml](https://github.com/precice/tutorials/blob/develop/tools/tests/tests.yaml:

   water-hammer:
     tutorials:
       - &water-hammer_fluid1d-left-nutils_fluid3d-right-openfoam
         path: water-hammer
         case_combination:
           - fluid1d-left-nutils
           - fluid3d-right-openfoam
+        run-before: ./set-case.sh 1d3d
         max_time: 0.05
         reference_result: ./water-hammer/reference-results/fluid1d-left-nutils_fluid3d-right-openfoam.tar.gz

Note that, in this example, we define four participants in the metadata.yaml, but in reality, only two are needed to construct the case. We could rename the participants in metadata.yaml (only) to Left and Right.

While implementing this, it might be easy to also add a run-after, for any post-processing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions