diff options
Diffstat (limited to 'test/dsets.c')
-rw-r--r-- | test/dsets.c | 138 |
1 files changed, 28 insertions, 110 deletions
diff --git a/test/dsets.c b/test/dsets.c index e686fa0..1d831f1 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -227,11 +227,6 @@ static size_t filter_expand(unsigned int flags, size_t cd_nelmts, * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modifications: - * Added test for compact dataset creation. - * Raymond Lu - * August 8, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -386,8 +381,6 @@ test_create(hid_t file) * Programmer: Robb Matzke * Wednesday, December 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -508,8 +501,6 @@ error: * Programmer: Raymond Lu * Wednesday, November 27, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -603,8 +594,6 @@ error: * Programmer: Raymond Lu * August 8, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -840,8 +829,8 @@ error: /* Close file */ H5Sclose(space); H5Pclose(plist); - H5Fclose(file); H5Dclose(dataset); + H5Fclose(file); } H5E_END_TRY; return -1; @@ -869,10 +858,10 @@ static herr_t test_layout_extend(hid_t fapl) { char filename[FILENAME_BUF_SIZE]; /* File name */ - hid_t fid; /* File id */ - hid_t sid_fix, sid_unlim; /* Dataspace id */ - hid_t dcpl_compact, dcpl_contig, dcpl_chunked; /* Dataset creation property list id */ - hid_t did_fixed, did_unlim; /* Dataset id */ + hid_t fid = -1; /* File id */ + hid_t sid_fix = -1, sid_unlim = -1; /* Dataspace id */ + hid_t dcpl_compact = -1, dcpl_contig = -1, dcpl_chunked = -1; /* Dataset creation property list id */ + hid_t did_fixed = -1, did_unlim = -1; /* Dataset id */ hsize_t cur_size[1] = {10}; /* Current size of dataspace */ hsize_t max_unlim[1] = {H5S_UNLIMITED}; /* Maximum size of dataspace (unlimited) */ hsize_t max_fix[1] = {100}; /* Maximum size of dataspace (fixed) */ @@ -986,8 +975,6 @@ error: * Programmer: Raymond Lu * Monday, May 12, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1134,8 +1121,6 @@ error: * Programmer: Robb Matzke * Wednesday, January 14, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1236,8 +1221,6 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static htri_t @@ -1264,8 +1247,6 @@ can_apply_bogus(hid_t UNUSED dcpl_id, hid_t type_id, hid_t UNUSED space_id) * Programmer: Robb Matzke * Tuesday, April 21, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -1290,8 +1271,6 @@ filter_bogus(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, * Programmer: Quincey Koziol * Friday, April 5, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1343,8 +1322,6 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -1401,8 +1378,6 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts, * Programmer: Raymond Lu * 4 August 2010 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -1499,8 +1474,6 @@ error: * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5Z_cb_return_t @@ -1524,8 +1497,6 @@ filter_cb_cont(H5Z_filter_t filter, void UNUSED *buf, size_t UNUSED buf_size, * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5Z_cb_return_t @@ -1553,10 +1524,6 @@ filter_cb_fail(H5Z_filter_t filter, void UNUSED *buf, size_t UNUSED buf_size, * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * Moved out of main test_compression routine - * Quincey Koziol, November 14, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1903,10 +1870,6 @@ error: * Programmer: Nat Furrer and James Laird * Monday, June 7, 2004 * - * Modifications: - * Make copy of data file since the test writes to the file. - * Larry Knox, October 14, 2009 - * *------------------------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_SZIP @@ -2028,8 +1991,6 @@ error: * Programmer: Nat Furrer and James Laird * Thursday, June 10, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2107,14 +2068,6 @@ error: * Programmer: Robb Matzke * Wednesday, April 15, 1998 * - * Modifications: - * Moved guts of filter testing out of main routine. - * Tests shuffle, deflate, fletcher32 checksum filters. - * Quincey Koziol, November 14, 2002 - * - * Added Fletcher32 filter testing - * Raymond Lu, Jan 22, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -2650,8 +2603,6 @@ error: * Programmer: Kent Yang * Wednesday, Nov. 13th, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2768,8 +2719,6 @@ error: * Programmer: Xiaowen Wu * Wednesday, Dec. 23th, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -2910,8 +2859,6 @@ error: * Programmer: Xiaowen Wu * Friday, Jan. 21th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -3041,8 +2988,6 @@ error: * Programmer: Xiaowen Wu * Wednesday, Jan. 26th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -3174,8 +3119,6 @@ error: * Programmer: Xiaowen Wu * Tuesday, Jan. 18th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -3322,8 +3265,6 @@ error: * Programmer: Xiaowen Wu * Tuesday, Jan. 18th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -3520,8 +3461,6 @@ error: * Programmer: Xiaowen Wu * Tuesday, Jan. 18th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -3809,8 +3748,6 @@ error: * Programmer: Xiaowen Wu * Thursday, Mar. 31th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4008,8 +3945,6 @@ error: * Programmer: Xiaowen Wu * Monday, Feb. 14th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4139,8 +4074,6 @@ error: * Programmer: Xiaowen Wu * Tuesday, March 15th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4286,8 +4219,6 @@ error: * Programmer: Xiaowen Wu * Wednesday, Apr. 20th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4418,8 +4349,6 @@ error: * Programmer: Xiaowen Wu * Wednesday, Apr. 20th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4566,8 +4495,6 @@ error: * Programmer: Xiaowen Wu * Monday, Apr. 25th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4698,8 +4625,6 @@ error: * Programmer: Xiaowen Wu * Monday, Apr. 25th, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4849,8 +4774,6 @@ error: * Programmer: Robb Matzke * Tuesday, June 9, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4915,8 +4838,6 @@ test_multiopen (hid_t file) * Programmer: Robb Matzke * Monday, June 7, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -6040,8 +5961,6 @@ error: * Programmer: Pedro Vicente * Monday, January 26, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -6169,8 +6088,6 @@ error: * Programmer: Pedro Vicente * Monday, March 8, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -6333,17 +6250,21 @@ error: 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; + hid_t s = -1, d = -1, dcpl = -1; + hsize_t dsize = 0, dmax = H5S_UNLIMITED, csize = 5; herr_t ret; TESTING("I/O on datasets with zero-sized dims"); + /* + * One-dimensional dataset + */ if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) FAIL_STACK_ERROR - /* Try creating chunked dataset with zero-sized chunk dimensions */ + /* Try creating chunked dataset with undefined chunk dimensions */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_layout(dcpl, H5D_CHUNKED) < 0) FAIL_STACK_ERROR + H5E_BEGIN_TRY { d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; @@ -6352,6 +6273,7 @@ test_zero_dims(hid_t file) FAIL_PUTS_ERROR("created dataset with undefined chunk dimensions") } /* end if */ + /* Try creating chunked dataset with zero-sized chunk dimensions */ H5E_BEGIN_TRY { ret = H5Pset_chunk(dcpl, 1, &dsize); } H5E_END_TRY; @@ -6360,15 +6282,16 @@ test_zero_dims(hid_t file) if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + /* Create the zero-sized extendible dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Just a no-op */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR if(H5Dclose(d) < 0) FAIL_STACK_ERROR if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Sclose(s) < 0) FAIL_STACK_ERROR PASSED(); @@ -6397,29 +6320,28 @@ error: * Programmer: Quincey Koziol * Tuesday, August 25, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t test_missing_chunk(hid_t file) { - hid_t s=-1, d=-1, dcpl=-1; + hid_t s = -1, d = -1, dcpl = -1; hsize_t hs_start[1]; hsize_t hs_stride[1], hs_count[1], hs_block[1]; int wdata[MISSING_CHUNK_DIM], rdata[MISSING_CHUNK_DIM]; - hsize_t dsize=100, dmax=H5S_UNLIMITED, csize=5; + hsize_t dsize=100, dmax=H5S_UNLIMITED; + hsize_t csize=5; size_t u; TESTING("Read dataset with unwritten chunk & undefined fill value"); - /* Initialize data */ - for(u=0; u<MISSING_CHUNK_DIM; u++) { - wdata[u]=(int)u; - rdata[u]=911; + /* Initialize data for 1-D dataset */ + for(u = 0; u < MISSING_CHUNK_DIM; u++) { + wdata[u] = (int)u; + rdata[u] = 911; } /* end for */ /* Create dataspace */ @@ -6437,7 +6359,7 @@ test_missing_chunk(hid_t file) /* Create dataset */ if((d = H5Dcreate2(file, MISSING_CHUNK_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR; - /* Select elements in every other chunk */ + /* Select elements in every other chunk for 1-D dataset */ hs_start[0]=0; hs_stride[0]=10; hs_count[0]=10; @@ -6499,8 +6421,6 @@ error: * Programmer: Christian Chilan * Monday, March 26, 2007 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -6526,7 +6446,7 @@ test_random_chunks(hid_t fapl) h5_fixname(FILENAME[6], fapl, filename, sizeof filename); /* Create file for first test */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; /* Create dataspace */ if((s = H5Screate_simple(2, dsize, NULL)) < 0) TEST_ERROR; @@ -6577,7 +6497,7 @@ test_random_chunks(hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR; /* Open file again */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Open dataset */ if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -6610,7 +6530,7 @@ test_random_chunks(hid_t fapl) /* Create file for second test */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; /* Create dataspace with unlimited maximum dimensions */ if((s = H5Screate_simple(2, dsize, dmax)) < 0) TEST_ERROR; @@ -6667,7 +6587,7 @@ test_random_chunks(hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR; /* Open file again */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR; + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; /* Open dataset */ if((d = H5Dopen2(file, dname, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -7312,7 +7232,7 @@ test_big_chunks_bypass_cache(hid_t fapl) if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) FAIL_STACK_ERROR if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) FAIL_STACK_ERROR - /* Create a first dataset */ + /* Create the first 1-D dataset */ if((dsid = H5Dcreate2(fid, BYPASS_DATASET1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -7767,8 +7687,6 @@ error: * Programmer: Robb Matzke * Tuesday, December 9, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ int |