diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2013-01-11 21:34:31 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2013-01-11 21:34:31 (GMT) |
commit | 3a7b11863a86b07935707b2896a5fd9f7eebf9a3 (patch) | |
tree | 57712960393292ac85cd61d5c7c09b668a0f1c6b /test | |
parent | 7b895e1dd8c9fdba0d94bf4100a1be77ee05a64b (diff) | |
download | hdf5-3a7b11863a86b07935707b2896a5fd9f7eebf9a3.zip hdf5-3a7b11863a86b07935707b2896a5fd9f7eebf9a3.tar.gz hdf5-3a7b11863a86b07935707b2896a5fd9f7eebf9a3.tar.bz2 |
[svn-r23152] I took out the obsolete function H5PSIwrite_chunk and its related test and performance test.
Tested on koala.
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 52 | ||||
-rw-r--r-- | test/dectris_tst.c | 326 |
3 files changed, 23 insertions, 359 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 64088b8..fd40ad6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -39,7 +39,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ - big mtime fillval mount flush1 flush2 app_ref enum dectris_tst \ + big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf farray earray btree2 fheap file_image @@ -128,7 +128,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse earray.h5 efc[0-5].h5 log_vfd_out.log \ new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ - file_image_core_test.h5.copy dectris.h5 + file_image_core_test.h5.copy # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/Makefile.in b/test/Makefile.in index 09b4f93..6f39794 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -107,8 +107,8 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ external$(EXEEXT) efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \ unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ - app_ref$(EXEEXT) enum$(EXEEXT) dectris_tst$(EXEEXT) \ - set_extent$(EXEEXT) ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ + app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ + ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ enc_dec_plist_with_endianess$(EXEEXT) getname$(EXEEXT) \ vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ @@ -168,10 +168,6 @@ dangle_SOURCES = dangle.c dangle_OBJECTS = dangle.$(OBJEXT) dangle_LDADD = $(LDADD) dangle_DEPENDENCIES = libh5test.la $(LIBHDF5) -dectris_tst_SOURCES = dectris_tst.c -dectris_tst_OBJECTS = dectris_tst.$(OBJEXT) -dectris_tst_LDADD = $(LDADD) -dectris_tst_DEPENDENCIES = libh5test.la $(LIBHDF5) dsets_SOURCES = dsets.c dsets_OBJECTS = dsets.$(OBJEXT) dsets_LDADD = $(LDADD) @@ -471,7 +467,23 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ - cross_read.c dangle.c dectris_tst.c dsets.c dt_arith.c \ + cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ + earray.c efc.c enc_dec_plist.c enc_dec_plist_with_endianess.c \ + enum.c err_compat.c error_test.c extend.c external.c farray.c \ + fheap.c file_image.c fillval.c filter_fail.c flush1.c flush2.c \ + freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ + gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \ + gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ + gen_new_super.c gen_noencoder.c gen_nullspace.c gen_plist.c \ + gen_sizes_lheap.c gen_specmetaread.c gen_udlinks.c getname.c \ + gheap.c hyperslab.c istore.c lheap.c links.c links_env.c mf.c \ + mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \ + set_extent.c space_overflow.c stab.c tcheck_version.c \ + $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ + vfd.c +DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \ + bittests.c btree2.c cache.c cache_api.c cache_tagging.c \ + cmpd_dset.c cross_read.c dangle.c dsets.c dt_arith.c \ dtransform.c dtypes.c earray.c efc.c enc_dec_plist.c \ enc_dec_plist_with_endianess.c enum.c err_compat.c \ error_test.c extend.c external.c farray.c fheap.c file_image.c \ @@ -485,23 +497,6 @@ SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c \ space_overflow.c stab.c tcheck_version.c $(testhdf5_SOURCES) \ testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c -DIST_SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c \ - bittests.c btree2.c cache.c cache_api.c cache_tagging.c \ - cmpd_dset.c cross_read.c dangle.c dectris_tst.c dsets.c \ - dt_arith.c dtransform.c dtypes.c earray.c efc.c \ - enc_dec_plist.c enc_dec_plist_with_endianess.c enum.c \ - err_compat.c error_test.c extend.c external.c farray.c fheap.c \ - file_image.c fillval.c filter_fail.c flush1.c flush2.c \ - freespace.c gen_bad_ohdr.c gen_bogus.c gen_cross.c \ - gen_deflate.c gen_file_image.c gen_filespace.c gen_filters.c \ - gen_new_array.c gen_new_fill.c gen_new_group.c gen_new_mtime.c \ - gen_new_super.c gen_noencoder.c gen_nullspace.c gen_plist.c \ - gen_sizes_lheap.c gen_specmetaread.c gen_udlinks.c getname.c \ - gheap.c hyperslab.c istore.c lheap.c links.c links_env.c mf.c \ - mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \ - set_extent.c space_overflow.c stab.c tcheck_version.c \ - $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \ - vfd.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -822,8 +817,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \ earray.h5 efc[0-5].h5 log_vfd_out.log new_multi_file_v16-r.h5 \ new_multi_file_v16-s.h5 split_get_file_image_test-m.h5 \ - split_get_file_image_test-r.h5 file_image_core_test.h5.copy \ - dectris.h5 + split_get_file_image_test-r.h5 file_image_core_test.h5.copy INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src # Test script for error_test and err_compat @@ -841,7 +835,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ - big mtime fillval mount flush1 flush2 app_ref enum dectris_tst \ + big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ freespace mf farray earray btree2 fheap file_image @@ -1012,9 +1006,6 @@ cross_read$(EXEEXT): $(cross_read_OBJECTS) $(cross_read_DEPENDENCIES) $(EXTRA_cr dangle$(EXEEXT): $(dangle_OBJECTS) $(dangle_DEPENDENCIES) $(EXTRA_dangle_DEPENDENCIES) @rm -f dangle$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dangle_OBJECTS) $(dangle_LDADD) $(LIBS) -dectris_tst$(EXEEXT): $(dectris_tst_OBJECTS) $(dectris_tst_DEPENDENCIES) $(EXTRA_dectris_tst_DEPENDENCIES) - @rm -f dectris_tst$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(dectris_tst_OBJECTS) $(dectris_tst_LDADD) $(LIBS) dsets$(EXEEXT): $(dsets_OBJECTS) $(dsets_DEPENDENCIES) $(EXTRA_dsets_DEPENDENCIES) @rm -f dsets$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dsets_OBJECTS) $(dsets_LDADD) $(LIBS) @@ -1223,7 +1214,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cross_read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dectris_tst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsets.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dt_arith.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtransform.Po@am__quote@ diff --git a/test/dectris_tst.c b/test/dectris_tst.c deleted file mode 100644 index 2dd6354..0000000 --- a/test/dectris_tst.c +++ /dev/null @@ -1,326 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * This test is for the DECTRIS project to the H5PSIdirect_write function - * - */ - -#include "h5test.h" -#include <math.h> -#include <stdlib.h> - -#ifdef H5_HAVE_FILTER_DEFLATE - -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) -# define H5_ZLIB_HEADER "zlib.h" -#endif -#if defined(H5_ZLIB_HEADER) -# include H5_ZLIB_HEADER /* "zlib.h" */ -#endif - -const char *FILENAME[] = { - "dectris", - NULL -}; - -#define DATASETNAME "Array" -#define RANK 2 -#define NX 16 -#define NY 16 -#define CHUNK_NX 4 -#define CHUNK_NY 4 - -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) - -int -main (void) -{ - char filename[1024]; - hid_t file; /* handles */ - hid_t fapl; - hid_t dataspace, dataset; - hid_t mem_space; - hid_t cparms, dxpl; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int ret; - int data[NX][NY]; - int check[NX][NY]; - int i, j, n; - - unsigned filter_mask = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - - const Bytef *z_src = (const Bytef*)(direct_buf); - Bytef *z_dst; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; - int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("H5PSIdirect_write for DECTRIS project"); - - /* Testing setup */ - h5_reset(); - fapl = h5_fileaccess(); - - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - TEST_ERROR; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - TEST_ERROR; - - /* - * Create a new file. If file exists its contents will be overwritten. - */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - TEST_ERROR; - - if((status = H5Pset_deflate( cparms, aggression)) < 0) - TEST_ERROR; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - TEST_ERROR; - - /* Initialize the dataset */ - for(i = n = 0; i < NX; i++) - for(j = 0; j < NY; j++) - data[i][j] = n++; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR; - - /* - * Write the data for the dataset. It should stay in the chunk cache. - * It will be evicted from the cache by the H5PSIdirect_write calls. - */ - if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, data)) < 0) - TEST_ERROR; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) - direct_buf[i][j] = n++; - - /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; - - /* Perform compression from the source to the destination buffer */ - ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); - - /* Check for various zlib errors */ - if(Z_BUF_ERROR == ret) { - fprintf(stderr, "overflow"); - TEST_ERROR; - } else if(Z_MEM_ERROR == ret) { - fprintf(stderr, "deflate memory error"); - TEST_ERROR; - } else if(Z_OK != ret) { - fprintf(stderr, "other deflate error"); - TEST_ERROR; - } - - /* Write the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ - for(i=0; i<NX/CHUNK_NX; i++) { - for(j=0; j<NY/CHUNK_NY; j++) { - status = H5PSIdirect_write(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf); - offset[1] += CHUNK_NY; - } - offset[0] += CHUNK_NX; - offset[1] = 0; - } - - if(outbuf) - free(outbuf); - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - /* Reopen the file and dataset */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) - TEST_ERROR; - - /* - * Select hyperslab for one chunk in the file - */ - start[0] = CHUNK_NX; start[1] = CHUNK_NY; - stride[0] = 1; stride[1] = 1; - count[0] = 1; count[1] = 1; - block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) - TEST_ERROR; - - /* Read the chunk back */ - if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - TEST_ERROR; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(direct_buf[i][j] != check_chunk[i][j]) { - printf(" 1. Read different values than written."); - printf(" At index %d,%d\n", i, j); - printf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]); - goto error; - } - } - } - - /* Reinitialize different data for one chunk */ - for(i = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) - direct_buf[i][j] = i + j; - - /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; - - /* Perform compression from the source to the destination buffer */ - ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); - - /* Check for various zlib errors */ - if(Z_BUF_ERROR == ret) { - fprintf(stderr, "overflow"); - TEST_ERROR; - } else if(Z_MEM_ERROR == ret) { - fprintf(stderr, "deflate memory error"); - TEST_ERROR; - } else if(Z_OK != ret) { - fprintf(stderr, "other deflate error"); - TEST_ERROR; - } - - /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ - offset[0] = offset[1] = 0; - for(i=0; i<NX/CHUNK_NX; i++) { - for(j=0; j<NY/CHUNK_NY; j++) { - status = H5PSIdirect_write(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf); - offset[1] += CHUNK_NY; - } - offset[0] += CHUNK_NX; - offset[1] = 0; - } - - if(outbuf) - free(outbuf); - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - /* Reopen the file and dataset */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) - TEST_ERROR; - - /* Read the chunk back */ - if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - TEST_ERROR; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(direct_buf[i][j] != check_chunk[i][j]) { - printf(" 2. Read different values than written."); - printf(" At index %d,%d\n", i, j); - printf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]); - goto error; - } - } - } - - - - /* - * Close/release resources. - */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Fclose(file); - - h5_cleanup(FILENAME, fapl); - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Fclose(file); - } H5E_END_TRY; - - if(outbuf) - free(outbuf); - - return 1; -} -#else -int -main(void) -{ - TESTING("Skipped because DEFLATE filter is disabled"); - return 0; -} -#endif /* H5_HAVE_FILTER_DEFLATE */ |