diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/accum.c | 40 | ||||
-rw-r--r-- | test/accum_swmr_reader.c | 23 | ||||
-rw-r--r-- | test/cache_image.c | 256 | ||||
-rw-r--r-- | test/cache_tagging.c | 58 | ||||
-rw-r--r-- | test/cmpd_dset.c | 4 | ||||
-rw-r--r-- | test/efc.c | 12 | ||||
-rw-r--r-- | test/h5test.c | 44 | ||||
-rw-r--r-- | test/h5test.h | 6 | ||||
-rw-r--r-- | test/objcopy.c | 2 | ||||
-rw-r--r-- | test/ohdr.c | 50 | ||||
-rw-r--r-- | test/tfile.c | 128 | ||||
-rw-r--r-- | test/vol.c | 211 |
12 files changed, 574 insertions, 260 deletions
diff --git a/test/accum.c b/test/accum.c index 87628d8..7af353c 100644 --- a/test/accum.c +++ b/test/accum.c @@ -26,10 +26,13 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename */ -#define FILENAME "accum.h5" +/* (The file names are the same as the define in accum_swmr_reader.c) */ +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; -/* The file name is the same as the define in accum_swmr_reader.c */ -#define SWMR_FILENAME "accum_swmr_big.h5" /* The reader forked by test_swmr_write_big() */ #define SWMR_READER "accum_swmr_reader" @@ -92,6 +95,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ hid_t fid = -1; hid_t fapl = -1; /* File access property list */ + char filename[1024]; H5F_t * f = NULL; /* File for all tests */ @@ -99,15 +103,13 @@ main(void) puts("Testing the metadata accumulator"); /* File access property list */ + h5_reset(); if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create a test file */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - - /* Closing and remove the file */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -143,7 +145,6 @@ main(void) /* End of test code, close and delete file */ if(H5Fclose(fid) < 0) TEST_ERROR - HDremove(FILENAME); /* This test uses a different file */ nerrors += test_swmr_write_big(TRUE); @@ -152,6 +153,7 @@ main(void) if(nerrors) goto error; puts("All metadata accumulator tests passed."); + h5_cleanup(FILENAME, fapl); return 0; @@ -1828,6 +1830,7 @@ test_swmr_write_big(hbool_t newest_format) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* File access property list */ H5F_t *rf = NULL; /* File pointer */ + char filename[1024]; uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ uint8_t wbuf[1024]; /* Buffer for reading & writing */ unsigned u; /* Local index variable */ @@ -1865,17 +1868,18 @@ test_swmr_write_big(hbool_t newest_format) /* File access property list */ if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Both cases will result in v3 superblock and version 2 object header for SWMR */ if(newest_format) { /* latest format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } else { /* non-latest-format */ - if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR } /* end if */ @@ -1884,7 +1888,7 @@ test_swmr_write_big(hbool_t newest_format) FAIL_STACK_ERROR /* Open the file with SWMR_WRITE */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) + if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR /* Push API context */ @@ -1979,20 +1983,19 @@ test_swmr_write_big(hbool_t newest_format) /* Flush the accumulator */ if(accum_reset(rf) < 0) FAIL_STACK_ERROR; - /* Close the property list */ - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; /* Close and remove the file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR; + /* Close the property list */ + if(H5Pclose(fapl) < 0) + FAIL_STACK_ERROR; + /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - HDremove(SWMR_FILENAME); - /* Release memory */ if(wbuf2) HDfree(wbuf2); @@ -2004,12 +2007,11 @@ test_swmr_write_big(hbool_t newest_format) error: /* Closing and remove the file */ - H5Pclose(fapl); H5Fclose(fid); if(api_ctx_pushed) H5CX_pop(); - HDremove(SWMR_FILENAME); + H5Pclose(fapl); /* Release memory */ if(wbuf2) diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 16e0ddc..ac48a13 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -23,7 +23,12 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ -#define SWMR_FILENAME "accum_swmr_big.h5" +const char *FILENAME[] = { + "accum", + "accum_swmr_big", + NULL +}; + /*------------------------------------------------------------------------- @@ -47,6 +52,7 @@ main(void) hid_t fid = -1; /* File ID */ hid_t fapl = -1; /* file access property list ID */ H5F_t *f = NULL; /* File pointer */ + char filename[1024]; unsigned u; /* Local index variable */ uint8_t rbuf[1024]; /* Buffer for reading */ uint8_t buf[1024]; /* Buffer for holding the expected data */ @@ -68,10 +74,11 @@ main(void) if((fapl = h5_fileaccess()) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); /* Open the file with SWMR_READ */ - if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) + FAIL_STACK_ERROR /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR @@ -79,21 +86,21 @@ main(void) /* Get H5F_t * to internal file structure */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Should read in [1024, 2024] with buf data */ if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data read is correct */ if(HDmemcmp(buf, rbuf, (size_t)1024) != 0) - TEST_ERROR; + TEST_ERROR; /* CLose the file */ if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR diff --git a/test/cache_image.c b/test/cache_image.c index 10e9a8a..10c37f0 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -40,27 +40,27 @@ static void attempt_swmr_open_hdf5_file(hbool_t create_file, static void verify_datasets(hid_t file_id, int min_dset, int max_dset); /* local test function declarations */ -static unsigned check_cache_image_ctl_flow_1(void); -static unsigned check_cache_image_ctl_flow_2(void); -static unsigned check_cache_image_ctl_flow_3(void); -static unsigned check_cache_image_ctl_flow_4(void); -static unsigned check_cache_image_ctl_flow_5(void); -static unsigned check_cache_image_ctl_flow_6(void); - -static unsigned cache_image_smoke_check_1(void); -static unsigned cache_image_smoke_check_2(void); -static unsigned cache_image_smoke_check_3(void); -static unsigned cache_image_smoke_check_4(void); -static unsigned cache_image_smoke_check_5(void); -static unsigned cache_image_smoke_check_6(void); - -static unsigned cache_image_api_error_check_1(void); -static unsigned cache_image_api_error_check_2(void); -static unsigned cache_image_api_error_check_3(void); -static unsigned cache_image_api_error_check_4(void); - -static unsigned get_free_sections_test(void); -static unsigned evict_on_close_test(void); +static unsigned check_cache_image_ctl_flow_1(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_2(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_3(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_4(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_5(hbool_t single_file_vfd); +static unsigned check_cache_image_ctl_flow_6(hbool_t single_file_vfd); + +static unsigned cache_image_smoke_check_1(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_2(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_3(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_4(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_5(hbool_t single_file_vfd); +static unsigned cache_image_smoke_check_6(hbool_t single_file_vfd); + +static unsigned cache_image_api_error_check_1(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_2(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_3(hbool_t single_file_vfd); +static unsigned cache_image_api_error_check_4(hbool_t single_file_vfd); + +static unsigned get_free_sections_test(hbool_t single_file_vfd); +static unsigned evict_on_close_test(hbool_t single_file_vfd); /****************************************************************************/ @@ -1329,7 +1329,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) */ static unsigned -check_cache_image_ctl_flow_1(void) +check_cache_image_ctl_flow_1(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_1()"; char filename[512]; @@ -1341,6 +1341,13 @@ check_cache_image_ctl_flow_1(void) TESTING("metadata cache image control flow test 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1608,7 +1615,7 @@ check_cache_image_ctl_flow_1(void) */ static unsigned -check_cache_image_ctl_flow_2(void) +check_cache_image_ctl_flow_2(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_2()"; char filename[512]; @@ -1620,6 +1627,13 @@ check_cache_image_ctl_flow_2(void) TESTING("metadata cache image control flow test 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -1871,7 +1885,7 @@ check_cache_image_ctl_flow_2(void) */ static unsigned -check_cache_image_ctl_flow_3(void) +check_cache_image_ctl_flow_3(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_3()"; char filename[512]; @@ -1883,6 +1897,13 @@ check_cache_image_ctl_flow_3(void) TESTING("metadata cache image control flow test 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2242,7 +2263,7 @@ check_cache_image_ctl_flow_3(void) */ static unsigned -check_cache_image_ctl_flow_4(void) +check_cache_image_ctl_flow_4(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_4()"; char filename[512]; @@ -2254,6 +2275,13 @@ check_cache_image_ctl_flow_4(void) TESTING("metadata cache image control flow test 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2573,7 +2601,7 @@ check_cache_image_ctl_flow_4(void) */ static unsigned -check_cache_image_ctl_flow_5(void) +check_cache_image_ctl_flow_5(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_5()"; char filename[512]; @@ -2585,6 +2613,13 @@ check_cache_image_ctl_flow_5(void) TESTING("metadata cache image control flow test 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -2854,7 +2889,7 @@ check_cache_image_ctl_flow_5(void) */ static unsigned -check_cache_image_ctl_flow_6(void) +check_cache_image_ctl_flow_6(hbool_t single_file_vfd) { const char * fcn_name = "check_cache_image_ctl_flow_6()"; char filename[512]; @@ -2866,6 +2901,13 @@ check_cache_image_ctl_flow_6(void) TESTING("metadata cache image control flow test 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) /* 0 */ @@ -3139,7 +3181,7 @@ check_cache_image_ctl_flow_6(void) */ static unsigned -cache_image_smoke_check_1(void) +cache_image_smoke_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_1()"; char filename[512]; @@ -3151,6 +3193,13 @@ cache_image_smoke_check_1(void) TESTING("metadata cache image smoke check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3562,7 +3611,7 @@ cache_image_smoke_check_1(void) */ static unsigned -cache_image_smoke_check_2(void) +cache_image_smoke_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_2()"; char filename[512]; @@ -3574,6 +3623,13 @@ cache_image_smoke_check_2(void) TESTING("metadata cache image smoke check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -3863,7 +3919,7 @@ cache_image_smoke_check_2(void) */ static unsigned -cache_image_smoke_check_3(void) +cache_image_smoke_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_3()"; char filename[512]; @@ -3875,6 +3931,13 @@ cache_image_smoke_check_3(void) TESTING("metadata cache image smoke check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4248,7 +4311,7 @@ cache_image_smoke_check_3(void) */ static unsigned -cache_image_smoke_check_4(void) +cache_image_smoke_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_4()"; char filename[512]; @@ -4262,6 +4325,13 @@ cache_image_smoke_check_4(void) TESTING("metadata cache image smoke check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -4653,7 +4723,7 @@ cache_image_smoke_check_4(void) #define MAX_NUM_GROUPS 128 static unsigned -cache_image_smoke_check_5(void) +cache_image_smoke_check_5(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_5()"; char filename[512]; @@ -4670,6 +4740,13 @@ cache_image_smoke_check_5(void) TESTING("metadata cache image smoke check 5"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5168,7 +5245,7 @@ cache_image_smoke_check_5(void) */ static unsigned -cache_image_smoke_check_6(void) +cache_image_smoke_check_6(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_smoke_check_6()"; char filename[512]; @@ -5183,6 +5260,13 @@ cache_image_smoke_check_6(void) TESTING("metadata cache image smoke check 6"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5578,7 +5662,7 @@ cache_image_smoke_check_6(void) */ static unsigned -cache_image_api_error_check_1(void) +cache_image_api_error_check_1(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_1()"; char filename[512]; @@ -5590,6 +5674,13 @@ cache_image_api_error_check_1(void) TESTING("metadata cache image api error check 1"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -5954,7 +6045,7 @@ cache_image_api_error_check_1(void) */ static unsigned -cache_image_api_error_check_2(void) +cache_image_api_error_check_2(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_2()"; char filename[512]; @@ -5966,6 +6057,13 @@ cache_image_api_error_check_2(void) TESTING("metadata cache image api error check 2"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6365,7 +6463,7 @@ cache_image_api_error_check_2(void) */ static unsigned -cache_image_api_error_check_3(void) +cache_image_api_error_check_3(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_3()"; char filename[512]; @@ -6377,6 +6475,13 @@ cache_image_api_error_check_3(void) TESTING("metadata cache image api error check 3"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -6649,7 +6754,7 @@ cache_image_api_error_check_3(void) */ static unsigned -cache_image_api_error_check_4(void) +cache_image_api_error_check_4(hbool_t single_file_vfd) { const char * fcn_name = "cache_image_api_error_check_4()"; char filename[512]; @@ -6663,6 +6768,13 @@ cache_image_api_error_check_4(void) TESTING("metadata cache image api error check 4"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7238,7 +7350,7 @@ cache_image_api_error_check_4(void) *------------------------------------------------------------------------- */ static unsigned -get_free_sections_test(void) +get_free_sections_test(hbool_t single_file_vfd) { const char * fcn_name = "get_free_sections_test()"; char filename[512]; @@ -7251,6 +7363,13 @@ get_free_sections_test(void) TESTING("Cache image / H5Fget_free_sections() interaction"); + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -7710,7 +7829,7 @@ get_free_sections_test(void) *------------------------------------------------------------------------- */ static unsigned -evict_on_close_test(void) +evict_on_close_test(hbool_t single_file_vfd) { #ifndef H5_HAVE_PARALLEL const char * fcn_name = "evict_on_close_test()"; @@ -7731,6 +7850,13 @@ evict_on_close_test(void) return 0; #else + /* Check for VFD that is a single file */ + if(!single_file_vfd) { + SKIPPED(); + HDputs(" Cache image not supported with the current VFD."); + return 0; + } + pass = TRUE; if ( show_progress ) @@ -8041,9 +8167,16 @@ evict_on_close_test(void) int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ unsigned nerrs = 0; int express_test; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + H5open(); express_test = GetTestExpress(); @@ -8053,27 +8186,30 @@ main(void) printf(" express_test = %d\n", express_test); printf("=========================================\n"); - nerrs += check_cache_image_ctl_flow_1(); - nerrs += check_cache_image_ctl_flow_2(); - nerrs += check_cache_image_ctl_flow_3(); - nerrs += check_cache_image_ctl_flow_4(); - nerrs += check_cache_image_ctl_flow_5(); - nerrs += check_cache_image_ctl_flow_6(); - - nerrs += cache_image_smoke_check_1(); - nerrs += cache_image_smoke_check_2(); - nerrs += cache_image_smoke_check_3(); - nerrs += cache_image_smoke_check_4(); - nerrs += cache_image_smoke_check_5(); - nerrs += cache_image_smoke_check_6(); - - nerrs += cache_image_api_error_check_1(); - nerrs += cache_image_api_error_check_2(); - nerrs += cache_image_api_error_check_3(); - nerrs += cache_image_api_error_check_4(); - - nerrs += get_free_sections_test(); - nerrs += evict_on_close_test(); + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + + nerrs += check_cache_image_ctl_flow_1(single_file_vfd); + nerrs += check_cache_image_ctl_flow_2(single_file_vfd); + nerrs += check_cache_image_ctl_flow_3(single_file_vfd); + nerrs += check_cache_image_ctl_flow_4(single_file_vfd); + nerrs += check_cache_image_ctl_flow_5(single_file_vfd); + nerrs += check_cache_image_ctl_flow_6(single_file_vfd); + + nerrs += cache_image_smoke_check_1(single_file_vfd); + nerrs += cache_image_smoke_check_2(single_file_vfd); + nerrs += cache_image_smoke_check_3(single_file_vfd); + nerrs += cache_image_smoke_check_4(single_file_vfd); + nerrs += cache_image_smoke_check_5(single_file_vfd); + nerrs += cache_image_smoke_check_6(single_file_vfd); + + nerrs += cache_image_api_error_check_1(single_file_vfd); + nerrs += cache_image_api_error_check_2(single_file_vfd); + nerrs += cache_image_api_error_check_3(single_file_vfd); + nerrs += cache_image_api_error_check_4(single_file_vfd); + + nerrs += get_free_sections_test(single_file_vfd); + nerrs += evict_on_close_test(single_file_vfd); return(nerrs > 0); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 752dd27..b91f013 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -448,7 +448,7 @@ check_file_creation_tags(hid_t fcpl_id, int type) TESTING("tag application during file creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl)) < 0 ) TEST_ERROR; @@ -539,7 +539,7 @@ check_file_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -652,7 +652,7 @@ check_group_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -751,7 +751,7 @@ check_multi_group_creation_tags(void) TESTING("tag application during multiple group creation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Set latest version of library */ if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; @@ -881,7 +881,7 @@ check_link_iteration_tags(void) TESTING("tag application during iteration over links in a group"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* =========== */ /* Create File */ @@ -1000,7 +1000,7 @@ check_dense_attribute_tags(void) TESTING("tag application during dense attribute manipulation"); /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) TEST_ERROR; /* Create Dcpl */ @@ -1184,7 +1184,7 @@ check_group_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -1295,7 +1295,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1429,7 +1429,7 @@ check_attribute_open_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1576,7 +1576,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1761,7 +1761,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -1917,7 +1917,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2051,7 +2051,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2187,7 +2187,7 @@ check_dataset_open_tags(void) /* ========= */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2318,7 +2318,7 @@ check_dataset_write_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2457,7 +2457,7 @@ check_attribute_write_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -2613,7 +2613,7 @@ check_dataset_read_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2751,7 +2751,7 @@ check_dataset_size_retrieval(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -2890,7 +2890,7 @@ check_dataset_extend_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3017,7 +3017,7 @@ check_object_info_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3126,7 +3126,7 @@ check_object_copy_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3257,7 +3257,7 @@ check_link_removal_tags(hid_t fcpl, int type) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl)) < 0 ) TEST_ERROR; @@ -3416,7 +3416,7 @@ check_link_getname_tags(void) if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3553,7 +3553,7 @@ check_external_link_creation_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3660,7 +3660,7 @@ check_external_link_open_tags(void) /* ===== */ /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; @@ -3671,8 +3671,6 @@ check_external_link_open_tags(void) /* Create a second file */ if ( (fid2 = H5Fcreate(FILENAME2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; - if ( H5Pclose(fapl) < 0 ) TEST_ERROR; - /* determine tag value of root group's object header */ if ( get_object_header_tag(fid2, &root2_tag) < 0 ) TEST_ERROR; @@ -3688,7 +3686,9 @@ check_external_link_open_tags(void) /* Close and Reopen the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; - if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl)) < 0 ) TEST_ERROR; + + if ( H5Pclose(fapl) < 0 ) TEST_ERROR; /* Evict as much as we can from the cache so we can track full tag path */ if ( evict_entries(fid) < 0 ) TEST_ERROR; @@ -3787,7 +3787,7 @@ check_invalid_tag_application(void) #if H5C_DO_TAGGING_SANITY_CHECKS /* Create Fapl */ - if ( (fapl = h5_fileaccess()) < 0 ) TEST_ERROR; + if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; /* Create a test file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0 ) TEST_ERROR; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index b011bc2..a8baeac 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2070,7 +2070,7 @@ test_ooo_order(char *filename, hid_t fapl_id) /* Close and reopen the file */ if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR /* Open the type */ if((dtype_tmp = H5Topen2(file, "dtype", H5P_DEFAULT)) < 0) TEST_ERROR @@ -2123,7 +2123,7 @@ test_ooo_order(char *filename, hid_t fapl_id) if(H5Tclose(dtype_tmp)) TEST_ERROR if(H5Tclose(dtype)) TEST_ERROR if(H5Fclose(file)) TEST_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR /* Open the type, and verify status */ if((dtype_tmp = H5Topen2(file, "dtype2", H5P_DEFAULT)) < 0) TEST_ERROR @@ -20,6 +20,7 @@ #include "H5Fpkg.h" #include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" +#include "H5Pprivate.h" /* Property lists */ const char *FILENAME[] = { "efc0", @@ -2896,6 +2897,8 @@ int main(void) { unsigned nerrors = 0; /* track errors */ + H5P_genplist_t *plist; /* Property list pointer for FAPL */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ @@ -2917,6 +2920,15 @@ main(void) if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; + /* Get the VOL info from the fapl */ + plist = (H5P_genplist_t *)H5I_object(fapl_id); + H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop); + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + H5CX_set_vol_connector_prop(&connector_prop); + /* Test Functions */ nerrors += test_single(); nerrors += test_graph_nocycle(); diff --git a/test/h5test.c b/test/h5test.c index 32638e6..ea5e2f8 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -803,6 +803,50 @@ error: /*------------------------------------------------------------------------- + * Function: h5_fileaccess_flags + * + * Purpose: Returns a file access template which is the default template + * but with a file driver, VOL connector, or libver bound set + * according to a constant or environment variable + * + * Return: Success: A file access property list + * Failure: H5I_INVALID_HID + * + * Programmer: Robb Matzke + * Thursday, November 19, 1998 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_fileaccess_flags(unsigned flags) +{ + hid_t fapl_id = H5I_INVALID_HID; + + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto error; + + /* Attempt to set up a file driver first */ + if((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) + goto error; + + /* Next, try to set up a VOL connector */ + if((flags & H5_FILEACCESS_VOL) && h5_get_vol_fapl(fapl_id) < 0) + goto error; + + /* Finally, check for libver bounds */ + if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) + goto error; + + return fapl_id; + +error: + if(fapl_id != H5I_INVALID_HID) + H5Pclose(fapl_id); + return H5I_INVALID_HID; +} /* end h5_fileaccess_flags() */ + + +/*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * * Purpose: Sets the file driver for a FAPL according to the value specified diff --git a/test/h5test.h b/test/h5test.h index c72f389..5fca0c9 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -121,6 +121,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define ALARM_ON TestAlarmOn() #define ALARM_OFF HDalarm(0) +/* Flags for h5_fileaccess_flags() */ +#define H5_FILEACCESS_VFD 0x01 +#define H5_FILEACCESS_VOL 0x02 +#define H5_FILEACCESS_LIBVER 0x04 + #ifdef __cplusplus extern "C" { #endif @@ -132,6 +137,7 @@ H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, s H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL hid_t h5_fileaccess(void); +H5TEST_DLL hid_t h5_fileaccess_flags(unsigned flags); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); diff --git a/test/objcopy.c b/test/objcopy.c index 6ee2f72..eb4927f 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -7871,7 +7871,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open) addr_reset(); /* Setup */ - if((src_fapl = h5_fileaccess()) < 0) TEST_ERROR + if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_VOL | H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR /* open source file (read-only) */ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index 57edaf5..25413cb 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -850,7 +850,7 @@ test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dspace_id = H5Screate_simple(1, array_10, NULL); @@ -1081,10 +1081,10 @@ test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename_a, sizeof(filename_a)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL) TEST_ERROR - if(h5_fixname(FILENAME[2], H5P_DEFAULT, filename_b, sizeof(filename_b)) == NULL) + if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL) TEST_ERROR for (compact = 0; compact < 2; compact++) { /* 0 or 1 */ @@ -1244,7 +1244,7 @@ test_minimized_dset_ohdr_with_filter(hid_t fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); @@ -1383,7 +1383,7 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) * SETUP * *********/ - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE); @@ -1426,8 +1426,6 @@ test_minimized_dset_ohdr_modification_times(hid_t _fapl_id) if(fapl_id < 0) TEST_ERROR if(cases[i].oh_version > 1) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if(fapl_id < 0) TEST_ERROR ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_V110); if(ret < 0) TEST_ERROR } @@ -1534,7 +1532,10 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) TESTING("minimized dset object headers with fill values and different libver support"); - if(h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename)) == NULL) + fapl_id = H5Pcopy(_fapl_id); + if(fapl_id < 0) TEST_ERROR + + if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL) TEST_ERROR dspace_id = H5Screate_simple(1, extents, extents); @@ -1552,9 +1553,6 @@ test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id) ret = H5Pset_fill_value(dcpl_id, dtype_id, fill); if(ret == FAIL) TEST_ERROR; - fapl_id = H5Pcopy(_fapl_id); - if(fapl_id < 0) TEST_ERROR - ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST); if(ret == FAIL) TEST_ERROR; @@ -1678,6 +1676,8 @@ main(void) hid_t fapl = -1; hid_t file = -1; H5F_t *f = NULL; + const char *env_h5_drvr; /* File driver value from environment */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ H5O_loc_t oh_loc; /* Object header locations */ @@ -1688,6 +1688,14 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Check for VFD which stores data in multiple files */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + /* Reset library */ h5_reset(); fapl = h5_fileaccess(); @@ -1906,11 +1914,23 @@ main(void) * and the various "fail/mark if unknown" object header message flags */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); - if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID"); - if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) - TEST_ERROR + if(single_file_vfd) { + if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) + TEST_ERROR + } /* end if */ + else { + SKIPPED(); + HDputs(" Unknown header message test not supported with the current VFD."); + } /* end else */ /* Test object header creation metadata cache issues */ if(test_ohdr_cache(filename, fapl) < 0) diff --git a/test/tfile.c b/test/tfile.c index 5338c32..c5e913c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1595,16 +1595,18 @@ test_file_perm2(void) ** *****************************************************************/ static void -test_file_is_accessible(void) +test_file_is_accessible(const char *env_h5_drvr) { hid_t fid; /* File opened with read-write permission */ hid_t fcpl_id; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* POSIX file descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ htri_t status; /* Whether a file is an HDF5 file */ + hbool_t single_file_vfd; /* Whether VFD used is a single file */ herr_t ret; /* Output message about test being performed */ @@ -1613,9 +1615,10 @@ test_file_is_accessible(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Close file */ @@ -1623,53 +1626,60 @@ test_file_is_accessible(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); + status = H5Fis_accessible(filename, fapl); VERIFY(status, TRUE, "H5Fis_accessible"); - /* Create a file creation property list with a non-default user block size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl_id, FAIL, "H5Pcreate"); + /* This test is not currently working for the family VFD */ + if(0 != HDstrcmp(env_h5_drvr, "family")) { + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, FAIL, "H5Pcreate"); - ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); - CHECK(ret, FAIL, "H5Pset_userblock"); + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Create file with non-default user block */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl_id, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + /* Create file with non-default user block */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl); + CHECK(fid, FAIL, "H5Fcreate"); - /* Release file-creation property list */ - ret = H5Pclose(fcpl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file-creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Verify that the file is an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, TRUE, "H5Fis_accessible"); + /* Verify that the file is an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, TRUE, "H5Fis_accessible"); + } /* end if */ - /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, FAIL, "HDopen"); + /* This test only works for VFDs with a single file */ + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); + if(single_file_vfd) { + /* Create non-HDF5 file and check it */ + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, FAIL, "HDopen"); - /* Initialize information to write */ - for (u=0; u<1024; u++) - buf[u]=(unsigned char)u; + /* Initialize information to write */ + for (u=0; u<1024; u++) + buf[u]=(unsigned char)u; - /* Write some information */ - nbytes = HDwrite(fd, buf, (size_t)1024); - VERIFY(nbytes, 1024, "HDwrite"); + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); - /* Close the file */ - ret = HDclose(fd); - CHECK(ret, FAIL, "HDclose"); + /* Close the file */ + ret = HDclose(fd); + CHECK(ret, FAIL, "HDclose"); - /* Verify that the file is not an HDF5 file */ - status = H5Fis_accessible(FILE1, fapl); - VERIFY(status, FALSE, "H5Fis_accessible"); + /* Verify that the file is not an HDF5 file */ + status = H5Fis_accessible(filename, fapl); + VERIFY(status, FALSE, "H5Fis_accessible"); + } /* end if */ /* Close property list */ ret = H5Pclose(fapl); @@ -1693,6 +1703,7 @@ test_file_ishdf5(void) hid_t fcpl; /* File creation property list */ hid_t fapl = -1; /* File access property list */ int fd; /* File Descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ ssize_t nbytes; /* Number of bytes written */ unsigned u; /* Local index variable */ unsigned char buf[1024]; /* Buffer of data to write */ @@ -1705,9 +1716,10 @@ test_file_ishdf5(void) /* Get FAPL */ fapl = h5_fileaccess(); CHECK(fapl, FAIL, "H5Pcreate"); + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create a file */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Close file */ @@ -1715,7 +1727,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); @@ -1727,7 +1739,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Pset_userblock"); /* Create file with non-default user block */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); CHECK(file, FAIL, "H5Fcreate"); /* Release file-creation property list */ @@ -1739,12 +1751,12 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "H5Fclose"); /* Verify that the file is an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, TRUE, "H5Fis_hdf5"); /* Create non-HDF5 file and check it */ - fd = HDopen(FILE1, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); + fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW); CHECK(fd, FAIL, "HDopen"); /* Initialize information to write */ @@ -1760,7 +1772,7 @@ test_file_ishdf5(void) CHECK(ret, FAIL, "HDclose"); /* Verify that the file is not an HDF5 file */ - status = H5Fis_hdf5(FILE1); + status = H5Fis_hdf5(filename); VERIFY(status, FALSE, "H5Fis_hdf5"); /* Close property list */ @@ -2247,6 +2259,7 @@ test_file_double_file_dataset_open(hbool_t new_format) hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */ hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */ hsize_t size; /* File size */ + char filename[FILENAME_LEN]; /* Filename to use */ const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */ const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */ char* buffer[5]; /* Output buffer */ @@ -2263,9 +2276,10 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); } /* end if */ + h5_fixname(FILE1, fapl, filename, sizeof filename); /* Create the test file */ - fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create a chunked dataset with fixed array indexing */ @@ -2347,8 +2361,6 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Sclose"); ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -2357,7 +2369,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2372,7 +2384,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2413,11 +2425,11 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2478,7 +2490,7 @@ test_file_double_file_dataset_open(hbool_t new_format) */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2490,7 +2502,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(size, 0, "H5Dget_storage_size"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2523,7 +2535,7 @@ test_file_double_file_dataset_open(hbool_t new_format) * from second call to H5Dset_extent->...H5D__earray_idx_remove->H5EA_get...H5EA__iblock_protect...H5AC_protect */ /* First file open */ - fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* First file's dataset open */ @@ -2542,7 +2554,7 @@ test_file_double_file_dataset_open(hbool_t new_format) CHECK(ret, FAIL, "H5Dwrite"); /* Second file open */ - fid2 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); CHECK(fid2, FAIL, "H5Fopen"); /* Second file's dataset open */ @@ -2573,6 +2585,9 @@ test_file_double_file_dataset_open(hbool_t new_format) ret = H5Tclose(tid1); CHECK(ret, FAIL, "H5Tclose"); + /* Close FAPL */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); } /* end test_file_double_dataset_open() */ /**************************************************************** @@ -7500,6 +7515,7 @@ test_deprec(void) void test_file(void) { + hbool_t single_file_vfd; /* Whether VFD used is a single file */ const char *env_h5_drvr; /* File Driver value from environment */ /* Output message about test being performed */ @@ -7509,6 +7525,7 @@ test_file(void) env_h5_drvr = HDgetenv("HDF5_DRIVER"); if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); test_file_create(); /* Test file creation(also creation templates)*/ test_file_open(); /* Test file opening */ @@ -7518,7 +7535,7 @@ test_file(void) test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_is_accessible(); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ test_file_getname(); /* Test basic H5Fget_name() functionality */ @@ -7554,7 +7571,10 @@ test_file(void) test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + if(single_file_vfd) + test_file_ishdf5(); /* Test detecting HDF5 files correctly */ + else + MESSAGE(5, ("Skipping testing detection of HDF5 Files (using deprecated H5Fis_hdf5() call for non-single file VFDs)\n")); test_deprec(); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_file() */ @@ -20,8 +20,13 @@ #include "h5test.h" +/* Filename */ +/* (The file names are the same as the define in accum_swmr_reader.c) */ +const char *FILENAME[] = { + "native_vol_test", + NULL +}; -#define NATIVE_VOL_TEST_FILENAME "native_vol_test" #define NATIVE_VOL_TEST_GROUP_NAME "test_group" #define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" #define NATIVE_VOL_TEST_ATTRIBUTE_NAME "test_dataset" @@ -237,7 +242,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_file_operation(void) +test_basic_file_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; @@ -245,6 +250,7 @@ test_basic_file_operation(void) hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; + char filename[1024]; ssize_t obj_count; hid_t obj_id_list[1]; hsize_t file_size; @@ -257,6 +263,7 @@ test_basic_file_operation(void) /* Retrieve the file access property for testing */ fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); /* Set the file close degree to a non-default value, to make the H5Pequal * work out. This is kinda odd, but the library's current behavior with @@ -273,7 +280,7 @@ test_basic_file_operation(void) FAIL_STACK_ERROR /* H5Fcreate */ - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Fget_obj_count */ @@ -290,13 +297,16 @@ test_basic_file_operation(void) if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_create_plist */ if ((fcpl_id = H5Fget_create_plist(fid)) < 0) @@ -308,9 +318,12 @@ test_basic_file_operation(void) if (H5Fget_filesize(fid, &file_size) < 0) TEST_ERROR; - /* H5Fget_vfd_handle */ - if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) - TEST_ERROR; + /* Can't retrieve VFD handle for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_vfd_handle */ + if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + } /* end if */ /* H5Fget_intent */ if (H5Fget_intent(fid, &intent) < 0) @@ -337,43 +350,49 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fis_accessible */ - if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) + if (H5Fis_accessible(filename, fapl_id) < 0) TEST_ERROR; /* H5Fopen */ - if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; - /* H5Fget_access_plist */ - if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) - TEST_ERROR; - if (H5Pequal(fapl_id, fapl_id2) != TRUE) - TEST_ERROR; - if (H5Pclose(fapl_id2) < 0) - TEST_ERROR; + /* Can't compare VFD properties for split / multi / family VFDs */ + if((hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family"))) { + /* H5Fget_access_plist */ + if((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if(H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if(H5Pclose(fapl_id2) < 0) + TEST_ERROR; + } /* end if */ if (H5Fclose(fid) < 0) TEST_ERROR; if (H5Fclose(fid_reopen) < 0) TEST_ERROR; + h5_delete_test_file(FILENAME[0], fapl_id); + /* H5Pclose */ if (H5Pclose(fapl_id) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); - PASSED(); return SUCCEED; @@ -404,14 +423,20 @@ static herr_t test_basic_group_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t gid_a = H5I_INVALID_HID; hid_t gcpl_id = H5I_INVALID_HID; + char filename[1024]; H5G_info_t info; TESTING("Basic VOL group operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Gcreate */ @@ -465,7 +490,11 @@ test_basic_group_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -474,6 +503,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Gclose(gid); + H5Pclose(fapl_id); H5Pclose(gcpl_id); } H5E_END_TRY; @@ -495,6 +525,7 @@ static herr_t test_basic_dataset_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t dcpl_id = H5I_INVALID_HID; hid_t dapl_id = H5I_INVALID_HID; hid_t did = H5I_INVALID_HID; @@ -502,6 +533,8 @@ test_basic_dataset_operation(void) hid_t sid = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; + char filename[1024]; + hsize_t curr_dims = 0; hsize_t max_dims = H5S_UNLIMITED; @@ -516,7 +549,11 @@ test_basic_dataset_operation(void) TESTING("Basic VOL dataset operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; for (i = 0; i < N_ELEMENTS; i++) { in_buf[i] = i; @@ -630,7 +667,11 @@ test_basic_dataset_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -642,6 +683,7 @@ error: H5Dclose(did_a); H5Sclose(sid); H5Tclose(tid); + H5Pclose(fapl_id); H5Pclose(dapl_id); H5Pclose(dcpl_id); } H5E_END_TRY; @@ -664,11 +706,14 @@ static herr_t test_basic_attribute_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t aid = H5I_INVALID_HID; hid_t aid_name = H5I_INVALID_HID; hid_t sid = H5I_INVALID_HID; + char filename[1024]; + hsize_t dims = 1; int data_in = 42; @@ -676,7 +721,11 @@ test_basic_attribute_operation(void) TESTING("Basic VOL attribute operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -730,7 +779,11 @@ test_basic_attribute_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -738,6 +791,7 @@ test_basic_attribute_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); H5Sclose(sid); H5Aclose(aid); @@ -762,14 +816,20 @@ static herr_t test_basic_object_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; hid_t oid = H5I_INVALID_HID; + char filename[1024]; H5O_info_t object_info; TESTING("Basic VOL object operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -797,7 +857,12 @@ test_basic_object_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -805,6 +870,7 @@ test_basic_object_operation(void) error: H5E_BEGIN_TRY { H5Fclose(fid); + H5Pclose(fapl_id); H5Gclose(gid); } H5E_END_TRY; @@ -827,10 +893,16 @@ test_basic_link_operation(void) { hid_t fid = H5I_INVALID_HID; hid_t gid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL link operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((gid = H5Gcreate2(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -862,7 +934,12 @@ test_basic_link_operation(void) if (H5Gclose(gid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + PASSED(); return SUCCEED; @@ -871,6 +948,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); H5Fclose(gid); + H5Pclose(fapl_id); } H5E_END_TRY; return FAIL; @@ -891,13 +969,19 @@ static herr_t test_basic_datatype_operation(void) { hid_t fid = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; hid_t tid = H5I_INVALID_HID; hid_t tid_anon = H5I_INVALID_HID; hid_t tcpl_id = H5I_INVALID_HID; + char filename[1024]; TESTING("Basic VOL datatype operations"); - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR; @@ -941,7 +1025,11 @@ test_basic_datatype_operation(void) if (H5Fclose(fid) < 0) TEST_ERROR; - HDremove(NATIVE_VOL_TEST_FILENAME); + h5_delete_test_file(FILENAME[0], fapl_id); + + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; PASSED(); return SUCCEED; @@ -950,6 +1038,7 @@ error: H5E_BEGIN_TRY { H5Pclose(tcpl_id); H5Fclose(fid); + H5Pclose(fapl_id); H5Tclose(tid); H5Tclose(tid_anon); } H5E_END_TRY; @@ -958,34 +1047,6 @@ error: } /* end test_basic_datatype_operation() */ -#if 0 - -/*------------------------------------------------------------------------- - * Function: test_echo_vol_operation() - * - * Purpose: Uses the echo VOL connector to test basic VOL operations - * via the H5VL public API. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -test_echo_vol_operation(void) -{ - char name[25]; - - TESTING("Echo VOL operations"); - - PASSED(); - return SUCCEED; - -error: - return FAIL; - -} /* end test_basic_vol_operation() */ -#endif - /*------------------------------------------------------------------------- * Function: main @@ -999,15 +1060,21 @@ error: int main(void) { + const char *env_h5_drvr; /* File driver value from environment */ int nerrors = 0; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv("HDF5_DRIVER"); + if(env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + h5_reset(); HDputs("Testing basic Virtual Object Layer (VOL) functionality."); nerrors += test_vol_registration() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; - nerrors += test_basic_file_operation() < 0 ? 1 : 0; + nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; |