2010-06-03 21:24:43 +08:00
|
|
|
#!/bin/sh
|
2015-11-20 04:44:07 +08:00
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2014-09-19 08:26:06 +08:00
|
|
|
. ${srcdir}/tst_ncgen_shared.sh
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
ALLXFAIL="${XFAILTESTS} ${SPECIALTESTS}"
|
|
|
|
|
|
|
|
if test "${MODE}" = 3 ; then
|
|
|
|
if test "${KFLAG}" = 4 ; then
|
|
|
|
TESTSET="${TESTS3} ${SPECIALTESTS3}"
|
|
|
|
else
|
|
|
|
TESTSET="${TESTS3}"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
TESTSET="${TESTS3} ${TESTS4} ${ALLXFAIL}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "*** Testing ncgen with -k${KFLAG}"
|
|
|
|
|
2017-11-17 23:22:49 +08:00
|
|
|
mkdir ${RESULTSDIR}
|
2010-06-03 21:24:43 +08:00
|
|
|
cd ${RESULTSDIR}
|
|
|
|
for x in ${TESTSET} ; do
|
2015-11-20 04:44:07 +08:00
|
|
|
if test $verbose = 1 ; then echo "*** Testing: ${x}" ; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
# determine if we need the specflag set
|
|
|
|
specflag=
|
|
|
|
headflag=
|
|
|
|
for s in ${SPECIALTESTS} ; do
|
|
|
|
if test "x${s}" = "x${x}" ; then specflag="-s"; headflag="-h"; fi
|
|
|
|
done
|
|
|
|
# determine if this is an xfailtest
|
|
|
|
isxfail=
|
|
|
|
for t in ${ALLXFAIL} ; do
|
|
|
|
if test "x${t}" = "x${x}" ; then isxfail=1; fi
|
|
|
|
done
|
|
|
|
rm -f ${x}.nc ${x}.dmp
|
2017-11-25 22:28:07 +08:00
|
|
|
${NCGEN} -b -k${KFLAG} -o ${x}_$$.nc ${cdl}/${x}.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
# dump .nc file
|
2012-05-26 05:22:09 +08:00
|
|
|
# if windows, we need to remove any leading 0's in exponents.
|
2017-11-25 22:28:07 +08:00
|
|
|
${NCDUMP} ${headflag} ${specflag} -n ${x} ${x}_$$.nc | sed 's/e+0/e+/g' > ${x}.dmp
|
2010-06-03 21:24:43 +08:00
|
|
|
# compare the expected (silently if XFAIL)
|
|
|
|
if test "x$isxfail" = "x1" -a "x$SHOWXFAILS" = "x" ; then
|
2023-04-26 07:15:06 +08:00
|
|
|
if diff -b -bw ${expected}/${x}.dmp ${x}.dmp &>/dev/null ; then ok=1; else ok=0; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
else
|
2012-05-09 03:36:27 +08:00
|
|
|
if diff -b -w ${expected}/${x}.dmp ${x}.dmp ; then ok=1; else ok=0; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
fi
|
|
|
|
if test "x$ok" = "x1" ; then
|
|
|
|
test $verbose = 1 && echo "*** SUCCEED: ${x}"
|
|
|
|
passcount=`expr $passcount + 1`
|
|
|
|
elif test "x${isxfail}" = "x1" ; then
|
2012-08-01 04:34:13 +08:00
|
|
|
echo "*** XFAIL : ${x}"
|
2010-06-03 21:24:43 +08:00
|
|
|
xfailcount=`expr $xfailcount + 1`
|
|
|
|
else
|
|
|
|
echo "*** FAIL: ${x}"
|
|
|
|
failcount=`expr $failcount + 1`
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
totalcount=`expr $passcount + $failcount + $xfailcount`
|
|
|
|
okcount=`expr $passcount + $xfailcount`
|
2015-11-20 04:44:07 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
|
2017-11-17 23:22:49 +08:00
|
|
|
rm -rf ${RESULTSDIR}
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
if test $failcount -gt 0 ; then
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|