summaryrefslogtreecommitdiffstats
path: root/test/earray.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-06-02 20:14:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-06-02 20:14:17 (GMT)
commitfc2899346417fed3727f28115d30d9fd62d6691d (patch)
tree342de31f2d0bfcccaa03e2b05cc827e8ae638506 /test/earray.c
parent126dae2440467e5e2f5a182a5a9424ab357d8992 (diff)
downloadhdf5-fc2899346417fed3727f28115d30d9fd62d6691d.zip
hdf5-fc2899346417fed3727f28115d30d9fd62d6691d.tar.gz
hdf5-fc2899346417fed3727f28115d30d9fd62d6691d.tar.bz2
[svn-r16997] Description:
Change previous "depend/undepend" routine names to be "support/unsupport" and add new "depend/undepend" routines, which make the extensible array a child flush dependency of another piece of metadata in the file. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) 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 debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.7 (amazon) in debug mode Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test/earray.c')
-rw-r--r--test/earray.c60
1 files changed, 53 insertions, 7 deletions
diff --git a/test/earray.c b/test/earray.c
index 1c70851..fe5cb99 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -137,6 +137,7 @@ struct earray_test_param_t {
/* Flush depend test context */
typedef struct earray_flush_depend_ctx_t {
+ hbool_t base_obj; /* Flag to indicate that base object has been flushed */
hbool_t idx0_obj; /* Flag to indicate that index 0's object has been flushed */
hbool_t idx0_elem; /* Flag to indicate that index 0's element has been flushed */
hbool_t idx1_obj; /* Flag to indicate that index 1's object has been flushed */
@@ -650,6 +651,10 @@ earray_cache_test_flush(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, hbool_t destroy,
HDassert(test);
if(test->cache_info.is_dirty) {
+ /* Check for out of order flush */
+ if(test->fd_info->base_obj)
+ TEST_ERROR
+
/* Check which index this entry corresponds to */
if((uint64_t)0 == test->idx) {
/* Check for out of order flush */
@@ -675,6 +680,10 @@ earray_cache_test_flush(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, hbool_t destroy,
/* Set flag for object flush */
test->fd_info->idx10000_obj = TRUE;
} /* end if */
+ else if((uint64_t)-1 == test->idx) {
+ /* Set flag for object flush */
+ test->fd_info->base_obj = TRUE;
+ } /* end if */
/* Mark the entry as clean */
test->cache_info.is_dirty = FALSE;
@@ -1305,7 +1314,8 @@ error:
/*-------------------------------------------------------------------------
* Function: test_flush_depend_cb
*
- * Purpose: Callback for flush dependency 'depend'/'undepend' routines
+ * Purpose: Callback for flush dependency 'depend'/'undepend' and
+ * 'support'/'unsupport' routines
*
* Return: Success: 0
* Failure: 1
@@ -1321,6 +1331,10 @@ test_flush_depend_cb(const void *_elmt, size_t nelmts, void *udata)
earray_flush_depend_ctx_t *ctx = (earray_flush_depend_ctx_t *)udata;
const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
+ /* Check for out of order flush */
+ if(ctx->base_obj)
+ return(FAIL);
+
/* Look for magic values */
while(nelmts > 0) {
/* Check for elements of interest */
@@ -1380,6 +1394,8 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
H5EA__ctx_cb_t cb; /* Extensible array context action info */
earray_flush_depend_ctx_t fd_info; /* Context information for flush depend test */
+ haddr_t base_addr; /* Base test entry address */
+ earray_test_t *base_entry; /* Pointer to base test entry */
haddr_t addr1; /* Test entry #1 address */
earray_test_t *entry1; /* Pointer to test entry #1 */
haddr_t addr2; /* Test entry #2 address */
@@ -1409,6 +1425,22 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
if(verify_cparam(ea, cparam) < 0)
TEST_ERROR
+ /* Create base entry to insert */
+ if(NULL == (base_entry = (earray_test_t *)HDmalloc(sizeof(earray_test_t))))
+ TEST_ERROR
+ HDmemset(base_entry, 0, sizeof(earray_test_t));
+ base_entry->idx = (uint64_t)-1;
+ base_entry->fd_info = &fd_info;
+
+ /* Insert test entry into cache */
+ base_addr = HADDR_MAX;
+ if(H5AC_set(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0)
+ TEST_ERROR
+
+ /* Set the base entry as a flush dependency for the array */
+ if(H5EA_depend((H5AC_info_t *)base_entry, ea) < 0)
+ TEST_ERROR
+
/* Create entry #1 to insert */
if(NULL == (entry1 = (earray_test_t *)HDmalloc(sizeof(earray_test_t))))
TEST_ERROR
@@ -1421,7 +1453,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Set the test entry as a flush dependency for 0th index in the array */
- if(H5EA_depend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0)
+ if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0)
TEST_ERROR
/* Set element of array */
@@ -1443,7 +1475,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Set the test entry as a flush dependency for 1st index in the array */
- if(H5EA_depend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0)
+ if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0)
TEST_ERROR
/* Set element of array */
@@ -1465,7 +1497,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Set the test entry as a flush dependency for 10,000th index in the array */
- if(H5EA_depend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0)
+ if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0)
TEST_ERROR
/* Set element of array */
@@ -1480,6 +1512,8 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Check that all callback flags have been set */
+ if(!fd_info.base_obj)
+ TEST_ERROR
if(!fd_info.idx0_obj)
TEST_ERROR
if(!fd_info.idx0_elem)
@@ -1494,8 +1528,20 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
+ /* Remove the base entry as a flush dependency for the array */
+ if(H5EA_undepend((H5AC_info_t *)base_entry, ea) < 0)
+ TEST_ERROR
+
+ /* Protect the base entry */
+ if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, NULL, NULL, H5AC_WRITE)))
+ TEST_ERROR
+
+ /* Unprotect & unpin the base entry */
+ if(H5AC_unprotect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0)
+ TEST_ERROR
+
/* Remove the test entry as a flush dependency for 0th index in the array */
- if(H5EA_undepend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0)
+ if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0)
TEST_ERROR
/* Protect the test entry */
@@ -1507,7 +1553,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Remove the test entry as a flush dependency for 1st index in the array */
- if(H5EA_undepend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0)
+ if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0)
TEST_ERROR
/* Protect the test entry */
@@ -1519,7 +1565,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t UNUSED
TEST_ERROR
/* Remove the test entry as a flush dependency for 10,000th index in the array */
- if(H5EA_undepend(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0)
+ if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0)
TEST_ERROR
/* Protect the test entry */