diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5format_convert/h5fc_gentest.c | 102 | ||||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_edge_v3.h5 (renamed from tools/h5format_convert/testfiles/h5fc_edge.h5) | bin | 2526 -> 2526 bytes | |||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_latest_v3.h5 (renamed from tools/h5format_convert/testfiles/h5fc_new.h5) | bin | 6130 -> 6130 bytes | |||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_non_v3.h5 | bin | 0 -> 4336 bytes | |||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_old.h5 | bin | 5688 -> 0 bytes | |||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v1.h5 (renamed from tools/h5format_convert/testfiles/h5fc_all.h5) | bin | 7672 -> 8252 bytes | |||
-rw-r--r-- | tools/h5format_convert/testfiles/h5fc_v_n_all.ddl | 12 | ||||
-rw-r--r-- | tools/h5format_convert/testh5fc.sh.in | 104 | ||||
-rw-r--r-- | tools/misc/clear_open_chk.c | 2 | ||||
-rw-r--r-- | tools/misc/h5clear_gentest.c | 147 | ||||
-rw-r--r-- | tools/misc/testh5clear.sh.in | 93 |
11 files changed, 205 insertions, 255 deletions
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c index de22691..2a8fa3e 100644 --- a/tools/h5format_convert/h5fc_gentest.c +++ b/tools/h5format_convert/h5fc_gentest.c @@ -26,12 +26,12 @@ #define GROUP "GROUP" -#define OLD_FILE "h5fc_old.h5" +#define OLD_V1_FILE "h5fc_v1.h5" #define DSET_NON_CHUNKED "DSET_NON_CHUNKED" #define DSET_BT1 "DSET_BT1" #define DSET_NDATA_BT1 "DSET_NDATA_BT1" -#define NEW_FILE "h5fc_new.h5" +#define LATEST_V3_FILE "h5fc_latest_v3.h5" #define DSET_EA "DSET_EA" #define DSET_NDATA_EA "DSET_NDATA_EA" #define DSET_BT2 "DSET_BT2" @@ -41,9 +41,9 @@ #define DSET_NONE "DSET_NONE" #define DSET_NDATA_NONE "DSET_NDATA_NONE" -#define ALL_FILE "h5fc_all.h5" +#define NON_V3_FILE "h5fc_non_v3.h5" -#define EDGE_FILE "h5fc_edge.h5" +#define EDGE_V3_FILE "h5fc_edge_v3.h5" #define DSET_EDGE "DSET_EDGE" /* @@ -57,6 +57,7 @@ static void gen_old(const char *fname) { hid_t fid = -1; /* file id */ + hid_t fcpl = -1; hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -67,8 +68,14 @@ gen_old(const char *fname) int i; /* local index variable */ int buf[24]; /* data buffer */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + + if(H5Pset_istore_k(fcpl, 64) < 0) + goto error; + /* Create file */ - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0) goto error; /* Create a group */ @@ -152,16 +159,16 @@ error: } /* gen_old() */ /* - * Function: gen_new() + * Function: gen_latest() * - * Create a new format file with: + * Create a file with write+latest-format--this will result in v3 superblock+latest version support: * 1) 2 chunked datasets with extensible array chunk indexing type (with/without data) * 2) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data) * 3) 2 chunked datasets with fixed array chunk indexing type (with/without data) * 4) 2 chunked datasets with implicit array chunk indexing type (with/without data) */ static void -gen_new(const char *fname) +gen_latest(const char *fname) { hid_t fid = -1; /* file id */ hid_t fapl = -1; /* file access property list */ @@ -341,23 +348,23 @@ error: H5Pclose(fapl); } H5E_END_TRY; -} /* gen_new() */ +} /* gen_latest() */ /* - * Function: gen_all() + * Function: gen_non() * - * Create a new format file with: + * Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support: * 1) 1 chunked dataset with extensible array chunk indexing type (without data) * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data) - * Re-open the file with old format and create: + * Re-open the file with write+non-latest-format and create: + * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data) + * 4) 1 chunked dataset with extensible array indexing type (with data) * 5) 1 non-chunked dataset - * 6) 2 chunked datasets with version 1 B-tree chunk indexing type (with/without data) */ static void -gen_all(const char *fname) +gen_non(const char *fname) { hid_t fid = -1; /* file id */ - hid_t fapl = -1; /* file access property list */ hid_t gid = -1; /* group id */ hid_t sid = -1; /* space id */ hid_t dcpl = -1; /* dataset creation property id */ @@ -369,13 +376,8 @@ gen_all(const char *fname) int i; /* local index variable */ int buf[24]; /* data buffer */ - /* Create a new format file */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + /* Create a new file with SWMR_WRITE + non-latest-format */ + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* Create a group */ @@ -393,7 +395,7 @@ gen_all(const char *fname) goto error; /* - * Create 1 chunked dataset with extensible array chunk indexing type (without data) + * Create a chunked dataset with extensible array chunk indexing type (without data) */ /* Create dataspace */ @@ -413,7 +415,7 @@ gen_all(const char *fname) goto error; /* - * Create 1 chunked dataset with version 2 B-tree chunk indexing type (with data) + * Create a chunked dataset with version 2 B-tree chunk indexing type (with data) */ /* Create dataspace */ @@ -436,8 +438,6 @@ gen_all(const char *fname) goto error; if(H5Dclose(did1) < 0) goto error; - - if(H5Pclose(dcpl) < 0) goto error; if(H5Gclose(gid) < 0) @@ -454,7 +454,7 @@ gen_all(const char *fname) goto error; /* - * Create 2 datasets with version 1 B-btree chunk indexing type (with/without data) + * Create a dataset with version 2 B-btree chunk indexing type (without data) */ /* Set chunk */ @@ -464,19 +464,34 @@ gen_all(const char *fname) goto error; /* Create dataspace */ - max_dims[0] = 10; + max_dims[0] = H5S_UNLIMITED; max_dims[1] = H5S_UNLIMITED; if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) goto error; - /* Create the datasets */ - if((did1 = H5Dcreate2(fid, DSET_NDATA_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + /* Create the dataset */ + if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - if((did2 = H5Dcreate2(gid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + /* Close the dataspace */ + if(H5Sclose(sid) < 0) goto error; - /* Write to one dataset */ + /* + * Create a dataset with version extensible array chunk indexing type (with data) in the group + */ + + /* Create dataspace */ + max_dims[0] = 10; + max_dims[1] = H5S_UNLIMITED; + if((sid = H5Screate_simple(2, dims2, max_dims)) < 0) + goto error; + + /* Create the dataset */ + if((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + goto error; + + /* Write to the dataset */ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; @@ -489,7 +504,7 @@ gen_all(const char *fname) goto error; /* - * Create a non-chunked dataset + * Create a non-chunked dataset in the group */ /* Create dataspace */ @@ -512,8 +527,6 @@ gen_all(const char *fname) goto error; if(H5Pclose(dcpl) < 0) goto error; - if(H5Pclose(fapl) < 0) - goto error; error: H5E_BEGIN_TRY { @@ -523,15 +536,14 @@ error: H5Dclose(did2); H5Gclose(gid); H5Fclose(fid); - H5Pclose(fapl); } H5E_END_TRY; -} /* gen_all() */ +} /* gen_non() */ /* * Function: gen_edge() * - * Create a new format file with: + * Create a file with write+latest-format--this will result in v3 superblock+latest version support: * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled * (i.e. the dataset does not filter partial edge chunks) */ @@ -608,16 +620,16 @@ error: int main(void) { - /* Generate an old format file with datasets for testing */ - gen_old(OLD_FILE); + /* Generate an old format file with v1 superbock */ + gen_old(OLD_V1_FILE); - /* Generate a new format file with datasets for testing */ - gen_new(NEW_FILE); + /* Generate a latest-format file with v3 superblock */ + gen_latest(LATEST_V3_FILE); - /* Generate a new format file (+reopen with old format) for testing */ - gen_all(ALL_FILE); + /* Generate a non-latest-format file with v3 superblock */ + gen_non(NON_V3_FILE); /* Generate a new format file with a no-filter-edge-chunk dataset for testing */ - gen_edge(EDGE_FILE); + gen_edge(EDGE_V3_FILE); return 0; } diff --git a/tools/h5format_convert/testfiles/h5fc_edge.h5 b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5 Binary files differindex abf6192..701afa3 100644 --- a/tools/h5format_convert/testfiles/h5fc_edge.h5 +++ b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5 diff --git a/tools/h5format_convert/testfiles/h5fc_new.h5 b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 Binary files differindex fe4d858..f7de743 100644 --- a/tools/h5format_convert/testfiles/h5fc_new.h5 +++ b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5 diff --git a/tools/h5format_convert/testfiles/h5fc_non_v3.h5 b/tools/h5format_convert/testfiles/h5fc_non_v3.h5 Binary files differnew file mode 100644 index 0000000..b1bffa8 --- /dev/null +++ b/tools/h5format_convert/testfiles/h5fc_non_v3.h5 diff --git a/tools/h5format_convert/testfiles/h5fc_old.h5 b/tools/h5format_convert/testfiles/h5fc_old.h5 Binary files differdeleted file mode 100644 index dc4e912..0000000 --- a/tools/h5format_convert/testfiles/h5fc_old.h5 +++ /dev/null diff --git a/tools/h5format_convert/testfiles/h5fc_all.h5 b/tools/h5format_convert/testfiles/h5fc_v1.h5 Binary files differindex 33a9166..d3d66f8 100644 --- a/tools/h5format_convert/testfiles/h5fc_all.h5 +++ b/tools/h5format_convert/testfiles/h5fc_v1.h5 diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl index d4b7a2d..76c70ee 100644 --- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl +++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl @@ -2,12 +2,13 @@ Process command line options It is noop... Open the file tmp.h5 Processing all datasets in the file... -Going to process dataset:/DSET_NDATA_BT1... +Going to process dataset:/DSET_NDATA_BT2... Open the dataset Retrieve the dataset's layout Verify the dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Verify the dataset's chunk indexing type is not version 1 B-tree +Not converting the dataset Close the dataset Close the dataset creation property list Going to process dataset:/DSET_NDATA_EA... @@ -19,15 +20,16 @@ Verify the dataset's chunk indexing type is not version 1 B-tree Not converting the dataset Close the dataset Close the dataset creation property list -Going to process dataset:/GROUP/DSET_BT1... +Going to process dataset:/GROUP/DSET_BT2... Open the dataset Retrieve the dataset's layout Verify the dataset is a chunked dataset Retrieve the dataset's chunk indexing type -Chunk indexing type is already version 1 B-tree: no further action +Verify the dataset's chunk indexing type is not version 1 B-tree +Not converting the dataset Close the dataset Close the dataset creation property list -Going to process dataset:/GROUP/DSET_BT2... +Going to process dataset:/GROUP/DSET_EA... Open the dataset Retrieve the dataset's layout Verify the dataset is a chunked dataset diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in index ac51c08..dc5aa48 100644 --- a/tools/h5format_convert/testh5fc.sh.in +++ b/tools/h5format_convert/testh5fc.sh.in @@ -79,10 +79,10 @@ TMPFILE=tmp.h5 # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_HDF5_TEST_FILES=" -$SRC_H5FORMCONV_TESTFILES/h5fc_old.h5 -$SRC_H5FORMCONV_TESTFILES/h5fc_new.h5 -$SRC_H5FORMCONV_TESTFILES/h5fc_all.h5 -$SRC_H5FORMCONV_TESTFILES/h5fc_edge.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_v1.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_latest_v3.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_non_v3.h5 +$SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5 " LIST_OTHER_TEST_FILES=" @@ -284,105 +284,105 @@ TOOLTEST_OUT h5fc_nooption.ddl '' TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 # # -# h5format_convert -d h5fc_old.h5 (just -d option, file exists) -# h5format_convert --dname h5fc_old.h5 (just --dname option, file exists) +# h5format_convert -d h5fc_v1.h5 (just -d option, file exists) +# h5format_convert --dname h5fc_v1.h5 (just --dname option, file exists) # h5format_convert --dname (just --dname option) -# h5format_convert --dname=nonexist h5fc_old.h5 (dataset does not exist, file exists) -TOOLTEST_OUT h5fc_d_file.ddl h5fc_old.h5 -d -TOOLTEST_OUT h5fc_d_file.ddl h5fc_old.h5 --dname +# h5format_convert --dname=nonexist h5fc_v1.h5 (dataset does not exist, file exists) +TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 -d +TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 --dname TOOLTEST_OUT h5fc_dname.ddl '' --dname -TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_old.h5 --dname=nonexist +TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_v1.h5 --dname=nonexist # # # -# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_old.h5 (verbose, non-chunked dataset) -# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_old.h5 (verbose, bt1 dataset) -# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_old.h5 (verbose, noop, bt1+nodata dataset) -# h5format_convert -v h5fc_old.h5 (verbose, all datasets) -TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_old.h5 -d /DSET_NON_CHUNKED -v -TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_old.h5 -d /GROUP/DSET_BT1 --verbose -TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_old.h5 -d /DSET_NDATA_BT1 -v -n -TOOLTEST_OUT h5fc_v_all.ddl h5fc_old.h5 -v +# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_v1.h5 (verbose, non-chunked dataset) +# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_v1.h5 (verbose, bt1 dataset) +# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_v1.h5 (verbose, noop, bt1+nodata dataset) +# h5format_convert -v h5fc_v1.h5 (verbose, all datasets) +TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_v1.h5 -d /DSET_NON_CHUNKED -v +TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_v1.h5 -d /GROUP/DSET_BT1 --verbose +TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_v1.h5 -d /DSET_NDATA_BT1 -v -n +TOOLTEST_OUT h5fc_v_all.ddl h5fc_v1.h5 -v # # # -# h5format_convert -d /DSET_EA -v -n h5fc_new.h5 (verbose, noop, one ea dataset) -# h5format_convert -v -n h5fc_all.h5 (verbose, noop, all datasets) -TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_new.h5 -d /DSET_EA -v -n -TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_all.h5 -v -n +# h5format_convert -d /DSET_EA -v -n h5fc_latest_v3.h5 (verbose, noop, one ea dataset) +# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets) +TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_latest_v3.h5 -d /DSET_EA -v -n +TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n # # # # No output from tests # 1) Use the tool to convert the dataset # 2) Verify the chunk indexing type is correct -# h5format_convert -d /DSET_EA h5fc_new.h5 -# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_new.h5 -# h5format_convert -d /GROUP/DSET_BT2 h5fc_new.h5 -# h5format_convert -d /DSET_NDATA_BT2 h5fc_new.h5 -# h5format_convert -d /DSET_FA h5fc_new.h5 -# h5format_convert -d /GROUP/DSET_FA h5fc_new.h5 -# h5format_convert -d /DSET_NONE h5fc_new.h5 -# h5format_convert -d /GROUP/DSET_NONE h5fc_new.h5 -TOOLTEST h5fc_new.h5 -d /DSET_EA +# h5format_convert -d /DSET_EA h5fc_latest_v3.h5 +# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_latest_v3.h5 +# h5format_convert -d /GROUP/DSET_BT2 h5fc_latest_v3.h5 +# h5format_convert -d /DSET_NDATA_BT2 h5fc_latest_v3.h5 +# h5format_convert -d /DSET_FA h5fc_latest_v3.h5 +# h5format_convert -d /GROUP/DSET_FA h5fc_latest_v3.h5 +# h5format_convert -d /DSET_NONE h5fc_latest_v3.h5 +# h5format_convert -d /GROUP/DSET_NONE h5fc_latest_v3.h5 +TOOLTEST h5fc_latest_v3.h5 -d /DSET_EA IDX_CHECK /DSET_EA # -TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_EA +TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_EA IDX_CHECK /GROUP/DSET_NDATA_EA # -TOOLTEST h5fc_new.h5 -d /GROUP/DSET_BT2 +TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_BT2 IDX_CHECK /GROUP/DSET_BT2 # -TOOLTEST h5fc_new.h5 -d /DSET_NDATA_BT2 +TOOLTEST h5fc_latest_v3.h5 -d /DSET_NDATA_BT2 IDX_CHECK /DSET_NDATA_BT2 # -TOOLTEST h5fc_new.h5 -d /DSET_FA +TOOLTEST h5fc_latest_v3.h5 -d /DSET_FA IDX_CHECK /DSET_FA # -TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_FA +TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_FA IDX_CHECK /GROUP/DSET_NDATA_FA # -TOOLTEST h5fc_new.h5 -d /DSET_NONE +TOOLTEST h5fc_latest_v3.h5 -d /DSET_NONE IDX_CHECK /DSET_NONE # -TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_NONE +TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_NONE IDX_CHECK /GROUP/DSET_NDATA_NONE # # # # No output from tests: just check exit code -# h5format_convert -d /DSET_NDATA_BT1 h5fc_old.h5 (v1-btree dataset) -# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_all.h5 (non-chunked dataset) -TOOLTEST h5fc_old.h5 -d /DSET_NDATA_BT1 -TOOLTEST h5fc_all.h5 -d /GROUP/DSET_NON_CHUNKED +# h5format_convert -d /DSET_NDATA_BT1 h5fc_v1.h5 (v1-btree dataset) +# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_non_v3.h5 (non-chunked dataset) +TOOLTEST h5fc_v1.h5 -d /DSET_NDATA_BT1 +TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_NON_CHUNKED # # # # No output from tests: just check exit code -# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_all.h5 (noop, one dataset) -# h5format_convert -n h5fc_all.h5 (noop, all datasets) -TOOLTEST h5fc_all.h5 -d /GROUP/DSET_BT2 -n -TOOLTEST h5fc_all.h5 -n +# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset) +# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets) +TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n +TOOLTEST h5fc_non_v3.h5 -n # # # # No output from tests: just check exit code -# h5format_convert h5fc_all.h5 +# h5format_convert h5fc_non_v3.h5 # 1) convert all datasets # 2) verify indexing types -TOOLTEST h5fc_all.h5 -IDX_CHECK /DSET_NDATA_BT1 +TOOLTEST h5fc_non_v3.h5 IDX_CHECK /DSET_NDATA_EA -IDX_CHECK /GROUP/DSET_BT1 +IDX_CHECK /DSET_NDATA_BT2 IDX_CHECK /GROUP/DSET_BT2 +IDX_CHECK /GROUP/DSET_EA # # # # No output from test: just check exit code -# h5format_convert h5fc_edge.h5 +# h5format_convert h5fc_edge_v3.h5 # 1) convert the chunked dataset (filter, no-filter-edge-chunk) # 2) verify the indexing type -TOOLTEST h5fc_edge.h5 +TOOLTEST h5fc_edge_v3.h5 IDX_CHECK /DSET_EDGE # # diff --git a/tools/misc/clear_open_chk.c b/tools/misc/clear_open_chk.c index 4256da0..f3e6ba3 100644 --- a/tools/misc/clear_open_chk.c +++ b/tools/misc/clear_open_chk.c @@ -55,7 +55,7 @@ main(int argc, char *argv[]) fname = HDstrdup(argv[1]); /* Try opening the file */ - if((fid = h5tools_fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { + if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { HDfprintf(stderr, "clear_open_chk: unable to open the file\n"); return EXIT_FAILURE; } diff --git a/tools/misc/h5clear_gentest.c b/tools/misc/h5clear_gentest.c index 1468432..062e938 100644 --- a/tools/misc/h5clear_gentest.c +++ b/tools/misc/h5clear_gentest.c @@ -17,19 +17,13 @@ /* The HDF5 test files */ const char *FILENAME[] = { - "h5clear_sec2.h5", /* 0 -- sec2 file */ - "h5clear_core.h5", /* 1 -- core file */ - "h5clear_fam_%05d.h5", /* 2 -- family files */ - "h5clear_split", /* 3 -- split files */ - "h5clear_invalid.h5" /* 4 -- sec2 file with invalid superblock version */ + "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ + "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ + "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ + "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ }; -#define FAMILY_SIZE 1024U -#define CORE_INCREMENT 1024U - -#define SUPER_VERS_OFF 8 -#define SUPER_VERS_SIZE 1 -#define SUPER_VERS_LATEST 2 +#define KB 1024U /*------------------------------------------------------------------------- * Function: main @@ -37,11 +31,15 @@ const char *FILENAME[] = { * Purpose: To create HDF5 files with non-zero status_flags in the superblock * via flushing and exiting without closing the library. * - * Due to file locking, status_flag in the superblock will be + * Due to file locking, status_flags in the superblock will be * nonzero after H5Fcreate. The library will clear status_flags * on file closing. This program, after "H5Fcreate" the files, * exits without going through library closing. Thus, status_flags - * for these files are not cleared and users cannot open them. + * for these files are not cleared. + * The library will check consistency of status_flags when opening + * a file with superblock >= v3 and will return error accordingly. + * The library will not check status_flags when opening a file + * with < v3 superblock. * * These files are used by "h5clear" to see if the tool clears * status_flags properly so users can open the files afterwards. @@ -57,6 +55,7 @@ int main(void) { hid_t fid; /* File ID */ + hid_t fcpl; /* File creation property list */ hid_t fapl, new_fapl; /* File access property lists */ char fname[512]; /* File name */ unsigned new_format; /* To use latest library format or not */ @@ -75,7 +74,7 @@ main(void) if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - /* Create file with/without latest library format */ + /* Files created within this for loop will have v3 superblock and nonzero status_flags */ for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t fapl2, my_fapl; /* File access property lists */ @@ -91,7 +90,7 @@ main(void) goto error; /* Create the file */ sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ @@ -103,19 +102,19 @@ main(void) goto error; /* - * Create a core file + * Create a log file */ /* Create a copy of file access property list */ if((my_fapl = H5Pcopy(fapl2)) < 0) goto error; - /* Setup the fapl for the family file driver */ - if(H5Pset_fapl_core(my_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) + /* Setup the fapl for the log driver */ + if(H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0) goto error; /* Create the file */ sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ @@ -126,104 +125,44 @@ main(void) if(H5Pclose(my_fapl) < 0) goto error; - /* - * Create a family file - */ - /* Create a copy of file access property list */ - if((my_fapl = H5Pcopy(fapl2)) < 0) - goto error; - - /* Setup the fapl for the family file driver */ - if(H5Pset_fapl_family(my_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) - goto error; - - /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[2]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - goto error; - - /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - goto error; - - /* Close the property list */ - if(H5Pclose(my_fapl) < 0) - goto error; + } /* end for */ - /* - * Create a split file - */ - /* Create a copy of file access property list */ - my_fapl = H5Pcopy(fapl2); + /* + * Create a sec2 file with v0 superblock but nonzero status_flags + */ + if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; - /* Setup the fapl for the split file driver */ - H5Pset_fapl_split(my_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); + /* Flush the file */ + if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + goto error; - /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[3]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - goto error; - /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - goto error; + /* + * Create a sec2 file with v2 superblock but nonzero status_flags + */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + goto error; + if(H5Pset_shared_mesg_nindexes(fcpl, 1) < 0) + goto error; + if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0) + goto error; - /* Close the property list */ - if(H5Pclose(my_fapl) < 0) - goto error; + if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + goto error; - /* - * Create a sec2 file but change its superblock version # - */ - /* Create a copy of file access property list */ - if((my_fapl = H5Pcopy(fapl2)) < 0) - goto error; - /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[4]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - goto error; + /* Flush the file */ + if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) + goto error; - /* Flush the file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - goto error; - /* Close the property list */ - if(H5Pclose(my_fapl) < 0) - goto error; - - /* Open the test file via system call "open" */ - if((fd = HDopen(fname, O_RDWR, 0666)) < 0) { - HDfprintf(stdout, "cannot open the file\n"); - goto error; - } - - /* Position the file to superblock version via system call "lseek" */ - if(HDlseek(fd, (off_t)SUPER_VERS_OFF, SEEK_SET) < 0) { - HDfprintf(stdout, "cannot lseek the file superblock version\n"); - goto error; - } - - /* Change to an incorrect superblock version */ - super_vers = SUPER_VERS_LATEST + 1; - /* Write to the file via system call "write" */ - if((bytes_written = HDwrite(fd, &super_vers, (size_t)SUPER_VERS_SIZE)) < 0) { - HDfprintf(stdout, "cannot write to the file with incorrect superblock version\n"); - goto error; - } - - /* Close the file via system call "close" */ - if(HDclose(fd) < 0) { - HDfprintf(stdout, "cannot close the file\n"); - goto error; - } - - } /* end for */ - /* Close the property lists */ if(H5Pclose(fapl) < 0) goto error; if(H5Pclose(new_fapl) < 0) goto error; + if(H5Pclose(fcpl) < 0) + goto error; fflush(stdout); fflush(stderr); diff --git a/tools/misc/testh5clear.sh.in b/tools/misc/testh5clear.sh.in index 0e3a48b..aeac03e 100644 --- a/tools/misc/testh5clear.sh.in +++ b/tools/misc/testh5clear.sh.in @@ -43,55 +43,46 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' } -# Algorithm: -# Try to open the test file--should fail -# Use "h5clear" to clear the status_flags in the test file -# Try to open the test file again--should succeed -# $1 is the filename to H5Fopen() via h5clear +# (1) Use "h5clear" to clear the status_flags in the test file +# (2) Open the test file via "clear_open_chk" +# $1 is the filename for testing TOOLTEST() { TESTING $H5CLEAR $1 fname=$1 - # - # Try to open the test file - $OPENCHK_BIN $fname 2>/dev/null # should fail; ignore error message - if test $? -eq $SUCCEED; then - echo ".....$OPENCHK: should fail" - nerrors=`expr $nerrors + 1` + # Use "h5clear" to clear the status_flags in the test file + $RUNSERIAL $H5CLEAR_BIN $fname + if test $? -ne $SUCCEED; then + echo ".....$H5CLEAR: should succeed" + nerrors=`expr $nerrors + 1` else - # Run h5clear to clear the status_flags in the test file - $RUNSERIAL $H5CLEAR_BIN $fname + # Open the test file via "clear_open_chk" + $OPENCHK_BIN $fname if test $? -ne $SUCCEED; then - echo ".....$H5CLEAR: should succeed" + echo "......$OPENCHK: should succeed" nerrors=`expr $nerrors + 1` else - # Try to open the test file again - $OPENCHK_BIN $fname - if test $? -ne $SUCCEED; then - echo "......$OPENCHK: should succeed" - nerrors=`expr $nerrors + 1` - else - echo "PASSED" - fi + echo "PASSED" fi fi } -# The input file has an incorrect superblock version # -# Algorithm: -# Use "h5clear" to clear status_flags in the test file--should fail to open the file -# $1 is the filename to H5Fopen() via h5clear -TOOLFAIL() { - TESTING $H5CLEAR $1 + + +# Use "clear_open_chk" to check if the file open succeeds or fails +# $1 is the filename to open +# $2 is the expected return from "clear_open_chk" +OPENCHK() { fname=$1 - # Run h5clear to clear the status_flags in the test file - $RUNSERIAL $H5CLEAR_BIN $fname 2>/dev/null # should fail: ignore error message - if test $? -eq $SUCCEED; then - echo ".....$H5CLEAR: should fail" - nerrors=`expr $nerrors + 1` - else - echo "PASSED" + expected=$2 + # + $OPENCHK_BIN $fname 2>/dev/null + actual=$? + if test $actual -ne $expected; then + echo "Unexpected return from $OPENCHK" + nerrors=`expr $nerrors + 1` fi } + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -103,21 +94,27 @@ if test $? -ne 0; then # Error returned from generating test files echo "$GENTEST: .....fail in generating test files" nerrors=`expr $nerrors + 1` else - TOOLTEST h5clear_sec2.h5 - TOOLTEST h5clear_core.h5 - TOOLTEST h5clear_fam_%05d.h5 - TOOLTEST h5clear_split + # Initial file open fails + # After "h5clear" the file, the subsequent file open succeeds + OPENCHK h5clear_sec2_v3.h5 $FAIL + TOOLTEST h5clear_sec2_v3.h5 + # + OPENCHK h5clear_log_v3.h5 $FAIL + TOOLTEST h5clear_log_v3.h5 + # + OPENCHK latest_h5clear_sec2_v3.h5 $FAIL + TOOLTEST latest_h5clear_sec2_v3.h5 + # + OPENCHK latest_h5clear_log_v3.h5 $FAIL + TOOLTEST latest_h5clear_log_v3.h5 +fi # -# files created with latest library format - TOOLTEST latest_h5clear_sec2.h5 - TOOLTEST latest_h5clear_core.h5 - TOOLTEST latest_h5clear_fam_%05d.h5 - TOOLTEST latest_h5clear_split # -# files created with incorrect superblock version # -TOOLFAIL h5clear_invalid.h5 -TOOLFAIL latest_h5clear_invalid.h5 -fi +# File open succeeds because the library does not check status_flags for file with < v3 superblock +OPENCHK h5clear_sec2_v0.h5 $SUCCEED +TOOLTEST h5clear_sec2_v0.h5 +OPENCHK h5clear_sec2_v2.h5 $SUCCEED +TOOLTEST h5clear_sec2_v2.h5 # # Clean up test files if test -z "$HDF5_NOCLEANUP"; then |