From 1bc5e581f1131d3fcde78ae9c93e1a7a12425536 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Wed, 13 Jul 2022 21:12:35 +0200
Subject: [PATCH] Update CI scripts on Daint: fail early when running in $HOME.

---
 .ci/bb/daint-cscs/test.all.cray |  9 +++++++++
 .ci/bb/daint-cscs/test.all.pgi  |  9 +++++++++
 .ci/bb/daint-cscs/utils.sh      | 20 ++++++++++++++++++--
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/.ci/bb/daint-cscs/test.all.cray b/.ci/bb/daint-cscs/test.all.cray
index 5d4fc6d18..2e773ec28 100755
--- a/.ci/bb/daint-cscs/test.all.cray
+++ b/.ci/bb/daint-cscs/test.all.cray
@@ -9,6 +9,15 @@ top_srcdir=$(cd "${script_dir}/../../.."; pwd)
 . "${script_dir}/utils.sh"
 init_cray1203
 
+# Save time for the person running this script manually:
+if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then
+  case $top_srcdir in
+    "${HOME}/"*)
+      echo "ERROR: parallel NetCDF4 tests are known to fail when CDI is built in the user home directory and linked against NetCDF that does not support MPI parallel invocations" >&2
+      exit 1
+  esac
+fi
+
 test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh"
 
 # The configure script does not check the 'lib64' subdirectory, therefore we
diff --git a/.ci/bb/daint-cscs/test.all.pgi b/.ci/bb/daint-cscs/test.all.pgi
index 2ffd68aaa..3874ce2b7 100755
--- a/.ci/bb/daint-cscs/test.all.pgi
+++ b/.ci/bb/daint-cscs/test.all.pgi
@@ -9,6 +9,15 @@ top_srcdir=$(cd "${script_dir}/../../.."; pwd)
 . "${script_dir}/utils.sh"
 init_pgi2011
 
+# Save time for the person running this script manually:
+if test "x${PE_NETCDF_MODULE_NAME}" = 'xcray-netcdf'; then
+  case $top_srcdir in
+    "${HOME}/"*)
+      echo "ERROR: parallel NetCDF4 tests are known to fail when CDI is built in the user home directory and linked against NetCDF that does not support MPI parallel invocations" >&2
+      exit 1
+  esac
+fi
+
 test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh"
 
 # The configure script does not check the 'lib64' subdirectory, therefore we
diff --git a/.ci/bb/daint-cscs/utils.sh b/.ci/bb/daint-cscs/utils.sh
index bb68477bb..c7092679d 100644
--- a/.ci/bb/daint-cscs/utils.sh
+++ b/.ci/bb/daint-cscs/utils.sh
@@ -103,7 +103,15 @@ init_env ()
 init_cray1203 ()
 {
   init_env
-  switch_for_module craype PrgEnv-cray cce/12.0.3 cray-mpich cray-netcdf
+  switch_for_module craype PrgEnv-cray cce/12.0.3 cray-mpich
+
+  # Build and test against NetCDF that does not support MPI parallel invocations
+  # (parallel NetCDF4 tests are known to fail in this case when run from the
+  # user home directory on Daint):
+  switch_for_module cray-netcdf
+
+  # Uncomment the following line to test against MPI-capable NetCDF:
+  # switch_for_module cray-netcdf-hdf5parallel cray-hdf5-parallel
 
   CC=cc
   CXX=CC
@@ -129,7 +137,15 @@ init_pgi2011 ()
   # the Cray packages and have to make sure that the default versions are
   # unloaded (otherwise, we get various warnings and errors):
   module unload cray-mpich cray-netcdf cray-netcdf-hdf5parallel cray-hdf5 cray-hdf5-parallel
-  switch_for_module craype PrgEnv-pgi/6.0.8 pgi/20.1.1 cray-mpich/7.7.15 cray-netcdf/4.7.4.0 cray-hdf5/1.12.0.0
+  switch_for_module craype PrgEnv-pgi/6.0.8 pgi/20.1.1 cray-mpich/7.7.15
+
+  # Build and test against NetCDF that does not support MPI parallel invocations
+  # (parallel NetCDF4 tests are known to fail in this case when run from the
+  # user home directory on Daint):
+  switch_for_module cray-netcdf/4.7.4.0 cray-hdf5/1.12.0.0
+
+  # Uncomment the following line to test against MPI-capable NetCDF:
+  # switch_for_module cray-netcdf-hdf5parallel/4.7.4.0 cray-hdf5-parallel/1.12.0.0
 
   CC=cc
   CXX=CC
-- 
GitLab