diff options
-rw-r--r-- | MANIFEST | 10 | ||||
-rw-r--r-- | test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 9 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/bounds_ref_earliest_latest.h5 | bin | 0 -> 9130 bytes | |||
-rw-r--r-- | test/bounds_ref_latest_latest.h5 | bin | 0 -> 9130 bytes | |||
-rw-r--r-- | test/bounds_ref_v110_v110.h5 | bin | 0 -> 9076 bytes | |||
-rw-r--r-- | test/bounds_ref_v112_v112.h5 | bin | 0 -> 9130 bytes | |||
-rw-r--r-- | test/bounds_ref_v18_v18.h5 | bin | 0 -> 9076 bytes | |||
-rw-r--r-- | test/bounds_sel_earliest_latest.h5 | bin | 0 -> 7580 bytes | |||
-rw-r--r-- | test/bounds_sel_latest_latest.h5 | bin | 0 -> 7580 bytes | |||
-rw-r--r-- | test/bounds_sel_v110_v110.h5 | bin | 0 -> 7556 bytes | |||
-rw-r--r-- | test/bounds_sel_v112_v112.h5 | bin | 0 -> 7580 bytes | |||
-rw-r--r-- | test/version_bounds_1_10.c | 345 |
14 files changed, 367 insertions, 1 deletions
@@ -997,6 +997,15 @@ ./test/be_extlink2.h5 ./test/big.c ./test/bittests.c +./test/bounds_ref_earliest_latest.h5 +./test/bounds_ref_latest_latest.h5 +./test/bounds_ref_v110_v110.h5 +./test/bounds_ref_v112_v112.h5 +./test/bounds_ref_v18_v18.h5 +./test/bounds_sel_earliest_latest.h5 +./test/bounds_sel_latest_latest.h5 +./test/bounds_sel_v110_v110.h5 +./test/bounds_sel_v112_v112.h5 ./test/btree_idx_1_6.h5 ./test/btree_idx_1_8.h5 ./test/btree2.c @@ -1218,6 +1227,7 @@ ./test/use_common.c ./test/use_disable_mdc_flushes.c ./test/use.h +./test/version_bounds_1_10.c ./test/vds.c ./test/vds_env.c ./test/vds_swmr.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1911903..68e9b03 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -257,6 +257,7 @@ set (H5_TESTS swmr thread_id # special link timer + version_bounds_1_10 ) macro (ADD_H5_EXE file) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 4e14067..1d15b20 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -123,6 +123,15 @@ set (HDF5_REFERENCE_TEST_FILES be_data.h5 be_extlink1.h5 be_extlink2.h5 + bounds_ref_earliest_latest.h5 + bounds_ref_latest_latest.h5 + bounds_ref_v110_v110.h5 + bounds_ref_v112_v112.h5 + bounds_ref_v18_v18.h5 + bounds_sel_earliest_latest.h5 + bounds_sel_latest_latest.h5 + bounds_sel_v110_v110.h5 + bounds_sel_v112_v112.h5 btree_idx_1_6.h5 btree_idx_1_8.h5 corrupt_stab_msg.h5 diff --git a/test/Makefile.am b/test/Makefile.am index 7e1cd4b..7b26d66 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -65,7 +65,8 @@ TEST_PROG= testhdf5 \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ dangle dtransform reserved cross_read freespace mf vds file_image \ - unregister cache_logging cork swmr thread_id timer + unregister cache_logging cork swmr thread_id timer \ + version_bounds_1_10 # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. diff --git a/test/bounds_ref_earliest_latest.h5 b/test/bounds_ref_earliest_latest.h5 Binary files differnew file mode 100644 index 0000000..2153514 --- /dev/null +++ b/test/bounds_ref_earliest_latest.h5 diff --git a/test/bounds_ref_latest_latest.h5 b/test/bounds_ref_latest_latest.h5 Binary files differnew file mode 100644 index 0000000..81c5c5a --- /dev/null +++ b/test/bounds_ref_latest_latest.h5 diff --git a/test/bounds_ref_v110_v110.h5 b/test/bounds_ref_v110_v110.h5 Binary files differnew file mode 100644 index 0000000..ed916a8 --- /dev/null +++ b/test/bounds_ref_v110_v110.h5 diff --git a/test/bounds_ref_v112_v112.h5 b/test/bounds_ref_v112_v112.h5 Binary files differnew file mode 100644 index 0000000..beb2de7 --- /dev/null +++ b/test/bounds_ref_v112_v112.h5 diff --git a/test/bounds_ref_v18_v18.h5 b/test/bounds_ref_v18_v18.h5 Binary files differnew file mode 100644 index 0000000..37fd8c3 --- /dev/null +++ b/test/bounds_ref_v18_v18.h5 diff --git a/test/bounds_sel_earliest_latest.h5 b/test/bounds_sel_earliest_latest.h5 Binary files differnew file mode 100644 index 0000000..71597c5 --- /dev/null +++ b/test/bounds_sel_earliest_latest.h5 diff --git a/test/bounds_sel_latest_latest.h5 b/test/bounds_sel_latest_latest.h5 Binary files differnew file mode 100644 index 0000000..ade1b85 --- /dev/null +++ b/test/bounds_sel_latest_latest.h5 diff --git a/test/bounds_sel_v110_v110.h5 b/test/bounds_sel_v110_v110.h5 Binary files differnew file mode 100644 index 0000000..aac4539 --- /dev/null +++ b/test/bounds_sel_v110_v110.h5 diff --git a/test/bounds_sel_v112_v112.h5 b/test/bounds_sel_v112_v112.h5 Binary files differnew file mode 100644 index 0000000..ade1b85 --- /dev/null +++ b/test/bounds_sel_v112_v112.h5 diff --git a/test/version_bounds_1_10.c b/test/version_bounds_1_10.c new file mode 100644 index 0000000..46e17a1 --- /dev/null +++ b/test/version_bounds_1_10.c @@ -0,0 +1,345 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*********************************************************** +* +* Test program: tverbounds110 +* +* Test 1.10 compatibility with version bounds for files +* generated by gen_bounds.c in develop branch. +* +* +* The following tests are for testing datasets with references +* and selections respectively: +* --test_ref_bounds() +* --test_sel_bounds() +* +*************************************************************/ +#include "h5test.h" +#include "H5srcdir.h" + +/* File names used in test_ref_bounds() */ +#define FILENAME_REF_E_L "bounds_ref_earliest_latest.h5" +#define FILENAME_REF_L_L "bounds_ref_latest_latest.h5" +#define FILENAME_REF_V112_V112 "bounds_ref_v112_v112.h5" +#define FILENAME_REF_V110_V110 "bounds_ref_v110_v110.h5" +#define FILENAME_REF_V18_V18 "bounds_ref_v18_v18.h5" + +/* Dataset names used in test_ref_bounds() */ +#define REVISED_REFS_DSET "Revised_refs_dset" +#define OLD_REF_OBJ_DSET "Old_ref_object_dset" +#define OLD_REF_REG_DSET "Old_ref_region_dset" + +/* File names used in test_sel_bounds() */ +#define FILENAME_SEL_E_L "bounds_sel_earliest_latest.h5" +#define FILENAME_SEL_L_L "bounds_sel_latest_latest.h5" +#define FILENAME_SEL_V112_V112 "bounds_sel_v112_v112.h5" +#define FILENAME_SEL_V110_V110 "bounds_sel_v110_v110.h5" + +/* Dataset names used in test_sel_bounds() */ +#define SEL_EX_REG_DSET "Sel_ex32_reg_dset" +#define SEL_EX_IRR_DSET "Sel_ex32_irr_dset" +#define SEL_EX_PT_DSET "Sel_ex32_pt_dset" + + +/*********************************************************************** + * + * Used by test_sel_bounds() to verify: + * --the dataset "dset_name" can be opened (or not)" + * --the selection in "dset_name" can be accessed (or not)" + * + ***********************************************************************/ +static herr_t +test_sel_check(hid_t fid, const char *dset_name, int should_open, int should_access) +{ + hid_t did = H5I_INVALID_HID; + hid_t sid = H5I_INVALID_HID; + hdset_reg_ref_t ref_rbuf[1]; /* The buffer for the reference */ + + /* Open and read the referenced dataset */ + H5E_BEGIN_TRY { + did = H5Dopen2(fid, dset_name, H5P_DEFAULT); + } H5E_END_TRY; + + if(should_open && (H5I_INVALID_HID == did)) + FAIL_PUTS_ERROR("*** Should have been able to open the dataset ***"); + if(!should_open && (H5I_INVALID_HID != did)) + FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataset ***"); + + if(did != H5I_INVALID_HID) { + if(H5Dread(did, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_rbuf) < 0) + TEST_ERROR + + /* Open access to the region reference from the dataset's dataspace */ + H5E_BEGIN_TRY { + sid = H5Rget_region(did, H5R_DATASET_REGION, &ref_rbuf[0]); + } H5E_END_TRY; + + if(should_access && (H5I_INVALID_HID == sid)) + FAIL_PUTS_ERROR("*** Should have been able to open the dataspace ***"); + if(!should_access && (H5I_INVALID_HID != sid)) + FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataspace ***"); + + if(H5Dclose(did) < 0) + TEST_ERROR + + if(should_access && H5Sclose(sid) < 0) + TEST_ERROR + } + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; +} /* test_sel_check() */ + +/*********************************************************************** + * test_sel_bounds(): + * This routine will be used to read in the following test files + * generated by gen_bounds.c in develop branch: + * (1) FILENAME_SEL_E_L--"bounds_sel_earliest_latest.h5" + * (2) FILENAME_SEL_L_L--"bounds_sel_latest_latest.h5" + * (3) FILENAME_SEL_V110_V110--"bounds_sel_v110_v110.h5" + * (4) FILENAME_SEL_V112_V112--"bounds_sel_v112_v112.h5" + * See detailed description of datasets created in those files in + * gen_bounds.c in develop branch. + * + * + * This test verifies the following: + * File #1, #3: + * a) dataset SEL_EX_REG_DSET--"Sel_ex32_reg_dset" + * --if existed, succeed to open and read the dataset; also, + * succeed to access the selection + * b) dataset SEL_EX_IRR_DSET--"Sel_ex32_irr_dset" + * --if existed, succeed to open and read the dataset but fail to + * access the selection due to hyperslab selection version 3 + * c) dataset SEL_EX_PT_DSET--"Sel_ex32_pt_dset" + * --if existed, succeed to open and read the dataset but fail to + * access the selection due to point selection version 2 + * + * Files #2, #4: + * a) dataset SEL_EX_REG_DSET--"Sel_ex32_reg_dset" + * --if existed, succeed to open the datasets but fail to access + * the selection due to hyperslab selection version 3 + * b) dataset SEL_EX_IRR_DSET--"Sel_ex32_irr_dset" + * --if existed, succeed to open the datasets but fail to access + * the selection due to hyperslab selection version 3 + * c) dataset SEL_EX_PT_DSET--"Sel_ex32_pt_dset" + * --if existed, succeed to open the datasets but fail to access + * the selection due to point selection version 2 + * + ***********************************************************************/ +static int +test_sel_bounds(const char *filename) +{ + hid_t fid = H5I_INVALID_HID; + const char *path; + htri_t exists; + + HDprintf("Test file: %s\n", filename); + TESTING("selection version bounds"); + + path = H5_get_srcdir_filename(filename); + + if(H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) + TEST_ERROR + + if(!HDstrcmp(filename, FILENAME_SEL_E_L) || + !HDstrcmp(filename, FILENAME_SEL_V110_V110)) { + + if((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, TRUE) < 0) + goto error; + + if((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) + goto error; + + if((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) + goto error; + + } + else { + + if((exists = H5Lexists(fid, SEL_EX_REG_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_sel_check(fid, SEL_EX_REG_DSET, TRUE, FALSE) < 0) + goto error; + + if((exists = H5Lexists(fid, SEL_EX_IRR_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_sel_check(fid, SEL_EX_IRR_DSET, TRUE, FALSE) < 0) + goto error; + + if((exists = H5Lexists(fid, SEL_EX_PT_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(test_sel_check(fid, SEL_EX_PT_DSET, TRUE, FALSE) < 0) + goto error; + } + + if(H5Fclose(fid) < 0) + TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + } H5E_END_TRY; + + return -1; +} /* test_sel_bounds() */ + +/*********************************************************************** + * + * Used by test_ref_bounds() to verify: + * --the dataset "dset_name" can be opened (or not) + * + ***********************************************************************/ +static herr_t +test_ref_check(hid_t fid, const char *dset_name, hbool_t should_open) +{ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + + H5E_BEGIN_TRY { + did = H5Dopen2(fid, dset_name, H5P_DEFAULT); + } H5E_END_TRY; + + if(should_open && (H5I_INVALID_HID == did)) + FAIL_PUTS_ERROR("*** Should have been able to open the dataset ***"); + if(!should_open && (H5I_INVALID_HID != did)) + FAIL_PUTS_ERROR("*** Should NOT have been able to open the dataset ***"); + + if(should_open && H5Dclose(did) < 0) + TEST_ERROR + + return SUCCEED; +error: + return FAIL; + +} /* test_ref_check() */ + +/*********************************************************************** + * test_ref_bounds(): + * This routine will be used to read in the following test files + * generated by gen_bounds.c in develop branch: + * (1) FILENAME_REF_E_L--"bounds_ref_earliest_latest.h5" + * (2) FILENAME_REF_L_L--"bounds_ref_latest_latest.h5" + * (3) FILENAME_REF_V112_V112--"bounds_ref_v112_v112.h5" + * (4) FILENAME_REF_V110_V110--"bounds_ref_v110_v110.h5" + * (5) FILENAME_REF_V18_V18--"bounds_ref_v18_v18.h5" + * See detailed description of datasets created in those files in + * gen_bounds.c in develop branch. + * + * + * This test verifies the following: + * Files #1 to #5: + * a) dataset REVISED_REFS_DSET--"Revised_refs_dset" + * --if existed, fail to open this dataset due to datatype message version 4 + * b) dataset OLD_REF_OBJ_DSET--"Old_ref_object_dset" + * --if existed, succeed to open the dataset + * c) dataset OLD_REF_REG_DSET--"Old_ref_region_dset" + * --if existed, succeed to open the dataset + * + ***********************************************************************/ +static int +test_ref_bounds(const char *filename) +{ + const char *path; + hid_t fid = H5I_INVALID_HID; + htri_t exists; + + HDprintf("Test file: %s\n", filename); + TESTING("reference version bounds"); + + path = H5_get_srcdir_filename(filename); + + if(H5I_INVALID_HID == (fid = H5Fopen(path, H5F_ACC_RDONLY, H5P_DEFAULT))) + TEST_ERROR + + if((exists = H5Lexists(fid, REVISED_REFS_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_ref_check(fid, REVISED_REFS_DSET, FALSE) < 0) + goto error; + + if((exists = H5Lexists(fid, OLD_REF_OBJ_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_ref_check(fid, OLD_REF_OBJ_DSET, TRUE) < 0) + goto error; + + if((exists = H5Lexists(fid, OLD_REF_REG_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR + if(exists && test_ref_check(fid, OLD_REF_REG_DSET, TRUE) < 0) + goto error; + + if(H5Fclose(fid) < 0) + TEST_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + } H5E_END_TRY; + + return -1; +} /* test_ref_bounds() */ + +/************************************************************************* +** +** Main routine to test version bounds with 1.10 library +** +*************************************************************************/ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDprintf("Testing reference and selection version bounds.\n"); + + /* Verify the reference datasets in the test files */ + nerrors += test_ref_bounds(FILENAME_REF_E_L) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_L_L) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V112_V112) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V110_V110) < 0 ? 1 : 0; + nerrors += test_ref_bounds(FILENAME_REF_V18_V18) < 0 ? 1 : 0; + + /* Verify the selections of reference datasets in the test files */ + nerrors += test_sel_bounds(FILENAME_SEL_E_L) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_L_L) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_V112_V112) < 0 ? 1 : 0; + nerrors += test_sel_bounds(FILENAME_SEL_V110_V110) < 0 ? 1 : 0; + + if(nerrors) { + HDprintf("***** %d Reference and selection version bounds TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return EXIT_FAILURE; + } + + HDprintf("All reference and selection version bounds tests passed.\n"); + + return EXIT_SUCCESS; +} |