From f4f93e6b29cb6b58177881e1fc6b3da0982b5f28 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Tue, 29 Oct 2024 14:53:34 +0100 Subject: [PATCH] Fix file simple test for non threaded tests The simple file test deadlocked when run without mpi2-threads being enabled. This was caused by calling and checking for a thread with number 0. Instead one should check for TST_THREAD_MASTER - and do not use thread related code in non-threaded runs, i.e., put ifdefs around. Signed-off-by: Christoph Niethammer --- io/tst_file_simple.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/io/tst_file_simple.c b/io/tst_file_simple.c index 8663331..3f0e847 100644 --- a/io/tst_file_simple.c +++ b/io/tst_file_simple.c @@ -38,8 +38,13 @@ int tst_file_simple_init (struct tst_env * env) memset (file_name, 0, sizeof (char)*100); sprintf(file_name, "%s%ld", TST_FILE_NAME, (long)getpid()); } - if (0 == tst_thread_get_num()) +#ifdef HAVE_MPI2_THREADS + if (tst_thread_get_num() == TST_THREAD_MASTER) { +#endif MPI_CHECK (MPI_Bcast(file_name, 100, MPI_CHAR, ROOT, comm)); +#ifdef HAVE_MPI2_THREADS + } +#endif env->read_buffer = tst_type_allocvalues (env->type, env->values_num); tst_file_alloc(env->type, env->values_num, comm_size, file_name, comm);