2020-12-17 11:48:02 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
2020-12-20 12:17:46 +08:00
|
|
|
. ${srcdir}/test_nczarr.sh
|
|
|
|
|
2020-12-17 11:48:02 +08:00
|
|
|
set -e
|
|
|
|
|
2020-12-20 12:17:46 +08:00
|
|
|
#zext=nc4
|
|
|
|
zext=nzf
|
|
|
|
|
2020-12-17 11:48:02 +08:00
|
|
|
alias zc='../ncdump/.libs/ncdumpchunks -v v'
|
|
|
|
|
2020-12-20 12:17:46 +08:00
|
|
|
TC="${execdir}/tst_chunkcases -4"
|
2020-12-17 11:48:02 +08:00
|
|
|
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile() {
|
|
|
|
fileargs $1
|
|
|
|
case "$zext" in
|
|
|
|
nc4) F=$file;;
|
|
|
|
nzf) F=$fileurl;;
|
|
|
|
*) echo "no such extension: $zext" ; exit 1;;
|
|
|
|
esac
|
|
|
|
}
|
2020-12-17 11:48:02 +08:00
|
|
|
|
|
|
|
# Test whole variable write and read
|
2020-12-20 12:17:46 +08:00
|
|
|
|
|
|
|
if test "x$zext" != xnc4 ; then
|
2020-12-17 11:48:02 +08:00
|
|
|
echo "Test whole variable write then read"
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile tmp_whole
|
2020-12-17 11:48:02 +08:00
|
|
|
rm -f tmp_whole.txt tmp_whole.cdl
|
|
|
|
$TC -d 6,6 -c 6,6 -X w -OWw $F
|
|
|
|
$TC -d 6,6 -c 6,6 -X w -OWr $F > tmp_whole.txt
|
|
|
|
diff -b ${srcdir}/ref_whole.txt tmp_whole.txt
|
|
|
|
${NCDUMP} $F > tmp_whole.cdl
|
|
|
|
diff -b ${srcdir}/ref_whole.cdl tmp_whole.cdl
|
2020-12-20 12:17:46 +08:00
|
|
|
fi
|
2020-12-17 11:48:02 +08:00
|
|
|
|
|
|
|
# Test skipping whole chunks
|
|
|
|
echo "Test chunk skipping during read"
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile tmp_skip
|
2020-12-17 11:48:02 +08:00
|
|
|
rm -f tmp_skip.txt tmp_skip.cdl tmp_skipw.cdl
|
|
|
|
$TC -d 6,6 -c 2,2 -Ow $F
|
|
|
|
$TC -s 5,5 -p 6,6 -Or $F > tmp_skip.txt
|
|
|
|
${NCDUMP} $F > tmp_skip.cdl
|
|
|
|
diff -b ${srcdir}/ref_skip.txt tmp_skip.txt
|
|
|
|
diff -b ${srcdir}/ref_skip.cdl tmp_skip.cdl
|
|
|
|
|
|
|
|
echo "Test chunk skipping during write"
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile tmp_skipw
|
2020-12-17 11:48:02 +08:00
|
|
|
rm -f tmp_skipw.cdl
|
|
|
|
$TC -d 6,6 -s 5,5 -p 6,6 -Ow $F
|
|
|
|
${NCDUMP} $F > tmp_skipw.cdl
|
|
|
|
diff -b ${srcdir}/ref_skipw.cdl tmp_skipw.cdl
|
|
|
|
|
|
|
|
echo "Test dimlen % chunklen != 0"
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile tmp_rem
|
2020-12-17 11:48:02 +08:00
|
|
|
rm -f tmp_rem.txt tmp_rem.cdl
|
|
|
|
$TC -d 8,8 -c 3,3 -Ow $F
|
|
|
|
${NCDUMP} $F > tmp_rem.cdl
|
|
|
|
diff -b ${srcdir}/ref_rem.cdl tmp_rem.cdl
|
|
|
|
${execdir}/ncdumpchunks -v v $F > tmp_rem.txt
|
|
|
|
diff -b ${srcdir}/ref_rem.txt tmp_rem.txt
|
|
|
|
|
|
|
|
echo "Test rank > 2"
|
2020-12-20 12:17:46 +08:00
|
|
|
makefile tmp_ndims
|
2020-12-17 11:48:02 +08:00
|
|
|
rm -f tmp_ndims.txt tmp_ndims.cdl
|
|
|
|
$TC -d 8,8,8,8 -c 3,3,4,4 -Ow $F
|
|
|
|
${NCDUMP} $F > tmp_ndims.cdl
|
|
|
|
diff -b ${srcdir}/ref_ndims.cdl tmp_ndims.cdl
|
|
|
|
${execdir}/ncdumpchunks -v v $F > tmp_ndims.txt
|
|
|
|
diff -b ${srcdir}/ref_ndims.txt tmp_ndims.txt
|
2020-12-20 12:17:46 +08:00
|
|
|
|
|
|
|
echo "Test miscellaneous 1"
|
|
|
|
makefile tmp_misc1
|
|
|
|
rm -f tmp_misc1.txt tmp_misc1.cdl
|
|
|
|
$TC -d 6,12,4 -c 2,3,1 -f 0,0,0 -e 6,1,4 -Ow $F
|
|
|
|
${NCDUMP} $F > tmp_misc1.cdl
|
|
|
|
diff -b ${srcdir}/ref_misc1.cdl tmp_misc1.cdl
|
|
|
|
${execdir}/ncdumpchunks -v v $F > tmp_misc1.txt
|
|
|
|
diff -b ${srcdir}/ref_misc1.txt tmp_misc1.txt
|