diff --git a/configure.ac b/configure.ac index 75068f558..d7db9c19a 100644 --- a/configure.ac +++ b/configure.ac @@ -466,6 +466,10 @@ fi if test "x$enable_dap" = xyes; then AC_DEFINE([USE_DAP], [1], [if true, build DAP Client]) + AC_DEFINE([ENABLE_DAP], [1], [if true, build DAP Client]) +fi +if test "x$enable_dap_remote_tests" = xyes; then + AC_DEFINE([ENABLE_DAP_REMOTE_TESTS], [1], [if true, do remote tests]) fi # Default is now to always do the short remote tests @@ -479,6 +483,7 @@ if test "x$enable_dap" = "xno" ; then fi AC_MSG_RESULT($enable_dap_remote_tests) + AC_MSG_CHECKING([whether the time-consuming dap tests should be enabled (default off)]) AC_ARG_ENABLE([dap-long-tests], [AS_HELP_STRING([--enable-dap-long-tests], diff --git a/libncdap3/Makefile.am b/libncdap3/Makefile.am index c168f2fab..6563045bc 100755 --- a/libncdap3/Makefile.am +++ b/libncdap3/Makefile.am @@ -83,12 +83,11 @@ LDADD += @EXTERN_LDFLAGS@ # Add a trivial test case to check for undefined references check_PROGRAMS = t_dap +TESTS_ENVIRONMENT=TOPSRCDIR=${abs_top_srcdir} TESTS = t_dap t_dap_SOURCES = t_dap.c stubdap3.c t_dap_LDFLAGS = ${top_builddir}/libsrc/libnetcdf3.la \ ${top_builddir}/libdispatch/libdispatch.la - - CLEANFILES += t_dap EXTRA_DIST = ce.y diff --git a/libncdap3/t_dap.c b/libncdap3/t_dap.c index a2dd6189a..3cde0a58c 100644 --- a/libncdap3/t_dap.c +++ b/libncdap3/t_dap.c @@ -109,13 +109,33 @@ int main() { int ncid, varid, ncstat, i, j; char* url; + char* topsrcdir; + size_t len; - /* location of our target url*/ + /* location of our target url: use file// to avoid remote + server downtime issues + */ + + /* Assume that TESTS_ENVIRONMENT was set */ + topsrcdir = getenv("TOPSRCDIR"); + if(topsrcdir == NULL) { + fprintf(stderr,"*** FAIL: $abs_top_srcdir not defined: location= %s:%d\n",__FILE__,__LINE__); + exit(1); + } + len = strlen("file://") + strlen(topsrcdir) + strlen("/ncdap_test/testdata3/test.02") + 1; #ifdef DEBUG - url = "[log][show=fetch]http://test.opendap.org:8080/dods/dts/test.02"; -#else - url = "http://test.opendap.org:8080/dods/dts/test.02"; + len += strlen("[log][show=fetch]"); #endif + url = (char*)malloc(len); + url[0] = '\0'; + +#ifdef DEBUG + strcat(url,"[log][show=fetch]"); +#endif + + strcat(url,"file://"); + strcat(url,topsrcdir); + strcat(url,"/ncdap_test/testdata3/test.02"); printf("*** Test: var conversions on URL: %s\n",url); diff --git a/libncdap4/Makefile.am b/libncdap4/Makefile.am index c1fbad8a8..5f92c0afe 100755 --- a/libncdap4/Makefile.am +++ b/libncdap4/Makefile.am @@ -59,6 +59,7 @@ LDADD += @EXTERN_LDFLAGS@ # Add a trivial test case to check for undefined references check_PROGRAMS = t_dap +TESTS_ENVIRONMENT=TOPSRCDIR=${abs_top_srcdir} TESTS = t_dap t_dap_SOURCES = t_dap.c stubdap4.c CLEANFILES += t_dap diff --git a/libncdap4/t_dap.c b/libncdap4/t_dap.c index 8b3b4306e..cd4db9b07 100644 --- a/libncdap4/t_dap.c +++ b/libncdap4/t_dap.c @@ -123,16 +123,37 @@ int main() { int ncid, varid, ncstat; char* url; + char* topsrcdir; + size_t len; + #ifndef USE_NETCDF4 int j; #endif - /* location of our target url*/ + /* location of our target url: use file// to avoid remote + server downtime issues + */ + + /* Assume that TESTS_ENVIRONMENT was set */ + topsrcdir = getenv("TOPSRCDIR"); + if(topsrcdir == NULL) { + fprintf(stderr,"*** FAIL: $abs_top_srcdir not defined: location= %s:%d\n",__FILE__,__LINE__); + exit(1); + } + len = strlen("file://") + strlen(topsrcdir) + strlen("/ncdap_test/testdata3/test.02") + 1; #ifdef DEBUG - url = "[log][show=fetch]http://test.opendap.org:8080/dods/dts/test.02"; -#else - url = "http://test.opendap.org:8080/dods/dts/test.02"; + len += strlen("[log][show=fetch]"); #endif + url = (char*)malloc(len); + url[0] = '\0'; + +#ifdef DEBUG + strcat(url,"[log][show=fetch]"); +#endif + + strcat(url,"file://"); + strcat(url,topsrcdir); + strcat(url,"/ncdap_test/testdata3/test.02"); printf("*** Test: var conversions on URL: %s\n",url); diff --git a/nc_test4/tst_files2.c b/nc_test4/tst_files2.c index 9c37ae0b8..914933f8d 100644 --- a/nc_test4/tst_files2.c +++ b/nc_test4/tst_files2.c @@ -15,6 +15,7 @@ main(int argc, char **argv) { printf("\n*** Testing netcdf file functions some more.\n"); #ifdef USE_DAP +#ifdef ENABLE_DAP_REMOTE_TESTS printf("*** testing simple opendap open/close..."); { int ncid; @@ -24,6 +25,7 @@ main(int argc, char **argv) if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; +#endif /*ENABLE_DAP_REMOTE_TESTS*/ #endif /* USE_DAP */ FINAL_RESULTS; }