From ddf436469153cc5deb7cadfdb9a1b985c605774f Mon Sep 17 00:00:00 2001 From: Christian Chilan Date: Mon, 26 Mar 2007 20:01:23 -0500 Subject: [svn-r13548] Tests that write/read on randomly selected chunks to check for potential problem in b-tree code. Tests passed on smirom, cobalt, and copper. --- test/dsets.c | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 236 insertions(+), 1 deletion(-) diff --git a/test/dsets.c b/test/dsets.c index 196fefe..794f9c2 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -137,6 +137,10 @@ const char *FILENAME[] = { #define MISSING_CHUNK_DATASET "missing_chunk" #define MISSING_CHUNK_DIM 100 +/* Names for random chunks test */ +#define NPOINTS 50 +#define RC_FILENAME "random_chunks.h5" + /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -5957,6 +5961,236 @@ error: return -1; } /* end test_zero_dims() */ + +/*------------------------------------------------------------------------- + * Function: test_random_chunks + * + * Purpose: Tests that write/read on randomly selected chunks in 2 datasets. + * One dataset has fixed dimensions, and the other has unlimited + * dimensions which are extended before write/read operations. + * + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Christian Chilan + * Monday, March 26, 2007 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_random_chunks(void) +{ + hid_t s=-1, m=-1, d=-1, dcpl=-1, file=-1; + int wbuf[NPOINTS], + rbuf[NPOINTS], + check[20][20]; + hsize_t coord[NPOINTS][2]; + hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200}; + hsize_t msize[1]={NPOINTS}; + const char dname[]="dataset"; + int chunk_row, chunk_col; + size_t i, j; + + + TESTING("Write/read on randomly selected chunks"); + + assert(NPOINTS < 100); + + /* Create file for first test */ + if ((file = H5Fcreate(RC_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) TEST_ERROR; + + /* Create dataspace */ + if((s = H5Screate_simple(2, dsize, NULL))<0) TEST_ERROR; + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR; + + /* Set chunked layout */ + if(H5Pset_chunk(dcpl, 2, csize)<0) TEST_ERROR; + + /* Set early allocation time */ + if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY)<0) TEST_ERROR; + + /* Create dataset */ + if((d = H5Dcreate(file, dname, H5T_NATIVE_INT, s, dcpl))<0) TEST_ERROR; + + /* Initialization of check array for repeated coordinates */ + for (i=0; i