[svn-r22220] Feature: HDFFV-7981

Added test to verify h5repack --metadata option produces bigger size file.

Tested: h5committest (koala, jam, ostrich).
This commit is contained in:
Albert Cheng 2012-03-31 15:50:31 -05:00
parent c2a9dcb897
commit 8123f8221a

View File

@ -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();