summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2012-03-31 20:50:31 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2012-03-31 20:50:31 (GMT)
commit8123f8221a0ba358d8a371c3ce43f2a1f931b55a (patch)
tree6b6772060242b01c1cc90dc59363b0bd9dfcc399 /tools
parentc2a9dcb8977f81ff8e66bfd41c72f106993d3086 (diff)
downloadhdf5-8123f8221a0ba358d8a371c3ce43f2a1f931b55a.zip
hdf5-8123f8221a0ba358d8a371c3ce43f2a1f931b55a.tar.gz
hdf5-8123f8221a0ba358d8a371c3ce43f2a1f931b55a.tar.bz2
[svn-r22220] Feature: HDFFV-7981
Added test to verify h5repack --metadata option produces bigger size file. Tested: h5committest (koala, jam, ostrich).
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/h5repacktst.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 5d72ce4..5c6f87b 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -171,6 +171,8 @@ int main (void)
diff_opt_t diff_options;
hsize_t fs_size = 0; /* free space section threshold */
H5F_file_space_type_t fs_type = H5F_FILE_SPACE_DEFAULT; /* file space handling strategy */
+ h5_stat_t file_stat;
+ h5_stat_size_t fsize1, fsize2; /* file sizes */
#if defined (H5_HAVE_FILTER_SZIP)
int szip_can_encode = 0;
#endif
@@ -1561,18 +1563,36 @@ int main (void)
/*-------------------------------------------------------------------------
* test --metadata_block_size option
+ * Also verify that output file using the metadata_block_size option is
+ * larger than the output file one not using it.
*-------------------------------------------------------------------------
*/
TESTING(" metadata block size option");
if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0)
GOERROR;
+ /* First run without metadata option. No need to verify the correctness */
+ /* since this has been verified by earlier tests. Just record the file */
+ /* size of the output file. */
+ if(h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
+ GOERROR;
+ if (HDstat(FNAME1OUT, &file_stat) < 0)
+ GOERROR;
+ fsize1 = file_stat.st_size;
+ /* run it again with metadata option */
pack_options.meta_block_size = 8192;
if(h5repack(FNAME1, FNAME1OUT, &pack_options) < 0)
GOERROR;
if(h5diff(FNAME1, FNAME1OUT, NULL, NULL, &diff_options) > 0)
GOERROR;
+ /* record the file size of the output file */
+ if (HDstat(FNAME1OUT, &file_stat) < 0)
+ GOERROR;
+ fsize2 = file_stat.st_size;
if(h5repack_verify(FNAME1, FNAME1OUT, &pack_options) <= 0)
GOERROR;
+ /* verify second file size is larger than the first one */
+ if(fsize2 <= fsize1)
+ GOERROR;
if(h5repack_end(&pack_options) < 0)
GOERROR;
PASSED();