From 730a600fae153cd5a992e1c7f2a776c366783895 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Fri, 1 Nov 2024 11:22:06 +0100
Subject: [PATCH] Exclude from coverage a bunch of hard-to-reach code

---
 src/language/utils/ASTCheckpointsInfo.hpp         | 2 ++
 src/language/utils/CheckpointResumeRepository.cpp | 4 ++++
 src/utils/Messenger.cpp                           | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/src/language/utils/ASTCheckpointsInfo.hpp b/src/language/utils/ASTCheckpointsInfo.hpp
index d033f0ff0..3a521dcb6 100644
--- a/src/language/utils/ASTCheckpointsInfo.hpp
+++ b/src/language/utils/ASTCheckpointsInfo.hpp
@@ -36,7 +36,9 @@ class ASTCheckpointsInfo
         return i;
       }
     }
+    // LCOV_EXCL_START
     throw UnexpectedError("Could not find node");
+    // LCOV_EXCL_STOP
   }
 
   const ASTCheckpoint&
diff --git a/src/language/utils/CheckpointResumeRepository.cpp b/src/language/utils/CheckpointResumeRepository.cpp
index 1e9b14d2f..d93476823 100644
--- a/src/language/utils/CheckpointResumeRepository.cpp
+++ b/src/language/utils/CheckpointResumeRepository.cpp
@@ -16,10 +16,12 @@ CheckpointResumeRepository::checkpoint(const ASTNodeDataType& data_type,
     const CheckpointFunction& function = i_dt_function->second;
     function(symbol_name, embedded_data, file, checkpoint_group, symbol_table_group);
   } else {
+    // LCOV_EXCL_START
     std::ostringstream error_msg;
     error_msg << "cannot find checkpointing function for type '" << rang::fgB::yellow << data_type_name
               << rang::fg::reset << "'";
     throw UnexpectedError(error_msg.str());
+    // LCOV_EXCL_STOP
   }
 }
 
@@ -33,10 +35,12 @@ CheckpointResumeRepository::resume(const ASTNodeDataType& data_type,
     const ResumeFunction& function = i_dt_function->second;
     return function(symbol_name, symbol_table_group);
   } else {
+    // LCOV_EXCL_START
     std::ostringstream error_msg;
     error_msg << "cannot find resuming function for type '" << rang::fgB::yellow << data_type_name << rang::fg::reset
               << "'";
     throw UnexpectedError(error_msg.str());
+    // LCOV_EXCL_STOP
   }
 }
 
diff --git a/src/utils/Messenger.cpp b/src/utils/Messenger.cpp
index c66102669..db8ed17a6 100644
--- a/src/utils/Messenger.cpp
+++ b/src/utils/Messenger.cpp
@@ -34,12 +34,14 @@ Messenger::Messenger([[maybe_unused]] int& argc, [[maybe_unused]] char* argv[],
   MPI_Init(&argc, &argv);
 
   if (CommunicatorManager::hasSplitColor()) {
+    // LCOV_EXCL_START
     int key = 0;
 
     auto res = MPI_Comm_split(MPI_COMM_WORLD, CommunicatorManager::splitColor(), key, &m_pugs_comm_world);
     if (res) {
       MPI_Abort(MPI_COMM_WORLD, res);
     }
+    // LCOV_EXCL_STOP
   }
 
   m_rank = [&]() {
-- 
GitLab