diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-12-30 22:59:33 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2003-12-30 22:59:33 (GMT) |
commit | d8531b84827b78bc481ccdac77693fb9247ba979 (patch) | |
tree | e16e1dd108cccef622c4e1f4c459fba6fc224cbe /tools/h5repack/testh5repack_main.c | |
parent | 95da5842dfd4caaca02460a6ff1ffa22b8b9a312 (diff) | |
download | hdf5-d8531b84827b78bc481ccdac77693fb9247ba979.zip hdf5-d8531b84827b78bc481ccdac77693fb9247ba979.tar.gz hdf5-d8531b84827b78bc481ccdac77693fb9247ba979.tar.bz2 |
[svn-r7997] Purpose:
h5repack new features
Description:
added support for layout options
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'tools/h5repack/testh5repack_main.c')
-rw-r--r-- | tools/h5repack/testh5repack_main.c | 261 |
1 files changed, 249 insertions, 12 deletions
diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index 4385247..ab5da12 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -103,7 +103,6 @@ error: * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> * September, 19, 2003 * - * Modifications: * *------------------------------------------------------------------------- */ @@ -145,7 +144,7 @@ test_filter_deflate(void) TEST_ERROR; if (h5repack_addfilter("dset1:GZIP 9",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("dset1:20x10",&pack_options)<0) + if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -165,7 +164,7 @@ test_filter_deflate(void) TEST_ERROR; if (h5repack_addfilter("GZIP 9",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("20x10",&pack_options)<0) + if (h5repack_addlayout("CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -207,7 +206,6 @@ error: * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> * December, 19, 2003 * - * Modifications: * *------------------------------------------------------------------------- */ @@ -232,7 +230,7 @@ test_filter_szip(void) TEST_ERROR; if (h5repack_addfilter("dset2:SZIP 8",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("dset2:20x10",&pack_options)<0) + if (h5repack_addlayout("dset2:CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -254,7 +252,7 @@ test_filter_szip(void) TEST_ERROR; if (h5repack_addfilter("SZIP 8",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("20x10",&pack_options)<0) + if (h5repack_addlayout("CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -322,7 +320,7 @@ test_filter_shuffle(void) TEST_ERROR; if (h5repack_addfilter("dset1:SHUF",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("dset1:20x10",&pack_options)<0) + if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -342,7 +340,7 @@ test_filter_shuffle(void) TEST_ERROR; if (h5repack_addfilter("SHUF",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("20x10",&pack_options)<0) + if (h5repack_addlayout("CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -384,8 +382,6 @@ error: * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> * September, 19, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -409,7 +405,7 @@ test_filter_checksum(void) TEST_ERROR; if (h5repack_addfilter("dset1:FLET",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("dset1:20x10",&pack_options)<0) + if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -429,7 +425,7 @@ test_filter_checksum(void) TEST_ERROR; if (h5repack_addfilter("FLET",&pack_options)<0) TEST_ERROR; - if (h5repack_addchunk("20x10",&pack_options)<0) + if (h5repack_addlayout("CHUNK 20x10",&pack_options)<0) TEST_ERROR; if (h5repack(FNAME4,FNAME4OUT,&pack_options)<0) TEST_ERROR; @@ -455,6 +451,229 @@ error: } +/*------------------------------------------------------------------------- + * Function: test_layout_chunked + * + * Purpose: + * + * 1) test the CHUNK layout options + * 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 layout input on the output file + * + * Return: Success: zero + * Failure: 1 + * + * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> + * December 30, 2003 + * + *------------------------------------------------------------------------- + */ +static int +test_layout_chunked(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(" layout chunked"); + +/*------------------------------------------------------------------------- + * test an individual object option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("dset1:CHUNK 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; + +/*------------------------------------------------------------------------- + * test all objects option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("CHUNK 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(); + return 0; + +error: + return 1; + + +} + + +/*------------------------------------------------------------------------- + * Function: test_layout_contiguous + * + * Purpose: + * + * 1) test the CONTI layout options + * 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 layout input on the output file + * + * Return: Success: zero + * Failure: 1 + * + * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> + * December 30, 2003 + * + *------------------------------------------------------------------------- + */ +static int +test_layout_contiguous(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(" layout contiguous"); + +/*------------------------------------------------------------------------- + * test an individual object option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("dset1:CONTI",&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; + +/*------------------------------------------------------------------------- + * test all objects option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("CONTI",&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(); + return 0; + +error: + return 1; + + +} + + +/*------------------------------------------------------------------------- + * Function: test_layout_compact + * + * Purpose: + * + * 1) test the COMPA layout options + * 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 layout input on the output file + * + * Return: Success: zero + * Failure: 1 + * + * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu> + * December 30, 2003 + * + *------------------------------------------------------------------------- + */ +static int +test_layout_compact(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(" layout compact"); + +/*------------------------------------------------------------------------- + * test an individual object option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("dset1:COMPA",&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; + +/*------------------------------------------------------------------------- + * test all objects option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0)<0) + TEST_ERROR; + if (h5repack_addlayout("COMPA",&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(); + return 0; + +error: + return 1; + + +} + + + /*------------------------------------------------------------------------- * Function: main @@ -483,6 +702,8 @@ int main (void) if (make_testfiles()<0) goto error; +#if 1 + /* test a copy with no filters */ nerrors += test_copy(); @@ -498,6 +719,22 @@ int main (void) /* test a copy with the checksum filter */ nerrors += test_filter_checksum(); + /* test a copy with layout CHUNK options */ + nerrors += test_layout_chunked(); + +#endif + +#if 0 + + /* test a copy with layout CONTI options */ + nerrors += test_layout_contiguous(); + + /* test a copy with layout COMPA options */ + nerrors += test_layout_compact(); + +#endif + + /* check for errors */ if (nerrors) goto error; |