From 02fb1e0d79267f3e79af1e1e85cad76e46a58a0c Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 29 Nov 2023 22:59:44 +0100
Subject: [PATCH] Prevent hdf5 file locking during tests

---
 tests/mpi_test_main.cpp | 3 +++
 tests/test_main.cpp     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp
index fc137d3bb..fb0da8569 100644
--- a/tests/mpi_test_main.cpp
+++ b/tests/mpi_test_main.cpp
@@ -52,6 +52,9 @@ main(int argc, char* argv[])
   Catch::Session session;
   int result = session.applyCommandLine(argc, argv);
 
+  // disable file locking to avoid mess in tests
+  setenv("HDF5_USE_FILE_LOCKING", "FALSE", 1);
+
   if (result == 0) {
     const auto& config = session.config();
     if (config.listReporters() or config.listTags() or config.listTests()) {
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 9903c7ae5..d8641d318 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -33,6 +33,9 @@ main(int argc, char* argv[])
     Kokkos::initialize(args);
   }
 
+  // disable file locking to avoid mess in tests
+  setenv("HDF5_USE_FILE_LOCKING", "FALSE", 1);
+
   PETScWrapper::initialize(argc, argv);
   SLEPcWrapper::initialize(argc, argv);
 
-- 
GitLab