diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/chunk_info.c | 72 | ||||
-rw-r--r-- | test/dtypes.c | 4 | ||||
-rw-r--r-- | test/external.c | 358 | ||||
-rw-r--r-- | test/h5test.c | 3 | ||||
-rw-r--r-- | test/test_usecases.sh.in | 31 | ||||
-rw-r--r-- | test/testflushrefresh.sh.in | 25 | ||||
-rw-r--r-- | test/testswmr.sh.in | 11 | ||||
-rw-r--r-- | test/testvdsswmr.sh.in | 13 | ||||
-rw-r--r-- | test/tfile.c | 1 | ||||
-rw-r--r-- | test/vfd.c | 133 |
10 files changed, 420 insertions, 231 deletions
diff --git a/test/chunk_info.c b/test/chunk_info.c index d3e5751..057991c 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -43,7 +43,9 @@ #include "H5Dpkg.h" #include "testhdf5.h" +#ifdef H5_HAVE_FILTER_DEFLATE #include "zlib.h" +#endif /* Test file names, using H5F_libver_t as indices */ const char *FILENAME[] = { @@ -51,6 +53,7 @@ const char *FILENAME[] = { "tchunk_info_v18", "tchunk_info_v110", "tchunk_info_v112", + "tchunk_info_v114", NULL }; @@ -467,7 +470,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) hid_t dset = H5I_INVALID_HID; /* Dataset ID */ hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* Data chunk */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */ hsize_t out_offset[2]; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -480,11 +483,13 @@ test_get_chunk_info_highest_v18(hid_t fapl) int fillvalue = -1; /* Fill value */ int aggression = 9; /* Compression aggression setting */ hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ +#ifdef H5_HAVE_FILTER_DEFLATE const Bytef *z_src = (const Bytef*)(direct_buf); Bytef *z_dst; /*destination buffer */ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); uLong z_src_nbytes = (uLong)CHK_SIZE; - void *outbuf = NULL; /* Pointer to new buffer */ +#endif /* end H5_HAVE_FILTER_DEFLATE */ + void *inbuf = NULL; /* Pointer to new buffer */ hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */ hsize_t ii, jj; /* Array indices */ int n; /* Used as chunk index, but int to avoid conversion warning */ @@ -523,16 +528,19 @@ test_get_chunk_info_highest_v18(hid_t fapl) dset = H5Dcreate2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = (int)(ii*jj) + 1; + /* Initialize a chunk of data */ + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[ii][jj] = (int)(ii*jj) + 1; #ifdef H5_HAVE_FILTER_DEFLATE - /* Allocate output (compressed) buffer */ - outbuf = malloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; + /* Allocate input (compressed) buffer */ + inbuf = malloc(z_dst_nbytes); + + /* Set chunk size to the compressed chunk size and the chunk point + to the compressed data chunk */ + chunk_size = (hsize_t)z_dst_nbytes; + z_dst = (Bytef *)inbuf; /* Perform compression from the source to the destination buffer */ ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); @@ -548,6 +556,10 @@ test_get_chunk_info_highest_v18(hid_t fapl) fprintf(stderr, "other deflate error"); TEST_ERROR } +#else + /* Allocate input (non-compressed) buffer */ + inbuf = malloc(CHK_SIZE); + HDmemcpy(inbuf, direct_buf, CHK_SIZE); #endif /* end H5_HAVE_FILTER_DEFLATE */ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: @@ -555,21 +567,15 @@ test_get_chunk_info_highest_v18(hid_t fapl) n = 0; for(ii = START_CHK_X; ii < END_CHK_X; ii++) for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { - -#ifdef H5_HAVE_FILTER_DEFLATE - /* Set chunk size to the compressed chunk size and the chunk point - to the compressed data chunk */ - chunk_size = (hsize_t)z_dst_nbytes; -#endif /* end H5_HAVE_FILTER_DEFLATE */ offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)outbuf); + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)inbuf); if(ret < 0) TEST_ERROR } - /* Free the read buffer */ - if(outbuf) - HDfree(outbuf); + /* Free the input buffer */ + if(inbuf) + HDfree(inbuf); if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR @@ -781,7 +787,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -835,7 +841,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify info of the first and only chunk */ if(verify_get_chunk_info(dset, H5S_ALL, 0, SINGLE_CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at logical coordinates (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -907,7 +913,7 @@ test_chunk_info_implicit(char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -979,7 +985,7 @@ error: H5_FAILED(); return FAIL; } /* test_chunk_info_implicit() */ - + /*------------------------------------------------------------------------- * Function: test_chunk_info_fixed_array * @@ -1024,7 +1030,7 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR @@ -1110,7 +1116,7 @@ error: H5_FAILED(); return FAIL; } /* test_chunk_info_fixed_array() */ - + /*------------------------------------------------------------------------- * Function: test_chunk_info_extensible_array * @@ -1156,7 +1162,7 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR @@ -1293,7 +1299,7 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR @@ -1470,7 +1476,7 @@ test_basic_query(hid_t fapl) /* Get and verify info of the first and only chunk */ if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (CHUNK_NX,CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -1499,7 +1505,7 @@ test_basic_query(hid_t fapl) offset should be (0,0) */ if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); @@ -1510,12 +1516,12 @@ test_basic_query(hid_t fapl) offset[1] = CHUNK_NY; if(verify_get_chunk_info(dset, H5S_ALL, 1, CHK_SIZE, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - + /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); - /* Get and verify info of an empty chunk, at offset + /* Get and verify info of an empty chunk, at offset (2*CHUNK_NX, 2*CHUNK_NY) */ offset[0] = 2*CHUNK_NX; offset[1] = 2*CHUNK_NY; @@ -1586,7 +1592,7 @@ test_failed_attempts(const char *filename, hid_t fapl) /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - + /* Create dataspace */ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR diff --git a/test/dtypes.c b/test/dtypes.c index 5eaa77c..4ccb951 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -7650,8 +7650,8 @@ test_versionbounds(void) hsize_t arr_dim[] = {ARRAY_LEN}; /* Length of the array */ int i, j; /* Indices for iterating over versions */ H5F_libver_t low, high; /* File format bounds */ - H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110}; - int versions_count = 3; /* Number of version bounds in the array */ + H5F_libver_t versions[] = {H5F_LIBVER_EARLIEST, H5F_LIBVER_V18, H5F_LIBVER_V110, H5F_LIBVER_V112, H5F_LIBVER_V114}; + int versions_count = 5; /* Number of version bounds in the array */ unsigned highest_version; /* Highest version in nested datatypes */ color_t enum_val; /* Enum type index */ herr_t ret = 0; /* Generic return value */ diff --git a/test/external.c b/test/external.c index 6c12c93..e2565de 100644 --- a/test/external.c +++ b/test/external.c @@ -15,7 +15,7 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" #include "external_fname.h" @@ -27,7 +27,7 @@ * Purpose: Determines whether two files contain the same data. * * Return: Success: nonzero if same, zero if different. - * Failure: zero + * Failure: zero * * Programmer: Robb Matzke * Wednesday, March 4, 1998 @@ -37,14 +37,17 @@ static hbool_t files_have_same_contents(const char *name1, const char *name2) { - int fd1 = 0, fd2 = 0; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0; + int fd2 = 0; + ssize_t n1 = 0; + ssize_t n2 = 0; + char buf1[1024]; + char buf2[1024]; hbool_t ret = FALSE; /* not equal until proven otherwise */ - if((fd1 = HDopen(name1, O_RDONLY)) < 0) + if ((fd1 = HDopen(name1, O_RDONLY)) < 0) goto out; - if((fd2 = HDopen(name2, O_RDONLY)) < 0) + if ((fd2 = HDopen(name2, O_RDONLY)) < 0) goto out; /* Loop until files are empty or we encounter a problem */ @@ -97,23 +100,21 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ - haddr_t dset_addr; /* address of dataset */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {100}; /* data space maximum size */ + int n = 0; /* number of external files */ + off_t file_offset = 0; /* external file offset */ + hsize_t file_size = 0; /* sizeof external file segment */ + haddr_t dset_addr = HADDR_UNDEF; /* address of dataset */ TESTING("fixed-size data space, exact storage"); - /* Create the dataset */ + /* Create the dataset and close */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) @@ -148,27 +149,23 @@ test_non_extendible(hid_t file) HDputs(" Returned external count is wrong."); HDprintf(" got: %d\n ans: 1\n", n); goto error; - } /* end if */ + } - HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + /* Verify external file settings */ + if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0) FAIL_STACK_ERROR - - /* Check file offset */ if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; - } /* end if */ - - /* Check file size */ + } if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); HDputs(" Wrong file size."); HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); goto error; - } /* end if */ + } /* Done (dataspace was previously closed) */ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR @@ -195,7 +192,7 @@ test_non_extendible(hid_t file) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -203,18 +200,17 @@ test_non_extendible(hid_t file) static int test_too_small(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {100}; /* maximum data space size */ TESTING("external storage is too small"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -249,10 +245,10 @@ test_too_small(hid_t file) * represent the current data and large enough to represent the * eventual size of the data. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -260,18 +256,16 @@ test_too_small(hid_t file) static int test_large_enough_current_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {200}; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = 200; if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) @@ -313,19 +307,17 @@ error: static int test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* current data space size */ + hsize_t max_size[1] = {200}; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) /* note -1 */ FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -369,15 +361,14 @@ test_large_enough_current_not_eventual(hid_t file) static int test_unlimited(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {H5S_UNLIMITED}; /* data space maximum size */ + int n; /* number of external files */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); @@ -386,8 +377,6 @@ test_unlimited(hid_t file) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR - cur_size[0] = 100; - max_size[0] = H5S_UNLIMITED; if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) @@ -411,22 +400,20 @@ test_unlimited(hid_t file) goto error; } /* end if */ - HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + if(H5Pget_external(dcpl, 0, 0, NULL, &file_offset, &file_size) < 0) FAIL_STACK_ERROR if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; - } /* end if */ - + } if(H5F_UNLIMITED != file_size) { H5_FAILED(); HDputs(" Wrong file size."); HDprintf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; - } /* end if */ + } if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR @@ -460,35 +447,67 @@ test_unlimited(hid_t file) static int test_multiple_files(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* dataspace */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1] = {100}; /* data space current size */ + hsize_t max_size[1] = {100}; /* data space maximum size */ + hsize_t max_ext_size; /* maximum size of external files */ + unsigned n_external_files = 4; TESTING("multiple external files"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - cur_size[0] = max_size[0] = 100; + max_ext_size = (hsize_t)(sizeof(int) * max_size[0] / n_external_files); + + for (unsigned i = 0; i < n_external_files; i++) { + char exname[9] = ""; + HDsnprintf(exname, 9, "ext%d.data", i+1); + if (H5Pset_external(dcpl, exname, (off_t)0, max_ext_size) < 0) { + HDfprintf(stderr, "Problem adding external file %s\n", exname); + fflush(stderr); + FAIL_STACK_ERROR + } + } - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) - FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR + if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + /* Re-use space below */ + + /* ---------------------------------------------- + * Verify that too-small external files will fail + */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + + max_ext_size -= 1; + + for (unsigned i = 0; i < n_external_files; i++) { + char exname[9] = ""; + HDsnprintf(exname, 9, "ext%d.data", i+1); + if (H5Pset_external(dcpl, exname, (off_t)0, max_ext_size) < 0) { + HDfprintf(stderr, "Problem adding external file %s\n", exname); + fflush(stderr); + FAIL_STACK_ERROR + } + } /* end for each external file */ + + H5E_BEGIN_TRY { + dset = H5Dcreate2(file, "dset7", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + } H5E_END_TRY; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external files succeeded instead of failing."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -520,9 +539,9 @@ error: static int test_add_to_unlimited(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status = FAIL; /* function return status */ + int n = 0; /* number of external files */ TESTING("external file following unlimited file"); @@ -571,12 +590,12 @@ test_add_to_unlimited(void) static int test_overflow(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status = FAIL; /* return status */ TESTING("address overflow in external files"); - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR @@ -616,19 +635,19 @@ test_overflow(void) static int test_read_file_set(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hid_t grp = -1; /* group to emit diagnostics */ - size_t i; /* miscellaneous counter */ - char filename[1024]; /* file names */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + size_t i = 0; /* miscellaneous counter */ + char filename[1024]; /* file names */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - hid_t hs_space = -1; /* hyperslab data space */ - hsize_t hs_start = 30; /* hyperslab starting offset */ - hsize_t hs_count = 25; /* hyperslab size */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space = -1; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ TESTING("read external dataset"); @@ -657,7 +676,7 @@ test_read_file_set(hid_t fapl) HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) FAIL_STACK_ERROR - } /* end for */ + } /* Create the dataspace */ cur_size = TOTAL_SIZE; @@ -734,19 +753,19 @@ test_read_file_set(hid_t fapl) static int test_write_file_set(hid_t fapl) { - hid_t file = -1; /* file to which to write */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t mem_space = -1; /* memory data space */ - hid_t file_space = -1; /* file data space */ - hid_t dset = -1; /* dataset */ - unsigned i; /* miscellaneous counter */ - int part[PART_SIZE]; /* raw data buffer (partial) */ - int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size = 100; /* current data space size */ - hsize_t max_size = 200; /* maximum data space size */ - hsize_t hs_start = 100; /* hyperslab starting offset */ - hsize_t hs_count = 100; /* hyperslab size */ - char filename[1024]; /* file name */ + hid_t file = -1; /* file to which to write */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t mem_space = -1; /* memory data space */ + hid_t file_space = -1; /* file data space */ + hid_t dset = -1; /* dataset */ + unsigned i = 0; /* miscellaneous counter */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size = 100; /* current data space size */ + hsize_t max_size = 200; /* maximum data space size */ + hsize_t hs_start = 100; /* hyperslab starting offset */ + hsize_t hs_count = 100; /* hyperslab size */ + char filename[1024]; /* file name */ TESTING("write external dataset"); @@ -859,16 +878,16 @@ test_write_file_set(hid_t fapl) static int test_path_absolute(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counter */ - char cwdpath[1024]; /* working directory */ - char filename[1536]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + size_t i = 0; /* miscellaneous counter */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ + hsize_t cur_size; /* current data space size */ TESTING("absolute filenames for external file"); @@ -949,16 +968,16 @@ error: static int test_path_relative(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + size_t i = 0; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ + hsize_t cur_size; /* current data space size */ TESTING("filenames relative to current directory for external file"); @@ -1039,21 +1058,21 @@ error: static int test_path_relative_cwd(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dapl = -1; /* dataset access property list */ - hid_t dapl2 = -1; /* copy of dapl */ - hid_t dset = -1; /* dataset */ - hid_t dset2 = -1; /* dataset, opened a second time */ - hid_t dset3 = -1; /* dataset, opened with different prefix */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dapl2 = -1; /* copy of dapl */ + hid_t dset = -1; /* dataset */ + hid_t dset2 = -1; /* dataset, opened a second time */ + hid_t dset3 = -1; /* dataset, opened with different prefix */ + size_t i = 0; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - char buffer[1024]; /* buffer to read efile_prefix */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ TESTING("filenames relative to HDF5 file for external file"); @@ -1195,14 +1214,14 @@ error: static int test_h5d_get_access_plist(hid_t fapl_id) { - hid_t fid = -1; /* file to write to */ - hid_t dcpl_id = -1; /* dataset creation properties */ - hid_t dapl_id = -1; /* dataset access properties */ - hid_t sid = -1; /* data space */ - hid_t did = -1; /* dataset */ - hsize_t dims = 0; /* dataset size */ - char *buffer = NULL; /* saved prefix name from dapl */ - char filename[1024]; /* file names */ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id = -1; /* dataset access properties */ + hid_t sid = -1; /* data space */ + hid_t did = -1; /* dataset */ + hsize_t dims = 0; /* dataset size */ + char *buffer = NULL; /* saved prefix name from dapl */ + char filename[1024]; /* file names */ TESTING("H5Dget_access_plist() returns correct prefix"); @@ -1285,7 +1304,7 @@ test_h5d_get_access_plist(hid_t fapl_id) * * Return: EXIT_SUCCESS/EXIT_FAILURE * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 3, 1998 * *------------------------------------------------------------------------- @@ -1293,13 +1312,13 @@ test_h5d_get_access_plist(hid_t fapl_id) int main(void) { - hid_t fapl_id_old = -1; /* file access properties (old format) */ - hid_t fapl_id_new = -1; /* file access properties (new format) */ - hid_t fid = -1; /* file for test_1* functions */ - hid_t gid = -1; /* group to emit diagnostics */ - char filename[1024]; /* file name for test_1* funcs */ - unsigned latest_format; /* default or latest file format */ - int nerrors = 0; /* number of errors */ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ + hid_t fid = -1; /* file for test_1* functions */ + hid_t gid = -1; /* group to emit diagnostics */ + char filename[1024]; /* file name for test_1* funcs */ + unsigned latest_format; /* default or latest file format */ + int nerrors = 0; /* number of errors */ h5_reset(); @@ -1325,11 +1344,11 @@ main(void) if(latest_format) { HDputs("\nTesting with the latest file format:"); current_fapl_id = fapl_id_new; - } /* end if */ + } else { HDputs("Testing with the default file format:"); current_fapl_id = fapl_id_old; - } /* end else */ + } /* Create the common file used by some of the tests */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, current_fapl_id)) < 0) @@ -1365,7 +1384,7 @@ main(void) /* Close the common file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - } /* end for */ + } /* end for old and new format */ if(nerrors > 0) goto error; @@ -1387,7 +1406,7 @@ main(void) HDremove("extern_4w.raw"); HDrmdir("extern_dir"); - } /* end if */ + } return EXIT_SUCCESS; @@ -1402,3 +1421,4 @@ error: HDprintf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ + diff --git a/test/h5test.c b/test/h5test.c index dd8d906..c8f4132 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -106,7 +106,8 @@ const char *LIBVER_NAMES[] = { "earliest", /* H5F_LIBVER_EARLIEST = 0 */ "v18", /* H5F_LIBVER_V18 = 1 */ "v110", /* H5F_LIBVER_V110 = 2 */ - "latest", /* H5F_LIBVER_V112 = 3 */ + "v112", /* H5F_LIBVER_V112 = 3 */ + "latest", /* H5F_LIBVER_V114 = 4 */ NULL }; diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index 8bc2078..49868ca 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -40,7 +40,7 @@ fi # Define symbols EXIT_SUCCESS=0 EXIT_FAILURE=1 -EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed +EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed RESULT_PASSED=" PASSED" RESULT_FAILED="*FAILED*" RESULT_SKIP="-SKIP-" @@ -97,17 +97,17 @@ TOOLTEST() { cat $actual_err >> $actual if [ $exit_code -eq 0 ];then - echo "$RESULT_PASSED" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_PASSED" + test yes = "$verbose" && sed 's/^/ /' < $actual else - echo "$RESULT_FAILED" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_FAILED" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && sed 's/^/ /' < $actual fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -122,7 +122,9 @@ for FILE in use_*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE usecases_test + if test -f "$FILE" ; then + cp $FILE usecases_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -131,7 +133,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/use_append_chunk ]; then mkdir usecases_test/.libs - cp .libs/use_* usecases_test/.libs + for FILE in .libs/use_*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE usecases_test/.libs + fi + done cp .libs/twriteorder usecases_test/.libs fi @@ -176,10 +185,10 @@ for p in $USECASES_PROGRAMS; do TOOLTEST ./$p -l w TOOLTEST ./$p -l r # use case 1.9, testing with multi-planes chunks - TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks + TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks # cleanup temp datafile if test -z "$HDF5_NOCLEANUP"; then - rm -f $p.h5 + rm -f $p.h5 fi done diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index ca46dcb..3cdf10f 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -20,7 +20,7 @@ # the verification of this feature needs to occur in separate processes # from the one in which the file is being manipulated in. (i.e., we have # a single writer process, and various reader processes spawning off -# and doing the verification that individual objects are being +# and doing the verification that individual objects are being # correctly flushed). # # Programmer: @@ -80,23 +80,30 @@ fi # HDF5 has several tests that create and delete signal files to communicate # between processes, and it seems that even though the names of the files are # different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate +# the test. Running each of these tests in its own directory should eliminate # the problem. mkdir flushrefresh_test cp flushrefresh flushrefresh_test # With the --disable-shared option, flushrefresh is built in the test directory, -# otherwise it is in test/.libs with a wrapper script named flushrefresh in -# the test directory. test/flushrefresh should always be copied, +# otherwise it is in test/.libs with a wrapper script named flushrefresh in +# the test directory. test/flushrefresh should always be copied, # .libs/flushrefresh should be copied only if it exists. if [ -f .libs/flushrefresh ]; then mkdir flushrefresh_test/.libs - cp .libs/flushrefresh flushrefresh_test/.libs + for FILE in .libs/flushrefresh*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE flushrefresh_test/.libs + fi + done fi cd flushrefresh_test # ================================================= -# Set up/initialize some variables to be used later +# Set up/initialize some variables to be used later # ================================================= testfile=flushrefresh.h5 startsignal=flushrefresh_VERIFICATION_START @@ -119,13 +126,13 @@ pid_main=$! # ======================================= until [ $verification_done -eq 1 ]; do - + # Wait for signal from test program that verification routine can run. before=`TimeStamp` until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break @@ -165,7 +172,7 @@ if [ $timedout -eq 0 ]; then until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index f81a7d7..a41947e 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -131,9 +131,10 @@ for FILE in swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test + if test -f "$FILE" ; then + cp $FILE swmr_test + fi done -cp swmr* swmr_test # With the --disable-shared option, swmr program files are built in the test # directory, otherwise they are in test/.libs with a corresponding wrapper @@ -145,7 +146,9 @@ if [ -f .libs/swmr ]; then case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test/.libs + if test -f "$FILE" ; then + cp $FILE swmr_test/.libs + fi done fi @@ -153,7 +156,7 @@ cd swmr_test # Loop over index types -for index_type in "-i ea" "-i b2" +for index_type in "-i ea" "-i b2" do # Try with and without compression for compress in "" "-c 5" diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index 32af072..28abcf5 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -117,7 +117,9 @@ for FILE in vds_swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE vds_swmr_test + if test -f "$FILE" ; then + cp $FILE vds_swmr_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -126,7 +128,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/vds_swmr_writer ]; then mkdir vds_swmr_test/.libs - cp .libs/vds_swmr* vds_swmr_test/.libs + for FILE in .libs/vds_swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE vds_swmr_test/.libs + fi + done fi cd vds_swmr_test diff --git a/test/tfile.c b/test/tfile.c index f39da5a..cf4403c 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5769,6 +5769,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n case H5F_LIBVER_V110: case H5F_LIBVER_V112: + case H5F_LIBVER_V114: ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; @@ -1132,6 +1132,138 @@ error: /*------------------------------------------------------------------------- + * Function: test_family_member_fapl + * + * Purpose: Actually use the member fapl input to the member vfd. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Jacob Smith + * 21 May 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_family_member_fapl(void) +{ + hid_t file = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t memb_fapl_id = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t dset = H5I_INVALID_HID; + char filename[1024]; + char dname[] = "dataset"; + unsigned i = 0; + unsigned j = 0; + int buf[FAMILY_NUMBER][FAMILY_SIZE]; + hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; + + TESTING("Family member FAPL"); + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5I_INVALID_HID == fapl_id) { + TEST_ERROR; + } + memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (H5I_INVALID_HID == memb_fapl_id) { + TEST_ERROR; + } + if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) { + TEST_ERROR; + } + if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) { + TEST_ERROR; + } + h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename)); + + file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + if (H5I_INVALID_HID == file) { + TEST_ERROR; + } + + space = H5Screate_simple(2, dims, NULL); + if (H5I_INVALID_HID == space) { + TEST_ERROR; + } + + /* Create and write to dataset, then close file. + */ + dset = H5Dcreate2( + file, + dname, + H5T_NATIVE_INT, + space, + H5P_DEFAULT, + H5P_DEFAULT, + H5P_DEFAULT); + if (H5I_INVALID_HID == dset) { + TEST_ERROR; + } + for (i = 0; i < FAMILY_NUMBER; i++) { + for (j = 0; j < FAMILY_SIZE; j++) { + buf[i][j] = (int)((i * 10000) + j); + } + } + if (H5Dwrite(dset, + H5T_NATIVE_INT, + H5S_ALL, + H5S_ALL, + H5P_DEFAULT, + buf) + == FAIL) + { + TEST_ERROR; + } + if (H5Dclose(dset) == FAIL) { + TEST_ERROR; + } + if (H5Sclose(space) == FAIL) { + TEST_ERROR; + } + if (H5Fclose(file) == FAIL) { + TEST_ERROR; + } + + /* "Close" member FAPL at top level and re-open file. + * Should succeed, with library managing reference count properly + */ + if (H5Pclose(memb_fapl_id) == FAIL) { + TEST_ERROR; + } + + file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + if (H5I_INVALID_HID == file) { + TEST_ERROR; + } + + if (H5Fclose(file) == FAIL) { + TEST_ERROR; + } + + h5_delete_test_file(FILENAME[2], fapl_id); + + if (H5Pclose(fapl_id) == FAIL) { + TEST_ERROR; + } + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Sclose(space); + H5Dclose(dset); + H5Pclose(memb_fapl_id); + H5Pclose(fapl_id); + H5Fclose(file); + } H5E_END_TRY; + + return -1; +} /* end test_family_member_fapl() */ + + +/*------------------------------------------------------------------------- * Function: test_multi_opens * * Purpose: Private function for test_multi() to tests wrong ways of @@ -2042,6 +2174,7 @@ main(void) nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; + nerrors += test_family_member_fapl() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 0 ? 1 : 0; nerrors += test_log() < 0 ? 1 : 0; |