diff --git a/examples/src/testutil.h b/examples/src/testutil.h index c593b4e0..e7c48e11 100644 --- a/examples/src/testutil.h +++ b/examples/src/testutil.h @@ -1260,12 +1260,17 @@ int test_remove_file(test_cfg* cfg, const char* filepath) /* stat file and simply return if it already doesn't exist */ rc = stat(filepath, &sb); + // We want every rank get the result from stat() + // above. The barrier makes sure rank 0 won't just + // go ahead delete the file before others call stat() + test_barrier(cfg); if (rc) { test_print_verbose_once(cfg, "DEBUG: stat(%s): file already doesn't exist", filepath); return 0; } + if (cfg->use_mpiio) { if (cfg->rank == 0 || cfg->io_pattern == IO_PATTERN_NN) { MPI_CHECK(cfg, (MPI_File_delete(filepath, MPI_INFO_NULL)));