mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-01 16:28:09 +08:00
[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
This commit is contained in:
parent
26fdccf6cd
commit
104e1cd848
3
MANIFEST
3
MANIFEST
@ -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
|
||||
|
||||
|
||||
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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 */
|
||||
@ -304,17 +303,6 @@ 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;
|
||||
|
@ -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:
|
||||
@ -2660,6 +2692,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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
BIN
tools/testfiles/h5repack_ext.bin
Normal file
BIN
tools/testfiles/h5repack_ext.bin
Normal file
Binary file not shown.
BIN
tools/testfiles/h5repack_ext.h5
Normal file
BIN
tools/testfiles/h5repack_ext.h5
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user