File: tst_tds.sh

package info (click to toggle)
netcdf 1:4.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 104,952 kB
  • sloc: ansic: 228,683; sh: 10,980; yacc: 2,561; makefile: 1,319; lex: 1,173; xml: 173; awk: 2
file content (172 lines) | stat: -rwxr-xr-x 3,669 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/sh

set -e

# 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.

if test "x$topsrcdir" != x ; then
  srcdir="$topsrcdir/ncdap_test"
else
  srcdir=`dirname $0`
fi

cd $srcdir
srcdir=`pwd`

# compute the build directory
builddir=`pwd`/..
# Hack for CYGWIN
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
    srcdir=`pwd | sed 's/\/c\//c:\//g'`
    builddir="$srcdir"/..
fi

cd ${builddir}/ncdap_test

quiet=0
cache=1
leakcheck=0

if test "x$cache" = "x1" ; then
CACHEPARAM="[cache]"
else
CACHEPARAM=""
fi

PARAMS="[netcdf3][log]${CACHEPARAM}"

#OCLOGFILE=/dev/null
OCLOGFILE="" ; export OCLOGFILE

# Locate the testdata and expected directory
EXPECTED="${srcdir}/expecttds3"

# get the list of test files
##################################################
# Special test info
##################################################
# TDS files under 10 megabytes
# TDS Catalog: http://thredds.ucar.edu/thredds/catalog/public/dataset/catalog.html

TDSURL1="http://thredds.ucar.edu/thredds/dodsC/public/dataset"
TDSTESTS1="\
tst-striped.nc \
tst-PROFILER_RASS.nc \
tst-upc-nmm-point.nc \
testData2.nc \
testData.nc \
tst-ocean.nc \
tst-sst.nc \
tst-RUC.nc \
tst-NCEP-NAM-CONUS.nc \
tst-NCEP-SREF-CONUS.nc \
tst-NWS-NDFD-CONUS.nc \
tst-NCEP-RUC-CONUS.nc \
tst-NCEP-GFS-ALASKA.nc \
tst-PROFILER.nc"

# TDS files over 10 megabytes
TDSURL2="${TDSURL1}"
TDSTESTS2="\
tst-NCEP-DGEX-CONUS.nc \
tst-upc-nmm-grid.nc \
tst-eta.nc \
tst-NCEP-GEFS-GLOBAL.nc \
tst-GFS_Global.nc \
tst-Surface-METAR.nc"

TESTURL="${TDSURL1}"
TESTSET="${TDSTESTS1}"

# Temporarily suppress
XFAILTESTS="tst-Surface-METAR.nc"

RESULTSDIR="./results_tst_tds"
expected3="${srcdir}/expecttds3"

# Locate some tools
NCDUMP="${builddir}/ncdump/ncdump"
NCCOPY="${builddir}/ncdump/nccopy"

if test "x$leakcheck" = x1 ; then
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
fi

rm -fr ${RESULTSDIR}
mkdir "${RESULTSDIR}"

passcount=0
xfailcount=0
failcount=0

if test "x$quiet" = "x0" ; then 
echo "*** Testing TDS server"
echo "*** URL: ${TESTURL}"
echo "*** PARAMS: ${PARAMS}"
fi

cd ${RESULTSDIR}
for t in ${TESTSET} ; do
  name="$t"
  url="${PARAMS}${TESTURL}/$name"
  if test "x$quiet" = "x0" ; then echo "*** Testing: ${name}"; fi

  # Ignore missing cases
#  if test -f ${EXPECTED}/${name}.dmp
#  then ignore=1; else echo "Missing: ${EXPECTED}/${name}.dmp";  continue; fi

  # determine if this is an xfailtest
  isxfail=0
  for x in ${XFAILTESTS} ; do
    if test "x${name}" = "x${x}" ; then isxfail=1; fi
  done

  status=0

  if ${VALGRIND} ${NCCOPY} ${url} ${name}.nc
  then status=$status; else status=1; fi

  if ${NCDUMP} ${name}.nc > ${name}.dmp
  then status=$status; else status=1; fi

  if diff -w ${EXPECTED}/${name}.dmp ${name}.dmp
  then status=$status; else status=1; fi

  if test "x$status" = "x1" ; then
    if test "x$isxfail" = "x1" ; then status=2; fi  # xfail
  fi

  case "$status" in
  0)
    passcount=`expr $passcount + 1`
    if test "x$quiet" = "x" ; then echo "*** SUCCEED: ${name}"; fi
    ;;
  1)
    failcount=`expr $failcount + 1`
    echo "*** FAIL:  ${name}"
    ;;
  2)
    xfailcount=`expr $xfailcount + 1`
    echo "*** XFAIL : ${name}"
    ;;
  esac

done
cd ..

rm -fr ${RESULTSDIR}
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`

echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"

# Ignore failures for now
#failcount=0
if test "$failcount" -gt 0 ; then
  exit 1
else
  exit 0
fi