summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-08-08 17:24:43 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-08-08 17:24:43 (GMT)
commitc902bbdd9041be89ffe6bc1f186ae166e03c435a (patch)
tree4b73867753f18ce82cb2eebfc98763a139d9b9b0
parentf1b5d46cd045a9a705be6515a338e7bbb3298161 (diff)
downloadhdf5-c902bbdd9041be89ffe6bc1f186ae166e03c435a.zip
hdf5-c902bbdd9041be89ffe6bc1f186ae166e03c435a.tar.gz
hdf5-c902bbdd9041be89ffe6bc1f186ae166e03c435a.tar.bz2
[svn-r23975] This checkin contains--
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)
-rw-r--r--tools/h5stat/h5stat.c163
-rw-r--r--tools/h5stat/h5stat_gentest.c333
-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_newgrat-UA.ddl2
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.ddl37
-rw-r--r--tools/h5stat/testfiles/h5stat_newgrat.h5bin6369482 -> 6362168 bytes
-rw-r--r--tools/h5stat/testfiles/h5stat_tsohm.ddl12
-rw-r--r--tools/h5stat/testh5stat.sh.in66
13 files changed, 535 insertions, 124 deletions
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index dcc2c08..6fc1dc4 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -26,10 +26,13 @@
#define PROGRAMNAME "h5stat"
/* Parameters to control statistics gathered */
-#define SIZE_SMALL_GROUPS 10
-#define SIZE_SMALL_ATTRS 10
-#define SIZE_SMALL_DSETS 10
-#define SIZE_SMALL_SECTS 10
+
+/* 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 SIZE_SMALL_SECTS 10
#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
accommodate for user-define filters + one
@@ -69,22 +72,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 */
@@ -134,15 +137,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 ="ADdFfhGgsSTO:V";
-/* e.g. "filemetadata" has to precedue "file"; "groupmetadata" has to precede "group" etc. */
+static const char *s_opts ="Aa:Ddm:FfhGgl:sSTO: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'},
@@ -170,6 +177,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'},
@@ -181,6 +192,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'},
@@ -212,6 +226,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' },
{ "freespace", no_arg, 's' },
{ "freespac", no_arg, 's' },
{ "freespa", no_arg, 's' },
@@ -237,6 +258,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);
@@ -248,11 +279,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, --freespace Print free space information\n");
HDfprintf(stdout, " -S, --summary Print summary of file space information\n");
}
@@ -268,8 +308,6 @@ static void usage(const char *prog)
* Programmer: Quincey Koziol
* Monday, August 22, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static unsigned
@@ -311,7 +349,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;
@@ -382,8 +420,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;
@@ -514,8 +554,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 */
@@ -871,6 +914,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_group = TRUE;
break;
+ case 'l':
+ sgroups_threshold = HDatoi(opt_arg);
+ if(sgroups_threshold < 1) {
+ error_msg("Invalid threshold for small groups\n");
+ goto error;
+ } /* end if */
+
+ break;
+
case 'D':
display_all = FALSE;
display_dset_metadata = TRUE;
@@ -881,6 +933,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_dset = TRUE;
break;
+ case 'm':
+ sdsets_threshold = HDatoi(opt_arg);
+ if(sdsets_threshold < 1) {
+ error_msg("Invalid threshold for small datasets\n");
+ goto error;
+ } /* end if */
+
+ break;
+
case 'T':
display_all = FALSE;
display_dset_dtype_meta = TRUE;
@@ -891,6 +952,15 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret)
display_attr = TRUE;
break;
+ case 'a':
+ sattrs_threshold = HDatoi(opt_arg);
+ if(sattrs_threshold < 1) {
+ error_msg("Invalid threshold for small # of attributes\n");
+ goto error;
+ } /* end if */
+
+ break;
+
case 's':
display_all = FALSE;
display_free_sections = TRUE;
@@ -967,18 +1037,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);
@@ -991,6 +1074,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 */
+
/* Clear array of bins for free-space section sizes */
if(iter->sect_bins) {
HDfree(iter->sect_bins);
@@ -1117,11 +1206,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 */
@@ -1130,13 +1219,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 */
@@ -1207,29 +1296,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 */
@@ -1346,8 +1435,6 @@ print_dset_dtype_meta(const iter_t *iter)
* Programmer: Vailin Choi
* July 12, 2007
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1357,9 +1444,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];
@@ -1660,6 +1747,16 @@ main(int argc, const char *argv[])
iter.free_hdr = finfo.free.meta_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 a7bb4b0..5ad73f7 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -16,88 +16,325 @@
/*
* 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 fcpl; /* File creation property */
- 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 fcpl; /* File creation property */
+ 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;
+
+ /* Get a copy of file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
/* Set file space handling strategy */
- fcpl = H5Pcreate(H5P_FILE_CREATE);
- ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
- assert(ret >= 0);
+ if(H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
- /* Create dataset */
- file = H5Fcreate(FILE, H5F_ACC_TRUNC, fcpl, fapl);
+ /* 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 */
+ if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Create dataset */
- dset_id = H5Dcreate2(file, DATASET_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* 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_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 ddafd81..0a6733d 100644
--- a/tools/h5stat/testfiles/h5stat_filters.ddl
+++ b/tools/h5stat/testfiles/h5stat_filters.ddl
@@ -35,10 +35,10 @@ File space information for file metadata (in bytes):
Free-space managers:
Header: 0
Amount of free space: 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
@@ -47,10 +47,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
@@ -79,7 +79,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 5665b35..d79c99f 100644
--- a/tools/h5stat/testfiles/h5stat_help1.ddl
+++ b/tools/h5stat/testfiles/h5stat_help1.ddl
@@ -9,10 +9,19 @@ 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, --freespace Print free space information
-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 3fb303a..af48e3a 100644
--- a/tools/h5stat/testfiles/h5stat_help2.ddl
+++ b/tools/h5stat/testfiles/h5stat_help2.ddl
@@ -9,10 +9,19 @@ 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, --freespace Print free space information
-S, --summary Print summary of file space information
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.ddl b/tools/h5stat/testfiles/h5stat_newgrat.ddl
index b93fa17..7d4ef91 100644
--- a/tools/h5stat/testfiles/h5stat_newgrat.ddl
+++ b/tools/h5stat/testfiles/h5stat_newgrat.ddl
@@ -33,14 +33,14 @@ File space information for file metadata (in bytes):
B-tree/List: 0
Heap: 0
Free-space managers:
- Header: 1584
- Amount of free space: 6042
-Small groups:
- # of groups of size 0: 35000
+ Header: 180
+ Amount of free space: 132
+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
@@ -48,8 +48,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
@@ -74,7 +74,7 @@ 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
@@ -83,20 +83,15 @@ Attribute bins:
Free-space section threshold: 1 bytes
Small size free-space sections (< 10 bytes):
# of sections of size 1: 1
- # of sections of size 2: 12
- # of sections of size 3: 1
- # of sections of size 7: 1
- # of sections of size 8: 2
- Total # of small size sections: 17
+ Total # of small size sections: 1
Free-space section bins:
- # of sections of size 1 - 9: 17
- # of sections of size 10 - 99: 49
- # of sections of size 100 - 999: 27
- Total # of sections: 93
+ # of sections of size 1 - 9: 1
+ # of sections of size 10 - 99: 4
+ Total # of sections: 5
File space management strategy: H5F_FILE_SPACE_ALL_PERSIST
Summary of file space information:
- File metadata: 6363440 bytes
+ File metadata: 6362036 bytes
Raw data: 0 bytes
- Amount/Percent of tracked free space: 6042 bytes/0.1%
+ Amount/Percent of tracked free space: 132 bytes/0.0%
Unaccounted space: 0 bytes
-Total space: 6369482 bytes
+Total space: 6362168 bytes
diff --git a/tools/h5stat/testfiles/h5stat_newgrat.h5 b/tools/h5stat/testfiles/h5stat_newgrat.h5
index cb5f47f..c919b71 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_tsohm.ddl b/tools/h5stat/testfiles/h5stat_tsohm.ddl
index 6ee8aa8..788421b 100644
--- a/tools/h5stat/testfiles/h5stat_tsohm.ddl
+++ b/tools/h5stat/testfiles/h5stat_tsohm.ddl
@@ -35,11 +35,11 @@ File space information for file metadata (in bytes):
Free-space managers:
Header: 0
Amount of free space: 0
-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
@@ -47,8 +47,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
@@ -73,7 +73,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."