From 600885cb34b88c4083425f9f1580e3d9cea6af70 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Fri, 16 Sep 2022 18:35:08 -0600 Subject: [PATCH 1/2] update file permission --- nczarr_test/run_unknown.sh | 110 +++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 nczarr_test/run_unknown.sh diff --git a/nczarr_test/run_unknown.sh b/nczarr_test/run_unknown.sh new file mode 100755 index 0000000000..6e01131241 --- /dev/null +++ b/nczarr_test/run_unknown.sh @@ -0,0 +1,110 @@ +#!/bin/bash +TESTNCZARR=1 +#!/bin/bash + +if test "x$srcdir" = x ; then srcdir=`pwd`; fi +. ../test_common.sh + +if test "x$TESTNCZARR" = x1 ; then +. "$srcdir/test_nczarr.sh" +fi + +set -e + +# Load the findplugins function +. ${builddir}/findplugin.sh +echo "findplugin.sh loaded" + +# Set up HDF5_PLUGIN_PATH +export HDF5_PLUGIN_PATH=${HDF5_PLUGIN_DIR} + +# Test operation with an unknown filter + +# 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 +} + +# Function to extract _Filter attribute from a file +# These attributes might be platform dependent +getfilterattr() { +sed -e '/var.*:_Filter/p' -ed <$1 >$2 +} + +# Function to extract _Codecs attribute from a file +# These attributes might be platform dependent +getcodecsattr() { +sed -e '/var.*:_Codecs/p' -ed <$1 >$2 +} + +trimleft() { +sed -e 's/[ ]*\([^ ].*\)/\1/' <$1 >$2 +} + +# Locate the plugin path and the library names; argument order is critical + +# Find noop and capture +findplugin h5unknown +UNKNOWNDIR="${HDF5_PLUGIN_DIR}" +UNKNOWNLIB="${HDF5_PLUGIN_LIB}" +UNKNOWNFILTER="${HDF5_PLUGIN_DIR}/${UNKNOWNLIB}" + +# Getting the name is especially tricky for dylib, which puts the version before the .dylib + +# Verify +if ! test -f ${UNKNOWNFILTER} ; then echo "Unable to locate ${UNKNOWNFILTER}"; exit 1; fi + +testunk() { +zext=$1 +echo "*** Testing access to filter info when filter implementation is not available for map $zext" +if test "x$TESTNCZARR" = x1 ; then +fileargs tmp_known +deletemap $zext $file +else +file="tmp_known_${zfilt}.nc" +rm -f $file +fileurl="$file" +fi +# build .nc file using unknown +${NCGEN} -lb -4 -o $fileurl ${srcdir}/../nc_test4/unknown.cdl +# dump and clean file when filter is avail +${NCDUMP} -hs $fileurl > ./tmp_known_$zext.txt +# Remove irrelevant -s output +sclean ./tmp_known_$zext.txt tmp_known_$zext.dump +# Hide the filter +rm -fr ${UNKNOWNDIR}/save +mkdir -p ${UNKNOWNDIR}/save +# Figure out all matching libs; make sure to remove .so, so.0, etc +LSRC=`${execdir}/../ncdump/ncpathcvt -F "${UNKNOWNDIR}"` +LDST=`${execdir}/../ncdump/ncpathcvt -F ${UNKNOWNDIR}/save` +mv ${LSRC}/*unknown* ${LDST} +# Verify that the filter is no longer defined +# Try to read the data; should xfail +if ${NCDUMP} -s $fileurl > ./tmp_unk_$zext.dmp ; then +echo "*** FAIL: filter found" +found=1 +else +echo "*** XFAIL: filter not found" +found=0 +fi +# Restore the filter +mv ${LDST}/*unknown* ${LSRC} +rm -fr ${UNKNOWNDIR}/save +if test "x$found" = x1 ; then exit 1; fi +} + +if test "x$TESTNCZARR" = x1 ; then + testunk file + if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testunk zip ; fi + if test "x$FEATURE_S3TESTS" = xyes ; then testunk s3 ; fi +else +testunk nc +fi + +exit 0 From 46ed3a1da720ca9ec180974f3ebfb97b4286e6ce Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Fri, 16 Sep 2022 18:58:36 -0600 Subject: [PATCH 2/2] Cleanup built test sources in nczarr_test re: https://github.com/conda-forge/libnetcdf-feedstock/pull/140 Some test are BUILTSOURCE in nczarr_test. But apparently I did not do it correctly. SO try to cleanup their construction. --- nczarr_test/Makefile.am | 4 +- nczarr_test/run_unknown.sh | 110 ------------------------------------- 2 files changed, 2 insertions(+), 112 deletions(-) delete mode 100755 nczarr_test/run_unknown.sh diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 6c237d778f..1798455aa5 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -129,7 +129,7 @@ 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_filter.sh run_specific_filters.sh \ +run_filter.sh \ run_newformat.sh run_nczarr_fill.sh run_quantize.sh \ run_jsonconvention.sh run_nczfilter.sh run_unknown.sh \ run_scalar.sh run_strings.sh run_nulls.sh @@ -161,7 +161,7 @@ EXTRA_DIST += ref_power_901_constants_orig.zip ref_power_901_constants.cdl ref_q CLEANFILES = ut_*.txt ut*.cdl tmp*.nc tmp*.cdl tmp*.txt tmp*.dmp tmp*.zip tmp*.nc tmp*.dump tmp*.tmp tmp_ngc.c ref_zarr_test_data.cdl tst_*.nc.zip ref_quotes.zip ref_power_901_constants.zip -BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh +BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh run_unknown.sh test_quantize.c: $(top_srcdir)/nc_test4/tst_quantize.c rm -f $@ echo "#define TESTNCZARR" > $@ diff --git a/nczarr_test/run_unknown.sh b/nczarr_test/run_unknown.sh deleted file mode 100755 index 6e01131241..0000000000 --- a/nczarr_test/run_unknown.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -TESTNCZARR=1 -#!/bin/bash - -if test "x$srcdir" = x ; then srcdir=`pwd`; fi -. ../test_common.sh - -if test "x$TESTNCZARR" = x1 ; then -. "$srcdir/test_nczarr.sh" -fi - -set -e - -# Load the findplugins function -. ${builddir}/findplugin.sh -echo "findplugin.sh loaded" - -# Set up HDF5_PLUGIN_PATH -export HDF5_PLUGIN_PATH=${HDF5_PLUGIN_DIR} - -# Test operation with an unknown filter - -# 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 -} - -# Function to extract _Filter attribute from a file -# These attributes might be platform dependent -getfilterattr() { -sed -e '/var.*:_Filter/p' -ed <$1 >$2 -} - -# Function to extract _Codecs attribute from a file -# These attributes might be platform dependent -getcodecsattr() { -sed -e '/var.*:_Codecs/p' -ed <$1 >$2 -} - -trimleft() { -sed -e 's/[ ]*\([^ ].*\)/\1/' <$1 >$2 -} - -# Locate the plugin path and the library names; argument order is critical - -# Find noop and capture -findplugin h5unknown -UNKNOWNDIR="${HDF5_PLUGIN_DIR}" -UNKNOWNLIB="${HDF5_PLUGIN_LIB}" -UNKNOWNFILTER="${HDF5_PLUGIN_DIR}/${UNKNOWNLIB}" - -# Getting the name is especially tricky for dylib, which puts the version before the .dylib - -# Verify -if ! test -f ${UNKNOWNFILTER} ; then echo "Unable to locate ${UNKNOWNFILTER}"; exit 1; fi - -testunk() { -zext=$1 -echo "*** Testing access to filter info when filter implementation is not available for map $zext" -if test "x$TESTNCZARR" = x1 ; then -fileargs tmp_known -deletemap $zext $file -else -file="tmp_known_${zfilt}.nc" -rm -f $file -fileurl="$file" -fi -# build .nc file using unknown -${NCGEN} -lb -4 -o $fileurl ${srcdir}/../nc_test4/unknown.cdl -# dump and clean file when filter is avail -${NCDUMP} -hs $fileurl > ./tmp_known_$zext.txt -# Remove irrelevant -s output -sclean ./tmp_known_$zext.txt tmp_known_$zext.dump -# Hide the filter -rm -fr ${UNKNOWNDIR}/save -mkdir -p ${UNKNOWNDIR}/save -# Figure out all matching libs; make sure to remove .so, so.0, etc -LSRC=`${execdir}/../ncdump/ncpathcvt -F "${UNKNOWNDIR}"` -LDST=`${execdir}/../ncdump/ncpathcvt -F ${UNKNOWNDIR}/save` -mv ${LSRC}/*unknown* ${LDST} -# Verify that the filter is no longer defined -# Try to read the data; should xfail -if ${NCDUMP} -s $fileurl > ./tmp_unk_$zext.dmp ; then -echo "*** FAIL: filter found" -found=1 -else -echo "*** XFAIL: filter not found" -found=0 -fi -# Restore the filter -mv ${LDST}/*unknown* ${LSRC} -rm -fr ${UNKNOWNDIR}/save -if test "x$found" = x1 ; then exit 1; fi -} - -if test "x$TESTNCZARR" = x1 ; then - testunk file - if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testunk zip ; fi - if test "x$FEATURE_S3TESTS" = xyes ; then testunk s3 ; fi -else -testunk nc -fi - -exit 0