moved HDF4 tests

This commit is contained in:
Ed Hartnett 2018-03-05 03:45:18 -07:00
parent 04be884eb6
commit 17f7a76356
15 changed files with 85 additions and 44 deletions

View File

@ -1623,6 +1623,7 @@ ENDIF(USE_HDF5)
IF(USE_HDF4)
add_subdirectory(libhdf4)
add_subdirectory(test_hdf4)
ENDIF(USE_HDF4)
IF(ENABLE_DAP2)

View File

@ -72,8 +72,8 @@ AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat1.nc:nc_test4/ref_hdf5_compat1.nc])
AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat2.nc:nc_test4/ref_hdf5_compat2.nc])
AC_CONFIG_LINKS([nc_test4/ref_hdf5_compat3.nc:nc_test4/ref_hdf5_compat3.nc])
AC_CONFIG_LINKS([nc_test4/ref_chunked.hdf4:nc_test4/ref_chunked.hdf4])
AC_CONFIG_LINKS([nc_test4/ref_contiguous.hdf4:nc_test4/ref_contiguous.hdf4])
AC_CONFIG_LINKS([hdf4_test/ref_chunked.hdf4:hdf4_test/ref_chunked.hdf4])
AC_CONFIG_LINKS([hdf4_test/ref_contiguous.hdf4:hdf4_test/ref_contiguous.hdf4])
AM_INIT_AUTOMAKE([foreign dist-zip subdir-objects])
@ -1430,6 +1430,7 @@ AC_CONFIG_FILES([Makefile
include/netcdf_meta.h
include/Makefile
h5_test/Makefile
hdf4_test/Makefile
libsrc/Makefile
libsrc4/Makefile
libsrcp/Makefile

16
hdf4_test/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
# Copy some test files from current source dir to out-of-tree build dir.
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
IF(MSVC)
FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
ENDIF()
IF(USE_HDF4_FILE_TESTS AND NOT MSVC)
build_bin_test_no_prefix(tst_interops2)
build_bin_test_no_prefix(tst_interops3)
add_bin_test(tst_chunk_hdf4)
add_bin_test(hdf4_test tst_h4_lendian)
add_sh_test(hdf4_test run_get_hdf4_files)
add_sh_test(hdf4_test run_formatx_hdf4)
ENDIF()

37
hdf4_test/Makefile.am Normal file
View File

@ -0,0 +1,37 @@
# This is part of the netCDF package.
# Copyright 2018 University Corporation for Atmospheric Research/Unidata
# See COPYRIGHT file for conditions of use.
#
# This directory has tests for the HDF4 code. This directory will be
# skipped if HDF4 is not enabled.
#
# Ed Hartnett
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
# Link to our assembled library.
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
# These are the C tests for HDF4.
check_PROGRAMS = tst_chunk_hdf4 tst_h4_lendian
TESTS = tst_chunk_hdf4 tst_h4_lendian
# This test script depends on ncdump and tst_interops2.c.
if BUILD_UTILITIES
check_PROGRAMS += tst_interops2
TESTS += run_formatx_hdf4.sh
endif # BUILD_UTILITIES
# This test script fetches HDF4 files from an FTP server and uses
# program tst_interops3.c to read them.
if USE_HDF4_FILE_TESTS
check_PROGRAMS += tst_interops3
TESTS += run_get_hdf4_files.sh
endif # USE_HDF4_FILE_TESTS
EXTRA_DIST = CMakeLists.txt ref_contiguous.hdf4 ref_chunked.hdf4 \
run_get_hdf4_files.sh run_formatx_hdf4.sh
CLEANFILES = *.h4 *.hdf

View File

@ -25,8 +25,25 @@ echo "*** Fail: extended format for an HDF4 file: result=" $TMP
ECODE=1
fi
# Clean up.
rm -f tmp_tst_formatx_hdf4
exit $ECODE
# Exit if there was a failure.
if test $ECODE = 1 ; then
exit $ECODE
fi
echo ""
echo "*** Testing reading an individual variable from an HDF4 file."
${NCDUMP} -v hdf4_dataset_type_0 $FILE
${NCDUMP} -v hdf4_dataset_type_1 $FILE
${NCDUMP} -v hdf4_dataset_type_2 $FILE
${NCDUMP} -v hdf4_dataset_type_3 $FILE
${NCDUMP} -v hdf4_dataset_type_4 $FILE
${NCDUMP} -v hdf4_dataset_type_5 $FILE
${NCDUMP} -v hdf4_dataset_type_6 $FILE
${NCDUMP} -v hdf4_dataset_type_7 $FILE
echo "*** Success."

View File

@ -65,7 +65,7 @@ main(int argc, char **argv)
/* Expected this to return NC_EPERM, but instead it returns
* success. See github issue #744. */
/* if (nc_def_var_chunking_ints(ncid, 0, NC_CONTIGUOUS, NULL) != NC_EPERM) ERR; */
/* if (nc_def_var_chunking_ints(ncid, 0, NC_CONTIGUOUS, NULL)) ERR; */
/* Read the data through a vara function from the netCDF API. */
if (nc_get_vara(ncid, 0, nstart, ncount, data_in)) ERR;

View File

@ -77,7 +77,6 @@ main(int argc, char **argv)
"MOD29.A2000055.0005.005.2006267200024.hdf",
"MYD29.A2002185.0000.005.2007160150627.hdf",
"MYD29.A2009152.0000.005.2009153124331.hdf"};
size_t len_in;
int expected_mode = NC_NETCDF4;
int expected_extended_format = NC_FORMATX_NC_HDF4;
int f;

View File

@ -95,26 +95,6 @@ benchmarks: check
./run_bm_ar4.sh
endif # BUILD_BENCHMARKS
# These are the tests for HDF4.
if USE_HDF4
check_PROGRAMS += tst_interops2 tst_chunk_hdf4 tst_h4_lendian
if BUILD_UTILITIES
# This test script depends on ncdump.
TESTS += tst_interops2 tst_formatx_hdf4.sh
tst_formatx_hdf4.log: tst_interops2.log
endif # BUILD_UTILITIES
TESTS += run_chunk_hdf4.sh tst_h4_lendian
if USE_HDF4_FILE_TESTS
check_PROGRAMS += tst_interops3
TESTS += run_get_hdf4_files.sh tst_hdf4_read_var.sh
tst_hdf4_read_var.log: tst_interops2.log
endif # USE_HDF4_FILE_TESTS
endif # USE_HDF4
# Szip Tests (requires ncdump)
if USE_SZIP
if BUILD_UTILITIES
@ -143,17 +123,15 @@ EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh \
run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh \
run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh \
run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl \
ref_chunks2.cdl run_get_hdf4_files.sh run_bm_ar4.sh \
ref_tst_compounds.nc ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc \
ref_tst_dims.nc ref_tst_interops4.nc run_get_knmi_files.sh \
CMakeLists.txt run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh tst_h5_endians.c tst_h4_lendian.c \
tst_atts_string_rewrite.c tst_put_vars_two_unlim_dim.c \
tst_empty_vlen_unlim.c run_empty_vlen_test.sh ref_hdf5_compat1.nc \
ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh tdset.h5 \
tst_hdf4_read_var.sh ref_contiguous.hdf4 ref_chunked.hdf4 tst_szip.sh \
ref_szip.h5 ref_szip.cdl tst_filter.sh bzip2.cdl filtered.cdl \
unfiltered.cdl ref_bzip2.c findplugin.in
ref_chunks2.cdl run_bm_ar4.sh ref_tst_compounds.nc \
ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc \
ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt \
run_grp_rename.sh tst_h5_endians.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c \
run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc \
ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_szip.sh ref_szip.h5 \
ref_szip.cdl tst_filter.sh bzip2.cdl filtered.cdl unfiltered.cdl \
ref_bzip2.c findplugin.in
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
@ -171,12 +149,4 @@ szip_dump.cdl
DISTCLEANFILES = findplugin.sh
if USE_HDF4_FILE_TESTS
DISTCLEANFILES += AMSR_E_L2_Rain_V10_200905312326_A.hdf \
AMSR_E_L3_DailyLand_V06_20020619.hdf \
MYD29.A2009152.0000.005.2009153124331.hdf \
MYD29.A2002185.0000.005.2007160150627.hdf \
MOD29.A2000055.0005.005.2006267200024.hdf
endif # HDF4_FILE_TESTS
SUBDIRS=hdf5plugins