From: Matthias Maier Date: Mon, 19 Apr 2021 20:48:51 +0000 (-0500) Subject: add a test X-Git-Tag: v9.3.0-rc1~208^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=086221f20042b17c0506c6acf294d95fd7822b98;p=dealii.git add a test --- 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