gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / dune-istl-2.7-fix-non-mpi-tests.patch
CommitLineData
6ca2d7da
FG
1Fix build of dune-istl's tests
2
3Patch copied from upstream source repository:
4
5https://gitlab.dune-project.org/core/dune-istl/-/commit/9eee3462df5a64881c08574f9291e76db398de0a
6
7From 9eee3462df5a64881c08574f9291e76db398de0a Mon Sep 17 00:00:00 2001
8From: Felix Gruber <felgru@posteo.net>
9Date: Sat, 4 Apr 2020 15:27:09 +0200
10Subject: [PATCH] make tests succeed when MPI is disabled
11
12When MPI is not available or explicitly disabled with the CMake build
13option -DCMAKE_IDSABLE_FIND_PACKAGE_MPI=TRUE, some tests were unable to
14build.
15
16The tests created from solverfactorytest.cc.in and part of
17scalarproductstest.cc use Dune::OwnerOverlapCopyCommunication which is
18defined behind `#if HAVE_MPI` and is thus not available in a non-MPI
19build. I've thus disabled those tests when MPI is unavailable.
20
21The matrixmarkettest did not work without MPI, as it contained some code
22using the wrong template parameters when HAVE_MPI was not set. Those
23template paramters have been fixed now.
24
25I've confirmed, that after my changes `make build_tests` succeeds to
26build all tests and that those tests run without failure.
27---
28 dune/istl/test/CMakeLists.txt | 3 ++-
29 dune/istl/test/matrixmarkettest.cc | 2 +-
30 dune/istl/test/scalarproductstest.cc | 2 ++
31 3 files changed, 5 insertions(+), 2 deletions(-)
32
33diff --git a/dune/istl/test/CMakeLists.txt b/dune/istl/test/CMakeLists.txt
34index ffd87969..2c7b2387 100644
35--- a/dune/istl/test/CMakeLists.txt
36+++ b/dune/istl/test/CMakeLists.txt
37@@ -77,7 +77,8 @@ set(DUNE_TEST_FACTORY_BLOCK_SIZES
38 function(add_factory_test BLOCK)
39 STRING(REGEX REPLACE "[^a-zA-Z0-9]" "" BLOCK_CLEAN ${BLOCK})
40 configure_file(solverfactorytest.cc.in solverfactorytest_${BLOCK_CLEAN}.cc)
41- dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc)
42+ dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc
43+ CMAKE_GUARD HAVE_MPI)
44 endfunction(add_factory_test)
45
46 foreach(FIELD_TYPE ${DUNE_TEST_FACTORY_FIELD_TYPES})
47diff --git a/dune/istl/test/matrixmarkettest.cc b/dune/istl/test/matrixmarkettest.cc
48index b335afe6..ce30e8ae 100644
49--- a/dune/istl/test/matrixmarkettest.cc
50+++ b/dune/istl/test/matrixmarkettest.cc
51@@ -52,7 +52,7 @@ int testMatrixMarket(int N)
52 storeMatrixMarket(mat, std::string("testmat"), comm);
53 storeMatrixMarket(bv, std::string("testvec"), comm, false);
54 #else
55- typedef Dune::MatrixAdapter<BCRSMat,BVector,BVector> Operator;
56+ typedef Dune::MatrixAdapter<Matrix,Vector,Vector> Operator;
57 Operator op(mat);
58 op.apply(bv, cv);
59
60diff --git a/dune/istl/test/scalarproductstest.cc b/dune/istl/test/scalarproductstest.cc
61index 452b1d89..f46ce2a9 100644
62--- a/dune/istl/test/scalarproductstest.cc
63+++ b/dune/istl/test/scalarproductstest.cc
64@@ -115,6 +115,7 @@ int main(int argc, char** argv)
65 scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
66 }
67
68+#if HAVE_MPI
69 // Test the ParallelScalarProduct class
70 {
71 using Vector = BlockVector<FieldVector<double,BlockSize> >;
72@@ -139,6 +140,7 @@ int main(int argc, char** argv)
73 ScalarProduct scalarProduct(communicator,SolverCategory::nonoverlapping);
74 scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
75 }
76+#endif
77
78 return t.exit();
79 }
80--
812.25.1
82