From 1f80ae6a89e0f21ffc7c2bd5355edc0182f82b35 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Thu, 8 Apr 2004 10:59:43 -0500 Subject: [svn-r8323] Purpose: bug fix, new tests Description: added a couple of #ifdefs to check if a specific filter is available for read added more tests the h5tools check filters had a mismatched filter variable Solution: Platforms tested: linux, with several filter configurations (all, some , none ) Misc. update: --- tools/h5repack/testh5repack_layout.c | 11 -- tools/h5repack/testh5repack_main.c | 319 +++++++++++++++++++++++------------ tools/lib/h5tools_filters.c | 2 +- 3 files changed, 212 insertions(+), 120 deletions(-) diff --git a/tools/h5repack/testh5repack_layout.c b/tools/h5repack/testh5repack_layout.c index 5cf39be..96e0ba6 100644 --- a/tools/h5repack/testh5repack_layout.c +++ b/tools/h5repack/testh5repack_layout.c @@ -16,21 +16,10 @@ #include "h5test.h" #include "h5repack.h" -#if 0 -#define CHUNK_DEBUG -#endif - -#if defined(CHUNK_DEBUG) -#define DIM1 39 -#define DIM2 20 -#define CDIM1 19 -#define CDIM2 10 -#else #define DIM1 40 #define DIM2 20 #define CDIM1 20 #define CDIM2 10 -#endif #define RANK 2 diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index dbd6f58..2faf20a 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -124,7 +124,7 @@ int main (void) *------------------------------------------------------------------------- */ PASSED(); - TESTING(" copy of datasets with filters"); + TESTING(" copy of datasets with all filters"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -161,19 +161,34 @@ int main (void) PASSED(); - TESTING(" removing one filter"); -/*------------------------------------------------------------------------- - * test the NONE specific option; uncompress a dataset - *------------------------------------------------------------------------- - */ + TESTING(" removing deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("dset_gzip:NONE",&pack_options)<0) TEST_ERROR; - if (h5repack_addfilter("dset1:NONE",&pack_options)<0) + 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 + + TESTING(" removing szip filter"); + +#ifdef H5_HAVE_FILTER_SZIP + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset_szip:NONE",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -189,18 +204,34 @@ int main (void) SKIPPED(); #endif + TESTING(" removing shuffle filter"); - TESTING(" deflate filter"); +#ifdef H5_HAVE_FILTER_SHUFFLE + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset_shuffle:NONE",&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; -#ifdef H5_HAVE_FILTER_DEFLATE + PASSED(); +#else + SKIPPED(); +#endif -/*------------------------------------------------------------------------- - * test no object option (preserve old filters) - *------------------------------------------------------------------------- - */ + TESTING(" removing fletcher filter"); +#ifdef H5_HAVE_FILTER_FLETCHER32 if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; + if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options)<0) + TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) == 1) @@ -210,6 +241,16 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); +#else + SKIPPED(); +#endif + + + + TESTING(" adding deflate filter"); + +#ifdef H5_HAVE_FILTER_DEFLATE /*------------------------------------------------------------------------- * test an individual object option @@ -230,12 +271,20 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); +#else + SKIPPED(); +#endif /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ + TESTING(" adding deflate filter to all"); + +#ifdef H5_HAVE_FILTER_DEFLATE + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("GZIP=9",&pack_options)<0) @@ -256,9 +305,12 @@ int main (void) SKIPPED(); #endif +/*------------------------------------------------------------------------- + * deflate + *------------------------------------------------------------------------- + */ - - TESTING(" szip filter"); + TESTING(" adding szip filter"); #ifdef H5_HAVE_FILTER_SZIP @@ -282,10 +334,19 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); +#else + SKIPPED(); +#endif + + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ +TESTING(" adding szip filter to all"); + +#ifdef H5_HAVE_FILTER_SZIP if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -306,7 +367,7 @@ int main (void) #endif - TESTING(" shuffle filter"); + TESTING(" addding shuffle filter"); #ifdef H5_HAVE_FILTER_SHUFFLE @@ -330,11 +391,20 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); +#else + SKIPPED(); +#endif + /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ +TESTING(" addding shuffle filter to all"); + +#ifdef H5_HAVE_FILTER_SHUFFLE + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("SHUF",&pack_options)<0) @@ -357,7 +427,7 @@ int main (void) - TESTING(" checksum filter"); + TESTING(" adding checksum filter"); #ifdef H5_HAVE_FILTER_FLETCHER32 @@ -380,12 +450,22 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + + PASSED(); +#else + SKIPPED(); +#endif /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ + + TESTING(" adding checksum filter to all"); + +#ifdef H5_HAVE_FILTER_FLETCHER32 + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; if (h5repack_addfilter("FLET",&pack_options)<0) @@ -406,16 +486,27 @@ int main (void) SKIPPED(); #endif - TESTING(" layout chunked"); + + TESTING(" filter queue fletcher, shuffle, deflate, szip"); /*------------------------------------------------------------------------- - * test an individual object option + * add some filters *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) + if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) + TEST_ERROR; +#if defined (H5_HAVE_FILTER_FLETCHER32) + if (h5repack_addfilter("dset1:FLET",&pack_options)<0) + TEST_ERROR; +#endif + if (h5repack_addfilter("dset1:SHUF",&pack_options)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0) + TEST_ERROR; + if (h5repack_addfilter("dset1:GZIP=1",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -426,14 +517,17 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); + + TESTING(" filter conversion from deflate to szip"); /*------------------------------------------------------------------------- - * test all objects option + * filter conversion from deflate to szip *------------------------------------------------------------------------- */ - +#ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) + if (h5repack_addfilter("dset_gzip:SZIP=8",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -443,18 +537,20 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); +#else + SKIPPED(); +#endif - TESTING(" layout contiguous"); - + TESTING(" filter conversion from szip to deflate"); /*------------------------------------------------------------------------- - * test an individual object option + * filter conversion from szip to deflate *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset1:CONTI",&pack_options)<0) + if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -464,14 +560,20 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); +#else + SKIPPED(); +#endif + TESTING(" filter conversion from szip and shuffle to deflate"); /*------------------------------------------------------------------------- - * test all objects option + * filter conversion from szip to deflate *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("CONTI",&pack_options)<0) + if (h5repack_addfilter("dset_all:GZIP=1",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -481,10 +583,12 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); +#else + SKIPPED(); +#endif - TESTING(" layout compact"); + TESTING(" adding layout chunked"); /*------------------------------------------------------------------------- * test an individual object option @@ -493,7 +597,7 @@ int main (void) if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset1:COMPA",&pack_options)<0) + if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -503,15 +607,17 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); /*------------------------------------------------------------------------- * test all objects option *------------------------------------------------------------------------- */ + TESTING(" adding layout chunked to all"); if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("COMPA",&pack_options)<0) + if (h5repack_addlayout("CHUNK=20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -521,19 +627,18 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - + PASSED(); - - TESTING(" layout compact to contiguous conversion"); + TESTING(" adding layout contiguous"); /*------------------------------------------------------------------------- - * layout compact to contiguous conversion + * test an individual object option *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_compact:CONTI",&pack_options)<0) + if (h5repack_addlayout("dset1:CONTI",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -543,17 +648,19 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout compact to chunk conversion"); + + PASSED(); + + TESTING(" adding layout contiguous to all"); + /*------------------------------------------------------------------------- - * layout compact to chunk conversion + * test all objects option *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options)<0) + if (h5repack_addlayout("CONTI",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -563,17 +670,19 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + + PASSED(); + + TESTING(" adding layout compact"); - TESTING(" layout compact to compact conversion"); - /*------------------------------------------------------------------------- - * layout compact to compact conversion + * test an individual object option *------------------------------------------------------------------------- */ + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_compact:COMPA",&pack_options)<0) + if (h5repack_addlayout("dset1:COMPA",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -583,16 +692,18 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout contiguous to compact conversion"); + PASSED(); + + TESTING(" adding layout compact to all"); + /*------------------------------------------------------------------------- - * layout contiguous to compact conversion + * test all objects option *------------------------------------------------------------------------- */ + if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options)<0) + if (h5repack_addlayout("COMPA",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -602,16 +713,19 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout contiguous to chunk conversion"); + + PASSED(); + + + TESTING(" layout compact to contiguous conversion"); + /*------------------------------------------------------------------------- - * layout contiguous to chunk conversion + * layout compact to contiguous conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options)<0) + if (h5repack_addlayout("dset_compact:CONTI",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -621,17 +735,17 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout contiguous to contiguous conversion"); + PASSED(); + + TESTING(" layout compact to chunk conversion"); /*------------------------------------------------------------------------- - * layout contiguous to contiguous conversion + * layout compact to chunk conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options)<0) + if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -641,16 +755,17 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); - TESTING(" layout chunked to compact conversion"); + TESTING(" layout compact to compact conversion"); + /*------------------------------------------------------------------------- - * layout chunked to compact conversion + * layout compact to compact conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_chunk:COMPA",&pack_options)<0) + if (h5repack_addlayout("dset_compact:COMPA",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -660,17 +775,16 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout chunked to contiguous conversion"); - + PASSED(); + + TESTING(" layout contiguous to compact conversion"); /*------------------------------------------------------------------------- - * layout chunked to contiguous conversion + * layout contiguous to compact conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_chunk:CONTI",&pack_options)<0) + if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -680,16 +794,16 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - - TESTING(" layout chunked to chunk conversion"); + PASSED(); + + TESTING(" layout contiguous to chunk conversion"); /*------------------------------------------------------------------------- - * layout chunked to chunked conversion + * layout contiguous to chunk conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options)<0) + if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -701,27 +815,15 @@ int main (void) TEST_ERROR; PASSED(); - - TESTING(" filter queue fletcher, shuffle, deflate, szip"); + TESTING(" layout contiguous to contiguous conversion"); /*------------------------------------------------------------------------- - * add some filters + * layout contiguous to contiguous conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) - TEST_ERROR; -#if defined (H5_HAVE_FILTER_FLETCHER32) - if (h5repack_addfilter("dset1:FLET",&pack_options)<0) - TEST_ERROR; -#endif - if (h5repack_addfilter("dset1:SHUF",&pack_options)<0) - TEST_ERROR; - if (h5repack_addfilter("dset1:SZIP=8",&pack_options)<0) - TEST_ERROR; - if (h5repack_addfilter("dset1:GZIP=1",&pack_options)<0) + if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -731,17 +833,16 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; + PASSED(); - PASSED(); - - TESTING(" filter conversion from deflate to szip"); + TESTING(" layout chunked to compact conversion"); /*------------------------------------------------------------------------- - * filter conversion from deflate to szip + * layout chunked to compact conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addfilter("dset_gzip:SZIP=8",&pack_options)<0) + if (h5repack_addlayout("dset_chunk:COMPA",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -751,16 +852,17 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); + + TESTING(" layout chunked to contiguous conversion"); - TESTING(" filter conversion from szip to deflate"); /*------------------------------------------------------------------------- - * filter conversion from szip to deflate + * layout chunked to contiguous conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options)<0) + if (h5repack_addlayout("dset_chunk:CONTI",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -770,16 +872,16 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); - TESTING(" filter conversion from 2 filters to 1 filter"); + TESTING(" layout chunked to chunk conversion"); /*------------------------------------------------------------------------- - * filter conversion from szip to deflate + * layout chunked to chunked conversion *------------------------------------------------------------------------- */ if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; - if (h5repack_addfilter("dset_all:GZIP=1",&pack_options)<0) + if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -789,7 +891,8 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); + diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index f02ec83..c76c3de 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -114,7 +114,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr *------------------------------------------------------------------------- */ case H5Z_FILTER_SHUFFLE: - if (!have_szip) + if (!have_shuffle) { if (name) print_warning(name,"shuffle"); -- cgit v0.12