2010-06-03 21:24:43 +08:00
|
|
|
## This is a automake file, part of Unidata's netCDF package.
|
|
|
|
# Copyright 2005, see the COPYRIGHT file for more information.
|
|
|
|
# This file builds and runs the ncdump program.
|
|
|
|
|
|
|
|
# $Id: Makefile.am,v 1.147 2010/05/29 00:50:39 dmh Exp $
|
|
|
|
|
2011-03-22 04:31:56 +08:00
|
|
|
# Put together AM_CPPFLAGS and AM_LDFLAGS.
|
|
|
|
include $(top_srcdir)/lib_flags.am
|
2014-08-26 04:30:11 +08:00
|
|
|
LDADD = ${top_builddir}/liblib/libnetcdf.la
|
2010-06-03 21:24:43 +08:00
|
|
|
|
re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446
Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.
Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.
Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf
Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.
This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
an offset are properly recognized. It does so by prefixing
a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-25 06:25:09 +08:00
|
|
|
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
|
|
|
|
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
|
|
|
|
|
2012-03-08 07:38:51 +08:00
|
|
|
TESTS_ENVIRONMENT=CC=${CC}
|
|
|
|
|
2011-03-22 04:31:56 +08:00
|
|
|
# This is the program we're building, and it's sources.
|
2014-08-26 04:30:11 +08:00
|
|
|
bin_PROGRAMS = ncdump
|
2017-11-12 07:45:03 +08:00
|
|
|
ncdump_SOURCES = ncdump.c vardata.c dumplib.c indent.c nctime0.c \
|
|
|
|
ncdump.h vardata.h dumplib.h indent.h isnan.h nctime0.h cdl.h utils.h \
|
|
|
|
utils.c nciter.h nciter.c nccomps.h
|
2011-03-22 04:31:56 +08:00
|
|
|
|
|
|
|
# Another utility program that copies any netCDF file using only the
|
|
|
|
# netCDF API
|
|
|
|
bin_PROGRAMS += nccopy
|
2017-11-12 07:45:03 +08:00
|
|
|
nccopy_SOURCES = nccopy.c nciter.c nciter.h chunkspec.h chunkspec.c \
|
2011-03-22 04:31:56 +08:00
|
|
|
utils.h utils.c dimmap.h dimmap.c
|
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
if USE_NETCDF4
|
|
|
|
noinst_PROGRAMS = nc4print
|
|
|
|
nc4print_SOURCES = nc4print.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Conditionally build the ocprint program, but do not install
|
|
|
|
if ENABLE_DAP
|
|
|
|
bin_PROGRAMS += ocprint
|
2017-11-12 07:45:03 +08:00
|
|
|
ocprint_SOURCES = ocprint.c
|
2017-03-09 08:01:10 +08:00
|
|
|
endif
|
|
|
|
|
2011-03-22 04:31:56 +08:00
|
|
|
# This is the man page.
|
|
|
|
man_MANS = ncdump.1 nccopy.1
|
|
|
|
|
2012-04-13 10:41:00 +08:00
|
|
|
if BUILD_TESTSETS
|
2010-06-03 21:24:43 +08:00
|
|
|
# These tests are run for both netCDF-4 and non-netCDF-4 builds.
|
2017-11-12 07:45:03 +08:00
|
|
|
check_PROGRAMS = rewrite-scalar ref_ctest ref_ctest64 ncdump tst_utf8 \
|
|
|
|
bom tst_dimsizes nctrunc
|
2016-05-04 11:17:06 +08:00
|
|
|
|
2017-11-12 07:45:03 +08:00
|
|
|
TESTS = tst_ctest.sh tst_inttags.sh run_tests.sh tst_64bit.sh \
|
|
|
|
ref_ctest64 tst_output.sh tst_lengths.sh tst_calendars.sh tst_utf8 \
|
|
|
|
run_utf8_tests.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
|
|
|
|
tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
|
2017-05-25 04:25:22 +08:00
|
|
|
tst_dimsizes.sh run_ncgen_tests.sh
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2016-08-08 23:24:19 +08:00
|
|
|
if USE_NETCDF4
|
2016-05-04 11:17:06 +08:00
|
|
|
check_PROGRAMS += tst_fileinfo
|
2017-11-12 07:45:03 +08:00
|
|
|
TESTS += tst_fileinfo.sh tst_hdf5_offset.sh run_ncgen_nc4_tests.sh
|
2016-05-04 11:17:06 +08:00
|
|
|
endif
|
|
|
|
|
2012-03-16 04:50:28 +08:00
|
|
|
if LARGE_FILE_TESTS
|
|
|
|
TESTS += tst_iter.sh
|
|
|
|
endif
|
|
|
|
|
2015-05-29 05:03:02 +08:00
|
|
|
if BUILD_DISKLESS
|
2015-11-07 04:20:10 +08:00
|
|
|
TESTS += tst_inmemory_nc3.sh
|
|
|
|
if USE_NETCDF4
|
|
|
|
TESTS += tst_inmemory_nc4.sh
|
|
|
|
endif
|
2015-05-29 05:03:02 +08:00
|
|
|
endif
|
|
|
|
|
2017-09-16 06:29:11 +08:00
|
|
|
if USE_NETCDF4
|
2017-09-16 01:18:42 +08:00
|
|
|
TESTS += tst_inttags4.sh
|
|
|
|
endif
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
if USE_NETCDF4
|
|
|
|
# NetCDF-4 has some extra tests.
|
2017-11-12 07:45:03 +08:00
|
|
|
check_PROGRAMS += tst_create_files tst_h_rdc0 tst_group_data \
|
|
|
|
tst_enum_data tst_opaque_data tst_string_data tst_vlen_data tst_comp \
|
|
|
|
tst_comp2 tst_nans tst_special_atts tst_unicode tst_fillbug \
|
|
|
|
tst_compress tst_chunking tst_h_scalar tst_bug324
|
|
|
|
|
|
|
|
TESTS += tst_create_files tst_group_data tst_enum_data tst_opaque_data \
|
|
|
|
tst_string_data tst_vlen_data tst_comp tst_comp2 tst_nans \
|
|
|
|
tst_special_atts tst_netcdf4.sh tst_h_rdc0 tst_unicode tst_fillbug \
|
2011-09-22 07:10:03 +08:00
|
|
|
tst_fillbug.sh tst_netcdf4_4.sh tst_compress tst_nccopy4.sh \
|
2015-02-02 22:51:00 +08:00
|
|
|
tst_grp_spec.sh tst_mud.sh tst_h_scalar tst_h_scalar.sh tst_formatx4.sh \
|
2015-10-23 04:09:19 +08:00
|
|
|
tst_bug324 run_utf8_nc4_tests.sh
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
if EXTRA_TESTS
|
|
|
|
TESTS += run_back_comp_tests.sh
|
|
|
|
endif # EXTRA_TESTS
|
|
|
|
|
|
|
|
tst_h_rdc0_CPPFLAGS = -I${top_srcdir}/nc_test ${AM_CPPFLAGS}
|
|
|
|
|
|
|
|
endif #!USE_NETCDF4
|
|
|
|
|
2012-04-13 10:41:00 +08:00
|
|
|
TESTS += tst_ncgen4_classic.sh
|
2017-11-12 07:45:03 +08:00
|
|
|
eif USE_NETCDF4
|
2012-04-13 10:41:00 +08:00
|
|
|
TESTS += tst_ncgen4.sh
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif BUILD_TESTSETS
|
|
|
|
|
2017-11-12 07:45:03 +08:00
|
|
|
CLEANFILES = test0.nc test1_ncdump.cdl test1_ncdump.nc \
|
|
|
|
test2_ncdump.cdl test1.cdl test0_ncdump.nc ctest1.cdl test1_cdf5.nc \
|
|
|
|
test1_cdf5.cdl test0_cdf5.nc test2_cdf5.nc test2_cdf5.cdl \
|
|
|
|
test0_offset.nc test1_offset.nc test1_offset.cdl test2_offset.nc \
|
|
|
|
test2_offset.cdl ctest0.nc ctest0_64.nc c1.cdl c1_4.cdl ctest1_64.cdl \
|
|
|
|
c0.nc c0_4.nc small.nc small2.nc c0tmp.nc c1.ncml utf8.cdl \
|
|
|
|
utf8_64.cdl utf8.nc utf8_64.nc tmp.cdl tst_vlen_data.nc tst_utf8.nc \
|
|
|
|
tst_special_atts.nc tst_unicode.nc tst_solar_2.nc tst_string_data.nc \
|
|
|
|
tst_calendars.nc tst_nans.nc tst_opaque_data.nc tst_solar_cmp.nc \
|
|
|
|
tst_enum_data.nc tst_solar_1.nc tst_mslp_64.nc tst_mslp.nc \
|
|
|
|
tst_bug321.nc tst_comp2.nc tst_ncml.nc tst_fillbug.nc \
|
|
|
|
tst_group_data.nc tst_small.nc tst_comp.nc tst_unicode.cdl \
|
|
|
|
tst_group_data.cdl tst_compounds2.cdl tst_comp.cdl tst_enum_data.cdl \
|
|
|
|
tst_small.cdl tst_times.cdl tst_solar_2.cdl tst_string_data.cdl \
|
|
|
|
tst_fillbug.cdl tst_opaque_data.cdl tst_compounds4.cdl tst_utf8.cdl \
|
|
|
|
tst_compounds3.cdl tst_special_atts.cdl tst_nans.cdl \
|
|
|
|
tst_format_att_64.cdl tst_vlen_data.cdl tst_solar_1.cdl \
|
|
|
|
tst_format_att.cdl tst_inflated.nc tmp_subset.cdl tst_inflated4.nc \
|
|
|
|
tst_deflated.nc tst_chunking.nc tmp*.nc tst_charfill.nc \
|
|
|
|
tmp_tst_charfill.cdl iter.* tst_nc_test_netcdf4_4_0.cdl tst_mud4.nc \
|
|
|
|
tst_mud4.cdl tst_mud4-bc.cdl tst_ncf213.cdl tst_ncf213.nc \
|
|
|
|
tst_h_scalar.cdl tst_h_scalar.nc tst_mud4_chars.cdl tst_mud4_chars.nc \
|
2016-01-06 12:26:25 +08:00
|
|
|
inttags.nc inttags4.nc tst_inttags.cdl tst_inttags4.cdl \
|
2016-05-04 11:17:06 +08:00
|
|
|
tst_dimsize_classic.nc tst_dimsize_64offset.nc tst_dimsize_64data.nc \
|
2017-11-12 07:45:03 +08:00
|
|
|
nc4_fileinfo.nc hdf5_fileinfo.hdf ref_hdf5_compat1.nc \
|
|
|
|
ref_hdf5_compat2.nc ref_hdf5_compat3.nc ref_tst_compounds.nc \
|
|
|
|
ref_tst_dims.nc ref_tst_interops4.nc ref_tst_xplatform2_1.nc \
|
|
|
|
ref_tst_xplatform2_2.nc nccopy3_subset_out.nc
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
# These files all have to be included with the distribution.
|
2017-11-12 07:45:03 +08:00
|
|
|
EXTRA_DIST = run_tests.sh tst_64bit.sh tst_output.sh test0.cdl \
|
|
|
|
ref_ctest1_nc4.cdl ref_ctest1_nc4c.cdl ref_tst_solar_1.cdl \
|
|
|
|
ref_tst_solar_2.cdl tst_netcdf4.sh tst_netcdf4_4.sh ref_tst_small.cdl \
|
|
|
|
tst_lengths.sh tst_ncml.cdl ref1.ncml ref_tst_group_data.cdl \
|
|
|
|
ref_tst_enum_data.cdl ref_tst_opaque_data.cdl ref_tst_string_data.cdl \
|
|
|
|
ref_tst_vlen_data.cdl ref_tst_comp.cdl ref_tst_unicode.cdl \
|
|
|
|
ref_tst_nans.cdl small.cdl small2.cdl $(man_MANS) run_utf8_tests.sh \
|
|
|
|
ref_tst_utf8.cdl ref_tst_fillbug.cdl tst_fillbug.sh tst_calendars.cdl \
|
|
|
|
tst_calendars.sh ref_times.cdl ref_tst_special_atts.cdl \
|
|
|
|
ref_tst_noncoord.cdl ref_tst_compounds2.nc ref_tst_compounds2.cdl \
|
|
|
|
ref_tst_compounds3.nc ref_tst_compounds3.cdl ref_tst_compounds4.nc \
|
|
|
|
ref_tst_compounds4.cdl ref_tst_group_data_v23.cdl tst_mslp.cdl \
|
|
|
|
tst_bug321.cdl ref_tst_format_att.cdl ref_tst_format_att_64.cdl \
|
|
|
|
tst_nccopy3.sh tst_nccopy4.sh ref_nc_test_netcdf4_4_0.nc \
|
|
|
|
run_back_comp_tests.sh ref_nc_test_netcdf4.cdl \
|
|
|
|
ref_tst_special_atts3.cdl tst_brecs.cdl ref_tst_grp_spec0.cdl \
|
|
|
|
ref_tst_grp_spec.cdl tst_grp_spec.sh ref_tst_charfill.cdl \
|
|
|
|
tst_charfill.cdl tst_charfill.sh tst_iter.sh tst_mud.sh \
|
|
|
|
ref_tst_mud4.cdl ref_tst_mud4-bc.cdl ref_tst_mud4_chars.cdl \
|
2015-11-20 04:44:07 +08:00
|
|
|
inttags.cdl inttags4.cdl ref_inttags.cdl ref_inttags4.cdl \
|
2017-11-12 07:45:03 +08:00
|
|
|
ref_tst_ncf213.cdl tst_h_scalar.sh run_utf8_nc4_tests.sh \
|
|
|
|
tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl tst_inttags.sh \
|
|
|
|
tst_inttags4.sh CMakeLists.txt XGetopt.c tst_bom.sh \
|
|
|
|
tst_inmemory_nc3.sh tst_dimsizes.sh tst_inmemory_nc4.sh \
|
|
|
|
tst_fileinfo.sh run_ncgen_tests.sh test_360_day_1900.nc \
|
|
|
|
test_365_day_1900.nc test_366_day_1900.nc ref_test_360_day_1900.cdl \
|
|
|
|
ref_test_365_day_1900.cdl ref_test_366_day_1900.cdl \
|
|
|
|
tst_hdf5_offset.sh run_ncgen_nc4_tests.sh tst_nccopy3_subset.sh \
|
|
|
|
ref_nccopy3_subset.nc test_corrupt_magic.nc c0.cdl
|
re e-support UBS-599337
re pull request https://github.com/Unidata/netcdf-c/pull/405
re pull request https://github.com/Unidata/netcdf-c/pull/446
Notes:
1. This branch is a cleanup of the magic.dmh branch.
2. magic.dmh was originally merged, but caused problems with parallel IO.
It was re-issued as pull request https://github.com/Unidata/netcdf-c/pull/446.
3. This branch + pull request replace any previous pull requests and magic.dmh branch.
Given an otherwise valid netCDF file that has a corrupted header,
the netcdf library currently crashes. Instead, it should return
NC_ENOTNC.
Additionally, the NC_check_file_type code does not do the
forward search required by hdf5 files. It currently only looks
at file position 0 instead of 512, 1024, 2048,... Also, it turns
out that the HDF4 magic number is assumed to always be at the
beginning of the file (unlike HDF5).
The change is localized to libdispatch/dfile.c See
https://support.hdfgroup.org/release4/doc/DSpec_html/DS.pdf
Also, it turns out that the code in NC_check_file_type is duplicated
(mostly) in the function libsrc4/nc4file.c#nc_check_for_hdf.
This branch does the following.
1. Make NC_check_file_type return NC_ENOTNC instead of crashing.
2. Remove nc_check_for_hdf and centralize all file format checking
NC_check_file_type.
3. Add proper forward search for HDF5 files (but not HDF4 files)
to look for the magic number at offsets of 0, 512, 1024...
4. Add test tst_hdf5_offset.sh. This tests that hdf5 files with
an offset are properly recognized. It does so by prefixing
a legal file with some number of zero bytes: 512, 1024, etc.
5. Off-topic: Added -N flag to ncdump to force a specific output dataset name.
2017-10-25 06:25:09 +08:00
|
|
|
|
|
|
|
# The L512.bin file is file containing exactly 512 bytes each of value 0.
|
|
|
|
# It is used for creating hdf5 files with varying offsets for testing.
|
|
|
|
EXTRA_DIST += L512.bin
|
2012-01-10 02:49:15 +08:00
|
|
|
|
2014-09-19 08:26:06 +08:00
|
|
|
# CDL files and Expected results
|
|
|
|
SUBDIRS=cdl expected
|
2017-11-12 07:45:03 +08:00
|
|
|
EXTRA_DIST += tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
|
|
|
|
tst_ncgen4_diff.sh tst_ncgen4_cycle.sh
|
|
|
|
|
|
|
|
CLEANFILES += results/*.nc results/*.dmp results/*.dmp2 tmp*.cdl \
|
|
|
|
c5.nc compound_datasize_test.nc compound_datasize_test2.nc ncf199.nc \
|
|
|
|
ref_camrun.c tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl \
|
|
|
|
tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl \
|
|
|
|
tst_gattenum.nc tst_ncf199.cdl tst_tst_gattenum.cdl \
|
|
|
|
tst_tst_usuffix.cdl tst_usuffix.nc tst_bug324.nc \
|
|
|
|
nccopy3_subset_out.nc
|
2017-05-25 05:49:18 +08:00
|
|
|
|
2012-05-14 02:42:10 +08:00
|
|
|
DISTCLEANFILES = results
|
2016-10-06 13:44:50 +08:00
|
|
|
|
|
|
|
clean-local:
|
|
|
|
-rm -rf results
|