From 57b2c347b9e4ff7913446907a82919bbae1be492 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 24 Jun 2022 20:16:22 +0200
Subject: [PATCH] Move CI script for NAG 6.2 to Breeze.

---
 .../test.all.nag-6.2.6223                     |  8 ++--
 .ci/bb/breeze-mpim/utils.sh                   | 45 +++++++++++++++++++
 2 files changed, 48 insertions(+), 5 deletions(-)
 rename .ci/bb/{mistral-dkrz => breeze-mpim}/test.all.nag-6.2.6223 (88%)

diff --git a/.ci/bb/mistral-dkrz/test.all.nag-6.2.6223 b/.ci/bb/breeze-mpim/test.all.nag-6.2.6223
similarity index 88%
rename from .ci/bb/mistral-dkrz/test.all.nag-6.2.6223
rename to .ci/bb/breeze-mpim/test.all.nag-6.2.6223
index 0d0b08992..803aefeaf 100755
--- a/.ci/bb/mistral-dkrz/test.all.nag-6.2.6223
+++ b/.ci/bb/breeze-mpim/test.all.nag-6.2.6223
@@ -12,7 +12,6 @@ init_nag626223
 test -f "${top_srcdir}/configure" || "${top_srcdir}/autogen.sh"
 
 # Create a distribution file with minimalistic configuration:
-switch_for_module texlive
 "${top_srcdir}/configure"
 make -j8 dist
 
@@ -27,10 +26,7 @@ tar xf cdi-*.tar.gz
 mkdir build && cd build
 
 # Use GCC from the path when compiling/linking Fortran code:
-FCFLAGS="-Wc=$(which gcc)"
-
-# MPI library is built with -kind=byte, therefore we have to specify it here:
-FCFLAGS+=' -g -kind=byte'
+FCFLAGS="-O2 -g -Wc=$(which gcc)"
 
 # Create an out-of-source configuration:
 ../cdi-*/configure \
@@ -43,8 +39,10 @@ FCFLAGS+=' -g -kind=byte'
 --with-eccodes="${ECCODES_ROOT}" \
 --with-netcdf="${NETCDF_ROOT}" \
 CC="${MPICC}" \
+CPPFLAGS="-I${UUID_ROOT}/include" \
 FC="${MPIFC}" \
 FCFLAGS="${FCFLAGS}" \
+LDFLAGS="-I${UUID_ROOT}/lib" \
 MPI_LAUNCH="${MPI_LAUNCH}" \
 PKG_CONFIG_PATH="${YAXT_ROOT}/lib/pkgconfig:${PPM_ROOT}/lib/pkgconfig"
 
diff --git a/.ci/bb/breeze-mpim/utils.sh b/.ci/bb/breeze-mpim/utils.sh
index 349285e40..51bf6d7b8 100644
--- a/.ci/bb/breeze-mpim/utils.sh
+++ b/.ci/bb/breeze-mpim/utils.sh
@@ -199,6 +199,35 @@ init_clang1201 ()
   export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}"
 }
 
+#
+# Sets variables for tests with NAG 6.2.6223.
+#
+init_nag626223 ()
+{
+  init_env
+  switch_for_module gcc/6.3.0 nag/6.2
+
+  CC=gcc
+  CXX=g++
+  FC=nagfor
+
+  export PATH="/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/mpich-3.4.2-fzsvtw2/bin:${PATH-}"
+  MPICC=mpicc
+  MPIFC=mpif90
+  MPI_LAUNCH="$(which mpirun)"
+
+  ECCODES_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/eccodes-2.21.0-3sdngaq'
+  NETCDF_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/netcdf-c-4.8.0-ogawg3w'
+  PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/scales-ppm-1.0.7-5kdlwzv'
+  YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/yaxt-0.9.2.1-rhq2ysn'
+  UUID_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/gcc-6.3.0-sandybridge/libuuid-1.0.3-rm4kv2o'
+
+  # Here we fix a never-ending story with Libtool overlinkning, absence of
+  # '*.la' files when they could help, and '-Wl,--disable/enable-new-dtags':
+  HDF5_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/nag-6.2-sandybridge/hdf5-1.10.7-pltg3k4'
+  export LD_LIBRARY_PATH="${ECCODES_ROOT}/lib:${HDF5_ROOT}/lib:${LD_LIBRARY_PATH-}"
+}
+
 #
 # Accepts a path to a file containing the testsuite summary (either the
 # 'test-suite.log' or the standard output of the 'make check' command) and
@@ -215,3 +244,19 @@ check_all_tests_passed ()
          }
        }' $1 >&2
 }
+
+#
+# Checks whether the current working directory or any of its subdirectories
+# contain a file and fails with an error message if that is the case.
+#
+check_no_files_in_cwd ()
+{
+  cnfic_files=`find . -type f 2>/dev/null`
+  if test -n "$cnfic_files"; then
+    {
+      echo "ERROR: the current working directory contains undeleted files:"
+      echo "$cnfic_files"
+    } >&2
+    exit 1
+  fi
+}
-- 
GitLab