From d0a10dbbaca764a17f5e90d6ec0a85097c72125a Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Tue, 27 Feb 2018 14:22:04 -0700 Subject: [PATCH 1/7] re: gh issue https://github.com/Unidata/netcdf-c/issues/887 Make sure that all attempts to access the rc file triples check first for triple->host being null. --- libdap4/d4curlfunctions.c | 6 ++++-- libdispatch/drc.c | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libdap4/d4curlfunctions.c b/libdap4/d4curlfunctions.c index 0c4f0bc26a..f4eafbaf26 100644 --- a/libdap4/d4curlfunctions.c +++ b/libdap4/d4curlfunctions.c @@ -200,12 +200,14 @@ set_curl_options(NCD4INFO* state) for(i=0;ihost); + size_t hostlen = (triple->host ? strlen(triple->host) : 0); const char* flagname; if(strncmp("CURL.",triple->key,5) != 0) continue; /* not a curl flag */ /* do hostport prefix comparison */ if(hostport != NULL) { - int t = strncmp(hostport,triple->host,hostlen); + int t = 0; + if(triple->host != NULL) + t = strncmp(hostport,triple->host,hostlen); if(t != 0) continue; } flagname = triple->key+5; /* 5 == strlen("CURL."); */ diff --git a/libdispatch/drc.c b/libdispatch/drc.c index c1b8b0cfe4..e2de99debe 100644 --- a/libdispatch/drc.c +++ b/libdispatch/drc.c @@ -315,6 +315,8 @@ rccompile(const char* path) } ncbytesnull(tmp); triple->host = ncbytesextract(tmp); + if(strlen(triple->host)==0) + {free(triple->host); triple->host = NULL;} } /* split off key and value */ key=line; @@ -331,7 +333,8 @@ rccompile(const char* path) rctrim(triple->value); #ifdef D4DEBUG fprintf(stderr,"rc: host=%s key=%s value=%s\n", - triple->host,triple->key,triple->valu); + (triple->host != NULL ? triple->host : ""), + triple->key,triple->valu); #endif nclistpush(rc,triple); triple = NULL; @@ -371,7 +374,9 @@ rclocate(const char* key, const char* hostport) (because we have checked all other cases)*/ if(hplen == 0) {found=1;break;} /* do hostport match */ - t = strcmp(hostport,triple->host); + t = 0; + if(triple->host != NULL) + t = strcmp(hostport,triple->host); if(t == 0) {found=1; break;} } return (found?triple:NULL); From 17f7a7635696120b8ca8586a18957b3406b9e2b0 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 03:45:18 -0700 Subject: [PATCH 2/7] moved HDF4 tests --- CMakeLists.txt | 1 + configure.ac | 5 +- hdf4_test/CMakeLists.txt | 16 ++++++ hdf4_test/Makefile.am | 37 ++++++++++++++ {nc_test4 => hdf4_test}/ref_chunked.hdf4 | Bin {nc_test4 => hdf4_test}/ref_contiguous.hdf4 | Bin {nc_test4 => hdf4_test}/run_chunk_hdf4.sh | 0 {nc_test4 => hdf4_test}/run_get_hdf4_files.sh | 0 {nc_test4 => hdf4_test}/tst_chunk_hdf4.c | 0 {nc_test4 => hdf4_test}/tst_formatx_hdf4.sh | 19 ++++++- {nc_test4 => hdf4_test}/tst_h4_lendian.c | 0 {nc_test4 => hdf4_test}/tst_hdf4_read_var.sh | 0 {nc_test4 => hdf4_test}/tst_interops2.c | 2 +- {nc_test4 => hdf4_test}/tst_interops3.c | 1 - nc_test4/Makefile.am | 48 ++++-------------- 15 files changed, 85 insertions(+), 44 deletions(-) create mode 100644 hdf4_test/CMakeLists.txt create mode 100644 hdf4_test/Makefile.am rename {nc_test4 => hdf4_test}/ref_chunked.hdf4 (100%) rename {nc_test4 => hdf4_test}/ref_contiguous.hdf4 (100%) rename {nc_test4 => hdf4_test}/run_chunk_hdf4.sh (100%) rename {nc_test4 => hdf4_test}/run_get_hdf4_files.sh (100%) rename {nc_test4 => hdf4_test}/tst_chunk_hdf4.c (100%) rename {nc_test4 => hdf4_test}/tst_formatx_hdf4.sh (55%) rename {nc_test4 => hdf4_test}/tst_h4_lendian.c (100%) rename {nc_test4 => hdf4_test}/tst_hdf4_read_var.sh (100%) rename {nc_test4 => hdf4_test}/tst_interops2.c (99%) rename {nc_test4 => hdf4_test}/tst_interops3.c (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a149e0fe4d..8f80859b9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1623,6 +1623,7 @@ ENDIF(USE_HDF5) IF(USE_HDF4) add_subdirectory(libhdf4) + add_subdirectory(test_hdf4) ENDIF(USE_HDF4) IF(ENABLE_DAP2) diff --git a/configure.ac b/configure.ac index 726c0bda41..a981fb0294 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/hdf4_test/CMakeLists.txt b/hdf4_test/CMakeLists.txt new file mode 100644 index 0000000000..190827ef14 --- /dev/null +++ b/hdf4_test/CMakeLists.txt @@ -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() + diff --git a/hdf4_test/Makefile.am b/hdf4_test/Makefile.am new file mode 100644 index 0000000000..5bb7e82898 --- /dev/null +++ b/hdf4_test/Makefile.am @@ -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 + diff --git a/nc_test4/ref_chunked.hdf4 b/hdf4_test/ref_chunked.hdf4 similarity index 100% rename from nc_test4/ref_chunked.hdf4 rename to hdf4_test/ref_chunked.hdf4 diff --git a/nc_test4/ref_contiguous.hdf4 b/hdf4_test/ref_contiguous.hdf4 similarity index 100% rename from nc_test4/ref_contiguous.hdf4 rename to hdf4_test/ref_contiguous.hdf4 diff --git a/nc_test4/run_chunk_hdf4.sh b/hdf4_test/run_chunk_hdf4.sh similarity index 100% rename from nc_test4/run_chunk_hdf4.sh rename to hdf4_test/run_chunk_hdf4.sh diff --git a/nc_test4/run_get_hdf4_files.sh b/hdf4_test/run_get_hdf4_files.sh similarity index 100% rename from nc_test4/run_get_hdf4_files.sh rename to hdf4_test/run_get_hdf4_files.sh diff --git a/nc_test4/tst_chunk_hdf4.c b/hdf4_test/tst_chunk_hdf4.c similarity index 100% rename from nc_test4/tst_chunk_hdf4.c rename to hdf4_test/tst_chunk_hdf4.c diff --git a/nc_test4/tst_formatx_hdf4.sh b/hdf4_test/tst_formatx_hdf4.sh similarity index 55% rename from nc_test4/tst_formatx_hdf4.sh rename to hdf4_test/tst_formatx_hdf4.sh index f008fe3e1d..67002a439c 100755 --- a/nc_test4/tst_formatx_hdf4.sh +++ b/hdf4_test/tst_formatx_hdf4.sh @@ -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." diff --git a/nc_test4/tst_h4_lendian.c b/hdf4_test/tst_h4_lendian.c similarity index 100% rename from nc_test4/tst_h4_lendian.c rename to hdf4_test/tst_h4_lendian.c diff --git a/nc_test4/tst_hdf4_read_var.sh b/hdf4_test/tst_hdf4_read_var.sh similarity index 100% rename from nc_test4/tst_hdf4_read_var.sh rename to hdf4_test/tst_hdf4_read_var.sh diff --git a/nc_test4/tst_interops2.c b/hdf4_test/tst_interops2.c similarity index 99% rename from nc_test4/tst_interops2.c rename to hdf4_test/tst_interops2.c index ee8c2ab448..2b7ff2681a 100644 --- a/nc_test4/tst_interops2.c +++ b/hdf4_test/tst_interops2.c @@ -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; diff --git a/nc_test4/tst_interops3.c b/hdf4_test/tst_interops3.c similarity index 99% rename from nc_test4/tst_interops3.c rename to hdf4_test/tst_interops3.c index 4603e8866e..166c50c663 100644 --- a/nc_test4/tst_interops3.c +++ b/hdf4_test/tst_interops3.c @@ -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; diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 6423d780ec..417a0c6309 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -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 From 3e6661e1b17fd664f8118e7d1f0512aa53091caf Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 04:22:15 -0700 Subject: [PATCH 3/7] fixed name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f80859b9e..29f1c04dc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1623,7 +1623,7 @@ ENDIF(USE_HDF5) IF(USE_HDF4) add_subdirectory(libhdf4) - add_subdirectory(test_hdf4) + add_subdirectory(hdf4_test) ENDIF(USE_HDF4) IF(ENABLE_DAP2) From a9457a61690f9aebd3ff3ace89daa235f4b085e5 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 04:52:53 -0700 Subject: [PATCH 4/7] fixed cmake build file --- hdf4_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdf4_test/CMakeLists.txt b/hdf4_test/CMakeLists.txt index 190827ef14..1d95d9b123 100644 --- a/hdf4_test/CMakeLists.txt +++ b/hdf4_test/CMakeLists.txt @@ -8,7 +8,7 @@ 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_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) From 4e646e03f6b70a754ce67f6cf389e92990e31290 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 05:03:46 -0700 Subject: [PATCH 5/7] fixed cmake build file --- nc_test4/CMakeLists.txt | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt index 7247d0d718..7502d16bc2 100644 --- a/nc_test4/CMakeLists.txt +++ b/nc_test4/CMakeLists.txt @@ -72,7 +72,7 @@ IF(BUILD_BENCHMARKS) ENDIF() # 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}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.hdf4 ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl) +FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl) FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) IF(MSVC) FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/) @@ -83,20 +83,6 @@ FOREACH(CTEST ${NC4_TESTS}) add_bin_test(nc_test4 ${CTEST}) ENDFOREACH() -# This must go after the 'foreach' stanza -# immediately above this comment. -IF(USE_HDF4_FILE_TESTS AND NOT MSVC) - add_bin_test_no_prefix(tst_interops2) - build_bin_test_no_prefix(tst_interops3) - add_sh_test(nc_test4 run_get_hdf4_files) - add_sh_test(nc_test4 tst_formatx_hdf4) - build_bin_test(tst_chunk_hdf4) - add_sh_test(nc_test4 run_chunk_hdf4) - add_bin_test(nc_test4 tst_h4_lendian) - add_sh_test(nc_test4 tst_hdf4_read_var) - SET_TESTS_PROPERTIES(nc_test4_tst_hdf4_read_var PROPERTIES DEPENDS tst_interops2) -ENDIF() - IF(TEST_PARALLEL4) build_bin_test(tst_mpi_parallel) build_bin_test(tst_parallel) From a5713f7ac03c291896073299fd4e1b9c6d96cf58 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 05:38:00 -0700 Subject: [PATCH 6/7] fixed cmake build for hdf4_tests --- hdf4_test/run_chunk_hdf4.sh | 26 ------------------ ...st_formatx_hdf4.sh => run_formatx_hdf4.sh} | 6 +++-- hdf4_test/tst_hdf4_read_var.sh | 27 ------------------- 3 files changed, 4 insertions(+), 55 deletions(-) delete mode 100755 hdf4_test/run_chunk_hdf4.sh rename hdf4_test/{tst_formatx_hdf4.sh => run_formatx_hdf4.sh} (88%) delete mode 100755 hdf4_test/tst_hdf4_read_var.sh diff --git a/hdf4_test/run_chunk_hdf4.sh b/hdf4_test/run_chunk_hdf4.sh deleted file mode 100755 index 5debe5fcfd..0000000000 --- a/hdf4_test/run_chunk_hdf4.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# Run test_chunk_hdf4 passing ${srcdir} - - - -if test "x$srcdir" = x ; then srcdir=`pwd`; fi -. ../test_common.sh - -set -e - -echo "" -echo "*** Testing hdf4 chunking..." - -if test "x${srcdir}" = "x" ; then -srcdir="." -fi - -if ./tst_chunk_hdf4 ; then - echo "***SUCCESS!! tst_chunk_hdf4" -else - RES=$? - echo "***FAIL: tst_chunk_hdf4" - exit $RES -fi - -exit 0 diff --git a/hdf4_test/tst_formatx_hdf4.sh b/hdf4_test/run_formatx_hdf4.sh similarity index 88% rename from hdf4_test/tst_formatx_hdf4.sh rename to hdf4_test/run_formatx_hdf4.sh index 67002a439c..8fc19928e7 100755 --- a/hdf4_test/tst_formatx_hdf4.sh +++ b/hdf4_test/run_formatx_hdf4.sh @@ -1,5 +1,8 @@ #!/bin/sh -# This shell script tests the output several previous tests. + +# This shell script runs tst_interops2 to create a HDF4 file, and read +# it with netCDF. Then the script runs ncdump on the HDF4 file. + # Ed Hartnett if test "x$srcdir" = x ; then srcdir=`pwd`; fi @@ -25,7 +28,6 @@ echo "*** Fail: extended format for an HDF4 file: result=" $TMP ECODE=1 fi -# Clean up. rm -f tmp_tst_formatx_hdf4 # Exit if there was a failure. diff --git a/hdf4_test/tst_hdf4_read_var.sh b/hdf4_test/tst_hdf4_read_var.sh deleted file mode 100755 index a59d96f739..0000000000 --- a/hdf4_test/tst_hdf4_read_var.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# This shell script tests that an hdf4 file can be read a -# variable at a time. -# -# this was added in support of https://github.com/Unidata/netcdf-c/issues/264 - -if test "x$srcdir" = x ; then srcdir=`pwd`; fi -. ../test_common.sh - - -FILE=tst_interops2.h4 - -set -e - -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." From 016049e5099912056cce8418adb184c403ab3e03 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 5 Mar 2018 05:53:41 -0700 Subject: [PATCH 7/7] fixed makefile for hdf4_test --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f8c1e3eb89..ea4f6193b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -64,13 +64,14 @@ endif # Build HDF4 if desired. if USE_HDF4 +HDF4_TEST_DIR = hdf4_test LIBHDF4 = libhdf4 endif # Define Test directories if BUILD_TESTSETS -TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(NCDAP2TESTDIR) \ -$(NCDAP4TESTDIR) +TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(HDF4_TEST_DIR) \ +$(NCDAP2TESTDIR) $(NCDAP4TESTDIR) endif # This is the list of subdirs for which Makefiles will be constructed