Testing: enable pipefail to catch errors in pipes

This commit is contained in:
Shahram Najm 2022-03-25 20:41:34 +00:00
parent 9f349eda0f
commit e921375b5b
5 changed files with 11 additions and 6 deletions

View File

@ -43,11 +43,14 @@ file="aaen_55.bufr"
export ECCODES_DEBUG=1
# By default debug output goes to stderr
${tools_dir}/bufr_dump -O ${data_dir}/bufr/$file 2>&1 | grep -q "parsing include file"
${tools_dir}/bufr_dump -O ${data_dir}/bufr/$file > $fLog 2>&1
grep -q "parsing include file" $fLog
# Redirect it to stdout
rm $fLog
export ECCODES_LOG_STREAM=stdout
${tools_dir}/bufr_dump -O ${data_dir}/bufr/$file | grep -q "parsing include file"
${tools_dir}/bufr_dump -O ${data_dir}/bufr/$file > $fLog
grep -q "parsing include file" $fLog
unset ECCODES_DEBUG
unset ECCODES_LOG_STREAM

View File

@ -13,10 +13,9 @@
REDIRECT=/dev/null
[ -z "$ECCODES_DEFINITION_PATH" ] | ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
[ -z "$ECCODES_DEFINITION_PATH" ] || ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
for file in `find ${ECCODES_DEFINITION_PATH}/ -name '*.def' -print | grep -v grib3/`
do
${tools_dir}/codes_parser $file > $REDIRECT
done

View File

@ -90,7 +90,8 @@ done
# GRIB-943: centre code table
# ----------------------------
${tools_dir}/grib_set -s centre=289 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $outfile
${tools_dir}/grib_dump -O $outfile | grep -q 'centre = 289.*Zambia'
${tools_dir}/grib_dump -O $outfile > $temp
grep -q 'centre = 289.*Zambia' $temp
# ECC-539: avoid output being the same as input
# -----------------------------------------------

View File

@ -1,4 +1,6 @@
set -ea
set -o pipefail
# For CMake
# Unset any environment variable that could interfere with tests

View File

@ -13,7 +13,7 @@
OUTPUT=all_codetable_flagtable_keys.txt
TEMP=temp.list_codetable_flagtable_keys.txt
[ -z "$ECCODES_DEFINITION_PATH" ] | ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
[ -z "$ECCODES_DEFINITION_PATH" ] || ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
touch $TEMP
echo "Go through all files in $ECCODES_DEFINITION_PATH ..."