diff options
author | lrknox <lrknox> | 2017-12-22 18:28:24 (GMT) |
---|---|---|
committer | lrknox <lrknox> | 2017-12-22 18:28:24 (GMT) |
commit | 86d8a4c267eccbc66d6ee6120c9099788853c40f (patch) | |
tree | 53f3d57003fb1f19faea8ca3a9393d44c3cdda0d /test/vds.c | |
parent | b1223dd653e65e076af92b2dfe236f3704da81c8 (diff) | |
download | hdf5-86d8a4c267eccbc66d6ee6120c9099788853c40f.zip hdf5-86d8a4c267eccbc66d6ee6120c9099788853c40f.tar.gz hdf5-86d8a4c267eccbc66d6ee6120c9099788853c40f.tar.bz2 |
Revert "Merge pull request #826 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop"
This reverts commit b1223dd653e65e076af92b2dfe236f3704da81c8, reversing
changes made to b25f123f5f5e25c1447a6a02861cb7c7265c12f2.
Diffstat (limited to 'test/vds.c')
-rw-r--r-- | test/vds.c | 1493 |
1 files changed, 570 insertions, 923 deletions
@@ -36,12 +36,6 @@ const char *FILENAME[] = { "vds_src_1", "vds%%_src", "vds_dapl", - "vds_virt_2", - "vds_virt_3", - "vds_src_2", - "vds_src_3", - "vds%%_src2", - "vds_dapl2", NULL }; @@ -55,8 +49,6 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 -#define TMPDIR "tmp/" - /*------------------------------------------------------------------------- * Function: vds_select_equal @@ -65,7 +57,14 @@ const char *FILENAME[] = { * provided dataspaces are the same. * * Return: Success: 0 + * * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, March 2, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static htri_t @@ -131,7 +130,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } + } /* end if */ /* Free buffers */ HDfree(buf1); @@ -181,7 +180,7 @@ vds_select_equal(hid_t space1, hid_t space2) if(buf1[i] != buf2[i]) { ret_value = FALSE; break; - } + } /* end if */ /* Free buffers */ HDfree(buf1); @@ -218,7 +217,14 @@ error: * parameters. * * Return: Success: 0 + * * Failure: -1 + * + * Programmer: Neil Fortner + * Monday, March 2, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -292,7 +298,8 @@ vds_check_mapping(hid_t dcpl, size_t i, hid_t vspace, hid_t srcspace, error: H5E_BEGIN_TRY { - H5Sclose(space_out); + if(space_out >= 0) + (void)H5Sclose(space_out); } H5E_END_TRY return -1; @@ -305,7 +312,14 @@ error: * Purpose: Tests API functions related to virtual datasets. * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Monday, February 16, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ /* Helper function to get DCPL for examination depending on config */ @@ -356,12 +370,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, file = -1; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open dataset */ if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get DCPL from dataset */ if((*ex_dcpl = H5Dget_create_plist(dset)) < 0) @@ -380,8 +394,8 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR - } - } + } /* end if */ + } /* end if */ else if((oinfo.meta_size.obj.heap_size != exp_meta_size) && (oinfo.meta_size.obj.heap_size != (hsize_t)0)) @@ -410,12 +424,12 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(H5Fclose(file) < 0) TEST_ERROR file = -1; - } + } /* end if */ else if(config == TEST_API_COPY_PLIST) { /* Copy property list */ if((*ex_dcpl = H5Pcopy(dcpl)) < 0) TEST_ERROR - } + } /* end if */ else if(config == TEST_API_ENCDEC_PLIST) { size_t plist_buf_size; @@ -434,14 +448,14 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, /* Free plist_buf */ HDfree(plist_buf); plist_buf = NULL; - } + } /* end if */ else { /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl * can be closed */ if(H5Iinc_ref(dcpl) < 0) TEST_ERROR *ex_dcpl = dcpl; - } + } /* end else */ /* Verify examination DCPL is equal to original DCPL. Do not compare the * plist to itself, and do not do the comparison if we reopened the file, @@ -452,14 +466,16 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(!tri_ret) TEST_ERROR - } + } /* end if */ return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); - H5Dclose(dset); + if(file >= 0) + (void)H5Fclose(file); + if(dset >= 0) + (void)H5Dclose(dset); } H5E_END_TRY; if(plist_buf) HDfree(plist_buf); @@ -516,7 +532,7 @@ test_api(test_api_config_t config, hid_t fapl) case TEST_API_NTESTS: default: TEST_ERROR - } + } /* end switch */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -802,7 +818,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Create virtual dataspace */ if((vspace[i] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - } + } /* end for */ /* Select all (should not be necessary, but just to be sure) */ if(H5Sselect_all(srcspace[0]) < 0) @@ -916,7 +932,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1022,7 +1038,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Add virtual layout mapping */ if(H5Pset_virtual(dcpl, vspace[i], tmp_filename, tmp_dsetname, srcspace[0]) < 0) TEST_ERROR - } + } /* end if */ /* Get examination DCPL */ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0) @@ -1047,7 +1063,7 @@ test_api(test_api_config_t config, hid_t fapl) /* Check that the mapping in the DCPL is correct */ if(vds_check_mapping(ex_dcpl, (size_t)i, vspace[i], srcspace[0], tmp_filename, tmp_dsetname) < 0) TEST_ERROR - } + } /* end if */ /* Close */ if(H5Sclose(srcspace[0]) < 0) @@ -1057,7 +1073,7 @@ test_api(test_api_config_t config, hid_t fapl) if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(ex_dcpl) < 0) TEST_ERROR ex_dcpl = -1; @@ -1107,459 +1123,23 @@ test_api(test_api_config_t config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Pclose(dcpl); - H5Pclose(ex_dcpl); + for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(ex_dcpl >= 0) + (void)H5Pclose(ex_dcpl); } H5E_END_TRY; return 1; } /* end test_api() */ -/*------------------------------------------------------------------------- - * Function: vds_link_prefix - * - * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" - * Should be able to access the target source files in tmp directory via the prefix set - * by H5Pset_virtual_prefix() - * - * Return: Success: 0 - * Failure: -1 - *------------------------------------------------------------------------- - */ -static int -test_vds_prefix(unsigned config, hid_t fapl) -{ - char srcfilename[FILENAME_BUF_SIZE]; - char srcfilename_map[FILENAME_BUF_SIZE]; - char vfilename[FILENAME_BUF_SIZE]; - char vfilename2[FILENAME_BUF_SIZE]; - char srcfilenamepct[FILENAME_BUF_SIZE]; - char srcfilenamepct_map[FILENAME_BUF_SIZE]; - const char *srcfilenamepct_map_orig = "vds%%%%_src"; - hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ - hid_t vfile = -1; /* File with virtual dset */ - hid_t vfile2 = -1; /* File with copied virtual dset */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dapl = -1; /* Dataset access property list */ - hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ - hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ - hid_t memspace = -1; /* Memory dataspace */ - hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ - hid_t vdset = -1; /* Virtual dataset */ - hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ - hsize_t start[4]; /* Hyperslab start */ - hsize_t stride[4]; /* Hyperslab stride */ - hsize_t count[4]; /* Hyperslab count */ - hsize_t block[4]; /* Hyperslab block */ - hssize_t offset[2] = {0, 0}; /* Selection offset */ - int buf[10][26]; /* Write and expected read buffer */ - int rbuf[10][26]; /* Read buffer */ - int rbuf99[9][9]; /* 9x9 Read buffer */ - int evbuf[10][26]; /* Expected VDS "buffer" */ - int erbuf[10][26]; /* Expected read buffer */ - int fill = -1; /* Fill value */ - herr_t ret; /* Generic return value */ - int i, j; - char buffer[1024]; /* buffer to read vds_prefix */ - - TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()") - - h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); - h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2); - h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename); - h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map); - h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct); - h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); - - /* create tmp directory and get current working directory path */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - - /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Initialize VDS prefix items */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if(H5Pset_virtual_prefix(dapl, TMPDIR) < 0) - TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if(HDstrcmp(buffer, TMPDIR) != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); - - /* - * Test 1: All - all selection - */ - /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) - TEST_ERROR - - /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) - TEST_ERROR - - /* Create virtual file */ - if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - else { - srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) - TEST_ERROR - } - - /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - } - } - - /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) - TEST_ERROR - } - - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } - - /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); - - /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) - TEST_ERROR - } - - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) - TEST_ERROR - - /* Close */ - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if(H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if(H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if(H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; - - /* - * Test 2: All - all selection with ENV prefix - */ - if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1)) - TEST_ERROR - - /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) - TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if(HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); - - /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) - TEST_ERROR - - /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) - TEST_ERROR - - /* Create virtual file */ - if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - else { - srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) - TEST_ERROR - } - - /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - } - } - - /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) - TEST_ERROR - } - - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } - - /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); - - /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Reopen srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) - TEST_ERROR - } - - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) - TEST_ERROR - - /* Close */ - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if(H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if(H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if(H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; - - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) - TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(memspace); - H5Pclose(dcpl); - } H5E_END_TRY; - - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) - TEST_ERROR - - return 1; -} /* end vds_link_prefix() */ - /*------------------------------------------------------------------------- * Function: test_basic_io @@ -1568,7 +1148,14 @@ test_vds_prefix(unsigned config, hid_t fapl) * pattern-matching file/dataset strings * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Tuesday, March 3, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -1651,12 +1238,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1685,8 +1272,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1700,7 +1287,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1729,7 +1316,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1813,12 +1400,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -1854,8 +1441,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1869,7 +1456,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1900,7 +1487,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -1949,8 +1536,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -1959,7 +1546,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open v_dset2 */ if((vdset = H5Dopen2(vfile, "v_dset2", H5P_DEFAULT)) < 0) @@ -1985,7 +1572,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Only copy to a different file if the source datasets are in a different * file */ @@ -2027,8 +1614,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen copied virtual file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2037,7 +1624,7 @@ test_basic_io(unsigned config, hid_t fapl) vfile2 = -1; if((vfile2 = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ /* Open v_dset3 */ if((vdset = H5Dopen2(vfile2, "v_dset3", H5P_DEFAULT)) < 0) @@ -2063,13 +1650,13 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Close copied virtual file */ if(H5Fclose(vfile2) < 0) TEST_ERROR vfile2 = -1; - } + } /* end if */ /* Close */ if(H5Dclose(srcdset[0]) < 0) @@ -2148,12 +1735,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2195,8 +1782,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2210,7 +1797,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2241,7 +1828,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2%", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2336,12 +1923,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2377,8 +1964,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2392,7 +1979,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read first source dataset through virtual dataset */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2445,7 +2032,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -2544,12 +2131,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2577,7 +2164,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i][j] = buf[2 * i][j]; for(/* j = 13 */; j < 26; j++) evbuf[i][j] = buf[2 * i + 1][j - 13]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2594,7 +2181,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[i + 5][j] = buf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) evbuf[i + 5][j] = buf[2 * i + 1][j]; - } + } /* end for */ /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2609,8 +2196,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2624,7 +2211,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2640,7 +2227,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i][j] = evbuf[2 * i][j]; for(/* j = 13 */; j < 26; j++) erbuf[i][j] = evbuf[2 * i + 1][j - 13]; - } + } /* end for */ /* Read second slice */ if(H5Dread(vdset, H5T_NATIVE_INT, vspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2652,7 +2239,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[i + 5][j] = evbuf[2 * i][j + 13]; for(/* j = 13 */; j < 26; j++) erbuf[i + 5][j] = evbuf[2 * i + 1][j]; - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2676,7 +2263,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j] = buf[i][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j - 13] = buf[i][j]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2693,7 +2280,7 @@ test_basic_io(unsigned config, hid_t fapl) evbuf[2 * i][j + 13] = buf[i + 5][j]; for(/* j = 13 */; j < 26; j++) evbuf[2 * i + 1][j] = buf[i + 5][j]; - } + } /* end for */ /* Reopen srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -2704,7 +2291,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ /* Reset rbuf */ @@ -2720,7 +2307,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j] = evbuf[i][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j - 13] = evbuf[i][j]; - } + } /* end for */ /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, srcspace[1], srcspace[1], H5P_DEFAULT, rbuf[0]) < 0) @@ -2732,7 +2319,7 @@ test_basic_io(unsigned config, hid_t fapl) erbuf[2 * i][j + 13] = evbuf[i + 5][j]; for(/* j = 13 */; j < 26; j++) erbuf[2 * i + 1][j] = evbuf[i + 5][j]; - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2852,12 +2439,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -2911,8 +2498,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -2926,7 +2513,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset by hyperslab */ /* Reset rbuf */ @@ -2951,7 +2538,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } + } /* end for */ /* Verify read data */ for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) @@ -2997,7 +2584,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source datasets */ /* Reset rbuf */ @@ -3018,7 +2605,7 @@ test_basic_io(unsigned config, hid_t fapl) for(j = 0; j < 26; j++) { erbuf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); erbuf[i + 1][j] -= (int)(sizeof(buf) / sizeof(buf[0][0])); - } + } /* end for */ /* Read second dataset */ if(H5Dread(srcdset[1], H5T_NATIVE_INT, memspace, srcspace[0], H5P_DEFAULT, rbuf[0]) < 0) @@ -3193,12 +2780,12 @@ test_basic_io(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source dataset */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3235,8 +2822,8 @@ test_basic_io(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3250,7 +2837,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data through virtual dataset */ /* Reset rbuf */ @@ -3356,7 +2943,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 3) && (j < 6)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -3409,7 +2996,7 @@ test_basic_io(unsigned config, hid_t fapl) if((j >= 6) && (j < 9)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -3627,7 +3214,7 @@ test_basic_io(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read data directly from source dataset */ /* Select hyperslab in memory space */ @@ -3702,19 +3289,32 @@ test_basic_io(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Fclose(vfile2); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(memspace); - H5Pclose(dcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { + if(srcfile[i] >= 0) + (void)H5Fclose(srcfile[i]); + } /* end for */ + if(vfile >= 0) + (void)H5Fclose(vfile); + if(vfile2 >= 0) + (void)H5Fclose(vfile2); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); } H5E_END_TRY; return 1; @@ -3727,7 +3327,14 @@ error: * Purpose: Tests VDS with unlimited selections * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Thursday, April 30, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -3840,12 +3447,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -3910,8 +3517,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -3925,7 +3532,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -3970,11 +3577,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Test H5Pget_virtual_view() */ if(H5Pget_virtual_view(dapl, &virtual_view) < 0) @@ -3994,7 +3601,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4042,11 +3649,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4055,7 +3662,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[0] = 5; @@ -4092,8 +3699,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4107,7 +3714,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4154,11 +3761,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -4172,7 +3779,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4225,11 +3832,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4238,7 +3845,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 5; @@ -4280,8 +3887,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4295,7 +3902,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4357,7 +3964,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -4422,11 +4029,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Shrink to 15 */ dims[1] = 15; @@ -4453,12 +4060,12 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4472,7 +4079,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4520,11 +4127,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -4559,11 +4166,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Grow to 18 */ @@ -4591,11 +4198,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Grow to 20 */ dims[1] = 20; @@ -4621,7 +4228,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < (int)mdims[1]; j++) if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -4634,12 +4241,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -4715,12 +4322,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -4785,8 +4392,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4800,7 +4407,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -4844,11 +4451,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -4862,7 +4469,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -4904,11 +4511,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -4917,7 +4524,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[1] = 7; @@ -4959,8 +4566,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -4974,7 +4581,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5020,11 +4627,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5038,7 +4645,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5089,11 +4696,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5102,7 +4709,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[1] = 10; @@ -5144,8 +4751,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5159,7 +4766,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5221,7 +4828,7 @@ test_unlim(unsigned config, hid_t fapl) if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -5238,7 +4845,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5290,11 +4897,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -5307,12 +4914,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -5407,12 +5014,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -5452,7 +5059,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][6 * j] = buf[i][2 * j]; erbuf[i][(6 * j) + 1] = buf[i][(2 * j) + 1]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5468,7 +5075,7 @@ test_unlim(unsigned config, hid_t fapl) for(j = 0; j < 2; j++) { erbuf[i][(6 * j) + 2] = buf[i][2 * j]; erbuf[i][(6 * j) + 3] = buf[i][(2 * j) + 1]; - } + } /* end for */ /* Adjust write buffer */ for(i = 0; i < (int)mdims[0]; i++) @@ -5489,7 +5096,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][4] = buf[i][0]; erbuf[i][5] = buf[i][1]; - } + } /* end for */ /* Close srcdsets and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5507,8 +5114,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5522,7 +5129,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5566,11 +5173,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5584,7 +5191,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5626,11 +5233,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5639,7 +5246,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[1] = 7; @@ -5676,8 +5283,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5691,7 +5298,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5736,11 +5343,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -5754,7 +5361,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5764,7 +5371,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][12] = buf[i][0]; erbuf[i][13] = buf[i][1]; erbuf[i][18] = buf[i][2]; - } + } /* end for */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5808,11 +5415,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5821,7 +5428,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset3", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[2] */ dims[1] = 5; @@ -5853,7 +5460,7 @@ test_unlim(unsigned config, hid_t fapl) erbuf[i][10] = buf[i][0]; erbuf[i][11] = buf[i][1]; erbuf[i][16] = buf[i][2]; - } + } /* end for */ /* Close srcdset[2] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -5865,8 +5472,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -5880,7 +5487,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -5925,11 +5532,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -5943,7 +5550,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -5989,11 +5596,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6002,7 +5609,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[1] = 6; @@ -6033,7 +5640,7 @@ test_unlim(unsigned config, hid_t fapl) for(i = 0; i < 10; i++) { erbuf[i][14] = buf[i][0]; erbuf[i][15] = buf[i][1]; - } + } /* end for */ /* Close srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6045,8 +5652,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6060,7 +5667,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6104,11 +5711,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6122,7 +5729,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6164,11 +5771,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now just read middle 2 rows */ HDmemset(rbuf[0], 0, sizeof(rbuf)); @@ -6194,11 +5801,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if((i == 4) || (i == 5)) { if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != 0) TEST_ERROR @@ -6217,12 +5824,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6303,12 +5910,12 @@ test_unlim(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create source datasets */ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, srcdcpl, H5P_DEFAULT)) < 0) @@ -6361,8 +5968,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6376,7 +5983,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6422,11 +6029,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -6440,7 +6047,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6482,11 +6089,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[0] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -6495,7 +6102,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset1", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[0] */ dims[0] = 5; @@ -6533,8 +6140,8 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6548,7 +6155,7 @@ test_unlim(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6594,11 +6201,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -6612,7 +6219,7 @@ test_unlim(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -6660,11 +6267,11 @@ test_unlim(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -6677,12 +6284,12 @@ test_unlim(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -6725,23 +6332,23 @@ error: for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { if(srcdset[i] >= 0) (void)H5Dclose(srcdset[i]); - } + } /* end for */ if(vdset >= 0) (void)H5Dclose(vdset); for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { if(srcfile[i] >= 0) (void)H5Fclose(srcfile[i]); - } + } /* end for */ if(vfile >= 0) (void)H5Fclose(vfile); for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { if(srcspace[i] >= 0) (void)H5Sclose(srcspace[i]); - } + } /* end for */ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(vspace[i] >= 0) (void)H5Sclose(vspace[i]); - } + } /* end for */ if(filespace >= 0) (void)H5Sclose(filespace); if(memspace >= 0) @@ -6878,12 +6485,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -6895,7 +6502,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -6909,7 +6516,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -6995,8 +6602,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7010,7 +6617,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7054,11 +6661,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -7095,8 +6702,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7110,7 +6717,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7150,11 +6757,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try with different selections */ count[0] = 10; @@ -7181,12 +6788,12 @@ test_printf(unsigned config, hid_t fapl) if((j < (int)start[1]) || (j >= (int)(start[1] + count[1]))) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end for */ start[1] = 0; /* Now try writing through VDS */ @@ -7222,7 +6829,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[2] = H5Dopen2(srcfile[0], "src_dset2", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Read srcdset[0] */ count[0] = 10; @@ -7324,12 +6931,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -7341,7 +6948,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7355,7 +6962,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7493,14 +7100,14 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -7514,7 +7121,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -7558,11 +7165,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Test H5Pget_virtual_printf_gap() */ if(H5Pget_virtual_printf_gap(dapl, &gap_size) < 0) @@ -7582,7 +7189,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7634,11 +7241,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 2, reopen file as well if * config option specified */ @@ -7652,7 +7259,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7704,11 +7311,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 3, reopen file as well if * config option specified */ @@ -7722,7 +7329,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7774,11 +7381,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 4, reopen file as well if * config option specified */ @@ -7792,7 +7399,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7844,11 +7451,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -7862,7 +7469,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -7908,11 +7515,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -7926,16 +7533,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8008,7 +7615,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8074,7 +7681,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8088,7 +7695,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8132,11 +7739,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8171,7 +7778,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8185,7 +7792,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8229,11 +7836,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8249,7 +7856,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8319,7 +7926,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8385,7 +7992,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8399,7 +8006,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8443,11 +8050,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile[1] if config option specified */ if(config & TEST_IO_CLOSE_SRC) @@ -8482,7 +8089,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8496,7 +8103,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8540,11 +8147,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close */ if(!(config & TEST_IO_CLOSE_SRC)) { @@ -8560,7 +8167,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[1]) < 0) TEST_ERROR srcfile[1] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -8573,7 +8180,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Sclose(vspace[0]) < 0) TEST_ERROR vspace[0] = -1; - } + } /* end if */ /* @@ -8631,12 +8238,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -8648,7 +8255,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8662,7 +8269,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8748,8 +8355,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8763,7 +8370,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8807,11 +8414,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -8847,8 +8454,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -8862,7 +8469,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -8906,11 +8513,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -8924,7 +8531,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -8971,11 +8578,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9011,8 +8618,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9026,7 +8633,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9070,11 +8677,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9088,7 +8695,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9135,11 +8742,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf_gap set to 1, reopen file as well if * config option specified */ @@ -9153,7 +8760,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9200,11 +8807,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -9218,16 +8825,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -9303,12 +8910,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -9320,7 +8927,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9334,7 +8941,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9430,8 +9037,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9445,7 +9052,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9489,11 +9096,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9507,7 +9114,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9554,11 +9161,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9598,8 +9205,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9613,7 +9220,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9657,11 +9264,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file * as well if config option specified */ @@ -9675,7 +9282,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9721,11 +9328,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -9762,8 +9369,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -9777,7 +9384,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -9821,11 +9428,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -9859,11 +9466,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Shrink to 12 */ @@ -9889,11 +9496,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Shrink to 10 */ dims[1] = 12; @@ -9918,12 +9525,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file * as well if config option specified */ @@ -9937,7 +9544,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -9983,11 +9590,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now test reopening virtual dataset without calling H5Dget_space, if * REOPEN_VIRT flag set */ @@ -10021,11 +9628,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Now try setting extent manually */ /* Grow to 12 */ @@ -10051,11 +9658,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Grow to 15 */ dims[1] = 15; @@ -10080,12 +9687,12 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } - } + } /* end for */ + } /* end if */ /* Reset dapl */ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0) @@ -10097,16 +9704,16 @@ test_printf(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10163,12 +9770,12 @@ test_printf(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile[0] = H5Fcreate(srcfilenamepct, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile[0] = vfile; if(H5Iinc_ref(srcfile[0]) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) @@ -10180,7 +9787,7 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10194,7 +9801,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10260,8 +9867,8 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10275,7 +9882,7 @@ test_printf(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10319,11 +9926,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Close VDS and reopen with printf gap set to 127, reopen file as well if * config option specified */ @@ -10337,7 +9944,7 @@ test_printf(unsigned config, hid_t fapl) vfile = -1; if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - } + } /* end if */ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) TEST_ERROR @@ -10383,11 +9990,11 @@ test_printf(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reset dapl */ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0) @@ -10401,12 +10008,12 @@ test_printf(unsigned config, hid_t fapl) if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile[0]) < 0) TEST_ERROR srcfile[0] = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -10437,19 +10044,32 @@ test_printf(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) - H5Fclose(srcfile[i]); - H5Fclose(vfile); - H5Sclose(srcspace); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(filespace); - H5Sclose(memspace); - H5Pclose(dcpl); - H5Pclose(dapl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) { + if(srcfile[i] >= 0) + (void)H5Fclose(srcfile[i]); + } /* end for */ + if(vfile >= 0) + (void)H5Fclose(vfile); + if(srcspace >= 0) + (void)H5Sclose(srcspace); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(filespace >= 0) + (void)H5Sclose(filespace); + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(dapl >= 0) + (void)H5Pclose(dapl); } H5E_END_TRY; return 1; @@ -10463,7 +10083,14 @@ error: * VDS * * Return: Success: 0 + * * Failure: number of errors + * + * Programmer: Neil Fortner + * Friday, August 14, 2015 + * + * Modifications: + * *------------------------------------------------------------------------- */ static int @@ -10585,12 +10212,12 @@ test_all(unsigned config, hid_t fapl) if(config & TEST_IO_DIFFERENT_FILE) { if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - } + } /* end if */ else { srcfile = vfile; if(H5Iinc_ref(srcfile) < 0) TEST_ERROR - } + } /* end if */ /* Create virtual dataset */ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -10602,7 +10229,7 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10616,7 +10243,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10687,14 +10314,14 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(config & TEST_IO_DIFFERENT_FILE) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10708,7 +10335,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10754,11 +10381,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10767,7 +10394,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 2; @@ -10802,8 +10429,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10817,7 +10444,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10863,11 +10490,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -10907,8 +10534,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -10922,7 +10549,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -10968,11 +10595,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -10981,7 +10608,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 3; @@ -11025,8 +10652,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11040,7 +10667,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11086,11 +10713,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11130,8 +10757,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11145,7 +10772,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11191,11 +10818,11 @@ test_all(unsigned config, hid_t fapl) if((i >= (int)dims[0]) || (j >= (int)dims[1])) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcdset[1] and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { @@ -11204,7 +10831,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((srcdset[1] = H5Dopen2(srcfile, "src_dset_unlim", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Extend srcdset[1] */ dims[0] = 7; @@ -11249,8 +10876,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11264,7 +10891,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11310,11 +10937,11 @@ test_all(unsigned config, hid_t fapl) if(j >= (int)dims[1]) { if(rbuf[i][j] != 0) TEST_ERROR - } + } /* end if */ else if(rbuf[i][j] != erbuf[i][j]) TEST_ERROR - } + } /* end for */ /* Reopen srcfile if config option specified */ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE)) @@ -11354,8 +10981,8 @@ test_all(unsigned config, hid_t fapl) if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } - } + } /* end if */ + } /* end if */ /* Reopen virtual dataset and file if config option specified */ if(config & TEST_IO_REOPEN_VIRT) { @@ -11369,7 +10996,7 @@ test_all(unsigned config, hid_t fapl) TEST_ERROR if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0) TEST_ERROR - } + } /* end if */ /* Get VDS space */ if((filespace = H5Dget_space(vdset)) < 0) @@ -11421,16 +11048,16 @@ test_all(unsigned config, hid_t fapl) if(H5Dclose(srcdset[i]) < 0) TEST_ERROR srcdset[i] = -1; - } + } /* end for */ if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ else if(!(config & TEST_IO_DIFFERENT_FILE)) { if(H5Fclose(srcfile) < 0) TEST_ERROR srcfile = -1; - } + } /* end if */ if(H5Dclose(vdset) < 0) TEST_ERROR vdset = -1; @@ -11441,12 +11068,12 @@ test_all(unsigned config, hid_t fapl) if(H5Sclose(srcspace[i]) < 0) TEST_ERROR srcspace[i] = -1; - } + } /* end for */ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { if(H5Sclose(vspace[i]) < 0) TEST_ERROR vspace[i] = -1; - } + } /* end for */ if(H5Pclose(dcpl) < 0) TEST_ERROR dcpl = -1; @@ -11462,19 +11089,32 @@ test_all(unsigned config, hid_t fapl) error: H5E_BEGIN_TRY { - for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) - H5Dclose(srcdset[i]); - H5Dclose(vdset); - H5Fclose(srcfile); - H5Fclose(vfile); - for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) - H5Sclose(srcspace[i]); - for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) - H5Sclose(vspace[i]); - H5Sclose(filespace); - H5Sclose(memspace); - H5Pclose(dcpl); - H5Pclose(srcdcpl); + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) { + if(srcdset[i] >= 0) + (void)H5Dclose(srcdset[i]); + } /* end for */ + if(vdset >= 0) + (void)H5Dclose(vdset); + if(srcfile >= 0) + (void)H5Fclose(srcfile); + if(vfile >= 0) + (void)H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) { + if(srcspace[i] >= 0) + (void)H5Sclose(srcspace[i]); + } /* end for */ + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) { + if(vspace[i] >= 0) + (void)H5Sclose(vspace[i]); + } /* end for */ + if(filespace >= 0) + (void)H5Sclose(filespace); + if(memspace >= 0) + (void)H5Sclose(memspace); + if(dcpl >= 0) + (void)H5Pclose(dcpl); + if(srcdcpl >= 0) + (void)H5Pclose(srcdcpl); } H5E_END_TRY; return 1; @@ -11488,6 +11128,10 @@ error: * * Return: Success: 0 * Failure: 1 + * + * Programmer: Dana Robinson + * March 2016 + * *------------------------------------------------------------------------- */ static int @@ -11629,6 +11273,10 @@ test_dapl_values(hid_t fapl_id) * Purpose: Tests datasets with virtual layout * * Return: EXIT_SUCCESS/EXIT_FAILURE + * + * Programmer: Neil Fortner + * Tuesday, February 17, 2015 + * *------------------------------------------------------------------------- */ int @@ -11651,11 +11299,10 @@ main(void) for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); - nerrors += test_vds_prefix(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); - } + } /* end for */ nerrors += test_dapl_values(fapl); |