diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 149 | ||||
-rw-r--r-- | test/earray.c | 5 | ||||
-rw-r--r-- | test/links.c | 89 | ||||
-rw-r--r-- | test/swmr_addrem_writer.c | 4 | ||||
-rw-r--r-- | test/swmr_common.c | 23 | ||||
-rw-r--r-- | test/swmr_generator.c | 1 | ||||
-rw-r--r-- | test/swmr_remove_writer.c | 4 | ||||
-rw-r--r-- | test/swmr_sparse_reader.c | 3 | ||||
-rw-r--r-- | test/swmr_sparse_writer.c | 4 | ||||
-rw-r--r-- | test/swmr_writer.c | 4 | ||||
-rw-r--r-- | test/tfile.c | 445 | ||||
-rw-r--r-- | test/use_common.c | 12 |
12 files changed, 473 insertions, 270 deletions
diff --git a/test/dsets.c b/test/dsets.c index 6c6bbcd..092a914 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -8005,7 +8005,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_chunk_fast(hid_t fapl) +test_chunk_fast(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = -1; /* File ID */ @@ -8060,6 +8060,11 @@ test_chunk_fast(hid_t fapl) /* SWMR is only supported on the latest file format */ if(swmr && H5F_LIBVER_LATEST != low) continue; + + /* SWMR is not compatible with multi-file VFDs */ + if(swmr && !(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) + continue; + #ifdef H5_HAVE_FILTER_DEFLATE /* Loop over compressing chunks */ for(compress = FALSE; compress <= TRUE; compress++) { @@ -9765,7 +9770,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_swmr_v1_btree_ci_fail(hid_t fapl) +test_swmr_v1_btree_ci_fail(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = -1; /* File ID */ @@ -9783,78 +9788,86 @@ test_swmr_v1_btree_ci_fail(hid_t fapl) TESTING("expected SWMR behavior using v-1 B-trees"); - h5_fixname(FILENAME[16], fapl, filename, sizeof filename); + /* Can't run this test with multi-file VFDs */ + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + h5_fixname(FILENAME[16], fapl, filename, sizeof filename); + + /* Copy the file access property list */ + if((v1_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR + if((fh_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR + if(H5Pset_libver_bounds(fh_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + + /* Create the test file, then close and reopen. + * + * We'll create the file with the file access property list that + * uses the latest file format so that the group is indexed with a + * fractal heap. If we don't do this, there can be issues when + * opening the file under SWMR since the root group will use a v1 + * B-tree for the symbol table. + * + * The close and re-open is so that new datasets are indexed with + * the old v1 B-tree scheme. + */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fh_fapl)) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, v1_fapl)) < 0) FAIL_STACK_ERROR - /* Copy the file access property list */ - if((v1_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR - if((fh_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR - if(H5Pset_libver_bounds(fh_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - - /* Create the test file, then close and reopen. - * - * We'll create the file with the file access property list that - * uses the latest file format so that the group is indexed with a - * fractal heap. If we don't do this, there can be issues when - * opening the file under SWMR since the root group will use a v1 - * B-tree for the symbol table. - * - * The close and re-open is so that new datasets are indexed with - * the old v1 B-tree scheme. - */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fh_fapl)) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, v1_fapl)) < 0) FAIL_STACK_ERROR + /* Create a dataset that uses v1 B-tree chunk indexing */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + chunk_dims[0] = 64; + if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) FAIL_STACK_ERROR + dims[0] = 1; + max_dims[0] = H5S_UNLIMITED; + if((sid = H5Screate_simple(1, dims, max_dims)) < 0) FAIL_STACK_ERROR + if((did = H5Dcreate2(fid, DSET_DEFAULT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Explicitly check that the dataset is using a v-1 B-tree index */ + if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("created dataset not indexed by version 1 B-tree") + + /* Close the file */ + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Create a dataset that uses v1 B-tree chunk indexing */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - chunk_dims[0] = 64; - if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) FAIL_STACK_ERROR - dims[0] = 1; - max_dims[0] = H5S_UNLIMITED; - if((sid = H5Screate_simple(1, dims, max_dims)) < 0) FAIL_STACK_ERROR - if((did = H5Dcreate2(fid, DSET_DEFAULT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Explicitly check that the dataset is using a v-1 B-tree index */ - if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR - if(idx_type != H5D_CHUNK_IDX_BTREE) - FAIL_PUTS_ERROR("created dataset not indexed by version 1 B-tree") - - /* Close the file */ - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Reopen the file with SWMR write access */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fh_fapl)) < 0) FAIL_STACK_ERROR - /* Reopen the file with SWMR write access */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, v1_fapl)) < 0) FAIL_STACK_ERROR + /* Attempt to write to a dataset that uses v-1 B-tree chunk indexing under + * SWMR semantics. + */ + did = -1; + err = -1; + H5E_BEGIN_TRY { + did = H5Dopen(fid, DSET_DEFAULT_NAME, H5P_DEFAULT); + if(did >= 0) { + err = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data); + } + } H5E_END_TRY; - /* Attempt to write to a dataset that uses v-1 B-tree chunk indexing under - * SWMR semantics. - */ - did = -1; - err = -1; - H5E_BEGIN_TRY { - did = H5Dopen(fid, DSET_DEFAULT_NAME, H5P_DEFAULT); - if(did >= 0) { - err = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data); + /* Fail on successful write */ + if(did >= 0 && err >= 0) { + H5_FAILED(); + puts(" library allowed writing to a version 1 B-tree indexed dataset under SWMR semantics"); + goto error; } - } H5E_END_TRY; - /* Fail on successful write */ - if(did >= 0 && err >= 0) { - H5_FAILED(); - puts(" library allowed writing to a version 1 B-tree indexed dataset under SWMR semantics"); - goto error; - } + /* Close everything */ + if(did >= 0) + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Pclose(v1_fapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(fh_fapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Close everything */ - if(did >= 0) - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - if(H5Pclose(v1_fapl) < 0) FAIL_STACK_ERROR - if(H5Pclose(fh_fapl) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Sclose(sid) < 0) FAIL_STACK_ERROR - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD not compatible with SWMR access"); + } /* end else */ - PASSED(); return 0; error: @@ -11006,7 +11019,7 @@ main(void) fapl = h5_fileaccess(); /* Test that SWMR access fails with version 1 B-tree access */ - nerrors += (test_swmr_v1_btree_ci_fail(fapl) < 0 ? 1 : 0); + nerrors += (test_swmr_v1_btree_ci_fail(envval, fapl) < 0 ? 1 : 0); /* Turn off the chunk cache, so all the chunks are immediately written to disk */ if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) @@ -11093,7 +11106,7 @@ main(void) nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); diff --git a/test/earray.c b/test/earray.c index a0a600b..44abdc2 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2499,6 +2499,11 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ time_t curr_time; /* Current time, for seeding random number generator */ int ExpressMode; /* Test express value */ + const char *env_h5_drvr; /* File Driver value from environment */ + + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; /* Reset library */ h5_reset(); diff --git a/test/links.c b/test/links.c index ae7aaa2..6420204 100644 --- a/test/links.c +++ b/test/links.c @@ -3954,7 +3954,7 @@ external_set_elink_fapl3(hbool_t new_format) *------------------------------------------------------------------------- */ static int -external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) +external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1; char filename1[NAME_BUF_SIZE], @@ -4030,10 +4030,46 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) /* Close file1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Reopen file1, with read-write and SWMR-write access */ - /* Only supported under the latest file format */ - if(new_format) { - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR + /* Can't run this test with multi-file VFDs */ + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + /* Reopen file1, with read-write and SWMR-write access */ + /* Only supported under the latest file format */ + if(new_format) { + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using default gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != H5F_ACC_RDWR) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + } + + /* Reopen file1, with read-only and SWMR-read access */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR /* Open a group through the external link using default gapl */ if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -4041,14 +4077,14 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) /* Verify that the correct parameters have been set on file2 */ if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR + if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR /* Close file2 and group */ if(H5Gclose(group) < 0) FAIL_STACK_ERROR if(H5Fclose(file2) < 0) FAIL_STACK_ERROR /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR /* Open a group through the external link using gapl */ if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR @@ -4056,7 +4092,7 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) /* Verify that the correct parameters have been set on file2 */ if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDWR) TEST_ERROR + if(flags != H5F_ACC_RDONLY) TEST_ERROR /* Close file2 and group */ if(H5Gclose(group) < 0) FAIL_STACK_ERROR @@ -4064,40 +4100,7 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) /* Close file1 */ if(H5Fclose(file1) < 0) TEST_ERROR - } - - /* Reopen file1, with read-only and SWMR-read access */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using default gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDONLY) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + } /* end if */ /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ @@ -14634,7 +14637,7 @@ main(void) /* This test cannot run with the EFC because the EFC cannot currently * reopen a cached file with a different intent */ - nerrors += external_set_elink_acc_flags(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; /* Try external link tests both with and without the external file cache */ diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index b2cee81..c15854c 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -88,6 +88,10 @@ open_skeleton(const char *filename, unsigned verbose) if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+
#ifdef QAK
/* Increase the initial size of the metadata cache */
{
diff --git a/test/swmr_common.c b/test/swmr_common.c index 651e88e..6cbd5e2 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -257,17 +257,19 @@ shutdown_symbols(void) int print_metadata_retries_info(hid_t fid) { - H5F_retries_info_t info; - unsigned power; - unsigned i, j; + H5F_retry_info_t info; + unsigned i; /* Retrieve the collection of retries */ - if(H5Fget_metadata_read_retries_info(fid, &info) < 0) + if(H5Fget_metadata_read_retry_info(fid, &info) < 0) return (-1); /* Print information for each non-NULL retries[i] */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { - if(info.retries[i] == NULL) + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { + unsigned power; + unsigned j; + + if(NULL == info.retries[i]) continue; fprintf(stderr, "Metadata read retries for item %u:\n", i); @@ -277,13 +279,14 @@ print_metadata_retries_info(hid_t fid) fprintf(stderr, "\t# of retries for %u - %u retries: %u\n", power, (power * 10) - 1, info.retries[i][j]); power *= 10; - } - } + } /* end for */ + } /* end for */ /* Free memory for each non-NULL retries[i] */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) if(info.retries[i] != NULL) free(info.retries[i]); - } + return 0; } /* print_metadata_retries_info() */ + diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 6946184..f556c3d 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -335,7 +335,6 @@ int main(int argc, const char *argv[]) gettimeofday(&t, NULL); random_seed = (unsigned)((t.tv_sec * 1000) + t.tv_usec); } /* end if */ - /* random_seed = 125092666; */ srandom(random_seed); /* ALWAYS emit the random seed for possible debugging */ fprintf(stderr, "Using generator random seed (used in sparse test only): %u\n", random_seed); diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index 0116467..ac32509 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -88,6 +88,10 @@ open_skeleton(const char *filename, unsigned verbose) if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+
#ifdef QAK
/* Increase the initial size of the metadata cache */
{
diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index 9cccef1..1678949 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -308,11 +308,10 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, } /* end if */
} /* end while */
-
/* Retrieve and print the collection of metadata read retries */
if(print_metadata_retries_info(fid) < 0)
fprintf(stderr, "Warning: could not obtain metadata retries info\n");
-
+
/* Close file */
if(H5Fclose(fid) < 0)
return -1;
diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index dda9c98..d30c86d 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -84,6 +84,10 @@ open_skeleton(const char *filename, unsigned verbose) if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+
#ifdef QAK
/* Increase the initial size of the metadata cache */
{
diff --git a/test/swmr_writer.c b/test/swmr_writer.c index 362e197..0aec265 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -76,6 +76,10 @@ open_skeleton(const char *filename, unsigned verbose) if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) return -1; + /* Set to use the latest library format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + return -1; + #ifdef QAK /* Increase the initial size of the metadata cache */ { diff --git a/test/tfile.c b/test/tfile.c index f22586d..11e0a72 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -26,8 +26,8 @@ #include "H5srcdir.h" #include "H5Bprivate.h" -#include "H5Pprivate.h" #include "H5Iprivate.h" +#include "H5Pprivate.h" /* * This file needs to access private information from the H5F package. @@ -3517,7 +3517,7 @@ test_swmr_write(void) /* Output message about test being performed */ MESSAGE(5, ("Testing H5F_ACC_SWMR_WRITE access flag\n")); - /* Create a copy of the file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -3545,6 +3545,13 @@ test_swmr_write(void) CHECK(ret, FAIL, "H5Fclose"); + /* Attempt to open file, with SWMR_WRITE flag but not latest format */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE1, (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE), H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen"); + + /* Create file, with SWMR_WRITE flag */ fid = H5Fcreate(FILE1, (H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); @@ -3621,6 +3628,25 @@ test_swmr_write(void) ret = H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); + + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set a non-POSIX VFD */ + ret = H5Pset_fapl_stdio(fapl); + CHECK(ret, FAIL, "H5Pset_fapl_stdio"); + + /* Try to reopen file w/SWMR_WRITE flag & non-POSIX VFD */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE1, (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE), fapl); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen"); + + /* Close the property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_swmr_write() */ /**************************************************************** @@ -3634,6 +3660,7 @@ static void test_swmr_read(void) { hid_t fid, fid2; /* File IDs */ + hid_t fapl; /* File access property list id */ unsigned intent; /* File access flags */ herr_t ret; /* Generic return value */ @@ -3675,7 +3702,13 @@ test_swmr_read(void) VERIFY(fid, FAIL, "H5Fopen"); - /* Open file, with SWMR_READ flag */ + /* Attempt to open file, with SWMR_WRITE flag but not latest format */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE1, (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE), H5P_DEFAULT); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen"); + + /* Open file, with SWMR_READ flag (and non-latest format) */ fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -3706,6 +3739,26 @@ test_swmr_read(void) /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); + + + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set a non-POSIX VFD */ + ret = H5Pset_fapl_stdio(fapl); + CHECK(ret, FAIL, "H5Pset_fapl_stdio"); + + /* Try to reopen file w/SWMR_READ flag & non-POSIX VFD */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); + } H5E_END_TRY; + VERIFY(fid, FAIL, "H5Fopen"); + + /* Close the property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end test_swmr_read() */ /**************************************************************** @@ -3732,10 +3785,10 @@ test_metadata_read_attempts(void) /* * Set A: * Tests on verifying the # of read attempts when: - * --setting/getting read attemps from a copy of the + * --setting/getting read attempts from a * file access property list. */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -3808,10 +3861,22 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 2 */ - /* Open the file with SWMR access and default fapl */ - fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), H5P_DEFAULT); + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Open the file with SWMR access and default read attempts */ + fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3830,10 +3895,14 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 3 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Set the # of read attempts */ ret = H5Pset_metadata_read_attempts(fapl, 9); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); @@ -3842,6 +3911,10 @@ test_metadata_read_attempts(void) fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3860,10 +3933,14 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 4 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Set the # of read attempts */ ret = H5Pset_metadata_read_attempts(fapl, 1); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); @@ -3872,6 +3949,10 @@ test_metadata_read_attempts(void) fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3890,14 +3971,22 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 5 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - /* Open the file with SWMR_READ and fapl (non-default but unset) */ + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Open the file with SWMR_READ and fapl (non-default read attempts but unset) */ fid = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3923,10 +4012,22 @@ test_metadata_read_attempts(void) * --using default or non-default file access property list */ /* Test 1 */ - /* Create a file with non-SWMR access and default fapl */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT); + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create a file with non-SWMR access and default read attempts */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3967,7 +4068,7 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 3 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -3975,10 +4076,14 @@ test_metadata_read_attempts(void) ret = H5Pset_metadata_read_attempts(fapl, 9); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); - /* Open the file with SWMR access and fapl (non-default & set to 9) */ + /* Open the file with non-SWMR access and fapl (non-default & set to 9) */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -3997,7 +4102,7 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 4 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -4005,10 +4110,14 @@ test_metadata_read_attempts(void) ret = H5Pset_metadata_read_attempts(fapl, 1); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); - /* Open the file with SWMR access and fapl (non-default & set to 1) */ + /* Open the file with non-SWMR access and fapl (non-default & set to 1) */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -4027,14 +4136,18 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); /* Test 5 */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - /* Open the file with SWMR_READ and fapl (non-default but unset) */ + /* Open the file with non-SWMR_READ and fapl (non-default but unset) */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Pget_access_plist"); @@ -4053,10 +4166,14 @@ test_metadata_read_attempts(void) CHECK(ret, FAIL, "H5Pclose"); - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Set the # of read attempts */ ret = H5Pset_metadata_read_attempts(fapl, 9); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); @@ -4065,11 +4182,15 @@ test_metadata_read_attempts(void) fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Open file again with SWMR access and default fapl */ + /* Open file again with non-SWMR access and default fapl */ fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -4090,10 +4211,22 @@ test_metadata_read_attempts(void) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Open file again with SWMR access and default fapl */ - fid = H5Fopen(FILE1, H5F_ACC_SWMR_READ, H5P_DEFAULT); + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Open file again with SWMR access and default read attempts */ + fid = H5Fopen(FILE1, H5F_ACC_SWMR_READ, fapl); CHECK(fid, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Get file's fapl */ file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); @@ -4127,14 +4260,18 @@ test_metadata_read_attempts(void) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Open file again with SWMR access and default fapl */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, H5P_DEFAULT); - CHECK(fid1, FAIL, "H5Fopen"); - - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Open file again with SWMR access and default read attempts */ + fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl); + CHECK(fid1, FAIL, "H5Fopen"); + /* Set the # of read attempts */ ret = H5Pset_metadata_read_attempts(fapl, 9); CHECK(ret, FAIL, "H5Pset_metadata_read_attempts"); @@ -4143,6 +4280,10 @@ test_metadata_read_attempts(void) fid2 = H5Fopen(FILE1, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl); CHECK(fid2, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Re-open fid1 */ fid = H5Freopen(fid1); CHECK(fid, FAIL, "H5Freopen"); @@ -4154,7 +4295,7 @@ test_metadata_read_attempts(void) /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */ ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); - VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Fget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4172,10 +4313,10 @@ test_metadata_read_attempts(void) file_fapl = H5Fget_access_plist(fid); CHECK(file_fapl, FAIL, "H5Fget_access_plist"); - /* Retrieve the # of read attempts from file fapl -- should be 9 */ + /* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS, not 9 */ ret = H5Pget_metadata_read_attempts(file_fapl, &attempts); CHECK(ret, FAIL, "H5Pget_metadata_read_attempts"); - VERIFY(attempts, 9, "H5Pget_metadata_read_attempts"); + VERIFY(attempts, H5F_SWMR_METADATA_READ_ATTEMPTS, "H5Pget_metadata_read_attempts"); /* Close the file's fapl */ ret = H5Pclose(file_fapl); @@ -4199,10 +4340,22 @@ test_metadata_read_attempts(void) * --H5reopen the files */ + /* Create a file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set to use latest library format */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -4211,7 +4364,7 @@ test_metadata_read_attempts(void) fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid2, FAIL, "H5Fopen"); - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -4223,6 +4376,10 @@ test_metadata_read_attempts(void) fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); + /* Close fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Re-open fid1 */ fid = H5Freopen(fid1); CHECK(fid, FAIL, "H5Freopen"); @@ -4274,17 +4431,17 @@ test_metadata_read_attempts(void) /**************************************************************** ** -** test_metadata_read_retries_info(): -** This test checks whether the public routine H5Fget_metadata_read_retries_info +** test_metadata_read_retry_info(): +** This test checks whether the public routine H5Fget_metadata_read_retry_info ** works as specified in the reference manual. ** *****************************************************************/ static void -test_metadata_read_retries_info(void) +test_metadata_read_retry_info(void) { hid_t fapl, new_fapl; /* File access property list */ hid_t fid, fid1; /* File IDs */ - H5F_retries_info_t info, info1; /* The collection of metadata retries */ + H5F_retry_info_t info, info1; /* The collection of metadata retries */ H5F_t *f = NULL, *f1 = NULL; /* Internal file object pointers */ unsigned i, j, n; /* Local index variables */ herr_t ret; /* Generic return value */ @@ -4299,12 +4456,12 @@ test_metadata_read_retries_info(void) /* Output message about test being performed */ - MESSAGE(5, ("Testing H5Fget_metadata_read_retries_info()\n")); + MESSAGE(5, ("Testing H5Fget_metadata_read_retry_info()\n")); /* * Set up file for testing */ - /* Create a copy of file access property list */ + /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); @@ -4374,15 +4531,15 @@ test_metadata_read_retries_info(void) CHECK(ret, FAIL, "H5Dopen"); /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 0 */ - VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Dclose(did1); @@ -4402,15 +4559,15 @@ test_metadata_read_retries_info(void) CHECK(fid, FAIL, "H5Fopen"); /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 2 */ - VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Fclose(fid); @@ -4430,16 +4587,16 @@ test_metadata_read_retries_info(void) fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); CHECK(fid, FAIL, "H5Fopen"); - /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + /* Retrieve retry information */ + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 1 */ - VERIFY(info.nbins, 1, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 1, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Pclose(new_fapl); @@ -4460,16 +4617,16 @@ test_metadata_read_retries_info(void) fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); CHECK(fid, FAIL, "H5Fopen"); - /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + /* Retrieve retry information */ + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 3 */ - VERIFY(info.nbins, 3, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 3, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Pclose(new_fapl); @@ -4492,16 +4649,16 @@ test_metadata_read_retries_info(void) fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); CHECK(fid, FAIL, "H5Fopen"); - /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + /* Retrieve retry information */ + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 4 */ - VERIFY(info.nbins, 4, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 4, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Pclose(new_fapl); @@ -4524,16 +4681,16 @@ test_metadata_read_retries_info(void) fid = H5Fopen(FILE1, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl); CHECK(fid, FAIL, "H5Fopen"); - /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + /* Retrieve retry information */ + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 0 */ - VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Closing */ ret=H5Pclose(new_fapl); @@ -4542,7 +4699,6 @@ test_metadata_read_retries_info(void) CHECK(ret, FAIL, "H5Fclose"); - /* * Case 2: tests on retries info */ @@ -4567,16 +4723,16 @@ test_metadata_read_retries_info(void) ret = H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2); CHECK(ret, FAIL, "H5Dread"); - /* Retrieve retries information */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + /* Retrieve retry information */ + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 2 */ - VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); /* Get a pointer to the internal file object */ f = (H5F_t *)H5I_object(fid); @@ -4606,23 +4762,23 @@ test_metadata_read_retries_info(void) CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); /* Retrieve the collection of metadata read retries */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Verify retries for v2 B-tree leaf node */ - VERIFY(info.retries[4][0], 0, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[4][1], 500, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[4][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[4][1], 500, "H5Fget_metadata_read_retry_info"); /* Verify retries for extensive array data block */ - VERIFY(info.retries[15][0], 0, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[15][1], 1000, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[15][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[15][1], 1000, "H5Fget_metadata_read_retry_info"); /* Verify retries for file's superblock */ - VERIFY(info.retries[20][0], 1, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[20][1], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[20][0], 1, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[20][1], 0, "H5Fget_metadata_read_retry_info"); /* Free memory for info.retries */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { if(info.retries[i] != NULL) HDfree(info.retries[i]); } @@ -4655,50 +4811,49 @@ test_metadata_read_retries_info(void) CHECK(ret, FAIL, "H5F_track_metadata_read_retries"); /* Retrieve the collection of metadata read retries */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* * Verify info has both previous + current retries information: */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { switch(i) { case 0: /* Object header */ - VERIFY(info.retries[i][0], 5, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 5, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retry_info"); break; case 4: /* v2 B-tree leaf node */ - VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 500, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 500, "H5Fget_metadata_read_retry_info"); break; case 15: /* Extensive array data block */ - VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 1000, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 1000, "H5Fget_metadata_read_retry_info"); break; case 17: /* Fixed array header */ - VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 10000, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 10000, "H5Fget_metadata_read_retry_info"); break; case 20: /* File's superblock */ - VERIFY(info.retries[i][0], 2, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 2, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retry_info"); break; default: - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); break; } } /* Free memory for info.retries */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) if(info.retries[i] != NULL) HDfree(info.retries[i]); - } /* Closing */ ret=H5Dclose(did1); @@ -4726,32 +4881,31 @@ test_metadata_read_retries_info(void) H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1); /* Retrieve the collection of metadata read retries */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 3 */ - VERIFY(info.nbins, 3, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 3, "H5Fget_metadata_read_retry_info"); /* Verify retries info */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { switch(i) { case 20: /* File's superblock */ - VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[i][2], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i][0], 1, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][1], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[i][2], 0, "H5Fget_metadata_read_retry_info"); break; default: - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); break; } } /* Free memory */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) if(info.retries[i] != NULL) HDfree(info.retries[i]); - } /* Closing */ ret=H5Pclose(new_fapl); @@ -4780,21 +4934,21 @@ test_metadata_read_retries_info(void) CHECK(fid, FAIL, "H5Freopen"); /* Retrieve retries information for fid */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Retrieve retries information for fid1*/ - ret = H5Fget_metadata_read_retries_info(fid1, &info1); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid1, &info1); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Should be 0 */ - VERIFY(info.nbins, 0, "H5Fget_metadata_read_retries"); - VERIFY(info1.nbins, 0, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info1.nbins, 0, "H5Fget_metadata_read_retry_info"); /* Should be all NULL */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { - VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retries"); - VERIFY(info1.retries[i], NULL, "H5Fget_metadata_read_retries"); + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { + VERIFY(info.retries[i], NULL, "H5Fget_metadata_read_retry_info"); + VERIFY(info1.retries[i], NULL, "H5Fget_metadata_read_retry_info"); } /* Closing */ @@ -4838,40 +4992,42 @@ test_metadata_read_retries_info(void) } /* Retrieve the collection of metadata read retries for fid */ - ret = H5Fget_metadata_read_retries_info(fid, &info); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid, &info); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Retrieve the collection of metadata read retries for fid1 */ - ret = H5Fget_metadata_read_retries_info(fid1, &info1); - CHECK(ret, FAIL, "H5Fget_metadata_read_retries_info"); + ret = H5Fget_metadata_read_retry_info(fid1, &info1); + CHECK(ret, FAIL, "H5Fget_metadata_read_retry_info"); /* Verify nbins for fid & fid1: should be 2 */ - VERIFY(info.nbins, 2, "H5Fget_metadata_read_retries"); - VERIFY(info1.nbins, 2, "H5Fget_metadata_read_retries"); + VERIFY(info.nbins, 2, "H5Fget_metadata_read_retry_info"); + VERIFY(info1.nbins, 2, "H5Fget_metadata_read_retry_info"); /* Verify retries for fid: fixed array data block page */ - VERIFY(info.retries[19][0], 500, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[19][1], 0, "H5Fget_metadata_read_retries"); + VERIFY(info.retries[19][0], 500, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[19][1], 0, "H5Fget_metadata_read_retry_info"); - /* Verify retries for fid: free-space sections should be NULL */ - VERIFY(info.retries[9], NULL, "H5Fget_metadata_read_retries"); - VERIFY(info.retries[9], NULL, "H5Fget_metadata_read_retries"); + /* Verify retries for fid: free-space sections */ + /* (Since file was re-opened) */ + VERIFY(info.retries[9][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info.retries[9][1], 1000, "H5Fget_metadata_read_retry_info"); /* Verify retries for fid1: free-space sections */ - VERIFY(info1.retries[9][0], 0, "H5Fget_metadata_read_retries"); - VERIFY(info1.retries[9][1], 1000, "H5Fget_metadata_read_retries"); + VERIFY(info1.retries[9][0], 0, "H5Fget_metadata_read_retry_info"); + VERIFY(info1.retries[9][1], 1000, "H5Fget_metadata_read_retry_info"); - /* Verify retries for fid1: fixed array data block page should be NULL */ - VERIFY(info1.retries[19], NULL, "H5Fget_metadata_read_retries"); - VERIFY(info1.retries[19], NULL, "H5Fget_metadata_read_retries"); + /* Verify retries for fid1: fixed array data block page */ + /* (Since file was re-opened) */ + VERIFY(info1.retries[19][0], 500, "H5Fget_metadata_read_retry_info"); + VERIFY(info1.retries[19][1], 0, "H5Fget_metadata_read_retry_info"); /* Free memory for info.retries and info1.retries */ - for(i = 0; i < NUM_METADATA_READ_RETRIES; i++) { + for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) { if(info.retries[i] != NULL) HDfree(info.retries[i]); if(info1.retries[i] != NULL) HDfree(info1.retries[i]); - } + } /* end for */ /* Closing */ ret=H5Fclose(fid); @@ -4881,8 +5037,7 @@ test_metadata_read_retries_info(void) ret=H5Pclose(fapl); CHECK(ret, FAIL, "H5Pclose"); - -} /* end test_metadata_read_retries_info() */ +} /* end test_metadata_read_retry_info() */ /**************************************************************** ** @@ -5069,7 +5224,7 @@ test_file(void) test_swmr_write(); /* Tests for SWMR write access flag */ test_swmr_read(); /* Tests for SWMR read access flag */ test_metadata_read_attempts(); /* Tests for public routines H5Fget/set_metadata_read_attempts() */ - test_metadata_read_retries_info(); /* Tests for public routine H5Fget_metadata_read_retries_info() */ + test_metadata_read_retry_info(); /* Tests for public routine H5Fget_metadata_read_retry_info() */ #ifndef H5_NO_DEPRECATED_SYMBOLS test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/use_common.c b/test/use_common.c index 36d804c..c25f1f4 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -245,6 +245,7 @@ int write_uc_file(void) { hid_t fid; /* File ID for new HDF5 file */ hid_t dsid; /* dataset ID */ + hid_t fapl; /* File access property list */ hid_t dcpl; /* Dataset creation property list */ char *name; UC_CTYPE *buffer, *bufptr; /* data buffer */ @@ -261,7 +262,12 @@ int write_uc_file(void) name = UC_opts.filename; /* Open the file */ - if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), H5P_DEFAULT)) < 0){ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return -1; + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + return -1; + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){ fprintf(stderr, "H5Fopen failed\n"); return -1; } @@ -395,6 +401,10 @@ int write_uc_file(void) fprintf(stderr, "Failed to close file space\n"); return -1; } + if (H5Pclose(fapl) < 0){ + fprintf(stderr, "Failed to property list\n"); + return -1; + } if (H5Fclose(fid) < 0){ fprintf(stderr, "Failed to close file id\n"); return -1; |