From 22cd1b61cc33d61a705b369f81649b7180ec27a5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 14 Oct 2008 08:16:25 -0500 Subject: [svn-r15861] Description: Various bug fixes & cleanups with VFDs and file free space changes, along with cleaning up compiler warnings. Enable more VFDs (for 'make check-vfd' testing) for many tests. Tested on: Mac OS X/32 10.5.5 (amazon) in debug mode Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode --- release_docs/RELEASE.txt | 2 + src/H5F.c | 21 ++-- src/H5FD.c | 20 +++- src/H5FDcore.c | 1 + src/H5FDdirect.c | 1 + src/H5FDfamily.c | 32 +++--- src/H5FDlog.c | 1 + src/H5FDmpio.c | 1 + src/H5FDmpiposix.c | 1 + src/H5FDmulti.c | 63 +++++++----- src/H5FDpublic.h | 1 + src/H5FDsec2.c | 93 ++++++++--------- src/H5FDstdio.c | 1 + src/H5FDwindows.c | 1 + src/H5Fsuper.c | 127 +++++++++++++++++------ src/H5MFaggr.c | 3 - src/H5MFdbg.c | 71 +++++++++---- src/H5SM.c | 34 +++--- test/earray.c | 262 +++++++++++++++++++++++------------------------ test/freespace.c | 2 - test/links.c | 124 ++++++++++++---------- test/mf.c | 21 ---- 22 files changed, 493 insertions(+), 390 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1a27793..a1711d1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -117,6 +117,8 @@ Bug Fixes since HDF5-1.8.0 release Library ------- + - Corrected error with family/split/multi VFD not updating driver info + when "latest" version of the file format used. (QAK - 2008/10/14) - Corrected alignment+threshold errors to work correctly when metadata aggregation is enabled. (QAK - 2008/10/06) - Changed H5Fget_obj_count and H5Fget_obj_ids to ignore objects registered diff --git a/src/H5F.c b/src/H5F.c index f7c0022..327f934 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -1139,8 +1139,6 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_dest() */ - - /*------------------------------------------------------------------------- * Function: H5F_open @@ -1796,13 +1794,6 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") } /* end if */ - /* flush (and invalidate, if requested) the entire metadata cache */ - H5AC_flags = 0; - if((flags & H5F_FLUSH_INVALIDATE) != 0 ) - H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; - if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") - /* Truncate the file to the current allocated size */ /* (needs to happen before superblock write, since the 'eoa' value is * written in superblock -QAK) @@ -1811,9 +1802,19 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level truncate failed") /* Write the superblock to disk */ - if(H5F_super_write(f, dxpl_id) != SUCCEED) + /* (needs to happen before metadata flush (H5AC_flush), since the information + * in the superblock extension may be updated - 2008/10/14, QAK) + */ + if(H5F_super_write(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file") + /* Flush (and invalidate, if requested) the entire metadata cache */ + H5AC_flags = 0; + if((flags & H5F_FLUSH_INVALIDATE) != 0 ) + H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; + if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") + /* Flush out the metadata accumulator */ if(H5F_accum_flush(f, dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") diff --git a/src/H5FD.c b/src/H5FD.c index 9eacd3e..4c316d1 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -1712,15 +1712,27 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) herr_t H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_get_fs_type_map) + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5FD_get_fs_type_map, FAIL) + /* Sanity check */ HDassert(file); + HDassert(file && file->cls); HDassert(type_map); - /* Copy free space type mapping */ - HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map)); + /* Check for VFD class providing a type map retrieval rouine */ + if(file->cls->get_type_map) { + /* Retrieve type mapping for this file */ + if((file->cls->get_type_map)(file, type_map) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get type map failed") + } /* end if */ + else + /* Copy class's default free space type mapping */ + HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map)); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_get_fs_type_map() */ diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 8840720..68a0655 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -121,6 +121,7 @@ static const H5FD_class_t H5FD_core_g = { H5FD_core_close, /*close */ H5FD_core_cmp, /*cmp */ H5FD_core_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_core_get_eoa, /*get_eoa */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 88a2af0..61eb318 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -190,6 +190,7 @@ static const H5FD_class_t H5FD_direct_g = { H5FD_direct_close, /*close */ H5FD_direct_cmp, /*cmp */ H5FD_direct_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_direct_get_eoa, /*get_eoa */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 3e09f76..cfad5e3 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -128,6 +128,7 @@ static const H5FD_class_t H5FD_family_g = { H5FD_family_close, /*close */ H5FD_family_cmp, /*cmp */ H5FD_family_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_family_get_eoa, /*get_eoa */ @@ -976,22 +977,22 @@ done: static herr_t H5FD_family_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */) { - herr_t ret_value=SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_family_query, FAIL) /* Set the VFL feature flags that this driver supports */ if(flags) { - *flags=0; - *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ - *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes. */ - *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - } + *flags = 0; + *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */ + *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes. */ + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_family_query() */ /*------------------------------------------------------------------------- @@ -1372,35 +1373,32 @@ done: * Purpose: Flushes all family members. * * Return: Success: 0 - * * Failure: -1, as many files flushed as possible. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { H5FD_family_t *file = (H5FD_family_t*)_file; - unsigned u, nerrors=0; - herr_t ret_value=SUCCEED; /* Return value */ + unsigned u, nerrors = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_family_flush, FAIL) - for (u=0; unmembs; u++) - if (file->memb[u] && H5FD_flush(file->memb[u], dxpl_id, closing)<0) + for(u = 0; u < file->nmembs; u++) + if(file->memb[u] && H5FD_flush(file->memb[u], dxpl_id, closing) < 0) nerrors++; - if (nerrors) + if(nerrors) HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_family_flush() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 2a4dae6..f7eb349 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -225,6 +225,7 @@ static const H5FD_class_t H5FD_log_g = { H5FD_log_close, /*close */ H5FD_log_cmp, /*cmp */ H5FD_log_query, /*query */ + NULL, /*get_type_map */ H5FD_log_alloc, /*alloc */ NULL, /*free */ H5FD_log_get_eoa, /*get_eoa */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index ea5a768..57da069 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -113,6 +113,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { H5FD_mpio_close, /*close */ NULL, /*cmp */ H5FD_mpio_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_mpio_get_eoa, /*get_eoa */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 03e8cb3..245fc3e 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -221,6 +221,7 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = { H5FD_mpiposix_close, /*close */ H5FD_mpiposix_cmp, /*cmp */ H5FD_mpiposix_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_mpiposix_get_eoa, /*get_eoa */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 6b53d9e..2be54f8 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -66,16 +66,6 @@ assert(LOOPVAR>0 && LOOPVAR0 && LOOPVARfa.memb_map, mt) { - memb_eoa = H5FDget_eoa(file->memb[mt], mt); memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t)); p += sizeof(haddr_t); + memb_eoa = H5FDget_eoa(file->memb[mt], mt); memcpy(p, &memb_eoa, sizeof(haddr_t)); p += sizeof(haddr_t); nseen++; @@ -824,7 +816,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, } END_MEMBERS; return 0; -} +} /* end H5FD_multi_sb_encode() */ /*------------------------------------------------------------------------- @@ -982,7 +974,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } END_MEMBERS; return 0; -} +} /* end H5FD_multi_sb_decode() */ /*------------------------------------------------------------------------- @@ -1424,13 +1416,38 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) /* Set the VFL feature flags that this driver supports */ if(flags) { - *flags=0; - *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ - *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ - } + *flags = 0; + *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */ + } /* end if */ return(0); -} +} /* end H5FD_multi_query() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_multi_get_type_map + * + * Purpose: Retrieve the memory type mapping for this file + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, October 9, 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) +{ + const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + + /* Copy file's free space type mapping */ + memcpy(type_map, file->fa.memb_map, sizeof(file->fa.memb_map)); + + return(0); +} /* end H5FD_multi_get_type_map() */ /*------------------------------------------------------------------------- @@ -1463,7 +1480,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) const H5FD_multi_t *file = (const H5FD_multi_t*)_file; haddr_t eoa = 0; haddr_t memb_eoa = 0; - static const char *func="H5FD_multi_eoa"; /* Function Name for error reporting */ + static const char *func="H5FD_multi_get_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1523,7 +1540,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) } return eoa; -} +} /* end H5FD_multi_get_eoa() */ /*------------------------------------------------------------------------- @@ -1575,7 +1592,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) return 0; -} +} /* end H5FD_multi_set_eoa() */ /*------------------------------------------------------------------------- diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index f960a1c..fa30202 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -218,6 +218,7 @@ typedef struct H5FD_class_t { herr_t (*close)(H5FD_t *file); int (*cmp)(const H5FD_t *f1, const H5FD_t *f2); herr_t (*query)(const H5FD_t *f1, unsigned long *flags); + herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map); haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index cd3419b..3b09005 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -170,6 +170,7 @@ static const H5FD_class_t H5FD_sec2_g = { H5FD_sec2_close, /*close */ H5FD_sec2_cmp, /*cmp */ H5FD_sec2_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_sec2_get_eoa, /*get_eoa */ @@ -568,11 +569,11 @@ H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF) /* Set return value */ - ret_value=file->eoa; + ret_value = file->eoa; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sec2_get_eoa() */ /*------------------------------------------------------------------------- @@ -688,73 +689,70 @@ done: * * Return: Success: Zero. Result is stored in caller-supplied * buffer BUF. - * * Failure: -1, Contents of buffer BUF are undefined. * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ static herr_t -H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf/*out*/) +H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, + haddr_t addr, size_t size, void *buf/*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t*)_file; ssize_t nbytes; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_read, FAIL) - assert(file && file->pub.cls); - assert(buf); + HDassert(file && file->pub.cls); + HDassert(buf); /* Check for overflow conditions */ - if (HADDR_UNDEF==addr) + if(!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") - if (REGION_OVERFLOW(addr, size)) + if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + if((addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Seek to the correct location */ - if ((addr!=file->pos || OP_READ!=file->op) && - HDlseek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + if((addr != file->pos || OP_READ != file->op) && + HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") /* * Read data, being careful of interrupted system calls, partial results, * and the end of the file. */ - while (size>0) { + while(size > 0) { do { nbytes = HDread(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ + } while(-1 == nbytes && EINTR == errno); + if(-1 == nbytes) /* error */ HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - if (0==nbytes) { + if(0 == nbytes) { /* end of file but not end of format address space */ HDmemset(buf, 0, size); break; - } - assert(nbytes>=0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + } /* end if */ + HDassert(nbytes >= 0); + HDassert((size_t)nbytes <= size); + H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); addr += (haddr_t)nbytes; - buf = (char*)buf + nbytes; - } + buf = (char *)buf + nbytes; + } /* end while */ /* Update current position */ file->pos = addr; file->op = OP_READ; done: - if(ret_value<0) { + if(ret_value < 0) { /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; @@ -772,14 +770,11 @@ done: * DXPL_ID. * * Return: Success: Zero - * * Failure: -1 * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -789,53 +784,53 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had { H5FD_sec2_t *file = (H5FD_sec2_t*)_file; ssize_t nbytes; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_write, FAIL) - assert(file && file->pub.cls); - assert(buf); + HDassert(file && file->pub.cls); + HDassert(buf); /* Check for overflow conditions */ - if (HADDR_UNDEF==addr) + if(!H5F_addr_defined(addr)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") - if (REGION_OVERFLOW(addr, size)) + if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + if((addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Seek to the correct location */ - if ((addr!=file->pos || OP_WRITE!=file->op) && - HDlseek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + if((addr != file->pos || OP_WRITE != file->op) && + HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") /* * Write the data, being careful of interrupted system calls and partial * results */ - while (size>0) { + while(size > 0) { do { nbytes = HDwrite(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ + } while(-1 == nbytes && EINTR == errno); + if(-1 == nbytes) /* error */ HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - assert(nbytes>0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + HDassert(nbytes > 0); + HDassert((size_t)nbytes <= size); + H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); addr += (haddr_t)nbytes; - buf = (const char*)buf + nbytes; - } + buf = (const char *)buf + nbytes; + } /* end while */ /* Update current position and eof */ file->pos = addr; file->op = OP_WRITE; - if (file->pos>file->eof) + if(file->pos > file->eof) file->eof = file->pos; done: - if(ret_value<0) { + if(ret_value < 0) { /* Reset last file I/O information */ file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 59056c9..59e5b1e 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -186,6 +186,7 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_close, /*close */ H5FD_stdio_cmp, /*cmp */ H5FD_stdio_query, /*query */ + NULL, /*get_type_map */ H5FD_stdio_alloc, /*alloc */ NULL, /*free */ H5FD_stdio_get_eoa, /*get_eoa */ diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index 912c721..ef26fec 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -159,6 +159,7 @@ static const H5FD_class_t H5FD_windows_g = { H5FD_windows_close, /*close */ H5FD_windows_cmp, /*cmp */ H5FD_windows_query, /*query */ + NULL, /*get_type_map */ NULL, /*alloc */ NULL, /*free */ H5FD_windows_get_eoa, /*get_eoa */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 6196557..bd2fe20 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -356,7 +356,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) /* File status flags (not really used yet) */ UINT32DECODE(p, status_flags); HDassert(status_flags <= 255); - shared->status_flags = status_flags; + shared->status_flags = (uint8_t)status_flags; if(shared->status_flags & ~H5F_SUPER_ALL_FLAGS) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad flag value for superblock") @@ -567,12 +567,25 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */ + htri_t status; /* Status for message existing */ /* Sanity check - superblock extension should only be defined for * superblock version >= 2. */ HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); + /* Check for superblock extension being located "outside" the stored + * 'eoa' value, which can occur with the split/multi VFD. + */ + if(H5F_addr_gt(shared->extension_addr, stored_eoa)) { + /* Set the 'eoa' for the object header memory type large enough + * to give some room for a reasonably sized superblock extension. + * (This is _rather_ a kludge -QAK) + */ + if(H5FD_set_eoa(lf, H5FD_MEM_OHDR, (haddr_t)(shared->extension_addr + 1024)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file") + } /* end if */ + /* Set up "fake" object location for superblock extension */ H5O_loc_reset(&ext_loc); ext_loc.file = f; @@ -580,23 +593,44 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) /* Open the superblock extension */ if(H5O_open(&ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") + + /* Check for the extension having a 'driver info' message */ + if((status = H5O_msg_exists(&ext_loc, H5O_DRVINFO_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header") + if(status) { + /* Retrieve the 'driver info' structure */ + if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present") + + /* Check if driver matches driver information saved. Unfortunately, we can't push this + * function to each specific driver because we're checking if the driver is correct. + */ + if(!HDstrncmp(drvinfo.name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family")) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "family driver should be used") + if(!HDstrncmp(drvinfo.name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi")) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "multi driver should be used") + + /* Decode driver information */ + if(H5FD_sb_decode(lf, drvinfo.name, drvinfo.buf) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information") + + /* Reset driver info message */ + H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); + } /* end if */ /* Read in the shared OH message information if there is any */ if(H5SM_get_info(&ext_loc, c_plist, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read SOHM table information") - /* Read in v1 B-tree 'K' value message, if it exists */ - if(NULL == H5O_msg_read(&ext_loc, H5O_BTREEK_ID, &btreek, dxpl_id)) { - /* Reset error from "failed" message read */ - H5E_clear_stack(NULL); + /* Check for the extension having a 'v1 B-tree "K"' message */ + if((status = H5O_msg_exists(&ext_loc, H5O_BTREEK_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header") + if(status) { + /* Retrieve the 'v1 B-tree "K"' structure */ + if(NULL == H5O_msg_read(&ext_loc, H5O_BTREEK_ID, &btreek, dxpl_id)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "v1 B-tree 'K' info message not present") - /* No non-default v1 B-tree 'K' value info in file, use defaults */ - shared->btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF; - shared->btree_k[H5B_SNODE_ID] = HDF5_BTREE_SNODE_IK_DEF; - shared->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; - } /* end if */ - else { /* Set non-default v1 B-tree 'K' value info from file */ shared->btree_k[H5B_ISTORE_ID] = btreek.btree_k[H5B_ISTORE_ID]; shared->btree_k[H5B_SNODE_ID] = btreek.btree_k[H5B_SNODE_ID]; @@ -607,29 +641,13 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes") if(H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &btreek.sym_leaf_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes") - } /* end else */ - - /* Read in driver info message, if it exists */ - if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id)) { - /* Reset error from "failed" message read */ - H5E_clear_stack(NULL); } /* end if */ else { - /* Check if driver matches driver information saved. Unfortunately, we can't push this - * function to each specific driver because we're checking if the driver is correct. - */ - if(!HDstrncmp(drvinfo.name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "family driver should be used") - if(!HDstrncmp(drvinfo.name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi")) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "multi driver should be used") - - /* Decode driver information */ - if(H5FD_sb_decode(lf, drvinfo.name, drvinfo.buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information") - - /* Reset driver info message */ - H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); - } /* end else */ + /* No non-default v1 B-tree 'K' value info in file, use defaults */ + shared->btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF; + shared->btree_k[H5B_SNODE_ID] = HDF5_BTREE_SNODE_IK_DEF; + shared->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; + } /* end if */ /* Close the extension. Twiddle the number of open objects to avoid * closing the file (since this will be the only open object). @@ -818,7 +836,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Write driver info information to the superblock extension */ drvinfo.len = driver_size; drvinfo.buf = dbuf; - if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) + if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ @@ -984,6 +1002,47 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, superblock_size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock") + /* Check for newer version of superblock format & superblock extension */ + if(super_vers >= HDF5_SUPERBLOCK_VERSION_2 && H5F_addr_defined(f->shared->extension_addr)) { + /* Check for driver info message */ + H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t); + if(driver_size > 0) { + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + H5O_drvinfo_t drvinfo; /* Driver info */ + uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ + + /* Sanity check */ + HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); + + /* Encode driver-specific data */ + if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + + /* Set up "fake" object location for superblock extension */ + H5O_loc_reset(&ext_loc); + ext_loc.file = f; + ext_loc.addr = f->shared->extension_addr; + + /* Open the superblock extension */ + if(H5O_open(&ext_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") + + /* Write driver info information to the superblock extension */ + drvinfo.len = driver_size; + drvinfo.buf = dbuf; + if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update driver info header message") + + /* Close the extension. Twiddle the number of open objects to avoid + * closing the file (since this will be the only open object). + */ + f->nopen_objs++; + if(H5O_close(&ext_loc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension") + f->nopen_objs--; + } /* end if */ + } /* end if */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_super_write() */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index dda1968..f383e23 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -196,9 +196,6 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); aggr->size += (ext_size - frag_size); aggr->tot_size += ext_size; } else { - haddr_t unused_addr = HADDR_UNDEF; /* Address of unused portion */ - hsize_t unused_size = 0; /* Size of unused portion */ - if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index ca83b5a..ca87c83 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -41,6 +41,7 @@ #include "H5Fpkg.h" /* File access */ #include "H5MFpkg.h" /* File memory management */ +#ifdef H5MF_ALLOC_DEBUG_DUMP /****************/ /* Local Macros */ @@ -161,10 +162,14 @@ H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream) haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ hsize_t sda_size = 0; /* Size of "small data aggregator" */ H5FD_mem_t type; /* Memory type for iteration */ + int indent = 0; /* Amount to indent */ + int fwidth = 50; /* Field width */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5MF_sects_dump, FAIL) +#ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); +#endif /* H5MF_ALLOC_DEBUG */ /* * Check arguments. @@ -175,43 +180,67 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); /* Retrieve the 'eoa' for the file */ if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") -HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa); +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); +#endif /* H5MF_ALLOC_DEBUG */ /* Retrieve metadata aggregator info, if available */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); +#ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); +#endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); +#ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); +#endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { -#ifdef QAK - /* Check if the free space for the file has been initialized */ - if(!f->shared->fs_man[type]) - if(H5MF_alloc_start(f, dxpl_id, type, FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") -#endif /* QAK */ - - /* If there is a free space manager for this type, iterate over them */ - if(f->shared->fs_man[type]) { - H5MF_debug_iter_ud_t udata; /* User data for callbacks */ - - /* Prepare user data for section iteration callback */ - udata.fspace = f->shared->fs_man[type]; - udata.stream = stream; - udata.indent = 0; - udata.fwidth = 3; - - /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + /* Print header for type */ + HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)type); + + /* Check for this type being mapped to another type */ + if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[type] || + type == f->shared->fs_type_map[type]) { + /* Retrieve the 'eoa' for this file memory type */ + if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, type))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + "eoa:", + eoa); + + /* Print header for sections */ + HDfprintf(stream, "%*sSections:\n", indent + 3, ""); + + /* If there is a free space manager for this type, iterate over them */ + if(f->shared->fs_man[type]) { + H5MF_debug_iter_ud_t udata; /* User data for callbacks */ + + /* Prepare user data for section iteration callback */ + udata.fspace = f->shared->fs_man[type]; + udata.stream = stream; + udata.indent = indent + 6; + udata.fwidth = MAX(0, fwidth - 6); + + /* Iterate over all the free space sections */ + if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + } /* end if */ + else { + /* No sections of this type */ + HDfprintf(stream, "%*s\n", indent + 6, ""); + } /* end else */ } /* end if */ + else { + HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", (unsigned)f->shared->fs_type_map[type]); + } /* end else */ } /* end for */ done: HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_sects_dump() */ +#endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/src/H5SM.c b/src/H5SM.c index f782e68..d942399 100755 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1759,6 +1759,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) H5F_file_t *shared = f->shared; /* Shared file info (convenience variable) */ H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table */ + htri_t status; /* Status for message existing */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5SM_get_info, FAIL) @@ -1768,27 +1769,20 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) HDassert(f && shared); HDassert(fc_plist); - /* Read in shared message information, if it exists */ - if(NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table, dxpl_id)) { - /* Reset error from "failed" message read */ - H5E_clear_stack(NULL); - - /* No SOHM info in file */ - shared->sohm_addr = HADDR_UNDEF; - shared->sohm_nindexes = 0; - shared->sohm_vers = 0; - - /* Shared object header messages are disabled */ - if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes") - } /* end if */ - else { + /* Check for the extension having a 'shared message info' message */ + if((status = H5O_msg_exists(ext_loc, H5O_SHMESG_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header") + if(status) { unsigned index_flags[H5O_SHMESG_MAX_NINDEXES]; /* Message flags for each index */ unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Minimum message size for each index */ unsigned sohm_l2b; /* SOHM list-to-btree cutoff */ unsigned sohm_b2l; /* SOHM btree-to-list cutoff */ unsigned u; /* Local index variable */ + /* Retrieve the 'shared message info' structure */ + if(NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table, dxpl_id)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "shared message info message not present") + /* Portably initialize the arrays */ HDmemset(index_flags, 0, sizeof(index_flags)); HDmemset(minsizes, 0, sizeof(minsizes)); @@ -1836,6 +1830,16 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list") if(H5P_set(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &sohm_b2l) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list") + } /* end if */ + else { + /* No SOHM info in file */ + shared->sohm_addr = HADDR_UNDEF; + shared->sohm_nindexes = 0; + shared->sohm_vers = 0; + + /* Shared object header messages are disabled */ + if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes") } /* end else */ done: diff --git a/test/earray.c b/test/earray.c index 0f241e6..088ea95 100644 --- a/test/earray.c +++ b/test/earray.c @@ -1140,7 +1140,6 @@ main(void) hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ int ExpressMode; /* Test express value */ - const char *envval; /* File Driver value from environment */ /* Reset library */ h5_reset(); @@ -1149,146 +1148,139 @@ main(void) if(ExpressMode > 1) printf("***Express test mode on. Some tests may be skipped\n"); - if(NULL == (envval = HDgetenv("HDF5_DRIVER"))) - envval = "nomatch"; + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); - if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - /* Set the filename to use for this test (dependent on fapl) */ - h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); + /* Create an empty file to retrieve size */ + { + hid_t file; /* File ID */ - /* Create an empty file to retrieve size */ - { - hid_t file; /* File ID */ + if((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR - if((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(file) < 0) - FAIL_STACK_ERROR + /* Get the size of a file w/no array */ + if((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0) + TEST_ERROR + } + + + /* Initialize extensible array creation parameters */ + init_cparam(&cparam); + + /* Iterate over the testing parameters */ + for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { + + /* Initialize the testing parameters */ + init_tparam(&tparam, &cparam); + + /* Set appropriate testing parameters for each test */ + switch(curr_test) { + /* "Normal" testing parameters */ + case EARRAY_TEST_NORMAL: + puts("Testing with normal parameters"); + break; + + /* "Re-open array" testing parameters */ + case EARRAY_TEST_REOPEN: + puts("Testing with reopen array flag set"); + tparam.reopen_array = EARRAY_TEST_REOPEN; + break; + + /* An unknown test? */ + default: + goto error; + } /* end switch */ + + /* Basic capability tests */ + nerrors += test_create(fapl, &cparam, &tparam); + nerrors += test_reopen(fapl, &cparam, &tparam); + nerrors += test_open_twice(fapl, &cparam, &tparam); + nerrors += test_delete_open(fapl, &cparam, &tparam); + + /* Basic capacity tests */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)0, "setting first element of array"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts, "setting index block elements of array"); + /* Super block #0 ("virtual" super block, in index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + 1), "setting first element of array's 1st data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts), "setting all elements of array's 1st data block"); + /* Super block #1 ("virtual" super block, in index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts + 1), "setting first element of array's 2nd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts)), "setting all elements of array's 2nd data block"); + /* Super block #2 ("virtual" super block, in index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 3rd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts)), "setting all elements of array's 3rd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 4th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (7 * cparam.data_blk_min_elmts)), "setting all elements of array's 4th data block"); + /* Super block #3 ("virtual" super block, in index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (7 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 5th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (11 * cparam.data_blk_min_elmts)), "setting all elements of array's 5th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (11 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 6th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts)), "setting all elements of array's 6th data block"); + /* Super block #4 (actual super block, from index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 7th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (19 * cparam.data_blk_min_elmts)), "setting all elements of array's 7th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (19 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 8th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (23 * cparam.data_blk_min_elmts)), "setting all elements of array's 8th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (23 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 9th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (27 * cparam.data_blk_min_elmts)), "setting all elements of array's 9th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (27 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 10th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts)), "setting all elements of array's 10th data block"); + /* Super block #5 (actual super block, from index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 11th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (39 * cparam.data_blk_min_elmts)), "setting all elements of array's 11th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (39 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 12th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (47 * cparam.data_blk_min_elmts)), "setting all elements of array's 12th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (47 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 13th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (55 * cparam.data_blk_min_elmts)), "setting all elements of array's 13th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (55 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 14th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts)), "setting all elements of array's 14th data block"); + /* Super block #6 (actual super block, from index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 15th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (71 * cparam.data_blk_min_elmts)), "setting all elements of array's 15th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (71 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 16th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (79 * cparam.data_blk_min_elmts)), "setting all elements of array's 16th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (79 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 17th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (87 * cparam.data_blk_min_elmts)), "setting all elements of array's 17th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (87 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 18th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (95 * cparam.data_blk_min_elmts)), "setting all elements of array's 18th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (95 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 19th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (103 * cparam.data_blk_min_elmts)), "setting all elements of array's 19th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (103 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 20th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (111 * cparam.data_blk_min_elmts)), "setting all elements of array's 20th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (111 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 21st data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (119 * cparam.data_blk_min_elmts)), "setting all elements of array's 21st data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (119 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 22nd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts)), "setting all elements of array's 22nd data block"); + /* Super block #7 (actual super block, from index block) */ + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 23rd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (143 * cparam.data_blk_min_elmts)), "setting all elements of array's 23rd data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (143 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 24th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (159 * cparam.data_blk_min_elmts)), "setting all elements of array's 24th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (159 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 25th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (175 * cparam.data_blk_min_elmts)), "setting all elements of array's 25th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (175 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 26th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (191 * cparam.data_blk_min_elmts)), "setting all elements of array's 26th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (191 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 27th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (207 * cparam.data_blk_min_elmts)), "setting all elements of array's 27th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (207 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 28th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (223 * cparam.data_blk_min_elmts)), "setting all elements of array's 28th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (223 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 29th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (239 * cparam.data_blk_min_elmts)), "setting all elements of array's 29th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (239 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 30th data block"); + nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (255 * cparam.data_blk_min_elmts)), "setting all elements of array's 30th data block"); + + /* Close down testing parameters */ + finish_tparam(&tparam); + } /* end for */ - /* Get the size of a file w/no array */ - if((empty_size_g = h5_get_file_size(filename_g, fapl)) < 0) - TEST_ERROR - } - - - /* Initialize extensible array creation parameters */ - init_cparam(&cparam); - - /* Iterate over the testing parameters */ - for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { - - /* Initialize the testing parameters */ - init_tparam(&tparam, &cparam); - - /* Set appropriate testing parameters for each test */ - switch(curr_test) { - /* "Normal" testing parameters */ - case EARRAY_TEST_NORMAL: - puts("Testing with normal parameters"); - break; - - /* "Re-open array" testing parameters */ - case EARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); - tparam.reopen_array = EARRAY_TEST_REOPEN; - break; - - /* An unknown test? */ - default: - goto error; - } /* end switch */ - - /* Basic capability tests */ - nerrors += test_create(fapl, &cparam, &tparam); - nerrors += test_reopen(fapl, &cparam, &tparam); - nerrors += test_open_twice(fapl, &cparam, &tparam); - nerrors += test_delete_open(fapl, &cparam, &tparam); - - /* Basic capacity tests */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)0, "setting first element of array"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)cparam.idx_blk_elmts, "setting index block elements of array"); - /* Super block #0 ("virtual" super block, in index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + 1), "setting first element of array's 1st data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts), "setting all elements of array's 1st data block"); - /* Super block #1 ("virtual" super block, in index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + cparam.data_blk_min_elmts + 1), "setting first element of array's 2nd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts)), "setting all elements of array's 2nd data block"); - /* Super block #2 ("virtual" super block, in index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (3 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 3rd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts)), "setting all elements of array's 3rd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (5 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 4th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (7 * cparam.data_blk_min_elmts)), "setting all elements of array's 4th data block"); - /* Super block #3 ("virtual" super block, in index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (7 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 5th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (11 * cparam.data_blk_min_elmts)), "setting all elements of array's 5th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (11 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 6th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts)), "setting all elements of array's 6th data block"); - /* Super block #4 (actual super block, from index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (15 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 7th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (19 * cparam.data_blk_min_elmts)), "setting all elements of array's 7th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (19 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 8th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (23 * cparam.data_blk_min_elmts)), "setting all elements of array's 8th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (23 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 9th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (27 * cparam.data_blk_min_elmts)), "setting all elements of array's 9th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (27 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 10th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts)), "setting all elements of array's 10th data block"); - /* Super block #5 (actual super block, from index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (31 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 11th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (39 * cparam.data_blk_min_elmts)), "setting all elements of array's 11th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (39 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 12th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (47 * cparam.data_blk_min_elmts)), "setting all elements of array's 12th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (47 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 13th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (55 * cparam.data_blk_min_elmts)), "setting all elements of array's 13th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (55 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 14th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts)), "setting all elements of array's 14th data block"); - /* Super block #6 (actual super block, from index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (63 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 15th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (71 * cparam.data_blk_min_elmts)), "setting all elements of array's 15th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (71 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 16th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (79 * cparam.data_blk_min_elmts)), "setting all elements of array's 16th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (79 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 17th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (87 * cparam.data_blk_min_elmts)), "setting all elements of array's 17th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (87 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 18th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (95 * cparam.data_blk_min_elmts)), "setting all elements of array's 18th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (95 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 19th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (103 * cparam.data_blk_min_elmts)), "setting all elements of array's 19th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (103 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 20th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (111 * cparam.data_blk_min_elmts)), "setting all elements of array's 20th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (111 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 21st data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (119 * cparam.data_blk_min_elmts)), "setting all elements of array's 21st data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (119 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 22nd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts)), "setting all elements of array's 22nd data block"); - /* Super block #7 (actual super block, from index block) */ - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (127 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 23rd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (143 * cparam.data_blk_min_elmts)), "setting all elements of array's 23rd data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (143 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 24th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (159 * cparam.data_blk_min_elmts)), "setting all elements of array's 24th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (159 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 25th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (175 * cparam.data_blk_min_elmts)), "setting all elements of array's 25th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (175 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 26th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (191 * cparam.data_blk_min_elmts)), "setting all elements of array's 26th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (191 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 27th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (207 * cparam.data_blk_min_elmts)), "setting all elements of array's 27th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (207 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 28th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (223 * cparam.data_blk_min_elmts)), "setting all elements of array's 28th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (223 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 29th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (239 * cparam.data_blk_min_elmts)), "setting all elements of array's 29th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (239 * cparam.data_blk_min_elmts) + 1), "setting first element of array's 30th data block"); - nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)(cparam.idx_blk_elmts + (255 * cparam.data_blk_min_elmts)), "setting all elements of array's 30th data block"); - - /* Close down testing parameters */ - finish_tparam(&tparam); - } /* end for */ - - if(nerrors) - goto error; - puts("All extensible array tests passed."); - } /* end if(HDstrcmp(envval=="...")) */ - else - printf("All extensible array tests skipped - Incompatible with current Virtual File Driver\n"); + if(nerrors) + goto error; + puts("All extensible array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); diff --git a/test/freespace.c b/test/freespace.c index 93c81ea..52a5deb 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2782,9 +2782,7 @@ main(void) goto error; puts("All free-space tests passed."); -#ifdef OUT h5_cleanup(FILENAME, fapl); -#endif return (0); error: diff --git a/test/links.c b/test/links.c index a857fde..3b97fdb 100644 --- a/test/links.c +++ b/test/links.c @@ -1735,7 +1735,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR - if((fid = H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ @@ -1768,7 +1768,7 @@ external_link_root(hid_t fapl, hbool_t new_format) if(H5F_sfile_assert_num(0) != 0) TEST_ERROR /* Open first file again with read-only access and check on objects created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open objects created through external link */ if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1794,7 +1794,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Verify that new objects can't be created through a read-only external * link. */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -1901,7 +1901,7 @@ external_link_path(hid_t fapl, hbool_t new_format) /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open object created through external link */ if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2048,7 +2048,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open object created through external link */ if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2065,7 +2065,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Open an object through external links */ - if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* The intermediate files should not stay open. Replace one of them with a new file. */ @@ -2200,7 +2200,7 @@ external_link_self(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open file1 and create an extlink pointing to file3 */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + 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 @@ -2209,7 +2209,7 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ - if((fid=H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + 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 @@ -2222,7 +2222,7 @@ external_link_self(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open up file3 and make sure the object was created successfully */ - if((fid = H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + 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 @@ -2338,7 +2338,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + 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 @@ -5554,61 +5554,73 @@ 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") - /* - * 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, ""); + envval = HDgetenv("HDF5_DRIVER"); + if(envval == NULL) + envval = "nomatch"; + if(HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - /* 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 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, ""); - if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, LE_FILENAME); + /* 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 - /* 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 + if(HDstrlen(pathbuf) + HDstrlen(LE_FILENAME) >= sizeof(namebuf)) TEST_ERROR + HDstrcpy(namebuf, pathbuf); + HDstrcat(namebuf, LE_FILENAME); - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* 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 - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 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 - if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR - HDstrcpy(namebuf, pathbuf); - HDstrcat(namebuf, BE_FILENAME); + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* 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 + if(HDstrlen(pathbuf) + HDstrlen(BE_FILENAME) >= sizeof(namebuf)) TEST_ERROR + HDstrcpy(namebuf, pathbuf); + HDstrcat(namebuf, BE_FILENAME); - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* 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 - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 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 + + /* 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; error: @@ -9660,7 +9672,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -9821,7 +9833,7 @@ link_iterate(hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = max_compact * 2; - if(NULL == (visited = HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR iter_info.visited = visited; /* Loop over operating on different indices on link fields */ @@ -10280,7 +10292,7 @@ link_iterate_old(hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = CORDER_NLINKS; - if(NULL == (visited = HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR + if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR iter_info.visited = visited; /* Loop over operating in different orders */ @@ -10518,7 +10530,7 @@ open_by_idx(hid_t fapl) if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR /* Allocate object address array */ - if(NULL == (objno = HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR /* Create file to mount */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -10960,7 +10972,7 @@ object_info(hid_t fapl) if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR /* Allocate object address array */ - if(NULL == (objno = HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR @@ -12068,7 +12080,7 @@ timestamps(hid_t fapl) /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open groups */ if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -12151,7 +12163,7 @@ main(void) envval = HDgetenv("HDF5_DRIVER"); if(envval == NULL) envval = "nomatch"; - if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { + 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 */ diff --git a/test/mf.c b/test/mf.c index df8eb6f..b19e190 100644 --- a/test/mf.c +++ b/test/mf.c @@ -5559,27 +5559,6 @@ main(void) if(H5Pset_small_data_block_size(fapl, (hsize_t)TEST_BLOCK_SIZE2048) < 0) TEST_ERROR - nerrors += test_mf_eoa(env_h5_drvr, fapl); - nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); - nerrors += test_mf_eoa_extend(env_h5_drvr, fapl); - - /* interaction with free-space manager */ - nerrors += test_mf_fs_start(fapl); - nerrors += test_mf_fs_alloc_free(fapl); - nerrors += test_mf_fs_extend(fapl); - nerrors += test_mf_fs_absorb(env_h5_drvr, fapl); - - /* interaction with meta/sdata aggregator */ - nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc2(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc3(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc4(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc5(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc6(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc7(env_h5_drvr, fapl); - nerrors += test_mf_aggr_extend(env_h5_drvr, fapl); - nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); - /* interaction with file allocation */ nerrors += test_mf_eoa(env_h5_drvr, fapl); nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); -- cgit v0.12