2012-03-26 09:34:32 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
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
|
|
|
|
|
|
|
HASNC4=`../nc-config --has-nc4`
|
|
|
|
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF classic file without persistence"
|
2012-04-09 06:47:38 +08:00
|
|
|
./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
|
|
|
|
|
|
|
if test "x$HASNC4" = "xyes" ; then
|
|
|
|
echo ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Test diskless netCDF enhanced file without persistence"
|
2012-04-09 06:47:38 +08:00
|
|
|
./tst_diskless netcdf4
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "PASS: diskless netCDF enhanced file without persistence"
|
2012-03-26 09:34:32 +08:00
|
|
|
fi #HASNC4
|
|
|
|
|
|
|
|
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
|
2012-04-09 06:47:38 +08:00
|
|
|
./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"
|
|
|
|
# ../ncdump/ncdump $FILE1
|
|
|
|
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
|
|
|
|
|
|
|
|
if test "x$HASNC4" = "xyes" ; then
|
|
|
|
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
|
2012-04-09 06:47:38 +08:00
|
|
|
./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"
|
|
|
|
# ../ncdump/ncdump $FILE1
|
|
|
|
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
|
|
|
|
|
|
|
|
fi #HASNC4
|
|
|
|
|
|
|
|
# Do extended netcdf enhanced test
|
|
|
|
if test "x$HASNC4" = "xyes" ; then
|
|
|
|
|
|
|
|
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
|
2012-04-09 06:47:38 +08:00
|
|
|
./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
|
|
|
|
if ../ncdump/ncdump $FILE2 |sed -e s/tst_diskless2/tmp1/ > tmp1.cdl ; then
|
2014-12-29 13:42:05 +08:00
|
|
|
if ../ncgen/ncgen -k nc4 -o tmp1.nc tmp1.cdl ;then
|
2012-03-26 09:34:32 +08:00
|
|
|
if ../ncdump/ncdump tmp1.nc >tmp2.cdl ; then
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
|
fi #HASNC4
|
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 ""
|
2012-06-13 05:50:02 +08:00
|
|
|
echo "**** Create and modify file without using diskless"
|
2012-04-09 06:47:38 +08:00
|
|
|
rm -f $FILE3
|
|
|
|
./tst_diskless3
|
|
|
|
../ncdump/ncdump $FILE3 >tst_diskless3_file.cdl
|
|
|
|
|
|
|
|
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
|
|
|
|
./tst_diskless3 diskless
|
|
|
|
../ncdump/ncdump $FILE3 >tst_diskless3_memory.cdl
|
|
|
|
|
|
|
|
# compare
|
|
|
|
diff tst_diskless3_file.cdl tst_diskless3_memory.cdl
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
rm -f $FILE3 tst_diskless3_file.cdl tst_diskless3_memory.cdl
|
|
|
|
|
|
|
|
exit
|