summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2011-10-14 15:29:55 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2011-10-14 15:29:55 (GMT)
commit41052158c7620fdcd168488f8d57b35e7faeee55 (patch)
tree94527d4c03013bf7891c7c8577f3e03b14f7328b /test
parentaf1cffe28ed8f1bb380ed2925c6120c32bdf4fb6 (diff)
downloadhdf5-41052158c7620fdcd168488f8d57b35e7faeee55.zip
hdf5-41052158c7620fdcd168488f8d57b35e7faeee55.tar.gz
hdf5-41052158c7620fdcd168488f8d57b35e7faeee55.tar.bz2
[svn-r21563] Improve testing for H5Pset_libver_bounds
Add testing for H5F_LIBVER_18 Tested: durandal (too minor for full h5committest)
Diffstat (limited to 'test')
-rw-r--r--test/tfile.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/test/tfile.c b/test/tfile.c
index 1f7271a..9f6d6d4 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -2509,63 +2509,115 @@ test_userblock_alignment(void)
/****************************************************************
**
-** test_libver_bounds():
-** Verify that a file created with "LATEST, LATEST" can be
-** opened later, with no setting. (Further testing welcome)
+** test_libver_bounds_real():
+** Verify that a file created and modified with the
+** specified libver bounds has the specified object header
+** versions for the right objects.
**
****************************************************************/
static void
-test_libver_bounds(void)
+test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
+ H5F_libver_t libver_mod, unsigned oh_vers_mod)
{
hid_t file, group; /* Handles */
hid_t fapl; /* File access property list */
- herr_t ret; /* Return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing setting library version bounds\n"));
+ H5O_info_t oinfo; /* Object info */
+ herr_t ret; /* Return value */
/*
- * Create a new file using the default properties.
+ * Create a new file using the creation properties.
*/
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
- ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
+ ret = H5Pset_libver_bounds(fapl, libver_create, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
file = H5Fcreate("tfile5.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file, FAIL, "H5Fcreate");
+ /*
+ * Make sure the root group has the correct object header version
+ */
+ ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+
+ /*
+ * Reopen the file and make sure the root group still has the correct version
+ */
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
- ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST);
+ ret = H5Pset_libver_bounds(fapl, libver_mod, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl);
CHECK(file, FAIL, "H5Fopen");
+ ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+
/*
- * Create a group named "G1" in the file.
+ * Create a group named "G1" in the file, and make sure it has the correct
+ * object header version
*/
group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
+ ret = H5Oget_info(group, &oinfo);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name");
+
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
/*
- * Create a group named "/G1/G3" in the file.
+ * Create a group named "/G1/G3" in the file, and make sure it has the
+ * correct object header version
*/
group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
+ ret = H5Oget_info(group, &oinfo);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name");
+
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
+ /*
+ * Make sure the root group still has the correct object header version
+ */
+ ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_libver_bounds() */
+} /* end test_libver_bounds_real() */
+
+/****************************************************************
+**
+** test_libver_bounds():
+** Verify that a file created and modified with various
+** libver bounds is handled correctly. (Further testing
+** welcome)
+**
+****************************************************************/
+static void
+test_libver_bounds(void)
+{
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing setting library version bounds\n"));
+
+ /* Run the tests */
+ test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2);
+ test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_18, 2);
+ test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 1);
+ test_libver_bounds_real(H5F_LIBVER_18, 2, H5F_LIBVER_EARLIEST, 1);
+} /* end test_libver_bounds() */
/****************************************************************
**