summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-10-25 04:52:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-10-25 04:52:47 (GMT)
commit0df6e44a6e68da1614cf80b50ed7b208edaa5df7 (patch)
treef734083b478d38e09b0aecb8e8f3db838cf0b785 /test
parent1e8ef703cdc057211b3587be776a6e9f62e8f76f (diff)
downloadhdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.zip
hdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.tar.gz
hdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.tar.bz2
Squashed commit of private branch changes to support stackable VOL plugins.
modified: test/dsets.c
Diffstat (limited to 'test')
-rw-r--r--test/dsets.c15
-rw-r--r--test/dtypes.c16
-rw-r--r--test/file_image.c3
-rw-r--r--test/objcopy.c12
-rw-r--r--test/ohdr.c2
-rw-r--r--test/testfiles/error_test_12
-rw-r--r--test/tfile.c5
-rw-r--r--test/tmisc.c2
-rw-r--r--test/vol.c54
9 files changed, 78 insertions, 33 deletions
diff --git a/test/dsets.c b/test/dsets.c
index 050bd8f..5cd376a 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -826,7 +826,7 @@ test_compact_io(hid_t fapl)
**************************************/
/* Create a copy of file access property list */
- if((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+ if((new_fapl = new_fapl = h5_fileaccess()) < 0) TEST_ERROR
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations.
@@ -1334,6 +1334,19 @@ test_conv_buffer(hid_t fid)
return 0;
error:
+ H5E_BEGIN_TRY {
+ H5Pclose(xfer_list);
+ H5Sclose(space);
+ H5Tclose(arr_type1);
+ H5Tclose(arr_type2);
+ H5Tclose(arr_type3);
+ H5Tclose(ctype1);
+ H5Tclose(ctype2);
+ H5Tclose(arr_type4);
+ H5Tclose(arr_type5);
+ H5Dclose(dataset);
+ } H5E_END_TRY;
+
return -1;
}
diff --git a/test/dtypes.c b/test/dtypes.c
index 3253d6c..7e5a992 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -6957,13 +6957,13 @@ test_delete_obj_named_fileid(hid_t fapl)
/* Verify file ID from dataset matches correct file */
dset_fid = H5Iget_file_id(dset);
- if(dset_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR
H5Fclose(dset_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
type = H5Dget_type(dset);
type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
@@ -6979,13 +6979,13 @@ test_delete_obj_named_fileid(hid_t fapl)
/* Verify file ID from dataset matches correct file */
dset_fid = H5Iget_file_id(dset);
- if(dset_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(dset_fid, filea1)) TEST_ERROR
H5Fclose(dset_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
type = H5Dget_type(dset);
type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
@@ -7007,13 +7007,13 @@ test_delete_obj_named_fileid(hid_t fapl)
/* Verify file ID from dataset matches correct file */
attr_fid = H5Iget_file_id(attr);
- if(attr_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR
H5Fclose(attr_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
type = H5Aget_type(attr);
type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
@@ -7029,13 +7029,13 @@ test_delete_obj_named_fileid(hid_t fapl)
/* Verify file ID from dataset matches correct file */
attr_fid = H5Iget_file_id(attr);
- if(attr_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(attr_fid, filea1)) TEST_ERROR
H5Fclose(attr_fid);
/* Verify file ID from datatype (from dataset) matches correct file */
type = H5Aget_type(attr);
type_fid = H5Iget_file_id(type);
- if(type_fid != filea1) TEST_ERROR
+ if(!H5F__same_file_test(type_fid, filea1)) TEST_ERROR
H5Fclose(type_fid);
H5Tclose(type);
diff --git a/test/file_image.c b/test/file_image.c
index 12f0a18..0dba236 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -579,7 +579,8 @@ test_core(void)
reset_udata(udata);
file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl);
VERIFY(file >= 0, "H5Fopen failed");
- VERIFY(udata->used_callbacks == MALLOC, "opening a core file used the wrong callbacks");
+ VERIFY((udata->used_callbacks == MALLOC) ||
+ (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks");
VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open");
/* Close file */
diff --git a/test/objcopy.c b/test/objcopy.c
index f13537e..6ee2f72 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -2151,7 +2151,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
buf[i][j] = 10000 + 100*i+j;
/* Create a file access property list for destination file */
- if ((fapl_dst = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+ if ((fapl_dst = h5_fileaccess()) < 0) TEST_ERROR
/* Initialize the filenames */
h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname);
@@ -7854,6 +7854,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
{
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t src_fapl = -1; /* Source file FAPL ID */
const char *src_filename = H5_get_srcdir_filename(FILE_OLD_LAYOUT); /* Corrected test file name */
char dst_filename[NAME_BUF_SIZE];
@@ -7869,8 +7870,14 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
/* Reset file address checking info */
addr_reset();
+ /* Setup */
+ if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR
+
/* open source file (read-only) */
- if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+
+ /* Close source FAPL */
+ if(H5Pclose(src_fapl) < 0) TEST_ERROR
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
@@ -7914,6 +7921,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
error:
H5E_BEGIN_TRY {
+ H5Pclose(src_fapl);
H5Dclose(did2);
H5Dclose(did);
H5Fclose(fid_dst);
diff --git a/test/ohdr.c b/test/ohdr.c
index 2b57ada..cca7e7e 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -486,7 +486,7 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
FAIL_STACK_ERROR
/* Open FILE_BOGUS */
- if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Set up location ID depending on bogus_id */
diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1
index 473c53e..7838c9c 100644
--- a/test/testfiles/error_test_1
+++ b/test/testfiles/error_test_1
@@ -44,7 +44,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#001: (file name) line (number) in H5VL_dataset_read(): read failed
major: Virtual Object Layer
minor: Read failed
- #002: (file name) line (number) in H5VL_native_dataset_read(): can't read data
+ #002: (file name) line (number) in H5VL__native_dataset_read(): can't read data
major: Dataset
minor: Read failed
#003: (file name) line (number) in H5D__read(): can't read data
diff --git a/test/tfile.c b/test/tfile.c
index 12a0eca..f7ac243 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -4165,10 +4165,7 @@ test_file_freespace(const char *env_h5_drvr)
/* Check that there is the right amount of free space in the file */
free_space = H5Fget_freespace(file);
CHECK(free_space, FAIL, "H5Fget_freespace");
- if(new_format)
- VERIFY(free_space, expected_fs_del, "H5Fget_freespace");
- else
- VERIFY(free_space, expected_fs_del, "H5Fget_freespace");
+ VERIFY(free_space, expected_fs_del, "H5Fget_freespace");
/* Close file */
ret = H5Fclose(file);
diff --git a/test/tmisc.c b/test/tmisc.c
index 9eed5db..c7fb4a9 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -3488,7 +3488,7 @@ test_misc19(void)
CHECK(vol_cls, NULL, "h5_get_dummy_vol_class");
/* Register a virtual object driver */
- volid = H5VLregister(vol_cls);
+ volid = H5VLregister(vol_cls, H5P_DEFAULT);
CHECK(volid, FAIL, "H5VLregister");
/* Check the reference count */
diff --git a/test/vol.c b/test/vol.c
index 3152a93..0de7d88 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -43,11 +43,17 @@ static const H5VL_class_t fake_vol_g = {
0, /* version */
(H5VL_class_value_t)999, /* value */
FAKE_VOL_NAME, /* name */
+ 0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
- (size_t)0, /* fapl size */
- NULL, /* fapl copy */
- NULL, /* fapl free */
+ (size_t)0, /* info size */
+ NULL, /* info copy */
+ NULL, /* info compare */
+ NULL, /* info free */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* free_wrap_ctx */
+ NULL, /* wrap_object */
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */
@@ -120,7 +126,7 @@ static const H5VL_class_t fake_vol_g = {
* Function: test_vol_registration()
*
* Purpose: Tests if we can load, register, and close a simple
- * VOL driver.
+ * VOL plugin.
*
* Return: SUCCEED/FAIL
*
@@ -130,28 +136,48 @@ static herr_t
test_vol_registration(void)
{
htri_t is_registered;
- hid_t vol_id = -1;
+ hid_t vol_id = -1, vol_id2 = -1;
TESTING("VOL registration");
- /* The test/fake VOL driver should not be registered at the start of the test */
+ /* The test/fake VOL plugin should not be registered at the start of the test */
if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (is_registered > 0)
- FAIL_PUTS_ERROR("native VOL driver is inappropriately registered");
+ FAIL_PUTS_ERROR("native VOL plugin is inappropriately registered");
- /* Load a VOL interface */
- if ((vol_id = H5VLregister(&fake_vol_g)) < 0)
+ /* Register a VOL plugin */
+ if ((vol_id = H5VLregister(&fake_vol_g, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- /* The test/fake VOL driver should be registered now */
+ /* The test/fake VOL plugin should be registered now */
if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0)
FAIL_STACK_ERROR;
if (0 == is_registered)
- FAIL_PUTS_ERROR("native VOL driver is un-registered");
+ FAIL_PUTS_ERROR("native VOL plugin is un-registered");
+
+ /* Re-register a VOL plugin */
+ if ((vol_id2 = H5VLregister(&fake_vol_g, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* The test/fake VOL plugin should still be registered now */
+ if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0)
+ FAIL_STACK_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("native VOL plugin is un-registered");
+
+ /* Unregister the second test/fake VOL ID */
+ if (H5VLunregister(vol_id2) < 0)
+ FAIL_STACK_ERROR;
+
+ /* The test/fake VOL plugin should still be registered now */
+ if ((is_registered = H5VLis_registered(FAKE_VOL_NAME)) < 0)
+ FAIL_STACK_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("native VOL plugin is un-registered");
- /* Close the VOL interface */
- if (H5VLclose(vol_id) < 0)
+ /* Unregister the original test/fake VOL ID */
+ if (H5VLunregister(vol_id) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -159,7 +185,7 @@ test_vol_registration(void)
error:
H5E_BEGIN_TRY {
- H5VLclose(vol_id);
+ H5VLunregister(vol_id);
} H5E_END_TRY;
return FAIL;