From 49076d6d229abdf59cccac47a86431c977a60037 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Wed, 22 Jul 2015 16:41:18 -0500 Subject: [svn-r27425] Implement support for H5Pequal with VDS properties. Testing for H5Pequal with VDS. Tested: ummon --- src/H5Pdcpl.c | 43 ++++++++++++++++++++++++++++++++++++++++++- test/vds.c | 12 ++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 29976c2..bc32274 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -825,7 +825,48 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ break; case H5D_VIRTUAL: - HDassert(0 && "Not yet implemented...");//VDSINC + { + htri_t equal; + int strcmp_ret; + size_t u; /* Local index variable */ + + /* Compare number of mappings */ + if(layout1->storage.u.virt.list_nused < layout2->storage.u.virt.list_nused) HGOTO_DONE(-1) + if(layout1->storage.u.virt.list_nused > layout2->storage.u.virt.list_nused) HGOTO_DONE(1) + + /* Iterate over mappings */ + for(u = 0; u < layout1->storage.u.virt.list_nused; u++) { + /* Compare virtual spaces. Note we cannot tell which is + * "greater", so just return 1 if different, -1 on failure. + */ + if((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) HGOTO_DONE(-1) + if(!equal) + HGOTO_DONE(1) + if((equal = H5S_select_shape_same(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) HGOTO_DONE(-1) + if(!equal) + HGOTO_DONE(1) + + /* Compare source file names */ + strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_file_name, layout2->storage.u.virt.list[u].source_file_name); + if(strcmp_ret < 0) HGOTO_DONE(-1) + if(strcmp_ret > 0) HGOTO_DONE(1) + + /* Compare source dataset names */ + strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_dset_name, layout2->storage.u.virt.list[u].source_dset_name); + if(strcmp_ret < 0) HGOTO_DONE(-1) + if(strcmp_ret > 0) HGOTO_DONE(1) + + /* Compare source spaces. Note we cannot tell which is + * "greater", so just return 1 if different, -1 on failure. + */ + if((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) HGOTO_DONE(-1) + if(!equal) + HGOTO_DONE(1) + if((equal = H5S_select_shape_same(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) HGOTO_DONE(-1) + if(!equal) + HGOTO_DONE(1) + } /* end for */ + } /* end block */ break; case H5D_LAYOUT_ERROR: diff --git a/test/vds.c b/test/vds.c index 573af9e..04c0e5f 100644 --- a/test/vds.c +++ b/test/vds.c @@ -332,6 +332,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, hid_t file = -1; /* File */ hid_t dset = -1; /* Virtual dataset */ void *plist_buf = NULL; /* Serialized property list buffer */ + htri_t tri_ret; HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS)); HDassert(fapl >= 0); @@ -414,6 +415,17 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, *ex_dcpl = dcpl; } /* end else */ + /* Verify examination DCPL is equal to original DCPL. Do not compare the + * plist to itselt, and do not do the comparison if we reopened the file, + * because in that case the extent of the source dset will not be corrent. + */ + if((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) { + if((tri_ret = H5Pequal(dcpl, *ex_dcpl)) < 0) + TEST_ERROR + if(!tri_ret) + TEST_ERROR + } /* end if */ + return 0; error: -- cgit v0.12