Skip to content

Commit

Permalink
Add earthdata test case
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisHeimbigner committed Jun 11, 2023
1 parent 1f12c09 commit 9341904
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,8 @@ AC_SUBST([ISCMAKE], [])

# Provide conditional to temporarily suppress tests and such
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_CONFIG_FILES(test_common.sh:test_common.in)
Expand Down
13 changes: 12 additions & 1 deletion dap4_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,19 @@ ENDIF()
IF(ENABLE_DAP_REMOTE_TESTS)
add_sh_test(dap4_test test_remote)
add_sh_test(dap4_test test_hyrax)
# add_sh_test(dap4_test test_thredds)
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_TESTS)
Expand Down
20 changes: 16 additions & 4 deletions dap4_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,21 @@ if ENABLE_DAP_REMOTE_TESTS
TESTS += test_remote.sh
TESTS += test_constraints.sh
TESTS += test_hyrax.sh
#TESTS += test_thredds.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

Expand All @@ -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_parse.sh test_raw.sh \
test_remote.sh test_constraints.sh test_thredds.sh \
test_dap4url.sh \
test_dap4url.sh run test_earthdata.sh \
cdltestfiles rawtestfiles \
baseline baselineraw baselineremote baselinehyrax baselinethredds

Expand All @@ -81,8 +93,8 @@ clean-local: clean-local-check
.PHONY: clean-local-check

clean-local-check:
-rm -rf results results_test_*
-rm -f .dodsrc .daprc
-rm -rf results results_*
-rm -f .dodsrc .daprc .ncrc .netrc

# The shell file maketests.sh is used to build the testdata
# for dap4 testing. It creates and fills the directories
Expand Down
36 changes: 36 additions & 0 deletions dap4_test/test_earthdata.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9341904

Please sign in to comment.