2012-03-26 09:34:32 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
2012-03-26 09:34:32 +08:00
|
|
|
set -e
|
2018-10-11 03:32:17 +08:00
|
|
|
|
2012-04-10 06:03:02 +08:00
|
|
|
# Get the target OS and CPU
|
|
|
|
CPU=`uname -p`
|
|
|
|
OS=`uname`
|
|
|
|
|
2012-03-26 09:34:32 +08:00
|
|
|
#Constants
|
|
|
|
FILE1=tst_diskless.nc
|
|
|
|
FILE2=tst_diskless2.nc
|
2012-04-09 06:47:38 +08:00
|
|
|
FILE3=tst_diskless3.nc
|
2012-03-26 09:34:32 +08:00
|
|
|
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "*** Testing in-memory (diskless) files with and without persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF classic file without persistence"
|
2017-03-09 08:01:10 +08:00
|
|
|
${execdir}/tst_diskless
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: diskless netCDF classic file without persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
|
2020-08-18 09:15:47 +08:00
|
|
|
if test "x$FEATURE_HDF5" = "xyes" ; then
|
2012-03-26 09:34:32 +08:00
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF enhanced file without persistence"
|
2017-03-09 08:01:10 +08:00
|
|
|
${execdir}/tst_diskless netcdf4
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: diskless netCDF enhanced file without persistence"
|
2020-08-18 09:15:47 +08:00
|
|
|
fi #FEATURE_HDF5
|
2012-03-26 09:34:32 +08:00
|
|
|
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF classic file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
rm -f $FILE1
|
2017-03-09 08:01:10 +08:00
|
|
|
${execdir}/tst_diskless persist
|
2012-03-26 09:34:32 +08:00
|
|
|
if test -f $FILE1 ; then
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** $FILE1 created"
|
2017-04-04 11:39:44 +08:00
|
|
|
# ${NCDUMP} $FILE1
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: diskless netCDF classic file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
else
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "#### $FILE1 not created"
|
|
|
|
echo "FAIL: diskless netCDF classic file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
fi
|
|
|
|
|
2020-08-18 09:15:47 +08:00
|
|
|
if test "x$FEATURE_HDF5" = "xyes" ; then
|
2012-03-26 09:34:32 +08:00
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF enhanced file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
rm -f $FILE1
|
2017-03-09 08:01:10 +08:00
|
|
|
${execdir}/tst_diskless netcdf4 persist
|
2012-03-26 09:34:32 +08:00
|
|
|
if test -f $FILE1 ; then
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** $FILE1 created"
|
2017-04-04 11:39:44 +08:00
|
|
|
# ${NCDUMP} $FILE1
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: diskless netCDF enhanced file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
else
|
|
|
|
echo "$FILE1 not created"
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "FAIL: diskless netCDF enhanced file with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
fi
|
|
|
|
|
2020-08-18 09:15:47 +08:00
|
|
|
fi #FEATURE_HDF5
|
2012-03-26 09:34:32 +08:00
|
|
|
|
|
|
|
# Do extended netcdf enhanced test
|
2020-08-18 09:15:47 +08:00
|
|
|
if test "x$FEATURE_HDF5" = "xyes" ; then
|
2012-03-26 09:34:32 +08:00
|
|
|
|
|
|
|
ok=""
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test extended enhanced diskless netCDF with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
rm -f $FILE2 tst_diskless2.cdl
|
2017-03-09 08:01:10 +08:00
|
|
|
${execdir}/tst_diskless2
|
2012-03-26 09:34:32 +08:00
|
|
|
if test -f $FILE2 ; then
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** $FILE2 created"
|
2012-03-26 09:34:32 +08:00
|
|
|
# Do a cyle test
|
2017-03-09 08:01:10 +08:00
|
|
|
if ${NCDUMP} $FILE2 |sed -e s/tst_diskless2/tmp1/ > tmp1.cdl ; then
|
|
|
|
if ${NCGEN} -k nc4 -o tmp1.nc tmp1.cdl ;then
|
|
|
|
if ${NCDUMP} tmp1.nc >tmp2.cdl ; then
|
2012-03-26 09:34:32 +08:00
|
|
|
if diff -wb tmp1.cdl tmp2.cdl ; then
|
|
|
|
ok=yes
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "#### $FILE2 not created"
|
2012-03-26 09:34:32 +08:00
|
|
|
fi
|
2019-04-20 10:32:26 +08:00
|
|
|
exit
|
2012-03-26 09:34:32 +08:00
|
|
|
rm -f tmp1.cdl tmp2.cdl tmp1.nc tmp2.nc
|
|
|
|
|
|
|
|
if test "x$ok" = xyes ; then
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: extended enhanced diskless netCDF with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
else
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "FAIL: extended enhanced diskless netCDF with persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
fi
|
|
|
|
|
2020-08-18 09:15:47 +08:00
|
|
|
fi #FEATURE_HDF5
|
2012-04-09 06:47:38 +08:00
|
|
|
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Testing nc_open in-memory (diskless) files"
|
2012-04-09 06:47:38 +08:00
|
|
|
|
|
|
|
# clear old files
|
|
|
|
rm -f tst_diskless3_file.cdl tst_diskless3_memory.cdl
|
|
|
|
|
|
|
|
echo ""
|
2018-10-11 03:32:17 +08:00
|
|
|
echo "**** Create baseline cdl"
|
2012-04-09 06:47:38 +08:00
|
|
|
rm -f $FILE3
|
2019-04-20 10:32:26 +08:00
|
|
|
${execdir}/tst_diskless3 file file:$FILE3
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCDUMP} $FILE3 >tst_diskless3_file.cdl
|
2012-04-09 06:47:38 +08:00
|
|
|
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Create and modify file using diskless"
|
2012-04-09 06:47:38 +08:00
|
|
|
rm -f $FILE3
|
2019-04-20 10:32:26 +08:00
|
|
|
${execdir}/tst_diskless3 diskless persist file:$FILE3
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCDUMP} $FILE3 >tst_diskless3_memory.cdl
|
2012-04-09 06:47:38 +08:00
|
|
|
|
|
|
|
# compare
|
|
|
|
diff tst_diskless3_file.cdl tst_diskless3_memory.cdl
|
|
|
|
|
|
|
|
# cleanup
|
2019-04-20 10:32:26 +08:00
|
|
|
rm -f $FILE1 $FILE2 $FILE3 tst_diskless3_file.cdl tst_diskless3_memory.cdl
|
2012-04-09 06:47:38 +08:00
|
|
|
|
2017-12-07 06:00:21 +08:00
|
|
|
exit 0
|