From 01851e532a45919b83697aaf8ef502c86d5e7d99 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Fri, 5 Mar 2021 08:57:44 +0100
Subject: [PATCH] [test] Add CMAKE_GUARDs for PNM tests

---
 test/io/gridmanager/CMakeLists.txt               | 5 ++++-
 test/porenetwork/1p/CMakeLists.txt               | 2 ++
 test/porenetwork/1p/nonisothermal/CMakeLists.txt | 1 +
 test/porenetwork/1pnc/CMakeLists.txt             | 3 +++
 test/porenetwork/2p/CMakeLists.txt               | 2 ++
 test/porenetwork/2p/static/CMakeLists.txt        | 1 +
 6 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/io/gridmanager/CMakeLists.txt b/test/io/gridmanager/CMakeLists.txt
index f1f5d21ce9..bfbd6fb40e 100644
--- a/test/io/gridmanager/CMakeLists.txt
+++ b/test/io/gridmanager/CMakeLists.txt
@@ -305,6 +305,7 @@ add_executable(test_pnm_gridmanager EXCLUDE_FROM_ALL test_pnm_gridmanager.cc)
 dumux_add_test(NAME test_pnm_gridmanager_constant_params
                LABELS unit io porenetwork
                TARGET test_pnm_gridmanager
+               CMAKE_GUARD dune-foamgrid_FOUND
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/pnm_gridmanager-3d-constant.vtp
@@ -383,4 +384,6 @@ dumux_add_test(NAME test_pnm_gridmanager_remove_throats_on_boundary_all
                COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_gridmanager
                CMD_ARGS test_remove-troats-on-boundary.input -Grid.RemoveThroatsOnBoundary "0 1 2 3")
 
-dumux_add_test(SOURCES test_pnm_subgriddata.cc LABELS unit io porenetwork)
+dumux_add_test(SOURCES test_pnm_subgriddata.cc
+               LABELS unit io porenetwork
+               CMAKE_GUARD dune-foamgrid_FOUND)
diff --git a/test/porenetwork/1p/CMakeLists.txt b/test/porenetwork/1p/CMakeLists.txt
index b1c7aa2a77..3db08be27a 100644
--- a/test/porenetwork/1p/CMakeLists.txt
+++ b/test/porenetwork/1p/CMakeLists.txt
@@ -8,6 +8,7 @@ dumux_add_test(NAME test_pnm_1p
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=1
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1p-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1p-00000.vtp
@@ -18,6 +19,7 @@ dumux_add_test(NAME test_pnm_1p_gravity
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=1
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy --zeroThreshold {"velocity_liq \(m/s\)":1e-15,"volumeFlux":1e-25}
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1p_gravity-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1p_gravity-00000.vtp
diff --git a/test/porenetwork/1p/nonisothermal/CMakeLists.txt b/test/porenetwork/1p/nonisothermal/CMakeLists.txt
index e5f8f89b4f..1335a122a8 100644
--- a/test/porenetwork/1p/nonisothermal/CMakeLists.txt
+++ b/test/porenetwork/1p/nonisothermal/CMakeLists.txt
@@ -5,6 +5,7 @@ dumux_add_test(NAME test_pnm_1pni
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=0
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1pni-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1pni-00014.vtp
diff --git a/test/porenetwork/1pnc/CMakeLists.txt b/test/porenetwork/1pnc/CMakeLists.txt
index fd4912f884..8674b7890d 100644
--- a/test/porenetwork/1pnc/CMakeLists.txt
+++ b/test/porenetwork/1pnc/CMakeLists.txt
@@ -7,6 +7,7 @@ dumux_add_test(NAME test_pnm_1p2c_advection
                TARGET test_pnm_1p2c
                LABELS porenetwork
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1p2c-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1p2c-00055.vtp
@@ -16,6 +17,7 @@ dumux_add_test(NAME test_pnm_1p2c_diffusion
                TARGET test_pnm_1p2c
                LABELS porenetwork
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1p2c_diffusion-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1p2c_diffusion-00054.vtp
@@ -26,6 +28,7 @@ dumux_add_test(NAME test_pnm_1p2cni
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=0
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_1p2cni-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_1p2cni-00056.vtp
diff --git a/test/porenetwork/2p/CMakeLists.txt b/test/porenetwork/2p/CMakeLists.txt
index 7b212c3a05..ad938d1a9b 100644
--- a/test/porenetwork/2p/CMakeLists.txt
+++ b/test/porenetwork/2p/CMakeLists.txt
@@ -7,6 +7,7 @@ dumux_add_test(NAME test_pnm_2p
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=1
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_2p-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_2p-00107.vtp
@@ -17,6 +18,7 @@ dumux_add_test(NAME test_pnm_2pni
                LABELS porenetwork
                COMPILE_DEFINITIONS ISOTHERMAL=0
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzy
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_2pni-reference.vtp
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_2pni-00133.vtp
diff --git a/test/porenetwork/2p/static/CMakeLists.txt b/test/porenetwork/2p/static/CMakeLists.txt
index adea10e367..b0602ff1ee 100644
--- a/test/porenetwork/2p/static/CMakeLists.txt
+++ b/test/porenetwork/2p/static/CMakeLists.txt
@@ -4,6 +4,7 @@ dumux_add_test(NAME test_pnm_2p_static
                SOURCES main.cc
                LABELS porenetwork
                COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py
+               CMAKE_GUARD "( dune-foamgrid_FOUND AND HAVE_UMFPACK )"
                CMD_ARGS      --script fuzzyData
                              --files ${CMAKE_SOURCE_DIR}/test/references/test_pnm_2p_static-reference.txt
                                      ${CMAKE_CURRENT_BINARY_DIR}/test_pnm_2p_static_pc-s-curve.txt
-- 
GitLab