Skip to content

Commit 1c608fc

Browse files
committed
tests: on MPI run do not execute GTest::run() on all ranks
it is sufficient to run the tests only on the master node
1 parent 7576202 commit 1c608fc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/examples/advection_diffusion/test_mpi_advection_diffusion.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ int main(int argc, char** argv)
4545
{
4646
testing::InitGoogleTest(&argc, argv);
4747
MPI_Init(&argc, &argv);
48-
auto result = RUN_ALL_TESTS();
48+
int rank = 0;
49+
int result = 1; // GTest return value 1 (failure), 0 (success)
50+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
51+
if (rank == 0) {
52+
result = RUN_ALL_TESTS();
53+
}
4954
MPI_Finalize();
5055
return result;
5156
}

0 commit comments

Comments
 (0)