diff --git a/HDF5Examples/C/H5G/h5ex_g_compact.c b/HDF5Examples/C/H5G/h5ex_g_compact.c index 35cd6df885b..104242bc318 100644 --- a/HDF5Examples/C/H5G/h5ex_g_compact.c +++ b/HDF5Examples/C/H5G/h5ex_g_compact.c @@ -28,10 +28,17 @@ main(void) H5G_info_t ginfo; hsize_t size; + /* + * Set file access property list to use the earliest file format. + * This will force the library to create original format groups. + */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + status = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + /* * Create file 1. This file will use original format groups. */ - file = H5Fcreate(FILENAME1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILENAME1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); group = H5Gcreate(file, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* @@ -72,16 +79,16 @@ main(void) status = H5Fclose(file); /* - * Set file access property list to allow the latest file format. - * This will allow the library to create new compact format groups. + * Now use the default file access property list to allow the latest file + * format. This will allow the library to create new compact format groups. + * Since HDF5 2.0, the default is to use the 1.8 file format as the low + * bound, which includes compact groups. */ - fapl = H5Pcreate(H5P_FILE_ACCESS); - status = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); /* - * Create file 2 using the new file access property list. + * Create file 2 using the default access property list. */ - file = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); group = H5Gcreate(file, GROUP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 6d7a5bb0a76..42198e0fd50 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -80,7 +80,7 @@ test_file_create() H5File *file1 = NULL; try { // Create file FILE1 - file1 = new H5File(FILE1, H5F_ACC_EXCL); + file1 = new H5File(FILE1, H5F_ACC_TRUNC); // Try to create the same file with H5F_ACC_TRUNC. This should fail // because file1 is the same file and is currently open. @@ -847,8 +847,10 @@ test_file_info() H5F_fspace_strategy_t out_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; try { - // Create a file using default properties. - H5File tempfile(FILE7, H5F_ACC_TRUNC); + // Create a file using the earliest format. + FileAccPropList fapl; + fapl.setLibverBounds(H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + H5File tempfile(FILE7, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); // Get the file's version information. H5F_info2_t finfo; diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 0dfacd8adb0..9e81dbebc09 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -666,7 +666,7 @@ test_visit(hid_t fapl_id, bool new_format) delete file; // Reopen the file and group in the file. - file = new H5File(filename, H5F_ACC_RDWR); + file = new H5File(filename, H5F_ACC_RDWR, FileCreatPropList::DEFAULT, fapl); group = new Group(file->openGroup("Data")); // Open the group diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index ea042dd7ceb..234f498ffdd 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -1145,7 +1145,7 @@ SUBROUTINE file_space(filename, cleanup, total_error) CALL h5fget_freespace_f(fid, free_space, error) CALL check("h5fget_freespace_f",error,total_error) - IF(error .EQ.0 .AND. free_space .NE. 1248) THEN + IF(error .EQ.0 .AND. free_space .NE. 1853) THEN total_error = total_error + 1 WRITE(*,*) "1: Wrong amount of free space reported, ", free_space ENDIF @@ -1161,7 +1161,7 @@ SUBROUTINE file_space(filename, cleanup, total_error) ! Check the free space now CALL h5fget_freespace_f(fid, free_space, error) CALL check("h5fget_freespace_f",error,total_error) - IF(error .EQ.0 .AND. free_space .NE. 216) THEN + IF(error .EQ.0 .AND. free_space .NE. 1706) THEN total_error = total_error + 1 WRITE(*,*) "2: Wrong amount of free space reported, ", free_space ENDIF @@ -1173,7 +1173,7 @@ SUBROUTINE file_space(filename, cleanup, total_error) ! Check the free space now CALL h5fget_freespace_f(fid, free_space, error) CALL check("h5fget_freespace_f",error,total_error) - IF(error .EQ.0 .AND. free_space .NE. 1248) THEN + IF(error .EQ.0 .AND. free_space .NE. 1853) THEN total_error = total_error + 1 WRITE(*,*) "3: Wrong amount of free space reported, ", free_space ENDIF diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 8072b95ee7d..48071dcd113 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -52,8 +52,12 @@ static int test_file_image(size_t open_images, size_t nflags, const unsigned *flags) { - hid_t *file_id = NULL, *dset_id = NULL, file_space, plist; /* HDF5 ids */ - hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */ + hid_t *file_id = NULL; /* Array of file IDs */ + hid_t *dset_id = NULL; /* Array of dataset IDs */ + hid_t file_space_id = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl_id = H5I_INVALID_HID; /* DCPL ID */ + hid_t fapl_id = H5I_INVALID_HID; /* FAPL ID */ + hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; int data1[6] = {1, 2, 3, 4, 5, 6}; /* original contents of dataset */ int data2[6] = {7, 8, 9, 10, 11, 12}; /* "wrong" contents of dataset */ @@ -99,6 +103,13 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) if (NULL == (dset_id = (hid_t *)malloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); + /* Create FAPL and set earliest format */ + /* TODO: run this test with all different formats */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_PUTS_ERROR("H5Pcreate() failed"); + if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + FAIL_PUTS_ERROR("H5Pset_libver_bounds() failed"); + HL_TESTING2("get file images"); /* create several file images */ @@ -117,24 +128,24 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) snprintf(filename[i], filenamelength, "image_file%d.h5", (int)i); /* create file */ - if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_PUTS_ERROR("H5Fcreate() failed"); /* define dataspace for the dataset */ - if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0) + if ((file_space_id = H5Screate_simple(RANK, dims1, max_dims)) < 0) FAIL_PUTS_ERROR("H5Screate_simple() failed"); /* create dataset property list */ - if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_PUTS_ERROR("H5Pcreate() failed"); /* set property list to create chunked dataset */ - if (H5Pset_chunk(plist, RANK, dims1) < 0) + if (H5Pset_chunk(dcpl_id, RANK, dims1) < 0) FAIL_PUTS_ERROR("H5Pset_chunk() failed"); /* create and write an integer type dataset named "dset" */ - if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist, - H5P_DEFAULT)) < 0) + if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space_id, H5P_DEFAULT, + dcpl_id, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dcreate() failed"); /* dataset in open image 1 is written with "wrong" data */ @@ -153,11 +164,11 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) FAIL_PUTS_ERROR("H5Fflush() failed"); /* close dataset property list */ - if (H5Pclose(plist) < 0) + if (H5Pclose(dcpl_id) < 0) FAIL_PUTS_ERROR("H5Pclose() failed"); /* close dataspace */ - if (H5Sclose(file_space) < 0) + if (H5Sclose(file_space_id) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); /* close dataset */ @@ -277,11 +288,11 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) FAIL_PUTS_ERROR("H5Dopen() failed"); /* get dataspace for the dataset */ - if ((file_space = H5Dget_space(dset_id[i])) < 0) + if ((file_space_id = H5Dget_space(dset_id[i])) < 0) FAIL_PUTS_ERROR("H5Dget_space() failed"); /* get dimensions for the dataset */ - if (H5Sget_simple_extent_dims(file_space, dims3, NULL) < 0) + if (H5Sget_simple_extent_dims(file_space_id, dims3, NULL) < 0) FAIL_PUTS_ERROR("H5Sget_simple_extent_dims() failed"); /* read dataset */ @@ -312,7 +323,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) } /* end else */ /* close dataspace */ - if (H5Sclose(file_space) < 0) + if (H5Sclose(file_space_id) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); } /* end for */ @@ -455,11 +466,11 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) FAIL_PUTS_ERROR("H5Dopen() failed"); /* get dataspace for the dataset */ - if ((file_space = H5Dget_space(dset_id[i])) < 0) + if ((file_space_id = H5Dget_space(dset_id[i])) < 0) FAIL_PUTS_ERROR("H5Dget_space() failed"); /* get dimensions for the dataset */ - if (H5Sget_simple_extent_dims(file_space, dims3, NULL) < 0) + if (H5Sget_simple_extent_dims(file_space_id, dims3, NULL) < 0) FAIL_PUTS_ERROR("H5Sget_simple_extent_dims() failed"); /* read dataset */ @@ -479,7 +490,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) FAIL_PUTS_ERROR("comparison of image values with original data failed"); /* close dataspace */ - if (H5Sclose(file_space) < 0) + if (H5Sclose(file_space_id) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); /* close dataset */ @@ -513,6 +524,10 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags) } /* end for */ + /* close file access property list */ + if (H5Pclose(fapl_id) < 0) + FAIL_PUTS_ERROR("H5Pclose() failed"); + /* release temporary working buffers */ for (i = 0; i < open_images; i++) free(filename[i]); diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java index 7c70f5eaf58..93f8167a08f 100644 --- a/java/test/TestH5Fbasic.java +++ b/java/test/TestH5Fbasic.java @@ -293,7 +293,7 @@ public void testH5Fget_mdc_size() catch (Throwable err) { fail("H5.H5Fget_mdc_size: " + err); } - assertTrue("H5.H5Fget_mdc_size #:" + nentries, nentries == 4); + assertTrue("H5.H5Fget_mdc_size #:" + nentries, nentries == 2); } // TODO: test more cases of different cache sizes. diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 3929505f9fe..814ddfd708d 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -210,7 +210,7 @@ public void testH5Fget_info() try { H5F_info2_t finfo = H5.H5Fget_info(fid); - assertEquals(finfo.super_version, 0); + assertEquals(finfo.super_version, 2); assertEquals(finfo.free_version, 0); assertEquals(finfo.sohm_version, 0); } diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 7dc4cb70595..72eb17c9609 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -1038,7 +1038,7 @@ public void testH5P_userblock() /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 2); assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_userblock(fcpl_id, size); @@ -1074,7 +1074,7 @@ public void testH5P_sizes() /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 2); assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sizes(fcpl_id, size); @@ -1111,7 +1111,7 @@ public void testH5P_sym_k() /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 2); assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sym_k(fcpl_id, size); @@ -1148,7 +1148,7 @@ public void testH5P_istore_k() /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: " + finfo.super_version, finfo.super_version == 1); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 2); assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_istore_k(fcpl_id, size); diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 9e2dc249176..cf254b4c3d7 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -412,7 +412,7 @@ public void testH5Pget_libver_bounds() } assertTrue("testH5Pget_libver_bounds", ret_val >= 0); // Check the Earliest Version if the library - assertEquals(HDF5Constants.H5F_LIBVER_EARLIEST, libver[0]); + assertEquals(HDF5Constants.H5F_LIBVER_V18, libver[0]); // Check the Latest Version if the library assertEquals(HDF5Constants.H5F_LIBVER_LATEST, libver[1]); } diff --git a/release_docs/CHANGELOG.md b/release_docs/CHANGELOG.md index 5723daf2811..b392d4f5dbe 100644 --- a/release_docs/CHANGELOG.md +++ b/release_docs/CHANGELOG.md @@ -51,6 +51,10 @@ For releases prior to version 2.0.0, please see the release.txt file and for mor # ⚠️ Breaking Changes +### Updated default file format to 1.8 + + By default, HDF5 will now use the 1.8 file format (`H5F_LIBVER_V18`). This provides improved performance and space efficiency, particularly with groups and links. However, HDF5 library versions 1.6 and earlier will not be able to read files created with the default settings. The previous behavior can be restored using `H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST)`. + ### Renamed the option: `HDF5_ENABLE_Z_LIB_SUPPORT` The option has been renamed to `HDF5_ENABLE_ZLIB_SUPPORT` to be consistent with the naming of other options. Also, the option defaults to OFF. This requires the user to explicitly enable zlib support when configuring the library. @@ -59,6 +63,10 @@ For releases prior to version 2.0.0, please see the release.txt file and for mor CMake is now the build system available in HDF5 code. Version 3.26 or later is required. See the AutotoolsToCMakeOptions.md file for highlights of the CMake HDF5 install layout and CMake options to use in place of former Autotools options. +### Fixed problems with family driver and user block + + When using a user block with the family driver, the driver would inappropriately subtract the user block size for each member file when calculating member EOAs. This could cause a failure when an address overflowed the calculated eoa. The driver would also add the user block size when returning the EOF. Modified the family driver to not consider the user block, as it is handled by the H5FD layer. The user block now spans the first X bytes of the family array, for example a 4 KiB user block with 3 KiB member size will take up the entire first member and the first 1 KiB of the second. This may cause compatibility issues with preexisting family files with user blocks, though the way it worked before was inconsistent if it worked at all. + # 🚀 New Features & Improvements ## Configuration @@ -185,6 +193,10 @@ All other HDF5 library CMake options are prefixed with `HDF5_` ## Library +### Updated default file format to 1.8 + + By default, HDF5 will now use the 1.8 file format (`H5F_LIBVER_V18`). This provides improved performance and space efficiency, particularly with groups and links. This behavior can be overridden with `H5Pset_libver_bounds()`. + ### Added predefined datatypes for bfloat16 data Predefined datatypes have been added for little- and big-endian bfloat16 (https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) data. @@ -557,6 +569,10 @@ Added Fortran wrapper h5fdsubfiling_get_file_mapping_f() for the subfiling file ## Library +### Fixed problems with family driver and user block + + When using a user block with the family driver, the driver would inappropriately subtract the user block size for each member file when calculating member EOAs. This could cause a failure when an address overflowed the calculated eoa. The driver would also add the user block size when returning the EOF. Modified the family driver to not consider the user block, as it is handled by the H5FD layer. The user block now spans the first X bytes of the family array, for example a 4 KiB user block with 3 KiB member size will take up the entire first member and the first 1 KiB of the second. This may cause compatibility issues with preexisting family files with user blocks, though the way it worked before was inconsistent if it worked at all. + ### Fixed security issue CVE-2025-7067 Fixed a heap buffer overflow in H5FS__sinfo_serialize_node_cb() by discarding file free space sections from the file free space manager when they are found to be invalid. Specifically crafted HDF5 files can result in an attempt to insert duplicate or overlapping file free space sections into a file free space manager, later resulting in a buffer overflow when the same free space section is serialized to the file multiple times. diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 47a78c3a9c5..8bbf1a099ca 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -1016,15 +1016,14 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) } /* end if */ /* Set the EOA marker for the member */ - /* (Note compensating for base address addition in internal routine) */ H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t); if (addr > (haddr_t)file->memb_size) { - if (H5FD_set_eoa(file->memb[u], type, ((haddr_t)file->memb_size - file->pub.base_addr)) < 0) + if (H5FD_set_eoa(file->memb[u], type, (haddr_t)file->memb_size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to set file eoa"); addr -= file->memb_size; } /* end if */ else { - if (H5FD_set_eoa(file->memb[u], type, (addr - file->pub.base_addr)) < 0) + if (H5FD_set_eoa(file->memb[u], type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to set file eoa"); addr = 0; } /* end else */ @@ -1077,9 +1076,6 @@ H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type) break; } /* end for */ - /* Adjust for base address for file */ - eof += file->pub.base_addr; - /* * The file size is the number of members before the i'th member plus the * size of the i'th member. diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 118196ea47c..1463dd99f50 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -172,7 +172,7 @@ /* Definition for "low" bound of library format versions */ #define H5F_ACS_LIBVER_LOW_BOUND_SIZE sizeof(H5F_libver_t) -#define H5F_ACS_LIBVER_LOW_BOUND_DEF H5F_LIBVER_EARLIEST +#define H5F_ACS_LIBVER_LOW_BOUND_DEF H5F_LIBVER_V18 #define H5F_ACS_LIBVER_LOW_BOUND_ENC H5P__facc_libver_type_enc #define H5F_ACS_LIBVER_LOW_BOUND_DEC H5P__facc_libver_type_dec diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 78bbbee4afe..78850425ffe 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -428,6 +428,10 @@ check_file_creation_tags(hid_t fcpl_id, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0) TEST_ERROR; @@ -533,6 +537,10 @@ check_file_open_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -660,11 +668,12 @@ check_group_creation_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; - /* Create a test file with provided fcpl_t */ - if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR; - if (H5Pclose(fapl) < 0) + /* Create a test file with provided fcpl_t */ + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; /* determine tag value of root group's object header */ @@ -674,7 +683,7 @@ check_group_creation_tags(void) /* Close and Reopen the file */ if (H5Fclose(fid) < 0) TEST_ERROR; - if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ @@ -734,6 +743,8 @@ check_group_creation_tags(void) TEST_ERROR; if (H5Fclose(fid) < 0) TEST_ERROR; + if (H5Pclose(fapl) < 0) + TEST_ERROR; /* ========================================== */ /* Finished Test. Print status and return. */ @@ -928,6 +939,10 @@ check_link_iteration_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* =========== */ /* Create File */ /* =========== */ @@ -1295,6 +1310,10 @@ check_group_open_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -1425,6 +1444,10 @@ check_attribute_creation_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -1587,6 +1610,10 @@ check_attribute_open_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -1762,11 +1789,12 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; - /* Create a test file with provided fcpl_t */ - if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR; - if (H5Pclose(fapl) < 0) + /* Create a test file with provided fcpl_t */ + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; /* determine tag value of root group's object header */ @@ -1808,7 +1836,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) if (H5Fclose(fid) < 0) TEST_ERROR; - if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; if ((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -1907,6 +1935,8 @@ check_attribute_rename_tags(hid_t fcpl, int type) TEST_ERROR; if (H5Fclose(fid) < 0) TEST_ERROR; + if (H5Pclose(fapl) < 0) + TEST_ERROR; /* ========================================== */ /* Finished Test. Print status and return. */ @@ -2152,6 +2182,10 @@ check_dataset_creation_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -2310,6 +2344,10 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -2472,6 +2510,10 @@ check_dataset_open_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -2788,6 +2830,10 @@ check_attribute_write_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -3443,6 +3489,10 @@ check_object_info_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -3575,6 +3625,10 @@ check_object_copy_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -3733,6 +3787,10 @@ check_link_removal_tags(hid_t fcpl, int type) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR; @@ -3919,6 +3977,10 @@ check_link_getname_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -4080,6 +4142,10 @@ check_external_link_creation_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; @@ -4206,6 +4272,10 @@ check_external_link_open_tags(void) if ((fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Create a test file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; diff --git a/test/dtypes.c b/test/dtypes.c index 4b7468c6681..7afb43d0281 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -10008,9 +10008,15 @@ test_latest(void) if (H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) FAIL_STACK_ERROR; - /* Create file using default FAPL */ - h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename); - if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Set the 'use the earliest format' bounds in the FAPL */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + FAIL_STACK_ERROR; + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR; + + /* Create file using earliest version of the file format */ + h5_fixname(FILENAME[5], fapl, filename, sizeof filename); + if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR; /* Make a copy of the datatype, to commit */ @@ -10063,8 +10069,6 @@ test_latest(void) FAIL_STACK_ERROR; /* Set the 'use the latest format' bounds in the FAPL */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR; if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR; diff --git a/test/links.c b/test/links.c index ab67dc2772a..262cd0f2e50 100644 --- a/test/links.c +++ b/test/links.c @@ -23535,9 +23535,14 @@ main(void) if (h5_driver_is_default_vfd_compatible(fapl, &driver_is_default_compatible) < 0) TEST_ERROR; - /* fapl2 uses "latest version bounds" */ if ((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR; + + /* fapl uses "earliest version bounds" */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* fapl2 uses "latest version bounds" */ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR; diff --git a/test/mf.c b/test/mf.c index 74dca0a4873..48c12e4bea5 100644 --- a/test/mf.c +++ b/test/mf.c @@ -9141,6 +9141,10 @@ main(void) fapl = h5_fileaccess(); + /* These tests assume fapl indicates to use the earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Push API context */ if (H5CX_push(&api_ctx) < 0) FAIL_STACK_ERROR; diff --git a/test/stab.c b/test/stab.c index 788dad0ab67..8aa532542d6 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1397,7 +1397,11 @@ main(void) if ((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR; - /* Set the "use the latest version of the format" bounds for creating objects in the file */ + /* Set the "use the earliest version of the format" bounds on fapl for creating objects in the file */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Set the "use the latest version of the format" bounds on fapl2 for creating objects in the file */ if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR; diff --git a/test/swmr.c b/test/swmr.c index 7aa0e97c42d..74961f8fa2c 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -1578,11 +1578,12 @@ test_metadata_read_retry_info(hid_t in_fapl) static int test_start_swmr_write(hid_t in_fapl, bool new_format) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fapl = H5I_INVALID_HID; /* File access property */ - hid_t gid = H5I_INVALID_HID; /* Group ID */ - hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property */ - hid_t file_fapl = H5I_INVALID_HID; /* File access property for the file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property */ + hid_t earliest_fapl = H5I_INVALID_HID; /* FAPL with earliest format */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property */ + hid_t file_fapl = H5I_INVALID_HID; /* File access property for the file */ hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID, did3 = H5I_INVALID_HID; /* Dataset IDs */ hid_t did1_a = H5I_INVALID_HID, did1_b = H5I_INVALID_HID; hid_t sid1 = H5I_INVALID_HID, sid2 = H5I_INVALID_HID, sid3 = H5I_INVALID_HID; /* Dataspace IDs */ @@ -1611,9 +1612,20 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) FAIL_STACK_ERROR; } else { - TESTING("H5Fstart_swmr_write() when creating/opening a file without latest format"); + TESTING("H5Fstart_swmr_write() when creating/opening a file with earliest format"); + + /* Set to use the latest library format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR; } /* end if */ + /* Set up FAPL with earliest file format */ + if ((earliest_fapl = H5Pcopy(fapl)) < 0) + FAIL_STACK_ERROR; + if (new_format) + if (H5Pset_libver_bounds(earliest_fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR; + /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -1717,7 +1729,7 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) */ /* Open the file again with write + non-latest-format (earliest, latest) */ - if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, earliest_fapl)) < 0) FAIL_STACK_ERROR; /* Get the file's access_property list */ @@ -1859,6 +1871,10 @@ test_start_swmr_write(hid_t in_fapl, bool new_format) TEST_ERROR; if (H5Fclose(fid) < 0) TEST_ERROR; + if (H5Pclose(fapl) < 0) + TEST_ERROR; + if (H5Pclose(earliest_fapl) < 0) + TEST_ERROR; PASSED(); diff --git a/test/tattr.c b/test/tattr.c index e06694622cd..780f11591cf 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -4010,7 +4010,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) u = 2; snprintf(attrname, sizeof(attrname), "attr %02u", u); - if (vol_is_native && low != H5F_LIBVER_LATEST) { + if (vol_is_native && low < H5F_LIBVER_V18) { H5E_BEGIN_TRY { attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); @@ -4019,7 +4019,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) } else attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); - if (low == H5F_LIBVER_LATEST) { + if (low >= H5F_LIBVER_V18) { CHECK(attr, FAIL, "H5Acreate2"); /* Close attribute */ @@ -11939,10 +11939,12 @@ test_attr_delete_last_dense(hid_t fcpl, hid_t fapl) void test_attr(void H5_ATTR_UNUSED *params) { - hid_t fapl = (H5I_INVALID_HID), fapl2 = (H5I_INVALID_HID); /* File access property lists */ + hid_t fapl = (H5I_INVALID_HID), fapl2 = (H5I_INVALID_HID), + fapl3 = (H5I_INVALID_HID); /* File access property lists */ hid_t fcpl = (H5I_INVALID_HID), fcpl2 = (H5I_INVALID_HID); /* File creation property lists */ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ - unsigned new_format; /* Whether to use the new format or not */ + unsigned fapl_no; /* Which fapl to use */ + bool new_format; /* Whether to use the new format or not */ unsigned use_shared; /* Whether to use shared attributes or not */ unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ herr_t ret; /* Generic return value */ @@ -11952,10 +11954,16 @@ test_attr(void H5_ATTR_UNUSED *params) fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - /* fapl2 uses "latest version of the format" for creating objects in the file */ + /* fapl2 uses "earliest version of the format" for creating objects in the file */ fapl2 = H5Pcopy(fapl); CHECK(fapl2, FAIL, "H5Pcopy"); - ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* fapl3 uses "latest version of the format" for creating objects in the file */ + fapl3 = H5Pcopy(fapl); + CHECK(fapl3, FAIL, "H5Pcopy"); + ret = H5Pset_libver_bounds(fapl3, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); fcpl = H5Pcreate(H5P_FILE_CREATE); @@ -11984,17 +11992,28 @@ test_attr(void H5_ATTR_UNUSED *params) dcpl_g = dcpl; } - for (new_format = false; new_format <= true; new_format++) { + for (fapl_no = 1; fapl_no <= 3; fapl_no++) { hid_t my_fapl; /* Set the FAPL for the type of format */ - if (new_format) { - MESSAGE(7, ("testing with new file format\n")); - my_fapl = fapl2; - } - else { - MESSAGE(7, ("testing with old file format\n")); - my_fapl = fapl; + switch (fapl_no) { + case 1: + MESSAGE(7, ("testing with default file format\n")); + my_fapl = fapl; + new_format = true; + break; + case 2: + MESSAGE(7, ("testing with old file format\n")); + my_fapl = fapl2; + new_format = false; + break; + case 3: + MESSAGE(7, ("testing with new file format\n")); + my_fapl = fapl3; + new_format = true; + break; + default: + assert(0 && "unhandled case in switch statement"); } /* These next two tests use the same file information */ @@ -12154,6 +12173,8 @@ test_attr(void H5_ATTR_UNUSED *params) CHECK(ret, FAIL, "H5Pclose"); ret = H5Pclose(fapl2); CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fapl3); + CHECK(ret, FAIL, "H5Pclose"); } /* test_attr() */ /*------------------------------------------------------------------------- diff --git a/test/tfile.c b/test/tfile.c index 493e5de2f6d..7f7e293b921 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3202,6 +3202,7 @@ static void test_cached_stab_info(void) { hid_t file_id; + hid_t fapl_id; hid_t group_id; bool vol_is_native; herr_t ret; /* Generic return value */ @@ -3209,8 +3210,14 @@ test_cached_stab_info(void) /* Output message about test being performed */ MESSAGE(5, ("Testing cached symbol table information\n")); + /* Setup earliest file format */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl_id, FAIL, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Create file */ - file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); CHECK(file_id, FAIL, "H5Fcreate"); /* Check if native VOL is being used */ @@ -3242,6 +3249,10 @@ test_cached_stab_info(void) /* Close file */ ret = H5Fclose(file_id); CHECK(ret, FAIL, "H5Fclose"); + + /* Close fapl */ + ret = H5Pclose(fapl_id); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_cached_stab_info() */ /* @@ -4592,7 +4603,11 @@ test_file_freespace(const char *driver_name) new_fapl = H5Pcopy(fapl); CHECK(new_fapl, FAIL, "H5Pcopy"); - /* Set the "use the latest version of the format" bounds */ + /* Set the "use the earliest version of the format" bounds on fapl */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Set the "use the latest version of the format" bounds on new_fapl */ ret = H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); @@ -8107,7 +8122,6 @@ test_deprec(const char *driver_name) hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ hid_t fapl; /* File creation property list */ - hid_t new_fapl; hsize_t align; unsigned super; /* Superblock version # */ unsigned freelist; /* Free list version # */ @@ -8120,12 +8134,16 @@ test_deprec(const char *driver_name) /* Output message about test being performed */ MESSAGE(5, ("Testing deprecated routines\n")); - /* Creating a file with the default file creation property list should - * create a version 0 superblock + /* Creating a file with the default file creation property list no longer + * creates a version 0 superblock. Set up earliest file format on fapl. */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); /* Create file with default file creation property list */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Check if native VOL is being used */ @@ -8174,6 +8192,9 @@ test_deprec(const char *driver_name) /* Only run this part of the test with the sec2/default driver */ if (h5_using_default_driver(driver_name)) { + hid_t tmp_fapl; + hid_t new_fapl; + /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl, FAIL, "H5Pcreate"); @@ -8183,8 +8204,8 @@ test_deprec(const char *driver_name) ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512); CHECK(ret, FAIL, "H5Pset_file_space_strategy"); - fapl = H5Pcreate(H5P_FILE_ACCESS); - ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024); + tmp_fapl = H5Pcopy(fapl); + ret = H5Pset_alignment(tmp_fapl, (hsize_t)1, (hsize_t)1024); CHECK(ret, FAIL, "H5Pset_alignment"); /* Creating a file with the non-default file creation property list should @@ -8192,7 +8213,7 @@ test_deprec(const char *driver_name) */ /* Create file with custom file creation property list */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, tmp_fapl); CHECK(file, FAIL, "H5Fcreate"); new_fapl = H5Fget_access_plist(file); @@ -8231,7 +8252,7 @@ test_deprec(const char *driver_name) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + file = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Get the file's version information */ @@ -8262,6 +8283,12 @@ test_deprec(const char *driver_name) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); + /* Close temp FAPLs */ + ret = H5Pclose(tmp_fapl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + { /* Test deprecated H5Pget/set_file_space() */ H5F_file_space_type_t old_strategy; @@ -8296,7 +8323,7 @@ test_deprec(const char *driver_name) VERIFY(old_threshold, 3, "H5Pget_file_space"); /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); old_strategy = H5F_FILE_SPACE_DEFAULT; @@ -8318,7 +8345,7 @@ test_deprec(const char *driver_name) CHECK(ret, FAIL, "H5Pclose"); /* Reopen the file */ - fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(FILE1, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fcreate"); old_strategy = H5F_FILE_SPACE_DEFAULT; @@ -8337,6 +8364,10 @@ test_deprec(const char *driver_name) } } + /* Close FAPL */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* test_deprec */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/tmisc.c b/test/tmisc.c index 2d0608301c7..3914492935a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1930,6 +1930,7 @@ test_misc11(void) { hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ + hid_t fapl; /* File access property list */ hsize_t userblock; /* Userblock size retrieved from FCPL */ size_t off_size; /* Size of offsets in the file */ size_t len_size; /* Size of lengths in the file */ @@ -1947,12 +1948,18 @@ test_misc11(void) /* Output message about test being performed */ MESSAGE(5, ("Testing file creation properties retrieved correctly\n")); - /* Creating a file with the default file creation property list should - * create a version 0 superblock + /* Creating a file with the default file creation property list and libver + * bounds (earliest, latest) should create a version 0 superblock */ + /* Set up FAPL for earliest format */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Create file with default file creation property list */ - file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Check if native VOL is being used */ @@ -2015,7 +2022,7 @@ test_misc11(void) */ /* Create file with custom file creation property list */ - file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + file = H5Fcreate(MISC11_FILE, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Check if native VOL is being used */ @@ -2094,6 +2101,10 @@ test_misc11(void) /* Close FCPL */ ret = H5Pclose(fcpl); CHECK(ret, FAIL, "H5Pclose"); + + /* Close FAPL */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_misc11() */ /**************************************************************** @@ -3078,6 +3089,7 @@ static void test_misc18(void) { hid_t fid; /* File ID */ + hid_t fapl; /* File access property list */ hid_t sid; /* 'Space ID */ hid_t did1, did2; /* Dataset IDs */ hid_t aid; /* Attribute ID */ @@ -3091,8 +3103,14 @@ test_misc18(void) bool vol_is_native; herr_t ret; /* Generic return value */ + /* Set earliest file format on FAPL */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + /* Create the file */ - fid = H5Fcreate(MISC18_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(MISC18_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Check if native VOL is being used */ @@ -3244,6 +3262,9 @@ test_misc18(void) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); + + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_misc18() */ /**************************************************************** @@ -6430,6 +6451,10 @@ test_misc38(void) fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); + /* Default to earliest version of the file format, without checksummed object headers */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + if (1 == u) { /* Set property to allow unusual datatypes to be opened */ ret = H5Pset_relax_file_integrity_checks(fapl, H5F_RFIC_UNUSUAL_NUM_UNUSED_NUMERIC_BITS); diff --git a/test/vfd.c b/test/vfd.c index 79936acdb7c..35ac1659fec 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -769,10 +769,10 @@ test_direct(void) TEST_ERROR; /* There is no guarantee of the number of metadata allocations, but it's - * 4 currently and the size of the file should be between 3 & 4 file buffer + * 4 currently and the size of the file should be between 1 & 2 file buffer * sizes.. */ - if (file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4)) + if (file_size < FBSIZE || file_size >= (FBSIZE * 2)) TEST_ERROR; /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including @@ -1026,6 +1026,10 @@ test_family(void) TEST_ERROR; h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + /* Check that the VFD feature flags are correct */ if ((driver_id = H5Pget_driver(fapl)) < 0) TEST_ERROR; @@ -1480,6 +1484,10 @@ test_multi(void) if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; + /* Set earliest file format */ + if (H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + memset(memb_map, 0, sizeof(memb_map)); memset(memb_fapl, 0, sizeof(memb_fapl)); memset(memb_name, 0, sizeof(memb_name)); diff --git a/tools/test/h5import/testfiles/tall_fp32.ddl b/tools/test/h5import/testfiles/tall_fp32.ddl index 53f24bfceed..0a8c72703f0 100644 --- a/tools/test/h5import/testfiles/tall_fp32.ddl +++ b/tools/test/h5import/testfiles/tall_fp32.ddl @@ -7,7 +7,7 @@ GROUP "/" { STORAGE_LAYOUT { CONTIGUOUS SIZE 8 - OFFSET 2432 + OFFSET 2048 } FILTERS { NONE diff --git a/tools/test/h5import/testfiles/tall_i32.ddl b/tools/test/h5import/testfiles/tall_i32.ddl index b05dd533c62..ef16741dd8a 100644 --- a/tools/test/h5import/testfiles/tall_i32.ddl +++ b/tools/test/h5import/testfiles/tall_i32.ddl @@ -8,7 +8,7 @@ GROUP "/" { STORAGE_LAYOUT { CONTIGUOUS SIZE 24 - OFFSET 3464 + OFFSET 2048 } FILTERS { NONE diff --git a/tools/test/misc/expected/h5mkgrp_nested_mult_p.ls b/tools/test/misc/expected/h5mkgrp_nested_mult_p.ls index f2b3b4b8bb0..34cedd2d941 100644 --- a/tools/test/misc/expected/h5mkgrp_nested_mult_p.ls +++ b/tools/test/misc/expected/h5mkgrp_nested_mult_p.ls @@ -1,16 +1,21 @@ Opened "h5mkgrp_nested_mult_p.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one/two Group - Location: 1:1832 + Location: 1:342 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /three Group - Location: 1:2864 + Location: 1:489 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /three/four Group - Location: 1:3568 + Location: 1:636 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_nested_p.ls b/tools/test/misc/expected/h5mkgrp_nested_p.ls index 3034dbbdae1..8f1078dc826 100644 --- a/tools/test/misc/expected/h5mkgrp_nested_p.ls +++ b/tools/test/misc/expected/h5mkgrp_nested_p.ls @@ -1,10 +1,13 @@ Opened "h5mkgrp_nested_p.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one/two Group - Location: 1:1832 + Location: 1:342 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_several.ls b/tools/test/misc/expected/h5mkgrp_several.ls index 68a3f9ca6e3..ea830d63859 100644 --- a/tools/test/misc/expected/h5mkgrp_several.ls +++ b/tools/test/misc/expected/h5mkgrp_several.ls @@ -1,10 +1,13 @@ Opened "h5mkgrp_several.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /two Group - Location: 1:1832 + Location: 1:342 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_several_p.ls b/tools/test/misc/expected/h5mkgrp_several_p.ls index 43f1ce5cc6e..bcc56d46a55 100644 --- a/tools/test/misc/expected/h5mkgrp_several_p.ls +++ b/tools/test/misc/expected/h5mkgrp_several_p.ls @@ -1,10 +1,13 @@ Opened "h5mkgrp_several_p.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /two Group - Location: 1:1832 + Location: 1:342 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_several_v.ls b/tools/test/misc/expected/h5mkgrp_several_v.ls index a6df87b330c..4be4b7791b2 100644 --- a/tools/test/misc/expected/h5mkgrp_several_v.ls +++ b/tools/test/misc/expected/h5mkgrp_several_v.ls @@ -1,10 +1,13 @@ Opened "h5mkgrp_several_v.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /one Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /two Group - Location: 1:1832 + Location: 1:342 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_single.ls b/tools/test/misc/expected/h5mkgrp_single.ls index f2bd01c59f1..48e12e14a3c 100644 --- a/tools/test/misc/expected/h5mkgrp_single.ls +++ b/tools/test/misc/expected/h5mkgrp_single.ls @@ -1,7 +1,9 @@ Opened "h5mkgrp_single.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /single Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_single_p.ls b/tools/test/misc/expected/h5mkgrp_single_p.ls index e82dc315cc2..53fe4fce017 100644 --- a/tools/test/misc/expected/h5mkgrp_single_p.ls +++ b/tools/test/misc/expected/h5mkgrp_single_p.ls @@ -1,7 +1,9 @@ Opened "h5mkgrp_single_p.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /single Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/test/misc/expected/h5mkgrp_single_v.ls b/tools/test/misc/expected/h5mkgrp_single_v.ls index 7360865fbdd..48ba3af43ab 100644 --- a/tools/test/misc/expected/h5mkgrp_single_v.ls +++ b/tools/test/misc/expected/h5mkgrp_single_v.ls @@ -1,7 +1,9 @@ Opened "h5mkgrp_single_v.h5" with sec2 driver. / Group - Location: 1:96 + Location: 1:48 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX /single Group - Location: 1:800 + Location: 1:195 Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX