From 086221f20042b17c0506c6acf294d95fd7822b98 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 19 Apr 2021 15:48:51 -0500 Subject: [PATCH] add a test --- tests/base/mpi_init_finalize_signals_01.cc | 42 +++++++++++++++++++ ...i_init_finalize_signals_01.mpirun=1.output | 6 +++ 2 files changed, 48 insertions(+) create mode 100644 tests/base/mpi_init_finalize_signals_01.cc create mode 100644 tests/base/mpi_init_finalize_signals_01.mpirun=1.output diff --git a/tests/base/mpi_init_finalize_signals_01.cc b/tests/base/mpi_init_finalize_signals_01.cc new file mode 100644 index 0000000000..bfcb67cfec --- /dev/null +++ b/tests/base/mpi_init_finalize_signals_01.cc @@ -0,0 +1,42 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2021 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +// Test signals in MPI_InitFinalize + +#include + +#include "../tests.h" + +int +main(int argc, char *argv[]) +{ + initlog(); + + Utilities::MPI::MPI_InitFinalize::signals.at_mpi_init.connect([=]() { + deallog << "called via MPI_InitFinalize::signals.at_mpi_init" << std::endl; + }); + + Utilities::MPI::MPI_InitFinalize::signals.at_mpi_finalize.connect([=]() { + deallog << "called via MPI_InitFinalize::signals.at_mpi_finalize" + << std::endl; + }); + + deallog << "before MPI initialization" << std::endl; + { + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + deallog << "after MPI initialization" << std::endl; + } + deallog << "after MPI finalization" << std::endl; +} diff --git a/tests/base/mpi_init_finalize_signals_01.mpirun=1.output b/tests/base/mpi_init_finalize_signals_01.mpirun=1.output new file mode 100644 index 0000000000..a6fd773ce8 --- /dev/null +++ b/tests/base/mpi_init_finalize_signals_01.mpirun=1.output @@ -0,0 +1,6 @@ + +DEAL::before MPI initialization +DEAL::called via MPI_InitFinalize::signals.at_mpi_init +DEAL::after MPI initialization +DEAL::called via MPI_InitFinalize::signals.at_mpi_finalize +DEAL::after MPI finalization -- 2.39.5