netcdf-c/ncdap_test/Makefile.am
Dennis Heimbigner df3636b959 Mitigate S3 test interference + Unlimited Dimensions in NCZarr
This PR started as an attempt to add unlimited dimensions to NCZarr.
It did that, but this exposed significant problems with test interference.
So this PR is mostly about fixing -- well mitigating anyway -- test
interference.

The problem of test interference is now documented in the document docs/internal.md.
The solutions implemented here are also describe in that document.
The solution is somewhat fragile but multiple cleanup mechanisms
are provided. Note that this feature requires that the
AWS command line utility must be installed.

## Unlimited Dimensions.
The existing NCZarr extensions to Zarr are modified to support unlimited dimensions.
NCzarr extends the Zarr meta-data for the ".zgroup" object to include netcdf-4 model extensions. This information is stored in ".zgroup" as dictionary named "_nczarr_group".
Inside "_nczarr_group", there is a key named "dims" that stores information about netcdf-4 named dimensions. The value of "dims" is a dictionary whose keys are the named dimensions. The value associated with each dimension name has one of two forms
Form 1 is a special case of form 2, and is kept for backward compatibility. Whenever a new file is written, it uses format 1 if possible, otherwise format 2.
* Form 1: An integer representing the size of the dimension, which is used for simple named dimensions.
* Form 2: A dictionary with the following keys and values"
   - "size" with an integer value representing the (current) size of the dimension.
   - "unlimited" with a value of either "1" or "0" to indicate if this dimension is an unlimited dimension.

For Unlimited dimensions, the size is initially zero, and as variables extend the length of that dimension, the size value for the dimension increases.
That dimension size is shared by all arrays referencing that dimension, so if one array extends an unlimited dimension, it is implicitly extended for all other arrays that reference that dimension.
This is the standard semantics for unlimited dimensions.

Adding unlimited dimensions required a number of other changes to the NCZarr code-base. These included the following.
* Did a partial refactor of the slice handling code in zwalk.c to clean it up.
* Added a number of tests for unlimited dimensions derived from the same test in nc_test4.
* Added several NCZarr specific unlimited tests; more are needed.
* Add test of endianness.

## Misc. Other Changes
* Modify libdispatch/ncs3sdk_aws.cpp to optionally support use of the
   AWS Transfer Utility mechanism. This is controlled by the
   ```#define TRANSFER```` command in that file. It defaults to being disabled.
* Parameterize both the standard Unidata S3 bucket (S3TESTBUCKET) and the netcdf-c test data prefix (S3TESTSUBTREE).
* Fixed an obscure memory leak in ncdump.
* Removed some obsolete unit testing code and test cases.
* Uncovered a bug in the netcdf-c handling of big-endian floats and doubles. Have not fixed yet. See tst_h5_endians.c.
* Renamed some nczarr_tests testcases to avoid name conflicts with nc_test4.
* Modify the semantics of zmap\#ncsmap_write to only allow total rewrite of objects.
* Modify the semantics of zodom to properly handle stride > 1.
* Add a truncate operation to the libnczarr zmap code.
2023-09-26 16:56:48 -06:00

138 lines
3.5 KiB
Makefile

## This is a automake file, part of Unidata's netCDF package.
# Copyright 2018v, see the COPYRIGHT file for more information.
# This file builds and runs DAP tests.
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
# Un comment to use a more verbose test driver
#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TESTS_ENVIRONMENT = export SETX=1;
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
LDADD = ${top_builddir}/liblib/libnetcdf.la
AM_CPPFLAGS += -I$(top_srcdir)/liblib
AM_CPPFLAGS += -DTOPSRCDIR=${abs_top_srcdir}
AM_CPPFLAGS += -DTOPBINDIR=${abs_top_builddir}
# Set up the tests; do the .sh first, then .c
check_PROGRAMS =
TESTS =
t_dap3a_SOURCES = t_dap3a.c t_srcdir.h
test_cvt3_SOURCES = test_cvt.c t_srcdir.h
test_vara_SOURCES = test_vara.c t_srcdir.h
if ENABLE_DAP
check_PROGRAMS += t_dap3a test_cvt3 test_vara
TESTS += t_dap3a test_cvt3 test_vara
if BUILD_UTILITIES
TESTS += tst_ncdap3.sh
endif
# remote tests are optional
# because the server may be down or inaccessible
if ENABLE_DAP_REMOTE_TESTS
noinst_PROGRAMS = findtestserver pingurl
findtestserver_SOURCES = findtestserver.c
pingurl_SOURCES = pingurl.c
if BUILD_UTILITIES
TESTS += tst_ber.sh tst_remote3.sh tst_formatx.sh testurl.sh tst_fillmismatch.sh tst_zero_len_var.sh
endif
# Remote servers
# iridl.ldeo.columbia.edu
TESTS += tst_encode.sh
# test.opendap.org
TESTS += tst_hyrax.sh
TESTS += test_partvar
if ENABLE_DAP_LONG_TESTS
TESTS += tst_longremote3.sh
tst_longremote3.log: tst_remote3.log
if ENABLE_EXTERNAL_SERVER_TESTS
test_manyurls_SOURCES = test_manyurls.c manyurls.h
check_PROGRAMS += test_manyurls
test_manyurls.log: tst_longremote3.log
TESTS += test_manyurls
endif
endif
test_partvar_SOURCES = test_partvar.c
t_misc_SOURCES = t_misc.c
#TESTS += t_ncf330
TESTS += t_misc
test_nstride_cached_SOURCES = test_nstride_cached.c
TESTS += test_nstride_cached
check_PROGRAMS += test_nstride_cached
test_varm3_SOURCES = test_varm3.c
TESTS += test_varm3
check_PROGRAMS += test_varm3
check_PROGRAMS += test_partvar
check_PROGRAMS += t_misc
check_PROGRAMS += t_ncf330
if ENABLE_DAP_AUTH_TESTS
TESTS += testauth.sh
endif
endif #ENABLE_DAP_REMOTE_TESTS
endif #ENABLE_DAP
# Need to add subdirs
SUBDIRS = testdata3 expected3 expectremote3 expectedhyrax
EXTRA_DIST = tst_ncdap3.sh \
tst_remote3.sh \
tst_longremote3.sh \
tst_zero_len_var.sh \
tst_filelists.sh tst_urls.sh tst_utils.sh \
t_dap.c CMakeLists.txt tst_formatx.sh testauth.sh testurl.sh \
t_ncf330.c tst_ber.sh tst_fillmismatch.sh tst_encode.sh tst_hyrax.sh \
findtestserver.c.in
CLEANFILES = test_varm3 test_cvt3 file_results/* remote_results/* datadds* t_dap3a test_nstride_cached *.exe tmp*.txt
# This should only be left behind if using parallel io
CLEANFILES += tmp_*
DISTCLEANFILES = findtestserver.c
# This rule are used if someone wants to rebuild t_dap3a.c
# Otherwise never invoked, but records how to do it.
t_dap3a.c: t_dap.c
echo "#define NETCDF3ONLY" > ./t_dap3a.c
cat t_dap.c >> t_dap3a.c
# One last thing
BUILT_SOURCES = .dodsrc
.dodsrc:
echo "#DODSRC" >.dodsrc
echo "HTTP.READ.BUFFERSIZE=max" >>.dodsrc
echo "HTTP.KEEPALIVE=60/60" >>.dodsrc
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf results
-rm -f .dodsrc
-rm -fr testdir_* testset_*
# If valgrind is present, add valgrind targets.
@VALGRIND_CHECK_RULES@