summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c17
-rw-r--r--tools/lib/h5tools.c8
-rw-r--r--tools/lib/h5tools.h1
-rw-r--r--tools/src/h5diff/h5diff_common.c58
-rw-r--r--tools/src/h5dump/h5dump.c61
-rw-r--r--tools/src/h5repack/h5repack_main.c28
-rw-r--r--tools/test/h5diff/CMakeTests.cmake23
-rw-r--r--tools/test/h5diff/h5diffgentest.c729
-rw-r--r--tools/test/h5diff/testfiles/h5diff_900.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_901.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_902.txt30
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5bin0 -> 2112 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onionbin0 -> 1270 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5bin0 -> 6064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onionbin0 -> 10319 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_objs.h5bin0 -> 6064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onionbin0 -> 24995 bytes
-rw-r--r--tools/test/h5diff/testh5diff.sh.in18
-rw-r--r--tools/test/h5dump/CMakeTests.cmake20
-rw-r--r--tools/test/h5dump/h5dumpgentest.c677
-rw-r--r--tools/test/h5dump/testh5dump.sh.in16
-rw-r--r--tools/test/h5repack/CMakeTests.cmake55
-rw-r--r--tools/test/h5repack/h5repack.sh.in64
-rw-r--r--tools/test/h5repack/testfiles/onion.tst_onion_dset_1d.h5.ddl11
-rw-r--r--tools/test/h5repack/testfiles/onion.tst_onion_dset_ext.h5.ddl18
-rw-r--r--tools/test/h5repack/testfiles/onion.tst_onion_objs.h5.ddl24
-rw-r--r--tools/testfiles/tst_onion_dset_1d.ddl12
-rw-r--r--tools/testfiles/tst_onion_dset_1d.h5bin0 -> 2112 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_1d.h5.onionbin0 -> 1270 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_ext.ddl19
-rw-r--r--tools/testfiles/tst_onion_dset_ext.h5bin0 -> 6064 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_ext.h5.onionbin0 -> 10319 bytes
-rw-r--r--tools/testfiles/tst_onion_objs.ddl22
-rw-r--r--tools/testfiles/tst_onion_objs.h5bin0 -> 6064 bytes
-rw-r--r--tools/testfiles/tst_onion_objs.h5.onionbin0 -> 24995 bytes
-rw-r--r--tools/testfiles/tst_onion_revision_count.ddl1
36 files changed, 1908 insertions, 33 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 7eb17ba..0bad3fe 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -648,8 +648,15 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*-------------------------------------------------------------------------
*/
/* open file 1 */
+ if (opts->vfd_info[0].u.name) {
+ if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[0]))) < 0) {
+ parallel_print("h5diff: unable to create fapl for input file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
+ }
+ }
+
if (opts->custom_vol[0] || opts->custom_vfd[0]) {
- if ((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL,
+ if ((fapl1_id = h5tools_get_fapl(fapl1_id, opts->custom_vol[0] ? &(opts->vol_info[0]) : NULL,
opts->custom_vfd[0] ? &(opts->vfd_info[0]) : NULL)) < 0) {
parallel_print("h5diff: unable to create fapl for input file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
@@ -664,9 +671,15 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("file1_id = %s", fname1);
/* open file 2 */
+ if (opts->vfd_info[1].u.name) {
+ if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, NULL, &(opts->vfd_info[1]))) < 0) {
+ parallel_print("h5diff: unable to create fapl for output file\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
+ }
+ }
if (opts->custom_vol[1] || opts->custom_vfd[1]) {
- if ((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL,
+ if ((fapl2_id = h5tools_get_fapl(fapl2_id, opts->custom_vol[1] ? &(opts->vol_info[1]) : NULL,
opts->custom_vfd[1] ? &(opts->vfd_info[1]) : NULL)) < 0) {
parallel_print("h5diff: unable to create fapl for output file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 93886d2..9c4f746 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -85,6 +85,7 @@ const char *drivernames[] = {
[WINDOWS_VFD_IDX] = "windows", [STDIO_VFD_IDX] = "stdio", [CORE_VFD_IDX] = "core",
[FAMILY_VFD_IDX] = "family", [SPLIT_VFD_IDX] = "split", [MULTI_VFD_IDX] = "multi",
[MPIO_VFD_IDX] = "mpio", [ROS3_VFD_IDX] = "ros3", [HDFS_VFD_IDX] = "hdfs",
+ [ONION_VFD_IDX] = "onion",
};
#define NUM_VOLS (sizeof(volnames) / sizeof(volnames[0]))
@@ -573,6 +574,13 @@ h5tools_set_fapl_vfd(hid_t fapl_id, h5tools_vfd_info_t *vfd_info)
H5TOOLS_GOTO_ERROR(FAIL, "The HDFS VFD is not enabled");
#endif
}
+ else if (!HDstrcmp(vfd_info->u.name, drivernames[ONION_VFD_IDX])) {
+ /* Onion driver */
+ if (!vfd_info->info)
+ H5TOOLS_GOTO_ERROR(FAIL, "Onion VFD info is invalid");
+ if (H5Pset_fapl_onion(fapl_id, (const H5FD_onion_fapl_info_t *)vfd_info->info) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_onion() failed");
+ }
else {
/*
* Try to load VFD plugin.
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 0620791..6561b68 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -600,6 +600,7 @@ typedef enum {
MPIO_VFD_IDX,
ROS3_VFD_IDX,
HDFS_VFD_IDX,
+ ONION_VFD_IDX,
} driver_idx;
/* The following include, h5tools_str.h, must be after the
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 433f0c7..87c08be 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -56,6 +56,28 @@ static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
{"vfd-info-2", require_arg, 'Z'},
{NULL, 0, '\0'}};
+static H5FD_onion_fapl_info_t onion_fa_g_1 = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "first input file", /* comment */
+};
+
+static H5FD_onion_fapl_info_t onion_fa_g_2 = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "second input file", /* comment */
+};
+
/*-------------------------------------------------------------------------
* Function: check_options
*
@@ -451,7 +473,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
case '8':
opts->vfd_info[0].type = VFD_BY_NAME;
opts->vfd_info[0].u.name = H5_optarg;
- opts->custom_vol[0] = TRUE;
+ opts->custom_vfd[0] = TRUE;
break;
case '9':
@@ -476,6 +498,40 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
}
}
+ /* If file 1 uses the onion VFD, get the revision number */
+ if (opts->vfd_info[0].u.name && !HDstrcmp(opts->vfd_info[0].u.name, "onion")) {
+ if (opts->vfd_info[0].info) {
+ errno = 0;
+ onion_fa_g_1.revision_num = HDstrtoull(opts->vfd_info[0].info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified for file 1\n");
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ }
+ else
+ onion_fa_g_1.revision_num = 0;
+
+ opts->vfd_info[0].info = &onion_fa_g_1;
+ }
+
+ /* If file 2 uses the onion VFD, get the revision number */
+ if (opts->vfd_info[1].u.name && !HDstrcmp(opts->vfd_info[1].u.name, "onion")) {
+ if (opts->vfd_info[1].info) {
+ errno = 0;
+ onion_fa_g_2.revision_num = HDstrtoull(opts->vfd_info[1].info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified for file 2\n");
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
+ }
+ else
+ onion_fa_g_2.revision_num = 0;
+
+ opts->vfd_info[1].info = &onion_fa_g_2;
+ }
+
/* check options */
check_options(opts);
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index be68a47..3de1fbb 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -23,10 +23,13 @@ static hbool_t doxml_g = FALSE;
static hbool_t useschema_g = TRUE;
static const char *xml_dtd_uri_g = NULL;
-static hbool_t use_custom_vol_g = FALSE;
-static hbool_t use_custom_vfd_g = FALSE;
-static h5tools_vol_info_t vol_info_g = {0};
-static h5tools_vfd_info_t vfd_info_g = {0};
+static hbool_t use_custom_vol_g = FALSE;
+static hbool_t use_custom_vfd_g = FALSE;
+
+static h5tools_vol_info_t vol_info_g = {0};
+static h5tools_vfd_info_t vfd_info_g = {0};
+
+static hbool_t get_onion_revision_count = FALSE;
#ifdef H5_HAVE_ROS3_VFD
/* Default "anonymous" S3 configuration */
@@ -51,6 +54,17 @@ static H5FD_hdfs_fapl_t hdfs_fa_g = {
};
#endif /* H5_HAVE_LIBHDFS */
+static H5FD_onion_fapl_info_t onion_fa_g = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "input file", /* comment */
+};
+
/* module-scoped variables for XML option */
#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
#define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd"
@@ -1305,6 +1319,29 @@ end_collect:
}
}
+ /* If the file uses the onion VFD, get the revision number */
+ if (vfd_info_g.u.name && !HDstrcmp(vfd_info_g.u.name, "onion")) {
+
+ if (vfd_info_g.info) {
+ if (!HDstrcmp(vfd_info_g.info, "revision_count"))
+ get_onion_revision_count = TRUE;
+ else {
+ errno = 0;
+ onion_fa_g.revision_num = HDstrtoull(vfd_info_g.info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified\n");
+ goto error;
+ }
+
+ HDprintf("Using revision %" PRIu64 "\n", onion_fa_g.revision_num);
+ }
+ }
+ else
+ onion_fa_g.revision_num = 0;
+
+ vfd_info_g.info = &onion_fa_g;
+ }
+
parse_end:
/* check for file name to be processed */
if (argc <= H5_optind) {
@@ -1424,7 +1461,21 @@ main(int argc, char *argv[])
while (H5_optind < argc) {
fname = HDstrdup(argv[H5_optind++]);
- fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
+ /* A short cut to get the revision count of an onion file without opening the file */
+ if (get_onion_revision_count && H5FD_ONION == H5Pget_driver(fapl_id)) {
+ uint64_t revision_count = 0;
+
+ if (H5FDonion_get_revision_count(fname, fapl_id, &revision_count) < 0) {
+ error_msg("unable to create FAPL for file access\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
+ HDprintf("The number of revisions for the onion file is %" PRIu64 "\n", revision_count);
+ goto done;
+ }
+ else
+ fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id != H5P_DEFAULT), NULL, 0);
if (fid < 0) {
error_msg("unable to open file \"%s\"\n", fname);
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index a805b3d..0d3bc9a 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -76,6 +76,17 @@ static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
{"dst-vfd-info", require_arg, 'Z'},
{NULL, 0, '\0'}};
+static H5FD_onion_fapl_info_t onion_fa_in_g = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5P_DEFAULT, /* backing_fapl_id */
+ 32, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation_flags */
+ "input file", /* comment */
+};
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -875,6 +886,23 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
ret_value = -1;
}
+ /* If the input file uses the onion VFD, get the revision number */
+ if (in_vfd_info.u.name && !HDstrcmp(in_vfd_info.u.name, "onion")) {
+ if (in_vfd_info.info) {
+ errno = 0;
+ onion_fa_in_g.revision_num = HDstrtoull(in_vfd_info.info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified for the input file\n");
+ usage(h5tools_getprogname());
+ exit(EXIT_FAILURE);
+ }
+ }
+ else
+ onion_fa_in_g.revision_num = 0;
+
+ in_vfd_info.info = &onion_fa_in_g;
+ }
+
/* Setup FAPL for input and output file accesses */
if (custom_in_vol || custom_in_vfd) {
if ((tmp_fapl = h5tools_get_fapl(options->fin_fapl, custom_in_vol ? &in_vol_info : NULL,
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index 8e01605..21761c6 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -70,6 +70,13 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings2.h5
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps1.h5
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps2.h5
+ # onion VFD files
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_objs.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_objs.h5.onion
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_dset_ext.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_dset_ext.h5.onion
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_dset_1d.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_onion_dset_1d.h5.onion
# tools/testfiles/vds
${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5
${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5
@@ -295,6 +302,9 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_900.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_901.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_902.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_reg.txt
@@ -932,6 +942,12 @@
h5diff_8639.out.err
h5diff_90.out
h5diff_90.out.err
+ h5diff_900.out
+ h5diff_900.out.err
+ h5diff_901.out
+ h5diff_901.out.err
+ h5diff_902.out
+ h5diff_902.out.err
h5diff_v1.out
h5diff_v1.out.err
h5diff_v2.out
@@ -1563,6 +1579,13 @@ ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2})
ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2})
ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2})
+# ##############################################################################
+# # onion VFD tests (serial only)
+# ##############################################################################
+ADD_SH5_TEST (h5diff_900 1 -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_objs.h5 h5diff_onion_objs.h5)
+ADD_SH5_TEST (h5diff_901 0 -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_ext.h5 h5diff_onion_dset_ext.h5)
+ADD_SH5_TEST (h5diff_902 1 -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_1d.h5 h5diff_onion_dset_1d.h5)
+
##############################################################################
### P L U G I N T E S T S
##############################################################################
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index f388568..a66a7b8 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -38,30 +38,34 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
*-------------------------------------------------------------------------
*/
-#define FILE1 "h5diff_basic1.h5"
-#define FILE2 "h5diff_basic2.h5"
-#define FILE3 "h5diff_types.h5"
-#define FILE4 "h5diff_dtypes.h5"
-#define FILE5 "h5diff_attr1.h5"
-#define FILE6 "h5diff_attr2.h5"
-#define FILE6a "h5diff_attr3.h5"
-#define FILE7 "h5diff_dset1.h5"
-#define FILE8 "h5diff_dset2.h5"
-#define FILE8A "h5diff_dset3.h5"
-#define FILE9 "h5diff_hyper1.h5"
-#define FILE10 "h5diff_hyper2.h5"
-#define FILE11 "h5diff_empty.h5"
-#define FILE12 "h5diff_links.h5"
-#define FILE13 "h5diff_softlinks.h5"
-#define FILE14 "h5diff_linked_softlink.h5"
-#define FILE15 "h5diff_extlink_src.h5"
-#define FILE16 "h5diff_extlink_trg.h5"
-#define FILE17 "h5diff_ext2softlink_src.h5"
-#define FILE18 "h5diff_ext2softlink_trg.h5"
-#define FILE19 "h5diff_dset_zero_dim_size1.h5"
-#define FILE20 "h5diff_dset_zero_dim_size2.h5"
-#define FILE21 "h5diff_dset_idx1.h5"
-#define FILE22 "h5diff_dset_idx2.h5"
+#define FILE1 "h5diff_basic1.h5"
+#define FILE2 "h5diff_basic2.h5"
+#define FILE3 "h5diff_types.h5"
+#define FILE4 "h5diff_dtypes.h5"
+#define FILE5 "h5diff_attr1.h5"
+#define FILE6 "h5diff_attr2.h5"
+#define FILE6a "h5diff_attr3.h5"
+#define FILE7 "h5diff_dset1.h5"
+#define FILE8 "h5diff_dset2.h5"
+#define FILE8A "h5diff_dset3.h5"
+#define FILE9 "h5diff_hyper1.h5"
+#define FILE10 "h5diff_hyper2.h5"
+#define FILE11 "h5diff_empty.h5"
+#define FILE12 "h5diff_links.h5"
+#define FILE13 "h5diff_softlinks.h5"
+#define FILE14 "h5diff_linked_softlink.h5"
+#define FILE15 "h5diff_extlink_src.h5"
+#define FILE16 "h5diff_extlink_trg.h5"
+#define FILE17 "h5diff_ext2softlink_src.h5"
+#define FILE18 "h5diff_ext2softlink_trg.h5"
+#define FILE19 "h5diff_dset_zero_dim_size1.h5"
+#define FILE20 "h5diff_dset_zero_dim_size2.h5"
+#define FILE21 "h5diff_dset_idx1.h5"
+#define FILE22 "h5diff_dset_idx2.h5"
+#define FILE23 "h5diff_onion_dset_1d.h5"
+#define FILE24 "h5diff_onion_objs.h5"
+#define FILE25 "h5diff_onion_dset_ext.h5"
+
#define DANGLE_LINK_FILE1 "h5diff_danglelinks1.h5"
#define DANGLE_LINK_FILE2 "h5diff_danglelinks2.h5"
#define GRP_RECURSE_FILE1 "h5diff_grp_recurse1.h5"
@@ -111,6 +115,11 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define SPACE1_DIM1 0
#define SPACE1_DIM2 0
+/* For Onion VFD */
+#define ONION_TEST_FIXNAME_SIZE 1024
+#define ONION_TEST_PAGE_SIZE (uint32_t)32
+#define ONE_DIM_SIZE 16
+
/* Error macros */
#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, __func__);
#define PROGRAM_ERROR \
@@ -179,6 +188,11 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2);
static void test_objs_strings(const char *fname, const char *fname2);
static void test_double_epsilon(const char *fname1, const char *fname2);
+/* Generate the files for testing Onion VFD */
+static int test_onion_1d_dset(const char *fname);
+static int test_onion_create_delete_objects(const char *fname);
+static int test_onion_dset_extension(const char *fname);
+
/* called by test_attributes() and test_datasets() */
static void write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
static void write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, int make_diffs);
@@ -298,9 +312,676 @@ main(void)
/* double dataset and epsilion. HDFFV-10897 */
test_double_epsilon(DIFF_EPS1, DIFF_EPS2);
+ /* Generate the files for testing Onion VFD */
+ test_onion_1d_dset(FILE23);
+ test_onion_create_delete_objects(FILE24);
+ test_onion_dset_extension(FILE25);
+
return EXIT_SUCCESS;
}
+/* Structure to collect the onion filepaths in one place. */
+struct onion_filepaths {
+ char *canon;
+ char *onion;
+ char *recovery;
+};
+
+/* Allocate and populate filepaths with h5_fixname'd strings as appropriate.
+ * Should be released with onion_filepaths_destroy() when done.
+ */
+static struct onion_filepaths *
+onion_filepaths_init(const char *basename)
+{
+ struct onion_filepaths *paths = NULL;
+
+ if (NULL == (paths = HDcalloc(1, sizeof(struct onion_filepaths))))
+ goto error;
+
+ if (NULL == (paths->canon = HDstrdup(basename)))
+ goto error;
+
+ if (NULL == (paths->onion = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE)))
+ goto error;
+ HDsnprintf(paths->onion, ONION_TEST_FIXNAME_SIZE, "%s.onion", paths->canon);
+
+ if (NULL == (paths->recovery = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE)))
+ goto error;
+ HDsnprintf(paths->recovery, ONION_TEST_FIXNAME_SIZE, "%s.onion.recovery", paths->canon);
+
+ return paths;
+
+error:
+ if (paths != NULL) {
+ HDfree(paths->canon);
+ HDfree(paths->onion);
+ HDfree(paths->recovery);
+ HDfree(paths);
+ }
+ return NULL;
+}
+
+static void
+onion_filepaths_destroy(struct onion_filepaths *s)
+{
+ if (s) {
+ HDfree(s->canon);
+ HDfree(s->onion);
+ HDfree(s->recovery);
+ HDfree(s);
+ }
+}
+
+static int
+test_onion_1d_dset(const char *fname)
+{
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[2] = {1, ONE_DIM_SIZE}, maxdims[2] = {1, ONE_DIM_SIZE};
+ int wdata[1][ONE_DIM_SIZE], /* Write buffer */
+ fillval;
+
+ hid_t fapl_id = H5I_INVALID_HID;
+ struct onion_filepaths *paths = NULL;
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+ hid_t file_id = H5I_INVALID_HID;
+
+ /* Setup */
+ onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(fname)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+ /* Initialize data */
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ wdata[0][i] = i;
+
+ /* Create a new file using the default properties */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create dataspace with unlimited dimensions */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /* Create the dataset creation property list */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ /* Set the fill value for the dataset */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /* Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the dataset using the dataset creation property list */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write the data to the dataset */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]) < 0)
+ goto error;
+
+ /* Close and release resources */
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ int dset_data[1][ONE_DIM_SIZE];
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ dset_data[0][i] = i + ONE_DIM_SIZE;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ dset_data[0][i] = i + 2048;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ /* CLEANUP */
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+ file_id = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Third revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ for (int i = 0; i < ONE_DIM_SIZE; i += 20)
+ dset_data[0][i] = i + 3072;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ /* CLEANUP */
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(onion_info.backing_fapl_id);
+ H5Pclose(fapl_id);
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY;
+
+ return -1;
+} /* test_onion_1d_dset */
+
+static int
+test_onion_create_delete_objects(const char *fname)
+{
+ struct onion_filepaths *paths = NULL;
+
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t attr_space_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+
+ hsize_t attr_dim[1] = {4};
+ hsize_t dims[2] = {4, 4};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk[2] = {4, 4};
+ int wdata[4][4]; /* Write buffer */
+
+ int fillval;
+
+ /* Set up */
+ if ((onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(fname)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+
+ /*
+ * Initialize data.
+ */
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ wdata[i][j] = i + j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Create dataspace with unlimited dimensions.
+ */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /*
+ * Create the dataset creation property list, and set the chunk
+ * size.
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
+ goto error;
+
+ /*
+ * Set the fill value for the dataset.
+ */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /*
+ * Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /*
+ * Create the dataset using the dataset creation property list.
+ */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Write the data to the dataset.
+ */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and add a dataset (DS2) to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /*
+ * Create the dataset using the dataset creation property list.
+ */
+ if ((dset = H5Dcreate2(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Write the data to the dataset.
+ */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and remove the dataset (DS2),
+ * which was added during the first revision.
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Ldelete(file, "DS2", H5P_DEFAULT) < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Third revision: open the file with Onion VFD and add an attribute to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Create dataspace for attribute */
+ attr_space_id = H5Screate_simple(1, attr_dim, NULL);
+
+ if ((attr_id =
+ H5Acreate2(file, "file_attribute", H5T_STD_I32LE, attr_space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if (H5Sclose(attr_space_id) < 0)
+ goto error;
+ if (H5Aclose(attr_id) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Fourth revision: open the file with Onion VFD and delete the attribute
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Adelete(file, "file_attribute") < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Fifth revision: open the file with Onion VFD and add a group to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((group_id = H5Gcreate2(file, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if (H5Gclose(group_id) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Sixth revision: open the file with Onion VFD and delete the newly added group
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Ldelete(file, "new_group", H5P_DEFAULT) < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*
+ * Close and release resources.
+ */
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+error:
+
+ if (paths != NULL) {
+ HDremove(paths->canon);
+ HDremove(paths->onion);
+ HDremove(paths->recovery);
+ onion_filepaths_destroy(paths);
+ }
+
+ if (dset != H5I_INVALID_HID)
+ (void)H5Dclose(dset);
+ if (file != H5I_INVALID_HID)
+ (void)H5Fclose(file);
+ if (fapl_id != H5I_INVALID_HID)
+ (void)H5Pclose(fapl_id);
+ if (onion_info.backing_fapl_id != H5I_INVALID_HID)
+ H5Pclose(onion_info.backing_fapl_id);
+
+ return -1;
+} /* test_onion_create_delete_objects */
+
+static int
+test_onion_dset_extension(const char *fname)
+{
+ hid_t fapl_id = H5I_INVALID_HID;
+ struct onion_filepaths *paths = NULL;
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset_space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hsize_t dims[2] = {4, 4}, maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}, chunk[2] = {4, 4};
+ hsize_t size[2], offset[2];
+ int wdata[4][4], /* Write buffer */
+ fillval;
+
+ /* Setup */
+ if ((onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(fname)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+ /* Initialize data */
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ wdata[i][j] = i + j;
+
+ /* Create a new file using the default properties */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create dataspace with unlimited dimensions */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /* Create the dataset creation property list, and set the chunk
+ * size.
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
+ goto error;
+
+ /* Set the fill value for the dataset */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /* Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the dataset using the dataset creation property list */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write the data to the dataset */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and extend the dataset
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Open the dataset */
+ if ((dset = H5Dopen2(file, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Extend the dataset and double the rows */
+ size[0] = 2 * dims[0];
+ size[1] = dims[1];
+ if (H5Dset_extent(dset, size) < 0)
+ goto error;
+
+ if ((dset_space = H5Dget_space(dset)) < 0)
+ goto error;
+
+ offset[0] = dims[0];
+ offset[1] = 0;
+ if (H5Sselect_hyperslab(dset_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0)
+ goto error;
+
+ /* Write the data to the dataset. */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, space, dset_space, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Sclose(dset_space) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and shrink the dataset
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Open the dataset */
+ if ((dset = H5Dopen2(file, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Extend the dataset and shrink back the size */
+ if (H5Dset_extent(dset, dims) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /* Close and release resources. */
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+error:
+
+ if (paths != NULL) {
+ HDremove(paths->canon);
+ HDremove(paths->onion);
+ HDremove(paths->recovery);
+ onion_filepaths_destroy(paths);
+ }
+
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dset);
+ H5Fclose(file);
+ H5Pclose(fapl_id);
+ H5Pclose(onion_info.backing_fapl_id);
+ }
+ H5E_END_TRY;
+
+ return -1;
+} /* test_onion_dset_extension */
+
/*-------------------------------------------------------------------------
* Function: test_basic
*
diff --git a/tools/test/h5diff/testfiles/h5diff_900.txt b/tools/test/h5diff/testfiles/h5diff_900.txt
new file mode 100644
index 0000000..eca7872
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_900.txt
@@ -0,0 +1,12 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /DS1
+ x /DS2
+
+group : </> and </>
+0 differences found
+dataset: </DS1> and </DS1>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_901.txt b/tools/test/h5diff/testfiles/h5diff_901.txt
new file mode 100644
index 0000000..eb1f7d9
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_901.txt
@@ -0,0 +1,17 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /DS1
+
+group : </> and </>
+0 differences found
+dataset: </DS1> and </DS1>
+Not comparable: </DS1> has rank 2, dimensions [4x4], max dimensions [18446744073709551615x18446744073709551615]
+and </DS1> has rank 2, dimensions [8x4], max dimensions [18446744073709551615x18446744073709551615]
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_902.txt b/tools/test/h5diff/testfiles/h5diff_902.txt
new file mode 100644
index 0000000..3863e16
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_902.txt
@@ -0,0 +1,30 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /DS1
+
+group : </> and </>
+0 differences found
+dataset: </DS1> and </DS1>
+size: [1x16] [1x16]
+position DS1 DS1 difference
+------------------------------------------------------------
+[ 0 0 ] 0 16 16
+[ 0 1 ] 1 17 16
+[ 0 2 ] 2 18 16
+[ 0 3 ] 3 19 16
+[ 0 4 ] 4 20 16
+[ 0 5 ] 5 21 16
+[ 0 6 ] 6 22 16
+[ 0 7 ] 7 23 16
+[ 0 8 ] 8 24 16
+[ 0 9 ] 9 25 16
+[ 0 10 ] 10 26 16
+[ 0 11 ] 11 27 16
+[ 0 12 ] 12 28 16
+[ 0 13 ] 13 29 16
+[ 0 14 ] 14 30 16
+[ 0 15 ] 15 31 16
+16 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5 b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5
new file mode 100644
index 0000000..5e53fba
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion
new file mode 100644
index 0000000..95893f2
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5 b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5
new file mode 100644
index 0000000..369ace6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion
new file mode 100644
index 0000000..291f9b3
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5 b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5
new file mode 100644
index 0000000..369ace6
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion
new file mode 100644
index 0000000..7811f83
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion
Binary files differ
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index 6871463..4d232a7 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -124,6 +124,12 @@ $SRC_H5DIFF_TESTFILES/h5diff_strings1.h5
$SRC_H5DIFF_TESTFILES/h5diff_strings2.h5
$SRC_H5DIFF_TESTFILES/h5diff_eps1.h5
$SRC_H5DIFF_TESTFILES/h5diff_eps2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_onion_objs.h5
+$SRC_H5DIFF_TESTFILES/h5diff_onion_objs.h5.onion
+$SRC_H5DIFF_TESTFILES/h5diff_onion_dset_ext.h5
+$SRC_H5DIFF_TESTFILES/h5diff_onion_dset_ext.h5.onion
+$SRC_H5DIFF_TESTFILES/h5diff_onion_dset_1d.h5
+$SRC_H5DIFF_TESTFILES/h5diff_onion_dset_1d.h5.onion
$SRC_TOOLS_TESTFILES/tvlstr.h5
"
@@ -356,6 +362,9 @@ $SRC_H5DIFF_TESTFILES/h5diff_800.txt
$SRC_H5DIFF_TESTFILES/h5diff_801.txt
$SRC_H5DIFF_TESTFILES/h5diff_830.txt
$SRC_H5DIFF_TESTFILES/h5diff_90.txt
+$SRC_H5DIFF_TESTFILES/h5diff_900.txt
+$SRC_H5DIFF_TESTFILES/h5diff_901.txt
+$SRC_H5DIFF_TESTFILES/h5diff_902.txt
$SRC_H5DIFF_TESTFILES/h5diff_8625.txt
$SRC_H5DIFF_TESTFILES/h5diff_8639.txt
$SRC_H5DIFF_TESTFILES/h5diff_reg.txt
@@ -1214,6 +1223,15 @@ TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5
TOOLTEST h5diff_v2.txt -r 1_vds.h5 2_vds.h5
TOOLTEST h5diff_v3.txt -c 1_vds.h5 2_vds.h5
+# ##############################################################################
+# Onion VFD tests
+# ##############################################################################
+# These tests won't pass under ph5diff
+if test -z "$pmode"; then
+ TOOLTEST h5diff_900.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_objs.h5 h5diff_onion_objs.h5
+ TOOLTEST h5diff_901.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_ext.h5 h5diff_onion_dset_ext.h5
+ TOOLTEST h5diff_902.txt -r -v --vfd-name-1 onion --vfd-info-1 0 --vfd-name-2 onion --vfd-info-2 1 h5diff_onion_dset_1d.h5 h5diff_onion_dset_1d.h5
+fi
# ##############################################################################
# # END
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 933aba9..4fa9a8f 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -211,6 +211,11 @@
${HDF5_TOOLS_DIR}/testfiles/trefer_paramR.ddl
${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1dR.ddl
${HDF5_TOOLS_DIR}/testfiles/trefer_regR.ddl
+ # Onion VFD files
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_objs.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_ext.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_1d.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_revision_count.ddl
)
set (HDF5_N_REFERENCE_FILES
tall-3
@@ -350,7 +355,13 @@
${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5
${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5
${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5
-
+ # Onion VFD files
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_objs.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_objs.h5.onion
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_ext.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_ext.h5.onion
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_1d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_1d.h5.onion
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err
@@ -1187,6 +1198,13 @@
ADD_H5_TEST (tCVE_2018_11206_fill_old 1 tCVE_2018_11206_fill_old.h5)
ADD_H5_TEST (tCVE_2018_11206_fill_new 1 tCVE_2018_11206_fill_new.h5)
+ # onion VFD tests
+ ADD_H5_TEST (tst_onion_objs 0 --enable-error-stack --vfd-name onion --vfd-info 3 tst_onion_objs.h5)
+ ADD_H5_TEST (tst_onion_dset_ext 0 --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_ext.h5)
+ ADD_H5_TEST (tst_onion_dset_1d 0 --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_1d.h5)
+ ADD_H5_TEST (tst_onion_revision_count 0 --enable-error-stack --vfd-name onion --vfd-info revision_count tst_onion_objs.h5)
+
+
##############################################################################
### P L U G I N T E S T S
##############################################################################
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 30e0c46..08f241c 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -117,6 +117,13 @@
#define FILE87 "tintsnodata.h5"
#define FILE88 "tldouble_scalar.h5"
#define FILE89 "tfloatsattrs.h5"
+#define FILE90 "tst_onion_dset_1d.h5"
+#define FILE91 "tst_onion_objs.h5"
+#define FILE92 "tst_onion_dset_ext.h5"
+
+#define ONION_TEST_FIXNAME_SIZE 1024
+#define ONION_TEST_PAGE_SIZE (uint32_t)32
+#define ONE_DIM_SIZE 16
/*-------------------------------------------------------------------------
* prototypes
@@ -11350,6 +11357,671 @@ error:
H5E_END_TRY;
} /* gen_err_attr_dspace() */
+/* Structure to collect the onion filepaths in one place. */
+struct onion_filepaths {
+ char *canon;
+ char *onion;
+ char *recovery;
+};
+
+/* Allocate and populate filepaths with h5_fixname'd strings as appropriate.
+ * Should be released with onion_filepaths_destroy() when done.
+ */
+static struct onion_filepaths *
+onion_filepaths_init(const char *basename)
+{
+ struct onion_filepaths *paths = NULL;
+
+ if (NULL == (paths = HDcalloc(1, sizeof(struct onion_filepaths))))
+ goto error;
+
+ if (NULL == (paths->canon = HDstrdup(basename)))
+ goto error;
+
+ if (NULL == (paths->onion = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE)))
+ goto error;
+ HDsnprintf(paths->onion, ONION_TEST_FIXNAME_SIZE, "%s.onion", paths->canon);
+
+ if (NULL == (paths->recovery = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE)))
+ goto error;
+ HDsnprintf(paths->recovery, ONION_TEST_FIXNAME_SIZE, "%s.onion.recovery", paths->canon);
+
+ return paths;
+
+error:
+ if (paths != NULL) {
+ HDfree(paths->canon);
+ HDfree(paths->onion);
+ HDfree(paths->recovery);
+ HDfree(paths);
+ }
+ return NULL;
+}
+
+static void
+onion_filepaths_destroy(struct onion_filepaths *s)
+{
+ if (s) {
+ HDfree(s->canon);
+ HDfree(s->onion);
+ HDfree(s->recovery);
+ HDfree(s);
+ }
+}
+
+static int
+gent_onion_1d_dset(void)
+{
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ struct onion_filepaths *paths = NULL;
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+ hsize_t dims[2] = {1, ONE_DIM_SIZE};
+ hsize_t maxdims[2] = {1, ONE_DIM_SIZE};
+ int wdata[1][ONE_DIM_SIZE];
+ int fillval;
+
+ /* Setup */
+ onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(FILE90)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+ /* Initialize data */
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ wdata[0][i] = i;
+
+ /* Create a new file using the default properties */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create dataspace with unlimited dimensions */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /* Create the dataset creation property list */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ /* Set the fill value for the dataset */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /* Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the dataset using the dataset creation property list */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write the data to the dataset */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata[0]) < 0)
+ goto error;
+
+ /* Close and release resources */
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ int dset_data[1][ONE_DIM_SIZE];
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ dset_data[0][i] = i + ONE_DIM_SIZE;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ for (int i = 0; i < ONE_DIM_SIZE; i++)
+ dset_data[0][i] = i + 2048;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ /* CLEANUP */
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+ file_id = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Third revision: open the file with Onion VFD and change the data
+ *----------------------------------------------------------------------
+ */
+ if ((file_id = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((dset = H5Dopen2(file_id, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ for (int i = 0; i < ONE_DIM_SIZE; i += 20)
+ dset_data[0][i] = i + 3072;
+
+ if (H5Dwrite(dset, H5T_STD_I32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data) < 0)
+ goto error;
+
+ /* CLEANUP */
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(onion_info.backing_fapl_id);
+ H5Pclose(fapl_id);
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Fclose(file_id);
+ }
+ H5E_END_TRY;
+
+ return -1;
+} /* gent_onion_1d_dset */
+
+static int
+gent_onion_create_delete_objects(void)
+{
+ struct onion_filepaths *paths = NULL;
+
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t attr_space_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+
+ hsize_t attr_dim[1] = {4};
+ hsize_t dims[2] = {4, 4};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk[2] = {4, 4};
+ int wdata[4][4];
+
+ int fillval;
+
+ /* Set up */
+ if ((onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(FILE91)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+
+ /*
+ * Initialize data.
+ */
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ wdata[i][j] = i + j;
+
+ /*
+ * Create a new file using the default properties.
+ */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Create dataspace with unlimited dimensions.
+ */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /*
+ * Create the dataset creation property list, and set the chunk
+ * size.
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
+ goto error;
+
+ /*
+ * Set the fill value for the dataset.
+ */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /*
+ * Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /*
+ * Create the dataset using the dataset creation property list.
+ */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Write the data to the dataset.
+ */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and add a dataset (DS2) to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /*
+ * Create the dataset using the dataset creation property list.
+ */
+ if ((dset = H5Dcreate2(file, "DS2", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /*
+ * Write the data to the dataset.
+ */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and remove the dataset (DS2),
+ * which was added during the first revision.
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Ldelete(file, "DS2", H5P_DEFAULT) < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Third revision: open the file with Onion VFD and add an attribute to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Create dataspace for attribute */
+ attr_space_id = H5Screate_simple(1, attr_dim, NULL);
+
+ if ((attr_id =
+ H5Acreate2(file, "file_attribute", H5T_STD_I32LE, attr_space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if (H5Sclose(attr_space_id) < 0)
+ goto error;
+ if (H5Aclose(attr_id) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Fourth revision: open the file with Onion VFD and delete the attribute
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Adelete(file, "file_attribute") < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Fifth revision: open the file with Onion VFD and add a group to the file
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if ((group_id = H5Gcreate2(file, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if (H5Gclose(group_id) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Sixth revision: open the file with Onion VFD and delete the newly added group
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ if (H5Ldelete(file, "new_group", H5P_DEFAULT) < 0)
+ goto error;
+
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*
+ * Close and release resources.
+ */
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+error:
+
+ if (paths != NULL) {
+ HDremove(paths->canon);
+ HDremove(paths->onion);
+ HDremove(paths->recovery);
+ onion_filepaths_destroy(paths);
+ }
+
+ if (dset != H5I_INVALID_HID)
+ (void)H5Dclose(dset);
+ if (file != H5I_INVALID_HID)
+ (void)H5Fclose(file);
+ if (fapl_id != H5I_INVALID_HID)
+ (void)H5Pclose(fapl_id);
+ if (onion_info.backing_fapl_id != H5I_INVALID_HID)
+ H5Pclose(onion_info.backing_fapl_id);
+
+ return -1;
+} /* gent_onion_create_delete_objects */
+
+static int
+gent_onion_dset_extension(void)
+{
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset_space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ struct onion_filepaths *paths = NULL;
+ H5FD_onion_fapl_info_t onion_info = {
+ H5FD_ONION_FAPL_INFO_VERSION_CURR,
+ H5I_INVALID_HID, /* backing_fapl_id */
+ ONION_TEST_PAGE_SIZE, /* page_size */
+ H5FD_ONION_STORE_TARGET_ONION, /* store_target */
+ H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST,
+ 0, /* force_write_open */
+ 0, /* creation flags, was H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT */
+ "initial commit" /* comment */
+ };
+ hsize_t dims[2] = {4, 4};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk[2] = {4, 4};
+ hsize_t size[2];
+ hsize_t offset[2];
+ int wdata[4][4]; /* Write buffer */
+ int fillval;
+
+ /* Setup */
+ if ((onion_info.backing_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ if (H5Pset_fapl_onion(fapl_id, &onion_info) < 0)
+ goto error;
+
+ if ((paths = onion_filepaths_init(FILE92)) == NULL)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * Create the skeleton file (create the file without Onion VFD)
+ *----------------------------------------------------------------------
+ */
+ /* Initialize data */
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ wdata[i][j] = i + j;
+
+ /* Create a new file using the default properties */
+ if ((file = H5Fcreate(paths->canon, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create dataspace with unlimited dimensions */
+ if ((space = H5Screate_simple(2, dims, maxdims)) < 0)
+ goto error;
+
+ /* Create the dataset creation property list, and set the chunk
+ * size.
+ */
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if (H5Pset_chunk(dcpl, 2, chunk) < 0)
+ goto error;
+
+ /* Set the fill value for the dataset */
+ fillval = 99;
+ if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
+ goto error;
+
+ /* Set the allocation time to "early". This way we can be sure
+ * that reading from the dataset immediately after creation will
+ * return the fill value.
+ */
+ if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
+ goto error;
+
+ /* Create the dataset using the dataset creation property list */
+ if ((dset = H5Dcreate2(file, "DS1", H5T_STD_I32LE, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write the data to the dataset */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ if (H5Fclose(file) < 0)
+ goto error;
+
+ /*----------------------------------------------------------------------
+ * First revision: open the file with Onion VFD and extend the dataset
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Open the dataset */
+ if ((dset = H5Dopen2(file, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Extend the dataset and double the rows */
+ size[0] = 2 * dims[0];
+ size[1] = dims[1];
+ if (H5Dset_extent(dset, size) < 0)
+ goto error;
+
+ if ((dset_space = H5Dget_space(dset)) < 0)
+ goto error;
+
+ offset[0] = dims[0];
+ offset[1] = 0;
+ if (H5Sselect_hyperslab(dset_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0)
+ goto error;
+
+ /* Write the data to the dataset. */
+ if (H5Dwrite(dset, H5T_NATIVE_INT, space, dset_space, H5P_DEFAULT, wdata) < 0)
+ goto error;
+
+ if (H5Sclose(dset_space) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /*----------------------------------------------------------------------
+ * Second revision: open the file with Onion VFD and shrink the dataset
+ *----------------------------------------------------------------------
+ */
+ if ((file = H5Fopen(paths->canon, H5F_ACC_RDWR, fapl_id)) < 0)
+ goto error;
+
+ /* Open the dataset */
+ if ((dset = H5Dopen2(file, "DS1", H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Extend the dataset and shrink back the size */
+ if (H5Dset_extent(dset, dims) < 0)
+ goto error;
+
+ if (H5Dclose(dset) < 0)
+ goto error;
+ dset = H5I_INVALID_HID;
+ if (H5Fclose(file) < 0)
+ goto error;
+ file = H5I_INVALID_HID;
+
+ /* Close and release resources. */
+ if (H5Pclose(onion_info.backing_fapl_id) < 0)
+ goto error;
+ if (H5Pclose(fapl_id) < 0)
+ goto error;
+ if (H5Pclose(dcpl) < 0)
+ goto error;
+ if (H5Sclose(space) < 0)
+ goto error;
+
+ onion_filepaths_destroy(paths);
+
+ return 0;
+error:
+
+ if (paths != NULL) {
+ HDremove(paths->canon);
+ HDremove(paths->onion);
+ HDremove(paths->recovery);
+ onion_filepaths_destroy(paths);
+ }
+
+ H5E_BEGIN_TRY
+ {
+ H5Dclose(dset);
+ H5Fclose(file);
+ H5Pclose(fapl_id);
+ H5Pclose(onion_info.backing_fapl_id);
+ }
+ H5E_END_TRY;
+
+ return -1;
+} /* gent_onion_dset_extension */
+
int
main(void)
{
@@ -11449,5 +12121,10 @@ main(void)
gent_err_attr_dspace();
+ /* Generate the files for testing Onion VFD */
+ gent_onion_1d_dset();
+ gent_onion_create_delete_objects();
+ gent_onion_dset_extension();
+
return 0;
}
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index f9f3734..ce7f643 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -184,6 +184,12 @@ $SRC_H5DUMP_TESTFILES/tvms.h5
$SRC_H5DUMP_TESTFILES/err_attr_dspace.h5
$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_old.h5
$SRC_H5DUMP_TESTFILES/tCVE_2018_11206_fill_new.h5
+$SRC_H5DUMP_TESTFILES/tst_onion_objs.h5
+$SRC_H5DUMP_TESTFILES/tst_onion_objs.h5.onion
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_ext.h5
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_ext.h5.onion
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_1d.h5
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_1d.h5.onion
"
LIST_OTHER_TEST_FILES="
@@ -372,6 +378,10 @@ $SRC_H5DUMP_TESTFILES/h5dump-help.txt
$SRC_H5DUMP_TESTFILES/out3.h5import
$SRC_H5DUMP_TESTFILES/tbinregR.exp
$SRC_H5DUMP_TESTFILES/err_attr_dspace.ddl
+$SRC_H5DUMP_TESTFILES/tst_onion_objs.ddl
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_ext.ddl
+$SRC_H5DUMP_TESTFILES/tst_onion_dset_1d.ddl
+$SRC_H5DUMP_TESTFILES/tst_onion_revision_count.ddl
"
LIST_ERROR_TEST_FILES="
@@ -1486,6 +1496,12 @@ TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5
TOOLTEST_FAIL tCVE_2018_11206_fill_old.h5
TOOLTEST_FAIL tCVE_2018_11206_fill_new.h5
+# test Onion VFD
+TOOLTEST tst_onion_objs.ddl --enable-error-stack --vfd-name onion --vfd-info 3 tst_onion_objs.h5
+TOOLTEST tst_onion_dset_ext.ddl --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_ext.h5
+TOOLTEST tst_onion_dset_1d.ddl --enable-error-stack --vfd-name onion --vfd-info 1 tst_onion_dset_1d.h5
+TOOLTEST tst_onion_revision_count.ddl --enable-error-stack --vfd-name onion --vfd-info revision_count tst_onion_objs.h5
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 09648ff..163bd00 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -122,6 +122,13 @@
${HDF5_TOOLS_DIR}/testfiles/vds/5_b.h5
${HDF5_TOOLS_DIR}/testfiles/vds/5_c.h5
${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5
+ # tools/testfiles onion VFD files
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_1d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_1d.h5.onion
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_ext.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_dset_ext.h5.onion
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_objs.h5
+ ${HDF5_TOOLS_DIR}/testfiles/tst_onion_objs.h5.onion
)
set (LIST_OTHER_TEST_FILES
@@ -446,6 +453,50 @@
endif ()
endmacro ()
+ macro (ADD_H5_DMP_NO_OPT_TEST testname testtype resultcode resultfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DMP-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}"
+ )
+ set_property(TEST H5REPACK_DMP-${testname} PROPERTY DISABLED)
+ endif ()
+ else ()
+ add_test (
+ NAME H5REPACK_DMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile}
+ )
+ set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES
+ FIXTURES_REQUIRED clear_h5repack
+ )
+ add_test (
+ NAME H5REPACK_DMP-${testname}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}
+ )
+ set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES
+ DEPENDS H5REPACK_DMP-${testname}-clear-objects
+ )
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DMP-h5dump-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=out-${testname}.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}-${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${testname}.${resultfile}.ddl"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES
+ DEPENDS "H5REPACK_DMP-${testname}"
+ )
+ endif ()
+ endif ()
+ endmacro ()
+
macro (ADD_H5_DIFF_TEST testname testtype resultcode testfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -1665,6 +1716,10 @@ ADD_H5_DMP_TEST (textlink-mergeprune "TEST" 0 textlink.h5 --merge --prune --enab
### HDFFV-11128 needs fixed to enable the following test
#ADD_H5_DMP_TEST (textlinktar-mergeprune "TEST" 0 textlinktar.h5 --merge --prune --enable-error-stack)
+ADD_H5_DMP_NO_OPT_TEST (tst_onion_dset_1d "TEST" 0 tst_onion_dset_1d.h5 --src-vfd-name onion --src-vfd-info 1)
+ADD_H5_DMP_NO_OPT_TEST (tst_onion_dset_ext "TEST" 0 tst_onion_dset_ext.h5 --src-vfd-name onion --src-vfd-info 1)
+ADD_H5_DMP_NO_OPT_TEST (tst_onion_objs "TEST" 0 tst_onion_objs.h5 --src-vfd-name onion --src-vfd-info 1)
+
##############################################################################
### P L U G I N T E S T S
##############################################################################
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index a241ea8..63d62bc 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -177,6 +177,13 @@ $SRC_TOOLS_TESTFILES/vds/5_a.h5
$SRC_TOOLS_TESTFILES/vds/5_b.h5
$SRC_TOOLS_TESTFILES/vds/5_c.h5
$SRC_TOOLS_TESTFILES/vds/5_vds.h5
+########tools/testfiles########
+$SRC_TOOLS_TESTFILES/tst_onion_dset_1d.h5
+$SRC_TOOLS_TESTFILES/tst_onion_dset_1d.h5.onion
+$SRC_TOOLS_TESTFILES/tst_onion_dset_ext.h5
+$SRC_TOOLS_TESTFILES/tst_onion_dset_ext.h5.onion
+$SRC_TOOLS_TESTFILES/tst_onion_objs.h5
+$SRC_TOOLS_TESTFILES/tst_onion_objs.h5.onion
"
LIST_OTHER_TEST_FILES="
@@ -251,6 +258,10 @@ $SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst
$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst
$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst
$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
+########onion#files########
+$SRC_H5REPACK_TESTFILES/onion.tst_onion_dset_1d.h5.ddl
+$SRC_H5REPACK_TESTFILES/onion.tst_onion_dset_ext.h5.ddl
+$SRC_H5REPACK_TESTFILES/onion.tst_onion_objs.h5.ddl
"
#
@@ -1130,6 +1141,56 @@ TOOLTEST_DUMP()
rm -f $outfile
}
+# This is same as TOOLTEST_DUMP() with comparing h5dump output
+# without any option
+#
+TOOLTEST_DUMP_NO_OPT()
+{
+ infile=$2
+ outfile=out-$1.$2
+ expect="$TESTDIR/$1.$2.ddl"
+ actual="$TESTDIR/out-$1.$2.out"
+ actual_err="$TESTDIR/out-$1.$2.err"
+
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5dump output $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DUMP_BIN $outfile
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ RET=$?
+
+ fi
+
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
# This is similar to TOOLTEST_DUMP().
# Test h5repack with options added for paged aggregation.
# h5stat is used on the repacked file and the expected output
@@ -1830,6 +1891,9 @@ TOOLTEST_DUMP textlink-mergeprune textlink.h5 --merge --prune --enable-error-sta
#TOOLTEST_DUMP textlinksrc-mergeprune textlinksrc.h5 --merge --prune --enable-error-stack
### HDFFV-11128 needs fixed to enable the following test
#TOOLTEST_DUMP textlinktar-mergeprune textlinktar.h5 --merge --prune --enable-error-stack
+TOOLTEST_DUMP_NO_OPT onion tst_onion_dset_1d.h5 --src-vfd-name onion --src-vfd-info 1
+TOOLTEST_DUMP_NO_OPT onion tst_onion_dset_ext.h5 --src-vfd-name onion --src-vfd-info 1
+TOOLTEST_DUMP_NO_OPT onion tst_onion_objs.h5 --src-vfd-name onion --src-vfd-info 1
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/testfiles/onion.tst_onion_dset_1d.h5.ddl b/tools/test/h5repack/testfiles/onion.tst_onion_dset_1d.h5.ddl
new file mode 100644
index 0000000..06ecf1a
--- /dev/null
+++ b/tools/test/h5repack/testfiles/onion.tst_onion_dset_1d.h5.ddl
@@ -0,0 +1,11 @@
+HDF5 "out-onion.tst_onion_dset_1d.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 1, 16 ) / ( 1, 16 ) }
+ DATA {
+ (0,0): 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/onion.tst_onion_dset_ext.h5.ddl b/tools/test/h5repack/testfiles/onion.tst_onion_dset_ext.h5.ddl
new file mode 100644
index 0000000..39c1900
--- /dev/null
+++ b/tools/test/h5repack/testfiles/onion.tst_onion_dset_ext.h5.ddl
@@ -0,0 +1,18 @@
+HDF5 "out-onion.tst_onion_dset_ext.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 8, 4 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 4,
+ (2,0): 2, 3, 4, 5,
+ (3,0): 3, 4, 5, 6,
+ (4,0): 0, 1, 2, 3,
+ (5,0): 1, 2, 3, 4,
+ (6,0): 2, 3, 4, 5,
+ (7,0): 3, 4, 5, 6
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/onion.tst_onion_objs.h5.ddl b/tools/test/h5repack/testfiles/onion.tst_onion_objs.h5.ddl
new file mode 100644
index 0000000..fa4ab4f
--- /dev/null
+++ b/tools/test/h5repack/testfiles/onion.tst_onion_objs.h5.ddl
@@ -0,0 +1,24 @@
+HDF5 "out-onion.tst_onion_objs.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 4 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 4,
+ (2,0): 2, 3, 4, 5,
+ (3,0): 3, 4, 5, 6
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 4 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 4,
+ (2,0): 2, 3, 4, 5,
+ (3,0): 3, 4, 5, 6
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tst_onion_dset_1d.ddl b/tools/testfiles/tst_onion_dset_1d.ddl
new file mode 100644
index 0000000..adca75f
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_1d.ddl
@@ -0,0 +1,12 @@
+Using revision 1
+HDF5 "tst_onion_dset_1d.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 1, 16 ) / ( 1, 16 ) }
+ DATA {
+ (0,0): 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tst_onion_dset_1d.h5 b/tools/testfiles/tst_onion_dset_1d.h5
new file mode 100644
index 0000000..5042ebf
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_1d.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_1d.h5.onion b/tools/testfiles/tst_onion_dset_1d.h5.onion
new file mode 100644
index 0000000..a86670e
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_1d.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_ext.ddl b/tools/testfiles/tst_onion_dset_ext.ddl
new file mode 100644
index 0000000..2405774
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_ext.ddl
@@ -0,0 +1,19 @@
+Using revision 1
+HDF5 "tst_onion_dset_ext.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 8, 4 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 4,
+ (2,0): 2, 3, 4, 5,
+ (3,0): 3, 4, 5, 6,
+ (4,0): 0, 1, 2, 3,
+ (5,0): 1, 2, 3, 4,
+ (6,0): 2, 3, 4, 5,
+ (7,0): 3, 4, 5, 6
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tst_onion_dset_ext.h5 b/tools/testfiles/tst_onion_dset_ext.h5
new file mode 100644
index 0000000..479aaa8
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_ext.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_ext.h5.onion b/tools/testfiles/tst_onion_dset_ext.h5.onion
new file mode 100644
index 0000000..b5cbdb4
--- /dev/null
+++ b/tools/testfiles/tst_onion_dset_ext.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_objs.ddl b/tools/testfiles/tst_onion_objs.ddl
new file mode 100644
index 0000000..c66275b
--- /dev/null
+++ b/tools/testfiles/tst_onion_objs.ddl
@@ -0,0 +1,22 @@
+Using revision 3
+HDF5 "tst_onion_objs.h5" {
+GROUP "/" {
+ ATTRIBUTE "file_attribute" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 0, 0, 0
+ }
+ }
+ DATASET "DS1" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 4, 4 ) / ( H5S_UNLIMITED, H5S_UNLIMITED ) }
+ DATA {
+ (0,0): 0, 1, 2, 3,
+ (1,0): 1, 2, 3, 4,
+ (2,0): 2, 3, 4, 5,
+ (3,0): 3, 4, 5, 6
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tst_onion_objs.h5 b/tools/testfiles/tst_onion_objs.h5
new file mode 100644
index 0000000..479aaa8
--- /dev/null
+++ b/tools/testfiles/tst_onion_objs.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_objs.h5.onion b/tools/testfiles/tst_onion_objs.h5.onion
new file mode 100644
index 0000000..4abc174
--- /dev/null
+++ b/tools/testfiles/tst_onion_objs.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_revision_count.ddl b/tools/testfiles/tst_onion_revision_count.ddl
new file mode 100644
index 0000000..4f2e1db
--- /dev/null
+++ b/tools/testfiles/tst_onion_revision_count.ddl
@@ -0,0 +1 @@
+The number of revisions for the onion file is 6