mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-18 18:20:39 +08:00
broke out test into libsrc/tst_interops6.c to help find memory problem
This commit is contained in:
parent
a60c19a01d
commit
4220dca07a
@ -140,10 +140,10 @@ tst_h_atts3 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_dimscales \
|
||||
tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums \
|
||||
tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
|
||||
tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps \
|
||||
tst_compounds tst_compounds2 tst_compounds3 tst_opaques tst_strings \
|
||||
tst_interops tst_interops4 tst_interops5 tst_enums tst_coords \
|
||||
tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars tst_varms \
|
||||
tst_unlim_vars tst_converts tst_converts2 tst_grps tst_compounds \
|
||||
tst_compounds2 tst_compounds3 tst_opaques tst_strings tst_interops \
|
||||
tst_interops4 tst_interops5 tst_interops6 tst_enums tst_coords \
|
||||
tst_coords2 tst_coords3 tst_vars3 tst_chunks tst_utf8 tst_fills \
|
||||
tst_fillbug tst_xplatform tst_xplatform2 tst_endian_fill
|
||||
|
||||
@ -164,9 +164,9 @@ tst_h_dimscales3 tst_h_enums tst_dims tst_dims2 tst_dims3 tst_files \
|
||||
tst_files4 tst_vars tst_varms tst_unlim_vars tst_converts \
|
||||
tst_converts2 tst_grps tst_compounds tst_compounds2 tst_compounds3 \
|
||||
tst_opaques tst_strings tst_interops tst_interops4 tst_interops5 \
|
||||
tst_enums tst_vars3 tst_chunks tst_coords tst_coords2 tst_coords3 \
|
||||
tst_utf8 tst_fills tst_fillbug tst_xplatform tst_xplatform2 \
|
||||
tst_h_atts2 tst_endian_fill
|
||||
tst_interops6 tst_enums tst_vars3 tst_chunks tst_coords tst_coords2 \
|
||||
tst_coords3 tst_utf8 tst_fills tst_fillbug tst_xplatform \
|
||||
tst_xplatform2 tst_h_atts2 tst_endian_fill
|
||||
|
||||
EXTRA_DIST = ref_tst_compounds.nc ref_tst_h_compounds.h5 \
|
||||
ref_tst_h_compounds2.h5 run_par_tests.sh run_valgrind_tests.sh \
|
||||
|
@ -417,7 +417,7 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name,
|
||||
int *dim_without_var)
|
||||
{
|
||||
/*char *start_of_len;*/
|
||||
char dimscale_name_att[NC_MAX_NAME + 1];
|
||||
char dimscale_name_att[NC_MAX_NAME + 1] = "";
|
||||
int natts, a;
|
||||
hid_t attid = 0;
|
||||
char att_name[NC_MAX_HDF5_NAME + 1];
|
||||
@ -485,15 +485,6 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name,
|
||||
return retval;
|
||||
grp->dim->len = *lenp;
|
||||
}
|
||||
/* else */
|
||||
/* { */
|
||||
/* start_of_len = dimscale_name_att + strlen(DIM_WITHOUT_VARIABLE); */
|
||||
/* #if (SIZEOF_SIZE_T < 8) */
|
||||
/* sscanf(start_of_len, "%d", (int *)&grp->dim->len); */
|
||||
/* #else */
|
||||
/* sscanf(start_of_len, "%ld", (size_t *)&grp->dim->len); */
|
||||
/* #endif */
|
||||
/* } */
|
||||
(*dim_without_var)++;
|
||||
}
|
||||
}
|
||||
|
@ -401,94 +401,6 @@ main(int argc, char **argv)
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
printf("*** Checking a HDF5 file with scalar, fixed-length string dataset...");
|
||||
{
|
||||
#define VAR_NAME "Gettysburg Address"
|
||||
hid_t fapl_id, fcpl_id, fileid, grpid, spaceid, typeid, datasetid, plistid;
|
||||
/*void *fillp;*/
|
||||
/*int ncid, nvars_in, ndims_in, natts_in, unlimdim_in, type_in;*/
|
||||
/*size_t size_in;*/
|
||||
char data[] = "Four score and seven years ago our fathers brought forth on "
|
||||
"this continent, a new nation, conceived in Liberty, and dedicated to "
|
||||
"the proposition that all men are created equal. Now we are engaged "
|
||||
"in a great civil war, testing whether that nation, or any nation so "
|
||||
"conceived and so dedicated, can long endure. We are met on a great "
|
||||
"battle-field of that war. We have come to dedicate a portion of that "
|
||||
"field, as a final resting place for those who here gave their lives "
|
||||
"that that nation might live. It is altogether fitting and proper that "
|
||||
"we should do this. But, in a larger sense, we can not dedicate -- we "
|
||||
"can not consecrate -- we can not hallow -- this ground. The brave men, "
|
||||
"living and dead, who struggled here, have consecrated it, far above our "
|
||||
"poor power to add or detract. The world will little note, nor long "
|
||||
"remember what we say here, but it can never forget what they did here. "
|
||||
"It is for us the living, rather, to be dedicated here to the unfinished "
|
||||
"work which they who fought here have thus far so nobly advanced. It is "
|
||||
"rather for us to be here dedicated to the great task remaining before "
|
||||
"us -- that from these honored dead we take increased devotion to that "
|
||||
"cause for which they gave the last full measure of devotion -- that we "
|
||||
"here highly resolve that these dead shall not have died in vain -- that "
|
||||
"this nation, under God, shall have a new birth of freedom -- and that "
|
||||
"government of the people, by the people, for the people, shall not "
|
||||
"perish from the earth.";
|
||||
char *empty = "";
|
||||
/*char *data_in2;*/
|
||||
|
||||
/* Create file access and create property lists. */
|
||||
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
|
||||
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
|
||||
|
||||
/* Set latest_format in access propertly list. This ensures that
|
||||
* the latest, greatest, HDF5 versions are used in the file. */
|
||||
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;
|
||||
|
||||
/* Set H5P_CRT_ORDER_TRACKED in the creation property list. This
|
||||
* turns on HDF5 creation ordering in the file. */
|
||||
if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
|
||||
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
|
||||
if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
|
||||
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
|
||||
|
||||
/* Create the file, open root group. */
|
||||
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR;
|
||||
if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR;
|
||||
|
||||
/* Create string type. */
|
||||
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
|
||||
if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR;
|
||||
|
||||
/* Create a scalar space. */
|
||||
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
|
||||
|
||||
/* Write an scalar dataset of this type. */
|
||||
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
|
||||
if (H5Pset_fill_value(plistid, typeid, &empty) < 0) ERR;
|
||||
if ((datasetid = H5Dcreate1(grpid, VAR_NAME, typeid,
|
||||
spaceid, plistid)) < 0) ERR;
|
||||
if (H5Dwrite(datasetid, typeid, spaceid, spaceid,
|
||||
H5P_DEFAULT, data) < 0) ERR;
|
||||
|
||||
/* Close up. */
|
||||
if (H5Dclose(datasetid) < 0) ERR;
|
||||
if (H5Pclose(fapl_id) < 0) ERR;
|
||||
if (H5Pclose(fcpl_id) < 0) ERR;
|
||||
if (H5Pclose(plistid) < 0) ERR;
|
||||
if (H5Tclose(typeid) < 0) ERR;
|
||||
if (H5Gclose(grpid) < 0) ERR;
|
||||
if (H5Fclose(fileid) < 0) ERR;
|
||||
|
||||
/* Read the file with netCDF-4. */
|
||||
/* if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; */
|
||||
/* if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR; */
|
||||
/* if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdim_in != -1) ERR; */
|
||||
/* if (nc_inq_att(ncid, NC_GLOBAL, ATT_NAME2, &type_in, &size_in)) ERR; */
|
||||
/* if (type_in != NC_STRING || size_in != ATT_LEN) ERR; */
|
||||
/* if (nc_get_att_string(ncid, NC_GLOBAL, ATT_NAME2, data_in2)) ERR; */
|
||||
/* for (i = 0; i < size_in; i++) */
|
||||
/* if (strcmp(data[i], data_in2[i])) ERR; */
|
||||
/* if (nc_free_string(size_in, data_in2)) ERR; */
|
||||
/* if (nc_close(ncid)) ERR; */
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
/* printf("**** testing 2D coordinate variable..."); */
|
||||
|
||||
/* { */
|
||||
|
Loading…
x
Reference in New Issue
Block a user