summaryrefslogtreecommitdiffstats
path: root/test/vds.c
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2019-12-24 21:12:08 (GMT)
commit5b9cf732caab9daa6ed1e00f2df4f5a792340196 (patch)
tree4c01c9bd71ba5e7d8d11b474f6896e6ffbf0416d /test/vds.c
parent646fc294078f560fc9bef784cb1c4e27cdc51f5b (diff)
parente0fa36bfe008c03365ce8ea94d705f8fdebccdf0 (diff)
downloadhdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.zip
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.gz
hdf5-5b9cf732caab9daa6ed1e00f2df4f5a792340196.tar.bz2
Merge pull request #2203 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_6
* commit 'e0fa36bfe008c03365ce8ea94d705f8fdebccdf0': (166 commits) Update release date strings in README.txt and release_docs/RELEASE.txt Add release note about using ompio instead of romio when collective writes fail with OpenMPI. Fixed typos, grammatical errors, etc. Expanded entry for S3 and HDFS VFDs. Moved Mac 10.11 and 10.12 from Supported Platforms to More Platforms Tested. Add qualification to RELEASE.txt regarding performance improvements Standalone doesn't use h5test implementation. Add missing note Update COPYING file with new HDF5 license. Update bin/config.guess and config.sub to current version available from git.savannah.gnu.org. Fix include to correct memory calls - big-endian issue. Revert BLDLIBDIR value in junit.sh.in. Corrections to CMake functions Update version for HDF5 1.10.6 release. Remove autom4te.cache directory that shouldn't have been added. Remove duplicate instance Fix merge issue HDFFV-10979 - fix global name clash Correct clang search and java include Latest date first in RELEASE.txt Update RELEASE.txt with performance improvements and Steven Varga's bugfix. Update version numbers for shared lib files according to api compatibility report. Created hdf5_1_10_6 branch for HDF5 1.10.6 release preparation. Set version to 1.10.6-pre1. Switched default maintainer mode to disabled and default build mode to production. Added files produced by autogen.sh to commit except for src/H5config.h.in~ and src/H5public.h~. ...
Diffstat (limited to 'test/vds.c')
-rw-r--r--test/vds.c226
1 files changed, 23 insertions, 203 deletions
diff --git a/test/vds.c b/test/vds.c
index 66e137f..9c7fd5c 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -55,7 +55,7 @@ const char *FILENAME[] = {
#define FILENAME_BUF_SIZE 1024
-#define TMPDIR "tmp/"
+#define TMPDIR "tmp_vds/"
/*-------------------------------------------------------------------------
@@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
TEST_ERROR
if(config == TEST_API_REOPEN_FILE) {
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);
+ HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
TEST_ERROR
}
}
@@ -619,9 +619,8 @@ test_api(test_api_config_t config, hid_t fapl)
/* Get examination DCPL */
-
- /* Should be a value of 174, not 213. HDFFV-10469 */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)174) < 0)
+ /* Correct previous fix for HDFFV-10469 */
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */
@@ -1122,7 +1121,7 @@ error:
} /* end test_api() */
/*-------------------------------------------------------------------------
- * Function: vds_link_prefix
+ * Function: vds_link_prefix_first
*
* 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
@@ -1133,7 +1132,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_vds_prefix(unsigned config, hid_t fapl)
+test_vds_prefix_first(unsigned config, hid_t fapl)
{
char srcfilename[FILENAME_BUF_SIZE];
char srcfilename_map[FILENAME_BUF_SIZE];
@@ -1159,7 +1158,7 @@ test_vds_prefix(unsigned config, hid_t fapl)
int i, j;
char buffer[1024]; /* buffer to read vds_prefix */
- TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()")
+ TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2);
@@ -1192,9 +1191,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
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
@@ -1219,11 +1215,14 @@ test_vds_prefix(unsigned config, hid_t fapl)
/* Create source file if requested */
if(config & TEST_IO_DIFFERENT_FILE) {
- HDgetcwd(buffer, 1024);
- HDchdir(TMPDIR);
+ if(NULL == HDgetcwd(buffer, 1024))
+ TEST_ERROR
+ if(HDchdir(TMPDIR) < 0)
+ TEST_ERROR
if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
- HDchdir(buffer);
+ if(HDchdir(buffer) < 0)
+ TEST_ERROR
}
else {
srcfile[0] = vfile;
@@ -1300,11 +1299,14 @@ test_vds_prefix(unsigned config, hid_t fapl)
/* 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(NULL == HDgetcwd(buffer, 1024))
+ TEST_ERROR
+ if(HDchdir(TMPDIR) < 0)
+ TEST_ERROR
if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
- HDchdir(buffer);
+ if(HDchdir(buffer) < 0)
+ TEST_ERROR
}
if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0)
TEST_ERROR
@@ -1347,187 +1349,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
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;
@@ -1539,7 +1360,6 @@ test_vds_prefix(unsigned config, hid_t fapl)
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++)
@@ -1553,7 +1373,7 @@ test_vds_prefix(unsigned config, hid_t fapl)
TEST_ERROR
return 1;
-} /* end vds_link_prefix() */
+} /* end test_vds_prefix */
/*-------------------------------------------------------------------------
@@ -11624,7 +11444,7 @@ 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_vds_prefix_first(bit_config, fapl);
nerrors += test_unlim(bit_config, fapl);
nerrors += test_printf(bit_config, fapl);
nerrors += test_all(bit_config, fapl);
@@ -11637,14 +11457,14 @@ main(void)
if(nerrors)
goto error;
- printf("All virtual dataset tests passed.\n");
+ HDprintf("All virtual dataset tests passed.\n");
h5_cleanup(FILENAME, fapl);
return EXIT_SUCCESS;
error:
nerrors = MAX(1, nerrors);
- printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
+ HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */