Skip to content
Snippets Groups Projects
Forked from ogs / ogs
917 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
AddTest.cmake 24.89 KiB
#
# AddTest
# -------
#
# Creates application test runs. Order of arguments can be arbitrary.
#
# ~~~
# AddTest(
#   NAME <name of the the test>
#   PATH <working directory> # relative to SourceDir/Tests/Data
#   EXECUTABLE <executable target> # optional, defaults to ogs
#   EXECUTABLE_ARGS <arguments>
#   WRAPPER <time|mpirun> # optional
#   WRAPPER_ARGS <arguments> # optional
#   TESTER <diff|vtkdiff|vtkdiff-mesh|gmldiff|memcheck|numdiff> # optional
#   TESTER_ARGS <argument> # optional
#   REQUIREMENTS # optional simple boolean expression which has to be true to
#                  enable the test, e.g.
#                  OGS_USE_PETSC AND (FOO OR BAR)
#   PYTHON_PACKAGES package_x=1.2.3 package_y=0.1.x # optional
#   RUNTIME <in seconds> # optional for optimizing ctest duration
#                          values should be taken from envinf job
#   WORKING_DIRECTORY # optional, specify the working directory of the test
#   DISABLED # optional, disables the test
#   PROPERTIES <test properties> # optional
# )
# ~~~
#
# Conditional arguments:
#
# ~~~
#   diff-tester
#     - DIFF_DATA <list of files to diff>
#         the given file is compared to a file with the same name from Tests/Data
#
#   vtkdiff-tester
#     - DIFF_DATA
#         <vtk file a> <vtk file b> <data array a name> <data array b name> <absolute tolerance> <relative tolerance>
#         Can be given multiple times; the given data arrays in the vtk files are
#         compared using the given absolute and relative tolerances.
#       OR
#     - DIFF_DATA
#         GLOB <globbing expression, e.g. xyz*.vtu> <data array a name> <data array b name> <absolute tolerance> <relative tolerance>
#         Searches for all matching files in the working directory (PATH).
#         Matched files are then compared against files with the same name in
#         the benchmark output directory.
#
#   gmldiff-tester
#     - DIFF_DATA
#         <gml file> <absolute tolerance> <relative tolerance>
#         Can be given multiple times; the point coordinates in the gml files are
#         compared using the given absolute and relative tolerances.
# ~~~
# cmake-lint: disable=C0103,R0911,R0912,R0915
function(AddTest)

    # parse arguments
    set(options DISABLED)
    set(oneValueArgs
        EXECUTABLE
        PATH
        NAME
        WRAPPER
        TESTER
        ABSTOL
        RELTOL
        RUNTIME
        DEPENDS
        WORKING_DIRECTORY
    )