netcdf-c/nc_test/CMakeLists.txt

102 lines
3.2 KiB
CMake
Raw Normal View History

Primary change: add dap4 support Specific changes: 1. Add dap4 code: libdap4 and dap4_test. Note that until the d4ts server problem is solved, dap4 is turned off. 2. Modify various files to support dap4 flags: configure.ac, Makefile.am, CMakeLists.txt, etc. 3. Add nc_test/test_common.sh. This centralizes the handling of the locations of various things in the build tree: e.g. where is ncgen.exe located. See nc_test/test_common.sh for details. 4. Modify .sh files to use test_common.sh 5. Obsolete separate oc2 by moving it to be part of netcdf-c. This means replacing code with netcdf-c equivalents. 5. Add --with-testserver to configure.ac to allow override of the servers to be used for --enable-dap-remote-tests. 6. There were multiple versions of nctypealignment code. Try to centralize in libdispatch/doffset.c and include/ncoffsets.h 7. Add a unit test for the ncuri code because of its complexity. 8. Move the findserver code out of libdispatch and into a separate, self contained program in ncdap_test and dap4_test. 9. Move the dispatch header files (nc{3,4}dispatch.h) to .../include because they are now shared by modules. 10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts. 11. Make use of MREMAP if available 12. Misc. minor changes e.g. - #include <config.h> -> #include "config.h" - Add some no-install headers to /include - extern -> EXTERNL and vice versa as needed - misc header cleanup - clean up checking for misc. unix vs microsoft functions 13. Change copyright decls in some files to point to LICENSE file. 14. Add notes to RELEASENOTES.md
2017-03-09 08:01:10 +08:00
message(STATUS "CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}")
add_definitions(-D"TOPSRCDIR=${CMAKE_SOURCE_DIR}")
add_definitions(-D"TOPBINDIR=${CMAKE_BINARY_DIR}")
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include)
SET (nc_test_m4_SOURCES test_get test_put test_read test_write)
FOREACH (F ${nc_test_m4_SOURCES})
GEN_m4(${F})
ENDFOREACH()
2014-08-23 23:34:16 +08:00
SET (nc_test_SRC
nc_test.c
error.c
test_get.c
test_put.c
test_read.c
test_write.c
2014-08-23 23:34:16 +08:00
util.c
)
2015-12-23 03:02:18 +08:00
ADD_EXECUTABLE(nc_test ${nc_test_SRC})
2014-08-23 23:34:16 +08:00
TARGET_LINK_LIBRARIES(nc_test
netcdf
${HAVE_LIBM}
)
# Some extra stand-alone tests
SET(TESTS t_nc tst_small tst_misc tst_norm tst_names tst_nofill tst_nofill2 tst_nofill3 tst_meta tst_inq_type tst_utf8_validate tst_utf8_phrases tst_global_fillval tst_max_var_dims tst_formats tst_def_var_fill tst_err_enddef tst_default_format)
2012-09-15 05:35:25 +08:00
IF(NOT HAVE_BASH)
SET(TESTS ${TESTS} tst_atts3)
2012-09-15 05:35:25 +08:00
ENDIF()
IF(USE_PNETCDF)
build_bin_test_no_prefix(tst_pnetcdf)
build_bin_test_no_prefix(tst_parallel2)
build_bin_test_no_prefix(tst_addvar)
add_sh_test(nc_test run_pnetcdf_test)
add_bin_test(nc_test tst_formatx_pnetcdf)
add_bin_test(nc_test tst_default_format_pnetcdf)
ENDIF()
IF(LARGE_FILE_TESTS)
SET(TESTS ${TESTS} quick_large_files tst_big_var6 tst_big_var2 tst_big_rvar tst_big_var tst_large tst_large_cdf5)
IF(NOT MSVC)
SET(TESTS ${TESTS} large_files)
ENDIF()
ENDIF()
SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory tst_open_mem)
IF(USE_NETCDF4)
SET(TESTFILES ${TESTFILES} tst_diskless2)
Revert/Improve nc_create + NC_DISKLESS behavior re: https://github.com/Unidata/netcdf-c/issues/1154 Inadvertently, the behavior of NC_DISKLESS with nc_create() was changed in release 4.6.1. Previously, the NC_WRITE flag needed to be explicitly used with NC_DISKLESS in order to cause the created file to be persisted to disk. Additional analyis indicated that the current NC_DISKLESS implementation was seriously flawed. This PR attempts to clean up and regularize the situation with respect to NC_DISKLESS control. One important aspect of diskless operation is that there are two different notions of write. 1. The file is read-write vs read-only when using the netcdf API. 2. The file is persisted or not to disk at nc_close(). Previously, these two were conflated. The rules now are as follows. 1. NC_DISKLESS + NC_WRITE means that the file is read/write using the netcdf API 2. NC_DISKLESS + NC_PERSIST means that the file is persisted to a disk file at nc_close. 3. NC_DISKLESS + NC_PERSIST + NC_WRITE means both 1 and 2. The NC_PERSIST flag is new and takes over the obsolete NC_MPIPOSIX flag. NC_MPIPOSIX is still defined, but is now an alias for the NC_MPIIO flag. It is also now the case that for netcdf-4, NC_DISKLESS is independent of NC_INMEMORY and in fact it is an error to specify both flags simultaneously. Finally, the MMAP code was fixed to use NC_PERSIST as well. Also marked MMAP as deprecated. Also added a test case to test various combinations of NC_DISKLESS, NC_PERSIST, and NC_WRITE. This PR affects a number of files and especially test cases that used NC_DISKLESS. Misc. Unrelated fixes 1. fixed some warnings in ncdump/dumplib.c
2018-10-11 03:32:17 +08:00
SET(TESTFILES ${TESTFILES} tst_diskless6)
ENDIF()
2013-02-15 04:24:02 +08:00
# Build executables required for the shell scripts.
FOREACH(BINFILE ${TESTFILES})
build_bin_test(${BINFILE})
2013-02-15 04:24:02 +08:00
ENDFOREACH()
2013-02-15 04:24:02 +08:00
# Process single-file test files.
FOREACH(CTEST ${TESTS})
add_bin_test(nc_test ${CTEST})
ENDFOREACH()
ADD_TEST(nc_test ${EXECUTABLE_OUTPUT_PATH}/nc_test)
IF(BUILD_UTILITIES)
add_sh_test(nc_test run_diskless)
IF(BUILD_MMAP)
add_sh_test(nc_test run_mmap)
2017-12-02 06:23:26 +08:00
SET_TESTS_PROPERTIES(nc_test_run_mmap PROPERTIES RUN_SERIAL TRUE)
ENDIF(BUILD_MMAP)
IF(LARGE_FILE_TESTS)
add_sh_test(nc_test run_diskless2)
ENDIF(LARGE_FILE_TESTS)
2017-05-03 23:58:49 +08:00
add_sh_test(nc_test run_diskless5)
add_sh_test(nc_test run_inmemory)
ENDIF(BUILD_UTILITIES)
2013-02-15 04:24:02 +08:00
# Copy some test files from current source dir to out-of-tree build dir.
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
IF(MSVC)
FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
ENDIF()
## Specify files to be distributed by 'make dist'
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
2017-05-03 23:58:49 +08:00
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} test_get.m4 test_put.m4 test_read.m4 test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")