diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2014-06-19 20:09:06 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2014-06-19 20:09:06 (GMT) |
commit | 67ba5eb6e8a71a110d47fd3079edcc1fe09fb95f (patch) | |
tree | 92735056c19013281c6ba687e836ed59772e2f3e /test | |
parent | 02eab2eb72a18fa685545ba7c7c5ac7715693d1b (diff) | |
download | hdf5-67ba5eb6e8a71a110d47fd3079edcc1fe09fb95f.zip hdf5-67ba5eb6e8a71a110d47fd3079edcc1fe09fb95f.tar.gz hdf5-67ba5eb6e8a71a110d47fd3079edcc1fe09fb95f.tar.bz2 |
[svn-r25333] Bring revisions #24948 - #25120 from trunk to revise_chunks.
Tested on jam, ostrich, koala, platypus.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeTests.cmake | 2 | ||||
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/Makefile.in | 4 | ||||
-rw-r--r-- | test/accum.c | 213 | ||||
-rw-r--r-- | test/dsets.c | 11 | ||||
-rw-r--r-- | test/enc_dec_plist.c | 3 | ||||
-rw-r--r-- | test/gen_bogus.c | 2 | ||||
-rw-r--r-- | test/gen_plist.c | 2 | ||||
-rw-r--r-- | test/h5test.c | 104 | ||||
-rw-r--r-- | test/testfiles/plist_files/fapl_be | bin | 1402 -> 1462 bytes | |||
-rw-r--r-- | test/testfiles/plist_files/fapl_le | bin | 1402 -> 1462 bytes | |||
-rw-r--r-- | test/testfiles/plist_files/lapl_be | bin | 1502 -> 1562 bytes | |||
-rw-r--r-- | test/testfiles/plist_files/lapl_le | bin | 1502 -> 1562 bytes | |||
-rw-r--r-- | test/tmisc.c | 110 | ||||
-rw-r--r-- | test/tselect.c | 12 | ||||
-rw-r--r-- | test/vfd.c | 13 |
16 files changed, 319 insertions, 159 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5c703c0..cf3c54b 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -253,7 +253,7 @@ foreach (test ${H5_TESTS}) set_tests_properties (H5TEST-${test} PROPERTIES DEPENDS H5TEST-clear-objects) endforeach (test ${H5_TESTS}) -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS flush1) +set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) ############################################################################## ############################################################################## diff --git a/test/Makefile.am b/test/Makefile.am index 4730fa1..e0eb0e9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -110,7 +110,7 @@ LDADD=libh5test.la $(LIBHDF5) ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c -VFD_LIST = sec2 stdio core split multi family +VFD_LIST = sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif diff --git a/test/Makefile.in b/test/Makefile.in index c2481b6..e976578 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -993,7 +993,6 @@ LIPO = @LIPO@ LL_PATH = @LL_PATH@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_ADD_LIBHDF5_DEPENDENCY = @LT_ADD_LIBHDF5_DEPENDENCY@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -1253,7 +1252,8 @@ LDADD = libh5test.la $(LIBHDF5) ttsafe_SOURCES = ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c -VFD_LIST = sec2 stdio core split multi family $(am__append_4) +VFD_LIST = sec2 stdio core core_paged split multi family \ + $(am__append_4) # Sources for testhdf5 executable testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ 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; diff --git a/test/dsets.c b/test/dsets.c index a2f8e2b..768b268 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6788,8 +6788,17 @@ test_zero_dims(hid_t file) } else if(idx_type != H5D_CHUNK_IDX_BTREE) FAIL_PUTS_ERROR("should be using v1 B-tree as index"); - /* Just a no-op */ + /* Various no-op writes */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dwrite(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + + /* Various no-op reads */ + if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR + if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR if(H5Dclose(d) < 0) FAIL_STACK_ERROR if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 2d0d732..4832767 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -18,6 +18,7 @@ */ #include "h5test.h" +#include "H5ACprivate.h" #include "H5Pprivate.h" static int @@ -381,6 +382,8 @@ main(void) FAIL_STACK_ERROR if((H5Pset_mdc_config(fapl, &my_cache_config)) < 0) FAIL_STACK_ERROR + if((H5Pset_core_write_tracking(fapl, TRUE, 1024 * 1024)) < 0) + FAIL_STACK_ERROR /* Test encoding & decoding property list */ if(test_encode_decode(fapl) < 0) diff --git a/test/gen_bogus.c b/test/gen_bogus.c index 7456ae6..7d8d073 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -20,7 +20,7 @@ * Purpose: This program is run to generate an HDF5 data file with several * datasets that have "bogus" messages in their object header. */ -
+ #include "H5private.h" #include "hdf5.h" #include "H5Oprivate.h" diff --git a/test/gen_plist.c b/test/gen_plist.c index b4da261..acc5f3e 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -327,6 +327,8 @@ main(void) assert(ret > 0); if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0) assert(ret > 0); + if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) + assert(ret > 0); if((ret = encode_plist(fapl1, little_endian, "testfiles/plist_files/fapl_le", "testfiles/plist_files/fapl_be")) < 0) assert(ret > 0); diff --git a/test/h5test.c b/test/h5test.c index 9fe05ae..769e03f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -511,64 +511,71 @@ h5_fileaccess(void) /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER - if (!val) val = HDF5_DRIVER; + if (!val) + val = HDF5_DRIVER; #endif - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1; - if (!val || !*val) return fapl; /*use default*/ + if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) + return -1; + if (!val || !*val) + return fapl; /*use default*/ HDstrncpy(s, val, sizeof s); s[sizeof(s)-1] = '\0'; if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl; if (!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl)<0) return -1; + /* Unix read() and write() system calls */ + if (H5Pset_fapl_sec2(fapl)<0) return -1; } else if (!HDstrcmp(name, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl)<0) return -1; + /* Standard C fread() and fwrite() system calls */ + if (H5Pset_fapl_stdio(fapl)<0) return -1; } else if (!HDstrcmp(name, "core")) { - /* In-core temporary file with 1MB increment */ - if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; - } else if (!HDstrcmp(name, "split")) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, + /* In-memory driver settings (backing store on, 1 MB increment) */ + if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; + } else if (!HDstrcmp(name, "core_paged")) { + /* In-memory driver with write tracking and paging on */ + if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1; + if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096)<0) return -1; + } else if (!HDstrcmp(name, "split")) { + /* Split meta data and raw data each using default driver */ + if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0) - return -1; + return -1; } else if (!HDstrcmp(name, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; H5FD_mem_t mt; - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - - HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_fapl[mt] = H5P_DEFAULT; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, - memb_addr, FALSE)<0) { - return -1; - } + HDmemset(memb_map, 0, sizeof memb_map); + HDmemset(memb_fapl, 0, sizeof memb_fapl); + HDmemset(memb_name, 0, sizeof memb_name); + HDmemset(memb_addr, 0, sizeof memb_addr); + + HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + memb_fapl[mt] = H5P_DEFAULT; + sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } /* end for */ + + if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, + memb_addr, FALSE)<0) { + return -1; + } } else if (!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ - /* Family of files, each 1MB and using the default driver */ - if ((val=HDstrtok(NULL, " \t\n\r"))) - fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) + /* Family of files, each 1MB and using the default driver */ + if ((val=HDstrtok(NULL, " \t\n\r"))) + fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; } else if (!HDstrcmp(name, "log")) { unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; @@ -578,20 +585,21 @@ h5_fileaccess(void) log_flags = (unsigned)HDstrtol(val, NULL, 0); if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - return -1; + return -1; } else if (!HDstrcmp(name, "direct")) { #ifdef H5_HAVE_DIRECT - /* Linux direct read() and write() system calls. Set memory boundary, file block size, - * and copy buffer size to the default values. */ - if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) return -1; + /* Linux direct read() and write() system calls. Set memory boundary, file block size, + * and copy buffer size to the default values. */ + if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) + return -1; #endif } else if(!HDstrcmp(name, "latest")) { - /* use the latest format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + /* use the latest format */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; } else { - /* Unknown driver */ - return -1; + /* Unknown driver */ + return -1; } return fapl; diff --git a/test/testfiles/plist_files/fapl_be b/test/testfiles/plist_files/fapl_be Binary files differindex 8fcefa2..0b050d0 100644 --- a/test/testfiles/plist_files/fapl_be +++ b/test/testfiles/plist_files/fapl_be diff --git a/test/testfiles/plist_files/fapl_le b/test/testfiles/plist_files/fapl_le Binary files differindex 8fcefa2..0b050d0 100644 --- a/test/testfiles/plist_files/fapl_le +++ b/test/testfiles/plist_files/fapl_le diff --git a/test/testfiles/plist_files/lapl_be b/test/testfiles/plist_files/lapl_be Binary files differindex 30f52a4..e58bfb4 100644 --- a/test/testfiles/plist_files/lapl_be +++ b/test/testfiles/plist_files/lapl_be diff --git a/test/testfiles/plist_files/lapl_le b/test/testfiles/plist_files/lapl_le Binary files differindex 30f52a4..e58bfb4 100644 --- a/test/testfiles/plist_files/lapl_le +++ b/test/testfiles/plist_files/lapl_le diff --git a/test/tmisc.c b/test/tmisc.c index 512d029..cac6b04 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -316,6 +316,15 @@ unsigned m13_rdata[MISC13_DIM1][MISC13_DIM2]; /* Data read from dataset /* Definitions for misc. test #30 */ #define MISC30_FILE "tmisc30.h5" +/* Definitions for misc. test #31 */ +#define MISC31_FILE "tmisc31.h5" +#define MISC31_DSETNAME "dset" +#define MISC31_ATTRNAME1 "attr1" +#define MISC31_ATTRNAME2 "attr2" +#define MISC31_GROUPNAME "group" +#define MISC31_PROPNAME "misc31_prop" +#define MISC31_DTYPENAME "dtype" + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -5195,6 +5204,105 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ + +/**************************************************************** +** +** test_misc31(): Test reentering library through deprecated +* routines that register an id after calling +* H5close(). +** +****************************************************************/ +static void +test_misc31(void) +{ + hid_t file_id; /* File id */ + hid_t space_id; /* Dataspace id */ + hid_t dset_id; /* Dataset id */ + hid_t attr_id; /* Attribute id */ + hid_t group_id; /* Group id */ + hid_t dtype_id; /* Datatype id */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Deprecated routines initialize after H5close()\n")); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + file_id = H5Fcreate(MISC31_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fcreate"); + + /* Test dataset package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + dset_id = H5Dcreate1(file_id, MISC31_DSETNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(dset_id, FAIL, "H5Dcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + + /* Test attribute package */ + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME1, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dset_id = H5Dopen1(file_id, MISC31_DSETNAME); + CHECK(dset_id, FAIL, "H5Dopen1"); + space_id = H5Screate(H5S_SCALAR); + CHECK(space_id, FAIL, "H5Screate"); + attr_id = H5Acreate1(dset_id, MISC31_ATTRNAME2, H5T_NATIVE_INT, space_id, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Acreate1"); + + /* Test group package */ + group_id = H5Gcreate1(file_id, MISC31_GROUPNAME, 0); + CHECK(group_id, FAIL, "H5Gcreate1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + group_id = H5Gopen1(file_id, MISC31_GROUPNAME); + CHECK(group_id, FAIL, "H5Gopen1"); + + /* Test property list package */ + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + ret = H5Pregister1(H5P_OBJECT_CREATE, MISC31_PROPNAME, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + CHECK(ret, FAIL, "H5Pregister1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + + /* Test datatype package */ + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Tcopy(H5T_NATIVE_INT); + CHECK(dtype_id, FAIL, "H5Tcopy"); + ret = H5Tcommit1(file_id, MISC31_DTYPENAME, dtype_id); + CHECK(ret, FAIL, "H5Tcommit1"); + ret = H5close(); + CHECK(ret, FAIL, "H5close"); + file_id = H5Fopen(MISC31_FILE, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(file_id, FAIL, "H5Fopen"); + dtype_id = H5Topen1(file_id, MISC31_DTYPENAME); + CHECK(ret, FAIL, "H5Topen1"); + ret = H5Fclose(file_id); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Tclose(dtype_id); + CHECK(ret, FAIL, "H5Tclose"); + +#else /* H5_NO_DEPRECATED_SYMBOLS */ + /* Output message about test being skipped */ + MESSAGE(5, (" ...Skipped")); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} /* end test_misc31() */ + + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5240,6 +5348,7 @@ test_misc(void) test_misc28(); /* Test that chunks are cached appropriately */ test_misc29(); /* Test that speculative metadata reads are handled correctly */ test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ + test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ } /* test_misc() */ @@ -5296,5 +5405,6 @@ cleanup_misc(void) HDremove(MISC28_FILE); HDremove(MISC29_COPY_FILE); HDremove(MISC30_FILE); + HDremove(MISC31_FILE); } diff --git a/test/tselect.c b/test/tselect.c index fed405c..d5a1f4c 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -292,11 +292,15 @@ test_select_hyper(hid_t xfer_plist) ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,wbuf); CHECK(ret, FAIL, "H5Dwrite"); - /* Exercise check for NULL buffer and valid selection */ + /* Exercise checks for NULL buffer and valid selection */ H5E_BEGIN_TRY { ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dwrite"); + H5E_BEGIN_TRY { + ret=H5Dwrite(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dwrite"); /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -326,11 +330,15 @@ test_select_hyper(hid_t xfer_plist) ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); - /* Exercise check for NULL buffer and valid selection */ + /* Exercise checks for NULL buffer and valid selection */ H5E_BEGIN_TRY { ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,NULL); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Dread"); + H5E_BEGIN_TRY { + ret=H5Dread(dataset,H5T_NATIVE_UCHAR,H5S_ALL,H5S_ALL,xfer_plist,NULL); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dread"); /* Check that the values match with a dataset iterator */ tbuf=wbuf+(15*SPACE2_DIM2); @@ -28,6 +28,7 @@ #define FAMILY_SIZE2 (5*KB) #define MULTI_SIZE 128 #define CORE_INCREMENT (4*KB) +#define CORE_PAGE_SIZE (1024 * 1024) #define DSET1_NAME "dset1" #define DSET1_DIM1 1024 #define DSET1_DIM2 32 @@ -376,6 +377,8 @@ test_core(void) char filename[1024]; void *fhandle=NULL; hsize_t file_size; + hbool_t use_write_tracking; + size_t write_tracking_page_size; int *points = NULL, *check = NULL, *p1, *p2; hid_t dset1=-1, space1=-1; hsize_t dims1[2]; @@ -387,6 +390,8 @@ test_core(void) fapl = h5_fileaccess(); if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; + if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) + TEST_ERROR; h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -400,6 +405,14 @@ test_core(void) if(H5FD_CORE != H5Pget_driver(access_fapl)) TEST_ERROR; + /* Check that the backing store write tracking info was saved */ + if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0) + TEST_ERROR; + if(TRUE != use_write_tracking) + TEST_ERROR; + if(CORE_PAGE_SIZE != write_tracking_page_size) + TEST_ERROR; + /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; |