summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-08-16 19:20:34 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-08-16 19:20:34 (GMT)
commitdd327986b9d8137a1106c6f750712d68e5e27813 (patch)
tree3faafa475d5bba5a1cfd86021e71b37d9845c9bb /tools/h5stat
parentefb39881a0e4cc59799238a2c6758f41be780abc (diff)
downloadhdf5-dd327986b9d8137a1106c6f750712d68e5e27813.zip
hdf5-dd327986b9d8137a1106c6f750712d68e5e27813.tar.gz
hdf5-dd327986b9d8137a1106c6f750712d68e5e27813.tar.bz2
[svn-r24014] This checkin is a merge of the checkin for h5stat to the trunk (rev #23975-23977) + an additional bug fix--
A) Fix for HDFFV-1238: --Add 3 new options to allow users in setting threshold for small groups/datasets/attributes (tools/h5stat/h5stat.c) --Generate new test file for testing the new options (tools/h5stat/h5stat_gentest.c) --Add tests for the new options (tools/h5stat/testh5stat.sh.in) --Update expected output files (tools/h5stat/testfiles/*.ddl) B) Fix a bug in determining maximum dimension size for 1-D dataset in dataset_stats() (tools/h5stat/h5stat.c) C) Fix a bug when using opt_arg that is NULL for the new options.
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/h5stat.c175
-rw-r--r--tools/h5stat/h5stat_gentest.c320
-rw-r--r--tools/h5stat/testfiles/h5stat_dims1.ddl47
-rw-r--r--tools/h5stat/testfiles/h5stat_dims2.ddl38
-rw-r--r--tools/h5stat/testfiles/h5stat_err1_dims.ddl4
-rw-r--r--tools/h5stat/testfiles/h5stat_err1_links.ddl4
-rw-r--r--tools/h5stat/testfiles/h5stat_err1_numattrs.ddl4
-rw-r--r--tools/h5stat/testfiles/h5stat_err2_numattrs.ddl4
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-d.ddl6
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-dT.ddl6
-rw-r--r--tools/h5stat/testfiles/h5stat_filters-g.ddl4
-rw-r--r--tools/h5stat/testfiles/h5stat_filters.ddl12
-rw-r--r--tools/h5stat/testfiles/h5stat_help1.ddl9
-rw-r--r--tools/h5stat/testfiles/h5stat_help2.ddl9
-rw-r--r--tools/h5stat/testfiles/h5stat_links1.ddl13
-rw-r--r--tools/h5stat/testfiles/h5stat_links2.ddl96
-rw-r--r--tools/h5stat/testfiles/h5stat_links3.ddl15
-rw-r--r--tools/h5stat/testfiles/h5stat_links4.ddl11
-rw-r--r--tools/h5stat/testfiles/h5stat_links5.ddl12
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat-UA.ddl2
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat-UG.ddl2
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl24
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.h5bin6363081 -> 6367891 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_nofile.ddl27
-rw-r--r--tools/h5stat/testfiles/h5stat_numattrs1.ddl18
-rw-r--r--tools/h5stat/testfiles/h5stat_numattrs2.ddl96
-rw-r--r--tools/h5stat/testfiles/h5stat_numattrs3.ddl15
-rw-r--r--tools/h5stat/testfiles/h5stat_numattrs4.ddl11
-rw-r--r--tools/h5stat/testfiles/h5stat_threshold.h5bin0 -> 16312 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl12
-rw-r--r--tools/h5stat/testh5stat.sh.in66
31 files changed, 949 insertions, 113 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index 1201044..de36c19 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -26,13 +26,15 @@
#define PROGRAMNAME "h5stat"
/* Parameters to control statistics gathered */
-#define SIZE_SMALL_GROUPS 10
-#define SIZE_SMALL_ATTRS 10
-#define SIZE_SMALL_DSETS 10
-#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
- accommodate for user-define filters + one
- to accomodate datasets whithout any filters */
+/* Default threshold for small groups/datasets/attributes */
+#define DEF_SIZE_SMALL_GROUPS 10
+#define DEF_SIZE_SMALL_DSETS 10
+#define DEF_SIZE_SMALL_ATTRS 10
+
+#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
+ accommodate for user-define filters + one
+ to accomodate datasets whithout any filters */
@@ -60,22 +62,22 @@ typedef struct iter_t {
unsigned long max_links; /* Maximum # of links to an object */
hsize_t max_fanout; /* Maximum fanout from a group */
- unsigned long num_small_groups[SIZE_SMALL_GROUPS]; /* Size of small groups tracked */
+ unsigned long *num_small_groups; /* Size of small groups tracked */
unsigned group_nbins; /* Number of bins for group counts */
unsigned long *group_bins; /* Pointer to array of bins for group counts */
ohdr_info_t group_ohdr_info; /* Object header information for groups */
- hsize_t max_attrs; /* Maximum attributes from a group */
- unsigned long num_small_attrs[SIZE_SMALL_ATTRS]; /* Size of small attributes tracked */
+ hsize_t max_attrs; /* Maximum attributes from a group */
+ unsigned long *num_small_attrs; /* Size of small attributes tracked */
unsigned attr_nbins; /* Number of bins for attribute counts */
unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
unsigned max_dset_rank; /* Maximum rank of dataset */
unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */
hsize_t max_dset_dims; /* Maximum dimension size of dataset */
- unsigned long small_dset_dims[SIZE_SMALL_DSETS]; /* Size of dimensions of small datasets tracked */
+ unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
- unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
+ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */
unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
@@ -116,15 +118,19 @@ static int display_dset_metadata = FALSE; /* display file space info f
static int display_object = FALSE; /* not implemented yet */
+/* Initialize threshold for small groups/datasets/attributes */
+static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
+static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
+static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
+
/* a structure for handling the order command-line parameters come in */
struct handler_t {
size_t obj_count;
char **obj;
};
-
-static const char *s_opts ="ADdFfhGgSTO:V";
-/* e.g. "filemetadata" has to precedue "file"; "groupmetadata" has to precede "group" etc. */
+static const char *s_opts ="Aa:Ddm:FfhGgl:STO:V";
+/* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */
static struct long_options l_opts[] = {
{"help", no_arg, 'h'},
{"hel", no_arg, 'h'},
@@ -152,6 +158,10 @@ static struct long_options l_opts[] = {
{"grou", no_arg, 'g'},
{"gro", no_arg, 'g'},
{"gr", no_arg, 'g'},
+ { "links", require_arg, 'l' },
+ { "link", require_arg, 'l' },
+ { "lin", require_arg, 'l' },
+ { "li", require_arg, 'l' },
{"dsetmetadata", no_arg, 'D'},
{"dsetmetadat", no_arg, 'D'},
{"dsetmetada", no_arg, 'D'},
@@ -163,6 +173,9 @@ static struct long_options l_opts[] = {
{"dset", no_arg, 'd'},
{"dse", no_arg, 'd'},
{"ds", no_arg, 'd'},
+ {"dims", require_arg, 'm'},
+ {"dim", require_arg, 'm'},
+ {"di", require_arg, 'm'},
{"dtypemetadata", no_arg, 'T'},
{"dtypemetadat", no_arg, 'T'},
{"dtypemetada", no_arg, 'T'},
@@ -194,6 +207,13 @@ static struct long_options l_opts[] = {
{ "attr", no_arg, 'A' },
{ "att", no_arg, 'A' },
{ "at", no_arg, 'A' },
+ { "numattrs", require_arg, 'a' },
+ { "numattr", require_arg, 'a' },
+ { "numatt", require_arg, 'a' },
+ { "numat", require_arg, 'a' },
+ { "numa", require_arg, 'a' },
+ { "num", require_arg, 'a' },
+ { "nu", require_arg, 'a' },
{ "summary", no_arg, 'S' },
{ "summar", no_arg, 'S' },
{ "summa", no_arg, 'S' },
@@ -211,6 +231,16 @@ leave(int ret)
}
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Compute the ceiling of log_10(x)
+ *
+ * Return: >0 on success, 0 on failure
+ *
+ *-------------------------------------------------------------------------
+ */
static void usage(const char *prog)
{
HDfflush(stdout);
@@ -222,11 +252,20 @@ static void usage(const char *prog)
HDfprintf(stdout, " -f, --file Print file information\n");
HDfprintf(stdout, " -F, --filemetadata Print file space information for file's metadata\n");
HDfprintf(stdout, " -g, --group Print group information\n");
+ HDfprintf(stdout, " -l N, --links=N Set the threshold for the # of links when printing\n");
+ HDfprintf(stdout, " information for small groups. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
HDfprintf(stdout, " -G, --groupmetadata Print file space information for groups' metadata\n");
HDfprintf(stdout, " -d, --dset Print dataset information\n");
+ HDfprintf(stdout, " -m N, --dims=N Set the threshold for the dimension sizes when printing\n");
+ HDfprintf(stdout, " information for small datasets. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
HDfprintf(stdout, " -D, --dsetmetadata Print file space information for datasets' metadata\n");
HDfprintf(stdout, " -T, --dtypemetadata Print datasets' datatype information\n");
HDfprintf(stdout, " -A, --attribute Print attribute information\n");
+ HDfprintf(stdout, " -a N, --numattrs=N Set the threshold for the # of attributes when printing\n");
+ HDfprintf(stdout, " information for small # of attributes. N is an integer greater\n");
+ HDfprintf(stdout, " than 0. The default threshold is 10.\n");
HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
}
@@ -241,8 +280,6 @@ static void usage(const char *prog)
* Programmer: Quincey Koziol
* Monday, August 22, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static unsigned
@@ -284,7 +321,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
- if(oi->num_attrs < SIZE_SMALL_ATTRS)
+ if(oi->num_attrs <= (hsize_t)sattrs_threshold)
(iter->num_small_attrs[(size_t)oi->num_attrs])++;
if(oi->num_attrs > iter->max_attrs)
iter->max_attrs = oi->num_attrs;
@@ -355,8 +392,10 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
HDassert(ret >= 0);
/* Update link stats */
- if(ginfo.nlinks < SIZE_SMALL_GROUPS)
+ /* Collect statistics for small groups */
+ if(ginfo.nlinks < (hsize_t)sgroups_threshold)
(iter->num_small_groups[(size_t)ginfo.nlinks])++;
+ /* Determine maximum link count */
if(ginfo.nlinks > iter->max_fanout)
iter->max_fanout = ginfo.nlinks;
@@ -487,8 +526,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
/* Only gather dim size statistics on 1-D datasets */
if(ndims == 1) {
- iter->max_dset_dims = dims[0];
- if(dims[0] < SIZE_SMALL_DSETS)
+ /* Determine maximum dimension size */
+ if(dims[0] > iter->max_dset_dims)
+ iter->max_dset_dims = dims[0];
+ /* Collect statistics for small datasets */
+ if(dims[0] < (hsize_t)sdsets_threshold)
(iter->small_dset_dims[(size_t)dims[0]])++;
/* Add dim count to proper bin */
@@ -784,6 +826,18 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_group = TRUE;
break;
+ case 'l':
+ if(opt_arg) {
+ sgroups_threshold = HDatoi(opt_arg);
+ if(sgroups_threshold < 1) {
+ error_msg("Invalid threshold for small groups\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small groups\n");
+
+ break;
+
case 'D':
display_all = FALSE;
display_dset_metadata = TRUE;
@@ -794,6 +848,18 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_dset = TRUE;
break;
+ case 'm':
+ if(opt_arg) {
+ sdsets_threshold = HDatoi(opt_arg);
+ if(sdsets_threshold < 1) {
+ error_msg("Invalid threshold for small datasets\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small datasets\n");
+
+ break;
+
case 'T':
display_all = FALSE;
display_dset_dtype_meta = TRUE;
@@ -804,6 +870,18 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_attr = TRUE;
break;
+ case 'a':
+ if(opt_arg) {
+ sattrs_threshold = HDatoi(opt_arg);
+ if(sattrs_threshold < 1) {
+ error_msg("Invalid threshold for small # of attributes\n");
+ goto error;
+ }
+ } else
+ error_msg("Missing threshold for small # of attributes\n");
+
+ break;
+
case 'S':
display_all = FALSE;
display_summary = TRUE;
@@ -875,18 +953,31 @@ error:
static void
iter_free(iter_t *iter)
{
+
/* Clear array of bins for group counts */
if(iter->group_bins) {
HDfree(iter->group_bins);
iter->group_bins = NULL;
} /* end if */
+ /* Clear array for tracking small groups */
+ if(iter->num_small_groups) {
+ HDfree(iter->num_small_groups);
+ iter->num_small_groups = NULL;
+ } /* end if */
+
/* Clear array of bins for attribute counts */
if(iter->attr_bins) {
HDfree(iter->attr_bins);
iter->attr_bins = NULL;
} /* end if */
+ /* Clear array for tracking small attributes */
+ if(iter->num_small_attrs) {
+ HDfree(iter->num_small_attrs);
+ iter->num_small_attrs= NULL;
+ } /* end if */
+
/* Clear dataset datatype information found */
if(iter->dset_type_info) {
HDfree(iter->dset_type_info);
@@ -899,6 +990,12 @@ iter_free(iter_t *iter)
iter->dset_dim_bins = NULL;
} /* end if */
+ /* Clear array of tracking 1-D small datasets */
+ if(iter->small_dset_dims) {
+ HDfree(iter->small_dset_dims);
+ iter->small_dset_dims = NULL;
+ } /* end if */
+
} /* end iter_free() */
@@ -1015,11 +1112,11 @@ print_group_info(const iter_t *iter)
unsigned long total; /* Total count for various statistics */
unsigned u; /* Local index variable */
- printf("Small groups:\n");
+ printf("Small groups (with 0 to %u links):\n", sgroups_threshold-1);
total = 0;
- for(u = 0; u < SIZE_SMALL_GROUPS; u++) {
+ for(u = 0; u < (unsigned)sgroups_threshold; u++) {
if(iter->num_small_groups[u] > 0) {
- printf("\t# of groups of size %u: %lu\n", u, iter->num_small_groups[u]);
+ printf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]);
total += iter->num_small_groups[u];
} /* end if */
} /* end for */
@@ -1028,13 +1125,13 @@ print_group_info(const iter_t *iter)
printf("Group bins:\n");
total = 0;
if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) {
- printf("\t# of groups of size 0: %lu\n", iter->group_bins[0]);
+ printf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]);
total = iter->group_bins[0];
} /* end if */
power = 1;
for(u = 1; u < iter->group_nbins; u++) {
if(iter->group_bins[u] > 0) {
- printf("\t# of groups of size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ printf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1,
iter->group_bins[u]);
total += iter->group_bins[u];
} /* end if */
@@ -1105,29 +1202,29 @@ print_dataset_info(const iter_t *iter)
printf("1-D Dataset information:\n");
HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims);
- printf("\tSmall 1-D datasets:\n");
+ printf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1);
total = 0;
- for(u = 0; u < SIZE_SMALL_DSETS; u++) {
+ for(u = 0; u < (unsigned)sdsets_threshold; u++) {
if(iter->small_dset_dims[u] > 0) {
- printf("\t\t# of dataset dimensions of size %u: %lu\n", u,
+ printf("\t\t# of datasets with dimension sizes %u: %lu\n", u,
iter->small_dset_dims[u]);
total += iter->small_dset_dims[u];
} /* end if */
} /* end for */
- printf("\t\tTotal small datasets: %lu\n", total);
+ printf("\t\tTotal # of small datasets: %lu\n", total);
/* Protect against no datasets in file */
if(iter->dset_dim_nbins > 0) {
printf("\t1-D Dataset dimension bins:\n");
total = 0;
if(iter->dset_dim_bins[0] > 0) {
- printf("\t\t# of datasets of size 0: %lu\n", iter->dset_dim_bins[0]);
+ printf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]);
total = iter->dset_dim_bins[0];
} /* end if */
power = 1;
for(u = 1; u < iter->dset_dim_nbins; u++) {
if(iter->dset_dim_bins[u] > 0) {
- printf("\t\t# of datasets of size %lu - %lu: %lu\n", power, (power * 10) - 1,
+ printf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1,
iter->dset_dim_bins[u]);
total += iter->dset_dim_bins[u];
} /* end if */
@@ -1244,8 +1341,6 @@ print_dset_dtype_meta(const iter_t *iter)
* Programmer: Vailin Choi
* July 12, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1255,9 +1350,9 @@ print_attr_info(const iter_t *iter)
unsigned long total; /* Total count for various statistics */
unsigned u; /* Local index variable */
- printf("Small # of attributes:\n");
+ printf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold);
total = 0;
- for(u = 1; u < SIZE_SMALL_ATTRS; u++) {
+ for(u = 1; u <= (unsigned)sattrs_threshold; u++) {
if(iter->num_small_attrs[u] > 0) {
printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]);
total += iter->num_small_attrs[u];
@@ -1497,6 +1592,16 @@ main(int argc, const char *argv[])
iter.SM_heap_storage_size = finfo.sohm.msgs_info.heap_size;
} /* end else */
+ iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long));
+ iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long));
+
+ if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
+ error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
if((fcpl = H5Fget_create_plist(fid)) < 0)
warn_msg("Unable to retrieve file creation property\n");
diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c
index 042fc78..80cc9e0 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -16,82 +16,316 @@
/*
* Generate the binary hdf5 files for the h5stat tests.
* Usage: just execute the program without any arguments will
- * generate all the binary hdf5 files in the ./testfiles directory.
+ * generate all the binary hdf5 files
*
* If you regenerate the test files (e.g., changing some code,
* trying it on a new platform, ...), you need to verify the correctness
* of the expected output and update the corresponding *.ddl files.
*/
-
-#include <assert.h>
#include "hdf5.h"
-#define FILE "h5stat_newgrat.h5"
+/* For gen_newgrat_file() */
+#define NEWGRAT_FILE "h5stat_newgrat.h5"
#define DATASET_NAME "DATASET_NAME"
#define GROUP_NAME "GROUP"
#define ATTR_NAME "ATTR"
#define NUM_GRPS 35000
#define NUM_ATTRS 100
+/* For gen_threshold_file() */
+#define THRESHOLD_FILE "h5stat_threshold.h5"
+#define THRES_ATTR_NAME "attr"
+#define THRES_ATTR_GRP_NAME "grp_attr"
+#define THRES_DSET_NAME "dset"
+#define THRES_NUM 10
+#define THRES_NUM_25 25
+
/*
- * Generate 1.8 HDF5 file
- * with NUM_GRPS groups
- * with NUM_ATTRS attributes on the dataset
+ * Generate HDF5 file with latest format with
+ * NUM_GRPS groups and NUM_ATTRS attributes for the dataset
+ *
*/
-static void gen_file(void)
+static void
+gen_newgrat_file(const char *fname)
{
- hid_t fapl; /* File access property */
- hid_t file; /* File id */
- hid_t gid; /* Group id */
- hid_t type_id; /* Datatype id */
- hid_t space_id; /* Dataspace id */
- hid_t attr_id; /* Attribute id */
- hid_t dset_id; /* Dataset id */
- char name[30]; /* Group name */
- char attrname[30]; /* Attribute name */
- int ret; /* Return value */
- int i; /* Local index variable */
-
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- assert(ret >= 0);
+ hid_t fapl; /* File access property */
+ hid_t fid; /* File id */
+ hid_t gid; /* Group id */
+ hid_t tid; /* Datatype id */
+ hid_t sid; /* Dataspace id */
+ hid_t attr_id; /* Attribute id */
+ hid_t did; /* Dataset id */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int i; /* Local index variable */
+
+ /* Get a copy file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Set to use latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
/* Create dataset */
- file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if((fid = H5Fcreate(NEWGRAT_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create NUM_GRPS groups in the root group */
for(i = 1; i <= NUM_GRPS; i++) {
sprintf(name, "%s%d", GROUP_NAME,i);
- gid = H5Gcreate2(file, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(gid);
+ if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
} /* end for */
/* Create a datatype to commit and use */
- type_id = H5Tcopy(H5T_NATIVE_INT);
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto error;
/* Create dataspace for dataset */
- space_id = H5Screate(H5S_SCALAR);
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
- /* Create dataset */
- dset_id = H5Dcreate2(file, DATASET_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create dataset */
+ if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create NUM_ATTRS for the dataset */
for(i = 1; i <= NUM_ATTRS; i++) {
sprintf(attrname, "%s%d", ATTR_NAME,i);
- attr_id = H5Acreate2(dset_id, attrname, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- ret = H5Aclose(attr_id);
- assert(ret >= 0);
+ if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
} /* end for */
- ret = H5Dclose(dset_id);
- assert(ret >= 0);
- ret = H5Sclose(space_id);
- assert(ret >= 0);
- ret = H5Tclose(type_id);
- assert(ret >= 0);
- ret = H5Fclose(file);
- assert(ret >= 0);
-}
+ /* Close dataset, dataspace, datatype, file */
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Tclose(tid) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(attr_id);
+ H5Dclose(did);
+ H5Tclose(tid);
+ H5Sclose(sid);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_newgrat_file() */
+
+/*
+ * Generate an HDF5 file with groups, datasets, attributes for testing the options:
+ * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
+ * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
+ * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
+ */
+static void
+gen_threshold_file(const char *fname)
+{
+ hid_t fid; /* File ID */
+ hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */
+ hid_t did; /* Dataset ID */
+ hid_t attr_id; /* Attribute ID */
+ hid_t gid; /* Group ID */
+ hsize_t two_dims[] = {2, 5}; /* Dimension array */
+ hsize_t one_dims[] = {6}; /* Dimension array */
+ hsize_t zero_dims[] = {0}; /* Dimension array */
+ char name[30]; /* Name */
+ unsigned i; /* Local index variable */
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 1-D dataspace with zero dimension size */
+ if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
+ goto error;
+
+ /* Create 1-D dataspace with non-zero dimension size*/
+ if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
+ goto error;
+
+ /* Create 2-D dataspace */
+ if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
+ goto error;
+
+ /* Create scalar dataspace */
+ if((sid3 = H5Screate(H5S_SCALAR)) < 0)
+ goto error;
+
+ /* Create null dataspace */
+ if((sid4 = H5Screate(H5S_NULL)) < 0)
+ goto error;
+
+ /* Create an attribute for the root group */
+ if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+
+ /* Create 1-D dataset with zero dimension size for the root group */
+ if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 11 attributes for the dataset */
+ for(i = 1; i <= (THRES_NUM+1); i++) {
+ sprintf(name, "%s%d", THRES_ATTR_NAME,i);
+ if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create dataset with scalar dataspace for the root group */
+ if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create dataset with null dataspace for the root group */
+ if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create 2-D dataset for the root group */
+ if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 10 attributes for the 2-D dataset */
+ for(i = 1; i <= THRES_NUM; i++) {
+ sprintf(name, "%s%d", THRES_ATTR_NAME,i);
+ if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+ if(H5Dclose(did) < 0)
+ goto error;
+
+ /* Create first group */
+ if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create an attribute for the group */
+ if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close attribute */
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+
+ /* Create 10 1-D datasets with non-zero dimension size for the group */
+ for(i = 1; i <= THRES_NUM; i++) {
+ /* set up dataset name */
+ sprintf(name, "%s%d", THRES_DSET_NAME,i);
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+
+ /* Create second group */
+ if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 25 attributes for the group */
+ for(i = 1; i <= THRES_NUM_25; i++) {
+ /* Set up attribute name */
+ sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i);
+
+ /* Create the attribute */
+ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the attribute */
+ if(H5Aclose(attr_id) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+ /* Create third group */
+ if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Create 9 1-D datasets with non-zero dimension size for the group */
+ for(i = 1; i < THRES_NUM; i++) {
+ /* set up dataset name */
+ sprintf(name, "%s%d", THRES_DSET_NAME,i);
+
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ goto error;
+ }
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ goto error;
+
+
+ /* Close dataspaces */
+ if(H5Sclose(sid0) < 0)
+ goto error;
+ if(H5Sclose(sid1) < 0)
+ goto error;
+ if(H5Sclose(sid2) < 0)
+ goto error;
+ if(H5Sclose(sid3) < 0)
+ goto error;
+ if(H5Sclose(sid4) < 0)
+ goto error;
+
+ /* Close file */
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Aclose(attr_id);
+ H5Dclose(did);
+ H5Sclose(sid0);
+ H5Sclose(sid1);
+ H5Sclose(sid2);
+ H5Sclose(sid3);
+ H5Sclose(sid4);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+
+} /* gen_threshold_file() */
int main(void)
{
- gen_file();
+ gen_newgrat_file(NEWGRAT_FILE);
+ gen_threshold_file(THRESHOLD_FILE);
return 0;
}
diff --git a/tools/h5stat/testfiles/h5stat_dims1.ddl b/tools/h5stat/testfiles/h5stat_dims1.ddl
new file mode 100644
index 0000000..182d31a
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_dims1.ddl
@@ -0,0 +1,47 @@
+#############################
+Expected output for 'h5stat -gd -m 5 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ Total # of small groups: 3
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 4):
+ # of datasets with dimension sizes 0: 1
+ Total # of small datasets: 1
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
diff --git a/tools/h5stat/testfiles/h5stat_dims2.ddl b/tools/h5stat/testfiles/h5stat_dims2.ddl
new file mode 100644
index 0000000..abf3f61
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_dims2.ddl
@@ -0,0 +1,38 @@
+#############################
+Expected output for 'h5stat -d --di=15 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 14):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
diff --git a/tools/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/h5stat/testfiles/h5stat_err1_dims.ddl
new file mode 100644
index 0000000..8f0686f
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_err1_dims.ddl
@@ -0,0 +1,4 @@
+#############################
+Expected output for 'h5stat -d --dims=-1 h5stat_threshold.h5'
+#############################
+h5stat error: Invalid threshold for small datasets
diff --git a/tools/h5stat/testfiles/h5stat_err1_links.ddl b/tools/h5stat/testfiles/h5stat_err1_links.ddl
new file mode 100644
index 0000000..07987a2
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_err1_links.ddl
@@ -0,0 +1,4 @@
+#############################
+Expected output for 'h5stat -l 0 h5stat_threshold.h5'
+#############################
+h5stat error: Invalid threshold for small groups
diff --git a/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl
new file mode 100644
index 0000000..8eea546
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_err1_numattrs.ddl
@@ -0,0 +1,4 @@
+#############################
+Expected output for 'h5stat -a -2 h5stat_threshold.h5'
+#############################
+h5stat error: Invalid threshold for small # of attributes
diff --git a/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl
new file mode 100644
index 0000000..a1ecb31
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_err2_numattrs.ddl
@@ -0,0 +1,4 @@
+#############################
+Expected output for 'h5stat --numattrs h5stat_threshold.h5'
+#############################
+h5stat error: Invalid threshold for small # of attributes
diff --git a/tools/h5stat/testfiles/h5stat_filters-d.ddl b/tools/h5stat/testfiles/h5stat_filters-d.ddl
index 3cc9071..dae1f06 100644
--- a/tools/h5stat/testfiles/h5stat_filters-d.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-d.ddl
@@ -9,10 +9,10 @@ Dataset dimension information:
# of dataset with rank 2: 14
1-D Dataset information:
Max. dimension size of 1-D datasets: 100
- Small 1-D datasets:
- Total small datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
1-D Dataset dimension bins:
- # of datasets of size 100 - 999: 1
+ # of datasets with dimension size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
Total raw data size: 8659
diff --git a/tools/h5stat/testfiles/h5stat_filters-dT.ddl b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
index ae9121d..5c7a4ab 100644
--- a/tools/h5stat/testfiles/h5stat_filters-dT.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-dT.ddl
@@ -9,10 +9,10 @@ Dataset dimension information:
# of dataset with rank 2: 14
1-D Dataset information:
Max. dimension size of 1-D datasets: 100
- Small 1-D datasets:
- Total small datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
1-D Dataset dimension bins:
- # of datasets of size 100 - 999: 1
+ # of datasets with dimension size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
Total raw data size: 8659
diff --git a/tools/h5stat/testfiles/h5stat_filters-g.ddl b/tools/h5stat/testfiles/h5stat_filters-g.ddl
index d488b8f..6cb791c 100644
--- a/tools/h5stat/testfiles/h5stat_filters-g.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters-g.ddl
@@ -2,8 +2,8 @@
Expected output for 'h5stat -g h5stat_filters.h5'
#############################
Filename: h5stat_filters.h5
-Small groups:
+Small groups (with 0 to 9 links):
Total # of small groups: 0
Group bins:
- # of groups of size 10 - 99: 1
+ # of groups with 10 - 99 links: 1
Total # of groups: 1
diff --git a/tools/h5stat/testfiles/h5stat_filters.ddl b/tools/h5stat/testfiles/h5stat_filters.ddl
index 15bb66b..5fdbd31 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -31,10 +31,10 @@ File space information for file metadata (in bytes):
Header: 0
B-tree/List: 0
Heap: 0
-Small groups:
+Small groups (with 0 to 9 links):
Total # of small groups: 0
Group bins:
- # of groups of size 10 - 99: 1
+ # of groups with 10 - 99 links: 1
Total # of groups: 1
Dataset dimension information:
Max. rank of datasets: 2
@@ -43,10 +43,10 @@ Dataset dimension information:
# of dataset with rank 2: 14
1-D Dataset information:
Max. dimension size of 1-D datasets: 100
- Small 1-D datasets:
- Total small datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
1-D Dataset dimension bins:
- # of datasets of size 100 - 999: 1
+ # of datasets with dimension size 100 - 999: 1
Total # of datasets: 1
Dataset storage information:
Total raw data size: 8659
@@ -75,7 +75,7 @@ Dataset datatype information:
Count (total/named) = (1/0)
Size (desc./elmt) = (14/4)
Total dataset datatype count: 15
-Small # of attributes:
+Small # of attributes (objects with 1 to 10 attributes):
Total # of objects with small # of attributes: 0
Attribute bins:
Total # of objects with attributes: 0
diff --git a/tools/h5stat/testfiles/h5stat_help1.ddl b/tools/h5stat/testfiles/h5stat_help1.ddl
index bf7e1fa..378389e 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -9,9 +9,18 @@ Usage: h5stat [OPTIONS] file
-f, --file Print file information
-F, --filemetadata Print file space information for file's metadata
-g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
-G, --groupmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
-D, --dsetmetadata Print file space information for datasets' metadata
-T, --dtypemetadata Print datasets' datatype information
-A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
-S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_help2.ddl b/tools/h5stat/testfiles/h5stat_help2.ddl
index 15f987a..65d8bca 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -9,9 +9,18 @@ Usage: h5stat [OPTIONS] file
-f, --file Print file information
-F, --filemetadata Print file space information for file's metadata
-g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
-G, --groupmetadata Print file space information for groups' metadata
-d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
-D, --dsetmetadata Print file space information for datasets' metadata
-T, --dtypemetadata Print datasets' datatype information
-A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
-S, --summary Print summary of file space information
diff --git a/tools/h5stat/testfiles/h5stat_links1.ddl b/tools/h5stat/testfiles/h5stat_links1.ddl
new file mode 100644
index 0000000..e77a788
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_links1.ddl
@@ -0,0 +1,13 @@
+#############################
+Expected output for 'h5stat -g -l 8 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 7 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ Total # of small groups: 2
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
diff --git a/tools/h5stat/testfiles/h5stat_links2.ddl b/tools/h5stat/testfiles/h5stat_links2.ddl
new file mode 100644
index 0000000..27d6c6d
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_links2.ddl
@@ -0,0 +1,96 @@
+#############################
+Expected output for 'h5stat --links=8 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+File information
+ # of unique groups: 4
+ # of unique datasets: 23
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 10
+File space information for file metadata (in bytes):
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 3576/0
+ Datasets(exclude compact data): 7896/2912
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 3816
+ Heap: 744
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+Small groups (with 0 to 7 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ Total # of small groups: 2
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (23/0)
+ Size (desc./elmt) = (14/1)
+ Total dataset datatype count: 23
+Small # of attributes (objects with 1 to 10 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ Total # of objects with small # of attributes: 3
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+Summary of file space information:
+ File metadata: 16032 bytes
+ Raw data: 0 bytes
+ Unaccounted space: 280 bytes
+Total space: 16312 bytes
diff --git a/tools/h5stat/testfiles/h5stat_links3.ddl b/tools/h5stat/testfiles/h5stat_links3.ddl
new file mode 100644
index 0000000..d0071d7
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_links3.ddl
@@ -0,0 +1,15 @@
+#############################
+Expected output for 'h5stat --links=20 -g h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Small groups (with 0 to 19 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ # of groups with 10 link(s): 1
+ Total # of small groups: 4
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
diff --git a/tools/h5stat/testfiles/h5stat_links4.ddl b/tools/h5stat/testfiles/h5stat_links4.ddl
new file mode 100644
index 0000000..ca3911c
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_links4.ddl
@@ -0,0 +1,11 @@
+#############################
+Expected output for 'h5stat -g h5stat_newgrat.h5'
+#############################
+Filename: h5stat_newgrat.h5
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 35000
+ Total # of small groups: 35000
+Group bins:
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
+ Total # of groups: 35001
diff --git a/tools/h5stat/testfiles/h5stat_links5.ddl b/tools/h5stat/testfiles/h5stat_links5.ddl
new file mode 100644
index 0000000..44ec161
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_links5.ddl
@@ -0,0 +1,12 @@
+#############################
+Expected output for 'h5stat -g -l 40000 h5stat_newgrat.h5'
+#############################
+Filename: h5stat_newgrat.h5
+Small groups (with 0 to 39999 links):
+ # of groups with 0 link(s): 35000
+ # of groups with 35001 link(s): 1
+ Total # of small groups: 35001
+Group bins:
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
+ Total # of groups: 35001
diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl
index 70f9a82..18f91f3 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat-UA.ddl
@@ -2,7 +2,7 @@
Expected output for 'h5stat -A h5stat_newgrat.h5'
#############################
Filename: h5stat_newgrat.h5
-Small # of attributes:
+Small # of attributes (objects with 1 to 10 attributes):
Total # of objects with small # of attributes: 0
Attribute bins:
# of objects with 100 - 999 attributes: 1
diff --git a/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl
index b300a8f..ecebdef 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat-UG.ddl
@@ -5,4 +5,4 @@ Filename: h5stat_newgrat.h5
File space information for groups' metadata (in bytes):
Object headers (total/unused): 5145147/3220092
B-tree/List: 470054
- Heap: 739102
+ Heap: 739045
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index ef50d4f..bd10e4a 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -19,10 +19,10 @@ File space information for file metadata (in bytes):
Datatypes: 0/0
Groups:
B-tree/List: 470054
- Heap: 739102
+ Heap: 739045
Attributes:
B-tree/List: 2598
- Heap: 4442
+ Heap: 4431
Chunked datasets:
Index: 0
Datasets:
@@ -31,12 +31,12 @@ File space information for file metadata (in bytes):
Header: 0
B-tree/List: 0
Heap: 0
-Small groups:
- # of groups of size 0: 35000
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 35000
Total # of small groups: 35000
Group bins:
- # of groups of size 0: 35000
- # of groups of size 10000 - 99999: 1
+ # of groups with 0 link: 35000
+ # of groups with 10000 - 99999 links: 1
Total # of groups: 35001
Dataset dimension information:
Max. rank of datasets: 0
@@ -44,8 +44,8 @@ Dataset dimension information:
# of dataset with rank 0: 1
1-D Dataset information:
Max. dimension size of 1-D datasets: 0
- Small 1-D datasets:
- Total small datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
Dataset storage information:
Total raw data size: 0
Total external raw data size: 0
@@ -70,14 +70,14 @@ Dataset datatype information:
Count (total/named) = (1/0)
Size (desc./elmt) = (14/4)
Total dataset datatype count: 1
-Small # of attributes:
+Small # of attributes (objects with 1 to 10 attributes):
Total # of objects with small # of attributes: 0
Attribute bins:
# of objects with 100 - 999 attributes: 1
Total # of objects with attributes: 1
Max. # of attributes to objects: 100
Summary of file space information:
- File metadata: 6361757 bytes
+ File metadata: 6361689 bytes
Raw data: 0 bytes
- Unaccounted space: 1324 bytes
-Total space: 6363081 bytes
+ Unaccounted space: 6202 bytes
+Total space: 6367891 bytes
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5
index 8fa406b..fc8433d 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.h5
+++ b/tools/h5stat/testfiles/h5stat_newgrat.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_nofile.ddl b/tools/h5stat/testfiles/h5stat_nofile.ddl
new file mode 100644
index 0000000..7b98be4
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_nofile.ddl
@@ -0,0 +1,27 @@
+#############################
+Expected output for 'h5stat '
+#############################
+Usage: h5stat [OPTIONS] file
+
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -f, --file Print file information
+ -F, --filemetadata Print file space information for file's metadata
+ -g, --group Print group information
+ -l N, --links=N Set the threshold for the # of links when printing
+ information for small groups. N is an integer greater
+ than 0. The default threshold is 10.
+ -G, --groupmetadata Print file space information for groups' metadata
+ -d, --dset Print dataset information
+ -m N, --dims=N Set the threshold for the dimension sizes when printing
+ information for small datasets. N is an integer greater
+ than 0. The default threshold is 10.
+ -D, --dsetmetadata Print file space information for datasets' metadata
+ -T, --dtypemetadata Print datasets' datatype information
+ -A, --attribute Print attribute information
+ -a N, --numattrs=N Set the threshold for the # of attributes when printing
+ information for small # of attributes. N is an integer greater
+ than 0. The default threshold is 10.
+ -S, --summary Print summary of file space information
+h5stat error: missing file name
diff --git a/tools/h5stat/testfiles/h5stat_numattrs1.ddl b/tools/h5stat/testfiles/h5stat_numattrs1.ddl
new file mode 100644
index 0000000..bee1d29
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_numattrs1.ddl
@@ -0,0 +1,18 @@
+#############################
+Expected output for 'h5stat -AS -a 10 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Small # of attributes (objects with 1 to 10 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ Total # of objects with small # of attributes: 3
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+Summary of file space information:
+ File metadata: 16032 bytes
+ Raw data: 0 bytes
+ Unaccounted space: 280 bytes
+Total space: 16312 bytes
diff --git a/tools/h5stat/testfiles/h5stat_numattrs2.ddl b/tools/h5stat/testfiles/h5stat_numattrs2.ddl
new file mode 100644
index 0000000..29a09d0
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_numattrs2.ddl
@@ -0,0 +1,96 @@
+#############################
+Expected output for 'h5stat -a 1 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+File information
+ # of unique groups: 4
+ # of unique datasets: 23
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 10
+File space information for file metadata (in bytes):
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 3576/0
+ Datasets(exclude compact data): 7896/2912
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 3816
+ Heap: 744
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 0
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+Small groups (with 0 to 9 links):
+ # of groups with 0 link(s): 1
+ # of groups with 7 link(s): 1
+ # of groups with 9 link(s): 1
+ Total # of small groups: 3
+Group bins:
+ # of groups with 0 link: 1
+ # of groups with 1 - 9 links: 2
+ # of groups with 10 - 99 links: 1
+ Total # of groups: 4
+Dataset dimension information:
+ Max. rank of datasets: 2
+ Dataset ranks:
+ # of dataset with rank 0: 2
+ # of dataset with rank 1: 20
+ # of dataset with rank 2: 1
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 6
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ # of datasets with dimension sizes 0: 1
+ # of datasets with dimension sizes 6: 19
+ Total # of small datasets: 20
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 0: 1
+ # of datasets with dimension size 1 - 9: 19
+ Total # of datasets: 20
+Dataset storage information:
+ Total raw data size: 0
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 23
+ Dataset layout counts[CHUNKED]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 23
+ GZIP filter: 0
+ SHUFFLE filter: 0
+ FLETCHER32 filter: 0
+ SZIP filter: 0
+ NBIT filter: 0
+ SCALEOFFSET filter: 0
+ USER-DEFINED filter: 0
+Dataset datatype information:
+ # of unique datatypes used by datasets: 1
+ Dataset datatype #0:
+ Count (total/named) = (23/0)
+ Size (desc./elmt) = (14/1)
+ Total dataset datatype count: 23
+Small # of attributes (objects with 1 to 1 attributes):
+ # of objects with 1 attributes: 2
+ Total # of objects with small # of attributes: 2
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
+Summary of file space information:
+ File metadata: 16032 bytes
+ Raw data: 0 bytes
+ Unaccounted space: 280 bytes
+Total space: 16312 bytes
diff --git a/tools/h5stat/testfiles/h5stat_numattrs3.ddl b/tools/h5stat/testfiles/h5stat_numattrs3.ddl
new file mode 100644
index 0000000..515b76c
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_numattrs3.ddl
@@ -0,0 +1,15 @@
+#############################
+Expected output for 'h5stat -A --numattrs=25 h5stat_threshold.h5'
+#############################
+Filename: h5stat_threshold.h5
+Small # of attributes (objects with 1 to 25 attributes):
+ # of objects with 1 attributes: 2
+ # of objects with 10 attributes: 1
+ # of objects with 11 attributes: 1
+ # of objects with 25 attributes: 1
+ Total # of objects with small # of attributes: 5
+Attribute bins:
+ # of objects with 1 - 9 attributes: 2
+ # of objects with 10 - 99 attributes: 3
+ Total # of objects with attributes: 5
+ Max. # of attributes to objects: 25
diff --git a/tools/h5stat/testfiles/h5stat_numattrs4.ddl b/tools/h5stat/testfiles/h5stat_numattrs4.ddl
new file mode 100644
index 0000000..515a4a9
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_numattrs4.ddl
@@ -0,0 +1,11 @@
+#############################
+Expected output for 'h5stat -A -a 100 h5stat_newgrat.h5'
+#############################
+Filename: h5stat_newgrat.h5
+Small # of attributes (objects with 1 to 100 attributes):
+ # of objects with 100 attributes: 1
+ Total # of objects with small # of attributes: 1
+Attribute bins:
+ # of objects with 100 - 999 attributes: 1
+ Total # of objects with attributes: 1
+ Max. # of attributes to objects: 100
diff --git a/tools/h5stat/testfiles/h5stat_threshold.h5 b/tools/h5stat/testfiles/h5stat_threshold.h5
new file mode 100644
index 0000000..ae9fff6
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_threshold.h5
Binary files differ
diff --git a/tools/h5stat/testfiles/h5stat_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index 1f16f03..f9f3924 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -31,11 +31,11 @@ File space information for file metadata (in bytes):
Header: 38
B-tree/List: 550
Heap: 1279
-Small groups:
- # of groups of size 3: 1
+Small groups (with 0 to 9 links):
+ # of groups with 3 link(s): 1
Total # of small groups: 1
Group bins:
- # of groups of size 1 - 9: 1
+ # of groups with 1 - 9 links: 1
Total # of groups: 1
Dataset dimension information:
Max. rank of datasets: 2
@@ -43,8 +43,8 @@ Dataset dimension information:
# of dataset with rank 2: 3
1-D Dataset information:
Max. dimension size of 1-D datasets: 0
- Small 1-D datasets:
- Total small datasets: 0
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
Dataset storage information:
Total raw data size: 0
Total external raw data size: 0
@@ -69,7 +69,7 @@ Dataset datatype information:
Count (total/named) = (3/0)
Size (desc./elmt) = (14/8)
Total dataset datatype count: 3
-Small # of attributes:
+Small # of attributes (objects with 1 to 10 attributes):
Total # of objects with small # of attributes: 0
Attribute bins:
Total # of objects with attributes: 0
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index ab97698..f780c97 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -13,7 +13,12 @@
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
-# Tests for the h5dump tool
+# Tests for the h5stat tool
+#
+# Modifcations:
+# Vailin Choi; July 2013
+# Add tests for -l, -m, -a options
+#
srcdir=@srcdir@
@@ -72,12 +77,14 @@ LIST_HDF5_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_filters.h5
$SRC_H5STAT_TESTFILES/h5stat_tsohm.h5
$SRC_H5STAT_TESTFILES/h5stat_newgrat.h5
+$SRC_H5STAT_TESTFILES/h5stat_threshold.h5
"
LIST_OTHER_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_help1.ddl
$SRC_H5STAT_TESTFILES/h5stat_help2.ddl
$SRC_H5STAT_TESTFILES/h5stat_notexist.ddl
+$SRC_H5STAT_TESTFILES/h5stat_nofile.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters-file.ddl
$SRC_H5STAT_TESTFILES/h5stat_filters-F.ddl
@@ -90,6 +97,21 @@ $SRC_H5STAT_TESTFILES/h5stat_tsohm.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links4.ddl
+$SRC_H5STAT_TESTFILES/h5stat_links5.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl
+$SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl
"
#
@@ -210,6 +232,7 @@ TOOLTEST h5stat_help1.ddl -h
TOOLTEST h5stat_help2.ddl --help
# Test when h5stat a file that does not exist
TOOLTEST h5stat_notexist.ddl notexist.h5
+TOOLTEST h5stat_nofile.ddl ''
# Test file with groups, compressed datasets, user-applied fileters, etc.
# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
@@ -229,6 +252,47 @@ TOOLTEST h5stat_tsohm.ddl h5stat_tsohm.h5
TOOLTEST h5stat_newgrat.ddl h5stat_newgrat.h5
TOOLTEST h5stat_newgrat-UG.ddl -G h5stat_newgrat.h5
TOOLTEST h5stat_newgrat-UA.ddl -A h5stat_newgrat.h5
+#
+# Tests for -l (--links) option on h5stat_threshold.h5:
+# -l 0 (incorrect threshold value)
+# -g -l 8
+# --links=8
+# --links=20 -g
+TOOLTEST h5stat_err1_links.ddl -l 0 h5stat_threshold.h5
+TOOLTEST h5stat_links1.ddl -g -l 8 h5stat_threshold.h5
+TOOLTEST h5stat_links2.ddl --links=8 h5stat_threshold.h5
+TOOLTEST h5stat_links3.ddl --links=20 -g h5stat_threshold.h5
+#
+# Tests for -l (--links) option on h5stat_newgrat.h5:
+# -g
+# -g -l 40000
+TOOLTEST h5stat_links4.ddl -g h5stat_newgrat.h5
+TOOLTEST h5stat_links5.ddl -g -l 40000 h5stat_newgrat.h5
+#
+# Tests for -m (--dims) option on h5stat_threshold.h5
+# -d --dims=-1 (incorrect threshold value)
+# -gd -m 5
+# -d --di=15
+TOOLTEST h5stat_err1_dims.ddl -d --dims=-1 h5stat_threshold.h5
+TOOLTEST h5stat_dims1.ddl -gd -m 5 h5stat_threshold.h5
+TOOLTEST h5stat_dims2.ddl -d --di=15 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_threshold.h5
+# -a -2 (incorrect threshold value)
+# --numattrs (without threshold value)
+# -AS -a 10
+# -a 1
+# -A --numattrs=25
+TOOLTEST h5stat_err1_numattrs.ddl -a -2 h5stat_threshold.h5
+TOOLTEST h5stat_err2_numattrs.ddl --numattrs h5stat_threshold.h5
+TOOLTEST h5stat_numattrs1.ddl -AS -a 10 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs2.ddl -a 1 h5stat_threshold.h5
+TOOLTEST h5stat_numattrs3.ddl -A --numattrs=25 h5stat_threshold.h5
+#
+# Tests for -a option on h5stat_newgrat.h5
+# -A -a 100
+TOOLTEST h5stat_numattrs4.ddl -A -a 100 h5stat_newgrat.h5
+#
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."