Add earthdata test case

This commit is contained in:
Dennis Heimbigner 2023-06-10 20:11:26 -06:00
parent 1f12c09b07
commit 9341904b0b
4 changed files with 66 additions and 5 deletions

View File

@ -2140,6 +2140,8 @@ AC_SUBST([ISCMAKE], [])
# Provide conditional to temporarily suppress tests and such # Provide conditional to temporarily suppress tests and such
AM_CONDITIONAL([AX_IGNORE], [test xno = xyes]) AM_CONDITIONAL([AX_IGNORE], [test xno = xyes])
# Provide conditional to identify tests that must be run manually
AM_CONDITIONAL([AX_MANUAL], [test xno = xyes])
AC_MSG_NOTICE([generating header files and makefiles]) AC_MSG_NOTICE([generating header files and makefiles])
AC_CONFIG_FILES(test_common.sh:test_common.in) AC_CONFIG_FILES(test_common.sh:test_common.in)

View File

@ -53,8 +53,19 @@ ENDIF()
IF(ENABLE_DAP_REMOTE_TESTS) IF(ENABLE_DAP_REMOTE_TESTS)
add_sh_test(dap4_test test_remote) add_sh_test(dap4_test test_remote)
add_sh_test(dap4_test test_hyrax) add_sh_test(dap4_test test_hyrax)
# add_sh_test(dap4_test test_thredds)
add_sh_test(dap4_test test_dap4url) add_sh_test(dap4_test test_dap4url)
IF(RUN_MANUAL_TESTS)
# The following test can only be run by hand.
# It tests earthdata authorization.
# Before running it, one needs to do the following:
# export USERPWD="<username>:<password>"
# where the username and password are registered
# with urs.earthdata.nasa.gov.
add_sh_test(dap4_test test_earthdata)
ENDIF()
IF(RUN_IGNORED_TESTS)
add_sh_test(dap4_test test_thredds)
ENDIF
ENDIF(ENABLE_DAP_REMOTE_TESTS) ENDIF(ENABLE_DAP_REMOTE_TESTS)
ENDIF(ENABLE_TESTS) ENDIF(ENABLE_TESTS)

View File

@ -48,9 +48,21 @@ if ENABLE_DAP_REMOTE_TESTS
TESTS += test_remote.sh TESTS += test_remote.sh
TESTS += test_constraints.sh TESTS += test_constraints.sh
TESTS += test_hyrax.sh TESTS += test_hyrax.sh
#TESTS += test_thredds.sh
TESTS += test_dap4url.sh TESTS += test_dap4url.sh
# The following test can only be run by hand.
# It tests earthdata authorization.
# Before running it, one needs to do the following:
# export USERPWD="<username>:<password>"
# where the username and password are registered with urs.earthdata.nasa.gov.
if AX_MANUAL
TESTS += test_earthdata.sh
endif
if AX_MANUAL
TESTS += test_thredds.sh
endif
endif endif
endif endif
@ -59,7 +71,7 @@ EXTRA_DIST = CMakeLists.txt test_common.h build.sh \
test_curlopt.sh test_data.sh test_hyrax.sh test_meta.sh \ test_curlopt.sh test_data.sh test_hyrax.sh test_meta.sh \
test_parse.sh test_raw.sh \ test_parse.sh test_raw.sh \
test_remote.sh test_constraints.sh test_thredds.sh \ test_remote.sh test_constraints.sh test_thredds.sh \
test_dap4url.sh \ test_dap4url.sh run test_earthdata.sh \
cdltestfiles rawtestfiles \ cdltestfiles rawtestfiles \
baseline baselineraw baselineremote baselinehyrax baselinethredds baseline baselineraw baselineremote baselinehyrax baselinethredds
@ -81,8 +93,8 @@ clean-local: clean-local-check
.PHONY: clean-local-check .PHONY: clean-local-check
clean-local-check: clean-local-check:
-rm -rf results results_test_* -rm -rf results results_*
-rm -f .dodsrc .daprc -rm -f .dodsrc .daprc .ncrc .netrc
# The shell file maketests.sh is used to build the testdata # The shell file maketests.sh is used to build the testdata
# for dap4 testing. It creates and fills the directories # for dap4 testing. It creates and fills the directories

View File

@ -0,0 +1,36 @@
#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
isolate "results_earthdata_dap4"
THISDIR=`pwd`
cd $ISOPATH
# This shell script tests reading of
# publically accessible DAP4 datasets on earthdata
# Setup
# Assume environment variable USERPWD="username:password"
USR=`echo "$USERPWD" | cut -d':' -f1 | tr -d '\n\r'`
PWD=`echo "$USERPWD" | cut -d':' -f2 | tr -d '\n\r'`
rm -fr ./.netrc ./.ncrc ./urscookies
echo "machine urs.earthdata.nasa.gov login $USR password $PWD" > ./.netrc
echo "HTTP.COOKIEJAR=${ISOPATH}/urscookies" > ./.ncrc
echo "HTTP.NETRC=${ISOPATH}/.netrc" >> ./.ncrc
TESTCASES="opendap1;dap4://opendap.earthdata.nasa.gov/collections/C2532426483-ORNL_CLOUD/granules/Daymet_Daily_V4R1.daymet_v4_daily_hi_tmax_2010.nc"
testcase() {
NM=`echo "$1" | cut -d';' -f1`
URL=`echo "$1" | cut -d';' -f2`
echo "*** Test: $NM = $URL"
rm -f "tmp_$NM.cdl"
${NCDUMP} -h -n $NM $URL > "tmp_${NM}.cdl"
}
for t in $TESTCASES ; do
testcase "$t"
done