diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-31 19:59:59 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-05-31 19:59:59 (GMT) |
commit | 1ec351813bd999925e4d4ba2a93f28b3c84c405f (patch) | |
tree | 596b980da63ba784a82c636b9a2b59e8754cf0f0 /test | |
parent | f0efc265de355b89203bfde05d358999cb6ef47f (diff) | |
download | hdf5-1ec351813bd999925e4d4ba2a93f28b3c84c405f.zip hdf5-1ec351813bd999925e4d4ba2a93f28b3c84c405f.tar.gz hdf5-1ec351813bd999925e4d4ba2a93f28b3c84c405f.tar.bz2 |
[svn-r8600] Purpose:
Code optimization
Description:
Don't recompute the internal index value for looking up the chunk in the
hash table, just use the value already computed from iterating through the
chunks.
Platforms tested:
Solaris 2.7 (arabica)
FreeBSD 4.9 (sleipnir) w/parallel
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 121 | ||||
-rw-r--r-- | test/set_extent.c | 177 | ||||
-rw-r--r-- | test/tmisc.c | 4 |
3 files changed, 161 insertions, 141 deletions
diff --git a/test/dsets.c b/test/dsets.c index 79ff80b..0c9c18d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1272,6 +1272,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, { hid_t dataset; /* Dataset ID */ hid_t dxpl; /* Dataset xfer property list ID */ + hid_t write_dxpl; /* Dataset xfer property list ID for writing */ hid_t sid; /* Dataspace ID */ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ const hssize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ @@ -1290,6 +1291,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) goto error; tconv_buf = malloc (1000); if (H5Pset_buffer (dxpl, (size_t)1000, tconv_buf, NULL)<0) goto error; + if ((write_dxpl = H5Pcopy (dxpl))<0) TEST_ERROR; if (if_fletcher32==DISABLE_FLETCHER32) { if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)<0) @@ -1347,10 +1349,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0) - goto error; + if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points)<0) + TEST_ERROR; - if((*dset_size=H5Dget_storage_size(dataset))==0) goto error; + if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR; PASSED(); @@ -1363,25 +1365,27 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Read the dataset back */ if(corrupted) { /* Default behavior is failure when data is corrupted. */ + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; + if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) TEST_ERROR; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; + if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL)<0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; } else { if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Check that the values read are the same as the values written */ for (i=0; i<size[0]; i++) { @@ -1414,31 +1418,33 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, points[i][j] = (int)HDrandom (); } } - if (H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0) - goto error; + if (H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points)<0) + TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; + if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) TEST_ERROR; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; + if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL)<0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; } else { /* Read the dataset back and check it */ if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Check that the values read are the same as the values written */ for (i=0; i<size[0]; i++) { @@ -1454,7 +1460,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - if((*dset_size=H5Dget_storage_size(dataset))==0) goto error; + if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR; PASSED(); /*---------------------------------------------------------------------- @@ -1465,30 +1471,32 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, */ TESTING(" filters (re-open)"); - if (H5Dclose (dataset)<0) goto error; - if ((dataset = H5Dopen (fid, name))<0) goto error; + if (H5Dclose (dataset)<0) TEST_ERROR; + if ((dataset = H5Dopen (fid, name))<0) TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; + if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) TEST_ERROR; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; + if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL)<0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; } else { if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Check that the values read are the same as the values written */ for (i=0; i<size[0]; i++) { @@ -1521,31 +1529,34 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } if (H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, - NULL)<0) goto error; + NULL)<0) TEST_ERROR; + /* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */ if (H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points)<0) - goto error; + TEST_ERROR; if(corrupted) { /* Default behavior is failure when data is corrupted. */ + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; + if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) TEST_ERROR; if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; + TEST_ERROR; /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; + if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL)<0) TEST_ERROR; + /* (Use the "write" DXPL in order to make certain corruption is seen) */ H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); + status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check); } H5E_END_TRY; - if(status>=0) goto error; + if(status>=0) TEST_ERROR; } else { if (H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check)<0) - goto error; + TEST_ERROR; /* Check that the values read are the same as the values written */ for (i=0; i<hs_size[0]; i++) { @@ -1687,7 +1698,7 @@ test_filters(hid_t file) if (H5Zregister (H5Z_CORRUPT)<0) goto error; if (H5Pset_filter (dc, H5Z_FILTER_CORRUPT, 0, 3, data_corrupt)<0) goto error; - if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,ENABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size)<0) goto error; + if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size)<0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); puts(" Size after checksumming is incorrect."); @@ -1954,7 +1965,7 @@ test_missing_filter(hid_t file) /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -3348,6 +3359,7 @@ test_filters_endianess(void) if (H5Dclose (dsid)<0) goto error; if (H5Sclose (sid)<0) goto error; if (H5Fclose (fid)<0) goto error; + /*------------------------------------------------------------------------- * step 2: open a file written on a little-endian machine in step 1 *------------------------------------------------------------------------- @@ -3371,6 +3383,7 @@ test_filters_endianess(void) /* close */ if (H5Fclose(fid)<0) goto error; + /*------------------------------------------------------------------------- * step 3: open a file written on a big-endian machine in step 1 *------------------------------------------------------------------------- @@ -3432,25 +3445,26 @@ int main(void) { hid_t file, grp, fapl; + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; int nerrors=0; char filename[1024]; h5_reset(); fapl = h5_fileaccess(); -#if 0 - { - /* Turn off raw data cache */ - int mdc_nelmts; - if (H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL)<0) goto error; - if (H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0)<0) goto error; - } -#endif - /* Set the random # seed */ HDsrandom((unsigned long)HDtime(NULL)); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + + /* Turn off the chunk cache, so all the chunks are immediately written to disk */ + if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0)<0) goto error; + rdcc_nbytes=0; + if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0)<0) goto error; + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) { goto error; } @@ -3460,6 +3474,7 @@ main(void) if (H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted")<0) goto error; if (H5Gclose (grp)<0) goto error; + nerrors += test_create(file)<0 ?1:0; nerrors += test_simple_io(fapl)<0 ?1:0; nerrors += test_compact_io(fapl)<0 ?1:0; diff --git a/test/set_extent.c b/test/set_extent.c index 067dabc..845d621 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -67,17 +67,17 @@ int main( void ) /* Create a new file using default properties. */ - if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) goto out; + if ((file_id = H5Fcreate( "set_extent_create.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ))<0) TEST_ERROR; TESTING("extend dataset create with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; /*------------------------------------------------------------------------- @@ -86,10 +86,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -97,15 +97,16 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) goto out; + if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) goto out; + if ( dims_out[0] != dims_new[0] ) TEST_ERROR; + if ( dims_out[1] != dims_new[1] ) TEST_ERROR; /*------------------------------------------------------------------------- @@ -114,13 +115,17 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) goto out; + if ( buf1[i][j] != data[i][j] ) { + printf("buf1[%d][%d]=%d\n",i,j,buf1[i][j]); + printf("data[%d][%d]=%d\n",i,j,data[i][j]); + TEST_ERROR; + } /* end if */ /*------------------------------------------------------------------------- @@ -129,15 +134,15 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; + if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims[0] ) goto out; + if ( dims_out[0] != dims[0] ) TEST_ERROR; /*------------------------------------------------------------------------- @@ -146,16 +151,16 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { - if ( buf2[i][j] != fillvalue ) goto out; + if ( buf2[i][j] != fillvalue ) TEST_ERROR; } else { - if ( buf2[i][j] != data[i][j] ) goto out; + if ( buf2[i][j] != data[i][j] ) TEST_ERROR; } } } @@ -174,12 +179,12 @@ int main( void ) TESTING("extend dataset create without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) goto out; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; + if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; /*------------------------------------------------------------------------- * Create and write one dataset @@ -187,10 +192,10 @@ int main( void ) */ /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; shrink it @@ -198,15 +203,15 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims_new )<0) goto out; + if (H5Dset_extent( dataset_id , dims_new )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) goto out; + if ( dims_out[0] != dims_new[0] ) TEST_ERROR; /*------------------------------------------------------------------------- @@ -215,13 +220,13 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) goto out; + if ( buf1[i][j] != data[i][j] ) TEST_ERROR; /*------------------------------------------------------------------------- @@ -230,15 +235,15 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; + if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims[0] ) goto out; + if ( dims_out[0] != dims[0] ) TEST_ERROR; /*------------------------------------------------------------------------- @@ -247,16 +252,16 @@ int main( void ) */ /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { - if ( buf2[i][j] != 0 ) goto out; + if ( buf2[i][j] != 0 ) TEST_ERROR; } else { - if ( buf2[i][j] != data[i][j] ) goto out; + if ( buf2[i][j] != data[i][j] ) TEST_ERROR; } } } @@ -283,32 +288,32 @@ int main( void ) */ /* Create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE))<0) goto out; + if((fcpl = H5Pcreate(H5P_FILE_CREATE))<0) TEST_ERROR; /* Set non-default indexed storage B-tree internal 'K' value */ - if(H5Pset_istore_k(fcpl,ISTORE_IK)<0) goto out; + if(H5Pset_istore_k(fcpl,ISTORE_IK)<0) TEST_ERROR; /* Create a new file using properties. */ - if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT ))<0) goto out; + if ((file_id = H5Fcreate( "set_extent_read.h5", H5F_ACC_TRUNC, fcpl, H5P_DEFAULT ))<0) TEST_ERROR; /* Close property list */ - if(H5Pclose(fcpl)<0) goto out; + if(H5Pclose(fcpl)<0) TEST_ERROR; TESTING("extend dataset read with fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) goto out; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; + if (H5Pset_fill_value( plist_id, H5T_NATIVE_INT, &fillvalue )<0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + if ((dataset_id = H5Dcreate( file_id , "Dataset1", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; /* Close/release resources. */ H5Dclose( dataset_id ); @@ -318,29 +323,29 @@ int main( void ) /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; + if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) goto out; + if ((dataset_id = H5Dopen( file_id , "Dataset1" ))<0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) goto out; + if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) goto out; + if ( dims_out[0] != dims_new[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) goto out; + if ( buf1[i][j] != data[i][j] ) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -348,27 +353,27 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; + if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims[0] ) goto out; + if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { - if ( buf2[i][j] != fillvalue ) goto out; + if ( buf2[i][j] != fillvalue ) TEST_ERROR; } else { - if ( buf2[i][j] != data[i][j] ) goto out; + if ( buf2[i][j] != data[i][j] ) TEST_ERROR; } } } @@ -388,18 +393,18 @@ int main( void ) TESTING("extend dataset read without fill value"); /* Create the data space with unlimited dimensions. */ - if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) goto out; + if ((space_id = H5Screate_simple( RANK, dims, maxdims ))<0) TEST_ERROR; /* Modify dataset creation properties, i.e. enable chunking. */ - if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) goto out; - if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) goto out; - if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) goto out; + if ((plist_id = H5Pcreate (H5P_DATASET_CREATE ))<0) TEST_ERROR; + if (H5Pset_chunk( plist_id, RANK, dims_chunk )<0) TEST_ERROR; + if (H5Pset_fill_time( plist_id, H5D_FILL_TIME_ALLOC)<0) TEST_ERROR; /* Create a new dataset within the file using cparms creation properties. */ - if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) goto out; + if ((dataset_id = H5Dcreate( file_id , "Dataset2", H5T_NATIVE_INT, space_id, plist_id ))<0) TEST_ERROR; /* Write the data. */ - if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) goto out; + if (H5Dwrite( dataset_id , H5T_NATIVE_INT, space_id, H5S_ALL, H5P_DEFAULT, data )<0) TEST_ERROR; /* Close/release resources. */ H5Dclose( dataset_id ); @@ -409,29 +414,29 @@ int main( void ) /* Open the file */ - if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) goto out; + if ((file_id = H5Fopen( "set_extent_read.h5", H5F_ACC_RDWR, H5P_DEFAULT ))<0) TEST_ERROR; /* Open the dataset */ - if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) goto out; + if ((dataset_id = H5Dopen( file_id , "Dataset2" ))<0) TEST_ERROR; /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id, dims_new )<0) goto out; + if (H5Dset_extent( dataset_id, dims_new )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims_new[0] ) goto out; + if ( dims_out[0] != dims_new[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) for( j = 0; j < (int)dims_out[1]; j++ ) - if ( buf1[i][j] != data[i][j] ) goto out; + if ( buf1[i][j] != data[i][j] ) TEST_ERROR; /*------------------------------------------------------------------------- * Set new dimensions for the array; expand it again @@ -439,27 +444,27 @@ int main( void ) */ /* Set new dimensions for the array. */ - if (H5Dset_extent( dataset_id , dims )<0) goto out; + if (H5Dset_extent( dataset_id , dims )<0) TEST_ERROR; /* Get the space. */ - if ((space_id = H5Dget_space( dataset_id ))<0) goto out; + if ((space_id = H5Dget_space( dataset_id ))<0) TEST_ERROR; /* Get dimensions. */ - if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) goto out; + if (H5Sget_simple_extent_dims( space_id, dims_out, NULL )<0) TEST_ERROR; - if ( dims_out[0] != dims[0] ) goto out; + if ( dims_out[0] != dims[0] ) TEST_ERROR; /* Read the new dataset. */ - if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) goto out; + if (H5Dread( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2 )<0) TEST_ERROR; /* Compare the read array with the original array */ for( i = 0; i < (int)dims_out[0]; i++ ) { for( j = 0; j < (int)dims_out[1]; j++ ) { if ( i >= 70 || j >= 70 ) { - if ( buf2[i][j] != 0 ) goto out; + if ( buf2[i][j] != 0 ) TEST_ERROR; } else { - if ( buf2[i][j] != data[i][j] ) goto out; + if ( buf2[i][j] != data[i][j] ) TEST_ERROR; } } } @@ -482,7 +487,7 @@ int main( void ) return 0; -out: +error: H5Dclose( dataset_id ); H5Sclose( space_id ); H5Pclose( plist_id ); diff --git a/test/tmisc.c b/test/tmisc.c index b1d1691..a6823d0 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -229,8 +229,8 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset #define MISC20_DSET_NAME "Dataset" #define MISC20_DSET2_NAME "Dataset2" #define MISC20_SPACE_RANK 2 -#define MISC20_SPACE_DIM0 (8*1024*1024*1024ULL) -#define MISC20_SPACE_DIM1 ((4*1024*1024*1024ULL)+1ULL) +#define MISC20_SPACE_DIM0 (8*1024*1024*(uint64_t)1024) +#define MISC20_SPACE_DIM1 ((4*1024*1024*(uint64_t)1024)+1) #define MISC20_SPACE2_DIM0 8 #define MISC20_SPACE2_DIM1 4 |