summaryrefslogtreecommitdiffstats
path: root/test/dsets.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-12-31 20:28:46 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-12-31 20:28:46 (GMT)
commitb0b020d422b493228c00449391552bdfc50a33c2 (patch)
tree533cef47407452cdbe7142de8cbc1ac615132c4e /test/dsets.c
parent0d405bdfb29f6af66b10d213804a55b6e2cd4998 (diff)
downloadhdf5-b0b020d422b493228c00449391552bdfc50a33c2.zip
hdf5-b0b020d422b493228c00449391552bdfc50a33c2.tar.gz
hdf5-b0b020d422b493228c00449391552bdfc50a33c2.tar.bz2
[svn-r8007] Purpose:
Bug fix Description: Range check the szip 'pixels per block' against the chunk size of the dataset when attempting to create a new dataset, since the szip library requires the PPB to be at least the size of the fastest changing dimension in the chunk. Platforms tested: FreeBSD 4.9 (sleipnir) too minor for h5committest
Diffstat (limited to 'test/dsets.c')
-rw-r--r--test/dsets.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/dsets.c b/test/dsets.c
index b443ff5..7c1f123 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2562,7 +2562,9 @@ file)
unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block;
const hsize_t dims[2] = {500, 4096}; /* Dataspace dimensions */
+ const hsize_t dims2[2] = {4, 2}; /* Dataspace dimensions */
const hsize_t chunk_dims[2] = {250, 2048}; /* Chunk dimensions */
+ const hsize_t chunk_dims2[2] = {2, 1}; /* Chunk dimensions */
herr_t ret; /* Status value */
#else /* H5_HAVE_FILTER_SZIP */
const char *not_supported= " Szip filter is not enabled.";
@@ -2646,6 +2648,59 @@ file)
goto error;
} /* end if */
+ /* Create another data space */
+ if ((sid = H5Screate_simple(2, dims2, NULL))<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't open dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Create dcpl with special filter */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't create dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set chunk sizes\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Set (invalid at dataset creation time) szip parameters */
+ szip_pixels_per_block=32;
+ if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't set szip filter\n",__LINE__);
+ goto error;
+ }
+
+ /* Create new dataset */
+ /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */
+ H5E_BEGIN_TRY {
+ dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl);
+ } H5E_END_TRY;
+ if (dsid >=0) {
+ H5_FAILED();
+ printf(" Line %d: Shouldn't have created dataset!\n",__LINE__);
+ H5Dclose(dsid);
+ goto error;
+ } /* end if */
+
+ /* Close dataspace */
+ if(H5Sclose(sid)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dataspace\n",__LINE__);
+ goto error;
+ } /* end if */
+
+ /* Close dataset creation property list */
+ if(H5Pclose(dcpl)<0) {
+ H5_FAILED();
+ printf(" Line %d: Can't close dcpl\n",__LINE__);
+ goto error;
+ } /* end if */
+
PASSED();
#else /* H5_HAVE_FILTER_SZIP */