summaryrefslogtreecommitdiffstats
path: root/test/accum.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/accum.c')
-rw-r--r--test/accum.c213
1 files changed, 110 insertions, 103 deletions
diff --git a/test/accum.c b/test/accum.c
index fc7546d..ba0cea1 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -43,18 +43,18 @@
H5F_t * f = NULL;
/* Function Prototypes */
-unsigned test_write_read(void);
-unsigned test_write_read_nonacc_front(void);
-unsigned test_write_read_nonacc_end(void);
-unsigned test_accum_overlap(void);
-unsigned test_accum_overlap_clean(void);
-unsigned test_accum_overlap_size(void);
-unsigned test_accum_non_overlap_size(void);
-unsigned test_accum_adjust(void);
-unsigned test_read_after(void);
-unsigned test_free(void);
-unsigned test_big(void);
-unsigned test_random_write(void);
+unsigned test_write_read(const H5F_io_info_t *fio_info);
+unsigned test_write_read_nonacc_front(const H5F_io_info_t *fio_info);
+unsigned test_write_read_nonacc_end(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap_clean(const H5F_io_info_t *fio_info);
+unsigned test_accum_overlap_size(const H5F_io_info_t *fio_info);
+unsigned test_accum_non_overlap_size(const H5F_io_info_t *fio_info);
+unsigned test_accum_adjust(const H5F_io_info_t *fio_info);
+unsigned test_read_after(const H5F_io_info_t *fio_info);
+unsigned test_free(const H5F_io_info_t *fio_info);
+unsigned test_big(const H5F_io_info_t *fio_info);
+unsigned test_random_write(const H5F_io_info_t *fio_info);
unsigned test_swmr_write_big(void);
/* Helper Function Prototypes */
@@ -63,9 +63,9 @@ void accum_printf(void);
/* Private Test H5Faccum Function Wrappers */
#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b))
-#define accum_free(a,s) H5F_accum_free(f, H5P_DATASET_XFER_DEFAULT, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
-#define accum_flush() H5F_accum_flush(f, H5P_DATASET_XFER_DEFAULT)
-#define accum_reset() H5F_accum_reset(f, H5P_DATASET_XFER_DEFAULT, TRUE)
+#define accum_free(fio_info,a,s) H5F__accum_free(fio_info, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s))
+#define accum_flush(fio_info) H5F__accum_flush(fio_info)
+#define accum_reset(fio_info) H5F__accum_reset(fio_info, TRUE)
/* ================= */
/* Main Test Routine */
@@ -88,6 +88,7 @@ void accum_printf(void);
int
main(void)
{
+ H5F_io_info_t fio_info; /* I/O info for operation */
unsigned nerrors = 0; /* track errors */
hid_t fid = -1;
@@ -104,22 +105,26 @@ main(void)
file a ways. 10MB should do. */
if(H5FD_set_eoa(f->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) FAIL_STACK_ERROR
+
/* Reset metadata accumulator for the file */
- if(accum_reset() < 0) FAIL_STACK_ERROR
+ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR
/* Test Functions */
- nerrors += test_write_read();
- nerrors += test_write_read_nonacc_front();
- nerrors += test_write_read_nonacc_end();
- nerrors += test_accum_overlap();
- nerrors += test_accum_overlap_clean();
- nerrors += test_accum_overlap_size();
- nerrors += test_accum_non_overlap_size();
- nerrors += test_accum_adjust();
- nerrors += test_read_after();
- nerrors += test_free();
- nerrors += test_big();
- nerrors += test_random_write();
+ nerrors += test_write_read(&fio_info);
+ nerrors += test_write_read_nonacc_front(&fio_info);
+ nerrors += test_write_read_nonacc_end(&fio_info);
+ nerrors += test_accum_overlap(&fio_info);
+ nerrors += test_accum_overlap_clean(&fio_info);
+ nerrors += test_accum_overlap_size(&fio_info);
+ nerrors += test_accum_non_overlap_size(&fio_info);
+ nerrors += test_accum_adjust(&fio_info);
+ nerrors += test_read_after(&fio_info);
+ nerrors += test_free(&fio_info);
+ nerrors += test_big(&fio_info);
+ nerrors += test_random_write(&fio_info);
/* End of test code, close and delete file */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -158,7 +163,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read(void)
+test_write_read(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -181,7 +186,7 @@ test_write_read(void)
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -214,7 +219,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read_nonacc_front(void)
+test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -234,13 +239,13 @@ test_write_read_nonacc_front(void)
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush() < 0) FAIL_STACK_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -273,7 +278,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_write_read_nonacc_end(void)
+test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
{
int i = 0;
int *write_buf, *read_buf;
@@ -293,13 +298,13 @@ test_write_read_nonacc_end(void)
/* Do a simple write/read/verify of data */
/* Write 1KB at Address 0 */
if(accum_write(1024, 1024, write_buf) < 0) FAIL_STACK_ERROR;
- if(accum_flush() < 0) FAIL_STACK_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(1024, 1024, read_buf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -332,7 +337,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_free(void)
+test_free(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf = NULL;
@@ -355,38 +360,38 @@ test_free(void)
if(accum_write(0, 256 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
- if(accum_free(0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Free an empty accumulator */
- if(accum_free(0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, 256 * 1024 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write second quarter of the accumulator */
if(accum_write(64 * sizeof(int32_t), 64 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the second quarter of the accumulator, the requested area
* is bigger than the data region on the right side. */
- if(accum_free(64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 64 * sizeof(int32_t), 65 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Write half of the accumulator. */
if(accum_write(0, 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
/* Free the first block of 4B */
- if(accum_free(0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 0, sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 127 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 127 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 127*4B */
- if(accum_free(127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 127 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf + 1, rbuf, 126 * sizeof(int32_t)) != 0) TEST_ERROR;
/* Free the block of 4B at 2*4B */
- if(accum_free(2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 2 * sizeof(int32_t), sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(1 * sizeof(int32_t), 1 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -399,10 +404,10 @@ test_free(void)
* entirely before dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(66 * sizeof(int32_t), 126 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -413,10 +418,10 @@ test_free(void)
* completely contains dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(68 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 68, wbuf, 4 * sizeof(int32_t));
- if(accum_free(62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 62 * sizeof(int32_t), 16 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -427,10 +432,10 @@ test_free(void)
* before dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 66 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(70 * sizeof(int32_t), 122 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -441,10 +446,10 @@ test_free(void)
* dirty section, and ends in dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(74 * sizeof(int32_t), 118 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -455,10 +460,10 @@ test_free(void)
* contains dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 4 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 4 * sizeof(int32_t));
- if(accum_free(70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 70 * sizeof(int32_t), 8 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(78 * sizeof(int32_t), 114 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -469,10 +474,10 @@ test_free(void)
* of dirty section, and ends in dirty section */
if(accum_write(64 * sizeof(int32_t), 128 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 64, wbuf, 128 * sizeof(int32_t));
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
if(accum_write(72 * sizeof(int32_t), 8 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
HDmemcpy(expect + 72, wbuf, 8 * sizeof(int32_t));
- if(accum_free(72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
+ if(accum_free(fio_info, 72 * sizeof(int32_t), 4 * sizeof(int32_t)) < 0) FAIL_STACK_ERROR;
/* Check that the accumulator still contains the correct data */
if(accum_read(76 * sizeof(int32_t), 116 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
@@ -485,7 +490,7 @@ test_free(void)
HDfree(expect);
expect = NULL;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -519,7 +524,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap(void)
+test_accum_overlap(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -655,7 +660,7 @@ test_accum_overlap(void)
if(accum_read(112, 6 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 6 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -691,7 +696,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap_clean(void)
+test_accum_overlap_clean(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -717,7 +722,7 @@ test_accum_overlap_clean(void)
/* Case 2: End of new piece aligns with start of clean accumulated data */
/* Write 5 2's at address 20 */
/* @0:| 222221111111111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 5; i++)
wbuf[i] = 2;
if(accum_write(20, 5 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -757,7 +762,7 @@ test_accum_overlap_clean(void)
/* Case 6: New piece completely within clean accumulated data */
/* Write 3 6's at address 44 */
/* @0:| 333334666511111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 3; i++)
wbuf[i] = 6;
if(accum_write(44, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -767,7 +772,7 @@ test_accum_overlap_clean(void)
/* Case 7: New piece overlaps start of clean accumulated data */
/* Write 2 7's at address 16 */
/* @0:| 7733334666511111| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 2; i++)
wbuf[i] = 7;
if(accum_write(16, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -787,7 +792,7 @@ test_accum_overlap_clean(void)
/* Case 9: Start of new piece aligns with end of clean accumulated data */
/* Write 3 9's at address 80 */
/* @0:| 88883334666511111999| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 3; i++)
wbuf[i] = 9;
if(accum_write(80, 3 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -797,7 +802,7 @@ test_accum_overlap_clean(void)
/* Case 10: New piece overlaps end of clean accumulated data */
/* Write 3 2's at address 88 */
/* @0:| 888833346665111119922| */
- if(accum_flush() < 0) FAIL_STACK_ERROR;
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR;
for(i = 0; i < 2; i++)
wbuf[i] = 2;
if(accum_write(88, 2 * sizeof(int32_t), wbuf) < 0) FAIL_STACK_ERROR;
@@ -835,7 +840,7 @@ test_accum_overlap_clean(void)
if(accum_read(12, 22 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 22 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -870,7 +875,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_non_overlap_size(void)
+test_accum_non_overlap_size(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -902,7 +907,7 @@ test_accum_non_overlap_size(void)
if(accum_read(0, 20 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 20 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -937,7 +942,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_overlap_size(void)
+test_accum_overlap_size(const H5F_io_info_t *fio_info)
{
int i = 0;
int32_t *wbuf, *rbuf;
@@ -969,7 +974,7 @@ test_accum_overlap_size(void)
if(accum_read(60, 72 * sizeof(int32_t), rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, 72 * sizeof(int32_t)) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1015,7 +1020,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_accum_adjust(void)
+test_accum_adjust(const H5F_io_info_t *fio_info)
{
int i = 0;
int s = 1048576; /* size of buffer */
@@ -1061,7 +1066,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ================================================================ */
/* Case 2: Prepending large block to large, fully dirty accumulator */
@@ -1090,7 +1095,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, (size_t)1048571) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ========================================================= */
/* Case 3: Appending small block to large, clean accumulator */
@@ -1104,7 +1109,7 @@ test_accum_adjust(void)
/* Flush the accumulator -- we want to test the case when
accumulator contains clean data */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* Write a small (1KB) block to the end of the accumulator */
/* ==> Accumulator will need more buffer space */
@@ -1125,7 +1130,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 4: Appending small block to large, partially dirty accumulator, */
@@ -1139,7 +1144,7 @@ test_accum_adjust(void)
if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* write to part of the accumulator so just the start of it is dirty */
if(accum_write(0, 5, wbuf) < 0) FAIL_STACK_ERROR;
@@ -1165,7 +1170,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ==================================================================== */
/* Case 5: Appending small block to large, partially dirty accumulator, */
@@ -1176,7 +1181,7 @@ test_accum_adjust(void)
if(accum_write(0, (1024 * 1024) - 5, wbuf) < 0) FAIL_STACK_ERROR;
/* Flush the accumulator to clean it */
- if(accum_flush() < 0) FAIL_STACK_ERROR
+ if(accum_flush(fio_info) < 0) FAIL_STACK_ERROR
/* write to part of the accumulator so it's dirty, but not entirely dirty */
/* (just the begging few bytes will be clean) */
@@ -1202,7 +1207,7 @@ test_accum_adjust(void)
if(HDmemcmp(wbuf, rbuf, (size_t)10) != 0) TEST_ERROR;
/* Reset accumulator for next case */
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* ================================================================= */
/* Case 6: Appending small block to large, fully dirty accumulator */
@@ -1233,7 +1238,7 @@ test_accum_adjust(void)
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1271,7 +1276,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_read_after(void)
+test_read_after(const H5F_io_info_t *fio_info)
{
int i = 0;
int s = 128; /* size of buffer */
@@ -1316,7 +1321,7 @@ test_read_after(void)
if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
if(HDmemcmp(wbuf, rbuf, (size_t)128) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1350,7 +1355,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_big(void)
+test_big(const H5F_io_info_t *fio_info)
{
uint8_t *wbuf, *wbuf2, *rbuf, *zbuf; /* Buffers for reading & writing, etc */
unsigned u; /* Local index variable */
@@ -1386,7 +1391,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
@@ -1405,7 +1410,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
@@ -1423,7 +1428,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(BIG_BUF_SIZE - 512, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with beginning of "big" region */
@@ -1441,7 +1446,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to middle of accumulator */
@@ -1463,7 +1468,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to overlap with end of "big" region */
@@ -1486,7 +1491,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 512, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
@@ -1514,7 +1519,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1024));
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section to be past "big" region */
@@ -1542,7 +1547,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1536, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1569,7 +1574,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(512, BIG_BUF_SIZE, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1597,7 +1602,7 @@ test_big(void)
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, BIG_BUF_SIZE + 1536, zbuf) < 0) FAIL_STACK_ERROR;
HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
/* Write small section before "big" region */
@@ -1621,7 +1626,7 @@ test_big(void)
if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1658,7 +1663,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_random_write(void)
+test_random_write(const H5F_io_info_t *fio_info)
{
uint8_t *wbuf, *rbuf; /* Buffers for reading & writing */
unsigned seed = 0; /* Random # seed */
@@ -1758,7 +1763,7 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
/* Verify data read back in */
if(HDmemcmp(wbuf, rbuf, (size_t)RANDOM_BUF_SIZE) != 0) TEST_ERROR;
- if(accum_reset() < 0) FAIL_STACK_ERROR;
+ if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
PASSED();
@@ -1810,6 +1815,7 @@ test_swmr_write_big(void)
unsigned u; /* Local index variable */
pid_t pid; /* Process ID */
int status; /* Status returned from child process */
+ H5F_io_info_t fio_info; /* I/O info for operation */
char *new_argv[] = {NULL};
char *new_envp[] = {NULL};
@@ -1838,13 +1844,16 @@ test_swmr_write_big(void)
/* Get H5F_t * to internal file structure */
if(NULL == (rf = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR
+ /* Set up I/O info for operation */
+ fio_info.f = rf;
+ if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) FAIL_STACK_ERROR
+
/* We'll be writing lots of garbage data, so extend the
file a ways. 10MB should do. */
if(H5FD_set_eoa(rf->shared->lf, H5FD_MEM_DEFAULT, (haddr_t)(1024*1024*10)) < 0) FAIL_STACK_ERROR
/* Reset metadata accumulator for the file */
- if(H5F_accum_reset(rf, H5P_DATASET_XFER_DEFAULT, TRUE) < 0)
- FAIL_STACK_ERROR;
+ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR;
/* Allocate space for the write & read buffers */
if((wbuf2 = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE)) == NULL)
@@ -1865,8 +1874,7 @@ test_swmr_write_big(void)
/* Verify the data read is correct */
if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Flush the data to disk */
- if(H5F_accum_reset(rf, H5P_DATASET_XFER_DEFAULT, TRUE) < 0)
- FAIL_STACK_ERROR;
+ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR;
/* Initialize wbuf with all 1s */
for(u = 0; u < 1024; u++)
@@ -1913,8 +1921,7 @@ test_swmr_write_big(void)
/* Check if child process terminates normally and its return value */
if(WIFEXITED(status) && !WEXITSTATUS(status)) {
/* Flush the accumulator */
- if(H5F_accum_reset(rf, H5P_DATASET_XFER_DEFAULT, TRUE) < 0)
- FAIL_STACK_ERROR;
+ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR;
/* Close the property list */
if(H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;