diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2009-02-16 21:33:04 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2009-02-16 21:33:04 (GMT) |
commit | 61346d50fab0dbaadd313e46cc968d4e4ad26c82 (patch) | |
tree | c97b8cd021fdf412cd5d1e13d77088c55136626b /test | |
parent | f023ea68dc0fd97a313c292e9b6f2ea847a50768 (diff) | |
download | hdf5-61346d50fab0dbaadd313e46cc968d4e4ad26c82.zip hdf5-61346d50fab0dbaadd313e46cc968d4e4ad26c82.tar.gz hdf5-61346d50fab0dbaadd313e46cc968d4e4ad26c82.tar.bz2 |
[svn-r16487] Checkin for moving messages forward into continuation message:
src/H5Oalloc.c, test/ohdr.c, toshm.c
Fixed couple of problems in src/H5Odbg.c.
h5committested.
Diffstat (limited to 'test')
-rw-r--r-- | test/ohdr.c | 101 | ||||
-rw-r--r-- | test/tsohm.c | 4 |
2 files changed, 103 insertions, 2 deletions
diff --git a/test/ohdr.c b/test/ohdr.c index 2d4f057..905551d 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -43,6 +43,101 @@ const char *FILENAME[] = { */ #define FILE_BOGUS "tbogus.h5" +/* + * Verify that messages are moved forward into a "continuation message": + * Create an object header with several continuation chunks + * Remove a message in the last chunk + * The remaining message(s) in the last chunk should be moved forward into the continuation message + * The process will repeat when the continuation message is big enough to hold all the + * messages in the last chunk. + * Result: the number of chunks should be reduced + */ +static herr_t +test_cont(char *filename, hid_t fapl) +{ + hid_t file=-1; + H5F_t *f = NULL; + H5O_info_t oinfo; + H5O_loc_t oh_locA, oh_locB; + time_t time_new; + char *short_name = "T"; + char *long_name = "This is the message"; + size_t nchunks; + + TESTING("object header continuation block"); + + /* Create the file to operate on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + + HDmemset(&oh_locA, 0, sizeof(oh_locA)); + HDmemset(&oh_locB, 0, sizeof(oh_locB)); + + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) + FAIL_STACK_ERROR + + if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) + FAIL_STACK_ERROR + + time_new = 11111111; + + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE) < 0) + FAIL_STACK_ERROR + + if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0) + FAIL_STACK_ERROR + nchunks = oinfo.hdr.nchunks; + + /* remove the 1st H5O_NAME_ID message */ + if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0) + FAIL_STACK_ERROR + + if(H5O_get_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, FALSE, &oinfo) < 0) + FAIL_STACK_ERROR + + if (oinfo.hdr.nchunks >= nchunks) + TEST_ERROR + + if(H5O_close(&oh_locA) < 0) + FAIL_STACK_ERROR + if(H5O_close(&oh_locB) < 0) + FAIL_STACK_ERROR + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + + return 0; + +error: + H5E_BEGIN_TRY { + H5O_close(&oh_locA); + H5O_close(&oh_locB); + H5Fclose (file); + } H5E_END_TRY; + return -1; +} /* test_cont() */ + /*------------------------------------------------------------------------- * Function: main @@ -84,12 +179,16 @@ main(void) /* Display info about testing */ if(b) HDputs("Using new file format:"); - else + else HDputs("Using default file format:"); /* Set the format to use for the file */ if (H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + /* test on object continuation block */ + if (test_cont(filename, fapl) < 0) + FAIL_STACK_ERROR + /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR diff --git a/test/tsohm.c b/test/tsohm.c index 47c087e..0516590 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -2348,8 +2348,10 @@ static void test_sohm_size2(int close_reopen) if((list_index_big.attrs1 - list_index_big.interleaved) >= (list_index_small.attrs1 - list_index_small.interleaved)) VERIFY(0, 1, "h5_get_file_size"); + + /* Give it some overhead (for checkin to move messages into continuation message) */ if((list_index_small.attrs1 - list_index_small.interleaved) > - (btree_index.attrs1 - btree_index.interleaved)) + ((btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED)) VERIFY(0, 1, "h5_get_file_size"); |