From 73240831aab4c1a4e239a72773755dff3ffd78c2 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 12 Jan 2021 19:04:27 +0000 Subject: [PATCH] Testing: split long test into two for better parallelism --- tests/CMakeLists.txt | 3 +- tests/Makefile.am | 3 +- ...versions.sh => grib_tigge_conversions1.sh} | 7 ++-- tests/grib_tigge_conversions2.sh | 42 +++++++++++++++++++ 4 files changed, 50 insertions(+), 5 deletions(-) rename tests/{grib_tigge_conversions.sh => grib_tigge_conversions1.sh} (91%) create mode 100755 tests/grib_tigge_conversions2.sh diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ea8cc44a5..924699959 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -218,7 +218,8 @@ if( HAVE_BUILD_TOOLS ) if( ENABLE_EXTRA_TESTS ) list(APPEND tests_data_reqd grib_util_set_spec) list(APPEND tests_data_reqd grib_padding) - list(APPEND tests_data_reqd grib_tigge_conversions) + list(APPEND tests_data_reqd grib_tigge_conversions1) + list(APPEND tests_data_reqd grib_tigge_conversions2) list(APPEND tests_data_reqd bufr_dump_encode_C) list(APPEND tests_data_reqd bufr_dump_decode_C) endif() diff --git a/tests/Makefile.am b/tests/Makefile.am index fa6f078e3..f3865fb15 100755 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -59,7 +59,8 @@ TESTS = definitions.sh \ grib_statistics.sh \ grib_tigge.sh \ grib_uerra.sh \ - grib_tigge_conversions.sh \ + grib_tigge_conversions1.sh \ + grib_tigge_conversions2.sh \ read_any.sh \ grib_padding.sh \ grib_grid_lamb_az_eq_area.sh \ diff --git a/tests/grib_tigge_conversions.sh b/tests/grib_tigge_conversions1.sh similarity index 91% rename from tests/grib_tigge_conversions.sh rename to tests/grib_tigge_conversions1.sh index e63f1da40..9fad13fe1 100755 --- a/tests/grib_tigge_conversions.sh +++ b/tests/grib_tigge_conversions1.sh @@ -16,14 +16,15 @@ REDIRECT=/dev/null +label="grib_tigge_conv1" dir="${data_dir}/tigge" -temp1="temp.grib1_" -temp2="temp.grib2_" +temp1="temp.${label}.grib1_" +temp2="temp.${label}.grib2_" # --- Do I want to exclude any file pattern from the comparison ? exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf" -for file in ${dir}/tigge_*.grib; do +for file in ${dir}/tigge_[a-e]*.grib; do exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "` if [ -z "$exclude" ]; then rm -f ${temp1} ${temp2} diff --git a/tests/grib_tigge_conversions2.sh b/tests/grib_tigge_conversions2.sh new file mode 100755 index 000000000..718446bab --- /dev/null +++ b/tests/grib_tigge_conversions2.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# (C) Copyright 2005- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# +# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by +# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. +# + +# --- test grib edition 2 to 1 conversions with tigge data +# --- using the new features of grib_compare that allows +# --- namespace comparison + +. ./include.sh + +REDIRECT=/dev/null + +label="grib_tigge_conv2" +dir="${data_dir}/tigge" +temp1="temp.${label}.grib1_" +temp2="temp.${label}.grib2_" + +# --- Do I want to exclude any file pattern from the comparison ? +exclusion_pattern="tcw|ssr|str|skt|cap|ci|ttr|st|sm|sd|slhf|sshf" + +for file in ${dir}/tigge_[f-z]*.grib; do + exclude=`echo $file | awk " /$exclusion_pattern/ {print \"found\";} "` + if [ -z "$exclude" ]; then + rm -f ${temp1} ${temp2} + + # 2 to 1 conversion check + ${tools_dir}/grib_set -s editionNumber=1 ${file} ${temp1} 2> $REDIRECT > $REDIRECT + ${tools_dir}/grib_compare -P -c data:n,geography:n ${temp1} ${file} 2> $REDIRECT > $REDIRECT + + # 1 to 2 conversion check + ${tools_dir}/grib_set -s editionNumber=2 ${temp1} ${temp2} 2> $REDIRECT > $REDIRECT + ${tools_dir}/grib_compare -P -c shortName,data:n,geography:n ${temp2} ${file} 2> $REDIRECT > $REDIRECT + fi +done + +rm -f ${temp1} ${temp2}