summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-02-05 20:21:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-02-05 20:21:31 (GMT)
commit3c882637c2ca6b13337f3a32d92ea2bc9c068fde (patch)
tree4f8669a66d9041a5f3f4c1803c704d1a7265bc2f /test
parent4adbc1e1db51c50f0f0187abfbb4c640b1ec2d1b (diff)
downloadhdf5-3c882637c2ca6b13337f3a32d92ea2bc9c068fde.zip
hdf5-3c882637c2ca6b13337f3a32d92ea2bc9c068fde.tar.gz
hdf5-3c882637c2ca6b13337f3a32d92ea2bc9c068fde.tar.bz2
[svn-r16444] Description:
Bring r16412:16440 from trunk into revise_chunks branch. Tested on: FreeBSD/32 6.3(duty) (h5committest not required on this branch)
Diffstat (limited to 'test')
-rw-r--r--test/h5test.h1
-rw-r--r--test/ohdr.c101
-rw-r--r--test/set_extent.c80
-rw-r--r--test/tsohm.c4
4 files changed, 151 insertions, 35 deletions
diff --git a/test/h5test.h b/test/h5test.h
index dd3bb32..64d43cc 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -99,6 +99,7 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
* the H5_FAILED() macro is invoked automatically when an API function fails.
*/
#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);}
+#define TESTING2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);}
#define PASSED() {puts(" PASSED");fflush(stdout);}
#define H5_FAILED() {puts("*FAILED*");fflush(stdout);}
#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
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/set_extent.c b/test/set_extent.c
index e145cff..87ff91c 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -30,12 +30,16 @@
*-------------------------------------------------------------------------
*/
-
-#define FILE_NAME1 "set_extent1.h5"
-#define FILE_NAME2 "set_extent2.h5"
-#define FILE_NAME3 "set_extent3.h5"
-#define FILE_NAME4 "set_extent4.h5"
-#define FILE_NAME5 "set_extent5.h5"
+const char *FILENAME[] = {
+ "set_extent1",
+ "set_extent2",
+ "set_extent3",
+ "set_extent4",
+ "set_extent5",
+ NULL
+};
+
+#define NAME_BUF_SIZE 1024
#define EXT_FILE_NAME1 "ext1.bin"
#define EXT_FILE_NAME2 "ext2.bin"
@@ -102,7 +106,7 @@ int main( void )
/* Set the FAPL for the type of format */
if(new_format) {
- puts("\nTesting with new file format:");
+ puts("Testing with new file format:");
my_fapl = fapl2;
} /* end if */
else {
@@ -117,12 +121,9 @@ int main( void )
/* Close 2nd FAPL */
if(H5Pclose(fapl2) < 0) TEST_ERROR
+
+ h5_cleanup(FILENAME, fapl);
- HDremove(FILE_NAME1);
- HDremove(FILE_NAME2);
- HDremove(FILE_NAME3);
- HDremove(FILE_NAME4);
- HDremove(FILE_NAME5);
HDremove(EXT_FILE_NAME1);
HDremove(EXT_FILE_NAME2);
@@ -152,7 +153,7 @@ static int do_ranks( hid_t fapl )
hbool_t set_istore_k = 0;
- TESTING("with fill value, no compression");
+ TESTING2("with fill value, no compression");
do_fillvalue = 1;
@@ -186,7 +187,7 @@ static int do_ranks( hid_t fapl )
PASSED();
- TESTING("no fill value, no compression");
+ TESTING2("no fill value, no compression");
do_fillvalue = 0;
@@ -207,7 +208,7 @@ static int do_ranks( hid_t fapl )
PASSED();
- TESTING("with fill value, with compression");
+ TESTING2("with fill value, with compression");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -245,7 +246,7 @@ static int do_ranks( hid_t fapl )
SKIPPED();
#endif
- TESTING("no fill value, with compression");
+ TESTING2("no fill value, with compression");
#ifdef H5_HAVE_FILTER_DEFLATE
@@ -269,7 +270,7 @@ static int do_ranks( hid_t fapl )
SKIPPED();
#endif
- TESTING("with non-default indexed storage B-tree");
+ TESTING2("with non-default indexed storage B-tree");
do_fillvalue = 1;
set_istore_k = 1;
@@ -298,7 +299,7 @@ error:
static int do_layouts( hid_t fapl )
{
- TESTING("storage layout use");
+ TESTING2("storage layout use");
if (test_layouts( H5D_COMPACT, fapl ) < 0)
{
@@ -348,6 +349,7 @@ static int test_rank1( hbool_t do_compress,
int i;
int fillvalue = 1;
int comp_value;
+ char filename[NAME_BUF_SIZE];
if ( do_fill_value )
{
@@ -381,7 +383,8 @@ static int test_rank1( hbool_t do_compress,
}
/* create a new file */
- if ((fid = H5Fcreate(FILE_NAME1, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
goto error;
}
@@ -602,7 +605,7 @@ static int test_rank1( hbool_t do_compress,
goto error;
}
- if ((fid = H5Fopen( FILE_NAME1, H5F_ACC_RDWR, H5P_DEFAULT ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
goto error;
}
@@ -882,6 +885,7 @@ static int test_rank2( hbool_t do_compress,
int i, j;
int fillvalue = 1;
int comp_value;
+ char filename[NAME_BUF_SIZE];
if ( do_fill_value )
{
@@ -916,17 +920,15 @@ static int test_rank2( hbool_t do_compress,
}
}
+
/* create a new file */
- if ((fid = H5Fcreate(FILE_NAME2, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
goto error;
}
- /* close property list */
- if(H5Pclose(fcpl) < 0)
- {
- goto error;
- }
+
/* create the data space with unlimited dimensions. */
if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0)
@@ -1175,7 +1177,7 @@ static int test_rank2( hbool_t do_compress,
goto error;
}
- if ((fid = H5Fopen( FILE_NAME2, H5F_ACC_RDWR, H5P_DEFAULT ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
goto error;
}
@@ -1417,6 +1419,12 @@ static int test_rank2( hbool_t do_compress,
goto error;
}
+ /* close file creation property list */
+ if(H5Pclose(fcpl) < 0)
+ {
+ goto error;
+ }
+
if (H5Fclose( fid ) < 0)
{
goto error;
@@ -1474,6 +1482,7 @@ static int test_rank3( hbool_t do_compress,
int i, j, k;
int fillvalue = 1;
int comp_value;
+ char filename[NAME_BUF_SIZE];
if ( do_fill_value )
{
@@ -1512,7 +1521,8 @@ static int test_rank3( hbool_t do_compress,
}
/* create a new file */
- if ((fid = H5Fcreate(FILE_NAME3, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
goto error;
}
@@ -1752,7 +1762,7 @@ static int test_rank3( hbool_t do_compress,
goto error;
}
- if ((fid = H5Fopen( FILE_NAME3, H5F_ACC_RDWR, H5P_DEFAULT ))<0)
+ if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0)
{
goto error;
}
@@ -2051,6 +2061,7 @@ static int test_external( hid_t fapl )
int buf_ro[DIM0][DIM1]; /* original buffer for reading */
int i, j;
int comp_value = 0;
+ char filename[NAME_BUF_SIZE];
hsize_t size; /* number of bytes reserved in the file for the data */
@@ -2069,10 +2080,11 @@ static int test_external( hid_t fapl )
}
}
- TESTING("external file use");
+ TESTING2("external file use");
/* create a new file */
- if ((fid = H5Fcreate(FILE_NAME4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* modify dataset creation properties */
@@ -2383,7 +2395,8 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
hsize_t dims_r[RANK2]; /* read dimensions */
int buf_o[DIM0][DIM1];
int buf_r[DIM0][DIM1];
- int i, j;
+ int i, j;
+ char filename[NAME_BUF_SIZE];
for( i = 0; i < DIM0; i++ )
{
@@ -2395,7 +2408,8 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl )
/* create a new file */
- if ((fid = H5Fcreate(FILE_NAME5, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
{
goto 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");