summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/doc_src_examples_activeqt_menus.qdoc
blob: 18849dde067dd99618d76da2f99954ab6606ed00 (plain)
1
2
3
4
5
6
//! [0]
<object ID="QMenus" CLASSID="CLSID:4dc3f340-a6f7-44e4-a79b-3e9217695fbd"
CODEBASE="http://qtsoftware.com/demos/menusax.cab">
[Object not available! Did you forget to build and register the server?]
</object>
//! [0]
* Programmer: Quincey Koziol + * Tuesday, October 14, 2008 + * + *------------------------------------------------------------------------- + */ +static unsigned +gen_l4_btree2(const char *filename, hid_t fapl, haddr_t *bt2_addr, + const hsize_t *records) +{ + hid_t file = -1; + H5F_t *f = NULL; + hsize_t record; /* Record to insert into tree */ + unsigned u; /* Local index variable */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + STACK_ERROR + + /* + * Create v2 B-tree + */ + if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, bt2_addr/*out*/) < 0) + FAIL_STACK_ERROR + + /* Insert random records */ + for(u = 0; u < INSERT_MANY; u++) { + record = records[u]; + if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, *bt2_addr, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, *bt2_addr, &bt2_stat) < 0) + FAIL_STACK_ERROR + if(bt2_stat.depth != 4) + TEST_ERROR + + /* Close file */ + if(H5Fclose(file) < 0) + STACK_ERROR + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + + return 1; +} /* gen_l4_btree2() */ + + +/*------------------------------------------------------------------------- * Function: test_remove_lots * * Purpose: Basic tests for the B-tree v2 code. This test inserts many @@ -6344,7 +6409,7 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_remove_lots(hid_t fapl) +test_remove_lots(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; char filename[1024]; @@ -6360,8 +6425,8 @@ test_remove_lots(hid_t fapl) hsize_t *records; /* Record #'s for random insertion */ unsigned u; /* Local index variable */ unsigned rem_idx; /* Location to remove */ - H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t nrec; /* Number of records in B-tree */ + hbool_t single_file_vfd; /* Whether VFD used stores data in a single file */ /* Initialize random number seed */ curr_time = HDtime(NULL); @@ -6396,62 +6461,36 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Create the file to work on */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - STACK_ERROR - - /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) - STACK_ERROR - - /* - * Create v2 B-tree - */ - if(H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/) < 0) - FAIL_STACK_ERROR - - /* Insert random records */ - for(u = 0; u < INSERT_MANY; u++) { - record = records[u]; - if(H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record) < 0) - FAIL_STACK_ERROR - } /* end for */ - - /* Check up on B-tree */ - if(H5B2_stat_info(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &bt2_stat) < 0) - FAIL_STACK_ERROR - if(bt2_stat.depth != 4) + /* Generate the v2 B-tree to test */ + if(gen_l4_btree2(filename, fapl, &bt2_addr, records)) TEST_ERROR - /* Close file */ - if(H5Fclose(file) < 0) - STACK_ERROR - + /* 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")); + if(single_file_vfd) { + /* Make a copy of the file in memory, in order to speed up deletion testing */ - /* Make a copy of the file in memory, in order to speed up deletion testing */ - - /* Open the file just created */ - if((fd = HDopen(filename, O_RDONLY, 0)) < 0) - TEST_ERROR - - /* Retrieve the file's size */ - if(HDfstat(fd, &sb) < 0) - TEST_ERROR - - /* Allocate space for the file data */ - if(NULL == (file_data = HDmalloc((size_t)sb.st_size))) - TEST_ERROR + /* Open the file just created */ + if((fd = HDopen(filename, O_RDONLY, 0)) < 0) + TEST_ERROR - /* Read file's data into memory */ - if(HDread(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) - TEST_ERROR + /* Retrieve the file's size */ + if(HDfstat(fd, &sb) < 0) + TEST_ERROR - /* Close the file */ - if(HDclose(fd) < 0) - TEST_ERROR - fd = -1; + /* Allocate space for the file data */ + if(NULL == (file_data = HDmalloc((size_t)sb.st_size))) + TEST_ERROR + /* Read file's data into memory */ + if(HDread(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) + TEST_ERROR + /* Close the file */ + if(HDclose(fd) < 0) + TEST_ERROR + fd = -1; + } /* end if */ /* Print banner for this test */ TESTING("B-tree remove: create random level 4 B-tree and delete all records in random order"); @@ -6511,21 +6550,28 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); - /* Re-write the file's data with the copy in memory */ + /* Check for VFD which stores data in multiple files */ + if(single_file_vfd) { + /* Re-write the file's data with the copy in memory */ - /* Open the file just created */ - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - TEST_ERROR - - /* Write file's data from memory */ - if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) - TEST_ERROR + /* Open the file just created */ + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR - /* Close the file */ - if(HDclose(fd) < 0) - TEST_ERROR - fd = -1; + /* Write file's data from memory */ + if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) + TEST_ERROR + /* Close the file */ + if(HDclose(fd) < 0) + TEST_ERROR + fd = -1; + } /* end if */ + else { + /* Re-generate the v2 B-tree to test */ + if(gen_l4_btree2(filename, fapl, &bt2_addr, records)) + TEST_ERROR + } /* end else */ /* Print banner for this test */ @@ -6578,20 +6624,28 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); - /* Re-write the file's data with the copy in memory */ + /* Check for VFD which stores data in multiple files */ + if(single_file_vfd) { + /* Re-write the file's data with the copy in memory */ - /* Open the file just created */ - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - TEST_ERROR + /* Open the file just created */ + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR - /* Write file's data from memory */ - if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) - TEST_ERROR + /* Write file's data from memory */ + if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) + TEST_ERROR - /* Close the file */ - if(HDclose(fd) < 0) - TEST_ERROR - fd = -1; + /* Close the file */ + if(HDclose(fd) < 0) + TEST_ERROR + fd = -1; + } /* end if */ + else { + /* Re-generate the v2 B-tree to test */ + if(gen_l4_btree2(filename, fapl, &bt2_addr, records)) + TEST_ERROR + } /* end else */ @@ -6642,20 +6696,28 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); - /* Re-write the file's data with the copy in memory */ + /* Check for VFD which stores data in multiple files */ + if(single_file_vfd) { + /* Re-write the file's data with the copy in memory */ - /* Open the file just created */ - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - TEST_ERROR + /* Open the file just created */ + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR - /* Write file's data from memory */ - if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) - TEST_ERROR + /* Write file's data from memory */ + if(HDwrite(fd, file_data, (size_t)sb.st_size) < (ssize_t)sb.st_size) + TEST_ERROR - /* Close the file */ - if(HDclose(fd) < 0) - TEST_ERROR - fd = -1; + /* Close the file */ + if(HDclose(fd) < 0) + TEST_ERROR + fd = -1; + } /* end if */ + else { + /* Re-generate the v2 B-tree to test */ + if(gen_l4_btree2(filename, fapl, &bt2_addr, records)) + TEST_ERROR + } /* end else */ @@ -6704,8 +6766,10 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); PASSED(); - HDfree(records); - HDfree(file_data); + if(records) + HDfree(records); + if(file_data) + HDfree(file_data); return 0; @@ -6716,8 +6780,10 @@ error: if(fd > 0) HDclose(fd); - HDfree(records); - HDfree(file_data); + if(records) + HDfree(records); + if(file_data) + HDfree(file_data); return 1; } /* test_remove_lots() */ @@ -7432,79 +7498,76 @@ main(void) envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - /* Reset library */ - h5_reset(); - fapl = h5_fileaccess(); - ExpressMode = GetTestExpress(); - if (ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); - - /* Test B-tree record insertion */ - /* Iteration, find & index routines tested in these routines as well */ - nerrors += test_insert_basic(fapl); - nerrors += test_insert_split_root(fapl); - nerrors += test_insert_level1_2leaf_redistrib(fapl); - nerrors += test_insert_level1_side_split(fapl); - nerrors += test_insert_level1_3leaf_redistrib(fapl); - nerrors += test_insert_level1_middle_split(fapl); - nerrors += test_insert_make_level2(fapl); - nerrors += test_insert_level2_leaf_redistrib(fapl); - nerrors += test_insert_level2_leaf_split(fapl); - nerrors += test_insert_level2_2internal_redistrib(fapl); - nerrors += test_insert_level2_2internal_split(fapl); - nerrors += test_insert_level2_3internal_redistrib(fapl); - nerrors += test_insert_level2_3internal_split(fapl); - if (ExpressMode > 1) - printf("***Express test mode on. test_insert_lots skipped\n"); - else - nerrors += test_insert_lots(fapl); - - /* Test B-tree record removal */ - /* Querying the number of records routine also tested in these routines as well */ - nerrors += test_remove_basic(fapl); - nerrors += test_remove_level1_noredistrib(fapl); - nerrors += test_remove_level1_redistrib(fapl); - nerrors += test_remove_level1_2leaf_merge(fapl); - nerrors += test_remove_level1_3leaf_merge(fapl); - nerrors += test_remove_level1_promote(fapl); - nerrors += test_remove_level1_promote_2leaf_redistrib(fapl); - nerrors += test_remove_level1_promote_3leaf_redistrib(fapl); - nerrors += test_remove_level1_promote_2leaf_merge(fapl); - nerrors += test_remove_level1_promote_3leaf_merge(fapl); - nerrors += test_remove_level1_collapse(fapl); - nerrors += test_remove_level2_promote(fapl); - nerrors += test_remove_level2_promote_2internal_redistrib(fapl); - nerrors += test_remove_level2_promote_3internal_redistrib(fapl); - nerrors += test_remove_level2_promote_2internal_merge(fapl); - nerrors += test_remove_level2_promote_3internal_merge(fapl); - nerrors += test_remove_level2_2internal_merge_left(fapl); - nerrors += test_remove_level2_2internal_merge_right(fapl); - nerrors += test_remove_level2_3internal_merge(fapl); - nerrors += test_remove_level2_collapse_right(fapl); - if (ExpressMode > 1) - printf("***Express test mode on. test_remove_lots skipped\n"); - else - nerrors += test_remove_lots(fapl); - - /* Test more complex B-tree queries */ - nerrors += test_find_neighbor(fapl); - - /* Test deleting B-trees */ - nerrors += test_delete(fapl); - - /* Test modifying B-tree records */ - nerrors += test_modify(fapl); - - if(nerrors) - goto error; - - puts("All v2 B-tree tests passed."); - - h5_cleanup(FILENAME, fapl); - } /* end if */ + + /* Reset library */ + h5_reset(); + fapl = h5_fileaccess(); + ExpressMode = GetTestExpress(); + if (ExpressMode > 1) + printf("***Express test mode on. Some tests may be skipped\n"); + + /* Test B-tree record insertion */ + /* Iteration, find & index routines tested in these routines as well */ + nerrors += test_insert_basic(fapl); + nerrors += test_insert_split_root(fapl); + nerrors += test_insert_level1_2leaf_redistrib(fapl); + nerrors += test_insert_level1_side_split(fapl); + nerrors += test_insert_level1_3leaf_redistrib(fapl); + nerrors += test_insert_level1_middle_split(fapl); + nerrors += test_insert_make_level2(fapl); + nerrors += test_insert_level2_leaf_redistrib(fapl); + nerrors += test_insert_level2_leaf_split(fapl); + nerrors += test_insert_level2_2internal_redistrib(fapl); + nerrors += test_insert_level2_2internal_split(fapl); + nerrors += test_insert_level2_3internal_redistrib(fapl); + nerrors += test_insert_level2_3internal_split(fapl); + if (ExpressMode > 1) + printf("***Express test mode on. test_insert_lots skipped\n"); + else + nerrors += test_insert_lots(fapl); + + /* Test B-tree record removal */ + /* Querying the number of records routine also tested in these routines as well */ + nerrors += test_remove_basic(fapl); + nerrors += test_remove_level1_noredistrib(fapl); + nerrors += test_remove_level1_redistrib(fapl); + nerrors += test_remove_level1_2leaf_merge(fapl); + nerrors += test_remove_level1_3leaf_merge(fapl); + nerrors += test_remove_level1_promote(fapl); + nerrors += test_remove_level1_promote_2leaf_redistrib(fapl); + nerrors += test_remove_level1_promote_3leaf_redistrib(fapl); + nerrors += test_remove_level1_promote_2leaf_merge(fapl); + nerrors += test_remove_level1_promote_3leaf_merge(fapl); + nerrors += test_remove_level1_collapse(fapl); + nerrors += test_remove_level2_promote(fapl); + nerrors += test_remove_level2_promote_2internal_redistrib(fapl); + nerrors += test_remove_level2_promote_3internal_redistrib(fapl); + nerrors += test_remove_level2_promote_2internal_merge(fapl); + nerrors += test_remove_level2_promote_3internal_merge(fapl); + nerrors += test_remove_level2_2internal_merge_left(fapl); + nerrors += test_remove_level2_2internal_merge_right(fapl); + nerrors += test_remove_level2_3internal_merge(fapl); + nerrors += test_remove_level2_collapse_right(fapl); + if (ExpressMode > 1) + printf("***Express test mode on. test_remove_lots skipped\n"); else - puts("All v2 B-tree tests skipped - Incompatible with current Virtual File Driver"); + nerrors += test_remove_lots(envval, fapl); + + /* Test more complex B-tree queries */ + nerrors += test_find_neighbor(fapl); + + /* Test deleting B-trees */ + nerrors += test_delete(fapl); + + /* Test modifying B-tree records */ + nerrors += test_modify(fapl); + + if(nerrors) + goto error; + + puts("All v2 B-tree tests passed."); + + h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/dsets.c b/test/dsets.c index 1121f76..681f6ec 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -355,7 +355,7 @@ test_create(hid_t file) *------------------------------------------------------------------------- */ static herr_t -test_simple_io(hid_t fapl) +test_simple_io(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t file, dataset, space, xfer; @@ -368,83 +368,91 @@ test_simple_io(hid_t fapl) TESTING("simple I/O"); - h5_fixname(FILENAME[4], fapl, filename, sizeof filename); + /* Can't run this test with multi-file VFDs */ + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + h5_fixname(FILENAME[4], fapl, filename, sizeof filename); - /* Initialize the dataset */ - for(i = n = 0; i < DSET_DIM1; i++) - for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + /* Initialize the dataset */ + for(i = n = 0; i < DSET_DIM1; i++) + for(j = 0; j < DSET_DIM2; j++) + points[i][j] = n++; - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; - /* Create the data space */ - dims[0] = DSET_DIM1; - dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + /* Create the data space */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; - /* Create a small conversion buffer to test strip mining */ - tconv_buf = HDmalloc((size_t)1000); - xfer = H5Pcreate(H5P_DATASET_XFER); - assert(xfer>=0); - if(H5Pset_buffer (xfer, (size_t)1000, tconv_buf, NULL) < 0) goto error; + /* Create a small conversion buffer to test strip mining */ + tconv_buf = HDmalloc((size_t)1000); + xfer = H5Pcreate(H5P_DATASET_XFER); + assert(xfer>=0); + if(H5Pset_buffer (xfer, (size_t)1000, tconv_buf, NULL) < 0) goto error; - /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + /* Create the dataset */ + if((dataset = H5Dcreate2(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - /* Test dataset address. Should be undefined. */ - if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error; + /* Test dataset address. Should be undefined. */ + if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error; - /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0) - goto error; + /* Write the data to the dataset */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0) + goto error; - /* Test dataset address in file. Open the same file as a C file, seek - * the data position as H5Dget_offset points to, read the dataset, and - * compare it with the data written in.*/ - if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error; + /* Test dataset address in file. Open the same file as a C file, seek + * the data position as H5Dget_offset points to, read the dataset, and + * compare it with the data written in.*/ + if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error; - /* Read the dataset back */ - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0) - goto error; + /* Read the dataset back */ + if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0) + goto error; - /* Check that the values read are the same as the values written */ - for(i = 0; i < DSET_DIM1; i++) { - for(j = 0; j < DSET_DIM2; j++) { - if(points[i][j] != check[i][j]) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - goto error; - } - } - } + /* Check that the values read are the same as the values written */ + for(i = 0; i < DSET_DIM1; i++) { + for(j = 0; j < DSET_DIM2; j++) { + if(points[i][j] != check[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d,%d\n", i, j); + goto error; + } + } + } - if(H5Pclose (xfer) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; - if(H5Fclose(file) < 0) goto error; + if(H5Pclose (xfer) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; - f = HDopen(filename, O_RDONLY, 0); - HDlseek(f, (off_t)offset, SEEK_SET); - HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); + f = HDopen(filename, O_RDONLY, 0); + HDlseek(f, (off_t)offset, SEEK_SET); + HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); - /* Check that the values read are the same as the values written */ - for(i = 0; i < DSET_DIM1; i++) { - for(j = 0; j < DSET_DIM2; j++) { - if(points[i][j] != rdata[i][j]) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - goto error; - } - } - } + /* Check that the values read are the same as the values written */ + for(i = 0; i < DSET_DIM1; i++) { + for(j = 0; j < DSET_DIM2; j++) { + if(points[i][j] != rdata[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d,%d\n", i, j); + goto error; + } + } + } - HDclose(f); + HDclose(f); + + free (tconv_buf); + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); + } /* end else */ - free (tconv_buf); - PASSED(); return 0; error: @@ -469,7 +477,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_userblock_offset(hid_t fapl) +test_userblock_offset(const char *env_h5_drvr, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t file, fcpl, dataset, space; @@ -481,54 +489,62 @@ test_userblock_offset(hid_t fapl) TESTING("dataset offset with user block"); - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + /* Can't run this test with multi-file VFDs */ + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; - if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error; + if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; + if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error; - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - goto error; + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + goto error; - /* Create the data space */ - dims[0] = DSET_DIM1; - dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + /* Create the data space */ + dims[0] = DSET_DIM1; + dims[1] = DSET_DIM2; + if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; - /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + /* Create the dataset */ + if((dataset = H5Dcreate2(file, DSET_USERBLOCK_IO_NAME, H5T_NATIVE_INT, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - goto error; + /* Write the data to the dataset */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + goto error; - /* Test dataset address in file. Open the same file as a C file, seek - * the data position as H5Dget_offset points to, read the dataset, and - * compare it with the data written in.*/ - if((offset = H5Dget_offset(dataset)) == HADDR_UNDEF) goto error; + /* Test dataset address in file. Open the same file as a C file, seek + * the data position as H5Dget_offset points to, read the dataset, and + * compare it with the data written in.*/ + if((offset = H5Dget_offset(dataset)) == HADDR_UNDEF) goto error; - if(H5Dclose(dataset) < 0) goto error; - if(H5Fclose(file) < 0) goto error; + if(H5Dclose(dataset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; - f = HDopen(filename, O_RDONLY, 0); - HDlseek(f, (off_t)offset, SEEK_SET); - HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); + f = HDopen(filename, O_RDONLY, 0); + HDlseek(f, (off_t)offset, SEEK_SET); + HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2); - /* Check that the values read are the same as the values written */ - for(i = 0; i < DSET_DIM1; i++) { - for(j = 0; j < DSET_DIM2; j++) { - if(points[i][j] != rdata[i][j]) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - goto error; - } - } - } + /* Check that the values read are the same as the values written */ + for(i = 0; i < DSET_DIM1; i++) { + for(j = 0; j < DSET_DIM2; j++) { + if(points[i][j] != rdata[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d,%d\n", i, j); + goto error; + } + } + } - HDclose(f); + HDclose(f); + + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); + } /* end else */ - PASSED(); return 0; error: @@ -1662,7 +1678,7 @@ error: */ #ifdef H5_HAVE_FILTER_SZIP static herr_t -test_filter_noencoder(const char *dset_name, hid_t fapl) +test_filter_noencoder(const char *dset_name) { hid_t file_id = -1; hid_t dset_id = -1; @@ -1687,7 +1703,7 @@ test_filter_noencoder(const char *dset_name, hid_t fapl) } HDstrcat(testfile, NOENCODER_FILENAME); - file_id = H5Fopen(testfile, H5F_ACC_RDWR, fapl); + file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); if(file_id < 0) goto error; dset_id = H5Dopen2(file_id, dset_name, H5P_DEFAULT); @@ -2017,7 +2033,7 @@ UNUSED if( h5_szip_can_encode() != 1) { puts(""); - if(test_filter_noencoder(NOENCODER_SZIP_DATASET, fapl) < 0) goto error; + if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; } else { SKIPPED(); } @@ -2112,7 +2128,7 @@ UNUSED if( h5_szip_can_encode() != 1) { puts(""); - if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET,fapl) < 0) goto error; + if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error; } else { SKIPPED(); } @@ -5729,76 +5745,48 @@ test_filters_endianess(hid_t fapl) #if defined H5_HAVE_FILTER_FLETCHER32 /*------------------------------------------------------------------------- - * step1: create a file - *------------------------------------------------------------------------- - */ - /* create a file using default properties */ - if((fid = H5Fcreate("test_filters.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - - /* create a data space */ - if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto error; - - /* create dcpl */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk(dcpl,rank,chunk_dims) < 0) goto error; - - if(H5Pset_fletcher32 (dcpl) < 0) goto error; - - /* create a dataset */ - if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; - - if(H5Dwrite(dsid,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) - goto error; - - /* close */ - if(H5Pclose (dcpl) < 0) goto error; - if(H5Dclose (dsid) < 0) goto error; - if(H5Sclose (sid) < 0) goto error; - if(H5Fclose (fid) < 0) goto error; - - /*------------------------------------------------------------------------- - * step 2: open a file written on a little-endian machine in step 1 + * step 1: open a file written on a little-endian machine *------------------------------------------------------------------------- */ /* compose the name of the file to open, using the srcdir, if appropriate */ HDstrcpy(data_file, ""); - if( srcdir ) { + if(srcdir) { HDstrcpy(data_file, srcdir); HDstrcat(data_file, "/"); } - strcat( data_file, "test_filters_le.hdf5"); + HDstrcat(data_file, "test_filters_le.hdf5"); /* open */ - if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; + if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* read */ - if(auxread_fdata(fid,"dset") < 0) goto error; + if(auxread_fdata(fid,"dset") < 0) TEST_ERROR /* close */ - if(H5Fclose(fid) < 0) goto error; + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /*------------------------------------------------------------------------- - * step 3: open a file written on a big-endian machine in step 1 + * step 2: open a file written on a big-endian machine *------------------------------------------------------------------------- */ /* compose the name of the file to open, using the srcdir, if appropriate */ HDstrcpy(data_file, ""); - if( srcdir ) { + if(srcdir) { HDstrcpy(data_file, srcdir); HDstrcat(data_file, "/"); } - HDstrcat( data_file, "test_filters_be.hdf5"); + HDstrcat(data_file, "test_filters_be.hdf5"); /* open */ - if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto error; + if((fid = H5Fopen(data_file, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* read */ - if(auxread_fdata(fid,"dset") < 0) goto error; + if(auxread_fdata(fid,"dset") < 0) TEST_ERROR /* close */ - if(H5Fclose(fid) < 0) goto error; + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); #else @@ -6036,8 +6024,8 @@ test_random_chunks(hid_t fapl) } while (check2[chunk_row][chunk_col]); wbuf[i] = check2[chunk_row][chunk_col] = chunk_row+chunk_col+1; - coord[i][0] = chunk_row * csize[0]; - coord[i][1] = chunk_col * csize[1]; + coord[i][0] = (hsize_t)chunk_row * csize[0]; + coord[i][1] = (hsize_t)chunk_col * csize[1]; } /* Create dataspace for write buffer */ @@ -6126,8 +6114,8 @@ test_random_chunks(hid_t fapl) } while (check2[chunk_row][chunk_col]); wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1; - coord[i][0] = chunk_row * csize[0]; - coord[i][1] = chunk_col * csize[1]; + coord[i][0] = (hsize_t)chunk_row * csize[0]; + coord[i][1] = (hsize_t)chunk_col * csize[1]; } /* Create dataspace for write buffer */ @@ -6504,6 +6492,13 @@ error: int main(void) { + char filename[FILENAME_BUF_SIZE]; + hid_t file, grp, fapl, fapl2; + hbool_t new_format; + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; int nerrors = 0; const char *envval; @@ -6511,116 +6506,105 @@ main(void) envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - char filename[FILENAME_BUF_SIZE]; - hid_t file, grp, fapl, fapl2; - hbool_t new_format; - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - /* Set the random # seed */ - HDsrandom((unsigned long)HDtime(NULL)); - - /* Testing setup */ - h5_reset(); - fapl = h5_fileaccess(); - - /* Turn off the chunk cache, so all the chunks are immediately written to disk */ - if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - goto error; - rdcc_nbytes = 0; - if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - goto error; - /* Copy the file access property list */ - if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR + /* Set the random # seed */ + HDsrandom((unsigned long)HDtime(NULL)); - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + /* Testing setup */ + h5_reset(); + fapl = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Turn off the chunk cache, so all the chunks are immediately written to disk */ + if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) + goto error; + rdcc_nbytes = 0; + if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) + goto error; - /* Test with old & new format groups */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Set the FAPL for the type of format */ - if(new_format) { - puts("\nTesting with new file format:"); - my_fapl = fapl2; - } /* end if */ - else { - puts("Testing with old file format:"); - my_fapl = fapl; - } /* end else */ + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - /* Create the file for this test */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - goto error; + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Cause the library to emit initial messages */ - if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0) - goto error; - if(H5Gclose(grp) < 0) - goto error; + /* Test with old & new format groups */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - nerrors += (test_create(file) < 0 ? 1 : 0); - nerrors += (test_simple_io(my_fapl) < 0 ? 1 : 0); - nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); - nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); - nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); - nerrors += (test_tconv(file) < 0 ? 1 : 0); - nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); - nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int(file) < 0 ? 1 : 0); - nerrors += (test_nbit_float(file) < 0 ? 1 : 0); - nerrors += (test_nbit_double(file) < 0 ? 1 : 0); - nerrors += (test_nbit_array(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); - nerrors += (test_multiopen (file) < 0 ? 1 : 0); - nerrors += (test_types(file) < 0 ? 1 : 0); - nerrors += (test_userblock_offset(my_fapl) < 0 ? 1 : 0); - nerrors += (test_missing_filter(file) < 0 ? 1 : 0); - nerrors += (test_can_apply(file) < 0 ? 1 : 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); - nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); - nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess(my_fapl) < 0 ? 1 : 0); - nerrors += (test_zero_dims(file) < 0 ? 1 : 0); - nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); - nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); + /* Set the FAPL for the type of format */ + if(new_format) { + puts("\nTesting with new file format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old file format:"); + my_fapl = fapl; + } /* end else */ + + /* Create the file for this test */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + goto error; + + /* Cause the library to emit initial messages */ + if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0) + goto error; + if(H5Gclose(grp) < 0) + goto error; + + nerrors += (test_create(file) < 0 ? 1 : 0); + nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_tconv(file) < 0 ? 1 : 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_filter_delete(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess(my_fapl) < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); + nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += (test_deprec(file) < 0 ? 1 : 0); + nerrors += (test_deprec(file) < 0 ? 1 : 0); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); + nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); - if(H5Fclose(file) < 0) - goto error; - } /* end for */ + if(H5Fclose(file) < 0) + goto error; + } /* end for */ - /* Close 2nd FAPL */ - H5Pclose(fapl2); + /* Close 2nd FAPL */ + H5Pclose(fapl2); - if(nerrors) - goto error; - printf("All dataset tests passed.\n"); - h5_cleanup(FILENAME, fapl); - } /* end if */ - else - puts("All dataset tests skipped - Incompatible with current Virtual File Driver"); + if(nerrors) + goto error; + printf("All dataset tests passed.\n"); + h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/enum.c b/test/enum.c index 3196195..91a3790 100644 --- a/test/enum.c +++ b/test/enum.c @@ -211,58 +211,48 @@ test_tr1(hid_t file) static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED}; c_e1 data2[10]; - const char *envval = NULL; TESTING("O(1) conversions"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split")) { - if((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0) FAIL_STACK_ERROR - - - if((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0) FAIL_STACK_ERROR - - if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR - if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR - - for(i = 0; i < (size_t)ds_size[0]; i++) - if(data1[i] != data2[i]) { - H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", - (unsigned long)i, (int)(data1[i]), - (unsigned long)i, (int)(data2[i])); - goto error; - } - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR - if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR - if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR - - PASSED(); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } + if((cwg = H5Gcreate2(file, "test_tr1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "RED", CPTR(eval, E1_RED )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "GREEN", CPTR(eval, E1_GREEN)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLUE", CPTR(eval, E1_BLUE )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "WHITE", CPTR(eval, E1_WHITE)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLACK", CPTR(eval, E1_BLACK)) < 0) FAIL_STACK_ERROR + + + if((f_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "RED", CPTR(ival, 105)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "GREEN", CPTR(ival, 104)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLUE", CPTR(ival, 103)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "WHITE", CPTR(ival, 102)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLACK", CPTR(ival, 101)) < 0) FAIL_STACK_ERROR + + if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR + if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if(data1[i] != data2[i]) { + H5_FAILED(); + printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data2[i])); + goto error; + } + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR + if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR + if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; error: @@ -304,56 +294,47 @@ test_tr2(hid_t file) static c_e1 data1[10] = {E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE, E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED}; c_e1 data2[10]; - const char *envval = NULL; TESTING("O(log N) converions"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split")) { - if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE )) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0) FAIL_STACK_ERROR - - if((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0) FAIL_STACK_ERROR - if(H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0) FAIL_STACK_ERROR - - if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR - if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR - if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR - - for(i = 0; i < (size_t)ds_size[0]; i++) - if(data1[i] != data2[i]) { - H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", - (unsigned long)i, (int)(data1[i]), - (unsigned long)i, (int)(data2[i])); - goto error; - } - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR - if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR - if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR - - PASSED(); - } - else { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } + if((cwg = H5Gcreate2(file, "test_tr2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + if((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE )) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK)) < 0) FAIL_STACK_ERROR + + if((f_type = H5Tcreate(H5T_ENUM, sizeof(int))) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "RED", CPTR(val2, 1050)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020)) < 0) FAIL_STACK_ERROR + if(H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010)) < 0) FAIL_STACK_ERROR + + if((space = H5Screate_simple(1, ds_size, NULL)) < 0) FAIL_STACK_ERROR + if((dset = H5Dcreate2(cwg, "color_table", f_type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1) < 0) FAIL_STACK_ERROR + if(H5Dread(dset, m_type, space, space, H5P_DEFAULT, data2) < 0) FAIL_STACK_ERROR + + for(i = 0; i < (size_t)ds_size[0]; i++) + if(data1[i] != data2[i]) { + H5_FAILED(); + printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + (unsigned long)i, (int)(data1[i]), + (unsigned long)i, (int)(data2[i])); + goto error; + } + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Tclose(m_type) < 0) FAIL_STACK_ERROR + if(H5Tclose(f_type) < 0) FAIL_STACK_ERROR + if(H5Gclose(cwg) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; error: @@ -473,7 +454,8 @@ test_funcs(void) { hid_t type=-1; c_e1 val; - int size; + size_t size; + int offset; H5T_pad_t inpad; H5T_cset_t cset; herr_t ret; @@ -490,7 +472,7 @@ test_funcs(void) if ((size=H5Tget_precision(type))==0) goto error; if ((size=H5Tget_size(type))==0) goto error; - if ((size=H5Tget_offset(type))<0) goto error; + if ((offset=H5Tget_offset(type))<0) goto error; if (H5Tget_sign(type)<0) goto error; if (H5Tget_super(type)<0) goto error; diff --git a/test/extend.c b/test/extend.c index f5b0f2e..3ffcadc 100644 --- a/test/extend.c +++ b/test/extend.c @@ -68,8 +68,8 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me for(j = 0; j < 5; j++) { /* Extend the dataset */ - offset[0] = i * NX; - offset[1] = j * NY; + offset[0] = (hsize_t)(i * NX); + offset[1] = (hsize_t)(j * NY); size[0] = offset[0] + NX; size[1] = offset[1] + NY; if(size[0] > max_size[0] || size[1] > max_size[1]) { @@ -96,8 +96,8 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me for(j = 0; j < 10; j++) { /* Select a hyperslab */ - offset[0] = i * (NX / 2); - offset[1] = j * (NY / 2); + offset[0] = (hsize_t)(i * (NX / 2)); + offset[1] = (hsize_t)(j * (NY / 2)); if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; /* Read */ @@ -164,8 +164,8 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h for(j = 0; j < 5; j++) { /* Extend the dataset */ - offset[0] = i * NX; - offset[1] = j * NY; + offset[0] = (hsize_t)(i * NX); + offset[1] = (hsize_t)(j * NY); size[0] = offset[0] + NX; size[1] = offset[1] + NY; if(H5Dextend(dataset, size) < 0) TEST_ERROR; @@ -186,8 +186,8 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h for(j = 0; j < 10; j++) { /* Select a hyperslab */ - offset[0] = i * (NX / 2); - offset[1] = j * (NY / 2); + offset[0] = (hsize_t)(i * (NX / 2)); + offset[1] = (hsize_t)(j * (NY / 2)); if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR; /* Read */ @@ -251,57 +251,49 @@ main (void) static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; char filename[1024]; int i, j; - const char *envval = NULL; - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split")) { - h5_reset(); - fapl = h5_fileaccess(); + h5_reset(); + fapl = h5_fileaccess(); - /* Initialize buffer and space */ - for(i = 0; i < NX; i++) - for(j = 0; j < NY; j++) - buf1[i][j] = i * NY + j; + /* Initialize buffer and space */ + for(i = 0; i < NX; i++) + for(j = 0; j < NY; j++) + buf1[i][j] = i * NY + j; - if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR; + if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR; - /* Create the file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; + /* Create the file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; - /* Create the dataset creation property list */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; - if(H5Pset_chunk(cparms, 2, chunk_dims) < 0) TEST_ERROR; + /* Create the dataset creation property list */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; + if(H5Pset_chunk(cparms, 2, chunk_dims) < 0) TEST_ERROR; - /* Test with incremental allocation */ - nerrors += write_data("extendible dataset with incr. allocation", file, "dataset1a", cparms, mem_space) < 0 ? 1 : 0; + /* Test with incremental allocation */ + nerrors += write_data("extendible dataset with incr. allocation", file, "dataset1a", cparms, mem_space) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += write_data_deprec("extendible dataset with incr. allocation w/deprec. symbols", file, "dataset1b", cparms, mem_space) < 0 ? 1 : 0; + nerrors += write_data_deprec("extendible dataset with incr. allocation w/deprec. symbols", file, "dataset1b", cparms, mem_space) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Test with early allocation */ - if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR; - nerrors += write_data("extendible dataset with early allocation", file, "dataset2a", cparms, mem_space) < 0 ? 1 : 0; + /* Test with early allocation */ + if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR; + nerrors += write_data("extendible dataset with early allocation", file, "dataset2a", cparms, mem_space) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += write_data_deprec("extendible dataset with early allocation w/deprec. symbols", file, "dataset2b", cparms, mem_space) < 0 ? 1 : 0; + nerrors += write_data_deprec("extendible dataset with early allocation w/deprec. symbols", file, "dataset2b", cparms, mem_space) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - if(H5Pclose(cparms) < 0) TEST_ERROR; - if(H5Sclose(mem_space) < 0) TEST_ERROR; - if(H5Fclose(file) < 0) TEST_ERROR; + if(H5Pclose(cparms) < 0) TEST_ERROR; + if(H5Sclose(mem_space) < 0) TEST_ERROR; + if(H5Fclose(file) < 0) TEST_ERROR; - if(nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); - exit(1); - } /* end if */ - - printf("All extend tests passed.\n"); - h5_cleanup(FILENAME, fapl); + if(nerrors) { + printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); + exit(1); } /* end if */ - else - puts("All extend tests skipped - Incompatible with current Virtual File Driver"); + + printf("All extend tests passed.\n"); + h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/external.c b/test/external.c index 8524e72..2f3cdf6 100644 --- a/test/external.c +++ b/test/external.c @@ -842,65 +842,67 @@ test_4 (hid_t fapl) char filename[1024]; /*file name */ char pathname[1024]; char *srcdir = getenv("srcdir"); /*where the src code is located*/ - const char *envval = NULL; TESTING("opening external link twice"); - /* Don't run this test using the multi file driver */ - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - h5_fixname(FILENAME[3], fapl, filename, sizeof filename); + /* Make a copy of the FAPL, in order to switch to the sec2 driver */ + /* (useful when running test with another VFD) */ + if((fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR; - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + /* Switch local copy of the fapl to the sec2 driver */ + if(H5Pset_fapl_sec2(fapl) < 0) FAIL_STACK_ERROR; - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - goto error; + h5_fixname(FILENAME[3], fapl, filename, sizeof filename); - pathname[0] = '\0'; - /* Generate correct name for test file by prepending the source path */ - if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { - HDstrcpy(pathname, srcdir); - HDstrcat(pathname, "/"); - } - HDstrcat(pathname, LINKED_FILE); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; - /* Create an external link to an existing file*/ - if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0) - goto error; + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + goto error; - if(H5Gclose(gid) < 0) - goto error; + pathname[0] = '\0'; + /* Generate correct name for test file by prepending the source path */ + if(srcdir && ((HDstrlen(srcdir) + HDstrlen(LINKED_FILE) + 1) < sizeof(pathname))) { + HDstrcpy(pathname, srcdir); + HDstrcat(pathname, "/"); + } + HDstrcat(pathname, LINKED_FILE); - if(H5Fclose(fid) < 0) - goto error; + /* Create an external link to an existing file*/ + if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; - /* Reopen the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - goto error; + if(H5Gclose(gid) < 0) + goto error; - /* Open the external link */ - if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) - goto error; + if(H5Fclose(fid) < 0) + goto error; - /* Open the external link twice */ - if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0) - goto error; + /* Reopen the file */ + if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + goto error; - if(H5Gclose(xid2) < 0) - goto error; + /* Open the external link */ + if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) + goto error; - if(H5Gclose(xid) < 0) - goto error; + /* Open the external link twice */ + if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0) + goto error; - if(H5Fclose(fid) < 0) - goto error; + if(H5Gclose(xid2) < 0) + goto error; + + if(H5Gclose(xid) < 0) + goto error; + + if(H5Fclose(fid) < 0) + goto error; - PASSED(); - } else - SKIPPED(); + if(H5Pclose(fapl) < 0) + TEST_ERROR + + PASSED(); return 0; @@ -939,58 +941,48 @@ main (void) char filename[1024]; /*file name for test_1* funcs */ hid_t grp=-1; /*group to emit diagnostics */ int nerrors=0; /*number of errors */ - const char *envval = NULL; - - /* Don't run this test using the split file driver */ - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "split")) { - h5_reset(); - fapl = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(grp) < 0) goto error; - - nerrors += test_1a(file); - nerrors += test_1b(file); - nerrors += test_1c(file); - nerrors += test_1d(file); - nerrors += test_1e(file); - nerrors += test_1f(file); - nerrors += test_1g(); - nerrors += test_1h(); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - if (nerrors>0) goto error; - - if (H5Fclose(file) < 0) goto error; - puts("All external storage tests passed."); - if (h5_cleanup(FILENAME, fapl)) { - remove("extern_1a.raw"); - remove("extern_1b.raw"); - remove("extern_2a.raw"); - remove("extern_2b.raw"); - remove("extern_3a.raw"); - remove("extern_3b.raw"); - remove("extern_4a.raw"); - remove("extern_4b.raw"); - } - } - else - { - puts("All external storage tests skipped - Incompatible with current Virtual File Driver"); + + h5_reset(); + fapl = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) goto error; + + nerrors += test_1a(file); + nerrors += test_1b(file); + nerrors += test_1c(file); + nerrors += test_1d(file); + nerrors += test_1e(file); + nerrors += test_1f(file); + nerrors += test_1g(); + nerrors += test_1h(); + nerrors += test_2(fapl); + nerrors += test_3(fapl); + nerrors += test_4(fapl); + if (nerrors>0) goto error; + + if (H5Fclose(file) < 0) goto error; + puts("All external storage tests passed."); + if (h5_cleanup(FILENAME, fapl)) { + remove("extern_1a.raw"); + remove("extern_1b.raw"); + remove("extern_2a.raw"); + remove("extern_2b.raw"); + remove("extern_3a.raw"); + remove("extern_3b.raw"); + remove("extern_4a.raw"); + remove("extern_4b.raw"); } + return 0; - error: - H5E_BEGIN_TRY { - H5Fclose(file); - H5Pclose(fapl); - } H5E_END_TRY; - nerrors = MAX(1, nerrors); - printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); - return 1; +error: + H5E_BEGIN_TRY { + H5Fclose(file); + H5Pclose(fapl); + } H5E_END_TRY; + nerrors = MAX(1, nerrors); + printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); + return 1; } diff --git a/test/fheap.c b/test/fheap.c index 8c6e6d0..953a849 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -15772,29 +15772,15 @@ main(void) fheap_test_type_t curr_test; /* Current test being worked on */ unsigned u; /* Local index variable */ unsigned nerrors = 0; /* Cumulative error count */ - int ExpressMode; - const char *envval = NULL; /* File Driver value from environment */ + int ExpressMode; /* Express testing level */ /* Reset library */ h5_reset(); fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); - if (ExpressMode > 1) + if(ExpressMode > 1) printf("***Express test mode on. Some tests may be skipped\n"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - - /* This test case with Direct driver has a poor performance on - * NCSA copper, though it works. Skip it if the express mode is set on - * and worry about the performance later. - */ - if((HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && - HDstrcmp(envval, "family") && HDstrcmp(envval, "stdio")) && - !(!HDstrcmp(envval, "direct") && (ExpressMode > 1))) - { - /* Initialize heap creation parameters */ init_small_cparam(&small_cparam); init_large_cparam(&large_cparam); @@ -15925,7 +15911,7 @@ fill = FHEAP_TEST_FILL_LARGE; * level of complexity gradually. -QAK */ #ifndef QAK - if (ExpressMode > 1) + if(ExpressMode > 1) printf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n"); else nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam); @@ -15984,7 +15970,7 @@ tparam.drain_half = FHEAP_DEL_DRAIN_ALL; nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam); nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam); - if (ExpressMode > 1) + if(ExpressMode > 1) printf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam); @@ -16016,7 +16002,7 @@ tparam.drain_half = FHEAP_DEL_DRAIN_ALL; nerrors += test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam); - if (ExpressMode > 1) + if(ExpressMode > 1) printf("***Express test mode on. Some tests skipped\n"); else { nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam); @@ -16104,11 +16090,15 @@ HDfprintf(stderr, "Uncomment tests!\n"); tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ +#ifndef QAK nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam); nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam); nerrors += test_filtered_huge(fapl, &small_cparam, &tparam); +#else /* QAK */ +HDfprintf(stderr, "Uncomment tests!\n"); +#endif /* QAK */ #ifndef QAK /* Test 'tiny' object insert & delete */ @@ -16162,7 +16152,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); #ifndef QAK /* Random object insertion & deletion */ - if (ExpressMode > 1) + if(ExpressMode > 1) printf("***Express test mode on. Some tests skipped\n"); else { #ifndef QAK @@ -16250,10 +16240,6 @@ HDfprintf(stderr, "Uncomment tests!\n"); #else /* QAK */ HDfprintf(stderr, "Uncomment cleanup!\n"); #endif /* QAK */ - } /* end if(HDstrcmp(envval=="...")) */ - else { - printf("All fractal heap tests skipped - Incompatible with current Virtual File Driver\n"); - } return 0; diff --git a/test/fillval.c b/test/fillval.c index f0ee9ba..00e06ea 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1968,16 +1968,16 @@ skip: static int test_compatible(hid_t fapl) { - hid_t file=-1, dset1=-1, dset2=-1; - hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1; - int rd_fill=0, fill_val=4444, val_rd=0; - hsize_t dims[2], one[2]={1,1}; - hsize_t hs_offset[2]={3,4}; - H5D_fill_value_t status; - char *srcdir = getenv("srcdir"); /*where the src code is located*/ - char testfile[512]=""; /* test file name */ + hid_t file=-1, dset1=-1, dset2=-1; + hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1; + int rd_fill=0, fill_val=4444, val_rd=0; + hsize_t dims[2], one[2]={1,1}; + hsize_t hs_offset[2]={3,4}; + H5D_fill_value_t status; + char *srcdir = getenv("srcdir"); /*where the src code is located*/ + char testfile[512]=""; /* test file name */ - TESTING("contiguous dataset compatibility with v. 1.4"); + TESTING("contiguous dataset compatibility with v. 1.4"); /* Generate correct name for test file by prepending the source path */ if(srcdir && ((strlen(srcdir) + strlen(FILE_COMPATIBLE) + 1) < @@ -1987,9 +1987,9 @@ test_compatible(hid_t fapl) } HDstrcat(testfile, FILE_COMPATIBLE); - if((file = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) { + if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf(" Could not open file %s. Try set $srcdir to point at the " - "source directory of test\n", testfile); + "source directory of test\n", testfile); goto error; } @@ -2000,7 +2000,7 @@ test_compatible(hid_t fapl) H5_FAILED(); printf(" %d: Got a different fill value than what was set.",__LINE__); printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", - (long)status); + (long)status); goto error; } if((fspace = H5Dget_space(dset1)) < 0) goto error; @@ -2072,8 +2072,10 @@ test_compatible(hid_t fapl) if(H5Dclose(dset2) < 0) goto error; if(H5Fclose(file) < 0) goto error; + PASSED(); - return 0; + + return 0; error: H5E_BEGIN_TRY { @@ -2109,93 +2111,84 @@ error: int main(int argc, char *argv[]) { - const char *envval = NULL; - - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; - hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ - hbool_t new_format; /* Whether to use the new format or not */ - - if(argc >= 2) { - test_contig = test_chunk = test_compact = 0; - for(argno = 1; argno < argc; argno++) { - if(!strcmp(argv[argno], "contiguous")) - test_contig = 1; - else if(!strcmp(argv[argno], "chunked")) - test_chunk = 1; - else if(!strcmp(argv[argno], "compact")) - test_compact =1; - else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(1); - } - } /* end for */ - } /* end if */ + int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; + hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ + hbool_t new_format; /* Whether to use the new format or not */ + + if(argc >= 2) { + test_contig = test_chunk = test_compact = 0; + for(argno = 1; argno < argc; argno++) { + if(!strcmp(argv[argno], "contiguous")) + test_contig = 1; + else if(!strcmp(argv[argno], "chunked")) + test_chunk = 1; + else if(!strcmp(argv[argno], "compact")) + test_compact =1; + else { + fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + exit(1); + } + } /* end for */ + } /* end if */ - h5_reset(); - fapl = h5_fileaccess(); + h5_reset(); + fapl = h5_fileaccess(); - /* Property list tests */ - nerrors += test_getset(); - nerrors += test_getset_vl(fapl); + /* Property list tests */ + nerrors += test_getset(); + nerrors += test_getset_vl(fapl); - /* Copy the file access property list */ - if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + /* Loop over using new group format */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - /* Set the FAPL for the type of format */ - if(new_format) { - puts("\nTesting with new file format:"); - my_fapl = fapl2; - } /* end if */ - else { - puts("Testing with old file format:"); - my_fapl = fapl; - } /* end else */ - - /* Chunked storage layout tests */ - if(test_chunk) { - nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED); - nerrors += test_rdwr (my_fapl, FILENAME[2], H5D_CHUNKED); - nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED); - } /* end if */ - - /* Contiguous storage layout tests */ - if(test_contig) { - nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS); - nerrors += test_rdwr (my_fapl, FILENAME[3], H5D_CONTIGUOUS); - nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS); - nerrors += test_compatible(my_fapl); - } /* end if */ - - /* Compact dataset storage tests */ - if(test_compact) { - nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT); - nerrors += test_rdwr (my_fapl, FILENAME[7], H5D_COMPACT); - } /* end if */ - } /* end for */ + /* Set the FAPL for the type of format */ + if(new_format) { + puts("\nTesting with new file format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old file format:"); + my_fapl = fapl; + } /* end else */ + + /* Chunked storage layout tests */ + if(test_chunk) { + nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED); + nerrors += test_rdwr (my_fapl, FILENAME[2], H5D_CHUNKED); + nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED); + } /* end if */ - /* Close 2nd FAPL */ - H5Pclose(fapl2); + /* Contiguous storage layout tests */ + if(test_contig) { + nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS); + nerrors += test_rdwr (my_fapl, FILENAME[3], H5D_CONTIGUOUS); + nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS); + nerrors += test_compatible(my_fapl); + } /* end if */ - if(nerrors) - goto error; - puts("All fill value tests passed."); + /* Compact dataset storage tests */ + if(test_compact) { + nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT); + nerrors += test_rdwr (my_fapl, FILENAME[7], H5D_COMPACT); + } /* end if */ + } /* end for */ - if(h5_cleanup(FILENAME, fapl)) - remove(FILE_NAME_RAW); - } /* end if */ - else - puts("All fill value tests skipped - Incompatible with current Virtual File Driver"); + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + if(nerrors) + goto error; + puts("All fill value tests passed."); + + if(h5_cleanup(FILENAME, fapl)) + remove(FILE_NAME_RAW); return 0; diff --git a/test/flush1.c b/test/flush1.c index d9a55ed..f15a05a 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -171,49 +171,38 @@ main(void) { hid_t file, fapl; char name[1024]; - const char *envval = NULL; h5_reset(); fapl = h5_fileaccess(); TESTING("H5Fflush (part1)"); - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "split")) { - /* Create the file */ - h5_fixname(FILENAME[0], fapl, name, sizeof name); - file = create_file(name, fapl); - /* Flush and exit without closing the library */ - if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; - - /* Create the file */ - h5_fixname(FILENAME[2], fapl, name, sizeof name); - file = create_file(name, fapl); - /* Flush and exit without closing the library */ - if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; - /* Add a bit to the file and don't flush the new part */ - extend_file(file); - - /* Create the other file which will not be flushed */ - h5_fixname(FILENAME[1], fapl, name, sizeof name); - file = create_file(name, fapl); - - - PASSED(); - fflush(stdout); - fflush(stderr); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } - HD_exit(0); + /* Create the file */ + h5_fixname(FILENAME[0], fapl, name, sizeof name); + file = create_file(name, fapl); + /* Flush and exit without closing the library */ + if (H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; + + /* Create the file */ + h5_fixname(FILENAME[2], fapl, name, sizeof name); + file = create_file(name, fapl); + /* Flush and exit without closing the library */ + if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) goto error; + /* Add a bit to the file and don't flush the new part */ + extend_file(file); + + /* Create the other file which will not be flushed */ + h5_fixname(FILENAME[1], fapl, name, sizeof name); + file = create_file(name, fapl); - error: - HD_exit(1); - return 1; + PASSED(); + fflush(stdout); + fflush(stderr); + + HD_exit(0); + +error: + HD_exit(1); + return 1; } diff --git a/test/flush2.c b/test/flush2.c index 0304406..5675856 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -159,90 +159,74 @@ main(void) { hid_t fapl; H5E_auto2_t func; - char name[1024]; - const char *envval = NULL; h5_reset(); fapl = h5_fileaccess(); TESTING("H5Fflush (part2 with flush)"); - /* Don't run this test using the core or split file drivers */ - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) { - /* Check the case where the file was flushed */ - h5_fixname(FILENAME[0], fapl, name, sizeof name); - if(check_file(name, fapl, FALSE)) { - H5_FAILED() - goto error; - } - else - PASSED(); + /* Check the case where the file was flushed */ + h5_fixname(FILENAME[0], fapl, name, sizeof name); + if(check_file(name, fapl, FALSE)) { + H5_FAILED() + goto error; + } + else + PASSED(); - /* Check the case where the file was not flushed. This should give an error - * so we turn off the error stack temporarily */ - TESTING("H5Fflush (part2 without flush)"); - H5Eget_auto2(H5E_DEFAULT,&func,NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* Check the case where the file was not flushed. This should give an error + * so we turn off the error stack temporarily */ + TESTING("H5Fflush (part2 without flush)"); + H5Eget_auto2(H5E_DEFAULT,&func,NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - h5_fixname(FILENAME[1], fapl, name, sizeof name); - if(check_file(name, fapl, FALSE)) - PASSED() - else - { + h5_fixname(FILENAME[1], fapl, name, sizeof name); + if(check_file(name, fapl, FALSE)) + PASSED() + else + { #if defined _WIN32 && defined _HDF5USEDLL_ - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #elif defined H5_VMS - SKIPPED(); + SKIPPED(); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif - } - H5Eset_auto2(H5E_DEFAULT, func, NULL); - - /* Check the case where the file was flushed, but more data was added afterward. This should give an error - * so we turn off the error stack temporarily */ - TESTING("H5Fflush (part2 with flush and later addition)"); - H5Eget_auto2(H5E_DEFAULT,&func,NULL); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - - h5_fixname(FILENAME[2], fapl, name, sizeof name); - if(check_file(name, fapl, TRUE)) - PASSED() - else - { + } + H5Eset_auto2(H5E_DEFAULT, func, NULL); + + /* Check the case where the file was flushed, but more data was added afterward. This should give an error + * so we turn off the error stack temporarily */ + TESTING("H5Fflush (part2 with flush and later addition)"); + H5Eget_auto2(H5E_DEFAULT,&func,NULL); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + + h5_fixname(FILENAME[2], fapl, name, sizeof name); + if(check_file(name, fapl, TRUE)) + PASSED() + else + { #if defined _WIN32 && defined _HDF5USEDLL_ - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #elif defined H5_VMS - SKIPPED(); + SKIPPED(); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif - } - H5Eset_auto2(H5E_DEFAULT, func, NULL); + } + H5Eset_auto2(H5E_DEFAULT, func, NULL); + h5_cleanup(FILENAME, fapl); - h5_cleanup(FILENAME, fapl); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } return 0; - error: - return 1; +error: + return 1; } - - - diff --git a/test/istore.c b/test/istore.c index e0d2e82..fff6706 100644 --- a/test/istore.c +++ b/test/istore.c @@ -250,9 +250,9 @@ test_extend(hid_t f, const char *prefix, sprintf(s, "istore extend: %s", dims); TESTING(s); - buf = HDmalloc(nx * ny * nz); - check = HDmalloc(nx * ny * nz); - whole = HDcalloc((size_t)1, nx * ny * nz); + buf = (uint8_t *)HDmalloc(nx * ny * nz); + check = (uint8_t *)HDmalloc(nx * ny * nz); + whole = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz); whole_size[0] = nx; whole_size[1] = ny; @@ -463,7 +463,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, sprintf(s, "istore sparse: %s", dims); TESTING(s); - buf = HDmalloc(nx * ny * nz); + buf = (uint8_t *)HDmalloc(nx * ny * nz); HDmemset(buf, 128, nx * ny * nz); /* Set dimensions of dataset */ @@ -565,140 +565,116 @@ main(int argc, char *argv[]) unsigned size_of_test; unsigned u; /* Local index variable */ char filename[1024]; - const char *envval = NULL; - - /* Don't run this test using the split file driver */ - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "split")) { - /* Parse arguments or assume these tests (`small', `medium' ) */ - if (1 == argc) { - size_of_test = TEST_SMALL; - } else { - int i; - for (i = 1, size_of_test = 0; i < argc; i++) { - if (!strcmp(argv[i], "small")) { - size_of_test |= TEST_SMALL; - } else if (!strcmp(argv[i], "medium")) { - size_of_test |= TEST_MEDIUM; - } else if (!strcmp(argv[i], "large")) { - size_of_test |= TEST_LARGE; - } else { - printf("unrecognized argument: %s\n", argv[i]); + + /* Parse arguments or assume these tests (`small', `medium' ) */ + if (1 == argc) { + size_of_test = TEST_SMALL | TEST_MEDIUM | TEST_LARGE; + } else { + int i; + for (i = 1, size_of_test = 0; i < argc; i++) { + if (!strcmp(argv[i], "small")) { + size_of_test |= TEST_SMALL; + } else if (!strcmp(argv[i], "medium")) { + size_of_test |= TEST_MEDIUM; + } else if (!strcmp(argv[i], "large")) { + size_of_test |= TEST_LARGE; + } else { + printf("unrecognized argument: %s\n", argv[i]); #if 0 - exit(1); + exit(1); #endif - } - } - } - printf("Test sizes: "); - if (size_of_test & TEST_SMALL) - printf(" SMALL"); - if (size_of_test & TEST_MEDIUM) - printf(" MEDIUM"); - if (size_of_test & TEST_LARGE) - printf(" LARGE"); - printf("\n"); - - /* Set the random # seed */ - HDsrandom((unsigned long)HDtime(NULL)); - - /* Reset library */ - h5_reset(); - fapl = h5_fileaccess(); - - /* Use larger file addresses... */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - H5Pset_sizes(fcpl, (size_t)8, (size_t)0); - - /* Create the test file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - printf("Cannot create file %s; test aborted\n", filename); - exit(1); - } + } + } + } + printf("Test sizes: "); + if (size_of_test & TEST_SMALL) + printf(" SMALL"); + if (size_of_test & TEST_MEDIUM) + printf(" MEDIUM"); + if (size_of_test & TEST_LARGE) + printf(" LARGE"); + printf("\n"); + + /* Set the random # seed */ + HDsrandom((unsigned long)HDtime(NULL)); + + /* Reset library */ + h5_reset(); + fapl = h5_fileaccess(); + + /* Use larger file addresses... */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + H5Pset_sizes(fcpl, (size_t)8, (size_t)0); + + /* Create the test file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { + printf("Cannot create file %s; test aborted\n", filename); + exit(1); + } - /* - * For testing file families, fool the library into thinking it already - * allocated a whole bunch of data. - */ - if (H5FD_FAMILY==H5Pget_driver(fapl)) { - haddr_t addr; - H5F_t *f; - - addr = 8 * ((uint64_t)1<<30); /*8 GB */ - f=H5I_object(file); - if (H5FDset_eoa(f->shared->lf, H5FD_MEM_DEFAULT, addr) < 0) { - printf("Cannot create large file family\n"); - exit(1); - } - } + /* Initialize chunk dimensions */ + for(u = 0; u < H5O_LAYOUT_NDIMS; u++) + chunk_dims[u] = TEST_CHUNK_SIZE; + + /* + * Creation test: Creates empty objects with various raw data sizes + * and alignments. + */ + status = test_create(file, "create"); + nerrors += status < 0 ? 1 : 0; + + if (size_of_test & TEST_SMALL) { + status = test_extend(file, "extend", (size_t)10, (size_t)0, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_extend(file, "extend", (size_t)10, (size_t)10, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_extend(file, "extend", (size_t)10, (size_t)10, (size_t)10); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_MEDIUM) { + status = test_extend(file, "extend", (size_t)10000, (size_t)0, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_extend(file, "extend", (size_t)2500, (size_t)10, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_extend(file, "extend", (size_t)10, (size_t)400, (size_t)10); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_SMALL) { + status = test_sparse(file, "sparse", (size_t)100, (size_t)5, (size_t)0, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_sparse(file, "sparse", (size_t)100, (size_t)3, (size_t)4, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_sparse(file, "sparse", (size_t)100, (size_t)2, (size_t)3, (size_t)4); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_MEDIUM) { + status = test_sparse(file, "sparse", (size_t)1000, (size_t)30, (size_t)0, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_sparse(file, "sparse", (size_t)2000, (size_t)7, (size_t)3, (size_t)0); + nerrors += status < 0 ? 1 : 0; + status = test_sparse(file, "sparse", (size_t)2000, (size_t)4, (size_t)2, (size_t)3); + nerrors += status < 0 ? 1 : 0; + } + if (size_of_test & TEST_LARGE) { + status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50); + nerrors += status < 0 ? 1 : 0; + } - /* Initialize chunk dimensions */ - for (u = 0; u < H5O_LAYOUT_NDIMS; u++) - chunk_dims[u]=TEST_CHUNK_SIZE; - - /* - * Creation test: Creates empty objects with various raw data sizes - * and alignments. - */ - status = test_create(file, "create"); - nerrors += status < 0 ? 1 : 0; - - if (size_of_test & TEST_SMALL) { - status = test_extend(file, "extend", (size_t)10, (size_t)0, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_extend(file, "extend", (size_t)10, (size_t)10, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_extend(file, "extend", (size_t)10, (size_t)10, (size_t)10); - nerrors += status < 0 ? 1 : 0; - } - if (size_of_test & TEST_MEDIUM) { - status = test_extend(file, "extend", (size_t)10000, (size_t)0, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_extend(file, "extend", (size_t)2500, (size_t)10, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_extend(file, "extend", (size_t)10, (size_t)400, (size_t)10); - nerrors += status < 0 ? 1 : 0; - } - if (size_of_test & TEST_SMALL) { - status = test_sparse(file, "sparse", (size_t)100, (size_t)5, (size_t)0, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_sparse(file, "sparse", (size_t)100, (size_t)3, (size_t)4, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_sparse(file, "sparse", (size_t)100, (size_t)2, (size_t)3, (size_t)4); - nerrors += status < 0 ? 1 : 0; - } - if (size_of_test & TEST_MEDIUM) { - status = test_sparse(file, "sparse", (size_t)1000, (size_t)30, (size_t)0, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_sparse(file, "sparse", (size_t)2000, (size_t)7, (size_t)3, (size_t)0); - nerrors += status < 0 ? 1 : 0; - status = test_sparse(file, "sparse", (size_t)2000, (size_t)4, (size_t)2, (size_t)3); - nerrors += status < 0 ? 1 : 0; - } - if (size_of_test & TEST_LARGE) { - status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50); - nerrors += status < 0 ? 1 : 0; - } + /* Close the test file and exit */ + H5Pclose(fcpl); + H5Fclose(file); - /* Close the test file and exit */ - H5Pclose(fcpl); - H5Fclose(file); + if (nerrors) { + printf("***** %d I-STORE TEST%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "S"); + exit(1); + } - if (nerrors) { - printf("***** %d I-STORE TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); - exit(1); - } + printf("All i-store tests passed.\n"); + + h5_cleanup(FILENAME, fapl); - printf("All i-store tests passed.\n"); - h5_cleanup(FILENAME, fapl); - } - else - { - puts("All i-store tests skipped - Incompatible with current Virtual File Driver"); - } return 0; } + diff --git a/test/links.c b/test/links.c index 3b97fdb..8e4fe33 100644 --- a/test/links.c +++ b/test/links.c @@ -2112,7 +2112,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) *------------------------------------------------------------------------- */ static int -external_link_self(hid_t fapl, hbool_t new_format) +external_link_self(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ @@ -2128,117 +2128,127 @@ external_link_self(hid_t fapl, hbool_t new_format) else TESTING("external link to self") - /* Set up filename */ - h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); - h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); + /* Skip test when using core VFD, since it doesn't re-open file when linking + * to same file. + */ + if(HDstrcmp(env_h5_drvr, "core")) { + /* Set up filename */ + h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); + h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); - /* Create file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create an lcpl with intermediate group creation set */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + /* Create an lcpl with intermediate group creation set */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - /* Create a series of groups within the file: /A/B and /X/Y/Z */ - if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a series of groups within the file: /A/B and /X/Y/Z */ + if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Pclose (lcpl_id) < 0) TEST_ERROR + if(H5Pclose (lcpl_id) < 0) TEST_ERROR - /* Create external link to own root group*/ - if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to own root group*/ + if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X")) TEST_ERROR + /* Check name */ + if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X")) TEST_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close created group */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close created group */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close object opened through external link */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close object opened through external link */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Check on object created */ - if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Check on object created */ + if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR + /* Check name */ + if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + /* Complicate things. Use this file as an intermediate file in a chain + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ - /* Create file2 with an external link to file1 */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file2 with an external link to file1 */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file2 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file3 as a target */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Create file3 as a target */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file1 and create an extlink pointing to file3 */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open file1 and create an extlink pointing to file3 */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file1 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file1 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ - if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ + if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open up file3 and make sure the object was created successfully */ - if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open up file3 and make sure the object was created successfully */ + if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD can't reopen same file through external link"); + } /* end else */ - PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose (gid2); - H5Fclose (gid); - H5Pclose (lcpl_id); - H5Fclose (fid); + H5Fclose(gid2); + H5Fclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ @@ -2269,7 +2279,7 @@ external_link_self(hid_t fapl, hbool_t new_format) *------------------------------------------------------------------------- */ static int -external_link_pingpong(hid_t fapl, hbool_t new_format) +external_link_pingpong(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ @@ -2283,85 +2293,94 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) else TESTING("external links back and forth") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + /* Skip test when using core VFD, since it doesn't re-open file when linking + * to same file. + */ + if(HDstrcmp(env_h5_drvr, "core")) { + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); - /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create first file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Check name */ + if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR + /* Check name */ + if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD can't reopen same file through external link"); + } /* end else */ - PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ @@ -5314,7 +5333,7 @@ error: *------------------------------------------------------------------------- */ static int -external_link_closing(hid_t fapl, hbool_t new_format) +external_link_closing(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) { hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1); hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); @@ -5334,184 +5353,195 @@ external_link_closing(hid_t fapl, hbool_t new_format) else TESTING("that external files are closed during traversal") - /* In this test, external links will go from file1 to file2 and from - * file2 to file3. - * Test that all functions that can traverse external files close - * the files they open. - * Test that providing unusual paths containing external links can't - * make HDF5 forget to close a file it opened. + /* Skip test when using core VFD, since it doesn't re-open file when linking + * to same file. */ + if(HDstrcmp(env_h5_drvr, "core")) { + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); - h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); - h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); - h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); - - /* Create four files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ - dims[0] = 2; - dims[1] = 2; - if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - - /* Create external links from each file to the next */ - if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close all files but the first */ - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Test creating each kind of object */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR - - /* Test move */ - if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, - "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Open file 4 so we can do some fancy things */ - if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, - "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid4, "dataset1", fid1, - "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Close file 4 again */ - if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR - - /* Test copy (as of this test, it uses the same code as move) */ - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Test H5Gset and get comment */ - if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(buf, "comment")) TEST_ERROR - - /* Test H5*open */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5*open2 */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5Oopen */ - if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test H5Fmount */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR - } H5E_END_TRY - - /* Test H5Rcreate */ - if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR - - /* Test unlink */ - if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR - - /* We've tested that the various functions above don't leave files open. - * Now test that we can't confuse HDF5 by giving unusual paths with external links - */ - /* Create an external link that points to another external link */ - if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", - H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); + h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); + h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); + + /* Create four files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Do an external link traversal that recursively calls another external link. */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name(fid1, "elink/elink2/group2/group3/group4", &oi, H5P_DEFAULT) < 0) TEST_ERROR - /* Create two more groups so that the last three elements in the path are - * all within the same external file - */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink2/group2/group3/group4", &oi, H5P_DEFAULT) < 0) TEST_ERROR + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Add a few regular groups and a soft link in file2 using intermediate group creation */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", - lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - /* Try to traverse this path. There are three soft traversals in a row; - * slink points to (file2)/elink2, which points to (file3)/elink, which - * points to file 4. - */ - if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - /* Some simpler tests */ - if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR - /* Close file1, the only file that should still be open */ - if(H5Fclose(fid1) < 0) TEST_ERROR + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Re-create each file. If they are hanging open, these creates will fail */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR - /* Cleanup */ - if(H5Sclose(sid) < 0) TEST_ERROR - if(H5Tclose(tid2) < 0) TEST_ERROR - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - if(H5Fclose(fid1) < 0) TEST_ERROR + PASSED(); + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD can't reopen same file through external link"); + } /* end else */ - PASSED(); return 0; error: @@ -5546,7 +5576,7 @@ error: *------------------------------------------------------------------------- */ static int -external_link_endian(hid_t fapl, hbool_t new_format) +external_link_endian(hbool_t new_format) { hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ @@ -5554,72 +5584,61 @@ external_link_endian(hid_t fapl, hbool_t new_format) char * srcdir = getenv("srcdir"); /* The source directory */ char pathbuf[NAME_BUF_SIZE]; /* Path to the files */ char namebuf[NAME_BUF_SIZE]; - const char *envval = NULL; if(new_format) TESTING("endianness of external links (w/new group format)") else TESTING("endianness of external links") - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - - /* - * Create the name of the file to open (in case we are using the --srcdir - * option and the file is in a different directory from this test). - */ - if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) ) - { - HDstrcpy(pathbuf, srcdir); - HDstrcat(pathbuf, "/"); - } - else - HDstrcpy(pathbuf, ""); + /* + * Create the name of the file to open (in case we are using the --srcdir + * option and the file is in a different directory from this test). + */ + if (srcdir && ((HDstrlen(srcdir) + 2) < sizeof(pathbuf)) ) + { + HDstrcpy(pathbuf, srcdir); + HDstrcat(pathbuf, "/"); + } + else + HDstrcpy(pathbuf, ""); - /* Create a link access property list with the path to the srcdir */ - if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR + /* Create a link access property list with the path to the srcdir */ + if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, LE_FILENAME); + if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR + HDstrcpy(namebuf, pathbuf); + HDstrcat(namebuf, LE_FILENAME); - /* Test LE file; try to open a group through the external link */ - if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + /* Test LE file; try to open a group through the external link */ + if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, BE_FILENAME); + if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR + HDstrcpy(namebuf, pathbuf); + HDstrcat(namebuf, BE_FILENAME); - /* Test BE file; try to open a group through the external link */ - if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + /* Test BE file; try to open a group through the external link */ + if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Current VFD doesn't apply to existing test files"); - } /* end else */ + PASSED(); return 0; @@ -12158,164 +12177,163 @@ error: int main(void) { - const char *envval = NULL; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; + hbool_t new_format; /* Whether to use the new format or not */ + const char *envval; envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) envval = "nomatch"; - if(HDstrcmp(envval, "core")) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; - hbool_t new_format; /* Whether to use the new format or not */ - h5_reset(); - fapl = h5_fileaccess(); + h5_reset(); + fapl = h5_fileaccess(); - /* Copy the file access property list */ - if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Set the "use the latest version of the format" bounds for creating objects in the file */ - if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + /* Set the "use the latest version of the format" bounds for creating objects in the file */ + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; + /* Loop over using new group format */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - /* Check for FAPL to use */ - if(new_format) - my_fapl = fapl2; - else - my_fapl = fapl; - - /* General tests... (on both old & new format groups */ - - nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; - - /* Test new H5L link creation routine */ - nerrors += test_lcpl(my_fapl, new_format); - nerrors += test_move(my_fapl, new_format); - nerrors += test_copy(my_fapl, new_format); - nerrors += test_move_preserves(my_fapl, new_format); + /* Check for FAPL to use */ + if(new_format) + my_fapl = fapl2; + else + my_fapl = fapl; + + /* General tests... (on both old & new format groups */ + + nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; + + /* Test new H5L link creation routine */ + nerrors += test_lcpl(my_fapl, new_format); + nerrors += test_move(my_fapl, new_format); + nerrors += test_copy(my_fapl, new_format); + nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_deprec(my_fapl, new_format); + nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifndef H5_CANNOT_OPEN_TWICE - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_CANNOT_OPEN_TWICE */ - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_CANNOT_OPEN_TWICE - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(envval, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(envval, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_CANNOT_OPEN_TWICE */ - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_CANNOT_OPEN_TWICE - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(envval, my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_CANNOT_OPEN_TWICE */ - nerrors += external_link_endian(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - /* tests for external link */ - nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + /* tests for external link */ + nerrors += external_link_env(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; #endif - /* These tests assume that external links are a form of UD links, - * so assume that everything that passed for external links - * above has already been tested for UD links. - */ - if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - } /* end if */ - nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; - - /* Misc. extra tests, useful for both new & old format files */ - nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - - /* Keep this test last, it's testing files that are used above */ - /* do not do this for files used by external link tests */ - nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* end for */ + /* These tests assume that external links are a form of UD links, + * so assume that everything that passed for external links + * above has already been tested for UD links. + */ + if(new_format == TRUE) { + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + } /* end if */ + nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; + + /* Misc. extra tests, useful for both new & old format files */ + nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + + /* Keep this test last, it's testing files that are used above */ + /* do not do this for files used by external link tests */ + nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; + } /* end for */ - /* New group revision feature tests */ - nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; + /* New group revision feature tests */ + nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; /* XXX: when creation order indexing is fully working, go back and add checks * to these tests to make certain that the creation order values are * correct. */ - nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; - nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; - nerrors += corder_transition(fapl2) < 0 ? 1 : 0; - nerrors += corder_delete(fapl2) < 0 ? 1 : 0; - nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += link_iterate(fapl2) < 0 ? 1 : 0; - nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += object_info(fapl2) < 0 ? 1 : 0; - nerrors += group_info(fapl2) < 0 ? 1 : 0; - nerrors += timestamps(fapl2) < 0 ? 1 : 0; - - /* Test new API calls on old-style groups */ - nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; - nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += object_info_old(fapl) < 0 ? 1 : 0; - nerrors += group_info_old(fapl) < 0 ? 1 : 0; - - /* Close 2nd FAPL */ - H5Pclose(fapl2); - - /* Results */ - if(nerrors) { - printf("***** %d LINK TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); - exit(1); - } - printf("All link tests passed.\n"); - h5_cleanup(FILENAME, fapl); - /* clean up tmp directory created by external link tests */ - HDrmdir(TMPDIR); + nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; + nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; + nerrors += corder_transition(fapl2) < 0 ? 1 : 0; + nerrors += corder_delete(fapl2) < 0 ? 1 : 0; + nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += link_iterate(fapl2) < 0 ? 1 : 0; + nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += object_info(fapl2) < 0 ? 1 : 0; + nerrors += group_info(fapl2) < 0 ? 1 : 0; + nerrors += timestamps(fapl2) < 0 ? 1 : 0; + + /* Test new API calls on old-style groups */ + nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; + nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += object_info_old(fapl) < 0 ? 1 : 0; + nerrors += group_info_old(fapl) < 0 ? 1 : 0; + + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + /* Results */ + if(nerrors) { + printf("***** %d LINK TEST%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "S"); + exit(1); } - else - puts("All link tests skipped - Incompatible with current Virtual File Driver"); + printf("All link tests passed.\n"); + + h5_cleanup(FILENAME, fapl); + + /* clean up tmp directory created by external link tests */ + HDrmdir(TMPDIR); + return 0; error: diff --git a/test/mf.c b/test/mf.c index b19e190..527fa4a 100644 --- a/test/mf.c +++ b/test/mf.c @@ -142,13 +142,15 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; hsize_t ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MM_alloc() of file allocation"); /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -280,13 +282,15 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) haddr_t addr; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_shrink() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -383,7 +387,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -433,7 +437,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -477,7 +481,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -551,13 +555,15 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) htri_t extended; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_extend() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -652,7 +658,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -1706,11 +1712,13 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) H5MF_sect_ud_t udata; htri_t node_found=FALSE; H5FS_section_info_t *node; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("A free-space section absorbs an aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -1788,7 +1796,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("A free-space section absorbs an aggregator: test 2"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -1893,11 +1901,13 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr=HADDR_UNDEF; hsize_t ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2022,11 +2032,13 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2, addr3; haddr_t ma_addr=HADDR_UNDEF; hsize_t ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2174,11 +2186,13 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) hsize_t ma_size=0, new_ma_size=0; haddr_t sdata_addr=HADDR_UNDEF; hsize_t sdata_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2333,11 +2347,13 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2, saddr1, saddr2, saddr3; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 4"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2477,11 +2493,13 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2, addr3; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 5"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2607,11 +2625,13 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0; frspace_state_t state; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 6"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2769,11 +2789,13 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, sdata_size=0; frspace_state_t state; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 7"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2923,11 +2945,13 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0; htri_t extended; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2998,7 +3022,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of meta/sdata aggregator: test 2"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -3060,7 +3084,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -3161,11 +3185,13 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) hsize_t ma_size=0, new_ma_size=0; hsize_t sdata_size=0, new_sdata_size=0; htri_t status; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3219,7 +3245,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 2"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -3270,7 +3296,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { + if(contig_addr_vfd) { /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -3375,14 +3401,16 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) htri_t status, extended; frspace_state_t state; hsize_t alignment=0, mis_align=0, tmp=0, accum=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MM_alloc() of file allocation with alignment: test 1"); /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3489,8 +3517,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + if(have_alloc_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -3542,8 +3569,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + if(have_alloc_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -3643,6 +3669,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) H5MF_sect_ud_t udata; htri_t extended; hsize_t alignment=0, tmp=0, mis_align=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of free-space manager with alignment: test 1"); @@ -3809,8 +3836,9 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { if((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR @@ -4006,6 +4034,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr=HADDR_UNDEF; hsize_t ma_size=0, mis_align=0; hsize_t alignment=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 1"); @@ -4013,8 +4042,9 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4262,14 +4292,16 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, sdata_size=0, mis_align=0; hsize_t alignment=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2"); /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4588,6 +4620,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, sdata_size=0, mis_align=0; hsize_t alignment=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 3"); @@ -4595,8 +4628,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4882,6 +4916,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr=HADDR_UNDEF; hsize_t ma_size=0, saved_ma_size=0; hsize_t alignment=0, mis_align=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 4"); @@ -4889,8 +4924,9 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5087,6 +5123,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0; hsize_t alignment=0, mis_align=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 5"); @@ -5094,8 +5131,9 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5355,14 +5393,16 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0; hsize_t alignment=0, mis_align=0, tmp=0; + hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6"); /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list */ - if(HDstrcmp(env_h5_drvr, "stdio") && HDstrcmp(env_h5_drvr, "split") && - HDstrcmp(env_h5_drvr, "multi")) { + have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") + && HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(have_alloc_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5539,7 +5579,7 @@ main(void) hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */ unsigned nerrors = 0; /* Cumulative error count */ test_type_t curr_test; - const char *env_h5_drvr = NULL; /* File Driver value from environment */ + const char *env_h5_drvr; /* File Driver value from environment */ /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); diff --git a/test/mount.c b/test/mount.c index 9f07123..25af851 100644 --- a/test/mount.c +++ b/test/mount.c @@ -4222,59 +4222,51 @@ main(void) { int nerrors = 0; hid_t fapl = -1; - const char *envval = NULL; - - envval = HDgetenv("HDF5_DRIVER"); - if (envval == NULL) - envval = "nomatch"; - if (HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { - h5_reset(); - fapl = h5_fileaccess(); - if (setup(fapl) < 0) goto error; - - nerrors += test_basic(fapl); - nerrors += test_illegal(fapl); - nerrors += test_samefile(fapl); - nerrors += test_hide(fapl); - nerrors += test_assoc(fapl); - nerrors += test_mntlnk(fapl); - nerrors += test_unlink(fapl); - nerrors += test_move(fapl); - nerrors += test_mvmpt(fapl); - nerrors += test_preopen(fapl); - nerrors += test_postopen(fapl); - nerrors += test_interlink(fapl); - nerrors += test_uniformity(fapl); - nerrors += test_close(fapl); - nerrors += test_mount_after_close(fapl); - nerrors += test_mount_after_unmount(fapl); - nerrors += test_missing_unmount(fapl); - nerrors += test_hold_open_file(fapl); - nerrors += test_hold_open_group(fapl); - nerrors += test_fcdegree_same(fapl); - nerrors += test_fcdegree_semi(fapl); - nerrors += test_fcdegree_strong(fapl); - nerrors += test_acc_perm(fapl); - nerrors += test_mult_mount(fapl); - nerrors += test_nested_survive(fapl); - nerrors += test_close_parent(fapl); - nerrors += test_cut_graph(fapl); - nerrors += test_symlink(fapl); - nerrors += test_sharedacc(fapl); - nerrors += test_sharedclose(fapl); - - if (nerrors) goto error; - puts("All mount tests passed."); - h5_cleanup(F