]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add a test
authorMatthias Maier <tamiko@43-1.org>
Mon, 19 Apr 2021 20:48:51 +0000 (15:48 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 19 Apr 2021 22:22:49 +0000 (17:22 -0500)
tests/base/mpi_init_finalize_signals_01.cc [new file with mode: 0644]
tests/base/mpi_init_finalize_signals_01.mpirun=1.output [new file with mode: 0644]

diff --git a/tests/base/mpi_init_finalize_signals_01.cc b/tests/base/mpi_init_finalize_signals_01.cc
new file mode 100644 (file)
index 0000000..bfcb67c
--- /dev/null
@@ -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 <deal.II/base/mpi.h>
+
+#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 (file)
index 0000000..a6fd773
--- /dev/null
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.