diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2019-07-18 18:59:12 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2019-07-18 18:59:12 (GMT) |
commit | f4e2304bad527b57d6edcb7136e69ac7ba70cebf (patch) | |
tree | 99e6b0cbdd28f15e6abf4e84a4d2e77934d60e00 /test/tfile.c | |
parent | 346fe1a0bcb2da5e3b1de04f24195ce9781e846a (diff) | |
parent | 308393a020bd7a812c231eee8130c9365d192e18 (diff) | |
download | hdf5-f4e2304bad527b57d6edcb7136e69ac7ba70cebf.zip hdf5-f4e2304bad527b57d6edcb7136e69ac7ba70cebf.tar.gz hdf5-f4e2304bad527b57d6edcb7136e69ac7ba70cebf.tar.bz2 |
Merge pull request #14 in ~VCHOI/my_third_fork from hdf5_1_10 to bugfix/110_HDFFV-10808-h5pset_file_space_strategy
* commit '308393a020bd7a812c231eee8130c9365d192e18':
Change "bad" hid_t_value to H5I_INVALID_HID in test_libver_bounds_copy() test.
Bring pull request #1729 from develop to 1.10: Fix for HDFFV-10800 H5Ocopy failure: The value for the H5F_LIBVER_V18 index in H5O_fill_ver_bounds[], the format version bounds array for fill value message, should be version 3 not 2.
Diffstat (limited to 'test/tfile.c')
-rw-r--r-- | test/tfile.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/tfile.c b/test/tfile.c index a0a165f..a73d3e4 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -169,6 +169,15 @@ const char *FILESPACE_NAME[] = { NULL }; + +/* Declarations for test_libver_bounds_copy(): */ +/* SRC_FILE: source file created under 1.8 branch with latest format */ +/* DST_FILE: destination file for copying the dataset in SRC_FILE */ +/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */ +#define SRC_FILE "fill18.h5" +#define DST_FILE "fill18_copy.h5" +#define DSET_DS1 "DS1" + /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); @@ -5081,6 +5090,79 @@ test_libver_bounds_open(void) } /* end test_libver_bounds_open() */ +/*------------------------------------------------------------------------- + * Function: test_libver_bounds_copy + * + * Purpose: Test to verify HDFFV-10800 is fixed: + * This test is copied from the user test program: copy10.c. + * (See attached programs in the jira issue.) + * + * The source file used in the test is generated by the user test + * program "fill18.c" with the 1.8 library. The file is created + * with the latest format and the dataset created in the file + * has version 3 fill value message (latest). + * + * The test creates the destination file with (v18, v18) version bounds. + * H5Ocopy() should succeed in copying the dataset in the source file + * to the destination file. + * + * Return: Success: 0 + * Failure: number of errors + * + *------------------------------------------------------------------------- + */ +static void +test_libver_bounds_copy(void) +{ + hid_t src_fid = -1; /* File ID */ + hid_t dst_fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list ID */ + const char *src_fname; /* Source file name */ + herr_t ret; /* Generic return value */ + + /* Output message about the test being performed */ + MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n")); + + /* Get the test file name */ + src_fname = H5_get_srcdir_filename(SRC_FILE); + + /* Open the source test file */ + src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(src_fid, H5I_INVALID_HID, "H5Fopen"); + + /* Create file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); + + /* Set library version bounds to (v18, v18) */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create the destination file with the fapl */ + dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(dst_fid, H5I_INVALID_HID, "H5Pcreate"); + + /* Close the fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + + /* Copy the dataset in the source file to the destination file */ + ret = H5Ocopy(src_fid, DSET_DS1, dst_fid, DSET_DS1, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret, SUCCEED, "H5Ocopy"); + + /* Close the source file */ + ret = H5Fclose(src_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Close the destination file */ + ret = H5Fclose(dst_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Remove the destination file */ + HDremove(DST_FILE); + +} /* end test_libver_bounds_copy() */ + /**************************************************************** ** ** test_libver_bounds(): @@ -5099,6 +5181,7 @@ test_libver_bounds(void) test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); test_libver_bounds_open(); + test_libver_bounds_copy(); } /* end test_libver_bounds() */ /************************************************************************************** @@ -7491,5 +7574,6 @@ cleanup_file(void) HDremove(FILE5); HDremove(FILE6); HDremove(FILE7); + HDremove(DST_FILE); } |