diff options
author | kmu <kmu@hdfgroup.org> | 2020-01-14 17:25:49 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2020-01-14 17:25:49 (GMT) |
commit | 71b817038d8cd82163cf71119873b2ba65a2c81b (patch) | |
tree | ff2e04387a658c1d4188f402bc332825710577b8 /test | |
parent | 7366709e4000a96a9942934da0d13474213567f3 (diff) | |
parent | c3c60dc7b5d5104475748f9967135903e3974cc3 (diff) | |
download | hdf5-71b817038d8cd82163cf71119873b2ba65a2c81b.zip hdf5-71b817038d8cd82163cf71119873b2ba65a2c81b.tar.gz hdf5-71b817038d8cd82163cf71119873b2ba65a2c81b.tar.bz2 |
Merge branch 'develop' of https://git.hdfgroup.org/scm/hdffv/hdf5 into develop
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 41 | ||||
-rw-r--r-- | test/cache_api.c | 11 | ||||
-rw-r--r-- | test/cache_common.c | 13 | ||||
-rw-r--r-- | test/cache_common.h | 4 | ||||
-rw-r--r-- | test/cork.c | 86 | ||||
-rw-r--r-- | test/dsets.c | 30 | ||||
-rw-r--r-- | test/dtypes.c | 4 | ||||
-rw-r--r-- | test/external_env.c | 3 | ||||
-rw-r--r-- | test/getname.c | 8 | ||||
-rw-r--r-- | test/h5test.c | 3 | ||||
-rw-r--r-- | test/links.c | 385 | ||||
-rw-r--r-- | test/mount.c | 48 | ||||
-rw-r--r-- | test/mtime.c | 10 | ||||
-rw-r--r-- | test/ntypes.c | 2 | ||||
-rw-r--r-- | test/null_vol_connector.c | 148 | ||||
-rw-r--r-- | test/objcopy.c | 47 | ||||
-rw-r--r-- | test/objcopy_ref.c | 61 | ||||
-rw-r--r-- | test/ohdr.c | 11 | ||||
-rw-r--r-- | test/th5s.c | 13 | ||||
-rw-r--r-- | test/titerate.c | 6 | ||||
-rw-r--r-- | test/trefer.c | 40 | ||||
-rw-r--r-- | test/trefer_deprec.c | 2 | ||||
-rw-r--r-- | test/tsohm.c | 8 | ||||
-rw-r--r-- | test/tvltypes.c | 6 | ||||
-rw-r--r-- | test/unlink.c | 4 | ||||
-rw-r--r-- | test/vol.c | 4 |
26 files changed, 565 insertions, 433 deletions
diff --git a/test/cache.c b/test/cache.c index 9a60ba8..a90f12b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -18,24 +18,38 @@ * H5C.c */ #include "cache_common.h" +#include "H5MFprivate.h" +H5C_t * saved_cache = NULL; /* store the pointer to the instance of + * of H5C_t created by H5Fcreate() + * here between test cache setup and + * shutdown. + */ + +haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the + * space allocated for cache items in the file between + * cache setup & takedown + */ + hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between - * cache setup and takedown. Note - * that if saved_fapl_id == H5P_DEFAULT, - * we assume that there is no fapl to - * close. - */ + * cache setup and takedown. Note + * that if saved_fapl_id == H5P_DEFAULT, + * we assume that there is no fapl to + * close. + */ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between - * cache setup and takedown. Note - * that if saved_fcpl_id == H5P_DEFAULT, - * we assume that there is no fcpl to - * close. - */ -hid_t saved_fid = -1; /* store the file id here between cache setup - * and takedown. - */ + * cache setup and takedown. Note + * that if saved_fcpl_id == H5P_DEFAULT, + * we assume that there is no fcpl to + * close. + */ + +hid_t saved_fid = -1; /* store the file id here between cache setup + * and takedown. + */ +hbool_t write_permitted = TRUE; hbool_t try_core_file_driver = FALSE; hbool_t core_file_driver_failed = FALSE; @@ -44,7 +58,6 @@ hbool_t core_file_driver_failed = FALSE; const char *FILENAME[] = { "cache_test", - "cache_api_test", NULL }; diff --git a/test/cache_api.c b/test/cache_api.c index 1d5aa56..87d0025 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -25,7 +25,6 @@ /* global variable declarations: */ const char *FILENAME[] = { - "cache_test", "cache_api_test", NULL }; @@ -213,7 +212,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -361,7 +360,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -694,7 +693,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1040,7 +1039,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* setup the file name */ if ( pass ) { - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; @@ -1969,7 +1968,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) HDfprintf(stdout, "%s: calling h5_fixname().\n", FUNC); } - if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) + if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { pass = FALSE; diff --git a/test/cache_common.c b/test/cache_common.c index 96c146c..f977c3c 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -18,23 +18,10 @@ * implemented in H5C.c */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5MFprivate.h" #include "H5MMprivate.h" #include "cache_common.h" - -H5C_t * saved_cache = NULL; /* store the pointer to the instance of - * of H5C_t created by H5Fcreate() - * here between test cache setup and - * shutdown. - */ - -haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the - space allocated for cache items in the file between - cache setup & takedown */ - -hbool_t write_permitted = TRUE; hbool_t pass = TRUE; /* set to false on error */ const char *failure_mssg = NULL; diff --git a/test/cache_common.h b/test/cache_common.h index 61457d9..969cc2a 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -538,10 +538,6 @@ struct expected_entry_status /* global variable externs: */ -H5TEST_DLLVAR H5C_t * saved_cache; - -H5TEST_DLLVAR haddr_t saved_actual_base_addr; -H5TEST_DLLVAR hbool_t write_permitted; H5TEST_DLLVAR hbool_t pass; /* set to false on error */ H5TEST_DLLVAR const char *failure_mssg; diff --git a/test/cork.c b/test/cork.c index 06a520d..78b6b01 100644 --- a/test/cork.c +++ b/test/cork.c @@ -99,8 +99,9 @@ verify_old_dset_cork(void) hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ - int buf[100][20]; /* Data buffer */ - int i = 0, j = 0; /* Local index variable */ + int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ + int *buf_data = NULL; /* Data buffer (actual data) */ + int i = 0, j = 0; /* Local index variables */ H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */ @@ -137,13 +138,21 @@ verify_old_dset_cork(void) if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) TEST_ERROR + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + buf[i] = buf_data + (i * 20); + /* Initialize data buffer */ for(i = 0; i < (int)dims[0]; i++) for(j = 0; j < (int)dims[1]; j++) buf[i][j] = (i + 1) * (j + 1); /* Write to the dataset: DSET_BT1 */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ @@ -196,11 +205,6 @@ verify_old_dset_cork(void) if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Initialize data buffer */ - for(i = 0; i < (int)dims[0]; i++) - for(j = 0; j < (int)dims[1]; j++) - buf[i][j] = (i + 1) * (j + 1); - /* Open and write to the dataset: DSET_BT1 */ if((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0) TEST_ERROR @@ -249,6 +253,9 @@ verify_old_dset_cork(void) if(H5Fclose(fid) < 0) TEST_ERROR + HDfree(buf); + HDfree(buf_data); + PASSED(); return 0; @@ -265,6 +272,10 @@ error: H5Pclose(dcpl3); H5Fclose(fid); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return 1; } /* verify_old_dset_cork */ @@ -496,7 +507,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */ hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */ hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ - int buf[100][20]; int i = 0, j = 0; /* Data buffer */ + int **buf = NULL; /* Data bufer (pointers to fake 2D array) */ + int *buf_data = NULL; /* Data buffer (actual data) */ + int i = 0, j = 0; /* Local index variables */ H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */ unsigned flags; /* File access flags */ @@ -630,6 +643,14 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) TEST_ERROR + /* Set up data array */ + if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int)))) + TEST_ERROR; + if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data)))) + TEST_ERROR; + for (i = 0; i < 100; i++) + buf[i] = buf_data + (i * 20); + /* Initialize data buffer */ for(i = 0; i < (int)dims[0]; i++) for(j = 0; j < (int)dims[1]; j++) @@ -638,7 +659,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Open and write to the dataset: DSET_EA */ if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_EA */ @@ -648,7 +669,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Open and write to the dataset: DSET_FA */ if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -662,7 +683,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Open and write to the dataset: DSET_BT2 */ if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0) TEST_ERROR /* Verify the cork status for DSET_BT2 */ @@ -689,6 +710,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR + HDfree(buf); + HDfree(buf_data); + PASSED(); return 0; @@ -704,6 +728,10 @@ error: H5Pclose(fapl); H5Fclose(fid); } H5E_END_TRY; + + HDfree(buf); + HDfree(buf_data); + return 1; } /* verify_dset_cork */ @@ -1826,8 +1854,9 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) hsize_t cdims[RANK] = {2,2}; /* Chunk dimensions */ int fillval = 0; /* Fill value */ int i, j, k = 0; /* Local index variables */ - int data[DIMS0][DIMS1]; /* Data buffer */ - int rbuf[DIMS0][DIMS1]; /* Data buffer */ + int **wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */ + int *wbuf_data = NULL; /* Data buffer for writes (real data) */ + int *rbuf_data = NULL; /* Data buffer for reads (real data) */ hbool_t corked; /* Cork status of an object */ unsigned flags; /* File access flags */ @@ -1923,13 +1952,21 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(corked) TEST_ERROR + /* Set up data array */ + if(NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int)))) + TEST_ERROR; + if(NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data)))) + TEST_ERROR; + for (i = 0; i < DIMS0; i++) + wbuf[i] = wbuf_data + (i * DIMS1); + /* Initialize the buffer */ for(i = 0; i < DIMS0;i++) for(j = 0;j < DIMS1;j++) - data[i][j] = k++; + wbuf[i][j] = k++; /* Write to the dataset */ - if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0) TEST_ERROR /* Flush the dataset */ @@ -1962,8 +1999,12 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(corked) TEST_ERROR + /* Set up data array */ + if(NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int)))) + TEST_ERROR; + /* Read from the dataset */ - if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0) TEST_ERROR /* Cork the dataset */ @@ -1993,7 +2034,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Write to the dataset */ - if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0) + if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0) TEST_ERROR /* Refresh the dataset */ @@ -2106,6 +2147,10 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) if(H5Pclose(dcpl) < 0) TEST_ERROR + HDfree(wbuf); + HDfree(wbuf_data); + HDfree(rbuf_data); + PASSED(); return 0; @@ -2121,6 +2166,11 @@ error: H5Pclose(fapl); H5Fclose(fid); } H5E_END_TRY; + + HDfree(wbuf); + HDfree(wbuf_data); + HDfree(rbuf_data); + return 1; } /* test_dset_cork() */ diff --git a/test/dsets.c b/test/dsets.c index d017ff3..a394210 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -5293,7 +5293,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; + for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; @@ -5307,7 +5307,7 @@ test_types(hid_t file) (space=H5Screate_simple(1, &nelmts, NULL)) < 0 || (dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; + for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; @@ -5322,7 +5322,7 @@ test_types(hid_t file) (dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; @@ -5336,7 +5336,7 @@ test_types(hid_t file) (dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < sizeof buf; i++) - buf[i] = (unsigned char)0xff ^ (unsigned char)i; + buf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error; if(H5Sclose(space) < 0) goto error; if(H5Tclose(type) < 0) goto error; @@ -7065,6 +7065,7 @@ static void make_random_offset_and_increment(long nelts, long *offsetp, long *incp) { long inc; + long maxinc; HDassert(0 < nelts); @@ -7073,7 +7074,7 @@ make_random_offset_and_increment(long nelts, long *offsetp, long *incp) /* `maxinc` is chosen so that for any `x` in [0, nelts - 1], * `x + maxinc` does not overflow a long. */ - const long maxinc = MIN(nelts - 1, LONG_MAX - nelts); + maxinc = MIN(nelts - 1, LONG_MAX - nelts); /* Choose a random number in [1, nelts - 1]. If its greatest divisor * in common with `nelts` is 1, then it will "generate" the additive ring @@ -12775,20 +12776,23 @@ error: } /* end dls_01_write_data() */ static herr_t -dls_01_read_stuff( hid_t fid ) +dls_01_read_stuff(hid_t fid) { int status = 0; hid_t did = 0; H5O_info_t info; - did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); - if ( did <= 0 ) TEST_ERROR + did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT); + if(did <= 0) + TEST_ERROR - status = H5Oget_info2( did, &info, H5O_INFO_BASIC ); - if ( status != 0 ) TEST_ERROR + status = H5Oget_info2(did, &info, H5O_INFO_BASIC ); + if(status != 0) + TEST_ERROR - status = H5Dclose( did ); - if ( status != 0 ) TEST_ERROR + status = H5Dclose(did); + if(status != 0) + TEST_ERROR return SUCCEED; @@ -13132,7 +13136,7 @@ test_versionbounds(void) return FAIL; } /* end test_versionbounds() */ - + /*----------------------------------------------------------------------------- * Function: test_object_header_minimization_dcpl * diff --git a/test/dtypes.c b/test/dtypes.c index 791e8e8..c4c3946 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1216,8 +1216,8 @@ test_compound_6(void) orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { s_ptr = ((struct st*)((void *)orig)) + i; - s_ptr->b = (i*8+1) & 0x7fff; - s_ptr->d = (i*8+6) & 0x7fff; + s_ptr->b = (int16_t)((i*8+1) & 0x7fff); + s_ptr->d = (int16_t)((i*8+6) & 0x7fff); } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); diff --git a/test/external_env.c b/test/external_env.c index 01f2cba..e9c7635 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -15,7 +15,6 @@ * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" -#include "external_fname.h" static const char *EXT_ENV_FNAME[] = { "extern_env_dir/env_file_1", @@ -189,7 +188,7 @@ main(void) HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(EXT_FNAME, fapl_id_old)) { + if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) { HDremove("extern_env_1r.raw"); HDremove("extern_env_2r.raw"); HDremove("extern_env_3r.raw"); diff --git a/test/getname.c b/test/getname.c index 873ceb9..399f364 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2380,7 +2380,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype, NULL, 0)) != 0) TEST_ERROR /* Create a link to the object */ - if( H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Commit a second datatype with no links to it and commit it */ if((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR @@ -2405,17 +2405,17 @@ test_main(hid_t file_id, hid_t fapl) /* Check the H5Iget_name does not return an error for anon committed datatypes */ if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR - if((size = H5Iget_name(dtype_anon,NULL,0)) != 0) TEST_ERROR + if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR if(H5Tclose(dtype_anon) < 0) TEST_ERROR if(H5Fclose(file2_id) < 0) TEST_ERROR PASSED(); - return(0); + return 0; error: - return(1); + return 1; } static int diff --git a/test/h5test.c b/test/h5test.c index 67c73f1..6a3a5cb 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1321,8 +1321,7 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); + HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ HDprintf("object is MPI_INFO_NULL\n"); } diff --git a/test/links.c b/test/links.c index 5774f97..4dff1cf 100644 --- a/test/links.c +++ b/test/links.c @@ -31,10 +31,10 @@ #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5FDpkg.h" /* File drivers */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -537,9 +537,9 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); @@ -635,7 +635,7 @@ cklinks(hid_t fapl, hbool_t new_format) error: return FAIL; -} +} /* end cklinks() */ /*------------------------------------------------------------------------- @@ -686,11 +686,11 @@ ck_new_links(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return SUCCEED; + return 0; error: - return FAIL; -} + return -1; +} /* end ck_new_links() */ /*------------------------------------------------------------------------- @@ -3456,33 +3456,58 @@ error: static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hsize_t dims[2]; - int points[NUM40][NUM40]; - int i, j, n; - h5_stat_size_t filesize, new_filesize; + hid_t fid = H5I_INVALID_HID; + hid_t gid = H5I_INVALID_HID; + hid_t core_fapl = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t dapl_id = H5I_INVALID_HID; + hid_t dcpl = H5I_INVALID_HID; + char *filename1 = NULL; + char *filename2 = NULL; + char *tmpname = NULL; + char *cwdpath = NULL; + hsize_t dims[2]; + int **points = NULL; + int *points_data = NULL; + int i, j, n; + h5_stat_size_t filesize; + h5_stat_size_t new_filesize; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") else TESTING("H5Pset/get_elink_fapl() with same physical layout") + /* Set up file names and paths */ + if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR + /* Set up data array */ + if(NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int)))) + TEST_ERROR; + if(NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data)))) + TEST_ERROR; + for (i = 0; i < NUM40; i++) + points[i] = points_data + (i * NUM40); + /* * set up name for main file: * Linux: "/CWD/tmp_links/extlinks0" * Windows: "<cur drive>:/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); - h5_fixname(tmpname, fapl, filename1, sizeof filename1); + h5_fixname(tmpname, fapl, filename1, NAME_BUF_SIZE); /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); @@ -3490,7 +3515,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks17" */ /* set up name for target file: "extlinks17" */ - h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[39], core_fapl, filename2, NAME_BUF_SIZE); /* Create the target file to be a "core" file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR @@ -3505,7 +3530,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) dcpl = H5Pcreate(H5P_DATASET_CREATE); else dcpl = H5Pcopy(dcpl_g); - if (0 > dcpl) TEST_ERROR; + if (0 > dcpl) + TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ @@ -3548,7 +3574,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) points[i][j] = n++; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) TEST_ERROR if(H5Pclose(dapl_id) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -3561,6 +3587,14 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pclose(core_fapl) < 0) TEST_ERROR + HDfree(points); + HDfree(points_data); + + HDfree(filename1); + HDfree(filename2); + HDfree(tmpname); + HDfree(cwdpath); + PASSED(); return SUCCEED; @@ -3575,6 +3609,15 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; + + HDfree(points); + HDfree(points_data); + + HDfree(filename1); + HDfree(filename2); + HDfree(tmpname); + HDfree(cwdpath); + return FAIL; } /* end external_set_elink_fapl2() */ @@ -6059,19 +6102,26 @@ static int external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { #ifdef H5_HAVE_SYMLINK - hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; - hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t file1 = H5I_INVALID_HID; + hid_t file2 = H5I_INVALID_HID; + hid_t file3 = H5I_INVALID_HID; + hid_t file4 = H5I_INVALID_HID; + hid_t file5 = H5I_INVALID_HID; + hid_t group2 = H5I_INVALID_HID; + hid_t group3 = H5I_INVALID_HID; + hid_t group4 = H5I_INVALID_HID; + hid_t group5 = H5I_INVALID_HID; + char *filename1 = NULL; + char *filename2a = NULL; + char *filename2b = NULL; + char *filename3a = NULL; + char *filename3b = NULL; + char *filename4a = NULL; + char *filename4b = NULL; + char *filename5a = NULL; + char *filename5b = NULL; + char *tmpname = NULL; + char *cwdpath = NULL; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6087,144 +6137,179 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") || !HDstrcmp(env_h5_drvr, "core") || !HDstrcmp(env_h5_drvr, "nomatch")); - if(have_posix_compat_vfd) { - /* set up name for main file: "extlinks21A" */ - h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); + if(!have_posix_compat_vfd) { + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); + return SUCCEED; + } - /* create tmp_links directory and get current working directory path */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char)))) + TEST_ERROR; + + /* set up name for main file: "extlinks21A" */ + h5_fixname(FILENAME[45], fapl, filename1, NAME_BUF_SIZE); + + /* create tmp_links directory and get current working directory path */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR - /* Set up names for files in the subdirectories */ + /* Set up names for files in the subdirectories */ - /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ - h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[46]); - h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); + /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ + h5_fixname(FILENAME[46], fapl, filename2a, NAME_BUF_SIZE); + fix_ext_filename(tmpname, cwdpath, FILENAME[46]); + h5_fixname(tmpname, fapl, filename2b, NAME_BUF_SIZE); - /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */ - if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ + /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */ + if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ - h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); - h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); + /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ + h5_fixname(FILENAME[47], fapl, filename3a, NAME_BUF_SIZE); + h5_fixname(FILENAME[48], fapl, filename3b, NAME_BUF_SIZE); - /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ - h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[49]); - h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); + /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ + h5_fixname(FILENAME[49], fapl, filename4a, NAME_BUF_SIZE); + fix_ext_filename(tmpname, cwdpath, FILENAME[49]); + h5_fixname(tmpname, fapl, filename4b, NAME_BUF_SIZE); - /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */ - if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ + /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */ + if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ - h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); - h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); + /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ + h5_fixname(FILENAME[50], fapl, filename5a, NAME_BUF_SIZE); + h5_fixname(FILENAME[51], fapl, filename5b, NAME_BUF_SIZE); - /* Create file #1 in current directory */ - if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #1 in current directory */ + if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #2, using symlink #1 name */ - if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #2, using symlink #1 name */ + if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + + /* Create file #2 in tmp_links directory #2 */ + if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #2 in tmp_links directory #2 */ - if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR + /* Re-open file #2 in tmp_links directory through symlink */ + if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Re-open file #2 in tmp_links directory through symlink */ - if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Create group in file #2 in temporary directory */ + if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group in file #2 in temporary directory */ - if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create external link to file #3 & object in temporary directory #2 */ + if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create external link to file #3 & object in temporary directory #2 */ - if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Close group in file #2 */ + if(H5Gclose(group2) < 0) TEST_ERROR - /* Close group in file #2 */ - if(H5Gclose(group2) < 0) TEST_ERROR + /* Close file #2 */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Close file #2 */ - if(H5Fclose(file2) < 0) TEST_ERROR + /* Create file #3 in temp. directory #2 */ + if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ - if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create group in file #3 */ + if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group in file #3 */ - if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #1, using symlink #2 name */ + if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #1, using symlink #2 name */ - if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Close group in file #3 */ + if(H5Gclose(group3) < 0) TEST_ERROR - /* Close group in file #3 */ - if(H5Gclose(group3) < 0) TEST_ERROR + /* Close file #3 */ + if(H5Fclose(file3) < 0) TEST_ERROR - /* Close file #3 */ - if(H5Fclose(file3) < 0) TEST_ERROR + /* Create file #4 in temporary directory #1 */ + if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ - if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create group in file #4 in 'temporary' directory */ + if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group in file #4 in 'temporary' directory */ - if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create external link to file #5 & object in temporary directory #1 */ + if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create external link to file #5 & object in temporary directory #1 */ - if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Close group in file #4 */ + if(H5Gclose(group4) < 0) TEST_ERROR - /* Close group in file #4 */ - if(H5Gclose(group4) < 0) TEST_ERROR + /* Close file #4 */ + if(H5Fclose(file4) < 0) TEST_ERROR - /* Close file #4 */ - if(H5Fclose(file4) < 0) TEST_ERROR + /* Create file #5 in temporary directory #1 */ + if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ - if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create group in file #5 in 'temporary' directory #1 */ + if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Create group in file #5 in 'temporary' directory #1 */ - if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Close file #5 */ + if(H5Fclose(file5) < 0) TEST_ERROR - /* Close file #5 */ - if(H5Fclose(file5) < 0) TEST_ERROR + /* Actual tests... */ - /* Actual tests... */ + /* Reopen file #1 */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Reopen file #1 */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open group in file #2, through external link w/symlink */ + if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) TEST_ERROR - /* Open group in file #2, through external link w/symlink */ - if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group2) < 0) TEST_ERROR + /* Open group in file #3, through external link w/symlink to external link */ + if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3) < 0) TEST_ERROR - /* Open group in file #3, through external link w/symlink to external link */ - if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group3) < 0) TEST_ERROR + /* Open group in file #4, through external link w/symlink to external link w/symlink */ + if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4) < 0) TEST_ERROR - /* Open group in file #4, through external link w/symlink to external link w/symlink */ - if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group4) < 0) TEST_ERROR + /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ + if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ - if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + HDfree(filename1); + HDfree(filename2a); + HDfree(filename2b); + HDfree(filename3a); + HDfree(filename3b); + HDfree(filename4a); + HDfree(filename4b); + HDfree(filename5a); + HDfree(filename5b); + HDfree(tmpname); + HDfree(cwdpath); - PASSED(); - } /* end if */ - else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); - } /* end else */ + PASSED(); return SUCCEED; @@ -6240,7 +6325,21 @@ error: H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; + + HDfree(filename1); + HDfree(filename2a); + HDfree(filename2b); + HDfree(filename3a); + HDfree(filename3b); + HDfree(filename4a); + HDfree(filename4b); + HDfree(filename5a); + HDfree(filename5b); + HDfree(tmpname); + HDfree(cwdpath); + return FAIL; + #else /* H5_HAVE_SYMLINK */ SKIPPED(); HDputs(" Current file system or operating system doesn't support symbolic links"); @@ -7081,7 +7180,7 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi addr = *((const haddr_t *)udata); /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_addr(loc_group, addr); if(target_obj < 0) { ret_value = -1; goto done; @@ -7173,7 +7272,7 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud addr = *((const haddr_t *) udata); /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(file, addr); + target_obj = H5Oopen_by_addr(file, addr); if(target_obj < 0) { ret_value = -1; goto done; @@ -7371,7 +7470,7 @@ error: * Failure: -1 *------------------------------------------------------------------------- */ - /* A traversal function that ignores any udata and simply opens an object +/* A traversal function that ignores any udata and simply opens an object * in the current group named REREG_TARGET_NAME */ static hid_t @@ -7723,7 +7822,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Query the link to test its query callback */ - if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { H5_FAILED(); diff --git a/test/mount.c b/test/mount.c index b7d2858..72973ad 100644 --- a/test/mount.c +++ b/test/mount.c @@ -404,38 +404,41 @@ test_hide(hid_t fapl) char filename1[1024], filename2[1024]; TESTING("name hiding under mount point"); - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1)); + h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2)); if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Build the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* Original names under file1:/mnt1 should not be accessible */ H5E_BEGIN_TRY { - grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); + grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); } H5E_END_TRY; if(grp >= 0) { - H5_FAILED(); - HDputs(" Name is still accessible under mount point."); - TEST_ERROR + H5_FAILED(); + HDputs(" Name is still accessible under mount point."); + TEST_ERROR } /* end if */ /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { - H5_FAILED(); - HDputs(" Hard link failed for hidden object."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link failed for hidden object."); + TEST_ERROR } /* end if */ /* Unmount and close objects */ @@ -448,9 +451,9 @@ test_hide(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(grp); - H5Fclose(file1); - H5Fclose(file2); + H5Gclose(grp); + H5Fclose(file1); + H5Fclose(file2); } H5E_END_TRY; return 1; } /* end test_hide() */ @@ -490,20 +493,23 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) + FAIL_STACK_ERROR /* Create the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR /* * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - HDputs(" Association failed."); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -517,8 +523,8 @@ test_assoc(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file2); - H5Fclose(file1); + H5Fclose(file2); + H5Fclose(file1); } H5E_END_TRY; return 1; } /* end test_assoc() */ diff --git a/test/mtime.c b/test/mtime.c index f7a441d..06f576b 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -39,9 +39,7 @@ const char *FILENAME[] = { * * Purpose: H5O_mtime_decode() test. * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Thursday, July 30, 1998 @@ -188,10 +186,10 @@ main(void) /* All looks good */ HDputs("All modification time tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; /* Something broke */ error: - return 1; -} + return EXIT_FAILURE; +} /* end main() */ diff --git a/test/ntypes.c b/test/ntypes.c index 34558f5..f1d2449 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2484,7 +2484,7 @@ test_opaque_dtype(hid_t file) TEST_ERROR; for(i = 0; i < sizeof(wbuf); i++) - wbuf[i] = (unsigned char)0xff ^ (unsigned char)i; + wbuf[i] = (unsigned char)(0xff ^ i); if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Sclose(space) < 0) TEST_ERROR; diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 14e1a38..985b576 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -28,101 +28,105 @@ /* The VOL class struct */ static const H5VL_class_t null_vol_g = { - 0, /* version */ - NULL_VOL_CONNECTOR_VALUE, /* value */ - NULL_VOL_CONNECTOR_NAME, /* name */ + 0, /* version */ + NULL_VOL_CONNECTOR_VALUE, /* value */ + NULL_VOL_CONNECTOR_NAME, /* name */ 0, /* capability flags */ - NULL, /* initialize */ - NULL, /* terminate */ + NULL, /* initialize */ + NULL, /* terminate */ { /* info_cls */ - (size_t)0, /* size */ - NULL, /* copy */ - NULL, /* compare */ - NULL, /* free */ - NULL, /* to_str */ - NULL, /* from_str */ + (size_t)0, /* size */ + NULL, /* copy */ + NULL, /* compare */ + NULL, /* free */ + NULL, /* to_str */ + NULL, /* from_str */ }, { /* wrap_cls */ - NULL, /* get_object */ - NULL, /* get_wrap_ctx */ - NULL, /* wrap_object */ - NULL, /* unwrap_object */ - NULL, /* free_wrap_ctx */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL, /* unwrap_object */ + NULL, /* free_wrap_ctx */ }, { /* attribute_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* read */ - NULL, /* write */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ }, { /* dataset_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* read */ - NULL, /* write */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + NULL, /* create */ + NULL, /* open */ + NULL, /* read */ + NULL, /* write */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ }, { /* datatype_cls */ - NULL, /* commit */ - NULL, /* open */ - NULL, /* get_size */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + NULL, /* commit */ + NULL, /* open */ + NULL, /* get_size */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ }, { /* file_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ }, { /* group_cls */ - NULL, /* create */ - NULL, /* open */ - NULL, /* get */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* close */ + NULL, /* create */ + NULL, /* open */ + NULL, /* get */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* close */ }, { /* link_cls */ - NULL, /* create */ - NULL, /* copy */ - NULL, /* move */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ + NULL, /* create */ + NULL, /* copy */ + NULL, /* move */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ }, { /* object_cls */ - NULL, /* open */ - NULL, /* copy */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ + NULL, /* open */ + NULL, /* copy */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, + { /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* opt_query */ }, { /* request_cls */ - NULL, /* wait */ - NULL, /* notify */ - NULL, /* cancel */ - NULL, /* specific */ - NULL, /* optional */ - NULL /* free */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, { /* blob_cls */ - NULL, /* put */ - NULL, /* get */ - NULL, /* specific */ - NULL /* optional */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ }, - NULL /* optional */ + NULL /* optional */ }; /* These two functions are necessary to load this plugin using diff --git a/test/objcopy.c b/test/objcopy.c index 751fe72..cabdbfd 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -157,6 +157,7 @@ const char *FILENAME[] = { #define NUM_SUB_GROUPS 20 #define NUM_WIDE_LOOP_GROUPS 10 #define NUM_DATASETS 10 +#define ATTR_CMPD_STRING "ThisIsAString" char src_obj_full_name[215]; /* the full path + name of the object to be copied */ @@ -194,9 +195,9 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2); * * Purpose: Add an address to the table. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- @@ -228,11 +229,10 @@ addr_insert(H5O_info_t *oi) * * Purpose: Check if address has already been encountered * - * Return: Success: TRUE/FALSE - * - * Failure: (can't fail) + * Return: Success: TRUE/FALSE + * Failure: (can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- @@ -257,9 +257,9 @@ addr_lookup(H5O_info_t *oi) * * Purpose: Reset the address tracking data structures * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- @@ -5784,7 +5784,8 @@ attach_attribute_compound_vlstr(hid_t loc_id) int i; char *v; } s1; - s1 buf; /* Buffer */ + size_t len; + s1 buf = {0, NULL}; /* Buffer */ int ret_value = -1; /* Return value */ /* Create dataspace */ @@ -5814,8 +5815,11 @@ attach_attribute_compound_vlstr(hid_t loc_id) goto done; /* Write to the attribute */ + len = HDstrlen(ATTR_CMPD_STRING) + 1; buf.i = 9; - buf.v = "ThisIsAString"; + if(NULL == (buf.v = (char *)HDcalloc(len, sizeof(char)))) + goto done; + HDstrncpy(buf.v, ATTR_CMPD_STRING, len); if(H5Awrite(aid, cmpd_tid, &buf) < 0) goto done; @@ -5832,6 +5836,9 @@ done: H5Tclose(cmpd_tid); if(aid > 0) H5Aclose(aid); + + HDfree(buf.v); + return ret_value; } /* attach_attribute_compound_vlstr */ @@ -11464,8 +11471,8 @@ error: H5Tclose(f_tid); H5Tclose(g_tid); H5Tclose(anon_tid); - H5Pclose(ocpypl_id); - H5Aclose(aid); + H5Pclose(ocpypl_id); + H5Aclose(aid); H5Dclose(did); H5Sclose(sid); H5Gclose(gid); @@ -11704,14 +11711,14 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds error: H5E_BEGIN_TRY { - H5Pclose(ocpypl_id); - H5Tclose(tid); - H5Tclose(tid1); - H5Tclose(tid2); - H5Tclose(tid3); - H5Tclose(tid4); - H5Tclose(tid5); - H5Aclose(aid); + H5Pclose(ocpypl_id); + H5Tclose(tid); + H5Tclose(tid1); + H5Tclose(tid2); + H5Tclose(tid3); + H5Tclose(tid4); + H5Tclose(tid5); + H5Aclose(aid); H5Sclose(sid); H5Fclose(fid_dst); H5Fclose(fid_src); diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index b539b8a..4637f23 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -44,53 +44,15 @@ const char *FILENAME[] = { #define CONFIG_DENSE 16 #define MAX_CONFIGURATION 31 -#define NAME_DATATYPE_SIMPLE "H5T_NATIVE_INT" -#define NAME_DATATYPE_SIMPLE2 "H5T_NATIVE_INT-2" -#define NAME_DATATYPE_VL "vlen of int" -#define NAME_DATATYPE_VL_VL "vlen of vlen of int" #define NAME_DATASET_SIMPLE "dataset_simple" -#define NAME_DATASET_SIMPLE2 "dataset_simple_copy" -#define NAME_DATASET_SIMPLE3 "dataset_simple_another_copy" -#define NAME_DATASET_COMPOUND "dataset_compound" -#define NAME_DATASET_CHUNKED "dataset_chunked" -#define NAME_DATASET_CHUNKED_SINGLE "dataset_chunked_single" -#define NAME_DATASET_CHUNKED2 "dataset_chunked2" -#define NAME_DATASET_CHUNKED2_SINGLE "dataset_chunked2_single" -#define NAME_DATASET_CHUNKED3 "dataset_chunked3" -#define NAME_DATASET_CHUNKED3_SINGLE "dataset_chunked3_single" -#define NAME_DATASET_CHUNKED4 "dataset_chunked4" -#define NAME_DATASET_CHUNKED4_SINGLE "dataset_chunked4_single" -#define NAME_DATASET_COMPACT "dataset_compact" -#define NAME_DATASET_EXTERNAL "dataset_ext" -#define NAME_DATASET_NAMED_DTYPE "dataset_named_dtype" -#define NAME_DATASET_NAMED_DTYPE2 "dataset_named_dtype2" -#define NAME_DATASET_MULTI_OHDR "dataset_multi_ohdr" -#define NAME_DATASET_MULTI_OHDR2 "dataset_multi_ohdr2" -#define NAME_DATASET_VL "dataset_vl" -#define NAME_DATASET_VL2 "dataset_vl2" -#define NAME_DATASET_VL_VL "dataset_vl_vl" -#define NAME_DATASET_VL_VL2 "dataset_vl_vl2" -#define NAME_DATASET_CMPD_VL "dataset_cmpd_vl" #define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple" #define NAME_GROUP_UNCOPIED "/uncopied" -#define NAME_GROUP_EMPTY "/empty" #define NAME_GROUP_TOP "/g0" -#define NAME_GROUP_TOP2 "/g1" -#define NAME_GROUP_TOP3 "/g2" -#define NAME_GROUP_TOP4 "/g3" #define NAME_GROUP_SUB "/g0/g00" -#define NAME_GROUP_SUB_2 "/g0/g01" -#define NAME_GROUP_SUB_SUB "/g0/g00/g000" #define NAME_GROUP_SUB_SUB2 "g000" -#define NAME_GROUP_DATASET "/g0/dataset_simple" #define NAME_GROUP_LINK "/g_links" #define NAME_GROUP_LINK2 "/g_links2" -#define NAME_GROUP_LOOP "g_loop" -#define NAME_GROUP_LOOP2 "g_loop2" -#define NAME_GROUP_LOOP3 "g_loop3" #define NAME_GROUP_REF "ref_grp" -#define NAME_LINK_DATASET "/g_links/dataset_simple" -#define NAME_LINK_HARD "/g_links/hard_link_to_dataset_simple" #define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple" #define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple" #define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple" @@ -99,19 +61,11 @@ const char *FILENAME[] = { #define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere" #define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere" #define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere" -#define NAME_OLD_FORMAT "/dset1" #define NAME_BUF_SIZE 1024 #define ATTR_NAME_LEN 80 #define DIM_SIZE_1 12 #define DIM_SIZE_2 6 -#define MAX_DIM_SIZE_1 100 -#define MAX_DIM_SIZE_2 80 -#define CHUNK_SIZE_1 5 /* Not an even fraction of dimension sizes, so we test copying partial chunks */ -#define CHUNK_SIZE_2 5 -#define NUM_SUB_GROUPS 20 -#define NUM_WIDE_LOOP_GROUPS 10 -#define NUM_DATASETS 10 unsigned num_attributes_g; /* Number of attributes created */ @@ -137,9 +91,9 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) * * Purpose: Add an address to the table. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- @@ -171,11 +125,10 @@ addr_insert(H5O_info_t *oi) * * Purpose: Check if address has already been encountered * - * Return: Success: TRUE/FALSE - * - * Failure: (can't fail) + * Return: Success: TRUE/FALSE + * Failure: (can't fail) * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- @@ -200,9 +153,9 @@ addr_lookup(H5O_info_t *oi) * * Purpose: Reset the address tracking data structures * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, November 5, 2005 * *------------------------------------------------------------------------- diff --git a/test/ohdr.c b/test/ohdr.c index 9d2d414..53d2f59 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -50,7 +50,8 @@ const char *FILENAME[] = { * To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild * the library and simply compile gen_bogus.c with that HDF5 library and run it. */ -#define FILE_BOGUS "tbogus.h5" +#define FILE_BOGUS "tbogus.h5" +#define TESTFILE_LEN 256 /* */ #define FILE_OHDR_SWMR "ohdr_swmr.h5" @@ -473,13 +474,13 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) hid_t fid_bogus = -1; /* bogus file ID */ hid_t gid_bogus = -1; /* bogus group ID */ hid_t loc_bogus = -1; /* location: bogus file or group ID */ - char testfile[256]; + char testfile[TESTFILE_LEN]; /* create a different name for a local copy of the data file to be opened with rd/wr file permissions in case build and test are done in the source directory. */ - HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS)); - testfile[HDstrlen(FILE_BOGUS)]='\0'; + HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN); + testfile[TESTFILE_LEN - 1]='\0'; HDstrncat(testfile, ".copy", 5); /* Make a copy of the data file from svn. */ @@ -759,7 +760,7 @@ count_attributes(hid_t dset_id) { H5O_info_t info; - if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0) + if(H5Oget_info2(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0) return -1; else return (int)info.num_attrs; /* should never exceed int bounds */ diff --git a/test/th5s.c b/test/th5s.c index 747e741..7e1e547 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1739,12 +1739,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = 4; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: @@ -1765,12 +1765,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high) case CONFIG_16: stride = POWER16 - 1; block = POWER16 - 2; - expected_enc_size = expected_version == 3 ? 2 : 4; + expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4); break; case CONFIG_32: stride = POWER32 - 1; block = POWER32 - 2; - expected_enc_size = expected_version == 3 ? 4 : 8; + expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8); break; default: HDassert(0); @@ -1912,7 +1912,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) for(config = CONFIG_8; config <= CONFIG_32; config++) { hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */ uint32_t expected_version = 0; /* Expected version for selection info */ - uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */ + uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */ start = 0; count = 2; @@ -1984,7 +1984,8 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab"); /* Verify the version and encoded size expected for the configuration */ - ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail); + HDassert(expected_enc_size <= 255); + ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size, expected_to_fail); CHECK(ret, FAIL, "test_h5s_check_encoding"); } /* for config */ diff --git a/test/titerate.c b/test/titerate.c index 289a46c..669a094 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -1045,10 +1045,10 @@ test_iterate(void) /* These next tests use the same file */ for(new_format = FALSE; new_format <= TRUE; new_format++) { test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */ - test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */ + test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */ test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */ - test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ - test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ + test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */ + test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */ } /* end for */ /* Test the fix for issue HDFFV-10588 */ diff --git a/test/trefer.c b/test/trefer.c index cd09c8e..dec049e 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -568,7 +568,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ H5R_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ + H5R_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ @@ -2516,7 +2516,8 @@ test_reference_perf(void) ret = H5Rdestroy(&wbuf[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); @@ -2534,7 +2535,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2552,7 +2554,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID); @@ -2567,7 +2570,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2588,7 +2592,8 @@ test_reference_perf(void) ret = H5Rdestroy(&wbuf_reg[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Store first dataset region */ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); @@ -2603,7 +2608,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2622,7 +2628,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE); t = 0; for(i = 0; i < MAX_ITER_WRITE; i++) { @@ -2633,7 +2640,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2666,7 +2674,8 @@ test_reference_perf(void) ret = H5Rdestroy(&rbuf[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); @@ -2711,7 +2720,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2732,7 +2742,8 @@ test_reference_perf(void) ret = H5Rdestroy(&rbuf_reg[0]); CHECK(ret, FAIL, "H5Rdestroy"); } - HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ); /* Read selection from disk */ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg); @@ -2755,7 +2766,8 @@ test_reference_perf(void) t2 = H5_get_time(); t += t2 - t1; } - HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ); + if(VERBOSE_MED) + HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ); /* Close Dataset */ ret = H5Dclose(dataset); @@ -2816,7 +2828,7 @@ test_reference(void) for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { /* Invalid combinations, just continue */ - if(high <= H5F_LIBVER_V112 || high < low) + if(high <= H5F_LIBVER_V110 || high < low) continue; test_reference_region(low, high); /* Test basic H5R dataset region reference code */ diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 272b866..6322894 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -517,7 +517,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */ + hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{-128}}}; /* buffer with non-valid refs */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ diff --git a/test/tsohm.c b/test/tsohm.c index a064940..c126608 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3342,11 +3342,11 @@ test_sohm_extlink(void) static int verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) { - hid_t file_id = -1; - hid_t orig_space_id = -1; + hid_t file_id = H5I_INVALID_HID; + hid_t orig_space_id = H5I_INVALID_HID; hid_t space1_id, space2_id, space3_id; - hid_t dcpl_id = -1; - hid_t dset1_id, dset2_id, dset3_id; + hid_t dcpl_id = H5I_INVALID_HID; + hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID; hsize_t dims1[] = {1, 2}; hsize_t max_dims[] = {H5S_UNLIMITED, 2}; hsize_t dims2[] = {5, 2}; diff --git a/test/tvltypes.c b/test/tvltypes.c index acfd0a2..a6ed60e 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -465,15 +465,15 @@ test_vltypes_vlen_atomic(void) ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); + /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ + VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); + /* Try to call H5Dvlen_get_buf with bad dataspace */ H5E_BEGIN_TRY { ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size); } H5E_END_TRY VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); - /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ - VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); - /* Read dataset from disk */ ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata); CHECK(ret, FAIL, "H5Dread"); diff --git a/test/unlink.c b/test/unlink.c index 6825dec..5199dcf 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -441,7 +441,7 @@ check_new_move(hid_t fapl) TESTING("check new move function"); /* Open file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR @@ -458,7 +458,7 @@ check_new_move(hid_t fapl) FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.") /* Check soft links */ - if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) + if(H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/group1/group_move")) FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value") @@ -123,6 +123,10 @@ static const H5VL_class_t fake_vol_g = { NULL, /* specific */ NULL /* optional */ }, + { /* introspect_cls */ + NULL, /* get_conn_cls */ + NULL, /* opt_query */ + }, { /* request_cls */ NULL, /* wait */ NULL, /* notify */ |