Add test cases

This commit is contained in:
Dennis Heimbigner 2021-08-10 14:15:24 -06:00
parent 42854d19de
commit 3b13943e4d
11 changed files with 219 additions and 7 deletions

View File

@ -90,6 +90,7 @@ IF(ENABLE_TESTS)
add_sh_test(nczarr_test run_purezarr)
add_sh_test(nczarr_test run_interop)
add_sh_test(nczarr_test run_misc)
add_sh_test(nczarr_test run_nczarr_fill)
if(ENABLE_NCZARR_S3)
add_sh_test(nczarr_test run_s3_cleanup)

View File

@ -58,6 +58,7 @@ TESTS += run_chunkcases.sh
TESTS += run_purezarr.sh
TESTS += run_interop.sh
TESTS += run_misc.sh
TESTS += run_nczarr_fill.sh
endif
@ -108,7 +109,7 @@ ncdumpchunks_SOURCES = ncdumpchunks.c
EXTRA_DIST = CMakeLists.txt \
run_ut_map.sh run_ut_mapapi.sh run_ut_misc.sh run_ut_chunk.sh run_ncgen4.sh \
run_nccopyz.sh run_fillonlyz.sh run_chunkcases.sh test_nczarr.sh run_perf_chunks1.sh run_s3_cleanup.sh \
run_purezarr.sh run_interop.sh run_misc.sh run_newformat.sh
run_purezarr.sh run_interop.sh run_misc.sh run_newformat.sh run_nczarr_fill.sh
EXTRA_DIST += \
ref_ut_map_create.cdl ref_ut_map_writedata.cdl ref_ut_map_writemeta2.cdl ref_ut_map_writemeta.cdl \
@ -125,7 +126,9 @@ ref_misc1.cdl ref_misc1.dmp ref_misc2.cdl \
ref_avail1.cdl ref_avail1.dmp ref_avail1.txt \
ref_xarray.cdl ref_purezarr.cdl ref_purezarr_base.cdl ref_nczarr2zarr.cdl \
ref_power_901_constants.zip ref_power_901_constants.cdl ref_quotes.zip ref_quotes.cdl \
ref_oldformat.cdl ref_oldformat.zip ref_newformatpure.cdl
ref_oldformat.cdl ref_oldformat.zip ref_newformatpure.cdl \
ref_groups.h5 ref_byte.zarr.zip ref_byte_fill_value_null.zarr.zip \
ref_groups_regular.cdl ref_byte.cdl ref_byte_fill_value_null.cdl
CLEANFILES = ut_*.txt ut*.cdl tmp*.nc tmp*.cdl tmp*.txt tmp*.dmp tmp*.zip tmp*.nc

34
nczarr_test/ref_byte.cdl Normal file
View File

@ -0,0 +1,34 @@
netcdf ref_byte {
dimensions:
.zdim_20 = 20 ;
variables:
ubyte byte(.zdim_20, .zdim_20) ;
byte:_Storage = "chunked" ;
byte:_ChunkSizes = 20, 20 ;
// global attributes:
:_Format = "netCDF-4" ;
data:
byte =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
}

Binary file not shown.

View File

@ -0,0 +1,55 @@
netcdf ref_byte_fill_value_null {
dimensions:
.zdim_20 = 20 ;
variables:
ubyte byte(.zdim_20, .zdim_20) ;
byte:_Storage = "chunked" ;
byte:_ChunkSizes = 20, 20 ;
byte:_NoFill = "true" ;
// global attributes:
:_Format = "netCDF-4" ;
data:
byte =
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255 ;
}

Binary file not shown.

BIN
nczarr_test/ref_groups.h5 Executable file

Binary file not shown.

View File

@ -0,0 +1,45 @@
netcdf tmp_groups_regular {
dimensions:
.zdim_3 = 3 ;
.zdim_2 = 2 ;
.zdim_10 = 10 ;
// global attributes:
:_Format = "netCDF-4" ;
group: MyGroup {
variables:
int dset1(.zdim_3, .zdim_3) ;
dset1:_Storage = "chunked" ;
dset1:_ChunkSizes = 3, 3 ;
dset1:_NoFill = "true" ;
// group attributes:
data:
dset1 =
1, 2, 3,
1, 2, 3,
1, 2, 3 ;
group: Group_A {
variables:
int dset2(.zdim_2, .zdim_10) ;
dset2:_Storage = "chunked" ;
dset2:_ChunkSizes = 2, 10 ;
dset2:_NoFill = "true" ;
// group attributes:
data:
dset2 =
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
} // group Group_A
group: Group_B {
// group attributes:
} // group Group_B
} // group MyGroup
}

View File

@ -54,11 +54,15 @@ diff -wb ${abs_srcdir}/ref_misc2.cdl tmp_misc2_$zext.cdl
}
testcase1 file
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testcase1 zip; fi
if test "x$FEATURE_S3TESTS" = xyes ; then testcase1 s3; fi
testcase2 file
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testcase2 zip; fi
if test "x$FEATURE_S3TESTS" = xyes ; then testcase2 s3; fi
exit 0
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then
testcase1 zip
testcase2 zip
fi
if test "x$FEATURE_S3TESTS" = xyes ; then
testcase1 s3
testcase2 s3
fi
exit 0

59
nczarr_test/run_nczarr_fill.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
. "$srcdir/test_nczarr.sh"
set -e
echo "*** Test: Github issues #2063, #2062, #2059"
testcase2059() {
zext=$1
echo "*** Test: Github issue #2059"
fileargs tmp_groups_regular "mode=zarr,$zext"
deletemap $zext $file
${NCCOPY} ${srcdir}/ref_groups.h5 "$fileurl"
rm -f tmp.cdl
${NCDUMP} -s -n tmp_groups_regular "$fileurl" > tmp.cdl
sclean tmp.cdl tmp_groups_regular_$zext.cdl
diff -wb ${srcdir}/ref_groups_regular.cdl tmp_groups_regular_$zext.cdl
}
testcase2062() {
zext=$1
echo "*** Test: Github issue #2062"
rm -fr ref_byte.zarr
unzip ${srcdir}/ref_byte.zarr.zip
rm -fr tmp.cdl
${NCDUMP} -s "file://ref_byte.zarr#mode=zarr,$zext" > tmp.cdl
sclean tmp.cdl tmp_byte_$zext.cdl
diff -wb ${srcdir}/ref_byte.cdl tmp_byte_$zext.cdl
rm -fr ref_byte.zarr
}
testcase2063() {
zext=$1
echo "*** Test: Github issue #2063"
rm -fr ref_byte_fill_value_null.zarr
unzip ${srcdir}/ref_byte_fill_value_null.zarr.zip
rm -fr tmp.cdl
${NCDUMP} -s "file://ref_byte_fill_value_null.zarr#mode=zarr,$zext" > tmp.cdl
sclean tmp.cdl tmp_byte_fill_value_null_$zext.cdl
diff -wb ${srcdir}/ref_byte_fill_value_null.cdl tmp_byte_fill_value_null_$zext.cdl
rm -fr ref_byte_fill_value_null.zarr
}
#testcase2059 file
#testcase2062 file
testcase2063 file
exit 0
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then
testcase2059 zip
fi
if test "x$FEATURE_S3TESTS" = xyes ; then
testcase2059 s3
fi
exit 0

View File

@ -126,6 +126,17 @@ for t in ${TESTS} ; do
done
}
# Function to remove selected -s attributes from file;
# These attributes might be platform dependent
sclean() {
cat $1 \
| sed -e '/:_IsNetcdf4/d' \
| sed -e '/:_Endianness/d' \
| sed -e '/_NCProperties/d' \
| sed -e '/_SuperblockVersion/d' \
| cat > $2
}
# Make sure execdir and srcdir absolute paths are available
WD=`pwd`
cd $srcdir ; abs_srcdir=`pwd` ; cd $WD