diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:28:14 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:28:14 (GMT) |
commit | 104e1cd848e26eda1c774937c3beb38ff5861fd8 (patch) | |
tree | 6060c90d638783dd85f3b413e4e2ad15cba3e609 /tools/h5repack | |
parent | 26fdccf6cd0325756a9365c86fd373d3eb955095 (diff) | |
download | hdf5-104e1cd848e26eda1c774937c3beb38ff5861fd8.zip hdf5-104e1cd848e26eda1c774937c3beb38ff5861fd8.tar.gz hdf5-104e1cd848e26eda1c774937c3beb38ff5861fd8.tar.bz2 |
[svn-r13573]
Bug fixes
Reset external file list slots name_offset to a state when created (0) in H5P_dcrt_copy
so that it conforms to an assertion in H5D_update_entry_info that assumes the name_offset is 0 at this point
this fixes the problem of h5repack and external files, add a new test and files for an external file
h5diff, check for an error return in H5D_get_storage_size
tested linux 32, 64
Diffstat (limited to 'tools/h5repack')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 16 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 90 |
2 files changed, 90 insertions, 16 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index e8d0f90..1782502 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -186,7 +186,6 @@ int do_copy_objects(hid_t fidin, hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ hsize_t dsize_in; /* input dataset size before filter */ hsize_t dsize_out; /* output dataset size after filter */ - int next; /* external files */ int apply_s; /* flag for apply filter to small dataset sizes */ int apply_f; /* flag for apply filter to return error on H5Dcreate */ double per; /* percent utilization of storage */ @@ -303,18 +302,7 @@ int do_copy_objects(hid_t fidin, if ((msize=H5Tget_size(wtype_id))==0) goto error; - - /*------------------------------------------------------------------------- - * check for external files - *------------------------------------------------------------------------- - */ - if ((next=H5Pget_external_count (dcpl_id))<0) - goto error; - - if (next) - fprintf(stderr," <warning: %s has external files, ignoring read...>\n", - travt->objs[i].name ); - + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -322,7 +310,7 @@ int do_copy_objects(hid_t fidin, * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ - if (next==0 && h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) + if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) { apply_s=1; apply_f=1; diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 04c9a67..6dc3c3d 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -65,6 +65,9 @@ /* Big file to test read by hyperslabs */ #define FNAME14 "h5repack_big.h5" #define FNAME14OUT "h5repack_big_out.h5" +/* external file */ +#define FNAME15 "h5repack_ext.h5" +#define FNAME15OUT "h5repack_ext_out.h5" const char *H5REPACK_FILENAMES[] = { @@ -110,6 +113,8 @@ int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *dset_name,hid_t t int make_dset(hid_t loc_id,const char *name,hid_t sid,hid_t dcpl,void *buf); int make_attr(hid_t loc_id,int rank,hsize_t *dims,const char *attr_name,hid_t type_id,void *buf); void make_dset_reg_ref(hid_t loc_id); +int make_external(hid_t loc_id); + /*------------------------------------------------------------------------- * Function: main @@ -155,8 +160,7 @@ int main (void) * Format of the tests: * * 1) make a copy of the file with h5repack - * 2) use the h5diff utility to compare the input and output file; - * it returns RET==0 if the objects have the same data + * 2) use the h5diff function to compare the input and output file *------------------------------------------------------------------------- */ @@ -1281,6 +1285,23 @@ if (szip_can_encode) { GOERROR; PASSED(); +/*------------------------------------------------------------------------- + * test external dataset + *------------------------------------------------------------------------- + */ + TESTING(" external datasets"); + if (h5repack_init (&pack_options, 0)<0) + GOERROR; + if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0) + GOERROR; + if (h5diff(FNAME15,FNAME15OUT,NULL,NULL,&diff_options) > 0) + GOERROR; + if (h5repack_verify(FNAME15OUT,&pack_options)<=0) + GOERROR; + if (h5repack_end (&pack_options)<0) + GOERROR; + PASSED(); + /*------------------------------------------------------------------------- * end @@ -1463,6 +1484,17 @@ int make_testfiles(void) if(H5Fclose(loc_id)<0) return -1; +/*------------------------------------------------------------------------- + * create a file with external dataset + *------------------------------------------------------------------------- + */ + if((loc_id = H5Fcreate(FNAME15,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) + return -1; + if (make_external(loc_id)<0) + goto out; + if(H5Fclose(loc_id)<0) + return -1; + return 0; out: @@ -2661,6 +2693,60 @@ out: } /*------------------------------------------------------------------------- + * Function: make_external + * + * Purpose: create a external dataset + * + *------------------------------------------------------------------------- + */ + +int make_external(hid_t loc_id) +{ + hid_t did=-1; + hid_t sid=-1; + hid_t dcpl; + int buf[2]={1,2}; + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + hsize_t size; + + cur_size[0] = max_size[0] = 2; + size = max_size[0] * sizeof(int); + + /* create */ + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) + goto out; + if (H5Pset_external(dcpl, "h5repack_ext.bin", (off_t)0, size)<0) + goto out; + if ((sid = H5Screate_simple(1,cur_size, max_size))<0) + goto out; + if ((did = H5Dcreate(loc_id,"external",H5T_NATIVE_INT,sid,dcpl))<0) + goto out; + if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + goto out; + + /* close */ + if(H5Sclose(sid)<0) + goto out; + if(H5Pclose(dcpl)<0) + goto out; + if(H5Dclose(did)<0) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Sclose(sid); + H5Dclose(did); + } H5E_END_TRY; + return -1; + +} + + +/*------------------------------------------------------------------------- * Function: write_dset_in * * Purpose: write datasets in LOC_ID |