mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
53464e8963
re: https://github.com/Unidata/netcdf-c/issues/2119 H/T to [Egbert Eich](https://github.com/e4t) and [Bas Couwenberg](https://github.com/sebastic) for this PR. It is undesirable to make netcdf be dependent on the availability of libxml2, but it is desirable to allow its use if available. In order to do this, a wrapper API (include/ncxml.h) was constructed that supports either ezxml or libxml2 as the implementation. Additionally, the xml support code was moved to a new directory netcdf-c/libncxml. Primary changes: * Create a new sub-directory named netcdf-c/libncxml to hold all the xml implementation code. * Move ezxml.c and ezxml.h to libncxml * Create a wrapper API -- include/ncxml.h * Create an implementation, ncxml_ezxml.c to support use of ezxml. * Create an implementation, ncxml_xml2.c to support use of libxml2. * Add a check for libxml2 in configure.ac and CMakeLists.txt * Modify libdap to use the wrapper API instead of ezxml directly. Misc. Other Changes: * Change include/netcdf_json.h from built source to be part of the distribution.
92 lines
2.3 KiB
Bash
Executable File
92 lines
2.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
|
. ../test_common.sh
|
|
|
|
. "$srcdir/test_nczarr.sh"
|
|
|
|
# This shell script tests compatibility between
|
|
# this implementation and other implementations
|
|
# by means of files constructed by that other implementation
|
|
|
|
set -e
|
|
|
|
UH="${NCZARR_S3_TEST_HOST}"
|
|
UB="${NCZARR_S3_TEST_BUCKET}"
|
|
|
|
|
|
testcasefile() {
|
|
zext=file
|
|
ref=$1
|
|
mode=$2
|
|
metaonly=$3
|
|
if test "x$metaonly" = xmetaonly ; then flags="-h"; fi
|
|
fileargs ${execdir}/$ref "mode=$mode,$zext"
|
|
rm -f tmp_${ref}_${zext}.cdl
|
|
${NCDUMP} $flags $fileurl > tmp_${ref}_${zext}.cdl
|
|
diff -b ${srcdir}/${ref}.cdl tmp_${ref}_${zext}.cdl
|
|
}
|
|
|
|
testcasezip() {
|
|
zext=zip
|
|
ref=$1
|
|
mode=$2
|
|
fileargs $ref "mode=$mode,$zext"
|
|
rm -f tmp_${ref}_${zext}.cdl
|
|
${NCDUMP} -h $flags $fileurl > tmp_${ref}_${zext}.cdl
|
|
diff -b ${srcdir}/${ref}.cdl tmp_${ref}_${zext}.cdl
|
|
}
|
|
|
|
testcases3() {
|
|
zext=s3
|
|
zarr=$1
|
|
ref=$2
|
|
mode=$3
|
|
rm -f tmp_${zarr}_${zext}.cdl
|
|
url="https://${UH}/${UB}/${zarr}#mode=${mode},s3"
|
|
${NCDUMP} $url > tmp_${zarr}_${zext}.cdl
|
|
diff -b ${srcdir}/${ref}.cdl tmp_${zarr}_${zext}.cdl
|
|
}
|
|
|
|
testallcases() {
|
|
zext=$1
|
|
case "$zext" in
|
|
file)
|
|
# need to unpack
|
|
rm -fr ref_power_901_constants ref_power_901_constants.file
|
|
unzip ${srcdir}/ref_power_901_constants.zip > /dev/null
|
|
mv ref_power_901_constants ref_power_901_constants.file
|
|
testcasefile ref_power_901_constants zarr metaonly; # test xarray as default
|
|
;;
|
|
zip)
|
|
# Move into position
|
|
if test "x$srcdir" != "x$execdir" ; then
|
|
cp ${srcdir}/ref_power_901_constants.zip ${execdir}
|
|
cp ${srcdir}/ref_quotes.zip ${execdir}
|
|
fi
|
|
testcasezip ref_power_901_constants xarray metaonly
|
|
# Test large constant interoperability
|
|
testcasezip ref_quotes zarr metaonly
|
|
;;
|
|
s3)
|
|
# Read a test case created by netcdf-java zarr.
|
|
# Move into position
|
|
rm -f ${execdir}/ref_zarr_test_data.cdl
|
|
if gunzip -c < ${srcdir}/ref_zarr_test_data.cdl.gz > ${execdir}/ref_zarr_test_data.cdl ; then
|
|
testcases3 zarr_test_data.zarr ref_zarr_test_data xarray
|
|
fi
|
|
;;
|
|
*) echo "unimplemented kind: $1" ; exit 1;;
|
|
esac
|
|
}
|
|
|
|
#testallcases file
|
|
#if test "x$FEATURE_NCZARR_ZIP" = xyes ; then testallcases zip; fi
|
|
if test "x$FEATURE_S3TESTS" = xyes ; then testallcases s3; fi
|
|
exit
|
|
# Cleanup
|
|
rm -fr ${execdir}/ref_power_901_constants.file
|
|
rm -f ${execdir}/ref_zarr_test_data.cdl
|
|
|
|
exit 0
|