diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-28 03:22:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-28 03:22:14 (GMT) |
commit | 5f8a9d5dd27481f422608adfaeb9a860b7ba0f9a (patch) | |
tree | 973f47e37e3f321bc6be2b17c25157d5ecb74238 /test | |
parent | d9235366bb08ae9decd6f7b9d09fd7607e988fb4 (diff) | |
download | hdf5-5f8a9d5dd27481f422608adfaeb9a860b7ba0f9a.zip hdf5-5f8a9d5dd27481f422608adfaeb9a860b7ba0f9a.tar.gz hdf5-5f8a9d5dd27481f422608adfaeb9a860b7ba0f9a.tar.bz2 |
[svn-r8963] Purpose:
Bug fix
Description:
Allow I/O on extendible chunked datasets with (currently) zero-sized
dimensions to proceed harmlessly instead of dumping core on an assertion.
Solution:
Removed assertion and added checks to avoid problem situation in H5TB_end
Platforms tested:
FreeBSD 4.10 (sleipnir) w/ & w/o parallel
Too minor to require h5committest
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/dsets.c b/test/dsets.c index 8d819f3..5f0e708 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -113,6 +113,9 @@ const char *FILENAME[] = { #define NOENCODER_SZIP_DATASET "noencoder_szip_dset.h5" #define NOENCODER_SZIP_SHUFF_FLETCH_DATASET "noencoder_szip_shuffle_fletcher_dset.h5" +/* Names for zero-dim test */ +#define ZERODIM_DATASET "zerodim" + /* Shared global arrays */ #define DSET_DIM1 100 #define DSET_DIM2 200 @@ -3599,6 +3602,53 @@ error: /*------------------------------------------------------------------------- + * Function: test_zero_dims + * + * Purpose: Tests read/writes to zero-sized extendible datasets + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, July 27, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_zero_dims(hid_t file) +{ + hid_t s=-1, d=-1, dcpl=-1; + hsize_t dsize=0, dmax=H5S_UNLIMITED, csize=5; + + TESTING("I/O on datasets with zero-sized dims"); + + if((s = H5Screate_simple(1, &dsize, &dmax))<0) TEST_ERROR; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) TEST_ERROR; + if(H5Pset_chunk(dcpl, 1, &csize)<0) TEST_ERROR; + if((d = H5Dcreate(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, dcpl))<0) TEST_ERROR; + + if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911)<0) TEST_ERROR; + + if(H5Pclose(dcpl)<0) TEST_ERROR; + if(H5Sclose(s)<0) TEST_ERROR; + if(H5Dclose(d)<0) TEST_ERROR; + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(d); + H5Sclose(s); + } H5E_END_TRY; + return -1; +} /* end test_zero_dims() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the dataset interface (H5D) @@ -3667,6 +3717,7 @@ main(void) nerrors += test_can_apply_szip(file)<0 ?1:0; nerrors += test_compare_dcpl(file)<0 ?1:0; nerrors += test_filters_endianess()<0 ?1:0; + nerrors += test_zero_dims(file)<0 ?1:0; if (H5Fclose(file)<0) goto error; if (nerrors) goto error; |