diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:27:34 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-04-02 20:27:34 (GMT) |
commit | 711836587a19b9b5a6e9a5581807b288e2a49c31 (patch) | |
tree | 42fa64832ce960a228d0b8bb92f9246202f546bf /tools | |
parent | dd3768ee25e4db04301f26f699f731ea8f5291fa (diff) | |
download | hdf5-711836587a19b9b5a6e9a5581807b288e2a49c31.zip hdf5-711836587a19b9b5a6e9a5581807b288e2a49c31.tar.gz hdf5-711836587a19b9b5a6e9a5581807b288e2a49c31.tar.bz2 |
[svn-r13572]
Bug fixes
Reset external file list slots name_offset to a state when created (0) in H5D_crt_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')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 16 | ||||
-rw-r--r-- | tools/h5repack/h5repack_ext.bin | bin | 0 -> 8 bytes | |||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 88 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 7 | ||||
-rw-r--r-- | tools/testfiles/h5diff_70.txt | 2 | ||||
-rw-r--r-- | tools/testfiles/h5diff_80.txt | 4 | ||||
-rw-r--r-- | tools/testfiles/h5repack_ext.h5 | bin | 0 -> 1640 bytes |
7 files changed, 98 insertions, 19 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 294e6d9..8752b6a 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -180,7 +180,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 */ @@ -269,18 +268,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 @@ -288,7 +276,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/h5repack_ext.bin b/tools/h5repack/h5repack_ext.bin Binary files differnew file mode 100644 index 0000000..f858094 --- /dev/null +++ b/tools/h5repack/h5repack_ext.bin diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 4ef0d41..a409390 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -61,6 +61,10 @@ #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[] = { "h5repack_big_out", @@ -104,6 +108,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 @@ -154,6 +160,7 @@ int main (void) *------------------------------------------------------------------------- */ + /*------------------------------------------------------------------------- * file with fill values *------------------------------------------------------------------------- @@ -1154,6 +1161,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 @@ -1315,6 +1339,18 @@ 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: @@ -2285,6 +2321,58 @@ 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 diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 2d50382..d9ba4da 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -210,10 +210,13 @@ hsize_t diff_datasetid( hid_t did1, storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); - if (storage_size1<=0 && storage_size2<=0) + if (storage_size1<0 || storage_size2<0) + goto error; + + if (storage_size1==0 || storage_size2==0) { if (options->m_verbose && obj1_name && obj2_name) - printf("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name); + printf("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); cmp=0; options->not_cmp=1; } diff --git a/tools/testfiles/h5diff_70.txt b/tools/testfiles/h5diff_70.txt index dce3717..3e7e37c 100644 --- a/tools/testfiles/h5diff_70.txt +++ b/tools/testfiles/h5diff_70.txt @@ -8,7 +8,7 @@ file1 file2 x x /g1 dataset: </dset> and </dset> -</dset> and </dset> are empty datasets +</dset> or </dset> are empty datasets attribute: <string of </dset>> and <string of </dset>> size: [2] [2] position string of </dset> string of </dset> difference diff --git a/tools/testfiles/h5diff_80.txt b/tools/testfiles/h5diff_80.txt index 12fcab0..dcbda1f 100644 --- a/tools/testfiles/h5diff_80.txt +++ b/tools/testfiles/h5diff_80.txt @@ -294,10 +294,10 @@ position enum enum difference [ 0 ] RED GREEN 1 differences found dataset: </g1/enum2D> and </g1/enum2D> -</g1/enum2D> and </g1/enum2D> are empty datasets +</g1/enum2D> or </g1/enum2D> are empty datasets 0 differences found dataset: </g1/enum3D> and </g1/enum3D> -</g1/enum3D> and </g1/enum3D> are empty datasets +</g1/enum3D> or </g1/enum3D> are empty datasets 0 differences found dataset: </g1/float> and </g1/float> size: [2] [2] diff --git a/tools/testfiles/h5repack_ext.h5 b/tools/testfiles/h5repack_ext.h5 Binary files differnew file mode 100644 index 0000000..da8de7d --- /dev/null +++ b/tools/testfiles/h5repack_ext.h5 |