From 4853d207f9df4ef5e0bf3085829a2d6e9f2bbbd3 Mon Sep 17 00:00:00 2001
From: Peter Munch
Date: Mon, 17 Aug 2020 21:22:08 +0200
Subject: [PATCH] Run test suite also for json files
---
cmake/macros/macro_deal_ii_add_test.cmake | 18 ++++++++++++++++++
doc/news/changes/minor/20200817Munch | 3 +++
doc/users/testsuite.html | 7 +++++++
3 files changed, 28 insertions(+)
create mode 100644 doc/news/changes/minor/20200817Munch
diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake
index 42dea34149..92269949da 100644
--- a/cmake/macros/macro_deal_ii_add_test.cmake
+++ b/cmake/macros/macro_deal_ii_add_test.cmake
@@ -206,7 +206,25 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file)
"$"
"${_prm_file}"
)
+ ELSEIF( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.json")
+ # the same as above but for json files
+ SET(_json_file "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.json")
+ IF(NOT "${TEST_TARGET_${_build}}" STREQUAL "")
+ SET(_target ${TEST_TARGET_${_build}})
+ ELSEIF(NOT "${TEST_TARGET}" STREQUAL "")
+ SET(_target ${TEST_TARGET})
+ ELSE()
+ MESSAGE(FATAL_ERROR
+ "\nFor ${_comparison_file}: \"${_test_name}.json\" provided, "
+ "but neither \"\${TEST_TARGET}\", nor \"\${TEST_TARGET_${_build}}"
+ "\" is defined.\n\n"
+ )
+ ENDIF()
+ SET(_run_args
+ "$"
+ "${_json_file}"
+ )
ELSE()
MESSAGE(FATAL_ERROR
"\nFor ${_comparison_file}: Neither \"${_test_name}.cc\", "
diff --git a/doc/news/changes/minor/20200817Munch b/doc/news/changes/minor/20200817Munch
new file mode 100644
index 0000000000..b3daddb577
--- /dev/null
+++ b/doc/news/changes/minor/20200817Munch
@@ -0,0 +1,3 @@
+New: The test suite can now also be run with .json files.
+
+(Peter Munch, 2020/08/17)
diff --git a/doc/users/testsuite.html b/doc/users/testsuite.html
index e75b5ed25d..3d1303d85e 100644
--- a/doc/users/testsuite.html
+++ b/doc/users/testsuite.html
@@ -65,6 +65,13 @@ my_test_2.output
variable) is invoked with the path of my_test_2.prm
as
first argument. Again, its screen output is compared against
my_test_2.output
+
+my_test_3.json
+my_test_3.output
+ Just like in the last case, an already built executable (that is defined by a CMake
+ variable) is invoked with the path of my_test_3.json
as
+ first argument. Again, its screen output is compared against
+ my_test_3.output
--
2.39.5