summaryrefslogtreecommitdiffstats
path: root/test/vds.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/vds.c')
-rw-r--r--test/vds.c720
1 files changed, 719 insertions, 1 deletions
diff --git a/test/vds.c b/test/vds.c
index c3b6181..af052a8 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -1409,7 +1409,7 @@ test_basic_io(unsigned config, hid_t fapl)
int erbuf[10][26]; /* Expected read buffer */
int fill = -1; /* Fill value */
herr_t ret; /* Generic return value */
- int i, j;
+ int i, j, u, v;
TESTING("basic virtual dataset I/O")
@@ -3498,6 +3498,724 @@ test_basic_io(unsigned config, hid_t fapl)
memspace = -1;
+ /*
+ * Test 8: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 8;
+ dims[1] = 15;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 4;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* 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) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", 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, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* 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;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 15; j++) {
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(v >= 24) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ 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", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 2;
+ stride[1] = 2;
+ count[0] = 5;
+ count[1] = 12;
+ block[0] = 1;
+ block[1] = 1;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 2;
+ start[1] = 0;
+ count[0] = 4;
+ count[1] = 15;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], 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] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -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(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 9: For code coverage: Horizontal block virtual mappings, and file
+ * selection, grid memory selection, 3 mappings, 3D memory space
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ dims[1] = 13;
+ dims[2] = 2;
+ if((memspace = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 6;
+ dims[1] = 10;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[2] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 2;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 2;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+ start[0] = 4;
+ if(H5Sselect_hyperslab(vspace[2], H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[2], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset3", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* 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) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", 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, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reset erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+
+ /* 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;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 2;
+ count[1] = 5;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 2; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 2; i < 4; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 4;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to third source dataset */
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 4; i < 6; i++)
+ for(j = 0; j < 10; j++) {
+ erbuf[u][v] = buf[i][j];
+ if(++v == 6)
+ v += 2;
+ else if(v == 14) {
+ u += 2;
+ v = 0;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ 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", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ stride[0] = 2;
+ stride[1] = 4;
+ stride[2] = 1;
+ count[0] = 5;
+ count[1] = 2;
+ count[2] = 1;
+ block[0] = 1;
+ block[1] = 3;
+ block[2] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, 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] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -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(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(vspace[2]) < 0)
+ TEST_ERROR
+ vspace[2] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
+ /*
+ * Test 10: For code coverage: Vertical stripe virtual mappings, vertical
+ * block file selection, block memory selection, 3D VDS
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create memory dataspace */
+ if((memspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 10;
+ dims[1] = 9;
+ dims[2] = 6;
+ if((vspace[0] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(3, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 12;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure)
+ */
+ if(H5Sselect_all(srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 1;
+ count[1] = 4;
+ count[2] = 3;
+ stride[0] = 1;
+ stride[1] = 2;
+ stride[2] = 2;
+ block[0] = 10;
+ block[1] = 1;
+ block[2] = 1;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+ start[2] = 1;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset1", srcspace[0]) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset2", srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Reset dims */
+ dims[0] = 10;
+ dims[1] = 26;
+
+ /* 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) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ }
+
+ /* Create source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset2", 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, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Initialize erbuf */
+ HDmemset(erbuf[0], 0, sizeof(rbuf));
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 24; j += 6) {
+ erbuf[i][j] = -1;
+ erbuf[i][j + 1] = -1;
+ }
+
+ /* 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;
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 10;
+ count[1] = 12;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to first source dataset */
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 0;
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 8; j++) {
+ if(v == 0 || v == 12)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!(v % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 0;
+ }
+ }
+
+ /* Select hyperslab in memory */
+ start[1] = 8;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Write data directly to second source dataset */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ u = 0;
+ v = 1;
+ for(i = 0; i < 10; i++)
+ for(j = 8; j < 16; j++) {
+ if(v == 1 || v == 13)
+ erbuf[u][v] = buf[i][j];
+ v += 2;
+ if(!((v - 1) % 6))
+ v += 6;
+ if(v >= 28) {
+ u++;
+ v = 1;
+ }
+ }
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ 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", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ }
+
+ /* Select hyperslab in memory */
+ start[0] = 0;
+ start[1] = 0;
+ stride[0] = 1;
+ stride[1] = 6;
+ count[0] = 1;
+ count[1] = 4;
+ block[0] = 10;
+ block[1] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in file */
+ start[0] = 0;
+ start[1] = 0;
+ start[2] = 0;
+ count[0] = 10;
+ count[1] = 4;
+ count[2] = 2;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ HDmemset(rbuf[0], 0, sizeof(rbuf));
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, vspace[0], 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] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ }
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -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(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+
/* Close */
if(H5Pclose(dcpl) < 0)
TEST_ERROR