From 8123f8221a0ba358d8a371c3ce43f2a1f931b55a Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 31 Mar 2012 15:50:31 -0500 Subject: [svn-r22220] Feature: HDFFV-7981 Added test to verify h5repack --metadata option produces bigger size file. Tested: h5committest (koala, jam, ostrich). --- tools/h5repack/h5repacktst.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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(); -- cgit v0.12