diff options
-rw-r--r-- | MANIFEST | 3 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 18 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 16 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 90 | ||||
-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.bin | bin | 0 -> 8 bytes | |||
-rw-r--r-- | tools/testfiles/h5repack_ext.h5 | bin | 0 -> 1464 bytes |
9 files changed, 118 insertions, 22 deletions
@@ -1376,7 +1376,8 @@ ./tools/testfiles/h5repack_nbit.h5 ./tools/testfiles/h5repack_soffset.h5 ./tools/testfiles/info.h5repack - +./tools/testfiles/h5repack_ext.bin +./tools/testfiles/h5repack_ext.h5 diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index ee039c7..1e9f108 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -199,6 +199,9 @@ done: * Programmer: Raymond Lu * Tuesday, October 2, 2001 * + * Modifications: pvn, April 02, 2007 + * Reset external file list slots name_offset to a state when created + * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -235,6 +238,21 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) HDmemset(&dst_efl, 0, sizeof(H5O_efl_t)); if(NULL == H5O_msg_copy(H5O_EFL_ID, &src_efl, &dst_efl)) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list") + + /* reset efl name_offset and heap_addr, these are the values when the dataset is created */ + if (dst_efl.slot) + { + unsigned int i; + + dst_efl.heap_addr = HADDR_UNDEF; + for ( i = 0; i < dst_efl.nused; i++) + { + dst_efl.slot[i].name_offset = 0; + } + + } + + if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline") 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 diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 602cce7..2360c70 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -235,10 +235,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) - parallel_print("<%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 063f1d0..9e31e88 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.bin b/tools/testfiles/h5repack_ext.bin Binary files differnew file mode 100644 index 0000000..f858094 --- /dev/null +++ b/tools/testfiles/h5repack_ext.bin diff --git a/tools/testfiles/h5repack_ext.h5 b/tools/testfiles/h5repack_ext.h5 Binary files differnew file mode 100644 index 0000000..1fe88c9 --- /dev/null +++ b/tools/testfiles/h5repack_ext.h5 |