Disable test if not configured

This commit is contained in:
Shahram Najm 2018-05-22 17:51:28 +01:00
parent 49249190f6
commit 0163d5164a
1 changed files with 9 additions and 27 deletions

View File

@ -10,37 +10,19 @@
. ./include.sh
#set -x
# First decide if we have NetCDF enabled from configure.
# Temporarily turn off the '-e' flag for set so we dont exit on error
set +e
tmp_out=tmp_msg.out
skip_test=0
rm -f $tmp_out
# Invoke the grib_to_netcdf command with no options. If NetCDF was enabled
# we get a usage message otherwise we get a specific message. Note: In both cases
# the command fails.
${tools_dir}/grib_to_netcdf > $tmp_out
grep 'ecCodes was not compiled with NETCDF enabled' $tmp_out > /dev/null
if [ $? -eq 0 ]; then
# Message was found
skip_test=1
fi
# Restore the set -e so any error causes us to exit
set -e
rm -f $tmp_out
if [ $skip_test -eq 1 ]; then
echo "NetCDF was not enabled. Skipping this test."
# Disable if autotools being used
src_config=${src_dir}/config.h
if [ -f ${src_config} ]; then
exit 0
fi
echo "NetCDF was enabled."
grib_files="\
regular_latlon_surface.grib2 \
regular_latlon_surface.grib1 \
regular_gaussian_model_level.grib1 \
regular_gaussian_pressure_level.grib2 \
regular_gaussian_surface.grib1 \
missing.grib2"
regular_latlon_surface.grib2 \
regular_latlon_surface.grib1 \
regular_gaussian_model_level.grib1 \
regular_gaussian_pressure_level.grib2 \
regular_gaussian_surface.grib1 \
missing.grib2"
ncf_types="NC_SHORT NC_INT NC_FLOAT NC_DOUBLE"