2023-03-14 03:24:14 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
|
|
. ../test_common.sh
|
|
|
|
|
|
|
|
. "$srcdir/test_nczarr.sh"
|
|
|
|
|
2023-04-26 07:15:06 +08:00
|
|
|
# Build both ISOPATH and S3ISOPATH
|
|
|
|
s3isolate "testdir_notzarr"
|
|
|
|
THISDIR=`pwd`
|
|
|
|
cd $ISOPATH
|
|
|
|
|
2023-03-14 03:24:14 +08:00
|
|
|
# Test ability to detect NCZarr/Zarr files
|
|
|
|
|
|
|
|
URL="${NCZARR_S3_TEST_HOST}/${NCZARR_S3_TEST_BUCKET}"
|
2023-04-26 07:15:06 +08:00
|
|
|
KEY="/${S3ISOPATH}"
|
2023-03-14 03:24:14 +08:00
|
|
|
|
|
|
|
sometestfailed=
|
|
|
|
|
|
|
|
testfailed() {
|
|
|
|
if test "x$1" != "x-51" ; then
|
|
|
|
echo "*** Failed"
|
|
|
|
sometestfailed=1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Make test sets
|
2023-04-26 07:15:06 +08:00
|
|
|
cp ${srcdir}/ref_notzarr.tar.gz .
|
|
|
|
gunzip ref_notzarr.tar.gz
|
|
|
|
tar -xf ref_notzarr.tar
|
2023-03-14 03:24:14 +08:00
|
|
|
if test "x$FEATURE_S3TESTS" = xyes ; then
|
2023-04-26 07:15:06 +08:00
|
|
|
${execdir}/s3util -f notzarr.file/notzarr.txt -u "https://${URL}" -k "/${S3ISOPATH}/notzarr.s3/notzarr.txt" upload
|
2023-03-14 03:24:14 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Test empty file"
|
|
|
|
RET=`${execdir}/tst_notzarr "file://empty.file#mode=zarr,file"`
|
|
|
|
testfailed "$RET"
|
|
|
|
echo "Test non-zarr file"
|
|
|
|
RET=`${execdir}/tst_notzarr "file://notzarr.file#mode=zarr,file"`
|
|
|
|
testfailed "$RET"
|
|
|
|
|
|
|
|
if test "x$FEATURE_NCZARR_ZIP" = xyes ; then
|
|
|
|
echo "Test empty zip file"
|
|
|
|
RET=`${execdir}/tst_notzarr "file://empty.zip#mode=zarr,zip"`
|
|
|
|
testfailed "$RET"
|
|
|
|
echo "Test non-zarr zip file"
|
|
|
|
RET=`${execdir}/tst_notzarr "file://notzarr.zip#mode=zarr,zip"`
|
|
|
|
testfailed "$RET"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$FEATURE_S3TESTS" = xyes ; then
|
|
|
|
if test 1 = 0 ; then
|
|
|
|
# This test is NA for S3
|
|
|
|
echo "Test empty S3 file"
|
2023-04-26 07:15:06 +08:00
|
|
|
KEY2="${KEY}/empty.s3"
|
|
|
|
RET=`${execdir}/tst_notzarr "https://$URL${KEY2}#mode=zarr,s3"`
|
2023-03-14 03:24:14 +08:00
|
|
|
testfailed "$RET"
|
|
|
|
fi
|
|
|
|
echo "Test non-zarr S3 file"
|
2023-04-26 07:15:06 +08:00
|
|
|
RET=`${execdir}/tst_notzarr "https://$URL/${S3ISOPATH}/notzarr.s3#mode=zarr,s3"`
|
2023-03-14 03:24:14 +08:00
|
|
|
testfailed "$RET"
|
|
|
|
fi
|
|
|
|
|
2023-04-26 07:15:06 +08:00
|
|
|
if test "x$FEATURE_S3TESTS" = xyes ; then s3sdkdelete "/${S3ISOPATH}" ; fi # Cleanup
|