From 78aaab137dc7994952d966fc67f1159ff211a2b0 Mon Sep 17 00:00:00 2001
From: Thomas Jahns <jahns@dkrz.de>
Date: Thu, 17 Mar 2022 00:55:25 +0100
Subject: [PATCH] Reduce code divergence.

---
 tests/test_resource_copy.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/test_resource_copy.c b/tests/test_resource_copy.c
index e4cb3c826..91caf6fc0 100644
--- a/tests/test_resource_copy.c
+++ b/tests/test_resource_copy.c
@@ -192,7 +192,10 @@ static int modelRun(MPI_Comm comm)
   int bufferSize, differ;
 
 #ifdef USE_MPI
+  const char *fname = "example_resource_copy_mpi.grb";
   cdiPioSerializeSetMPI();
+#else
+  const char *fname = "example_resource_copy.grb";
 #endif
 
   gridID  = defineGrid      ();
@@ -203,11 +206,7 @@ static int modelRun(MPI_Comm comm)
   {
     struct idPair temp = defineVlist(gridID, zaxisID, taxisID);
     vlistID = temp.id1;
-#ifdef USE_MPI
-    streamID = streamOpenWrite("example_resource_copy_mpi.grb", CDI_FILETYPE_GRB);
-#else
-    streamID = streamOpenWrite("example_resource_copy.grb", CDI_FILETYPE_GRB);
-#endif
+    streamID = streamOpenWrite(fname, CDI_FILETYPE_GRB);
     if ( streamID < 0 ) xabort ( "Could not open file" );
     defineStream ( streamID, vlistID );
     vlistDestroy(temp.id1);
-- 
GitLab