2016-05-04 11:17:06 +08:00
|
|
|
#!/bin/sh
|
2018-08-26 11:44:41 +08:00
|
|
|
# Author: Dennis Heimbigner
|
2016-05-04 11:17:06 +08:00
|
|
|
|
2018-04-18 04:23:52 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
2017-03-09 08:01:10 +08:00
|
|
|
. ../test_common.sh
|
2016-05-04 11:17:06 +08:00
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
set -e
|
|
|
|
echo ""
|
2016-05-04 11:17:06 +08:00
|
|
|
|
|
|
|
EXIT=0
|
|
|
|
|
2018-08-26 11:44:41 +08:00
|
|
|
NCF="./nc4_fileinfo.nc"
|
|
|
|
HDF="./hdf5_fileinfo.hdf"
|
|
|
|
|
|
|
|
NF="${top_srcdir}/ncdump/ref_tst_compounds4.nc"
|
|
|
|
NPV1="${top_srcdir}/ncdump/ref_provenance_v1.nc"
|
|
|
|
|
|
|
|
# Create various files
|
|
|
|
${execdir}/tst_fileinfo
|
2016-05-04 11:17:06 +08:00
|
|
|
|
2018-04-18 04:23:52 +08:00
|
|
|
# Do a false negative test
|
2018-08-26 11:44:41 +08:00
|
|
|
rm -f ./tst_fileinfo.tmp
|
|
|
|
if $NCDUMP -s $NF | fgrep '_IsNetcdf4 = 0' > ./tst_fileinfo.tmp ; then
|
2016-05-04 11:17:06 +08:00
|
|
|
echo "Pass: False negative for file: $NF"
|
|
|
|
else
|
|
|
|
echo "FAIL: False negative for file: $NF"
|
2018-08-26 11:44:41 +08:00
|
|
|
EXIT=1
|
2016-05-04 11:17:06 +08:00
|
|
|
fi
|
|
|
|
|
2018-08-26 11:44:41 +08:00
|
|
|
rm -f ./tst_fileinfo.tmp
|
|
|
|
if test -e $NCF ; then
|
2016-05-04 11:17:06 +08:00
|
|
|
# look at the _IsNetcdf4 flag
|
2017-03-09 08:01:10 +08:00
|
|
|
N_IS=`${NCDUMP} -s $NCF | fgrep '_IsNetcdf4' | tr -d ' ;'`
|
2016-05-04 11:17:06 +08:00
|
|
|
N_IS=`echo $N_IS | cut -d= -f2`
|
2017-03-09 08:01:10 +08:00
|
|
|
H_IS=`${NCDUMP} -s $HDF | fgrep '_IsNetcdf4' | tr -d ' ;'`
|
2016-05-04 11:17:06 +08:00
|
|
|
H_IS=`echo $H_IS | cut -d= -f2`
|
|
|
|
if test "x$N_IS" = 'x0' ;then
|
|
|
|
echo "FAIL: $NCF is marked as not netcdf-4"
|
2018-08-26 11:44:41 +08:00
|
|
|
EXIT=1
|
2016-05-04 11:17:06 +08:00
|
|
|
fi
|
|
|
|
if test "x$H_IS" = 'x1' ;then
|
|
|
|
echo "FAIL: $HDF is marked as netcdf-4"
|
2018-08-26 11:44:41 +08:00
|
|
|
EXIT=1
|
2016-05-04 11:17:06 +08:00
|
|
|
fi
|
|
|
|
else
|
2018-08-26 11:44:41 +08:00
|
|
|
echo "FAIL: tst_fileinfo: $NCF does not exist"
|
|
|
|
EXIT=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Test what happens when we read a file that used provenance version 1
|
|
|
|
rm -f ./tst_fileinfo.tmp ./tst_fileinfo2.tmp
|
|
|
|
$NCDUMP -hs $NPV1 >tst_fileinfo2.tmp
|
|
|
|
fgrep '_NCProperties' <tst_fileinfo2.tmp > ./tst_fileinfo.tmp
|
|
|
|
if ! fgrep 'version=1' tst_fileinfo.tmp ; then
|
|
|
|
echo "FAIL: $NPV1 is not marked as version=1"
|
|
|
|
EXIT=1
|
2016-05-04 11:17:06 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $NCF
|
|
|
|
rm -f $HDF
|
2019-01-21 01:02:31 +08:00
|
|
|
rm -f tst_fileinfo.tmp tst_fileinfo2.tmp
|
2016-05-04 11:17:06 +08:00
|
|
|
|
2018-08-26 11:44:41 +08:00
|
|
|
if test "x$EXIT" = x0 ; then
|
|
|
|
echo "*** Pass all tests"
|
|
|
|
fi
|
2016-05-04 11:17:06 +08:00
|
|
|
exit $EXIT
|