Merge branch 'master' into gh712

This commit is contained in:
Ward Fisher 2017-12-04 15:36:21 -06:00
commit adaaf92f95
49 changed files with 1156 additions and 1244 deletions

View File

@ -1524,7 +1524,7 @@ ENDMACRO()
MACRO(build_bin_test_no_prefix F)
build_bin_test(${F})
IF(MSVC)
SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/")
#SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/")
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG

View File

@ -1,4 +1,4 @@
SET(H5TESTS tst_h_files tst_h_files2 tst_h_files4 tst_h_atts tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums tst_h_dimscales4)
SET(H5TESTS tst_h_files tst_h_files2 tst_h_files4 tst_h_atts tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_vl tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums tst_h_dimscales4)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.nc)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
@ -12,5 +12,3 @@ FOREACH(CTEST ${H5TESTS})
)
ADD_TEST(${CTEST} ${EXECUTABLE_OUTPUT_PATH}/${CTEST})
ENDFOREACH()
SET_TESTS_PROPERTIES(tst_h_rd_cmp PROPERTIES DEPENDS tst_h_wrt_cmp)

View File

@ -7,6 +7,7 @@
# only use HDF5; these tests don't use netCDF at all.
#
# If one of these tests fails, then netCDF-4 will not work correctly.
# Ed Hartnett, Ward Fisher
# Set AM_CPPFLAGS and AM_LDFLAGS based on user choices.
include $(top_srcdir)/lib_flags.am
@ -46,7 +47,8 @@ endif # USE_VALGRIND_TESTS
# We must include these files in the distribution.
EXTRA_DIST = run_par_tests.sh run_valgrind_tests.sh \
ref_tst_h_compounds.h5 ref_tst_h_compounds2.h5 run_par_tests.sh \
run_valgrind_tests.sh ref_tst_compounds.nc h5_err_macros.h CMakeLists.txt
run_valgrind_tests.sh ref_tst_compounds.nc h5_err_macros.h \
CMakeLists.txt
# Clean up test results.
CLEANFILES = tst_h_*.h5

View File

@ -236,7 +236,7 @@ main()
printf("*** large file test for HDF5...");
{
hid_t fapl_id, fcpl_id, fileid, grpid, spaceid, datasetid;
hid_t dim1_dimscaleid, dim2_dimscaleid, plistid, datasetid2, file_spaceid;
hid_t dim1_dimscaleid, dim2_dimscaleid, plistid, file_spaceid;
hid_t mem_spaceid, xfer_plistid, native_typeid;
hsize_t *chunksize, dims[1], maxdims[1], *dimsize, *maxdimsize;
hsize_t fdims[MAX_DIMS], fmaxdims[MAX_DIMS];

View File

@ -1,62 +0,0 @@
/* This is part of the netCDF package.
Copyright 2007 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
n Test HDF5 compound types.
*/
#include "h5_err_macros.h"
#include <hdf5.h>
#define FILE_NAME "tst_h_wrt_cmp.h5"
#define DIM1_LEN 3
#define COMPOUND_NAME "cmp"
#define VAR_NAME "var"
int
main()
{
hid_t fileid, access_plist, spaceid, typeid;
hid_t datasetid;
struct s1 {
unsigned char c1;
double d;
} data[DIM1_LEN];
int i;
printf("\n*** Checking HDF5 compound types (we're almost there kids).\n");
printf("*** Checking packing of HDF5 compound types...");
/* Open file. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, access_plist)) < 0) ERR;
/* Open dataset. */
if ((datasetid = H5Dopen1(fileid, VAR_NAME)) < 0) ERR;
/* Check space. */
if ((spaceid = H5Dget_space(datasetid)) < 0) ERR;
if (H5Sget_simple_extent_ndims(spaceid) != 1) ERR;
if (H5Sget_simple_extent_npoints(spaceid) != DIM1_LEN) ERR;
/* Get type. */
if ((typeid = H5Dget_type(datasetid)) < 0) ERR;
/* if ((native_type = H5Tget_native_type(typeid, H5T_DIR_DEFAULT)) < 0) ERR;*/
/* Read the data. */
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Check the data. */
for (i=0; i<DIM1_LEN; i++)
if (data[i].c1 != 126 || data[i].d != -9999999) ERR;
/* Release all resources. */
if (H5Fclose(fileid) < 0) ERR;
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -2,7 +2,8 @@
Copyright 2007 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Test HDF5 compound types.
Test HDF5 compound types.
Ed Hartnett
*/
#include "h5_err_macros.h"
@ -20,7 +21,7 @@ main()
hid_t datasetid;
hsize_t dims[1];
char dummy[] = " ";
struct s1
struct s1
{
unsigned char c1;
double d;
@ -46,7 +47,7 @@ main()
/* Open file and create group. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
access_plist)) < 0) ERR;
/* Create a simple compound type. */
@ -60,11 +61,11 @@ main()
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
/* Create a dataset of this compound type. */
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
/* Write some data. */
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Release all resources. */
@ -75,7 +76,7 @@ main()
}
SUMMARIZE_ERR;
printf("*** Checking packing of HDF5 compound types...");
{
{
/* Open file. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
@ -92,10 +93,38 @@ main()
/* Get type. */
if ((typeid = H5Dget_type(datasetid)) < 0) ERR;
/* if ((native_type = H5Tget_native_type(typeid, H5T_DIR_DEFAULT)) < 0) ERR;*/
/* Read the data. */
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Check the data. */
for (i=0; i<DIM1_LEN; i++)
if (data[i].c1 != 126 || data[i].d != -9999999) ERR;
/* Release all resources. */
if (H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
printf("*** Checking packing of HDF5 compound types...");
{
/* Open file. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, access_plist)) < 0) ERR;
/* Open dataset. */
if ((datasetid = H5Dopen1(fileid, VAR_NAME)) < 0) ERR;
/* Check space. */
if ((spaceid = H5Dget_space(datasetid)) < 0) ERR;
if (H5Sget_simple_extent_ndims(spaceid) != 1) ERR;
if (H5Sget_simple_extent_npoints(spaceid) != DIM1_LEN) ERR;
/* Get type. */
if ((typeid = H5Dget_type(datasetid)) < 0) ERR;
/* Read the data. */
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Check the data. */

View File

@ -4,6 +4,8 @@
Common includes, defines, etc., for test code in the libsrc4 and
nc_test4 directories.
Ed Hartnett, Russ Rew, Dennis Heimbigner
*/
#ifndef _ERR_MACROS_H
@ -20,12 +22,6 @@
* generally cosists of several sets of tests. */
static int total_err = 0, err = 0;
#if 0
/* This is handy for print statements. */
static char *format_name[] = {"", "classic", "64-bit offset", "netCDF-4",
"netCDF-4 classic model"};
#endif
/* This macro prints an error message with line number and name of
* test program. */
#define ERR do { \
@ -33,18 +29,12 @@ fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
err++; \
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d\n", \
__FILE__, __LINE__); \
fflush(stderr); \
return 2; \
} while (0)
/* This macro prints an error message with line number and name of
* test program, and then exits the program. */
#define ERR_RET do { \
fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d\n", \
__FILE__, __LINE__); \
return 2; \
} while (0)
/* Duplicate with different name. */
#define ERR_RET ERR
#define ERR_GOTO do { \
fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
@ -58,13 +48,12 @@ int ERR_report(int stat, const char* file, int line)
fflush(stdout);
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d; status=%d\n",
file,line,stat);
fflush(stdout);
fflush(stderr);
return 1;
}
#define ERRSTAT(stat) {err+=ERR_report(stat,__FILE__,__LINE__);}
/* After a set of tests, report the number of errors, and increment
* total_err. */
#define SUMMARIZE_ERR do { \
@ -78,12 +67,6 @@ int ERR_report(int stat, const char* file, int line)
printf("ok.\n"); \
} while (0)
/* If extra memory debugging is not in use (as it usually isn't),
* define away the nc_exit function, which may be in some tests. */
#ifndef EXTRA_MEM_DEBUG
#define nc_exit()
#endif
/* This macro prints out our total number of errors, if any, and exits
* with a 0 if there are not, or a 2 if there were errors. Make will
* stop if a non-zero value is returned from a test program. */

View File

@ -653,7 +653,6 @@ builddims(NCDAPCOMMON* dapcomm)
NCerror ncstat = NC_NOERR;
int dimid;
NClist* dimset = NULL;
NC* drno = dapcomm->controller;
NC* ncsub;
char* definename;
@ -738,7 +737,6 @@ buildvars(NCDAPCOMMON* dapcomm)
NCerror ncstat = NC_NOERR;
int varid;
NClist* varnodes = dapcomm->cdf.ddsroot->tree->varnodes;
NC* drno = dapcomm->controller;
char* definename;
ASSERT((varnodes != NULL));
@ -816,7 +814,6 @@ buildglobalattrs(NCDAPCOMMON* dapcomm, CDFnode* root)
char *nltxt, *p;
NCbytes* buf = NULL;
NClist* cdfnodes;
NC* drno = dapcomm->controller;
if(root->attributes != NULL) {
for(i=0;i<nclistlength(root->attributes);i++) {
@ -895,7 +892,6 @@ buildattribute(NCDAPCOMMON* dapcomm, NCattribute* att, nc_type vartype, int vari
int i;
NCerror ncstat = NC_NOERR;
unsigned int nvalues = nclistlength(att->values);
NC* drno = dapcomm->controller;
/* If the type of the attribute is string, then we need*/
/* to convert to a single character string by concatenation.

View File

@ -1570,93 +1570,114 @@ NC3_inq_base_pe(int ncid, int *pe)
/*
* !_CRAYMPP, only pe 0 is valid
*/
*pe = 0;
if (pe) *pe = 0;
#endif /* _CRAYMPP && LOCKNUMREC */
return NC_NOERR;
}
/**
* Return the file format.
*
* \param ncid the ID of the open file.
* \param formatp a pointer that gets the format. Ignored if NULL.
*
* \returns NC_NOERR No error.
* \returns NC_EBADID Bad ncid.
* \internal
* \author Ed Hartnett, Dennis Heimbigner
*/
int
NC3_inq_format(int ncid, int *formatp)
{
int status;
NC *nc;
NC3_INFO* nc3;
int status;
NC *nc;
NC3_INFO* nc3;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
/* only need to check for netCDF-3 variants, since this is never called for netCDF-4 files */
/* Why even call this function with no format pointer? */
if (!formatp)
return NC_NOERR;
/* only need to check for netCDF-3 variants, since this is never called for netCDF-4 files */
#ifdef USE_CDF5
if (fIsSet(nc3->flags, NC_64BIT_DATA))
*formatp = NC_FORMAT_CDF5;
else
if (fIsSet(nc3->flags, NC_64BIT_DATA))
*formatp = NC_FORMAT_CDF5;
else
#endif
if (fIsSet(nc3->flags, NC_64BIT_OFFSET))
*formatp = NC_FORMAT_64BIT_OFFSET;
else
*formatp = NC_FORMAT_CLASSIC;
return NC_NOERR;
*formatp = NC_FORMAT_64BIT_OFFSET;
else
*formatp = NC_FORMAT_CLASSIC;
return NC_NOERR;
}
/**
* Return the extended format (i.e. the dispatch model), plus the mode
* associated with an open file.
*
* \param ncid the ID of the open file.
* \param formatp a pointer that gets the extended format. Note that
* this is not the same as the format provided by nc_inq_format(). The
* extended foramt indicates the dispatch layer model. Classic, 64-bit
* offset, and CDF5 files all have an extended format of
* ::NC_FORMATX_NC3. Ignored if NULL.
* \param modep a pointer that gets the open/create mode associated with
* this file. Ignored if NULL.
*
* \returns NC_NOERR No error.
* \returns NC_EBADID Bad ncid.
* \internal
* \author Dennis Heimbigner
*/
int
NC3_inq_format_extended(int ncid, int *formatp, int *modep)
{
int status;
NC *nc;
int status;
NC *nc;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
if(formatp) *formatp = NC_FORMATX_NC3;
if(modep) *modep = nc->mode;
return NC_NOERR;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
if(formatp) *formatp = NC_FORMATX_NC3;
if(modep) *modep = nc->mode;
return NC_NOERR;
}
/* The sizes of types may vary from platform to platform, but within
* netCDF files, type sizes are fixed. */
#define NC_BYTE_LEN 1
#define NC_CHAR_LEN 1
#define NC_SHORT_LEN 2
#define NC_INT_LEN 4
#define NC_FLOAT_LEN 4
#define NC_DOUBLE_LEN 8
#define NUM_ATOMIC_TYPES 6
/* This netCDF-4 function proved so popular that a netCDF-classic
* version is provided. You're welcome. */
/**
* Determine name and size of netCDF type. This netCDF-4 function
* proved so popular that a netCDF-classic version is provided. You're
* welcome.
*
* \param ncid The ID of an open file.
* \param typeid The ID of a netCDF type.
* \param name Pointer that will get the name of the type. Maximum
* size will be NC_MAX_NAME. Ignored if NULL.
* \param size Pointer that will get size of type in bytes. Ignored if
* null.
*
* \returns NC_NOERR No error.
* \returns NC_EBADID Bad ncid.
* \returns NC_EBADTYPE Bad typeid.
* \internal
* \author Ed Hartnett
*/
int
NC3_inq_type(int ncid, nc_type typeid, char *name, size_t *size)
{
#if 0
int atomic_size[NUM_ATOMIC_TYPES] = {NC_BYTE_LEN, NC_CHAR_LEN, NC_SHORT_LEN,
NC_INT_LEN, NC_FLOAT_LEN, NC_DOUBLE_LEN};
char atomic_name[NUM_ATOMIC_TYPES][NC_MAX_NAME + 1] = {"byte", "char", "short",
"int", "float", "double"};
#endif
NC *ncp;
int stat = NC_check_id(ncid, &ncp);
if (stat != NC_NOERR)
return stat;
return stat;
/* Only netCDF classic model and CDF-5 need to be handled. */
/* After discussion, this seems like an artificial limitation.
See https://github.com/Unidata/netcdf-c/issues/240 for more
discussion. */
/*
if((ncp->mode & NC_CDF5) != 0) {
if (typeid < NC_BYTE || typeid > NC_STRING)
return NC_EBADTYPE;
} else if (typeid < NC_BYTE || typeid > NC_DOUBLE)
return NC_EBADTYPE;
*/
if(typeid < NC_BYTE || typeid > NC_STRING)
return NC_EBADTYPE;
return NC_EBADTYPE;
/* Give the user the values they want. Subtract one because types
* are numbered starting at 1, not 0. */
/* Give the user the values they want. */
if (name)
strcpy(name, NC_atomictypename(typeid));
if (size)
@ -1666,36 +1687,6 @@ NC3_inq_type(int ncid, nc_type typeid, char *name, size_t *size)
}
/**************************************************/
#if 0
int
NC3_set_content(int ncid, size_t size, void* memory)
{
int status = NC_NOERR;
NC *nc;
NC3_INFO* nc3;
status = NC_check_id(ncid, &nc);
if(status != NC_NOERR)
return status;
nc3 = NC3_DATA(nc);
#ifdef USE_DISKLESS
fClr(nc3->flags, NC_CREAT);
status = memio_set_content(nc3->nciop, size, memory);
if(status != NC_NOERR) goto done;
status = nc_get_NC(nc3);
if(status != NC_NOERR) goto done;
#else
status = NC_EDISKLESS;
#endif
done:
return status;
}
#endif
/**************************************************/
int
nc_delete_mp(const char * path, int basepe)
{

View File

@ -1152,7 +1152,6 @@ NC4_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const u
NC_GRP_INFO_T *grp;
NC_HDF5_FILE_INFO_T *h5;
NC_VAR_INFO_T *var;
NC_DIM_INFO_T *dim;
LOG((2, "%s: ncid 0x%x varid %d", __func__, ncid, varid));

View File

@ -1,40 +1,66 @@
/*
Copyright 2003, University Corporation for Atmospheric Research. See
netcdf-4/docs/COPYRIGHT file for copying and redistribution
conditions.
This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
HDF5 backend for netCDF, depending on your point of view.
This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
HDF5 backend for netCDF, depending on your point of view.
This file handles the nc_ calls, calling the appropriate nc3 or nc4
function, depending on ncid.
This file handles the (useless) *_base_pe() functions, and the
inq_format functions.
@author Ed Hartnett, Dennis Heimbigner
Copyright 2003, University Corporation for Atmospheric Research. See
netcdf-4/docs/COPYRIGHT file for copying and redistribution
conditions.
*/
#include "nc4internal.h"
#include "nc4dispatch.h"
/* This will return the length of a netcdf data type in bytes. Since
we haven't added any new types, I just call the v3 function.
Ed Hartnett 10/43/03
*/
/* This function only does anything for netcdf-3 files. */
/**
* This function only does anything for netcdf-3 files.
*
* \param ncid File ID (ignored).
* \param pe Processor element (ignored).
*
* \returns ::NC_ENOTNC3 Not a netCDF classic format file.
* \internal
* \author Ed Hartnett
*/
int
NC4_set_base_pe(int ncid, int pe)
{
return NC_ENOTNC3;
return NC_ENOTNC3;
}
/* This function only does anything for netcdf-3 files. */
/**
* This function only does anything for netcdf-3 files.
*
* \param ncid File ID (ignored).
* \param pe Pointer to processor element. Ignored if NULL. Gets a 0
* if present.
*
* \returns ::NC_ENOTNC3 Not a netCDF classic format file.
* \internal
* \author Ed Hartnett
*/
int
NC4_inq_base_pe(int ncid, int *pe)
{
return NC_ENOTNC3;
}
/* Get the format (i.e. classic, 64-bit-offset, or netcdf-4) of an
* open file. */
/**
* Get the format (i.e. NC_FORMAT_NETCDF4 pr
* NC_FORMAT_NETCDF4_CLASSIC) of an open netCDF-4 file.
*
* \param ncid File ID (ignored).
* \param formatp Pointer that gets the constant indicating format.
* \returns ::NC_NOERR No error.
* \returns ::NC_EBADID Bad ncid.
* \internal
* \author Ed Hartnett
*/
int
NC4_inq_format(int ncid, int *formatp)
{
@ -60,7 +86,24 @@ NC4_inq_format(int ncid, int *formatp)
return NC_NOERR;
}
/* Get the extended format of an open file. */
/**
* Return the extended format (i.e. the dispatch model), plus the mode
* associated with an open file.
*
* \param ncid File ID (ignored).
* \param formatp a pointer that gets the extended format. Note that
* this is not the same as the format provided by nc_inq_format(). The
* extended foramt indicates the dispatch layer model. NetCDF-4 files
* will always get NC_FORMATX_NC4 for netCDF files, NC_FORMATX_HDF4
* for HDF4 files.
* \param modep a pointer that gets the open/create mode associated with
* this file. Ignored if NULL.
* \returns ::NC_NOERR No error.
* \returns ::NC_EBADID Bad ncid.
* \internal
* \author Dennis Heimbigner
*/
int
NC4_inq_format_extended(int ncid, int *formatp, int *modep)
{
@ -77,10 +120,10 @@ NC4_inq_format_extended(int ncid, int *formatp, int *modep)
if(formatp) {
#ifdef USE_HDF4
/* Distinguish HDF5 from HDF4 */
*formatp = (h5->hdf4 ? NC_FORMATX_NC_HDF4 : NC_FORMATX_NC_HDF5);
/* Distinguish HDF5 from HDF4 */
*formatp = (h5->hdf4 ? NC_FORMATX_NC_HDF4 : NC_FORMATX_NC_HDF5);
#else /* USE_HDF4 */
*formatp = NC_FORMATX_NC_HDF5;
*formatp = NC_FORMATX_NC_HDF5;
#endif /* USE_HDF4 */
}
return NC_NOERR;

View File

@ -9,23 +9,14 @@ include $(top_srcdir)/lib_flags.am
AM_CPPFLAGS += -I$(top_srcdir)/libsrc
AM_CPPFLAGS += -DTOPSRCDIR=${abs_top_srcdir}
AM_CPPFLAGS += -DTOPBINDIR=${abs_top_bindir}
# These files are created by the tests.
CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
tst_*.nc t_nc.nc large_files.nc quick_large_files.nc \
tst_diskless.nc tst_diskless2.nc \
tst_diskless3.nc tst_diskless3_file.cdl tst_diskless3_memory.cdl \
tst_diskless4.cdl tst_diskless4.nc tst_formatx.nc nc_test_cdf5.nc \
unlim.nc tst_inq_type.nc tst_elatefill.nc tst_global_fillval.nc \
tst_large_cdf5.nc tst_max_var_dims.nc
check_PROGRAMS =
LDADD = ${top_builddir}/liblib/libnetcdf.la
AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include -I$(top_srcdir)/libsrc
# These are the tests which are always run.
TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm \
tst_names tst_nofill tst_nofill2 tst_nofill3 tst_atts3 \
tst_meta tst_inq_type tst_utf8_validate tst_utf8_phrases \
tst_global_fillval tst_max_var_dims
TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta tst_inq_type \
tst_utf8_validate tst_utf8_phrases tst_global_fillval \
tst_max_var_dims tst_formats
if USE_NETCDF4
TESTPROGRAMS += tst_atts tst_put_vars tst_elatefill
@ -45,11 +36,8 @@ endif
# These are the source files for the main workhorse test program,
# nc_test. If you pass nc_test, you are doing well.
nc_test_SOURCES = nc_test.c error.c test_get.c test_put.c \
test_read.c test_write.c util.c error.h tests.h
LDADD = ${top_builddir}/liblib/libnetcdf.la
AM_CPPFLAGS += -I$(top_builddir)/liblib -I$(top_builddir)/include -I$(top_srcdir)/libsrc
nc_test_SOURCES = nc_test.c error.c test_get.c test_put.c test_read.c \
test_write.c util.c error.h tests.h
# If the user asked for large file tests, then add them.
if LARGE_FILE_TESTS
@ -60,11 +48,10 @@ endif # LARGE_FILE_TESTS
if BUILD_BENCHMARKS
TESTPROGRAMS += testnc3perf
testnc3perf_SOURCES = testnc3perf.c
CLEANFILES += benchmark.nc
endif
# Set up the tests.
check_PROGRAMS += $(TESTPROGRAMS)
check_PROGRAMS = $(TESTPROGRAMS)
# Build Diskless test helpers
if BUILD_DISKLESS
@ -105,13 +92,19 @@ endif # USE_VALGRIND_TESTS
# Distribute the .c files so that m4 isn't required on the users
# machine.
EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
run_diskless.sh run_diskless2.sh run_diskless5.sh \
run_mmap.sh run_pnetcdf_test.sh \
test_read.m4 test_write.m4
EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
run_diskless.sh run_diskless2.sh run_diskless5.sh run_mmap.sh \
run_pnetcdf_test.sh test_read.m4 test_write.m4 ref_tst_diskless2.cdl \
tst_diskless5.cdl CMakeLists.txt
# ref_tst_diskless2.cdl is for diff comparison and to produce tst_diskless2.c
EXTRA_DIST += ref_tst_diskless2.cdl tst_diskless5.cdl CMakeLists.txt
# These files are created by the tests.
CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
tst_*.nc t_nc.nc large_files.nc quick_large_files.nc tst_diskless.nc \
tst_diskless2.nc tst_diskless3.nc tst_diskless3_file.cdl \
tst_diskless3_memory.cdl tst_diskless4.cdl tst_diskless4.nc \
tst_formatx.nc nc_test_cdf5.nc unlim.nc tst_inq_type.nc \
tst_elatefill.nc tst_global_fillval.nc tst_large_cdf5.nc \
tst_max_var_dims.nc benchmark.nc
# Only clean these on maintainer-clean, because they require m4 to
# regenerate.

View File

@ -11,7 +11,7 @@
This program is an add-on test to check very large 64-bit offset
files (8 GB, so make sure you have the disk space!).
$Id: large_files.c,v 1.4 2008/03/10 17:02:41 ed Exp $
Ed Hartnett, Ward Fisher
*/
#include <config.h>
@ -21,6 +21,11 @@
#include <netcdf.h>
#define FILE_NAME "large_files.nc"
#define NUMRECS 2
#define I_LEN 4106
#define J_LEN 1023
#define K_LEN 1023
#define N_LEN 2
static void
check_err(const int stat, const int line, const char *file) {
@ -36,7 +41,7 @@ main(int argc, char **argv) {
int stat; /* return status */
char file_name[NC_MAX_NAME + 1];
int ncid; /* netCDF id */
int rec, i, j, k;
int rec, i, j;
int x[] = {42, 21};
/* dimension ids */
@ -46,17 +51,6 @@ main(int argc, char **argv) {
int k_dim;
int n_dim;
#define NUMRECS 2
#define I_LEN 4106
//#define I_LEN 5
//#if 0
//#define J_LEN 214700000
//#endif
//#define J_LEN 500000000
#define J_LEN 1023
#define K_LEN 1023
#define N_LEN 2
/* dimension lengths */
size_t rec_len = NC_UNLIMITED;
size_t i_len = I_LEN;

File diff suppressed because it is too large Load Diff

View File

@ -41,9 +41,6 @@ static int
test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t index[NUMDIMS];
int nval = 99;
int nval_in;
size_t start[NUMDIMS] = {0, 0, 0, 0};
size_t count[NUMDIMS] = {1, 1, DIM2, DIM3};
signed char data[DIM2][DIM3];
@ -84,7 +81,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != (signed char)((i + j) % 16))
{
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
printf("error on start[0]: %ld i: %d j: %d expected %d got %d\n",
start[0], i, j, (i + j) % 16, data[i][j]);
ERR;
if(nerrs++ > 2)
@ -98,7 +95,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != (signed char)((i + j) % 16))
{
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
printf("error on start[0]: %ld i: %d j: %d expected %d got %d\n",
start[0], i, j, (i + j) % 16, data[i][j]);
ERR;
if(nerrs++ > 2)

View File

@ -45,9 +45,6 @@ static int
test_big_var(const char *testfile)
{
int ncid, varid, dimids[NUMDIMS];
size_t index[NUMDIMS];
int nval = 99;
int nval_in;
size_t start[NUMDIMS] = {0, 0, 0};
size_t count[NUMDIMS] = {1, DIM1, DIM2};
signed char data[DIM1][DIM2];
@ -92,7 +89,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != 42 )
{
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
printf("error on start[0]: %ld i: %d j: %d expected %d got %d\n",
start[0], i, j, 42, data[i][j]);
ERR;
if(nerrs++ > 1)
@ -106,7 +103,7 @@ test_big_var(const char *testfile)
{
if (data[i][j] != 19 )
{
printf("error on start[0]: %d i: %d j: %d expected %d got %d\n",
printf("error on start[0]: %ld i: %d j: %d expected %d got %d\n",
start[0], i, j, 19, data[i][j]);
ERR;
if(nerrs++ > 1)

View File

@ -7,7 +7,7 @@
more than 1 dimension and more than 2**32 values, where the write
starts after the first 2**32 elements.
$Id: tst_big_var6.c,v 1.1 2010/05/22 19:56:53 russ Exp $
Russ Rew
*/
#include <nc_tests.h>
@ -49,7 +49,7 @@ test_big_var(const char *testfile)
size_t start[NUMDIMS] = {0, 0, 0, 0};
size_t count[NUMDIMS] = {1, 1, 1, DIM3};
short data[DIM3];
int i, j, k;
int j;
int nerrs = 0;
/* Create a file with one big 4D variable. */
@ -85,7 +85,7 @@ test_big_var(const char *testfile)
if (nc_get_vara_short(ncid, varid, start, count, &data[0])) ERR;
for (j = 0; j < DIM3; j++) {
if (data[j] != FIRST_VAL ) {
printf("error on start[0..2]: %d,%d,%d j: %d, expected %d got %d\n",
printf("error on start[0..2]: %ld,%ld,%ld j: %d, expected %d got %d\n",
start[0], start[1], start[2], j, FIRST_VAL, data[j]);
ERR;
if(nerrs++ > 1)

159
nc_test/tst_formats.c Normal file
View File

@ -0,0 +1,159 @@
/* This is part of the netCDF package. Copyright 2005-2007 University
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
Test handling of formats.
Ed Hartnett, 11/22/17
*/
#include "config.h"
#include <nc_tests.h>
#include "err_macros.h"
#define FILE_NAME_BASE "tst_formats"
#define HDF4_FILE "ref_contiguous.hdf4"
/* Determine how many formats are available, and what they are. */
void
determine_test_formats(int *num_formats, int *format)
{
int ind = 0;
int num;
/* Check inputs. */
assert(num_formats && format);
/* We always have classic and 64-bit offset */
num = 2;
format[ind++] = NC_FORMAT_CLASSIC;
format[ind++] = NC_FORMAT_64BIT_OFFSET;
/* Do we have netCDF-4 and netCDF-4 classic? */
#ifdef USE_NETCDF4
num += 2;
format[ind++] = NC_FORMAT_NETCDF4;
format[ind++] = NC_FORMAT_NETCDF4_CLASSIC;
#endif /* USE_NETCDF4 */
/* Do we have CDF5? */
#ifdef ENABLE_CDF5
num++;
format[ind++] = NC_FORMAT_CDF5;
#endif /* ENABLE_CDF5 */
*num_formats = num;
}
/* Function to test nc_inq_format(). */
int
check_inq_format(int ncid, int expected_format, int expected_extended_format, int expected_mode)
{
int format;
int extended_format;
int mode;
if (nc_inq_format(ncid + 66000, NULL) != NC_EBADID) ERR;
if (nc_inq_format(ncid, NULL)) ERR;
if (nc_inq_format(ncid, &format)) ERR;
if (format != expected_format) {
printf("format %d expected_format %d\n", format, expected_format);
ERR;
}
if (nc_inq_format_extended(ncid + 66000, &extended_format, &mode) != NC_EBADID) ERR;
{
int mode;
if (nc_inq_format_extended(ncid, NULL, &mode)) ERR;
if (mode != expected_mode) {
printf("expected_mode %x mode %x\n", expected_mode, mode);
//ERR;
}
}
{
int extended_format;
if (nc_inq_format_extended(ncid, &extended_format, NULL)) ERR;
if (extended_format != expected_extended_format) ERR;
}
if (nc_inq_format_extended(ncid, &extended_format, &mode)) ERR;
if (mode != expected_mode) ERR;
if (extended_format != expected_extended_format) ERR;
/* Nothing to do with inq_format, but let's check the base_pe
* functions. */
if (expected_format == NC_FORMAT_CLASSIC || expected_format == NC_FORMAT_64BIT_OFFSET ||
expected_format == NC_FORMAT_CDF5) {
if (nc_set_base_pe(ncid, 0)) ERR;
if (nc_inq_base_pe(ncid, NULL)) ERR;
} else {
if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR;
if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR;
}
return 0;
}
int
main(int argc, char **argv)
{
printf("\n*** Testing netcdf format functions.\n");
{
int ncid;
int expected_mode;
int expected_extended_format;
char file_name[NC_MAX_NAME + 1];
int f;
int format[MAX_NUM_FORMATS];
int num_formats;
/* How many formats to be tested? */
determine_test_formats(&num_formats, format);
for (f = 0; f < num_formats; f++)
{
printf("*** testing nc_inq_format() and nc_inq_format_extended() with format %d...", format[f]);
sprintf(file_name, "%s_%d.nc", FILE_NAME_BASE, format[f]);
/* Set up test. */
switch (format[f]) {
case NC_FORMAT_CLASSIC:
expected_extended_format = NC_FORMATX_NC3;
expected_mode = 0;
break;
case NC_FORMAT_64BIT_OFFSET:
expected_extended_format = NC_FORMATX_NC3;
expected_mode = NC_64BIT_OFFSET;
break;
case NC_FORMAT_CDF5:
expected_extended_format = NC_FORMATX_NC3;
expected_mode = NC_CDF5;
break;
case NC_FORMAT_NETCDF4:
expected_extended_format = NC_FORMATX_NC4;
expected_mode = NC_NETCDF4;
break;
case NC_FORMAT_NETCDF4_CLASSIC:
expected_extended_format = NC_FORMATX_NC4;
expected_mode = NC_NETCDF4|NC_CLASSIC_MODEL;
break;
}
if (nc_set_default_format(format[f], NULL)) ERR;
/* Create a file. */
if (nc_create(file_name, 0, &ncid)) ERR;
if (check_inq_format(ncid, format[f], expected_extended_format, expected_mode)) ERR;
if (nc_close(ncid)) ERR;
/* Re-open the file and check it again. */
if (nc_open(file_name, 0, &ncid)) ERR;
/* Classic flag is not set on mode in nc_open(). Not sure if
* this is a bug or not. */
if (format[f] == NC_FORMAT_NETCDF4_CLASSIC)
expected_mode = NC_NETCDF4;
if (check_inq_format(ncid, format[f], expected_extended_format, expected_mode)) ERR;
if (nc_close(ncid)) ERR;
SUMMARIZE_ERR;
} /* next format */
}
FINAL_RESULTS;
}

View File

@ -79,17 +79,15 @@ ENDFOREACH()
# This must go after the 'foreach' stanza
# immediately above this comment.
IF(USE_HDF4_FILE_TESTS AND NOT MSVC)
add_sh_test(nc_test4 run_get_hdf4_files)
add_bin_test_no_prefix(tst_interops2)
add_bin_test(nc_test4 tst_interops3)
build_bin_test_no_prefix(tst_interops3)
add_sh_test(nc_test4 run_get_hdf4_files)
add_bin_test(nc_test4 tst_bug324)
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_interops3 PROPERTIES DEPENDS nc_test4_run_get_hdf4_files)
ENDIF()
IF(TEST_PARALLEL4)

View File

@ -11,7 +11,7 @@ include $(top_srcdir)/lib_flags.am
# Link to our assembled library.
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
# These are netCDF-4 test programs.
# These are netCDF-4 C test programs which are built and run.
NC4_TESTS = tst_dims tst_dims2 tst_dims3 tst_files tst_files4 \
tst_vars tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps \
tst_grps2 tst_compounds tst_compounds2 tst_compounds3 tst_opaques \
@ -29,15 +29,16 @@ if !ISCYGWIN
NC4_TESTS += tst_h_strbug tst_h_refs
endif
# Build test programs plus programs used in test scripts.
check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
TESTS = $(NC4_TESTS)
# Add these if large file tests are turned on.
if LARGE_FILE_TESTS
check_PROGRAMS += tst_large tst_large2
TESTS += tst_large tst_large2
endif
TESTS = $(NC4_TESTS)
if BUILD_UTILITIES
TESTS += run_grp_rename.sh tst_misc.sh
endif
@ -50,17 +51,11 @@ check_PROGRAMS += tst_v2
TESTS += tst_v2
endif # BUILD_V2
if LARGE_FILE_TESTS
check_PROGRAMS += tst_large
TESTS += tst_large
endif # LARGE_FILE_TESTS
# If benchmarks were turned on, build and run a bunch more tests.
if BUILD_BENCHMARKS
check_PROGRAMS += tst_create_files bm_file tst_chunks3 tst_ar4 \
tst_ar4_3d tst_ar4_4d bm_many_objs tst_h_many_atts bm_many_atts \
tst_files2 tst_files3 tst_ar5 tst_h_files3 tst_mem tst_knmi \
bm_netcdf4_recs
tst_files2 tst_files3 tst_ar5 tst_mem tst_knmi bm_netcdf4_recs
bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c
bm_many_atts_SOURCES = bm_many_atts.c tst_utils.c
@ -77,7 +72,7 @@ tst_knmi_SOURCES = tst_knmi.c tst_utils.c
# so they must appear in the appropriate order.
TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \
run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 tst_ar5 \
tst_h_files3 tst_mem run_get_knmi_files.sh tst_knmi
tst_mem run_get_knmi_files.sh tst_knmi
# This will run a parallel I/O benchmark for parallel builds.
if TEST_PARALLEL4
@ -104,7 +99,7 @@ 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_interops3 tst_hdf4_read_var.sh
TESTS += run_get_hdf4_files.sh tst_hdf4_read_var.sh
endif # USE_HDF4_FILE_TESTS
endif # USE_HDF4
@ -116,7 +111,6 @@ TESTS += tst_szip.sh
endif
endif
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
if USE_VALGRIND_TESTS

View File

@ -1,11 +1,18 @@
#!/bin/sh
# This shell gets files from the netCDF ftp site for testing.
# This shell gets some sample HDF4 files from the netCDF ftp site for
# testing. Then it runs program tst_interops3 on the test file to
# check that HDF4 reading works.
# $Id: run_get_hdf4_files.sh,v 1.4 2009/07/15 15:16:05 ed Exp $
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
echo ""
echo "Getting HDF4 sample files from Unidata FTP site..."
file_list="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"
@ -19,6 +26,11 @@ do
fi
done
echo ""
echo "Running test program to check HDF4 sample files..."
${execdir}/tst_interops3
echo "SUCCESS!!!"
exit 0

View File

@ -1,223 +0,0 @@
/* This is part of the netCDF package.
Copyright 2005 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Test netcdf-4 variables.
@author Ed Hartnett
*/
#include <nc_tests.h>
#include "err_macros.h"
#include "netcdf.h"
#include <unistd.h>
#include <time.h>
#include <sys/time.h> /* Extra high precision time info. */
#include <hdf5.h>
#include <H5DSpublic.h>
#define MAX_LEN 30
#define TMP_FILE_NAME "tst_files2_tmp.out"
#define FILE_NAME "tst_h_files3.nc"
#define MILLION 1000000
void *last_sbrk;
void
get_mem_used2(int *mem_used)
{
char buf[30];
FILE *pf;
snprintf(buf, 30, "/proc/%u/statm", (unsigned)getpid());
pf = fopen(buf, "r");
if (pf) {
unsigned size; /* total program size */
unsigned resident;/* resident set size */
unsigned share;/* shared pages */
unsigned text;/* text (code) */
unsigned lib;/* library */
unsigned data;/* data/stack */
/*unsigned dt; dirty pages (unused in Linux 2.6)*/
fscanf(pf, "%u %u %u %u %u %u", &size, &resident, &share,
&text, &lib, &data);
*mem_used = data;
}
else
*mem_used = -1;
fclose(pf);
}
int
main(int argc, char **argv)
{
printf("\n*** Testing netcdf-4 file functions, some more.\n");
last_sbrk = sbrk(0);
/* printf("Test for memory consumption of simple HDF5 file read...\n"); */
/* { */
/* #define NUM_TRIES 200000 */
/* #define CHUNK_CACHE_NELEMS_1 1009 */
/* #define CHUNK_CACHE_SIZE_1 1000000 */
/* #define CHUNK_CACHE_PREEMPTION_1 .75 */
/* #define MAX_OBJ 2 */
/* #define FILE_NAME2 "ref_tst_kirk.nc" */
/* int mem_used, mem_used1, mem_used2; */
/* hid_t fapl_id, fileid, grpid, datasetid; */
/* int try; */
/* int num_scales; */
/* printf("\t\t\tbef_open\taft_open\taft_close\tused_open\tused_closed\n"); */
/* for (try = 0; try < NUM_TRIES; try++) */
/* { */
/* char obj_name2[] = "Captain_Kirk"; */
/* get_mem_used2(&mem_used); */
/* /\* Reopen the file. *\/ */
/* if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; */
/* if ((fileid = H5Fopen(FILE_NAME2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) ERR; */
/* if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; */
/* if ((datasetid = H5Dopen2(grpid, obj_name2, H5P_DEFAULT)) < 0) ERR; */
/* num_scales = H5DSget_num_scales(datasetid, 0); */
/* get_mem_used2(&mem_used1); */
/* /\* Close everything. *\/ */
/* if (H5Dclose(datasetid)) ERR_RET; */
/* if (H5Pclose(fapl_id)) ERR_RET; */
/* if (H5Gclose(grpid) < 0) ERR_RET; */
/* if (H5Fclose(fileid) < 0) ERR_RET; */
/* get_mem_used2(&mem_used2); */
/* if (mem_used2 - mem_used) */
/* { */
/* printf("try %d - \t\t%d\t\t%d\t\t%d\t\t%d\t\t%d \n", try, */
/* mem_used, mem_used1, mem_used2, mem_used1 - mem_used, */
/* mem_used2 - mem_used); */
/* /\*if (try > 1) */
/* ERR_RET;*\/ */
/* } */
/* } */
/* } */
/* SUMMARIZE_ERR; */
/* printf("Test for memory consumption of HDF5 file read...\n"); */
/* { */
/* #define NUM_TRIES 2000 */
/* #define CHUNK_CACHE_NELEMS_1 1009 */
/* #define CHUNK_CACHE_SIZE_1 1000000 */
/* #define CHUNK_CACHE_PREEMPTION_1 .75 */
/* #define MAX_OBJ 2 */
/* #define FILE_NAME2 "ref_tst_kirk.nc" */
/* hsize_t num_obj, i; */
/* int mem_used, mem_used1, mem_used2; */
/* hid_t fapl_id, fileid, grpid, datasetid[MAX_OBJ]; */
/* hid_t access_pid, spaceid; */
/* char obj_name[NC_MAX_NAME + 1]; */
/* int try; */
/* H5O_info_t obj_info; */
/* H5_index_t idx_field = H5_INDEX_CRT_ORDER; */
/* ssize_t size; */
/* int ndims; */
/* hsize_t dims[NC_MAX_DIMS], max_dims[NC_MAX_DIMS]; */
/* int is_scale = 0; */
/* get_mem_used2(&mem_used); */
/* mem_used1 = mem_used; */
/* mem_used2 = mem_used; */
/* printf("start: memuse= %d\t%d\t%d \n",mem_used, mem_used1, */
/* mem_used2); */
/* /\* if (H5Eset_auto(NULL, NULL) < 0) ERR;*\/ */
/* printf("bef_open\taft_open\taft_close\tused_open\tused_closed\n"); */
/* for (try = 0; try < NUM_TRIES; try++) */
/* { */
/* get_mem_used2(&mem_used); */
/* /\* Reopen the file. *\/ */
/* if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; */
/* if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) ERR; */
/* if (H5Pset_cache(fapl_id, 0, CHUNK_CACHE_NELEMS_1, CHUNK_CACHE_SIZE_1, */
/* CHUNK_CACHE_PREEMPTION_1) < 0) ERR; */
/* if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, */
/* H5F_LIBVER_LATEST) < 0) ERR; */
/* if ((fileid = H5Fopen(FILE_NAME2, H5F_ACC_RDONLY, fapl_id)) < 0) ERR; */
/* if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; */
/* if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; */
/* if (num_obj > MAX_OBJ) ERR; */
/* for (i = 0; i < num_obj; i++) */
/* { */
/* if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, */
/* i, &obj_info, H5P_DEFAULT) < 0) ERR; */
/* if ((size = H5Lget_name_by_idx(grpid, ".", idx_field, H5_ITER_INC, i, */
/* NULL, 0, H5P_DEFAULT)) < 0) ERR; */
/* if (H5Lget_name_by_idx(grpid, ".", idx_field, H5_ITER_INC, i, */
/* obj_name, size+1, H5P_DEFAULT) < 0) ERR; */
/* if ((datasetid[i] = H5Dopen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR; */
/* if ((access_pid = H5Dget_access_plist(datasetid[i])) < 0) ERR; */
/* if ((spaceid = H5Dget_space(datasetid[i])) < 0) ERR; */
/* if ((ndims = H5Sget_simple_extent_ndims(spaceid)) < 0) ERR; */
/* if (H5Sget_simple_extent_dims(spaceid, dims, max_dims) < 0) ERR; */
/* if ((is_scale = H5DSis_scale(datasetid[i])) < 0) ERR; */
/* if (is_scale) */
/* { */
/* char dimscale_name_att[NC_MAX_NAME + 1]; */
/* int natts, a; */
/* hid_t attid = 0; */
/* char att_name[NC_MAX_HDF5_NAME + 1]; */
/* if ((natts = H5Aget_num_attrs(datasetid[i])) < 0) ERR; */
/* for (a = 0; a < natts; a++) */
/* { */
/* if ((attid = H5Aopen_idx(datasetid[i], (unsigned int)a)) < 0) ERR; */
/* if (H5Aget_name(attid, NC_MAX_HDF5_NAME, att_name) < 0) ERR; */
/* if (H5Aclose(attid) < 0) ERR; */
/* } */
/* if (H5DSget_scale_name(datasetid[i], dimscale_name_att, NC_MAX_NAME) < 0) ERR; */
/* } */
/* else */
/* { */
/* int num_scales; */
/* size_t chunk_cache_size, chunk_cache_nelems; */
/* double rdcc_w0; */
/* hid_t propid; */
/* num_scales = H5DSget_num_scales(datasetid[i], 0); */
/* if ((H5Pget_chunk_cache(access_pid, &chunk_cache_nelems, */
/* &chunk_cache_size, &rdcc_w0)) < 0) ERR; */
/* if ((propid = H5Dget_create_plist(datasetid[i])) < 0) ERR; */
/* if (H5Pclose(propid)) ERR; */
/* } */
/* if (H5Pclose(access_pid)) ERR; */
/* if (H5Sclose(spaceid)) ERR; */
/* } */
/* get_mem_used2(&mem_used1); */
/* /\* Close everything. *\/ */
/* for (i = 0; i < num_obj; i++) */
/* if (H5Dclose(datasetid[i])) ERR; */
/* if (H5Pclose(fapl_id)) ERR; */
/* if (H5Gclose(grpid) < 0) ERR; */
/* if (H5Fclose(fileid) < 0) ERR; */
/* get_mem_used2(&mem_used2); */
/* if (mem_used2 - mem_used) */
/* { */
/* printf("try %d - %d\t\t%d\t\t%d\t\t%d\t\t%d \n", try, */
/* mem_used, mem_used1, mem_used2, mem_used1 - mem_used, */
/* mem_used2 - mem_used); */
/* if (try > 1) */
/* ERR_RET; */
/* } */
/* } */
/* } */
/* SUMMARIZE_ERR; */
FINAL_RESULTS;
}

View File

@ -15,6 +15,54 @@
#define FILE_NAME "tst_interops3.h4"
/* Function to test nc_inq_format(). */
int
check_inq_format(int ncid, int expected_format, int expected_extended_format, int expected_mode)
{
int format;
int extended_format;
int mode;
if (nc_inq_format(ncid + 66000, NULL) != NC_EBADID) ERR;
if (nc_inq_format(ncid, NULL)) ERR;
if (nc_inq_format(ncid, &format)) ERR;
if (format != expected_format) {
printf("format %d expected_format %d\n", format, expected_format);
ERR;
}
if (nc_inq_format_extended(ncid + 66000, &extended_format, &mode) != NC_EBADID) ERR;
{
int mode;
if (nc_inq_format_extended(ncid, NULL, &mode)) ERR;
if (mode != expected_mode) {
printf("expected_mode %x mode %x\n", expected_mode, mode);
//ERR;
}
}
{
int extended_format;
if (nc_inq_format_extended(ncid, &extended_format, NULL)) ERR;
if (extended_format != expected_extended_format) ERR;
}
if (nc_inq_format_extended(ncid, &extended_format, &mode)) ERR;
if (mode != expected_mode) ERR;
if (extended_format != expected_extended_format) ERR;
/* Nothing to do with inq_format, but let's check the base_pe
* functions. */
if (expected_format == NC_FORMAT_CLASSIC || expected_format == NC_FORMAT_64BIT_OFFSET ||
expected_format == NC_FORMAT_CDF5) {
if (nc_set_base_pe(ncid, 0)) ERR;
if (nc_inq_base_pe(ncid, NULL)) ERR;
} else {
if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR;
if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR;
}
return 0;
}
int
main(int argc, char **argv)
{
@ -30,12 +78,15 @@ main(int argc, char **argv)
"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;
for (f = 0; f < NUM_SAMPLE_FILES; f++)
{
if (nc_open(file_name[f], NC_NOWRITE, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
if (check_inq_format(ncid, NC_FORMAT_NETCDF4, expected_extended_format, expected_mode)) ERR;
if (nc_close(ncid)) ERR;
}
}

View File

@ -40,7 +40,7 @@ int main(int argc, char **argv)
{"64-bit offset", "netCDF-4"};
int i, j, f;
printf("sizes: int - %d, size_t - %d, and int * - %d\n",
printf("sizes: int - %ld, size_t - %ld, and int * - %ld\n",
sizeof(int), sizeof(size_t), sizeof(int *));
/* Allocate room for one slab of data. */
@ -83,7 +83,7 @@ int main(int argc, char **argv)
{
if (data[j + LON_LEN * i] != (start[0] + i + j) % 19)
{
printf("error on start[0]: %d i: %d j: %d expected %d got %g\n",
printf("error on start[0]: %ld i: %ld j: %ld expected %d got %g\n",
start[0], i, j, (start[0] + i + j), data[j + LON_LEN * i]);
ERR_RET;
}

View File

@ -3,14 +3,15 @@
# This file builds and runs DAP tests.
# This will not work until we get a new remotetest server set up
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
# 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}

View File

@ -32,7 +32,7 @@ BOTHP="[log][show=fetch]"
BOTHS="noprefetch&fetch=disk"
locreset () {
rm -f ./tmp ./errtmp
rm -f ./tmp_testurl ./errtmp_testurl
}
buildurl () {
@ -58,8 +58,8 @@ echo "***Testing url prefix parameters"
buildurl $PREFIX ""
# Invoke ncdump to extract the URL
echo "command: ${NCDUMP} -h $url"
${NCDUMP} -h "$url" >./tmp 2> ./errtmp
if test "x${SHOW}" = x1 ; then cat ./tmp ; fi
${NCDUMP} -h "$url" >./tmp_testurl 2> ./errtmp_testurl
if test "x${SHOW}" = x1 ; then cat ./tmp_testurl ; fi
fi
locreset
@ -68,8 +68,8 @@ echo "***Testing url suffix parameters"
buildurl "" $SUFFIX
# Invoke ncdump to extract the URL
echo "command: ${NCDUMP} -h $url"
${NCDUMP} -h "$url" >./tmp 2> ./errtmp
if test "x${SHOW}" = x1 ; then cat ./tmp ; fi
${NCDUMP} -h "$url" >./tmp_testurl 2> ./errtmp_testurl
if test "x${SHOW}" = x1 ; then cat ./tmp_testurl ; fi
fi
locreset
@ -78,8 +78,8 @@ echo "***Testing url prefix+suffix parameters"
buildurl $BOTHP $BOTHS
# Invoke ncdump to extract the URL
echo "command: ${NCDUMP} -h $url"
${NCDUMP} -h "$url" >./tmp 2> ./errtmp
if test "x${SHOW}" = x1 ; then cat ./tmp ; fi
${NCDUMP} -h "$url" >./tmp_testurl 2> ./errtmp_testurl
if test "x${SHOW}" = x1 ; then cat ./tmp_testurl ; fi
fi
locreset

View File

@ -187,7 +187,7 @@ PARAMS="${PARAMS}[netcdf3]"
XFAILTESTS="$XFAILTESTS3"
SVCFAILTESTS="$SVCFAILTESTS3"
RESULTSDIR="./results"
RESULTSDIR="./results_tst_remote"
# Locate some tools
if test "x$leakcheck" = x1 ; then
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
@ -325,6 +325,7 @@ cd ..
done
rm -fr ${RESULTSDIR}
totalcount=`expr $passcount + $failcount + $xfailcount + $svcfailcount`
okcount=`expr $passcount + $xfailcount + $svcfailcount`

View File

@ -62,7 +62,7 @@ d055.nc;http://ilikai.soest.hawaii.edu/cgi-bin/nph-dods/fast/d055.nc \
# Temporarily suppress
XFAILTESTS="qscat_high_wind totalAagg world-unfilter-monthly.nc duacs_global_nrt_msla_merged_h_lr 500m"
RESULTSDIR="./results"
RESULTSDIR="./results_tst_special"
# Locate some tools
if test "x$leakcheck" = x1 ; then
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
@ -134,6 +134,7 @@ done
cd ..
done
rm -fr ${RESULTSDIR}
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`

View File

@ -84,7 +84,7 @@ TESTSET="${TDSTESTS1}"
# Temporarily suppress
XFAILTESTS="tst-Surface-METAR.nc"
RESULTSDIR="./results"
RESULTSDIR="./results_tst_tds"
expected3="${srcdir}/expecttds3"
# Locate some tools
@ -157,6 +157,7 @@ for t in ${TESTSET} ; do
done
cd ..
rm -fr ${RESULTSDIR}
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`

View File

@ -104,11 +104,10 @@ ENDIF()
add_sh_test(ncdump tst_64bit)
add_bin_test_no_prefix(ref_ctest)
add_bin_test_no_prefix(ref_ctest64)
add_sh_test(ncdump tst_ctest)
add_sh_test(ncdump tst_output)
add_sh_test(ncdump tst_lengths)
add_sh_test(ncdump tst_calendars)
add_bin_test_no_prefix(tst_utf8)
build_bin_test_no_prefix(tst_utf8)
add_sh_test(ncdump run_utf8_tests)
IF(USE_NETCDF4)
add_sh_test(ncdump run_utf8_nc4_tests)
@ -145,22 +144,22 @@ ENDIF()
ENDIF(BUILD_DISKLESS)
IF(USE_NETCDF4)
add_bin_test_no_prefix(tst_create_files)
add_bin_test_no_prefix(tst_group_data)
add_bin_test_no_prefix(tst_enum_data)
add_bin_test_no_prefix(tst_opaque_data)
add_bin_test_no_prefix(tst_string_data)
add_bin_test_no_prefix(tst_vlen_data)
add_bin_test_no_prefix(tst_comp)
add_bin_test_no_prefix(tst_comp2)
add_bin_test_no_prefix(tst_nans)
add_bin_test_no_prefix(tst_h_scalar)
build_bin_test_no_prefix(tst_create_files)
build_bin_test_no_prefix(tst_group_data)
build_bin_test_no_prefix(tst_enum_data)
build_bin_test_no_prefix(tst_opaque_data)
build_bin_test_no_prefix(tst_string_data)
build_bin_test_no_prefix(tst_vlen_data)
build_bin_test_no_prefix(tst_comp)
build_bin_test_no_prefix(tst_comp2)
build_bin_test_no_prefix(tst_nans)
build_bin_test_no_prefix(tst_h_scalar)
add_sh_test(ncdump tst_formatx4)
# Add this test by hand, as it is also called from a script.
# Editing the script would break autotools compatibility.
add_bin_test_no_prefix(tst_special_atts)
add_bin_test_no_prefix(tst_compress)
add_bin_test_no_prefix(tst_chunking)
build_bin_test_no_prefix(tst_special_atts)
build_bin_test_no_prefix(tst_compress)
build_bin_test_no_prefix(tst_chunking)
###
@ -179,9 +178,9 @@ ENDIF()
build_bin_test_no_prefix(tst_h_rdc0)
ENDIF()
add_bin_test_no_prefix(tst_unicode)
build_bin_test_no_prefix(tst_unicode)
add_bin_test_no_prefix(tst_fillbug)
build_bin_test_no_prefix(tst_fillbug)
add_sh_test(ncdump_sh tst_fillbug)
IF(NOT MSVC)

View File

@ -10,7 +10,6 @@ LDADD = ${top_builddir}/liblib/libnetcdf.la
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
TESTS_ENVIRONMENT=CC=${CC}
XFAIL_TESTS=""
# This is the program we're building, and it's sources.
@ -46,20 +45,16 @@ check_PROGRAMS = rewrite-scalar ref_ctest ref_ctest64 ncdump tst_utf8 \
bom tst_dimsizes nctrunc
# Tests for classic and 64-bit offset files.
TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh ref_ctest \
ref_ctest64 tst_ctest.sh tst_output.sh tst_lengths.sh \
tst_calendars.sh run_utf8_tests.sh tst_nccopy3.sh \
tst_nccopy3_subset.sh tst_charfill.sh tst_iter.sh tst_formatx3.sh \
tst_bom.sh tst_dimsizes.sh run_ncgen_tests.sh tst_ncgen4_classic.sh
TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh ref_ctest \
ref_ctest64 tst_output.sh tst_lengths.sh tst_calendars.sh \
run_utf8_tests.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
tst_dimsizes.sh run_ncgen_tests.sh tst_ncgen4_classic.sh
# Record dependencies between classic test scripts.
# The tst_nccopy3.sh test uses output from a bunch of other
# tests. This records the dependency so parallel builds work.
tst_nccopy3.log: tst_calendars.log run_utf8_tests.log tst_output.log \
tst_64bit.log run_tests.log tst_lengths.log
run_ncgen_tests.log: tst_output.log tst_nccopy3.log
tst_ctest.log: ref_ctest.log ref_ctest64.log
tst_output.log: tst_ctest.log
tst_ncgen4_classic.log: tst_formatx3.log tst_output.log \
tst_nccopy3.log run_ncgen_tests.log
TESTS += tst_null_byte_padding.sh
if USE_STRICT_NULL_BYTE_HEADER_PADDING
@ -85,15 +80,10 @@ tst_grp_spec.sh tst_mud.sh tst_h_scalar.sh tst_formatx4.sh \
run_utf8_nc4_tests.sh run_back_comp_tests.sh run_ncgen_nc4_tests.sh \
tst_ncgen4.sh
# Record dependencies between netcdf-4 test scripts.
tst_netcdf4.log: run_ncgen_tests.log tst_output.log tst_ncgen4.log \
tst_formatx4.log
tst_nccopy4.log: tst_netcdf4.log tst_fillbug.log tst_netcdf4_4.log \
tst_h_scalar.log tst_ctest.log
run_ncgen_nc4_tests.log: run_ncgen_tests.log tst_output.log \
tst_nccopy3.log
run_utf8_nc4_tests.log: run_utf8_tests.log
tst_ncgen4.log: tst_ncgen4_classic.log tst_formatx4.log
# The tst_nccopy4.sh test script depends on the output of a bunch of
# other tests. Record dependencies so parallel builds work.
tst_nccopy4.log: run_ncgen_tests.log tst_output.log tst_ncgen4.log \
tst_fillbug.log tst_netcdf4_4.log tst_h_scalar.log
endif #!USE_NETCDF4
# Add diskless checks if needed.
@ -128,17 +118,18 @@ 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 \
inttags.cdl inttags4.cdl ref_inttags.cdl ref_inttags4.cdl \
ref_tst_ncf213.cdl tst_h_scalar.sh run_utf8_nc4_tests.sh \
tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl ref_tst_nc4_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 ref_test_360_day_1900.nc \
ref_test_365_day_1900.nc ref_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 ref_test_corrupt_magic.nc \
tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
tst_ncgen4_diff.sh tst_ncgen4_cycle.sh tst_ctest.sh \
tst_null_byte_padding.sh ref_null_byte_padding_test.nc
tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl \
ref_tst_nc4_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 \
ref_test_360_day_1900.nc ref_test_365_day_1900.nc \
ref_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 ref_test_corrupt_magic.nc tst_ncgen_shared.sh \
tst_ncgen4.sh tst_ncgen4_classic.sh tst_ncgen4_diff.sh \
tst_ncgen4_cycle.sh tst_null_byte_padding.sh \
ref_null_byte_padding_test.nc
# 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.
@ -148,11 +139,12 @@ EXTRA_DIST += L512.bin
SUBDIRS = cdl expected
CLEANFILES = tst_*.nc tmp*.nc test*.nc iter.* tmp*.cdl \
test1_ncdump.cdl test2_ncdump.cdl test1.cdl ctest1.cdl test1_cdf5.cdl \
test2_cdf5.cdl test1_offset.cdl 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 \
nc4_utf8.cdl nc4_utf8.nc \
tst_output_*.cdl tst_output_*.c tst_utf8_*.cdl tst_tst8.cdl \
tst_netcdf4_*.cdl test1_ncdump.cdl test2_ncdump.cdl test1.cdl \
ctest1.cdl test1_cdf5.cdl test2_cdf5.cdl test1_offset.cdl \
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 nc4_utf8.cdl nc4_utf8.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 \

View File

@ -16,7 +16,8 @@ if test "x$srcdir" = x ; then srcdir="."; fi
# $ validateNC compound_datasize_test -k nc4
##
validateNC() {
BASENAME=$1
ORIGNAME=$1
BASENAME=tst_$1_run_ncgen_nc4_tests
INFILE=$top_srcdir/ncgen/$1.cdl
TMPFILE=tst_$2.cdl
shift
@ -25,7 +26,7 @@ validateNC() {
echo "*** generating $BASENAME.nc ***"
${NCGEN} $ARGS -o $BASENAME.nc $INFILE
${NCDUMP} $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
${NCDUMP} -n $ORIGNAME $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
echo "*** comparing binary against source CDL file *** "
diff -b -w $INFILE $TMPFILE
}

View File

@ -24,7 +24,8 @@ fi
#VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
validateNC() {
BASENAME=$1
ORIGNAME=$1
BASENAME=tst_$1_run_ncgen_tests
INFILE=$top_srcdir/ncgen/$1.cdl
TMPFILE=tst_$2.cdl
shift
@ -37,24 +38,24 @@ validateNC() {
else
${VALGRIND} ${NCGEN} $ARGS -o $BASENAME.nc $INFILE
fi
${NCDUMP} $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
${NCDUMP} -n $ORIGNAME $BASENAME.nc | sed 's/e+0/e+/g' > $TMPFILE
echo "*** comparing $BASENAME.nc against $INFILE *** "
diff -b -w $INFILE $TMPFILE
}
echo "*** creating classic file c0.nc from c0.cdl..."
echo "*** creating classic file c0_run_ncgen_tests.nc from c0.cdl..."
validateNC c0 c0 -b
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
echo "*** creating 64-bit offset file c0_64_run_ncgen_tests.nc from c0.cdl..."
validateNC c0 "c0_64" -k 64-bit-offset -b
if test "x$USE_CDF5" = x1 ; then
echo "*** creating 64-bit data file c5.nc from c5.cdl..."
${NCGEN} -k 64-bit-data -b -o c5.nc $top_srcdir/ncgen/c5.cdl
if [ ! -f c5.nc ]; then
${NCGEN} -k 64-bit-data -b -o tst_c5_run_ncgen_tests.nc $top_srcdir/ncgen/c5.cdl
if [ ! -f tst_c5_run_ncgen_tests.nc ]; then
echo "Failure."
exit 1
fi

View File

@ -1,20 +1,18 @@
#!/bin/sh
# This script runs UTF-8 tests for netCDF-4.
# Ward Fisher, Dennis Heimbigner, Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
#
# Moving some netcdf-4 only tests here, out of tst_nccopy and run_utf8_tests.
# Without this, the tests fail when netcdf-4 is disabled.
set -e
echo ""
echo "*** Testing netcdf-4 file with utf8 characters..."
rm -f nc4_utf8.nc nc4_utf8.cdl
echo "*** creating enhanced file with utf8 characters..."
${NCGEN} -4 -b -o nc4_utf8.nc ${srcdir}/ref_tst_nc4_utf8_4.cdl
echo "*** dump and compare utf8 output..."
${NCDUMP} nc4_utf8.nc > nc4_utf8.cdl
diff -b -w nc4_utf8.cdl ${srcdir}/ref_tst_nc4_utf8_4.cdl
rm -f tst_utf8_nc4.nc tst_utf8_nc4.cdl
${NCGEN} -4 -b -o tst_utf8_nc4.nc ${srcdir}/ref_tst_utf8_4.cdl
${NCDUMP} -n 'utf8' tst_utf8_nc4.nc > tst_utf8_nc4.cdl
diff -b -w tst_utf8_nc4.cdl ${srcdir}/ref_tst_utf8_4.cdl
echo "*** NetCDF-4 UTF8 testing passed!"
exit 0

View File

@ -1,44 +1,43 @@
# This shell script runs ncdump tests relating to the new UTF8 name stuff.
# Russ Rew, Dennis Heimbigner, Ward Fisher, Ed Hartnett
#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# This shell script runs ncdump tests relating to the new UTF8 name stuff.
set -e
echo ""
echo "*** Testing ncgen and ncdump for UTF8 support..."
# Run tst_utf8.c to produce test file tst_utf8.nc.
${execdir}/tst_utf8
if test "x$builddir" = x ; then
builddir="."
fi
if test "x$srcdir" = x ; then
srcdir="."
fi
# if test "x$builddir" = x ; then
# builddir="."
# fi
# if test "x$srcdir" = x ; then
# srcdir="."
# fi
rm -f utf8.nc utf8.cdl
rm -f tst_utf8_nc3.nc tst_utf8_nc3.cdl
echo "*** creating classic offset file with utf8 characters..."
${NCGEN} -b -o utf8.nc ${srcdir}/ref_tst_utf8.cdl
${NCGEN} -b -o tst_utf8_nc3.nc ${srcdir}/ref_tst_utf8.cdl
echo "*** dump and compare utf8 output..."
${NCDUMP} utf8.nc > utf8.cdl
diff -b -w utf8.cdl ${srcdir}/ref_tst_utf8.cdl
${NCDUMP} -n utf8 tst_utf8_nc3.nc > tst_utf8_nc3.cdl
diff -b -w tst_utf8_nc3.cdl ${srcdir}/ref_tst_utf8.cdl
rm -f utf8.nc utf8.cdl
rm -f tst_utf8_64.nc tst_utf8_64.cdl
echo "*** creating 64-bit offset file with utf8 characters..."
${NCGEN} -k 64-bit-offset -b -o utf8.nc ${srcdir}/ref_tst_utf8.cdl
${NCGEN} -k 64-bit-offset -b -o tst_utf8_64.nc ${srcdir}/ref_tst_utf8.cdl
echo "*** (64 bit) dump and compare utf8 output..."
${NCDUMP} utf8.nc > utf8.cdl
diff -b -w utf8.cdl ${srcdir}/ref_tst_utf8.cdl
${NCDUMP} -n utf8 tst_utf8_64.nc > tst_utf8_64.cdl
diff -b -w tst_utf8_64.cdl ${srcdir}/ref_tst_utf8.cdl
echo "*** dumping tst_utf8.nc to tst_utf8.cdl..."
rm -f tst8.cdl
sed -e 's/^netcdf tst_unicode/netcdf tst_utf8/' <${srcdir}/ref_tst_unicode.cdl >tst8.cdl
${NCDUMP} tst_utf8.nc > tst_utf8.cdl
echo "*** comparing tst_utf8.cdl with tst8.cdl..."
diff -b -w tst_utf8.cdl tst8.cdl
rm -f tst8.cdl result
rm -f tst_tst8.cdl tst_utf8_tst8.cdl
sed -e 's/^netcdf tst_unicode/netcdf tst_utf8/' <${srcdir}/ref_tst_unicode.cdl > tst_tst8.cdl
${NCDUMP} tst_utf8.nc > tst_utf8_tst8.cdl
echo "*** comparing tst_utf8_tst8.cdl with tst_tst8.cdl..."
diff -b -w tst_utf8_tst8.cdl tst_tst8.cdl
echo "*** All utf8 tests of ncgen and ncdump passed!"
exit 0

View File

@ -1,23 +0,0 @@
#!/bin/sh
# This shell script tests that running ncgen can use c0.cdl and
# produce the correct code, which matches ref_ctest.c.
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
echo ""
echo "*** Testing that ncgen produces correct C code from c0.cdl."
${execdir}/ref_ctest
${NCGEN} -lc -o ctest0.nc $srcdir/../ncgen/c0.cdl > ctest.c
diff -b ctest.c $srcdir/ref_ctest.c
echo "*** Testing that ncgen with c0.cdl for 64-bit offset format."
${execdir}/ref_ctest64
${NCGEN} -k2 -lc -o ctest0_64.nc $srcdir/../ncgen/c0.cdl > ctest64.c
diff -b ctest64.c $srcdir/ref_ctest64.c
echo "*** All tests of ncgen with ctest.c and ctest64.c passed!"
exit 0

View File

@ -3,7 +3,10 @@
See COPYRIGHT file for conditions of use.
Use HDF5 to read c0.nc, a file created by ncdump. This check was
added to detect a problem in the early HDF5 1.8.0 releases.
added to detect a problem in the early HDF5 1.8.0 releases. This
program is called from the test script tst_netcdf4.sh, which uses
ncgen to create the test file c0_tst_netcdf4.nc, which this program
reads with HDF5.
Ed Hartnett
*/
@ -11,7 +14,7 @@
#include "err_macros.h"
#include <hdf5.h>
#define FILE_NAME "c0.nc"
#define FILE_NAME "tst_netcdf4_c0.nc"
#define MAX_NAME 1024
int
@ -19,7 +22,6 @@ main()
{
printf("\n*** Checking HDF5 file c0.nc.\n");
printf("*** Checking HDF5 objcts...");
{
hid_t fileid, grpid;
hsize_t num_obj, i;
@ -42,6 +44,5 @@ main()
H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -1,10 +1,13 @@
#!/bin/sh
# For a netCDF-3 build, test nccopy on netCDF files in this
# directory. This test depends on a bunch of other ncdump tests
# running first, to produce the data files that are used to test
# nccopy.
# Dennis Heimbigner
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# For a netCDF-3 build, test nccopy on netCDF files in this directory
set -e
echo ""
@ -20,8 +23,8 @@ else
exit 1
fi
TESTFILES='c0 c0tmp ctest0 ctest0_64 test0_offset test1_offset
tst_calendars tst_mslp tst_mslp_64 tst_ncml tst_small tst_utf8 utf8'
TESTFILES='tst_output_c0 tst_output_c0tmp ctest0 ctest0_64 test0_offset test1_offset
tst_calendars tst_mslp tst_mslp_64 tst_ncml tst_small tst_utf8'
if test "x$HAVE_CDF5" = x1 ; then
TESTFILES="$TESTFILES small small2"

View File

@ -1,9 +1,13 @@
#!/bin/sh
# Tests for ncgen4 using list of test cdl files from the cdl4
# directory, and comparing output to expected results in the expected4
# directory. Note that these tests are run for classic files in
# tst_ncgen4_classic.sh
# Dennis Heimbigner
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
verbose=1
set -e
# To add a new test,
@ -15,14 +19,9 @@ set -e
# 4. Add the new files into cdl4/Makefile.am
# and expected4/Makefile.am
verbose=1
export verbose
KFLAG=1 ; export KFLAG
echo "*** Performing diff tests: k=1"
sh ${srcdir}/tst_ncgen4_diff.sh
echo "*** Performing cycle tests: k=1"
sh ${srcdir}/tst_ncgen4_cycle.sh
KFLAG=3 ; export KFLAG
echo "*** Performing diff tests: k=3"
sh ${srcdir}/tst_ncgen4_diff.sh
@ -34,5 +33,6 @@ sh ${srcdir}/tst_ncgen4_diff.sh
echo "*** Performing cycle tests: k=4"
sh ${srcdir}/tst_ncgen4_cycle.sh
rm -rf ${RESULTSDIR}
exit
echo "SUCCESS!!"
exit 0

View File

@ -1,4 +1,8 @@
#!/bin/sh
# Tests for ncgen4 using list of test cdl files from the cdl4
# directory, and comparing output to expected results in the expected4
# directory. Same as tst_ncgen4.sh but for classic format.
# Dennie Heimbigner
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
@ -6,12 +10,13 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
set -e
echo ""
verbose=0
export verbose
echo "*** Performing diff/cycle tests for classic format: k=1"
KFLAG=1 ; export KFLAG
bash -x ${srcdir}/tst_ncgen4_diff.sh
bash -x ${srcdir}/tst_ncgen4_cycle.sh
echo "SUCCESS!!"
exit 0

View File

@ -35,18 +35,19 @@ for x in ${TESTSET} ; do
echo "xfail test: ${x}: ignored"
xfailcount=`expr $xfailcount + 1`
else
rm -f ${x}.nc ${x}.dmp
rm -f ${x}_$$.nc ${x}_$$.dmp
# step 1: use original cdl to build the .nc
${NCGEN} -b -k${KFLAG} -o ${x}.nc ${cdl}/${x}.cdl
${NCGEN} -b -k${KFLAG} -o ${x}_$$.nc ${cdl}/${x}.cdl
# step 2: dump .nc file
${NCDUMP} ${headflag} ${specflag} ${x}.nc > ${x}.dmp
${NCDUMP} ${headflag} ${specflag} -n ${x} ${x}_$$.nc > ${x}_$$.dmp
# step 3: use ncgen and the ncdump output to (re-)build the .nc
rm -f ${x}.nc
${NCGEN} -b -k${KFLAG} -o ${x}.nc ${x}.dmp
rm -f ${x}_$$.nc
${NCGEN} -b -k${KFLAG} -o ${x}_$$.nc ${x}_$$.dmp
# step 4: dump .nc file again
${NCDUMP} ${headflag} ${specflag} ${x}.nc > ${x}.dmp2
${NCDUMP} ${headflag} ${specflag} -n ${x} ${x}_$$.nc > ${x}_$$.dmp2
# compare the two ncdump outputs
if diff -b -w ${x}.dmp ${x}.dmp2 ; then ok=1; else ok=0; fi
if diff -b -w ${x}_$$.dmp ${x}_$$.dmp2 ; then ok=1; else ok=0; fi
rm -f ${x}_$$.nc ${x}_$$.dmp
if test "x$ok" = "x1" ; then
test "x$verbose" = x1 && echo "*** SUCCEED: ${x}"
passcount=`expr $passcount + 1`

View File

@ -36,10 +36,10 @@ for x in ${TESTSET} ; do
if test "x${t}" = "x${x}" ; then isxfail=1; fi
done
rm -f ${x}.nc ${x}.dmp
${NCGEN} -b -k${KFLAG} -o ${x}.nc ${cdl}/${x}.cdl
${NCGEN} -b -k${KFLAG} -o ${x}_$$.nc ${cdl}/${x}.cdl
# dump .nc file
# if windows, we need to remove any leading 0's in exponents.
${NCDUMP} ${headflag} ${specflag} ${x}.nc | sed 's/e+0/e+/g' > ${x}.dmp
${NCDUMP} ${headflag} ${specflag} -n ${x} ${x}_$$.nc | sed 's/e+0/e+/g' > ${x}.dmp
# compare the expected (silently if XFAIL)
if test "x$isxfail" = "x1" -a "x$SHOWXFAILS" = "x" ; then
if diff -b -bw ${expected}/${x}.dmp ${x}.dmp >/dev/null 2>&1; then ok=1; else ok=0; fi

View File

@ -144,4 +144,3 @@ passcount=0
xfailcount=0
rm -fr $RESULTSDIR
#mkdir $RESULTSDIR

View File

@ -8,87 +8,61 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
set -e
echo ""
echo "*** Testing ncgen and ncdump test output for netCDF-4 format."
# echo "*** creating netcdf-4 file c0_4.nc from c0_4.cdl..."
${NCGEN} -k nc4 -b -o c0_4.nc ${ncgenc04}
# echo "*** creating c1_4.cdl from c0_4.nc..."
${NCDUMP} -n c1 c0_4.nc | sed 's/e+0/e+/g' > c1_4.cdl
# echo "*** comparing c1_4.cdl with ref_ctest1_nc4.cdl..."
diff -b c1_4.cdl $srcdir/ref_ctest1_nc4.cdl
echo "*** Testing ncgen and ncdump for netCDF-4 format."
${NCGEN} -k nc4 -b -o tst_netcdf4_c0_4.nc ${ncgenc04}
${NCDUMP} -n c1 tst_netcdf4_c0_4.nc | sed 's/e+0/e+/g' > tst_netcdf4_c1_4.cdl
diff -b tst_netcdf4_c1_4.cdl $srcdir/ref_ctest1_nc4.cdl
echo "*** Testing ncgen and ncdump test output for netCDF-4 classic format."
# echo "*** creating netcdf-4 classic file c0.nc from c0.cdl..."
${NCGEN} -k nc7 -b -o c0.nc ${ncgenc0}
# echo "*** creating c1.cdl from c0.nc..."
echo "*** Creating test output tst_netcdf4_c0.nc."
${NCGEN} -k nc7 -b -o tst_netcdf4_c0.nc ${ncgenc0}
echo "*** Testing that program tst_h_rdc0 can read c0.cdl."
echo "*** Testing that program tst_h_rdc0 can read tst_netcdf4_c0.nc."
${execdir}/tst_h_rdc0
# echo "*** comparing c1.cdl with ref_ctest1_nc4c.cdl..."
diff -b c1.cdl $srcdir/ref_ctest1_nc4c.cdl
echo "*** Running tst_create_files.c to create test files."
${execdir}/tst_create_files
echo "*** Testing tst_create_files output for netCDF-4 features."
${NCDUMP} tst_solar_1.nc | sed 's/e+0/e+/g' > tst_solar_1.cdl
# echo "*** comparing tst_solar_1.cdl with ref_tst_solar_1.cdl..."
diff -b tst_solar_1.cdl $srcdir/ref_tst_solar_1.cdl
${NCDUMP} tst_solar_2.nc | sed 's/e+0/e+/g' > tst_solar_2.cdl
# echo "*** comparing tst_solar_2.cdl with ref_tst_solar_2.cdl..."
diff -b tst_solar_2.cdl $srcdir/ref_tst_solar_2.cdl
echo "*** Running tst_group_data.c to create test files."
${execdir}/tst_group_data
${NCDUMP} tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cdl
# echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl
# Temporary hack to skip a couple tests that won't work in windows
# without changing the format of the string. See:
#
# http://www.mingw.org/wiki/Posix_path_conversion
if [[ "$OSTYPE" != 'msys' ]]; then
echo "*** Testing -v option with absolute name and groups..."
${NCDUMP} -v /g2/g3/var tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cdl
# echo "*** comparing tst_group_data.cdl with ref_tst_group_data_v23.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data_v23.cdl
fi
echo "*** Testing -v option with relative name and groups..."
${NCDUMP} -v var,var2 tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cdl
# echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl
echo "*** Running tst_enum_data.c to create test files."
${execdir}/tst_enum_data
${NCDUMP} tst_enum_data.nc | sed 's/e+0/e+/g' > tst_enum_data.cdl
# echo "*** comparing tst_enum_data.cdl with ref_tst_enum_data.cdl..."
diff -b tst_enum_data.cdl $srcdir/ref_tst_enum_data.cdl
echo "*** Running tst_opaque_data.c to create test files."
${execdir}/tst_opaque_data
${NCDUMP} tst_opaque_data.nc | sed 's/e+0/e+/g' > tst_opaque_data.cdl
# echo "*** comparing tst_opaque_data.cdl with ref_tst_opaque_data.cdl..."
diff -b tst_opaque_data.cdl $srcdir/ref_tst_opaque_data.cdl
echo "*** Running tst_vlen_data.c to create test files."
${execdir}/tst_vlen_data
${NCDUMP} tst_vlen_data.nc | sed 's/e+0/e+/g' > tst_vlen_data.cdl
# echo "*** comparing tst_vlen_data.cdl with ref_tst_vlen_data.cdl..."
diff -b tst_vlen_data.cdl $srcdir/ref_tst_vlen_data.cdl
echo "*** Running tst_comp.c to create test files."
${execdir}/tst_comp
${NCDUMP} tst_comp.nc | sed 's/e+0/e+/g' > tst_comp.cdl
# echo "*** comparing tst_comp.cdl with ref_tst_comp.cdl..."
diff -b tst_comp.cdl $srcdir/ref_tst_comp.cdl
# echo "*** creating tst_nans.cdl from tst_nans.nc"
echo "*** Running tst_nans.c to create test files."
${execdir}/tst_nans
${NCDUMP} tst_nans.nc | sed 's/e+0/e+/g' > tst_nans.cdl
# echo "*** comparing ncdump of generated file with ref_tst_nans.cdl ..."
diff -b tst_nans.cdl $srcdir/ref_tst_nans.cdl
# Do unicode test only if it exists => BUILD_UTF8 is true

View File

@ -10,19 +10,27 @@ set -e
echo ""
echo "*** Testing ncgen and ncdump test output for classic format."
echo "*** creating ctest1.cdl from ctest0.nc..."
${NCDUMP} -n c1 ${builddir}/ctest0.nc | sed 's/e+0/e+/g' > ctest1.cdl
echo "*** creating c0.nc from c0.cdl..."
${NCGEN} -b -o c0.nc ${ncgenc0}
echo "*** creating c1.cdl from c0.nc..."
${NCDUMP} -n c1 ${builddir}/c0.nc | sed 's/e+0/e+/g' > c1.cdl
echo "*** Testing that ncgen produces correct C code from c0.cdl."
${execdir}/ref_ctest
${NCGEN} -lc -o ctest0.nc $srcdir/../ncgen/c0.cdl > tst_output_ctest.c
diff -b tst_output_ctest.c $srcdir/ref_ctest.c
echo "*** creating ctest1.cdl from tst_output_ctest0.nc..."
${NCDUMP} -n c1 ${builddir}/ctest0.nc | sed 's/e+0/e+/g' > tst_output_ctest1.cdl
echo "*** creating tst_output_c0.nc from c0.cdl..."
${NCGEN} -b -o tst_output_c0.nc ${ncgenc0}
echo "*** creating tst_output_c1.cdl from tst_output_c0.nc..."
${NCDUMP} -n c1 ${builddir}/tst_output_c0.nc | sed 's/e+0/e+/g' > tst_output_c1.cdl
echo "*** comparing tst_output_c1.cdl with ref_ctest1_nc4c.cdl..."
diff -b tst_output_c1.cdl $srcdir/ref_ctest1_nc4c.cdl
echo "*** comparing ncdump of C program output (ctest1.cdl) with c1.cdl..."
diff -b c1.cdl ctest1.cdl
diff -b tst_output_c1.cdl tst_output_ctest1.cdl
echo "*** test output for ncdump -k"
KIND=`${NCDUMP} -k c0.nc`
KIND=`${NCDUMP} -k tst_output_c0.nc`
test "$KIND" = "classic";
${NCGEN} -k $KIND -b -o c0tmp.nc ${ncgenc0}
cmp c0tmp.nc c0.nc
${NCGEN} -k $KIND -b -o tst_output_c0tmp.nc ${ncgenc0}
cmp tst_output_c0tmp.nc tst_output_c0.nc
echo "*** test output for ncdump -x"
echo "*** creating tst_ncml.nc from tst_ncml.cdl"
@ -42,19 +50,24 @@ diff -b tst_format_att.cdl $srcdir/ref_tst_format_att.cdl
echo "*** All ncgen and ncdump test output for classic format passed!"
echo "*** Testing that ncgen with c0.cdl for 64-bit offset format."
${execdir}/ref_ctest64
${NCGEN} -k2 -lc -o ctest0_64.nc $srcdir/../ncgen/c0.cdl > tst_output_ctest64.c
diff -b tst_output_ctest64.c $srcdir/ref_ctest64.c
echo "*** Testing ncgen and ncdump test output for 64-bit offset format."
echo "*** creating ctest1_64.cdl from test0_64.nc..."
${NCDUMP} -n c1 ctest0_64.nc | sed 's/e+0/e+/g' > ctest1_64.cdl
echo "*** creating c0.nc from c0.cdl..."
${NCGEN} -k nc6 -b -o c0.nc ${ncgenc0}
echo "*** creating c1.cdl from c0.nc..."
${NCDUMP} -n c1 c0.nc | sed 's/e+0/e+/g' > c1.cdl
echo "*** comparing ncdump of C program output (ctest1_64.cdl) with c1.cdl..."
diff -b c1.cdl ctest1_64.cdl
${NCDUMP} -n c1 ctest0_64.nc | sed 's/e+0/e+/g' > tst_output_ctest1_64.cdl
echo "*** creating tst_output_c0_64.nc from c0.cdl..."
${NCGEN} -k nc6 -b -o tst_output_c0_64.nc ${ncgenc0}
echo "*** creating tst_output_c1_64.cdl from tst_output_c0_64.nc..."
${NCDUMP} -n c1 tst_output_c0_64.nc | sed 's/e+0/e+/g' > tst_output_c1_64.cdl
echo "*** comparing ncdump of C program output (ctest1_64.cdl) with tst_output_c1_64.cdl..."
diff -b tst_output_c1_64.cdl tst_output_ctest1_64.cdl
echo "*** test output for ncdump -k"
test "`${NCDUMP} -k c0.nc`" = "64-bit offset";
${NCGEN} -k nc6 -b -o c0tmp.nc ${ncgenc0}
cmp c0tmp.nc c0.nc
test "`${NCDUMP} -k tst_output_c0_64.nc`" = "64-bit offset";
${NCGEN} -k nc6 -b -o tst_output_c0_64_tmp.nc ${ncgenc0}
cmp tst_output_c0_64_tmp.nc tst_output_c0_64.nc
echo "*** test output for ncdump -s"
echo "*** creating tst_mslp_64.nc from tst_mslp.cdl"

View File

@ -648,7 +648,6 @@ convertFilterID(const char* id)
{
unsigned int nid = 0;
int ok = 0;
struct FilterID* f;
/* for now, must be an integer */
ok = sscanf(id,"%u",&nid);

View File

@ -57,7 +57,6 @@ main(int argc, char **argv)
char testfile[NC_MAX_NAME];
int format[MAX_NUM_FORMATS];
int num_formats;
int f = 0;
int i, nerrs = 0;
ncopts &= ~NC_FATAL; /* make errors nonfatal */

View File

@ -6,8 +6,6 @@
#include "occompile.h"
#include "ocdebug.h"
static const unsigned int MAX_UINT = 0xffffffff;
static OCerror mergedas1(OCnode* dds, OCnode* das);
static OCerror mergedods1(OCnode* dds, OCnode* das);
static OCerror mergeother1(OCnode* root, OCnode* das);

View File

@ -204,9 +204,7 @@ static int
readfile(const char* path, const char* suffix, NCbytes* packet)
{
int stat = OC_NOERR;
char buf[1024];
char filename[1024];
int flags = 0;
/* check for leading file:/// */
if(ocstrncmp(path,"file://",7)==0) path += 7; /* assume absolute path*/
if(!occopycat(filename,sizeof(filename),2,path,(suffix != NULL ? suffix : "")))