From 698f1af7cef2b2b471a8938d122fb44b2d94c0a2 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Wed, 7 Apr 2004 20:44:14 -0500 Subject: [svn-r8320] Purpose: new tests for h5repack Description: added more tests both to the test program and shell script that test a variation of different filter converssions Solution: Platforms tested: linux Misc. update: --- MANIFEST | 2 + tools/h5repack/h5repack.c | 6 +- tools/h5repack/h5repack.sh | 113 ++++++++++++++++++++++++++++++++++--- tools/h5repack/testh5repack_main.c | 61 +++++++++++++++++++- tools/h5repack/testh5repack_make.c | 2 - tools/testfiles/test1.h5 | Bin 0 -> 33920 bytes tools/testfiles/test3.h5 | Bin 0 -> 6984 bytes tools/testfiles/test4.h5 | Bin 35552 -> 53600 bytes 8 files changed, 172 insertions(+), 12 deletions(-) create mode 100644 tools/testfiles/test1.h5 create mode 100644 tools/testfiles/test3.h5 diff --git a/MANIFEST b/MANIFEST index 89d0dc5..5ee300b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1474,6 +1474,8 @@ ./tools/testfiles/h5diff_80.txt #test files for h5repack +./tools/testfiles/test1.h5 +./tools/testfiles/test3.h5 ./tools/testfiles/test4.h5 ./tools/testfiles/h5repack_info.txt diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index f980e3e..21166b7 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -338,7 +338,11 @@ static int check_options(pack_opt_t *options) szip_pixels_per_block=pack.filter[j].cd_values[0]; /* check szip parameters */ - if (check_szip(0, /* do not test size */ + if ( pack.chunk.rank!=-1 /* + it means a layout was not input, so there is no + case to try to check it + */ + && check_szip(0, /* do not test size */ pack.chunk.rank, pack.chunk.chunk_lengths, szip_options_mask, diff --git a/tools/h5repack/h5repack.sh b/tools/h5repack/h5repack.sh index bac641a..a471ba9 100644 --- a/tools/h5repack/h5repack.sh +++ b/tools/h5repack/h5repack.sh @@ -99,35 +99,132 @@ DIFFTEST() # -#The tests -#We use the file "test4.h5" generated by h5repacktst -#Each run generates "file4.out.h5" and the tool h5diff is used to +# The tests +# We use the files generated by h5repacktst +# Each run generates "file4.out.h5" and the tool h5diff is used to # compare the input and output files # + +# copy files +TOOLTEST -i test1.h5 -o test1.out.h5 +DIFFTEST test1.h5 test1.out.h5 + +TOOLTEST -i test3.h5 -o test3.out.h5 +DIFFTEST test3.h5 test3.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 DIFFTEST test4.h5 test4.out.h5 + +#TOOLTEST -i test5.h5 -o test5.out.h5 +#DIFFTEST test5.h5 test5.out.h5 + +# remove all filters +TOOLTEST -i test4.h5 -o test4.out.h5 -f NONE +DIFFTEST test4.h5 test4.out.h5 + +# remove one filter +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset_gzip:NONE +DIFFTEST test4.h5 test4.out.h5 + +# gzip +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:GZIP=9 +DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -f GZIP=1 DIFFTEST test4.h5 test4.out.h5 + +# szip +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:SZIP=8 +DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -f SZIP=8 DIFFTEST test4.h5 test4.out.h5 + +# shuffle +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:SHUF +DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -f SHUF DIFFTEST test4.h5 test4.out.h5 -TOOLTEST -i test4.h5 -o test4.out.h5 -f FLET + +# fletcher +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:FLET DIFFTEST test4.h5 test4.out.h5 -TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:SHUF -f dset1,dset2:GZIP=6 + +TOOLTEST -i test4.h5 -o test4.out.h5 -f FLET DIFFTEST test4.h5 test4.out.h5 -TOOLTEST -i test4.h5 -o test4.out.h5 -l dset1:CHUNK=20x10 -f dset1,dset2:SZIP=8 + +#layout chunk +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset1:CHUNK=20x10 DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -l CHUNK=20x10 DIFFTEST test4.h5 test4.out.h5 + +#layout compact +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset1:COMPA +DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -l COMPA DIFFTEST test4.h5 test4.out.h5 + +#layout contiguous +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset1:CONTI +DIFFTEST test4.h5 test4.out.h5 + TOOLTEST -i test4.h5 -o test4.out.h5 -l CONTI DIFFTEST test4.h5 test4.out.h5 -TOOLTEST -i test4.h5 -o test4.out.h5 -f GZIP=1 -m 1024 + +#conversions +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_compact:CONTI +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_compact:CHUNK=2x5 +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_compact:COMPA +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_contiguous:COMPA +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_contiguous:CHUNK=3x6 +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_contiguous:CONTI +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_chunk:COMPA +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_chunk:CONTI +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset_chunk:CHUNK=18x13 +DIFFTEST test4.h5 test4.out.h5 + +#filters +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset1:SHUF -f dset1,dset2:GZIP=6 +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -l dset1:CHUNK=20x10 -f dset1,dset2:SZIP=8 +DIFFTEST test4.h5 test4.out.h5 + +#filter conversions +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset_gzip:SZIP=8 +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset_szip:GZIP=1 +DIFFTEST test4.h5 test4.out.h5 + +TOOLTEST -i test4.h5 -o test4.out.h5 -f dset_all:GZIP=1 DIFFTEST test4.h5 test4.out.h5 -TOOLTEST -i test4.h5 -o test4.out.h5 -f NONE + +#limit +TOOLTEST -i test4.h5 -o test4.out.h5 -f GZIP=1 -m 1024 DIFFTEST test4.h5 test4.out.h5 + +#file #TOOLTEST -i test4.h5 -o test4.out.h5 -e h5repack_info.txt #DIFFTEST test4.h5 test4.out.h5 diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index a008455..dbd6f58 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -702,7 +702,7 @@ int main (void) PASSED(); - TESTING(" filter queue"); + TESTING(" filter queue fletcher, shuffle, deflate, szip"); /*------------------------------------------------------------------------- * add some filters @@ -734,6 +734,65 @@ int main (void) PASSED(); + TESTING(" filter conversion from deflate to szip"); +/*------------------------------------------------------------------------- + * filter conversion from deflate to szip + *------------------------------------------------------------------------- + */ + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset_gzip:SZIP=8",&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(); + + TESTING(" filter conversion from szip to deflate"); +/*------------------------------------------------------------------------- + * filter conversion from szip to deflate + *------------------------------------------------------------------------- + */ + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset_szip:GZIP=1",&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(); + + TESTING(" filter conversion from 2 filters to 1 filter"); +/*------------------------------------------------------------------------- + * filter conversion from szip to deflate + *------------------------------------------------------------------------- + */ + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addfilter("dset_all:GZIP=1",&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(); + + + puts("All h5repack tests passed."); return 0; diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index faacce4..fbf5cf5 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -84,9 +84,7 @@ int make_testfiles(void) return 0; out: - H5E_BEGIN_TRY { H5Fclose(loc_id); - } H5E_END_TRY; return -1; } diff --git a/tools/testfiles/test1.h5 b/tools/testfiles/test1.h5 new file mode 100644 index 0000000..ee6c239 Binary files /dev/null and b/tools/testfiles/test1.h5 differ diff --git a/tools/testfiles/test3.h5 b/tools/testfiles/test3.h5 new file mode 100644 index 0000000..38a2d87 Binary files /dev/null and b/tools/testfiles/test3.h5 differ diff --git a/tools/testfiles/test4.h5 b/tools/testfiles/test4.h5 index 7743eb5..b005b00 100644 Binary files a/tools/testfiles/test4.h5 and b/tools/testfiles/test4.h5 differ -- cgit v0.12