diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/btree2.c | 385 | ||||
-rw-r--r-- | test/dsets.c | 476 | ||||
-rw-r--r-- | test/enum.c | 178 | ||||
-rw-r--r-- | test/extend.c | 82 | ||||
-rw-r--r-- | test/external.c | 180 | ||||
-rw-r--r-- | test/fheap.c | 34 | ||||
-rw-r--r-- | test/fillval.c | 175 | ||||
-rw-r--r-- | test/flush1.c | 63 | ||||
-rw-r--r-- | test/flush2.c | 110 | ||||
-rw-r--r-- | test/istore.c | 240 | ||||
-rw-r--r-- | test/links.c | 976 | ||||
-rw-r--r-- | test/mf.c | 126 | ||||
-rw-r--r-- | test/mount.c | 96 | ||||
-rw-r--r-- | test/ntypes.c | 510 | ||||
-rwxr-xr-x | test/objcopy.c | 332 | ||||
-rw-r--r-- | test/ohdr.c | 49 | ||||
-rwxr-xr-x | test/reserved.c | 2 | ||||
-rw-r--r-- | test/stab.c | 102 | ||||
-rw-r--r-- | test/unlink.c | 378 |
19 files changed, 2197 insertions, 2297 deletions
diff --git a/test/btree2.c b/test/btree2.c index 84d90f6..dc0caa5 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -6329,6 +6329,71 @@ error: /*------------------------------------------------------------------------- + * Function: gen_l4_btree2 + * + * Purpose: Generate a level-4 v2 B-tree for testing. + * + * Return: Success: 0 + * Failure: 1 + * + * 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: @@ -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(FILENAME, fapl); - } - else - { - puts("All mount tests skipped - Incompatible with current Virtual File Driver"); - } + + 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(FILENAME, fapl); + return 0; - error: - puts("***** MOUNT ERRORS *****"); - return 1; +error: + puts("***** MOUNT ERRORS *****"); + return 1; } diff --git a/test/ntypes.c b/test/ntypes.c index 342aa5e..c8e7ccd 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -85,184 +85,175 @@ test_atomic_dtype(hid_t file) int i, j, n; hsize_t dims[2]; void *tmp; - const char *envval = NULL; TESTING("atomic datatype"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { - /* Initialize the dataset */ - for(i = n = 0; i < DIM0; i++) - for(j = 0; j < DIM1; j++) - ipoints2[i][j] = n++; - - /* Create the data space */ - dims[0] = DIM0; - dims[1] = DIM1; - if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; - - /*------------------- Test data values ------------------------*/ - /* Create the dataset */ - if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - - /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) - TEST_ERROR; - /* Close dataset */ - if(H5Dclose(dataset) < 0) TEST_ERROR; + /* Initialize the dataset */ + for(i = n = 0; i < DIM0; i++) + for(j = 0; j < DIM1; j++) + ipoints2[i][j] = n++; + + /* Create the data space */ + dims[0] = DIM0; + dims[1] = DIM1; + if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; + + /*------------------- Test data values ------------------------*/ + /* Create the dataset */ + if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_1, H5T_STD_I32BE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + + /* Write the data to the dataset */ + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) + TEST_ERROR; + + /* Close dataset */ + if(H5Dclose(dataset) < 0) TEST_ERROR; + + /* Open dataset again to check H5Tget_native_type */ + if((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR; + + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - /* Open dataset again to check H5Tget_native_type */ - if((dataset = H5Dopen2(file, DSET_ATOMIC_NAME_1, H5P_DEFAULT)) < 0) TEST_ERROR; - - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; - - if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - TEST_ERROR; - - /* Verify the datatype retrieved and converted */ - if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_INT)) - TEST_ERROR; - if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE)) - TEST_ERROR; - if(H5T_INTEGER != H5Tget_class(native_type)) - TEST_ERROR; - - /* Read the dataset back. The temporary buffer is for special platforms - * like Cray. */ - tmp = malloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + TEST_ERROR; - if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) - TEST_ERROR; + /* Verify the datatype retrieved and converted */ + if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_INT)) + TEST_ERROR; + if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I32BE)) + TEST_ERROR; + if(H5T_INTEGER != H5Tget_class(native_type)) + TEST_ERROR; - /* Copy data from temporary buffer to destination buffer */ - memcpy(icheck2, tmp, (size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); - free(tmp); - - /* Convert to the integer type */ - if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT) < 0) - TEST_ERROR; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < DIM0; i++) - for(j = 0; j < DIM1; j++) - if(ipoints2[i][j] != icheck2[i][j]) { - H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - goto error; - } /* end if */ + /* Read the dataset back. The temporary buffer is for special platforms + * like Cray. */ + tmp = malloc((size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); - if(H5Dclose(dataset) < 0) TEST_ERROR; - if(H5Tclose(native_type) < 0) TEST_ERROR; - if(H5Tclose(dtype) < 0) TEST_ERROR; + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) + TEST_ERROR; - /*------------------ Test different data types ----------------*/ + /* Copy data from temporary buffer to destination buffer */ + memcpy(icheck2, tmp, (size_t)(DIM0 * DIM1 * H5Tget_size(native_type))); + free(tmp); - /* Create the dataset of H5T_STD_I64LE */ - if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Convert to the integer type */ + if(H5Tconvert(native_type, H5T_NATIVE_INT, (DIM0*DIM1), icheck2, NULL, H5P_DEFAULT) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < DIM0; i++) + for(j = 0; j < DIM1; j++) + if(ipoints2[i][j] != icheck2[i][j]) { + H5_FAILED(); + printf(" Read different values than written.\n"); + printf(" At index %d,%d\n", i, j); + goto error; + } /* end if */ - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; - if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - TEST_ERROR; + /*------------------ Test different data types ----------------*/ - /* Verify the datatype retrieved and converted */ - if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_LLONG)) - TEST_ERROR; - if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I64LE)) - TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(native_type)) - TEST_ERROR; + /* Create the dataset of H5T_STD_I64LE */ + if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_2, H5T_STD_I64LE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Dclose(dataset) < 0) TEST_ERROR; - if(H5Tclose(native_type) < 0) TEST_ERROR; - if(H5Tclose(dtype) < 0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + TEST_ERROR; - /* Create the dataset of H5T_STD_I8LE */ - if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Verify the datatype retrieved and converted */ + if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_LLONG)) + TEST_ERROR; + if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I64LE)) + TEST_ERROR; + if(H5T_INTEGER!=H5Tget_class(native_type)) + TEST_ERROR; - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; - if((native_type = H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0) - TEST_ERROR; - /* Verify the datatype retrieved and converted */ - if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_CHAR)) - TEST_ERROR; - if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I8LE)) - TEST_ERROR; - if(H5T_INTEGER!=H5Tget_class(native_type)) - TEST_ERROR; + /* Create the dataset of H5T_STD_I8LE */ + if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_3, H5T_STD_I8LE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Dclose(dataset) < 0) TEST_ERROR; - if(H5Tclose(native_type) < 0) TEST_ERROR; - if(H5Tclose(dtype) < 0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if((native_type = H5Tget_native_type(dtype, H5T_DIR_ASCEND)) < 0) + TEST_ERROR; - /* Create the dataset of H5T_IEEE_F32BE */ - if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Verify the datatype retrieved and converted */ + if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_CHAR)) + TEST_ERROR; + if(H5Tget_size(native_type) < H5Tget_size(H5T_STD_I8LE)) + TEST_ERROR; + if(H5T_INTEGER!=H5Tget_class(native_type)) + TEST_ERROR; - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; - if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) - TEST_ERROR; - /* Verify the datatype retrieved and converted */ - if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT)) - TEST_ERROR; - if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F32BE)) - TEST_ERROR; - if(H5T_FLOAT!=H5Tget_class(native_type)) - TEST_ERROR; + /* Create the dataset of H5T_IEEE_F32BE */ + if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_4, H5T_IEEE_F32BE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Dclose(dataset) < 0) TEST_ERROR; - if(H5Tclose(native_type) < 0) TEST_ERROR; - if(H5Tclose(dtype) < 0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) + TEST_ERROR; - /* Create the dataset of H5T_IEEE_F64BE */ - if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Verify the datatype retrieved and converted */ + if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_FLOAT)) + TEST_ERROR; + if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F32BE)) + TEST_ERROR; + if(H5T_FLOAT!=H5Tget_class(native_type)) + TEST_ERROR; - if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; - if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) - TEST_ERROR; - /* Verify the datatype retrieved and converted */ - if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_DOUBLE)) - TEST_ERROR; - if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F64BE)) - TEST_ERROR; - if(H5T_FLOAT != H5Tget_class(native_type)) - TEST_ERROR; + /* Create the dataset of H5T_IEEE_F64BE */ + if((dataset = H5Dcreate2(file, DSET_ATOMIC_NAME_5, H5T_IEEE_F64BE, space, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Dclose(dataset) < 0) TEST_ERROR; - if(H5Tclose(native_type) < 0) TEST_ERROR; - if(H5Tclose(dtype) < 0) TEST_ERROR; + if((dtype = H5Dget_type(dataset)) < 0) TEST_ERROR; + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DESCEND)) < 0) + TEST_ERROR; - /* Close dataspace */ - if(H5Sclose(space) < 0) TEST_ERROR; + /* Verify the datatype retrieved and converted */ + if(H5Tget_order(native_type) != H5Tget_order(H5T_NATIVE_DOUBLE)) + TEST_ERROR; + if(H5Tget_size(native_type) < H5Tget_size(H5T_IEEE_F64BE)) + TEST_ERROR; + if(H5T_FLOAT != H5Tget_class(native_type)) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) TEST_ERROR; + if(H5Tclose(native_type) < 0) TEST_ERROR; + if(H5Tclose(dtype) < 0) TEST_ERROR; + + + /* Close dataspace */ + if(H5Sclose(space) < 0) TEST_ERROR; + + PASSED(); - PASSED(); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } return 0; - error: - return -1; +error: + return -1; } @@ -307,9 +298,9 @@ test_compound_dtype2(hid_t file) TESTING("nested compound datatype"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) + if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1))) TEST_ERROR; - if((check=calloc(sizeof(s1),DIM0*DIM1))==NULL) + if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1))) TEST_ERROR; /* Initialize the dataset */ @@ -317,9 +308,9 @@ test_compound_dtype2(hid_t file) for (j = 0; j < DIM1; j++,temp_point++) { temp_point->c = 't'; temp_point->i = n++; - temp_point->st.c2 = i+j; - temp_point->st.l2 = (i*5+j*50)*n; - temp_point->l = (i*10+j*100)*n; + temp_point->st.c2 = (short)(i + j); + temp_point->st.l2 = (i * 5 + j * 50) * n; + temp_point->l = (unsigned long_long)((i * 10 + j * 100) * n); } } @@ -554,16 +545,16 @@ test_compound_dtype(hid_t file) /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) + if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1))) TEST_ERROR; - if((check = calloc(sizeof(s1), DIM0 * DIM1)) == NULL) + if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1))) TEST_ERROR; /* Initialize the dataset */ for(i = n = 0, temp_point=points; i < DIM0; i++) for(j = 0; j < DIM1; j++,temp_point++) { temp_point->c = 't'; - temp_point->i = n++; + temp_point->i = (unsigned int)(n++); temp_point->l = (i*10+j*100)*n; } /* end for */ @@ -727,9 +718,9 @@ test_compound_dtype3(hid_t file) TESTING("compound datatype with array as field"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) + if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1))) TEST_ERROR; - if((check=calloc(sizeof(s1),DIM0*DIM1))==NULL) + if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1))) TEST_ERROR; /* Initialize the dataset */ @@ -925,9 +916,9 @@ test_compound_opaque(hid_t file) TESTING("compound datatype with opaque field"); /* Allocate space for the points & check arrays */ - if((points=HDmalloc(sizeof(s1)*DIM0*DIM1))==NULL) + if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1))) TEST_ERROR; - if((check=HDcalloc(sizeof(s1),DIM0*DIM1))==NULL) + if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1))) TEST_ERROR; /* Initialize the dataset */ @@ -936,7 +927,7 @@ test_compound_opaque(hid_t file) temp_point->c = 't'; temp_point->l = (i*10+j*100)*n; for(k = 0; k < 5; k++) - (temp_point->o)[k] = n++; + (temp_point->o)[k] = (unsigned char)(n++); } /* end for */ /* Create the data space */ @@ -1117,7 +1108,7 @@ test_enum_dtype(hid_t file) /* Initialize the dataset */ for(i = 0; i < DIM0; i++) for(j = 0, n = 0; j < DIM1; j++, n++) - spoints2[i][j] = (i*10+j*100+n)%8; + spoints2[i][j] = (short)((i * 10 + j * 100 + n) % 8); /* Create the data space */ dims[0] = DIM0; @@ -1128,7 +1119,7 @@ test_enum_dtype(hid_t file) if((tid = H5Tenum_create(H5T_STD_I16LE)) < 0) TEST_ERROR; for(i = 0; i < 8; i++) { - sub_colors[i * 2] = i; + sub_colors[i * 2] = (unsigned char)i; sub_colors[i * 2 + 1] = 0; if(H5Tenum_insert(tid, mname[i], &(sub_colors[i*2])) < 0) TEST_ERROR; } /* end for */ @@ -1141,7 +1132,7 @@ test_enum_dtype(hid_t file) if((tid_m = H5Tenum_create(H5T_NATIVE_SHORT)) < 0) TEST_ERROR; for(i = 0; i < 8; i++) { - colors[i] = i; + colors[i] = (short)i; if(H5Tenum_insert(tid_m, mname[i], &(colors[i])) < 0) TEST_ERROR; } /* end for */ @@ -1240,9 +1231,9 @@ test_array_dtype(hid_t file) TESTING("array of compound datatype"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*DIM0*DIM1*5))==NULL) + if(NULL == (points = (s1 *)HDmalloc(sizeof(s1) * DIM0 * DIM1 * 5))) TEST_ERROR; - if((check=calloc(sizeof(s1),DIM0*DIM1*5))==NULL) + if(NULL == (check = (s1 *)HDcalloc(sizeof(s1), DIM0 * DIM1 * 5))) TEST_ERROR; /* Initialize the dataset */ @@ -1307,7 +1298,7 @@ test_array_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); + tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)); if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -1429,7 +1420,7 @@ test_array_dtype2(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(DIM0 * DIM1 * H5Tget_size(native_type)); + tmp = HDmalloc(DIM0 * DIM1 * H5Tget_size(native_type)); if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) TEST_ERROR; @@ -1500,15 +1491,15 @@ test_vl_dtype(hid_t file) /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { - wdata[i].p=malloc((i+1)*sizeof(hvl_t)); + wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t)); if(wdata[i].p==NULL) { H5_FAILED(); printf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i); goto error; } /* end if */ wdata[i].len=i+1; - for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { - t1->p=malloc((j+1)*sizeof(unsigned int)); + for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) { + t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(t1->p==NULL) { H5_FAILED(); printf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j); @@ -1575,7 +1566,7 @@ test_vl_dtype(hid_t file) printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ - for(t1 = wdata[i].p, t2 = rdata[i].p, j = 0; j<rdata[i].len; j++, t1++, t2++) { + for(t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)rdata[i].p, j = 0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len != t2->len) { H5_FAILED(); printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); @@ -1584,8 +1575,8 @@ test_vl_dtype(hid_t file) /* use temporary buffer to convert datatype. This is for special * platforms like Cray */ - tmp=malloc(t2->len*sizeof(unsigned int)); - memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); + tmp = (void **)HDmalloc(t2->len * sizeof(unsigned int)); + HDmemcpy(tmp, t2->p, t2->len * H5Tget_size(nat_super_type)); if(H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; @@ -1878,135 +1869,124 @@ test_refer_dtype(hid_t file) hid_t sid1; /* Dataspace ID */ hid_t tid1, dtype, native_type; /* Datatype ID */ hsize_t dims1[] = {1}; + H5O_type_t obj_type; /* Object type */ hobj_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ - const char *envval = NULL; /* Output message about test being performed */ TESTING("reference datatype"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "multi")) { - H5O_type_t obj_type; /* Object type */ - /* Allocate write & read buffers */ - wbuf=HDmalloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))); - rbuf=HDmalloc(MAX(sizeof(unsigned),sizeof(hobj_ref_t))); + /* Allocate write & read buffers */ + wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t))); + rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t))); + + /* Create dataspace for datasets */ + if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) + TEST_ERROR; - /* Create dataspace for datasets */ - if((sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL)) < 0) - TEST_ERROR; + /* Create a group */ + if((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create a group */ - if((group = H5Gcreate2(file, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create a datatype to refer to */ + if((tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t))) < 0) + TEST_ERROR; - /* Create a datatype to refer to */ - if((tid1 = H5Tcreate (H5T_COMPOUND, sizeof(s1_t))) < 0) - TEST_ERROR; + /* Insert fields */ + if(H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT) < 0) + TEST_ERROR; - /* Insert fields */ - if(H5Tinsert (tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT) < 0) - TEST_ERROR; + if(H5Tinsert (tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0) + TEST_ERROR; - if(H5Tinsert (tid1, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0) - TEST_ERROR; + if(H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0) + TEST_ERROR; - if(H5Tinsert(tid1, "c", HOFFSET(s1_t, c), H5T_NATIVE_FLOAT) < 0) - TEST_ERROR; + /* Save datatype for later */ + if(H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR; - /* Save datatype for later */ - if(H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR; + /* Close datatype */ + if(H5Tclose(tid1) < 0) + TEST_ERROR; - /* Close datatype */ - if(H5Tclose(tid1) < 0) - TEST_ERROR; + /* Close group */ + if(H5Gclose(group) < 0) + TEST_ERROR; - /* Close group */ - if(H5Gclose(group) < 0) - TEST_ERROR; + /* Create a dataset */ + if((dataset = H5Dcreate2(file, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; - /* Create a dataset */ - if((dataset = H5Dcreate2(file, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR; + /* Create reference to named datatype */ + if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) + TEST_ERROR; + if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0) + TEST_ERROR; + if(obj_type != H5O_TYPE_NAMED_DATATYPE) + TEST_ERROR; - /* Create reference to named datatype */ - if(H5Rcreate(wbuf, file, "/Group1/Datatype1", H5R_OBJECT, -1) < 0) - TEST_ERROR; - if(H5Rget_obj_type2(dataset, H5R_OBJECT, wbuf, &obj_type) < 0) - TEST_ERROR; - if(obj_type != H5O_TYPE_NAMED_DATATYPE) - TEST_ERROR; + /* Write selection to disk */ + if(H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + TEST_ERROR; - /* Write selection to disk */ - if(H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - TEST_ERROR; + /* Close disk dataspace */ + if(H5Sclose(sid1) < 0) + TEST_ERROR; - /* Close disk dataspace */ - if(H5Sclose(sid1) < 0) - TEST_ERROR; + /* Close Dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR; - /* Close Dataset */ - if(H5Dclose(dataset) < 0) - TEST_ERROR; + /* Open the dataset */ + if((dataset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) + TEST_ERROR; - /* Open the dataset */ - if((dataset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) - TEST_ERROR; + /* Get datatype for dataset */ + if((dtype = H5Dget_type(dataset)) < 0) + TEST_ERROR; - /* Get datatype for dataset */ - if((dtype = H5Dget_type(dataset)) < 0) - TEST_ERROR; + /* Construct native type */ + if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) + TEST_ERROR; - /* Construct native type */ - if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - TEST_ERROR; + /* Check if the data type is equal */ + if(!H5Tequal(native_type, H5T_STD_REF_OBJ)) + TEST_ERROR; - /* Check if the data type is equal */ - if(!H5Tequal(native_type, H5T_STD_REF_OBJ)) - TEST_ERROR; + /* Read selection from disk */ + if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + TEST_ERROR; - /* Read selection from disk */ - if(H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - TEST_ERROR; + /* Open datatype object */ + if((tid1 = H5Rdereference(dataset, H5R_OBJECT, rbuf)) < 0) + TEST_ERROR; - /* Open datatype object */ - if((tid1 = H5Rdereference(dataset, H5R_OBJECT, rbuf)) < 0) - TEST_ERROR; + /* Verify correct datatype */ + if(H5Tget_class(tid1) != H5T_COMPOUND) + TEST_ERROR; - /* Verify correct datatype */ - if(H5Tget_class(tid1) != H5T_COMPOUND) - TEST_ERROR; + if(H5Tget_nmembers(tid1)!=3) + TEST_ERROR; - if(H5Tget_nmembers(tid1)!=3) - TEST_ERROR; + /* Close datatype */ + if(H5Tclose(tid1) < 0) + TEST_ERROR; - /* Close datatype */ - if(H5Tclose(tid1) < 0) - TEST_ERROR; + /* Close Dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR; - /* Close Dataset */ - if(H5Dclose(dataset) < 0) - TEST_ERROR; + /* Free memory buffers */ + free(wbuf); + free(rbuf); - /* Free memory buffers */ - free(wbuf); - free(rbuf); + PASSED(); - PASSED(); - } - else - { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } return 0; - error: - return -1; - +error: + return -1; } /* test_refer_dtype() */ @@ -2052,8 +2032,8 @@ test_refer_dtype2(hid_t file) TESTING("dataset region reference"); /* Allocate write & read buffers */ - dwbuf = malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - drbuf = calloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); + dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); /* Create dataspace for datasets */ if((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) @@ -2064,7 +2044,7 @@ test_refer_dtype2(hid_t file) TEST_ERROR; for(tu8 = dwbuf, i = 0; i < SPACE2_DIM1 * SPACE2_DIM2; i++) - *tu8++=i*3; + *tu8++ = (uint8_t)(i * 3); /* Write selection to disk */ if(H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf) < 0) diff --git a/test/objcopy.c b/test/objcopy.c index 86a0d30..aca041f 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -159,7 +159,7 @@ addr_insert(H5O_info_t *oi) /* Extend the table */ if(idtab_g.nobjs >= idtab_g.nalloc) { idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); - idtab_g.obj = HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); + idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0])); } /* end if */ /* Insert the entry */ @@ -485,7 +485,7 @@ test_copy_attach_attribute_vl(hid_t loc_id) buf[i].len = i*3+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = j+1; + ((int *)buf[i].p)[j] = (int)(j + 1); } /* end for */ if((aid = H5Acreate2(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -785,7 +785,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) unsigned i; /* Local index variable */ /* Compare the number of attributes */ - if(oinfo1.num_attrs != oinfo1.num_attrs) TEST_ERROR + if(oinfo1.num_attrs != oinfo2.num_attrs) TEST_ERROR /* Check the attributes are equal */ for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) { @@ -849,8 +849,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((base_tid = H5Tget_super(tid)) < 0) TEST_ERROR /* Loop over elements in buffers */ - vl_buf1 = buf1; - vl_buf2 = buf2; + vl_buf1 = (const hvl_t *)buf1; + vl_buf2 = (const hvl_t *)buf2; for(u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) { /* Check vlen lengths */ if(vl_buf1->len != vl_buf2->len) TEST_ERROR @@ -872,8 +872,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const hobj_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ - ref_buf1 = buf1; - ref_buf2 = buf2; + ref_buf1 = (const hobj_ref_t *)buf1; + ref_buf2 = (const hobj_ref_t *)buf2; for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */ @@ -928,8 +928,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, const hdset_reg_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */ /* Loop over elements in buffers */ - ref_buf1 = buf1; - ref_buf2 = buf2; + ref_buf1 = (const hdset_reg_ref_t *)buf1; + ref_buf2 = (const hdset_reg_ref_t *)buf2; for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) { hid_t obj1_id, obj2_id; /* IDs for objects referenced */ hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */ @@ -3495,7 +3495,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -3626,7 +3626,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -3763,7 +3763,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -4020,7 +4020,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) { for (j = 0; j < DIM_SIZE_2; j++) { - buf[i][j].len = j + 1; + buf[i][j].len = (size_t)(j + 1); buf[i][j].p = (int *)HDmalloc(buf[i][j].len * sizeof(int)); for (k = 0; k < (int)buf[i][j].len; k++) ((int *)buf[i][j].p)[k] = i * 10000 + j * 100 + k; @@ -5625,7 +5625,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl) addr_reset(); /* open source file (read-only) */ - if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* create destination file */ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR @@ -5706,7 +5706,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -5853,7 +5853,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -5994,7 +5994,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -6143,7 +6143,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl buf[i].len = i+1; buf[i].p = (int *)HDmalloc(buf[i].len * sizeof(int)); for(j = 0; j < buf[i].len; j++) - ((int *)buf[i].p)[j] = i*10+j; + ((int *)buf[i].p)[j] = (int)(i * 10 + j); } /* end for */ /* Initialize the filenames */ @@ -6296,7 +6296,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) return 1; } /* end if */ buf[i].len=i+1; - for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) { + for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) { tvl->p=HDmalloc((j+1)*sizeof(unsigned int)); if(tvl->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -6451,7 +6451,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) TEST_ERROR } /* end if */ buf[i].len=i+1; - for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) { + for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) { tvl->p=HDmalloc((j+1)*sizeof(unsigned int)); if(tvl->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -6606,7 +6606,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) TEST_ERROR } /* end if */ buf[i].len=i+1; - for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) { + for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) { tvl->p=HDmalloc((j+1)*sizeof(unsigned int)); if(tvl->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -6762,7 +6762,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) TEST_ERROR } /* end if */ buf[i].len=i+1; - for(tvl=buf[i].p,j=0; j<(i+1); j++, tvl++) { + for(tvl = (hvl_t *)buf[i].p,j=0; j<(i+1); j++, tvl++) { tvl->p=HDmalloc((j+1)*sizeof(unsigned int)); if(tvl->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -6998,9 +6998,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo if(attach_reg_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR /* create a dataset of region references */ -/* if(create_reg_ref_dataset(fid_src, gid_ref) < 0) TEST_ERROR -*/ /* Close group holding reference objects */ if(H5Gclose(gid_ref) < 0) TEST_ERROR @@ -7150,170 +7148,152 @@ error: int main(void) { - const char *envval; - - /* Don't run this test using the core, split, or multi file drivers */ - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - - if(HDstrcmp(envval, "stdio") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - int nerrors = 0; - hid_t fapl, fapl2; - hid_t fcpl_shared; - int configuration; /* Configuration of tests. */ - int ExpressMode; - - /* Setup */ - h5_reset(); - fapl = h5_fileaccess(); - - ExpressMode = GetTestExpress(); - if (ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); - - /* 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 - - /* Create an FCPL with sharing enabled */ - if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR - if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR - - /* Test in all configurations */ - for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) { - hid_t my_fapl; - hid_t fcpl_src; - hid_t fcpl_dst; - - /* Test with and without shared messages */ - if(configuration & CONFIG_SHARE_SRC) { - puts("\nTesting with shared src messages:"); - fcpl_src = fcpl_shared; - } - else { - puts("\nTesting without shared src messages:"); - fcpl_src = H5P_DEFAULT; - } - if(configuration & CONFIG_SHARE_DST) { - puts("Testing with shared dst messages:"); - fcpl_dst = fcpl_shared; - } - else { - puts("Testing without shared dst messages:"); - fcpl_dst = H5P_DEFAULT; - } - - /* Set the FAPL for the type of format */ - if(configuration & CONFIG_NEW_FORMAT) { - puts("Testing with new group format:"); - my_fapl = fapl2; - } /* end if */ - else { - puts("Testing with old group format:"); - my_fapl = fapl; - } /* end else */ - + int nerrors = 0; + hid_t fapl, fapl2; + hid_t fcpl_shared; + int configuration; /* Configuration of tests. */ + int ExpressMode; + + /* Setup */ + h5_reset(); + fapl = h5_fileaccess(); + + ExpressMode = GetTestExpress(); + if (ExpressMode > 1) + printf("***Express test mode on. Some tests may be skipped\n"); + + /* 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 + + /* Create an FCPL with sharing enabled */ + if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR + if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, (size_t) 10) < 0) TEST_ERROR + + /* Test in all configurations */ + for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) { + hid_t my_fapl; + hid_t fcpl_src; + hid_t fcpl_dst; + + /* Test with and without shared messages */ + if(configuration & CONFIG_SHARE_SRC) { + puts("\nTesting with shared src messages:"); + fcpl_src = fcpl_shared; + } + else { + puts("\nTesting without shared src messages:"); + fcpl_src = H5P_DEFAULT; + } + if(configuration & CONFIG_SHARE_DST) { + puts("Testing with shared dst messages:"); + fcpl_dst = fcpl_shared; + } + else { + puts("Testing without shared dst messages:"); + fcpl_dst = H5P_DEFAULT; + } - /* The tests... */ - nerrors += test_copy_named_datatype(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_named_datatype_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_named_datatype_vl_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_simple(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_simple_empty(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compound(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_chunked(fcpl_src, fcpl_dst, my_fapl); - - nerrors += test_copy_dataset_chunked_empty(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_chunked_sparse(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compressed(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compact(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_external(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_named_dtype(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_named_dtype_hier(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_named_dtype_hier_outside(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_multi_ohdr_chunks(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_attr_named_dtype(fcpl_src, fcpl_dst, my_fapl); - - nerrors += test_copy_dataset_contig_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_chunked_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compact_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compressed_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_attribute_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compact_named_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_contig_named_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_chunked_named_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compressed_named_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compact_vl_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_contig_vl_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_chunked_vl_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_dataset_compressed_vl_vl(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_group_empty(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_root_group(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_group(fcpl_src, fcpl_dst, my_fapl); - if (ExpressMode > 1 && !HDstrcmp(envval, "direct")) { - /* This test case with Direct driver has a poor performance on - * NCSA copper, though it works. Skip it for now and worry - * about the performance later. - */ - printf("***Express test mode on. test_copy_group_deep is skipped"); - SKIPPED(); - } else - nerrors += test_copy_group_deep(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_group_loop(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_group_wide_loop(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_group_links(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_soft_link(fcpl_src, fcpl_dst, my_fapl); + /* Set the FAPL for the type of format */ + if(configuration & CONFIG_NEW_FORMAT) { + puts("Testing with new group format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old group format:"); + my_fapl = fapl; + } /* end else */ + + + /* The tests... */ + nerrors += test_copy_named_datatype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_named_datatype_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_named_datatype_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_simple(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_simple_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compound(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked(fcpl_src, fcpl_dst, my_fapl); + + nerrors += test_copy_dataset_chunked_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_sparse(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_external(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype_hier(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_named_dtype_hier_outside(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_multi_ohdr_chunks(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_attr_named_dtype(fcpl_src, fcpl_dst, my_fapl); + + nerrors += test_copy_dataset_contig_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_attribute_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_contig_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_named_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compact_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_contig_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_chunked_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_dataset_compressed_vl_vl(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_empty(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_root_group(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_deep(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_loop(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_wide_loop(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_group_links(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_soft_link(fcpl_src, fcpl_dst, my_fapl); #ifndef H5_CANNOT_OPEN_TWICE - nerrors += test_copy_ext_link(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_ext_link(fcpl_src, fcpl_dst, my_fapl); #endif /* H5_CANNOT_OPEN_TWICE */ - nerrors += test_copy_exist(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_path(fcpl_src, fcpl_dst, my_fapl); - nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl); - nerrors += test_copy_old_layout(fcpl_dst, my_fapl); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG, - FALSE, "H5Ocopy(): without attributes"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, 0, TRUE, - "H5Ocopy(): with missing groups"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG, - FALSE, "H5Ocopy(): expand soft link"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, - FALSE, "H5Ocopy(): shallow group copy"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, - FALSE, "H5Ocopy(): expand object reference"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, - FALSE, "H5Ocopy(): preserve NULL messages"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG | - H5O_COPY_PRESERVE_NULL_FLAG, TRUE, "H5Ocopy(): preserve NULL messages"); + nerrors += test_copy_exist(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_path(fcpl_src, fcpl_dst, my_fapl); + nerrors += test_copy_same_file_named_datatype(fcpl_src, my_fapl); + nerrors += test_copy_old_layout(fcpl_dst, my_fapl); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG, + FALSE, "H5Ocopy(): without attributes"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, 0, TRUE, + "H5Ocopy(): with missing groups"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_SOFT_LINK_FLAG, + FALSE, "H5Ocopy(): expand soft link"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, + FALSE, "H5Ocopy(): shallow group copy"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, + FALSE, "H5Ocopy(): expand object reference"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_PRESERVE_NULL_FLAG, + FALSE, "H5Ocopy(): preserve NULL messages"); + nerrors += test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG | + H5O_COPY_PRESERVE_NULL_FLAG, TRUE, "H5Ocopy(): preserve NULL messages"); /* TODO: not implemented - nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy: expand external link"); - nerrors += test_copy_mount(my_fapl); - */ - } /* end for */ + nerrors += test_copy_option(my_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy: expand external link"); + nerrors += test_copy_mount(my_fapl); +*/ + } /* end for */ - /* Reset file address checking info */ - addr_reset(); + /* Reset file address checking info */ + addr_reset(); - /* Results */ - if(nerrors) { - printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", - nerrors, (1 == nerrors ? "" : "S")); - exit(1); - } /* end if */ + /* Results */ + if(nerrors) { + printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", + nerrors, (1 == nerrors ? "" : "S")); + exit(1); + } /* end if */ - puts ("All object copying tests passed."); + puts ("All object copying tests passed."); - h5_cleanup(FILENAME, fapl); - } /* end if */ - else - puts("All object copying tests skipped - Incompatible with current Virtual File Driver"); + h5_cleanup(FILENAME, fapl); return 0; error: return 1; } /* main */ + diff --git a/test/ohdr.c b/test/ohdr.c index 5d6542d..2d4f057 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -72,7 +72,6 @@ main(void) time_t time_new, ro; int i; hbool_t b; /* Index for "new format" loop */ - const char *envval = NULL; herr_t ret; /* Generic return value */ /* Reset library */ @@ -93,7 +92,7 @@ main(void) /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(NULL == (f = H5I_object(file))) FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR /* @@ -174,27 +173,18 @@ main(void) * works correctly - QAK) */ TESTING("close & re-open object header"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "multi") && HDstrcmp(envval, "split") && HDstrcmp(envval, "family")) { - if(H5O_close(&oh_loc) < 0) - FAIL_STACK_ERROR - if(H5Fclose(file) < 0) - FAIL_STACK_ERROR - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR - if(NULL == (f = H5I_object(file))) - FAIL_STACK_ERROR - oh_loc.file = f; - if(H5O_open(&oh_loc) < 0) - FAIL_STACK_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } /* end else */ + if(H5O_close(&oh_loc) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + oh_loc.file = f; + if(H5O_open(&oh_loc) < 0) + FAIL_STACK_ERROR + PASSED(); /* * Test creation of a bunch of messages one after another to see @@ -259,10 +249,7 @@ main(void) /* Test reading datasets with undefined object header messages */ HDputs("Accessing objects with unknown header messages:"); - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "multi") && HDstrcmp(envval, "split") && HDstrcmp(envval, "family")) { + { hid_t file2; /* File ID for 'bogus' object file */ char testpath[512] = ""; char testfile[512] = ""; @@ -282,7 +269,7 @@ main(void) TESTING("object with unknown header message and no flags set"); /* Open the file with objects that have unknown header messages (generated with gen_bogus.c) */ - if((file2 = H5Fopen(testfile, H5F_ACC_RDONLY, fapl)) < 0) + if((file2 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open the dataset with the unknown header message, but no extra flags */ @@ -372,11 +359,7 @@ main(void) TEST_ERROR PASSED(); - } /* end if */ - else { - SKIPPED(); - puts(" Test not compatible with current Virtual File Driver"); - } /* end else */ + } /* Close the file we created */ if(H5Fclose(file) < 0) diff --git a/test/reserved.c b/test/reserved.c index a6e8882..bb6d328 100755 --- a/test/reserved.c +++ b/test/reserved.c @@ -423,6 +423,8 @@ main(void) { /* This test is currently not working properly; it should be revisted * when we have time. + * + * (Also, we should try to make this test work with all the VFDs) */ #ifdef BROKEN int num_errs=0; diff --git a/test/stab.c b/test/stab.c index 56a5571..9ce3cfe 100644 --- a/test/stab.c +++ b/test/stab.c @@ -657,7 +657,7 @@ error: *------------------------------------------------------------------------- */ static int -read_old(hid_t fapl2) +read_old(void) { int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */ hid_t fid = (-1); /* File ID */ @@ -681,7 +681,7 @@ read_old(hid_t fapl2) HDstrcat(filename, FILE_OLD_GROUPS); /* Create filename */ - h5_fixname(FILENAME[0], fapl2, filename2, sizeof(filename2)); + h5_fixname(FILENAME[0], H5P_DEFAULT, filename2, sizeof(filename2)); /* Copy old file into temporary file */ if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) TEST_ERROR @@ -697,7 +697,7 @@ read_old(hid_t fapl2) /* Open copied file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR /* Attempt to open "old" group */ if((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0) TEST_ERROR @@ -1103,58 +1103,50 @@ error: int main(void) { - 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") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - hid_t fapl, fapl2; /* File access property list IDs */ - hbool_t new_format; /* Whether to use the new format or not */ - int nerrors = 0; - - /* Reset library */ - h5_reset(); - fapl = h5_fileaccess(); - - /* 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 - - /* Loop over using new group format */ - for(new_format = FALSE; new_format <= TRUE; new_format++) { - /* Perform basic tests, with old & new style groups */ - nerrors += test_misc((new_format ? fapl2 : fapl), new_format); - nerrors += test_long((new_format ? fapl2 : fapl), new_format); - nerrors += test_large((new_format ? fapl2 : fapl), new_format); - } /* end for */ - - /* New format group specific tests (require new format features) */ - nerrors += lifecycle(fapl2); - nerrors += long_compact(fapl2); - nerrors += read_old(fapl2); - nerrors += no_compact(fapl2); - nerrors += gcpl_on_root(fapl2); - - /* Old group API specific tests */ - nerrors += old_api(fapl); - - /* Close 2nd FAPL */ - H5Pclose(fapl2); - - /* Check for test errors */ - if(nerrors) - goto error; - - /* Cleanup */ - puts("All symbol table tests passed."); - h5_cleanup(FILENAME, fapl); - } /* end if */ - else - puts("All symbol table tests skipped - Incompatible with current Virtual File Driver"); + hid_t fapl, fapl2; /* File access property list IDs */ + hbool_t new_format; /* Whether to use the new format or not */ + int nerrors = 0; + + /* Reset library */ + h5_reset(); + fapl = h5_fileaccess(); + + /* 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 + + /* Loop over using new group format */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + /* Perform basic tests, with old & new style groups */ + nerrors += test_misc((new_format ? fapl2 : fapl), new_format); + nerrors += test_long((new_format ? fapl2 : fapl), new_format); + nerrors += test_large((new_format ? fapl2 : fapl), new_format); + } /* end for */ + + /* New format group specific tests (require new format features) */ + nerrors += lifecycle(fapl2); + nerrors += long_compact(fapl2); + nerrors += read_old(); + nerrors += no_compact(fapl2); + nerrors += gcpl_on_root(fapl2); + + /* Old group API specific tests */ + nerrors += old_api(fapl); + + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + /* Check for test errors */ + if(nerrors) + goto error; + + puts("All symbol table tests passed."); + + /* Cleanup */ + h5_cleanup(FILENAME, fapl); + return 0; error: diff --git a/test/unlink.c b/test/unlink.c index e03323f..60d6ac5 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -525,16 +525,6 @@ test_filespace(hid_t fapl) size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; - const char *envval = NULL; - int ExpressMode; - - /* Don't run some tests for some drivers */ - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - - /* See if some tests can be skipped */ - ExpressMode = GetTestExpress(); puts("Testing file space gets reused:"); @@ -982,92 +972,83 @@ test_filespace(hid_t fapl) /* Create complex group hiearchy, remove it & verify file size */ TESTING(" complex group hierarchy"); - if (ExpressMode > 1 && !HDstrcmp(envval, "direct")) { - /* This test case with Direct driver has a poor performance on - * NCSA copper, though it works. Skip it for now and worry - * about the performance later. - */ - SKIPPED(); - } else { + /* Create file */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Create file */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + /* Create a complex group hierarchy to remove */ + for(u = 0; u < FILESPACE_TOP_GROUPS; u++) { + /* Create group */ + sprintf(objname,"%s %u",GROUPNAME,u); + if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create a complex group hierarchy to remove */ - for(u = 0; u < FILESPACE_TOP_GROUPS; u++) { + /* Create nested groups inside top groups */ + for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - sprintf(objname,"%s %u",GROUPNAME,u); - if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Create nested groups inside top groups */ - for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { - /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); - if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Create datasets inside nested groups */ - for(w = 0; w < FILESPACE_NDATASETS; w++) { - /* Create & close a dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); - if((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR - } /* end for */ - - /* Close nested group */ - if(H5Gclose(group2) < 0) FAIL_STACK_ERROR + sprintf(objname, "%s %u", GROUP2NAME, v); + if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Create datasets inside nested groups */ + for(w = 0; w < FILESPACE_NDATASETS; w++) { + /* Create & close a dataset */ + sprintf(objname, "%s %u", DATASETNAME, w); + if((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close top group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR + /* Close nested group */ + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR } /* end for */ - /* Remove complex group hierarchy */ - /* (Remove them in reverse order just to make file size calculation easier -QAK) */ - for(u = FILESPACE_TOP_GROUPS; u > 0; u--) { - /* Open group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); - if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Open nested groups inside top groups */ - for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { - /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); - if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Remove datasets inside nested groups */ - for(w = 0; w < FILESPACE_NDATASETS; w++) { - /* Remove dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); - if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - } /* end for */ - - /* Close nested group */ - if(H5Gclose(group2) < 0) FAIL_STACK_ERROR - - /* Remove nested group */ - sprintf(objname, "%s %u",GROUP2NAME, v); - if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Close top group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + } /* end for */ + + /* Remove complex group hierarchy */ + /* (Remove them in reverse order just to make file size calculation easier -QAK) */ + for(u = FILESPACE_TOP_GROUPS; u > 0; u--) { + /* Open group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Open nested groups inside top groups */ + for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { + /* Create group */ + sprintf(objname, "%s %u", GROUP2NAME, v); + if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Remove datasets inside nested groups */ + for(w = 0; w < FILESPACE_NDATASETS; w++) { + /* Remove dataset */ + sprintf(objname, "%s %u", DATASETNAME, w); + if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close top group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR + /* Close nested group */ + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR - /* Remove top group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); - if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Remove nested group */ + sprintf(objname, "%s %u",GROUP2NAME, v); + if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close file */ - if(H5Fclose(file) < 0) FAIL_STACK_ERROR + /* Close top group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR - /* Get the size of the file */ - if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Remove top group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ - /* Verify the file is correct size */ - if(file_size != empty_size) TEST_ERROR + /* Close file */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - } + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + + /* Verify the file is correct size */ + if(file_size != empty_size) TEST_ERROR + + PASSED(); /* Create dataset and duplicate dataset, remove original & verify file size */ @@ -2411,132 +2392,123 @@ error: int main(void) { - const char *envval = NULL; - - /* Don't run this test using the wrong file drivers */ - envval = HDgetenv("HDF5_DRIVER"); - if(envval == NULL) - envval = "nomatch"; - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - hid_t fapl, fapl2, file; - int nerrors = 0; - char filename[1024]; - hbool_t new_format; - - /* Metadata cache parameters */ - int mdc_nelmts; - size_t rdcc_nelmts; - size_t rdcc_nbytes; - double rdcc_w0; - - /* Set the random # seed */ - HDsrandom((unsigned long)HDtime(NULL)); - - /* Open */ - h5_reset(); - fapl = h5_fileaccess(); - - /* 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 - - /* Test with old & new format groups */ - 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 group format:"); - my_fapl = fapl2; - } /* end if */ - else { - puts("Testing with old group format:"); - my_fapl = fapl; - } /* end else */ - - h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - - /* Tests */ - nerrors += test_one(file); - nerrors += test_many(file); - nerrors += test_symlink(file); - nerrors += test_rename(file); - - nerrors += test_new_move(my_fapl); - nerrors += check_new_move(my_fapl); - nerrors += test_filespace(my_fapl); - - /* Test creating & unlinking lots of objects with default FAPL */ - nerrors += test_create_unlink("create and unlink large number of objects", my_fapl); - - { - hid_t fapl_small_mdc; - - /* Make copy of regular fapl, to turn down the elements in the metadata cache */ - if((fapl_small_mdc = H5Pcopy(my_fapl)) < 0) - goto error; - - /* Get FAPL cache settings */ - if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - printf("H5Pget_cache failed\n"); - - /* Change FAPL cache settings */ - mdc_nelmts=1; - if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - printf("H5Pset_cache failed\n"); - - /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */ - nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc); - - if(H5Pclose(fapl_small_mdc) < 0) TEST_ERROR - } /* end block */ - - nerrors += test_link_slashes(my_fapl); - nerrors += test_unlink_slashes(my_fapl); - - /* Test specific B-tree removal issues */ - /* (only for old format groups) */ - if(!new_format) { - nerrors += test_unlink_rightleaf(file); - nerrors += test_unlink_rightnode(file); - nerrors += test_unlink_middlenode(file); - } /* end if */ - - /* Test "resurrecting" objects */ - nerrors += test_resurrect_dataset(my_fapl); - nerrors += test_resurrect_datatype(my_fapl); - nerrors += test_resurrect_group(my_fapl); - - /* Test unlinking chunked datasets */ - nerrors += test_unlink_chunked_dataset(my_fapl); - - /* Test unlinked groups which still have objects in them */ - /* (only for new format groups) */ - if(new_format) { - nerrors += test_full_group_compact(my_fapl); - nerrors += test_full_group_dense(my_fapl); - } /* end if */ - - /* Close */ - if(H5Fclose(file) < 0) TEST_ERROR - } /* end for */ + hid_t fapl, fapl2, file; + int nerrors = 0; + char filename[1024]; + hbool_t new_format; + + /* Metadata cache parameters */ + int mdc_nelmts; + size_t rdcc_nelmts; + size_t rdcc_nbytes; + double rdcc_w0; + + /* Set the random # seed */ + HDsrandom((unsigned long)HDtime(NULL)); + + /* Open */ + h5_reset(); + fapl = h5_fileaccess(); + + /* Copy the file access property list */ + if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Close 2nd FAPL */ - H5Pclose(fapl2); + /* 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 - if (nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); - exit(1); - } + /* Test with old & new format groups */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; - puts("All unlink tests passed."); - h5_cleanup(FILENAME, fapl); + /* Set the FAPL for the type of format */ + if(new_format) { + puts("\nTesting with new group format:"); + my_fapl = fapl2; + } /* end if */ + else { + puts("Testing with old group format:"); + my_fapl = fapl; + } /* end else */ + + h5_fixname(FILENAME[0], my_fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + + /* Tests */ + nerrors += test_one(file); + nerrors += test_many(file); + nerrors += test_symlink(file); + nerrors += test_rename(file); + + nerrors += test_new_move(my_fapl); + nerrors += check_new_move(my_fapl); + nerrors += test_filespace(my_fapl); + + /* Test creating & unlinking lots of objects with default FAPL */ + nerrors += test_create_unlink("create and unlink large number of objects", my_fapl); + + { + hid_t fapl_small_mdc; + + /* Make copy of regular fapl, to turn down the elements in the metadata cache */ + if((fapl_small_mdc = H5Pcopy(my_fapl)) < 0) + goto error; + + /* Get FAPL cache settings */ + if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) + printf("H5Pget_cache failed\n"); + + /* Change FAPL cache settings */ + mdc_nelmts=1; + if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) + printf("H5Pset_cache failed\n"); + + /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */ + nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc); + + if(H5Pclose(fapl_small_mdc) < 0) TEST_ERROR + } /* end block */ + + nerrors += test_link_slashes(my_fapl); + nerrors += test_unlink_slashes(my_fapl); + + /* Test specific B-tree removal issues */ + /* (only for old format groups) */ + if(!new_format) { + nerrors += test_unlink_rightleaf(file); + nerrors += test_unlink_rightnode(file); + nerrors += test_unlink_middlenode(file); + } /* end if */ + + /* Test "resurrecting" objects */ + nerrors += test_resurrect_dataset(my_fapl); + nerrors += test_resurrect_datatype(my_fapl); + nerrors += test_resurrect_group(my_fapl); + + /* Test unlinking chunked datasets */ + nerrors += test_unlink_chunked_dataset(my_fapl); + + /* Test unlinked groups which still have objects in them */ + /* (only for new format groups) */ + if(new_format) { + nerrors += test_full_group_compact(my_fapl); + nerrors += test_full_group_dense(my_fapl); + } /* end if */ + + /* Close */ + if(H5Fclose(file) < 0) TEST_ERROR + } /* end for */ + + /* Close 2nd FAPL */ + H5Pclose(fapl2); + + if (nerrors) { + printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); + exit(1); } - else - puts("All unlink tests skipped - Incompatible with current Virtual File Driver"); + + puts("All unlink tests passed."); + + h5_cleanup(FILENAME, fapl); return 0; |