summaryrefslogtreecommitdiffstats
path: root/tools/h5stat
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2016-04-24 08:21:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2016-04-24 08:21:09 (GMT)
commit4f831405cb0130769fd85e7e6d88e560a45833ff (patch)
tree7c8cdfe159d47e561e9c56babadeb104262302fc /tools/h5stat
parentb0980a5f5418dcfabb442592d82eebb625dc6220 (diff)
downloadhdf5-4f831405cb0130769fd85e7e6d88e560a45833ff.zip
hdf5-4f831405cb0130769fd85e7e6d88e560a45833ff.tar.gz
hdf5-4f831405cb0130769fd85e7e6d88e560a45833ff.tar.bz2
[svn-r29779] Description:
Bring over some of the tool testing for the new chunk indices. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (h5committest forthcoming)
Diffstat (limited to 'tools/h5stat')
-rw-r--r--tools/h5stat/h5stat_gentest.c104
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.ddl93
-rw-r--r--tools/h5stat/testfiles/h5stat_idx.h5bin0 -> 2206 bytes
-rw-r--r--tools/h5stat/testh5stat.sh.in4
4 files changed, 201 insertions, 0 deletions
diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c
index ad7d093..b1ab168 100644
--- a/tools/h5stat/h5stat_gentest.c
+++ b/tools/h5stat/h5stat_gentest.c
@@ -32,6 +32,11 @@
#define NUM_GRPS 35000
#define NUM_ATTRS 100
+/* Declarations for gen_idx_file() */
+#define IDX_FILE "h5stat_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
+
/* For gen_threshold_file() */
#define THRESHOLD_FILE "h5stat_threshold.h5"
#define THRES_ATTR_NAME "attr"
@@ -335,11 +340,110 @@ error:
} /* gen_threshold_file() */
+/*
+ * Function: gen_idx_file
+ *
+ * Purpose: Create a file with datasets that use Fixed Array indexing:
+ * one dataset: fixed dimension, chunked layout, w/o filters
+ * one dataset: fixed dimension, chunked layout, w/ filters
+ *
+ */
+static void
+gen_idx_file(const char *fname)
+{
+ hid_t fapl = -1; /* file access property id */
+ hid_t fid = -1; /* file id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1, did2 = -1; /* dataset id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
+
+ /* Get a copy of the file access property */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+
+ /* Set the "use the latest format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ goto error;
+
+ /* Create file */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
+
+ /* Create data */
+ for(i = 0; i < 10; i++)
+ buf[i] = i;
+
+ /* Set chunk */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
+ goto error;
+
+ /* Create a 1D dataset */
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ /* set deflate data */
+ if(H5Pset_deflate(dcpl, 9) < 0)
+ goto error;
+
+ /* Create and write the dataset */
+ if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ /* Close the dataset */
+ if(H5Dclose(did2) < 0)
+ goto error;
+#endif
+
+ /* closing: dataspace, dataset, file */
+ if(H5Pclose(fapl) < 0)
+ goto error;
+ if(H5Pclose(dcpl) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(dcpl);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Fclose(fid);
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ H5Dclose(did2);
+#endif
+ } H5E_END_TRY;
+
+} /* gen_idx_file() */
+
int main(void)
{
gen_newgrat_file(NEWGRAT_FILE);
gen_threshold_file(THRESHOLD_FILE);
+ /* Generate an HDF file to test for datasets with Fixed Array indexing */
+ gen_idx_file(IDX_FILE);
+
return 0;
}
diff --git a/tools/h5stat/testfiles/h5stat_idx.ddl b/tools/h5stat/testfiles/h5stat_idx.ddl
new file mode 100644
index 0000000..b26f1a4
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_idx.ddl
@@ -0,0 +1,93 @@
+Filename: h5stat_idx.h5
+File information
+ # of unique groups: 1
+ # of unique datasets: 2
+ # of unique named datatypes: 0
+ # of unique links: 0
+ # of unique other: 0
+ Max. # of links to object: 1
+ Max. # of objects in group: 2
+File space information for file metadata (in bytes):
+ Superblock: 48
+ Superblock extension: 0
+ User block: 0
+ Object headers: (total/unused)
+ Groups: 147/47
+ Datasets(exclude compact data): 568/362
+ Datatypes: 0/0
+ Groups:
+ B-tree/List: 0
+ Heap: 0
+ Attributes:
+ B-tree/List: 0
+ Heap: 0
+ Chunked datasets:
+ Index: 202
+ Datasets:
+ Heap: 0
+ Shared Messages:
+ Header: 0
+ B-tree/List: 0
+ Heap: 0
+ Free-space managers:
+ Header: 0
+ Amount of free space: 0
+Small groups (with 0 to 9 links):
+ # of groups with 2 link(s): 1
+ Total # of small groups: 1
+Group bins:
+ # of groups with 1 - 9 links: 1
+ Total # of groups: 1
+Dataset dimension information:
+ Max. rank of datasets: 1
+ Dataset ranks:
+ # of dataset with rank 1: 2
+1-D Dataset information:
+ Max. dimension size of 1-D datasets: 10
+ Small 1-D datasets (with dimension sizes 0 to 9):
+ Total # of small datasets: 0
+ 1-D Dataset dimension bins:
+ # of datasets with dimension size 10 - 99: 2
+ Total # of datasets: 2
+Dataset storage information:
+ Total raw data size: 110
+ Total external raw data size: 0
+Dataset layout information:
+ Dataset layout counts[COMPACT]: 0
+ Dataset layout counts[CONTIG]: 0
+ Dataset layout counts[CHUNKED]: 2
+ Dataset layout counts[VIRTUAL]: 0
+ Number of external files : 0
+Dataset filters information:
+ Number of datasets with:
+ NO filter: 1
+ GZIP filter: 1
+ 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) = (2/0)
+ Size (desc./elmt) = (14/4)
+ Total dataset datatype count: 2
+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
+ Max. # of attributes to objects: 0
+Free-space section threshold: 1 bytes
+Small size free-space sections (< 10 bytes):
+ Total # of small size sections: 0
+Free-space section bins:
+ Total # of sections: 0
+File space management strategy: H5F_FILE_SPACE_ALL
+Summary of file space information:
+ File metadata: 965 bytes
+ Raw data: 110 bytes
+ Amount/Percent of tracked free space: 0 bytes/0.0%
+ Unaccounted space: 1131 bytes
+Total space: 2206 bytes
diff --git a/tools/h5stat/testfiles/h5stat_idx.h5 b/tools/h5stat/testfiles/h5stat_idx.h5
new file mode 100644
index 0000000..303d1f8
--- /dev/null
+++ b/tools/h5stat/testfiles/h5stat_idx.h5
Binary files differ
diff --git a/tools/h5stat/testh5stat.sh.in b/tools/h5stat/testh5stat.sh.in
index 4d698da..b48f327 100644
--- a/tools/h5stat/testh5stat.sh.in
+++ b/tools/h5stat/testh5stat.sh.in
@@ -74,6 +74,7 @@ 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_idx.h5
$SRC_H5STAT_TESTFILES/h5stat_threshold.h5
"
@@ -94,6 +95,7 @@ $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_idx.ddl
$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
@@ -259,6 +261,8 @@ 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
+# h5stat_idx.h5 is generated by h5stat_gentest.c
+TOOLTEST h5stat_idx.ddl h5stat_idx.h5
#
# Tests for -l (--links) option on h5stat_threshold.h5:
# -l 0 (incorrect threshold value)