From 05d078a8b0238d80fdfda994c71976155835cfb1 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Tue, 20 Mar 2018 21:31:31 -0600 Subject: [PATCH] The ncdap_tests were a mess, so I decided to clean them up to remove cruft and to remove unused site tests and make the tests somewhat more understandable. Also did a fix to libdispatch/dwinpath to convert relative paths to absolute paths. This will, I hope, take care of some windows path problems when using $srcdir in shell scripts. --- libdispatch/dwinpath.c | 33 ++++++- ncdap_test/CMakeLists.txt | 5 ++ ncdap_test/Makefile.am | 4 +- ncdap_test/tst_filelists.sh | 50 +++++++++++ ncdap_test/tst_longremote3.sh | 30 +------ ncdap_test/tst_ncdap3.sh | 45 ++++++++-- ncdap_test/tst_remote3.sh | 41 ++++++++- ncdap_test/tst_urls.sh | 165 ++++++++++++++++++++++++++++++++++ ncdap_test/tst_utils.sh | 84 +++++++++++++++++ ncdump/tst_fileinfo.sh | 8 +- ncdump/tst_ncgen4_classic.sh | 4 +- ncdump/tst_netcdf4_4.sh | 98 +++++++------------- 12 files changed, 455 insertions(+), 112 deletions(-) create mode 100644 ncdap_test/tst_filelists.sh create mode 100644 ncdap_test/tst_urls.sh create mode 100644 ncdap_test/tst_utils.sh diff --git a/libdispatch/dwinpath.c b/libdispatch/dwinpath.c index b3c25c41d3..acd6205576 100644 --- a/libdispatch/dwinpath.c +++ b/libdispatch/dwinpath.c @@ -11,6 +11,9 @@ #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #ifdef _MSC_VER #include #endif @@ -30,11 +33,13 @@ for Windows. Other cases will be added as needed. 2. a leading '/cygdrive/X' will be converted to a drive letter X if X is alpha-char. 3. a leading D:/... is treated as a windows drive letter -4. If #1, #2, or #3 is encounterd, then forward slashes +4. a relative path will be converted to an absolute path. +5. If any of the above is encountered, then forward slashes will be converted to backslashes. -5. All other cases are passed thru unchanged +All other cases are passed thru unchanged */ + /* Define legal windows drive letters */ static char* windrive = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -42,6 +47,8 @@ static size_t cdlen = 10; /* strlen("/cygdrive/") */ static int pathdebug = -1; +static char* makeabsolute(const char* relpath); + EXTERNL char* /* caller frees */ NCpathcvt(const char* path) @@ -105,7 +112,13 @@ NCpathcvt(const char* path) goto slashtrans; } - /* 4. Other: just pass thru */ + /* 4. Look for relative path */ + if(pathlen > 1 && path[0] == '.') { + outpath = makeabsolute(path); + goto slashtrans; + } + + /* Other: just pass thru */ outpath = strdup(path); goto done; @@ -138,6 +151,20 @@ NCpathcvt(const char* path) return outpath; } +static char* +makeabsolute(const char* relpath) +{ + char* path = NULL; +#ifdef _MSC_VER + path = _fullpath(NULL,relpath,8192); +#else + path = realpath(relpath, NULL); +#endif + if(path == NULL) + path = strdup(relpath); + return path; +} + #ifdef WINPATH /* diff --git a/ncdap_test/CMakeLists.txt b/ncdap_test/CMakeLists.txt index d548b68987..1bb5a72a75 100644 --- a/ncdap_test/CMakeLists.txt +++ b/ncdap_test/CMakeLists.txt @@ -31,6 +31,11 @@ IF(ENABLE_TESTS) add_sh_test(ncdap tst_ber) add_sh_test(ncdap tst_remote3) # not yet add_sh_test(ncdap tst_hyrax) + + IF(ENABLE_DAP_LONG_TESTS) + add_sh_test(ncdap tst_longremote3) + ENDIF(ENABLE_DAP_LONG_TESTS) + ENDIF(BUILD_UTILITIES) IF(ENABLE_DAP_AUTH_TESTS) diff --git a/ncdap_test/Makefile.am b/ncdap_test/Makefile.am index 90b6537db7..95c0ae4c5d 100644 --- a/ncdap_test/Makefile.am +++ b/ncdap_test/Makefile.am @@ -81,11 +81,11 @@ SUBDIRS = testdata3 expected3 expectremote3 EXTRA_DIST = tst_ncdap3.sh \ tst_remote3.sh \ tst_longremote3.sh \ - tst_ncdap.sh tst_ncdap_shared.sh tst_remote.sh \ + tst_filelists.sh tst_urls.sh tst_utils.sh \ t_dap.c CMakeLists.txt tst_formatx.sh testauth.sh testurl.sh \ t_ncf330.c tst_ber.sh -CLEANFILES = test_varm3 test_cvt3 results/*.dmp results/*.das results/*.dds datadds* t_dap3a test_nstride_cached *.exe +CLEANFILES = test_varm3 test_cvt3 file_results/* remote_results/* datadds* t_dap3a test_nstride_cached *.exe # This should only be left behind if using parallel io CLEANFILES += tmp_* diff --git a/ncdap_test/tst_filelists.sh b/ncdap_test/tst_filelists.sh new file mode 100644 index 0000000000..a190112767 --- /dev/null +++ b/ncdap_test/tst_filelists.sh @@ -0,0 +1,50 @@ +################################################## +# Local test files +################################################## + +# This is not a standalone script; it is invoked by +# one or more of the main scripts + +# Synth8 and Synth9 still fail +SYNTHETICDATA="synth1 synth2 synth3 synth4 synth5 synth6 synth7 synth10" + +SOURCEFILES=\ +"1990-S1700101.HDF.WVC_Lat 1998-6-avhrr.dat \ +b31a b31 D1 Drifters \ +EOSDB ingrid nestedDAS NestedSeq2 \ +NestedSeq OverideExample pbug0001b SimpleDrdsExample \ +test.01 test.02 test.03 test.04 \ +test.05 test.06a test.07a \ +test.07 test.21 test.22 \ +test.23 test.31 \ +test.50 test.53 test.55 \ +test.56 test.57 \ +test.66 test.67 test.68 test.69 \ +test.an1 \ +test.dfp1 test.dfr1 test.dfr2 test.dfr3 \ +test.gr1 test.gr2 test.gr3 test.gr4 \ +test.gr5 test.PointFile test.sds1 \ +test.sds2 test.sds3 test.sds4 test.sds5 \ +test.sds6 test.sds7 test.vs1 \ +test.vs2 test.vs3 test.vs4 test.vs5 whoi \ +123bears.nc 123.nc bears.nc \ +ceopL2AIRS2-2.nc \ +data.nc fnoc1.nc \ +in1.nc in_2.nc in.nc \ +in_no_three_double_dmn.nc in_v.nc saco1.nc \ +test.nc text.nc \ +ber-2002-10-01.nc \ +kwcase.nc" + +# XFAIL tests should be a subset of the other tests; this is used +# only to detect which are considered XFAIL tests. +XFAILTESTS= + +# For now, remove some tests from windows platform. +#if test "x$platform" != xmingw ; then + XFAILTESTS="$XFAILTESTS EOSDB OverideExample SimpleDrdsExample test.67 test.gr5 123bears.nc 123.nc bears.nc ber-2002-10-01 data.nc in1.nc in_2.nc in_no_three_double_dmn.nc test.nc text.nc test.22 test.23 test.gr1 in.nc ber-2002-10-01.nc kwcase.nc" +#fi + +FILETESTS="${SYNTHETICDATA} ${SOURCEFILES}" +#DDSTESTS intersect FILETESTS should be empty +DDSTESTS= diff --git a/ncdap_test/tst_longremote3.sh b/ncdap_test/tst_longremote3.sh index 01f2cbe2d4..20bd27ac48 100755 --- a/ncdap_test/tst_longremote3.sh +++ b/ncdap_test/tst_longremote3.sh @@ -1,30 +1,4 @@ #!/bin/sh -# if this is part of a distcheck action, then this script -# will be executed in a different directory -# than the one containing it; so capture the path to this script -# as the location of the source directory. - -topsrcdir=`./test_environment topsrcdir` -if test "x$topsrcdir" != x ; then - srcdir="$topsrcdir/ncdap_test" -else - srcdir=`dirname $0` -fi - -cd $srcdir -srcdir=`pwd` - -# Hack for CYGWIN -cd $srcdir -if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then - srcdir=`pwd | sed 's/\/c\//c:\//g'` - builddir="$srcdir"/.. -fi - -# compute the build directory -builddir=`pwd`/.. -cd ${builddir}/ncdap_test - -sh ${srcdir}/tst_remote.sh "$srcdir" "$builddir" "3" "" "long" -exit +export longtests=1 +bash ${srcdir}/tst_remote3.sh diff --git a/ncdap_test/tst_ncdap3.sh b/ncdap_test/tst_ncdap3.sh index 4b82159b61..5a6f8a29a8 100755 --- a/ncdap_test/tst_ncdap3.sh +++ b/ncdap_test/tst_ncdap3.sh @@ -1,13 +1,48 @@ #!/bin/sh +if test "x$SETX" = x1 ; then set -x ; fi + if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh - set -e -#X="-x" -#grind="checkleaks" +. ${srcdir}/tst_utils.sh + +# get the list of test files +. ${srcdir}/tst_filelists.sh + +# Test executor +dotests() { +for x in ${FILETESTS} ; do + url="${PARAMS}${FILEURL}/$x" + if test "x$quiet" = "x0" ; then echo "*** Testing: ${x} ; url=$url" ; fi + # determine if this is an xfailtest + isxfail=0 + if test "x${XFAILTESTS}" != x ; then + if IGNORE=`echo -n " ${XFAILTESTS} " | fgrep " ${x} "`; then isxfail=1; fi + fi + ok=1 + if ${NCDUMP} ${FLAGS} "${url}" | sed 's/\\r//g' > ${x}.dmp ; then ok=$ok; else ok=0; fi + # compare with expected + if diff -w ${EXPECTED}/${x}.dmp ${x}.dmp ; then ok=$ok; else ok=0; fi + processstatus +done +} + +TITLE="DAP to netCDF-3 translation using files" +EXPECTED="$expected3" +RESULTSDIR="file_results" + +rm -fr ${RESULTSDIR} +mkdir "${RESULTSDIR}" -exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "file" $grind -#exec sh $X ${srcdir}/tst_ncdap.sh "$srcdir" "$builddir" "dds" $grind +echo "*** Testing $TITLE " +echo " Base URL: ${TESTURL}" +echo " Client Parameters: ${PARAMS}" +cd ${RESULTSDIR} +dotests file +cd .. +summarize +cleanup +doexit diff --git a/ncdap_test/tst_remote3.sh b/ncdap_test/tst_remote3.sh index a320be00db..b63c858e79 100755 --- a/ncdap_test/tst_remote3.sh +++ b/ncdap_test/tst_remote3.sh @@ -1,9 +1,46 @@ #!/bin/sh +if test "x$SETX" = x1 ; then set -x ; fi + if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh set -e -sh ${srcdir}/tst_remote.sh "$srcdir" "$builddir" "3" "" "" -exit +. ${srcdir}/tst_utils.sh + +# get the list of test url targets +. ${srcdir}/tst_urls.sh + +PARAMS="${PARAMS}[netcdf3]" + +# Choose tests to run +if test "x$longtests" != x; then +WHICHTESTS="L1 LC1 LC2" +else # Standard test set +WHICHTESTS="S1 C1" +fi + +TITLE="DAP to netCDF-3 translation using remote server" +EXPECTED="$expected3" +RESULTSDIR="remote_results" + +rm -fr ${RESULTSDIR} +mkdir "${RESULTSDIR}" + +echo "*** Testing $TITLE " +echo " Base URL: ${DTS}" +echo " Client Parameters: ${PARAMS}" +if test "$cache" = 0; then echo " Caching: off"; else echo " Caching: on"; fi +echo " Note: The remote tests may be slow or even fail if the server is overloaded" + +cd ${RESULTSDIR} +for i in $WHICHTESTS ; do + computewhich $i + doremotetests remote +done +cd .. +summarize +cleanup +doexit + diff --git a/ncdap_test/tst_urls.sh b/ncdap_test/tst_urls.sh new file mode 100644 index 0000000000..fa3afcebe7 --- /dev/null +++ b/ncdap_test/tst_urls.sh @@ -0,0 +1,165 @@ +################################################## +# Remote test info +################################################## + +# This is not a standalone script; it is invoked by +# one or more of the main scripts + +# Define various sets of test targets + +# Figure our dst server; if none, then just stop +DTS=`${execdir}/findtestserver dap2 dts` +if test "x$DTS" = "x" ; then +echo "WARNING: Cannot locate test server for dts" +exit 1 +fi + +if test "x$timing" = "x1" ; then TIMECMD="time"; else TIMECMD=""; fi +expected3="${srcdir}/expectremote3" + +# For special testing +X="test.03" +XC="test.03;1;s0,s1" + +# Set to run a specific test +S0="test.07" + +# These shorter tests are always run +S1="\ +test.01 test.02 test.04 test.05 test.07a test.07 \ +test.21 \ +test.50 test.53 test.55 test.56 test.57 \ +test.66 test.67 test.68 test.69" + +# Server is failing on some tests ; investigate why +S1FAIL="test.06a test.22 test.23 test.31" + +# This fails because of the duplicate name problem and the way thredds dap handles grids" +S2FAIL="test.06" + +# These longer tests are optional +SL1="\ +test.03 \ +b31 b31a D1 Drifters EOSDB \ +ingrid nestedDAS NestedSeq NestedSeq2 OverideExample \ +SimpleDrdsExample test.an1 \ +test.dfp1 test.gr1 \ +test.gr2 test.gr3 test.gr4 test.gr5 \ +test.sds1 test.sds2 test.sds3 \ +test.sds4 test.sds5 \ +test.vs1 test.vs2 test.vs3 test.vs4 test.vs5 \ +whoi" + +# Anything larger than about 100k will not be in the distribution +TOOBIGL1="parserBug0001 test.satimage Sat_Images test.32" + +# Following contain %XX escapes which I cannot handle yet +ESCAPEDFAIL="test.dfr1 test.dfr2 test.dfr3 test.GridFile test.PointFile test.SwathFile test.sds6 test.sds7" + +# Following tests are to check constraint handling +C1="\ +test.01;1;f64 \ +test.02;1;b[1:2:10] \ +test.03;1;i32[0:1][1:2][0:2] \ +test.04;1;types.i32 \ +test.05;1;types.floats.f32 \ +test.07;1;person.age \ +test.07;3;person \ +test.07;4;types.f32" + +# See S2FAIL above +SR1FAIL="test.06;1;ThreeD" + +# Constrained long tests +LC1="test.03;2;s1" + +# Unknown problem: test.07;2;&age>2 +IGNORE="test.07.2" + +# Columbia hack test Not sure if operative +COLUMBIA="http://iridl.ldeo.columbia.edu/SOURCES/.Models/.NMME/.NASA-GMAO/.MONTHLY/.sst" + +# Known to fail + +XFAILTESTS= +# Supress some tests if not windows platform. +if test "x$platform" == xmingw ; then + XFAILTESTS="$XFAILTESTS test.67" +fi + +# Following tests must be run as not cached +NOCACHETESTS="test.07" + +# Following tests must be run as not prefetch +NOPREFETCHTESTS="test.07" + +computewhich() { # set REMOTETESTS and constrained + case "$1" in + S0) REMOTETESTS="$S0" ; constrained=0 ;; + S1) REMOTETESTS="$S1" ; constrained=0 ;; + S2) REMOTETESTS="$S2" ; constrained=0 ;; + L1) REMOTETESTS="$L1" ; constrained=0 ;; + L2) REMOTETESTS="$L2" ; constrained=0 ;; + C1) REMOTETESTS="$C1" ; constrained=1 ;; + C2) REMOTETESTS="$C2" ; constrained=1 ;; + C3) REMOTETESTS="$C3" ; constrained=1 ;; + LC1) REMOTETESTS="$LC1" ; constrained=1 ;; + LC2) REMOTETESTS="$LC2" ; constrained=1 ;; + X) REMOTETESTS="$X" ; constrained=0 ;; + XC) REMOTETESTS="$XC" ; constrained=1 ;; + *) echo "Unknown which test: $1" ; exit 1;; + esac +} + +constrain() { + T="$1;;" # add semicolons to fake out the cut command + # see if we are using constraints will set testname and ce and testno and contrained + testname=`echo -n $T | cut "-d;" -f1` + testno=`echo -n $T | cut "-d;" -f2` + ce=`echo -n $T | cut "-d;" -f3` + if test "x$ce" = x ; then constrained=0; else constrained=1; fi +} + +setcache() { + CACHE="[cache]" + if test "x${NOCACHETESTS}" != x ; then + if IGNORE=`echo -n " ${NOCACHETESTS} " | fgrep " $1 "`; then CACHE=; fi + fi + PARAMS="${PARAMS}${CACHE}" +} + +setprefetch() { + PREFETCH="[prefetch]" + if test "x${NOPREFETCHTESTS}" != x ; then + if IGNORE=`echo -n " ${NOPREFETCHTESTS} " | fgrep " $1 "`; then PREFETCH=; fi + fi + PARAMS="${PARAMS}${PREFETCH}" +} + +# Use specialized test executor +doremotetests() { +for x in ${REMOTETESTS} ; do + PARAMS= + setcache $x + setprefetch $x + constrain $x + if test "x$constrained" = "x1" ; then + name="${testname}.${testno}" + url="${PARAMS}${DTS}/$testname?${ce}" + else + name="${testname}" + url="${PARAMS}${DTS}/$testname" + fi + if test "x$quiet" = "x0" ; then echo "*** Testing: ${name} ; url=$url" ; fi + # determine if this is an xfailtest + isxfail=0 + if test "x${XFAILTESTS}" != x ; then + if IGNORE=`echo -n " ${XFAILTESTS} " | fgrep " ${name} "`; then isxfail=1; fi + fi + ok=1 + if ${NCDUMP} ${FLAGS} "${url}" | sed 's/\\r//g' > ${name}.dmp ; then ok=$ok; else ok=0; fi + # compare with expected + if diff -w ${EXPECTED}/${name}.dmp ${name}.dmp ; then ok=$ok; else ok=0; fi + processstatus +done +} diff --git a/ncdap_test/tst_utils.sh b/ncdap_test/tst_utils.sh new file mode 100644 index 0000000000..8a7ca844bd --- /dev/null +++ b/ncdap_test/tst_utils.sh @@ -0,0 +1,84 @@ +# This is not a standalone script; it is invoked by +# one or more of the main scripts + +if test "x$SETX" = x1 ; then set -x ; fi + +quiet=0 + +PARAMS="[log]" +#PARAMS="${PARAMS}[fetch=memory]" +#PARAMS="${PARAMS}[show=fetch]" + +OCLOGFILE=/dev/null + +# Locate directories +testdata3="${srcdir}/testdata3" +expected3="${srcdir}/expected3" + +rm -f ./.dodsrc ./.ocrc ./.daprc + +passcount=0 +xfailcount=0 +failcount=0 + +# Try to figure out our platform +myplatform=`uname -a | cut -d" " -f 1` +case "$myplatform" in +Darwin*) platform=osx ;; +MINGW*) platform=mingw ;; +CYGWIN*) platform=cygwin ;; +linux*) platform=linux ;; +Linux*) platform=linux ;; +*) platform=unknown ;; +esac + +# How to access local files +FILEURL="file://${testdata3}" + +processstatus() { + if test "$ok" = 1 ; then + status=0 # succeed + elif test "x$isxfail" = "x0" ; then + status=1 # fail + else + status=2 # xfail + fi + case "$status" in + 0) + passcount=`expr $passcount + 1` + if test "x$quiet" = "x" ; then echo "*** SUCCEED: ${x}"; fi + ;; + 1) + failcount=`expr $failcount + 1` + echo "*** FAIL: ${x}" + ;; + 2) + xfailcount=`expr $xfailcount + 1` + echo "*** XFAIL : ${x}" + ;; + esac +} + +summarize() { +totalcount=`expr $passcount + $failcount + $xfailcount` +okcount=`expr $passcount + $xfailcount` +if test "$failcount" -gt 0 ; then +echo "*** FAILED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures" +else +echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures" +fi +} + +cleanup() { +rm -fr ${RESULTSDIR} +} + +doexit() { +if test "$failcount" -gt 0 +then + exit 1 +else + exit 0 +fi +} + diff --git a/ncdump/tst_fileinfo.sh b/ncdump/tst_fileinfo.sh index 87e0ee0ca3..afe907491d 100755 --- a/ncdump/tst_fileinfo.sh +++ b/ncdump/tst_fileinfo.sh @@ -8,13 +8,13 @@ echo "" EXIT=0 -NCF=$srcdir/nc4_fileinfo.nc -HDF=$srcdir/hdf5_fileinfo.hdf -NF=ref_tst_compounds4.nc +NCF=${srcdir}/ncdump/nc4_fileinfo.nc +HDF=${srcdir}/ncdump/hdf5_fileinfo.hdf +NF=${srcdir}/ncdump/ref_tst_compounds4.nc # Do a false negative test rm -f ./tmp_tst_fileinfo -if $NCDUMP -s $builddir/$NF | fgrep '_IsNetcdf4 = 0' > ./tmp_tst_fileinfo ; then +if $NCDUMP -s $NF | fgrep '_IsNetcdf4 = 0' > ./tmp_tst_fileinfo ; then echo "Pass: False negative for file: $NF" else echo "FAIL: False negative for file: $NF" diff --git a/ncdump/tst_ncgen4_classic.sh b/ncdump/tst_ncgen4_classic.sh index e72f3f4ab6..0dfdff026b 100755 --- a/ncdump/tst_ncgen4_classic.sh +++ b/ncdump/tst_ncgen4_classic.sh @@ -14,8 +14,8 @@ export verbose echo "*** Performing diff/cycle tests for classic format: k=1" KFLAG=1 ; export KFLAG -bash -x ${srcdir}/tst_ncgen4_diff.sh -bash -x ${srcdir}/tst_ncgen4_cycle.sh +bash ${srcdir}/tst_ncgen4_diff.sh +bash ${srcdir}/tst_ncgen4_cycle.sh echo "SUCCESS!!" exit 0 diff --git a/ncdump/tst_netcdf4_4.sh b/ncdump/tst_netcdf4_4.sh index 4da9b4b354..458cc1bd63 100755 --- a/ncdump/tst_netcdf4_4.sh +++ b/ncdump/tst_netcdf4_4.sh @@ -20,84 +20,50 @@ echo "*** Running extra netcdf-4 tests." # Short term solution, use sed when on windows/MSYS to # remove the './','../../ncdump'. # +# I am undoing this because libdispatch/dwinpath.c +# should be taking care of this. If not, then that is +# what we need to fix. Alternatively, we can use top_srcdir, +# which is an absolute path echo "*** running tst_string_data to create test files..." ${execdir}/tst_string_data -if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then # MINGW Platforms - - echo "*** dumping tst_string_data.nc to tst_string_data.cdl..." - ${NCDUMP} tst_string_data.nc > tst_string_data.cdl - TMPNAME=`head -n 1 tst_string_data.cdl | cut -d" " -f 2` - NEWNAME=`basename $TMPNAME` - sed "s,$TMPNAME,$NEWNAME,g" tst_string_data.cdl > tmp.cdl - mv tmp.cdl tst_string_data.cdl - echo "*** comparing tst_string_data.cdl with ref_tst_string_data.cdl..." - diff -b tst_string_data.cdl $srcdir/ref_tst_string_data.cdl - - echo '*** testing reference file ref_tst_compounds2.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds2.nc > tst_compounds2.cdl - TMPNAME=`head -n 1 tst_compounds2.cdl | cut -d" " -f 2` - NEWNAME=`basename $TMPNAME` - sed "s,$TMPNAME,$NEWNAME,g" tst_compounds2.cdl > tmp.cdl - mv tmp.cdl tst_compounds2.cdl - diff -b tst_compounds2.cdl $srcdir/ref_tst_compounds2.cdl - - echo '*** testing reference file ref_tst_compounds3.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds3.nc > tst_compounds3.cdl - TMPNAME=`head -n 1 tst_compounds3.cdl | cut -d" " -f 2` - NEWNAME=`basename $TMPNAME` - sed "s,$TMPNAME,$NEWNAME,g" tst_compounds3.cdl > tmp.cdl - mv tmp.cdl tst_compounds3.cdl - diff -b tst_compounds3.cdl $srcdir/ref_tst_compounds3.cdl - - echo '*** testing reference file ref_tst_compounds4.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds4.nc > tst_compounds4.cdl - TMPNAME=`head -n 1 tst_compounds4.cdl | cut -d" " -f 2` - NEWNAME=`basename $TMPNAME` - sed "s,$TMPNAME,$NEWNAME,g" tst_compounds4.cdl > tmp.cdl - mv tmp.cdl tst_compounds4.cdl - diff -b tst_compounds4.cdl $srcdir/ref_tst_compounds4.cdl - -else # Non-MINGW Platforms - - echo "*** dumping tst_string_data.nc to tst_string_data.cdl..." - ${NCDUMP} tst_string_data.nc > tst_string_data.cdl - echo "*** comparing tst_string_data.cdl with ref_tst_string_data.cdl..." - diff -b tst_string_data.cdl $srcdir/ref_tst_string_data.cdl +echo "*** dumping tst_string_data.nc to tst_string_data.cdl..." +${NCDUMP} tst_string_data.nc > tst_string_data.cdl +echo "*** comparing tst_string_data.cdl with ref_tst_string_data.cdl..." +diff -b tst_string_data.cdl ${top_srcdir}/ncdump/ref_tst_string_data.cdl #echo '*** testing non-coordinate variable of same name as dimension...' -#${NCGEN} -v4 -b -o tst_noncoord.nc $srcdir/ref_tst_noncoord.cdl +#${NCGEN} -v4 -b -o tst_noncoord.nc ${top_srcdir}/ncdump/ref_tst_noncoord.cdl - echo '*** testing reference file ref_tst_compounds2.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds2.nc > tst_compounds2.cdl - diff -b tst_compounds2.cdl $srcdir/ref_tst_compounds2.cdl +echo '*** testing reference file ref_tst_compounds2.nc...' +${NCDUMP} ${top_srcdir}/ncdump/ref_tst_compounds2.nc > tst_compounds2.cdl +diff -b tst_compounds2.cdl ${top_srcdir}/ncdump/ref_tst_compounds2.cdl - echo '*** testing reference file ref_tst_compounds3.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds3.nc > tst_compounds3.cdl - diff -b tst_compounds3.cdl $srcdir/ref_tst_compounds3.cdl +echo '*** testing reference file ref_tst_compounds3.nc...' +${NCDUMP} ${top_srcdir}/ncdump/ref_tst_compounds3.nc > tst_compounds3.cdl +diff -b tst_compounds3.cdl ${top_srcdir}/ncdump/ref_tst_compounds3.cdl - echo '*** testing reference file ref_tst_compounds4.nc...' - ${NCDUMP} $srcdir/ref_tst_compounds4.nc > tst_compounds4.cdl - diff -b tst_compounds4.cdl $srcdir/ref_tst_compounds4.cdl +echo '*** testing reference file ref_tst_compounds4.nc...' +${NCDUMP} ${top_srcdir}/ncdump/ref_tst_compounds4.nc > tst_compounds4.cdl +diff -b tst_compounds4.cdl ${top_srcdir}/ncdump/ref_tst_compounds4.cdl - # Exercise Jira NCF-213 bug fix +# Exercise Jira NCF-213 bug fix # rm -f tst_ncf213.cdl tst_ncf213.nc - ${NCGEN} -b -o tst_ncf213.nc $srcdir/ref_tst_ncf213.cdl - ${NCDUMP} -s -h tst_ncf213.nc \ - | sed -e 's/netcdflibversion=.*[|]/netcdflibversion=0.0.0|/' \ - | sed -e 's/hdf5libversion=.*"/hdf5libversion=0.0.0"/' \ - | sed -e 's|_SuperblockVersion = [0-9]|_SuperblockVersion = 0|' \ - | cat >tst_ncf213.cdl - # Now compare - ok=1; - if diff -b $srcdir/ref_tst_ncf213.cdl tst_ncf213.cdl ; then ok=1; else ok=0; fi - # cleanup +${NCGEN} -b -o tst_ncf213.nc ${top_srcdir}/ncdump/ref_tst_ncf213.cdl +${NCDUMP} -s -h tst_ncf213.nc \ + | sed -e 's/netcdflibversion=.*[|]/netcdflibversion=0.0.0|/' \ + | sed -e 's/hdf5libversion=.*"/hdf5libversion=0.0.0"/' \ + | sed -e 's|_SuperblockVersion = [0-9]|_SuperblockVersion = 0|' \ + | cat >tst_ncf213.cdl +# Now compare +ok=1; +if diff -b ${top_srcdir}/ncdump/ref_tst_ncf213.cdl tst_ncf213.cdl ; then ok=1; else ok=0; fi +# cleanup # rm -f tst_ncf213.cdl tst_ncf213.nc - if test $ok = 0 ; then - echo "*** FAIL: NCF-213 Bug Fix test" - exit 1 - fi +if test $ok = 0 ; then + echo "*** FAIL: NCF-213 Bug Fix test" + exit 1 fi echo "*** All ncgen and ncdump extra test output for netCDF-4 format passed!"