diff options
Diffstat (limited to 'tools/h5repack/testh5repack_main.c')
-rw-r--r-- | tools/h5repack/testh5repack_main.c | 106 |
1 files changed, 98 insertions, 8 deletions
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index 83b9b77..e46dd53 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -81,17 +81,15 @@ error: } - - /*------------------------------------------------------------------------- * Function: test_filter_deflate * * Purpose: * - * 1) compress/chunk FILENAME with teh DEFLATE filter + * 1) compress/chunk FILENAME with the DEFLATE filter * 2) use the h5diff utility to compare the input and output file; * it returns RET==0 if the objects have the same data - * 3) use API functions to verify the compression/chunking input on the otput file + * 3) use API functions to verify the compression/chunking input on the output file * * Return: Success: zero * Failure: 1 @@ -109,30 +107,119 @@ test_filter_deflate(void) pack_opt_t pack_options; diff_opt_t diff_options; memset(&diff_options, 0, sizeof (diff_opt_t)); + memset(&pack_options, 0, sizeof (pack_opt_t)); TESTING(" deflate filter"); +#ifdef H5_HAVE_FILTER_DEFLATE + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:GZIP 9",&pack_options)<0) + TEST_ERROR; + if (h5repack_addchunk("dset1:20x10",&pack_options)<0) + TEST_ERROR; + if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) + TEST_ERROR; + if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) + TEST_ERROR; + if (h5repack_verify(FNAME4OUT,&pack_options)<=0) + TEST_ERROR; + if (h5repack_end (&pack_options)<0) + TEST_ERROR; + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addcomp("dset_gzip:GZIP 9",&pack_options)<0) + if (h5repack_addfilter("GZIP 9",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("dset_gzip:5x4",&pack_options)<0) + if (h5repack_addchunk("20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; + if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) + TEST_ERROR; + if (h5repack_verify(FNAME4OUT,&pack_options)<=0) + TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + + PASSED(); +#else + SKIPPED(); +#endif + return 0; + +#ifdef H5_HAVE_FILTER_DEFLATE +error: + return 1; +#endif + + +} + + +/*------------------------------------------------------------------------- + * Function: test_filter_szip + * + * Purpose: + * + * 1) compress/chunk FILENAME with the SZIP filter + * 2) use the h5diff utility to compare the input and output file; + * it returns RET==0 if the objects have the same data + * 3) use API functions to verify the compression/chunking input on the output file + * + * Return: Success: zero + * Failure: 1 + * + * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> + * December, 19, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_filter_szip(void) +{ + pack_opt_t pack_options; + diff_opt_t diff_options; + memset(&diff_options, 0, sizeof (diff_opt_t)); + memset(&pack_options, 0, sizeof (pack_opt_t)); + + TESTING(" szip filter"); + +#ifdef H5_HAVE_FILTER_SZIP + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset2:SZIP 8",&pack_options)<0) + TEST_ERROR; + if (h5repack_addchunk("dset2:20x10",&pack_options)<0) + TEST_ERROR; + if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) + TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) TEST_ERROR; + if (h5repack_verify(FNAME4OUT,&pack_options)<=0) + TEST_ERROR; + if (h5repack_end (&pack_options)<0) + TEST_ERROR; - PASSED(); + PASSED(); +#else + SKIPPED(); +#endif return 0; +#ifdef H5_HAVE_FILTER_SZIP error: return 1; +#endif + } + /*------------------------------------------------------------------------- * Function: main * @@ -157,7 +244,8 @@ int main (void) puts("Testing h5repack:"); /* make the test files */ - nerrors += make_testfiles(); + if (make_testfiles()<0) + goto error; /* test a copy with no filters */ nerrors += test_copy(); @@ -165,6 +253,8 @@ int main (void) /* test a copy with the deflate filter */ nerrors += test_filter_deflate(); + /* test a copy with the szip filter */ + nerrors += test_filter_szip(); /* check for errors */ if (nerrors) |