From f42591827a7d13a885f0dec466dd7019864e03a5 Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 4 Dec 2019 10:42:27 +0100
Subject: [PATCH] [T/HT] Generate prj files with invalid media defi.

---
 .gitignore                | 1 +
 ProcessLib/HT/Tests.cmake | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 56bd57de1b5..f1089bbaa80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,4 @@ CMakeLists.txt.user*
 *.pyc
 
 Tests/**/*.md5
+Tests/Data/Parabolic/HT/InvalidProjectFiles/*.prj
diff --git a/ProcessLib/HT/Tests.cmake b/ProcessLib/HT/Tests.cmake
index d802be42658..abbbf75bfcc 100644
--- a/ProcessLib/HT/Tests.cmake
+++ b/ProcessLib/HT/Tests.cmake
@@ -449,7 +449,12 @@ AddTest(
     VIS ThermalConvection_pcs_0_ts_1_t_0.000000.vtu
 )
 
-if("${OGS_USE_MPI}" STREQUAL "" AND ${BUILD_TESTING})
+if(NOT OGS_USE_MPI AND BUILD_TESTING AND Python_FOUND)
+    add_custom_target(generate_invalid_project_files_ht
+        ${Python_EXECUTABLE}
+        ${PROJECT_SOURCE_DIR}/ThirdParty/ogs6py/generateInvalidMediaForHT.py
+                                                generateInvalidMediaForHT.py
+        WORKING_DIRECTORY ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/)
     file(GLOB HT_INVALID_PRJ_FILES ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/*.prj)
     foreach(ht_invalid_prj_file ${HT_INVALID_PRJ_FILES})
         string(REPLACE ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/HT "invalid" ht_invalid_prj_file_short ${ht_invalid_prj_file})
@@ -458,8 +463,8 @@ if("${OGS_USE_MPI}" STREQUAL "" AND ${BUILD_TESTING})
             PATH Parabolic/HT/InvalidProjectFiles
             EXECUTABLE ogs
             EXECUTABLE_ARGS ${ht_invalid_prj_file}
-            REQUIREMENTS NOT OGS_USE_MPI
             RUNTIME 1
+            DEPENDS generate_invalid_project_files_ht
         )
         set_tests_properties(ogs-HT_${ht_invalid_prj_file_short} PROPERTIES WILL_FAIL TRUE)
     endforeach()
-- 
GitLab