Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ncdap_tests were a mess, so I decided to clean them up #907

Merged
merged 2 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions libdispatch/dwinpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _MSC_VER
#include <io.h>
#endif
Expand All @@ -30,18 +33,22 @@ 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";

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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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

/*
Expand Down
5 changes: 5 additions & 0 deletions ncdap_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ncdap_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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_*

Expand Down
50 changes: 50 additions & 0 deletions ncdap_test/tst_filelists.sh
Original file line number Diff line number Diff line change
@@ -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=
30 changes: 2 additions & 28 deletions ncdap_test/tst_longremote3.sh
Original file line number Diff line number Diff line change
@@ -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
45 changes: 40 additions & 5 deletions ncdap_test/tst_ncdap3.sh
Original file line number Diff line number Diff line change
@@ -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
41 changes: 39 additions & 2 deletions ncdap_test/tst_remote3.sh
Original file line number Diff line number Diff line change
@@ -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

Loading