diff options
Diffstat (limited to 'test/vfd.c')
-rw-r--r-- | test/vfd.c | 87 |
1 files changed, 71 insertions, 16 deletions
@@ -108,10 +108,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; @@ -131,6 +127,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; @@ -615,6 +619,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; @@ -622,6 +632,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; @@ -632,6 +647,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; @@ -649,6 +668,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; @@ -714,6 +737,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; @@ -880,6 +907,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) @@ -948,6 +979,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; @@ -1043,6 +1078,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; @@ -1246,6 +1285,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) @@ -1383,10 +1426,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; @@ -1406,6 +1445,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; @@ -1463,10 +1510,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; @@ -1486,6 +1529,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; @@ -1555,10 +1606,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; @@ -1578,6 +1625,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; |