Merge pull request #1404 from NetCDF-World-Domination-Council/ejh_perf

fix compile warnings in tst_large2, tst_rename2, and tst_rename3, and some build issues, including partial fix for building with HDF4 but without HDF5
This commit is contained in:
Ward Fisher 2019-05-22 13:00:18 -06:00 committed by GitHub
commit a517efca96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 111 additions and 96 deletions

View File

@ -1386,6 +1386,11 @@ AC_MSG_WARN([netCDF-4 disabled => --disable-filter-testing])
enable_filter_testing=no
fi
if test "x$enable_hdf5" = xno ; then
AC_MSG_WARN([HDF5 disabled => --disable-filter-testing])
enable_filter_testing=no
fi
if test "x$enable_shared" = xno ; then
AC_MSG_WARN([Shared libraries are disabled => --disable-filter-testing])
enable_filter_testing=no

View File

@ -11,6 +11,7 @@
#ifndef _NCDIMSCALE_H_
#define _NCDIMSCALE_H_
#ifdef USE_HDF5
#include <hdf5.h>
/* This is used to uniquely identify datasets, so we can keep track of
@ -20,5 +21,6 @@ typedef struct hdf5_objid
unsigned long fileno[2]; /* file number */
haddr_t objno[2]; /* object number */
} HDF5_OBJID_T;
#endif /* USE_HDF5 */
#endif

View File

@ -14,7 +14,7 @@
#include "netcdf.h"
#include "netcdf_filter.h"
#ifdef USE_NETCDF4
#ifdef USE_HDF5
#include "hdf5internal.h"
#endif
@ -278,7 +278,7 @@ nc_filter_register(NC_FILTER_INFO* filter)
return NC_EINVAL;
switch (filter->format) {
case NC_FILTER_FORMAT_HDF5:
#ifdef USE_NETCDF4
#ifdef USE_HDF5
stat = nc4_filter_action(FILTER_REG, filter->format, filter->id, filter);
#else
stat = NC_ENOTBUILT;
@ -296,7 +296,7 @@ nc_filter_unregister(int fformat, int id)
int stat = NC_NOERR;
switch (fformat) {
case NC_FILTER_FORMAT_HDF5:
#ifdef USE_NETCDF4
#ifdef USE_HDF5
stat = nc4_filter_action(FILTER_UNREG, fformat, id, NULL);
#else
stat = NC_ENOTBUILT;
@ -314,7 +314,7 @@ nc_filter_inq(int fformat, int id, NC_FILTER_INFO* filter_info)
int stat = NC_NOERR;
switch (fformat) {
case NC_FILTER_FORMAT_HDF5:
#ifdef USE_NETCDF4
#ifdef USE_HDF5
stat = nc4_filter_action(FILTER_INQ, fformat, id, filter_info);
#else
stat = NC_ENOTBUILT;

View File

@ -9,7 +9,9 @@
*/
#include "config.h"
#ifdef USE_HDF5
#include <hdf5internal.h>
#endif
#include <math.h> /* For pow() used below. */
/** @internal Default size for unlimited dim chunksize. */

View File

@ -16,12 +16,12 @@ extern int NC3_finalize(void);
#ifdef USE_NETCDF4
#include "nc4internal.h"
#include "hdf5internal.h"
extern int NC4_initialize(void);
extern int NC4_finalize(void);
#endif
#ifdef USE_HDF5
#include "hdf5internal.h"
extern int NC_HDF5_initialize(void);
extern int NC_HDF5_finalize(void);
#endif

View File

@ -13,7 +13,9 @@
#include "config.h"
#include <nc4internal.h>
#include "nc4dispatch.h"
#ifdef USE_HDF5
#include "hdf5internal.h"
#endif
#include <math.h>
/**

View File

@ -58,7 +58,7 @@ EXTRA_DIST = run_par_bm_test.sh.in run_knmi_bm.sh CMakeLists.txt \
perftest.sh run_bm_test1.sh run_bm_test2.sh \
CMakeLists.txt
CLEANFILES = tst_*.nc *.txt bigmeta.nc bigvars.nc floats*.nc \
CLEANFILES = tst_*.nc bigmeta.nc bigvars.nc floats*.nc \
floats*.cdl shorts*.nc shorts*.cdl ints*.nc ints*.cdl tst_*.cdl
DISTCLEANFILES = run_par_bm_test.sh MSGCPP_CWP_NC*.nc

View File

@ -88,6 +88,7 @@ TESTS += test_byterange.sh
endif
if BUILD_MMAP
TESTS += run_mmap.sh
run_mmap.log: run_diskless.log
endif
endif
@ -110,7 +111,7 @@ CMakeLists.txt
CLEANFILES = nc_test_*.nc tst_*.nc t_nc.nc large_files.nc \
quick_large_files.nc tst_diskless3_file.cdl \
tst_diskless4.cdl ref_tst_diskless4.cdl benchmark.nc \
tst_http_nc3.cdl tst_http_nc4.cdl
tst_http_nc3.cdl tst_http_nc4.cdl tmp*.cdl tmp*.nc
EXTRA_DIST += bad_cdf5_begin.nc run_cdf5.sh
if ENABLE_CDF5

View File

@ -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]: %ld i: %ld j: %ld expected %d got %g\n",
printf("error on start[0]: %ld i: %d j: %d expected %ld got %g\n",
start[0], i, j, (start[0] + i + j), data[j + LON_LEN * i]);
ERR_RET;
}

View File

@ -275,8 +275,8 @@ main(int argc, char **argv)
SUMMARIZE_ERR;
fprintf(stderr,"*** test renaming affect on varids...");
{
int ncid, dimid1, dimid2, varid1, varid2;
int dimid_in, varid_in;
int ncid, varid1, varid2;
int varid_in;
char file_name[NC_MAX_NAME + 1];
/* Create file with two scalar vars. */

View File

@ -34,8 +34,8 @@ main(int argc, char **argv)
fprintf(stderr,"Test more renaming.\n");
fprintf(stderr,"*** test renaming affect on varids...");
{
int ncid, dimid1, dimid2, varid1, varid2;
int dimid_in, varid_in;
int ncid, varid1, varid2;
int varid_in;
char file_name[NC_MAX_NAME + 1];
/* Create file with two scalar vars. */
@ -60,96 +60,99 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
/* fprintf(stderr,"*** test renaming coord var to non-coord var..."); */
/* { */
/* int ncid, dimid1, dimid2, varid1, varid2; */
/* int dimid_in, varid_in; */
/* char file_name[NC_MAX_NAME + 1]; */
fprintf(stderr,"*** test renaming coord var to non-coord var...");
{
int ncid, dimid1, dimid2, varid1, varid2;
int dimid_in, varid_in;
char file_name[NC_MAX_NAME + 1];
/* /\* Create file with two dims and associated coordinate vars. *\/ */
/* sprintf(file_name, "%s_coord_to_non_coord.nc", TEST_NAME); */
/* if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR; */
/* if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR; */
/* if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR; */
/* if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR; */
/* if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR; */
/* if (nc_close(ncid)) ERR; */
/* Create file with two dims and associated coordinate vars. */
sprintf(file_name, "%s_coord_to_non_coord.nc", TEST_NAME);
if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR;
if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR;
if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR;
if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR;
if (nc_close(ncid)) ERR;
/* /\* Open the file and rename a var. *\/ */
/* nc_set_log_level(4); */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR; */
/* if (nc_close(ncid)) ERR; */
/* Open the file and rename a var. */
nc_set_log_level(4);
if (nc_open(file_name, NC_WRITE, &ncid)) ERR;
if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR;
if (nc_close(ncid)) ERR;
/* /\* Reopen file and check, *\/ */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; */
/* printf("dimid_in %d\n", dimid_in); */
/* if (dimid_in != dimid1) ERR; */
/* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; */
/* if (dimid_in != dimid2) ERR; */
/* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; */
/* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; */
/* /\* if (varid_in != varid1) ERR; *\/ */
/* if (nc_inq_varid(ncid, D1_NAME, &varid_in) != NC_ENOTVAR) ERR; */
/* if (nc_close(ncid)) ERR; */
/* Reopen file and check, */
if (nc_open(file_name, NC_WRITE, &ncid)) ERR;
if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR;
printf("dimid_in %d\n", dimid_in);
if (dimid_in != dimid1) ERR;
if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR;
if (dimid_in != dimid2) ERR;
if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR;
if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR;
/* if (varid_in != varid1) ERR; */
if (nc_inq_varid(ncid, D1_NAME, &varid_in) != NC_ENOTVAR) ERR;
if (nc_close(ncid)) ERR;
/* /\* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; *\/ */
/* /\* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; *\/ */
/* /\* if (nc_close(ncid)) ERR; *\/ */
/* This should work but does not (yet). */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; */
/* if (nc_close(ncid)) ERR; */
/* /\* /\\* Reopen file and check, *\\/ *\/ */
/* /\* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; *\/ */
/* /\* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; *\/ */
/* /\* if (dimid_in != dimid1) ERR; *\/ */
/* /\* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; *\/ */
/* /\* if (dimid_in != dimid2) ERR; *\/ */
/* /\* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; *\/ */
/* /\* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; *\/ */
/* /\* if (varid_in != varid1) ERR; *\/ */
/* /\* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; *\/ */
/* /\* if (varid_in != varid2) ERR; *\/ */
/* /\* if (nc_close(ncid)) ERR; *\/ */
/* } */
/* SUMMARIZE_ERR; */
/* fprintf(stderr,"*** test exchanging names of two coord vars, making them non-coord vars with names same as dims..."); */
/* { */
/* int ncid, dimid1, dimid2, varid1, varid2; */
/* int dimid_in, varid_in; */
/* char file_name[NC_MAX_NAME + 1]; */
/* /\* Reopen file and check, *\/ */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; */
/* if (dimid_in != dimid1) ERR; */
/* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; */
/* if (dimid_in != dimid2) ERR; */
/* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; */
/* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; */
/* if (varid_in != varid1) ERR; */
/* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; */
/* if (varid_in != varid2) ERR; */
/* if (nc_close(ncid)) ERR; */
}
SUMMARIZE_ERR;
fprintf(stderr,"*** test exchanging names of two coord vars, making them non-coord vars with names same as dims...");
{
int ncid, dimid1, dimid2, varid1, varid2;
/* int dimid_in; */
/* int varid_in; */
char file_name[NC_MAX_NAME + 1];
/* /\* Create file with dim and associated coordinate var. *\/ */
/* sprintf(file_name, "%s_non_coord_to_dim.nc", TEST_NAME); */
/* if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR; */
/* if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR; */
/* if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR; */
/* if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR; */
/* if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR; */
/* if (nc_close(ncid)) ERR; */
/* Create file with dim and associated coordinate var. */
sprintf(file_name, "%s_non_coord_to_dim.nc", TEST_NAME);
if (nc_create(file_name, NC_CLOBBER|NC_NETCDF4|NC_CLASSIC_MODEL, &ncid)) ERR;
if (nc_def_dim(ncid, D1_NAME, DIM1_LEN, &dimid1)) ERR;
if (nc_def_dim(ncid, D2_NAME, DIM1_LEN, &dimid2)) ERR;
if (nc_def_var(ncid, D1_NAME, NC_INT, NDIM1, &dimid1, &varid1)) ERR;
if (nc_def_var(ncid, D2_NAME, NC_INT, NDIM1, &dimid2, &varid2)) ERR;
if (nc_close(ncid)) ERR;
/* /\* Open the file and rename the vars. *\/ */
/* nc_set_log_level(4); */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR; */
/* nc_sync(ncid); */
/* /\* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; *\/ */
/* /\* nc_sync(ncid); *\/ */
/* /\* if (nc_rename_var(ncid, varid1, D2_NAME)) ERR; *\/ */
/* if (nc_close(ncid)) ERR; */
/* Open the file and rename the vars. */
nc_set_log_level(4);
if (nc_open(file_name, NC_WRITE, &ncid)) ERR;
if (nc_rename_var(ncid, varid1, TMP_NAME)) ERR;
nc_sync(ncid);
/* This should work but doesn't yet. */
/* if (nc_rename_var(ncid, varid2, D1_NAME)) ERR; */
/* nc_sync(ncid); */
/* if (nc_rename_var(ncid, varid1, D2_NAME)) ERR; */
if (nc_close(ncid)) ERR;
/* /\* Reopen file and check, *\/ */
/* if (nc_open(file_name, NC_WRITE, &ncid)) ERR; */
/* /\* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; *\/ */
/* /\* if (dimid_in != dimid1) ERR; *\/ */
/* /\* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; *\/ */
/* /\* if (dimid_in != dimid2) ERR; *\/ */
/* /\* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; *\/ */
/* /\* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; *\/ */
/* /\* if (varid_in != varid1) ERR; *\/ */
/* /\* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; *\/ */
/* /\* if (varid_in != varid2) ERR; *\/ */
/* if (nc_close(ncid)) ERR; */
/* } */
/* SUMMARIZE_ERR; */
/* Reopen file and check, this should work but doesnt yet. */
if (nc_open(file_name, NC_WRITE, &ncid)) ERR;
/* if (nc_inq_dimid(ncid, D1_NAME, &dimid_in)) ERR; */
/* if (dimid_in != dimid1) ERR; */
/* if (nc_inq_dimid(ncid, D2_NAME, &dimid_in)) ERR; */
/* if (dimid_in != dimid2) ERR; */
/* if (nc_inq_dimid(ncid, TMP_NAME, &dimid_in) != NC_EBADDIM) ERR; */
/* if (nc_inq_varid(ncid, TMP_NAME, &varid_in)) ERR; */
/* if (varid_in != varid1) ERR; */
/* if (nc_inq_varid(ncid, D1_NAME, &varid_in)) ERR; */
/* if (varid_in != varid2) ERR; */
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -25,7 +25,7 @@ NC4_show_metadata(int ncid)
int
tst_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
void *parameters, NC_Dispatch *dispatch, NC *nc_file)
void *parameters, const NC_Dispatch *dispatch, NC *nc_file)
{
return NC_NOERR;
}