diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-07-29 18:46:19 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-07-29 18:46:19 (GMT) |
commit | 4094dc843f1d42c71f4239e084e640454430ce3a (patch) | |
tree | 36b88358507430f973675defbeb2cf12e2a1a227 /test/vfd.c | |
parent | 871d377e65de92637507295a05f67d52167e2af8 (diff) | |
download | hdf5-4094dc843f1d42c71f4239e084e640454430ce3a.zip hdf5-4094dc843f1d42c71f4239e084e640454430ce3a.tar.gz hdf5-4094dc843f1d42c71f4239e084e640454430ce3a.tar.bz2 |
[svn-r25488] - fix bug with H5Fget_access_plist. need to set VOL and VOL info in property
- add tests for H5Fis_accessible in vfd tests to make sure it works with different fapls.
- fix bug in Log VFD driver.
Diffstat (limited to 'test/vfd.c')
-rw-r--r-- | test/vfd.c | 110 |
1 files changed, 90 insertions, 20 deletions
@@ -106,10 +106,6 @@ test_sec2(void) if(H5FD_SEC2 != H5Pget_driver(access_fapl)) TEST_ERROR; - /* ...and close the property list */ - if(H5Pclose(access_fapl) < 0) - TEST_ERROR; - /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; @@ -129,6 +125,14 @@ test_sec2(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, access_fapl) != TRUE) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -216,10 +220,6 @@ test_direct(void) if(H5FD_DIRECT != H5Pget_driver(access_fapl)) TEST_ERROR; - /* ...and close the property list */ - if (H5Pclose(access_fapl) < 0) - TEST_ERROR; - /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; @@ -333,6 +333,14 @@ test_direct(void) HDassert(check); HDfree(check); + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, access_fapl) != TRUE) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -438,12 +446,19 @@ test_core(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, fapl) != TRUE) + TEST_ERROR; /* Open the file with backing store off for read and write. * Changes won't be saved in file. */ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR; + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, fapl) != TRUE) + TEST_ERROR; + if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -501,6 +516,10 @@ test_core(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, fapl) != TRUE) + TEST_ERROR; + /* Open the file with backing store on for read and write. * Changes will be saved in file. */ if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) @@ -610,6 +629,12 @@ test_family_opens(char *fname, hid_t fa_pl) /* Case 1: reopen file with 1st member file name and default property list */ HDsnprintf(first_name, sizeof(first_name), fname, 0); + /* Verify that the file is not accessible */ + H5E_BEGIN_TRY { + if(H5Fis_accessible(first_name, H5P_DEFAULT) != FALSE) + TEST_ERROR; + } H5E_END_TRY; + H5E_BEGIN_TRY { file = H5Fopen(first_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; @@ -617,6 +642,11 @@ test_family_opens(char *fname, hid_t fa_pl) TEST_ERROR /* Case 2: reopen file with correct name template but default property list */ + + /* Verify that the file is not accessible */ + if(H5Fis_accessible(fname, H5P_DEFAULT) != FALSE) + TEST_ERROR; + H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; @@ -627,6 +657,10 @@ test_family_opens(char *fname, hid_t fa_pl) if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0) TEST_ERROR; + /* Verify that the file is not accessible */ + if(H5Fis_accessible(fname, fa_pl) != FALSE) + TEST_ERROR; + H5E_BEGIN_TRY { file = H5Fopen(fname, H5F_ACC_RDWR, fa_pl); } H5E_END_TRY; @@ -644,6 +678,10 @@ test_family_opens(char *fname, hid_t fa_pl) if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; + /* Verify that the file is not accessible */ + if(H5Fis_accessible(wrong_name, fa_pl) != FALSE) + TEST_ERROR; + H5E_BEGIN_TRY { file = H5Fopen(wrong_name, H5F_ACC_RDWR, fa_pl); } H5E_END_TRY; @@ -707,6 +745,10 @@ test_family(void) if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR; + /* Verify that the file is accessible with correct fapl */ + if(H5Fis_accessible(filename, fapl) != TRUE) + TEST_ERROR; + if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -871,6 +913,10 @@ test_family_compat(void) HDsnprintf(pathname_individual, sizeof(pathname_individual), pathname, counter); } + /* Verify that the file is accessible */ + if(H5Fis_accessible(newname, fapl) != TRUE) + TEST_ERROR; + /* Make sure we can open the file. Use the read and write mode to flush the * superblock. */ if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0) @@ -939,6 +985,10 @@ test_multi_opens(char *fname) HDsnprintf(super_name, sizeof(super_name), "%%s-%c.h5", 's'); HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); + /* Verify that the file is accessible */ + if(H5Fis_accessible(sf_name, H5P_DEFAULT) != FALSE) + return -1; + H5E_BEGIN_TRY { file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; @@ -1031,6 +1081,10 @@ test_multi(void) if(test_multi_opens(filename) < 0) TEST_ERROR; + /* Verify that the file is an HDF5 file */ + if(H5Fis_accessible(filename, fapl) != TRUE) + TEST_ERROR; + /* Reopen the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR; @@ -1232,6 +1286,10 @@ test_multi_compat(void) sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); + /* Verify that the file is accessible */ + if(H5Fis_accessible(newname, fapl) != TRUE) + TEST_ERROR; + /* Reopen the file for read only. Verify 1.8 library can open file * created with 1.6 library. */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) @@ -1367,10 +1425,6 @@ test_log(void) if(H5FD_LOG != H5Pget_driver(access_fapl)) TEST_ERROR; - /* ...and close the property list */ - if(H5Pclose(access_fapl) < 0) - TEST_ERROR; - /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; @@ -1390,6 +1444,14 @@ test_log(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is accessible with log vfd */ + if(H5Fis_accessible(filename, access_fapl) != TRUE) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -1445,10 +1507,6 @@ test_stdio(void) if(H5FD_STDIO != H5Pget_driver(access_fapl)) TEST_ERROR; - /* ...and close the property list */ - if(H5Pclose(access_fapl) < 0) - TEST_ERROR; - /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; @@ -1468,6 +1526,14 @@ test_stdio(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is accessible with stdio vfd */ + if(H5Fis_accessible(filename, access_fapl) != TRUE) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; @@ -1535,10 +1601,6 @@ test_windows(void) if(H5FD_WINDOWS!= H5Pget_driver(access_fapl)) TEST_ERROR; - /* ...and close the property list */ - if(H5Pclose(access_fapl) < 0) - TEST_ERROR; - /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; @@ -1558,6 +1620,14 @@ test_windows(void) if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify that the file is accessible with windows vfd */ + if(H5Fis_accessible(filename, access_fapl) != TRUE) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; |