1# Process with autom4te to create an -*- Autotest -*- test suite.
2
3AT_INIT([getdap])
4
5# AT_ARG_OPTION_ARG([generate],
6#    [--generate=arg   Build the baseline file for test 'arg'],
7#    dnl Break the arg into the last thing (file | url) and all of the previous things (switches)
8#    [url=
9#
10#    echo "getdap $at_arg_generate > $at_arg_generate_parse.baseline 2>&1";
11#     ./dmr-test -x -p $at_arg_generate_parse > $at_arg_generate_parse.baseline 2>&1;
12#     echo "Built baseline for $at_arg_generate_parse";
13#     exit],[])
14
15# Usage: GETDAP_TEST(<flags>, <path|url>, <baseline file>, <xfail?>)
16
17m4_define([GETDAP_TEST], [
18    AT_SETUP([getdap $1 $2 $3 ($4)])
19    AT_KEYWORDS([getdap])
20
21    # Added || true because expr-test returns 0 (failure) for some of
22    # these tests which is correct for the test - we expect some of
23    # the input to trigger an error response from the parser, et
24    # cetera. That's also why we capture both stdout and stderr -
25    # successful runs are sent to stdout while the errors are sent to
26    # stderr.
27
28    AT_CHECK([$abs_builddir/../getdap $1 $2 || true], [], [stdout], [stderr])
29    AT_CHECK([diff -b -B $abs_srcdir/$3 stdout || diff -b -B $abs_srcdir/$3 stderr], [], [ignore],[],[])
30    AT_XFAIL_IF([test "$4" = "xfail"])
31    AT_CLEANUP
32])
33
34GETDAP_TEST([-d], [http://test.opendap.org/dap/data/nc/fnoc1.nc], [getdap-testsuite/fnoc1.nc.dds], [pass])
35