summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2016-01-20 15:30:55 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2016-01-20 15:30:55 (GMT)
commitafd696593b786db4c68d7ad0235da145ba250568 (patch)
treeb5ebfef14196fa2b002b7bfea6cf24944659613d /test
parentf6429a3f5483100f08b40eb1d06daacc012313cb (diff)
parentb9763eee6dd6a81d2696faf430e0cf7f27281462 (diff)
downloadhdf5-afd696593b786db4c68d7ad0235da145ba250568.zip
hdf5-afd696593b786db4c68d7ad0235da145ba250568.tar.gz
hdf5-afd696593b786db4c68d7ad0235da145ba250568.tar.bz2
[svn-r28933] merge from trunk.
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am14
-rw-r--r--test/accum.c118
-rw-r--r--test/btree2.c2808
-rw-r--r--test/cache_tagging.c124
-rw-r--r--test/dsets.c67
-rw-r--r--test/dtypes.c99
-rw-r--r--test/dynlib3.c4
-rw-r--r--test/earray.c197
-rw-r--r--test/error_test.c4
-rw-r--r--test/farray.c163
-rw-r--r--test/fheap.c10
-rw-r--r--test/file_image.c4
-rw-r--r--test/links.c68
-rw-r--r--test/objcopy.c204
-rw-r--r--test/ohdr.c8
-rw-r--r--test/tarray.c176
-rw-r--r--test/tfile.c2
-rw-r--r--test/tgenprop.c4
-rw-r--r--test/tmisc.c16
-rw-r--r--test/tvlstr.c11
20 files changed, 3498 insertions, 603 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 64d811d..58f6022 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -37,16 +37,14 @@ check_SCRIPTS = $(TEST_SCRIPT)
# executed, generally most specific tests to least specific tests.
# As an exception, long-running tests should occur earlier in the list.
# This gives them more time to run when tests are executing in parallel.
-# These tests (fheap, btree2) are under development and are not used by
-# the library yet. Move them to the end so that their failure do not block
-# other current library code tests.
-TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \
+TEST_PROG= testhdf5 cache cache_api cache_tagging lheap ohdr stab gheap \
+ farray earray btree2 fheap \
pool accum hyperslab istore bittests dt_arith \
dtypes dsets cmpd_dset mdset filter_fail extend external efc objcopy links unlink \
big mtime fillval mount flush1 flush2 app_ref enum \
set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\
getname vfd ntypes dangle dtransform reserved cross_read \
- freespace mf vds farray earray btree2 fheap file_image unregister
+ freespace mf vds file_image unregister
# List programs to be built when testing here. error_test and err_compat are
# built at the same time as the other tests, but executed by testerror.sh.
@@ -145,9 +143,9 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 mdset.h5 compact_dataset.h5 dataset.h5 d
multi_file-[rs].h5 core_file plugin.h5 \
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
- unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \
- objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \
- earray.h5 efc[0-5].h5 log_vfd_out.log \
+ unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \
+ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 farray_tmp.h5 \
+ earray.h5 earray_tmp.h5 efc[0-5].h5 log_vfd_out.log \
new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \
split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \
file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \
diff --git a/test/accum.c b/test/accum.c
index 268b7e1..edfc751 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -164,7 +164,7 @@ test_write_read(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(1024 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(1024, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)1024, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -175,7 +175,7 @@ test_write_read(const H5F_io_info_t *fio_info)
/* Write 1KB at Address 0 */
if(accum_write(0, 1024, write_buf) < 0) FAIL_STACK_ERROR;
if(accum_read(0, 1024, read_buf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(write_buf, read_buf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -220,7 +220,7 @@ test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(2048 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(2048, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)2048, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -234,7 +234,7 @@ test_write_read_nonacc_front(const H5F_io_info_t *fio_info)
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, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -279,7 +279,7 @@ test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
/* Allocate buffers */
write_buf = (int *)HDmalloc(2048 * sizeof(int));
HDassert(write_buf);
- read_buf = (int *)HDcalloc(2048, sizeof(int));
+ read_buf = (int *)HDcalloc((size_t)2048, sizeof(int));
HDassert(read_buf);
/* Fill buffer with data, zero out read buffer */
@@ -293,7 +293,7 @@ test_write_read_nonacc_end(const H5F_io_info_t *fio_info)
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, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(write_buf, read_buf, (size_t)1024) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -525,7 +525,7 @@ test_accum_overlap(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -697,7 +697,7 @@ test_accum_overlap_clean(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -876,7 +876,7 @@ test_accum_non_overlap_size(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -943,7 +943,7 @@ test_accum_overlap_size(const H5F_io_info_t *fio_info)
/* Allocate buffers */
wbuf = (int32_t *)HDmalloc(4096 * sizeof(int32_t));
HDassert(wbuf);
- rbuf = (int32_t *)HDcalloc(4096, sizeof(int32_t));
+ rbuf = (int32_t *)HDcalloc((size_t)4096, sizeof(int32_t));
HDassert(rbuf);
/* Case 1: No metadata in accumulator */
@@ -1050,11 +1050,11 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read back and verify first write */
if(accum_read((1024 * 1024), (1024 * 1024) - 1, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, (1024 * 1024) - 1) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)((1024 * 1024) - 1)) != 0) TEST_ERROR;
/* Read back and verify second write */
if(accum_read((1024 * 1024) - 1024, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1080,10 +1080,10 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read back and verify both pieces of data */
if(accum_read(1048576, 1048575, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1048576) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1048576) != 0) TEST_ERROR;
if(accum_read(5, 1048571, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1048571) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1048571) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1118,7 +1118,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read((1024 * 1024) - 1, 1024, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1158,7 +1158,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1195,7 +1195,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read((1024 * 1024) - 5, 10, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 10) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)10) != 0) TEST_ERROR;
/* Reset accumulator for next case */
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1227,7 +1227,7 @@ test_accum_adjust(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(1048571, 349523, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 349523) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)349523) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1310,7 +1310,7 @@ test_read_after(const H5F_io_info_t *fio_info)
/* Read in the piece we wrote to disk above, and then verify that
the data is as expected */
if(accum_read(512, 512, rbuf) < 0) FAIL_STACK_ERROR;
- if(HDmemcmp(wbuf, rbuf, 128) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)128) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1352,13 +1352,13 @@ test_big(const H5F_io_info_t *fio_info)
unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
- wbuf = (uint8_t *)HDmalloc(BIG_BUF_SIZE);
+ wbuf = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE);
HDassert(wbuf);
- wbuf2 = (uint8_t *)HDmalloc(BIG_BUF_SIZE);
+ wbuf2 = (uint8_t *)HDmalloc((size_t)BIG_BUF_SIZE);
HDassert(wbuf2);
- rbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1);
+ rbuf = (uint8_t *)HDcalloc((size_t)(BIG_BUF_SIZE + 1536), (size_t)1);
HDassert(rbuf);
- zbuf = (uint8_t *)HDcalloc(BIG_BUF_SIZE + 1536, 1);
+ zbuf = (uint8_t *)HDcalloc((size_t)(BIG_BUF_SIZE + 1536), (size_t)1);
HDassert(zbuf);
/* Initialize write buffers */
@@ -1376,12 +1376,12 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1393,14 +1393,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + 1024, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 2048, (BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + 1024, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 2048, (size_t)(BIG_BUF_SIZE - 2048)) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(1024, 1024, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1412,13 +1412,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), 512) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + (BIG_BUF_SIZE - 512), (size_t)512) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1430,13 +1430,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(512, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf + 512, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 512, (BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf + 512, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 512, (size_t)(BIG_BUF_SIZE - 512)) != 0) TEST_ERROR;
/* Reset data in file back to zeros & reset the read buffer */
if(accum_write(0, 1024, zbuf) < 0) FAIL_STACK_ERROR;
- HDmemset(rbuf, 0, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1453,12 +1453,12 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE);
+ HDmemset(rbuf, 0, (size_t)BIG_BUF_SIZE);
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1475,13 +1475,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf + 512, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE + 512);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1502,14 +1502,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1024, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf2, rbuf, BIG_BUF_SIZE) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, 512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + BIG_BUF_SIZE, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf + BIG_BUF_SIZE + 512, (size_t)512) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE + 1024);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1024));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1531,13 +1531,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 1536) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)1536) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE + 1536);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1558,13 +1558,13 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(zbuf, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE + 512);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 512));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1585,14 +1585,14 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 1536, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, 1024) != 0) TEST_ERROR;
- if(HDmemcmp(zbuf, rbuf + 1024, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 1536, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)1024) != 0) TEST_ERROR;
+ if(HDmemcmp(zbuf, rbuf + 1024, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 1536, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
/* 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, BIG_BUF_SIZE + 1536);
+ HDmemset(rbuf, 0, (size_t)(BIG_BUF_SIZE + 1536));
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1613,8 +1613,8 @@ test_big(const H5F_io_info_t *fio_info)
if(accum_read(0, BIG_BUF_SIZE + 512, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read */
- if(HDmemcmp(wbuf, rbuf, 512) != 0) TEST_ERROR;
- if(HDmemcmp(wbuf2, rbuf + 512, BIG_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)512) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf2, rbuf + 512, (size_t)BIG_BUF_SIZE) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
@@ -1666,9 +1666,9 @@ test_random_write(const H5F_io_info_t *fio_info)
unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
- wbuf = (uint8_t *)HDmalloc(RANDOM_BUF_SIZE);
+ wbuf = (uint8_t *)HDmalloc((size_t)RANDOM_BUF_SIZE);
HDassert(wbuf);
- rbuf = (uint8_t *)HDcalloc(RANDOM_BUF_SIZE, 1);
+ rbuf = (uint8_t *)HDcalloc((size_t)RANDOM_BUF_SIZE, (size_t)1);
HDassert(rbuf);
/* Initialize write buffer */
@@ -1752,7 +1752,7 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
if(accum_read(RANDOM_BASE_OFF, RANDOM_BUF_SIZE, rbuf) < 0) FAIL_STACK_ERROR;
/* Verify data read back in */
- if(HDmemcmp(wbuf, rbuf, RANDOM_BUF_SIZE) != 0) TEST_ERROR;
+ if(HDmemcmp(wbuf, rbuf, (size_t)RANDOM_BUF_SIZE) != 0) TEST_ERROR;
if(accum_reset(fio_info) < 0) FAIL_STACK_ERROR;
diff --git a/test/btree2.c b/test/btree2.c
index 8f84135..2c9bbae 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -31,12 +31,16 @@
const char *FILENAME[] = {
"btree2",
+ "btree2_tmp",
NULL
};
#define INSERT_SPLIT_ROOT_NREC 63
-#define INSERT_MANY (1000*1000)
-#define FIND_MANY (INSERT_MANY/100)
+#define INSERT_SPLIT_ROOT_NREC_REC 64
+#define INSERT_MANY (1000 * 1000)
+#define INSERT_MANY_REC (2700 * 1000)
+#define FIND_MANY (INSERT_MANY / 100)
+#define FIND_MANY_REC (INSERT_MANY_REC / 100)
#define FIND_NEIGHBOR 2000
#define DELETE_SMALL 20
#define DELETE_MEDIUM 200
@@ -62,7 +66,7 @@ typedef struct bt2_test_param_t {
*-------------------------------------------------------------------------
*/
static int
-init_cparam(H5B2_create_t *cparam)
+init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2)
{
/* Wipe out background */
HDmemset(cparam, 0, sizeof(*cparam));
@@ -74,6 +78,16 @@ init_cparam(H5B2_create_t *cparam)
cparam->split_percent = 100;
cparam->merge_percent = 40;
+ /* Wipe out background */
+ HDmemset(cparam2, 0, sizeof(*cparam2));
+
+ /* General parameters */
+ cparam2->cls = H5B2_TEST2;
+ cparam2->node_size = (size_t)1024;
+ cparam2->rrec_size = (size_t)16;
+ cparam2->split_percent = 100;
+ cparam2->merge_percent = 40;
+
return(0);
} /* init_cparam() */
@@ -108,9 +122,8 @@ create_file(hid_t *file, H5F_t **f, hid_t fapl)
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0) {
+ if(H5AC_ignore_tags(*f) < 0)
STACK_ERROR
- }
/* Success */
return(0);
@@ -154,6 +167,47 @@ error:
/*-------------------------------------------------------------------------
+ * Function: reopen_file
+ *
+ * Purpose: Re-open the file
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 28, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+reopen_file(hid_t *file, H5F_t **f, hid_t fapl)
+{
+ char filename[1024]; /* Filename to use */
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Create the file to work on */
+ if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (*f = (H5F_t *)H5I_object(*file)))
+ STACK_ERROR
+
+ /* Ignore metadata tags in the file's cache */
+ if(H5AC_ignore_tags(*f) < 0)
+ STACK_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ return(-1);
+} /* end create_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: reopen_btree
*
* Purpose: Perform common "re-open" operations on B-tree for testing
@@ -237,11 +291,11 @@ error:
*-------------------------------------------------------------------------
*/
static int
-check_node_depth(H5B2_t *bt2, hid_t dxpl, hsize_t record, unsigned depth)
+check_node_depth(H5B2_t *bt2, hid_t dxpl, void *record, unsigned depth)
{
int rec_depth; /* Depth of record in B-tree */
- if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, &record)) < 0)
+ if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, record)) < 0)
FAIL_STACK_ERROR
if((unsigned)rec_depth != depth)
TEST_ERROR
@@ -285,7 +339,7 @@ check_node_info(H5B2_t *bt2, hid_t dxpl, hsize_t record,
error:
return(-1);
-} /* end check_node_depth() */
+} /* end check_node_info() */
/*-------------------------------------------------------------------------
@@ -294,7 +348,6 @@ error:
* Purpose: v2 B-tree iterator callback
*
* Return: Success: 0
- *
* Failure: 1
*
* Programmer: Quincey Koziol
@@ -317,12 +370,41 @@ iter_cb(const void *_record, void *_op_data)
/*-------------------------------------------------------------------------
+ * Function: iter_rec_cb
+ *
+ * Purpose: v2 B-tree iterator callback for H5B2_test_rec_t records
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+iter_rec_cb(const void *_record, void *_op_data)
+{
+ const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
+ H5B2_test_rec_t *idx = (H5B2_test_rec_t *)_op_data;
+
+ if(record->key != idx->key)
+ return(H5_ITER_ERROR);
+ if(record->val != idx->val)
+ return(H5_ITER_ERROR);
+
+ idx->key++;
+ idx->val += 2;
+ return(H5_ITER_CONT);
+} /* end iter_rec_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: find_cb
*
* Purpose: v2 B-tree find callback
*
* Return: Success: TRUE/FALSE
- *
* Failure: FAIL
*
* Programmer: Quincey Koziol
@@ -344,6 +426,33 @@ find_cb(const void *_record, void *_op_data)
/*-------------------------------------------------------------------------
+ * Function: find_rec_cb
+ *
+ * Purpose: v2 B-tree find callback for H5B2_test_rec_t records
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+find_rec_cb(const void *_record, void *_op_data)
+{
+ const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
+ H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data;
+
+ if(record->key != search->key)
+ return(FALSE);
+
+ search->val = record->val;
+ return(TRUE);
+} /* end find_rec_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: find_dec_cb
*
* Purpose: v2 B-tree find callback for indexing in decreasing order
@@ -372,6 +481,34 @@ find_dec_cb(const void *_record, void *_op_data)
/*-------------------------------------------------------------------------
+ * Function: index_rec_cb
+ *
+ * Purpose: v2 B-tree index callback for H5B2_test_rec_t records
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+index_rec_cb(const void *_record, void *_op_data)
+{
+ const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record;
+ H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data;
+
+ HDassert(record);
+ HDassert(search);
+
+ search->key = record->key;
+ search->val = record->val;
+ return(TRUE);
+} /* end index_rec_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: neighbor_cb
*
* Purpose: v2 B-tree neighbor callback
@@ -425,6 +562,57 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed)
/*-------------------------------------------------------------------------
+ * Function: modify_rec_cb
+ *
+ * Purpose: v2 B-tree modify callback for H5B2_test_rec_t records
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 25, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+modify_rec_cb(void *_record, void *_op_data, hbool_t *changed)
+{
+ H5B2_test_rec_t *record = (H5B2_test_rec_t *)_record;
+ H5B2_test_rec_t *modify = (H5B2_test_rec_t *)_op_data;
+
+ HDassert(record->key == modify->key);
+ record->val = modify->val;
+ *changed = TRUE;
+
+ return(0);
+} /* end modify_rec_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: no_modify_cb
+ *
+ * Purpose: v2 B-tree modify callback for updates which shouldn't change
+ * the record (ie. inserting not modifying)
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, December 23, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data,
+ hbool_t *changed)
+{
+ *changed = FALSE;
+
+ return(1);
+} /* end no_modify_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: remove_cb
*
* Purpose: v2 B-tree remove callback
@@ -717,7 +905,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC - 1);
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)0) < 0)
+ record = (hsize_t)33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -734,7 +923,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0)
+ record = (hsize_t)33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -755,7 +945,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + 2);
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0)
+ record = (hsize_t)33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -889,7 +1080,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)INSERT_SPLIT_ROOT_NREC, (unsigned)1) < 0)
+ record = (hsize_t)INSERT_SPLIT_ROOT_NREC;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -909,7 +1101,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0)
+ record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1);
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
@@ -940,7 +1133,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2), (unsigned)1) < 0)
+ record = (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2);
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -959,7 +1153,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0)
+ record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1);
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
@@ -1041,7 +1236,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1061,10 +1256,10 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 31;
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 63;
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
@@ -1096,7 +1291,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1115,9 +1310,11 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0)
+ record = 62;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
+ record = 94;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
@@ -1202,7 +1399,7 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1222,10 +1419,10 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1244,9 +1441,11 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)52, (unsigned)1) < 0)
+ record = 52;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)105, (unsigned)1) < 0)
+ record = 105;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1343,7 +1542,7 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2);
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1362,11 +1561,14 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0)
+ record = 62;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
+ record = 94;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)126, (unsigned)1) < 0)
+ record = 126;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1464,7 +1666,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0)
+ record = 948;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1513,7 +1716,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
FAIL_STACK_ERROR
/* Check with B-tree */
- if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0)
+ record = 948;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
/* Attempt to find existant record in internal node of level-2 B-tree */
@@ -1522,7 +1726,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
FAIL_STACK_ERROR
/* Check with B-tree */
- if(check_node_depth(bt2, dxpl, (hsize_t)505, (unsigned)1) < 0)
+ record = 505;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Attempt to find existant record in leaf of level-2 B-tree */
@@ -1531,7 +1736,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam,
FAIL_STACK_ERROR
/* Check with B-tree */
- if(check_node_depth(bt2, dxpl, (hsize_t)555, (unsigned)0) < 0)
+ record = 555;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Attempt to index non-existant record in level-2 B-tree */
@@ -1642,11 +1848,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2);
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1859, (unsigned)1) < 0)
+ record = 1859;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1921, (unsigned)0) < 0)
+ record = 1921;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1663,11 +1872,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1875, (unsigned)1) < 0)
+ record = 1875;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1922, (unsigned)0) < 0)
+ record = 1922;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1683,11 +1895,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0)
+ record = 94;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)32, (unsigned)0) < 0)
+ record = 32;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add more records to left-most leaf, to force a 2->1 split and then a
@@ -1704,11 +1919,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0)
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)47, (unsigned)1) < 0)
+ record = 47;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)0, (unsigned)0) < 0)
+ record = 0;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1724,13 +1942,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)535, (unsigned)1) < 0) /* Record in middle node before insertion point */
+ record = 535;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)630, (unsigned)1) < 0) /* Record in middle node after insertion point */
+ record = 630;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
+ record = 568;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
/* Add more records to middle leaf, to force a split and a 3 node redistribution on middle leaf */
@@ -1745,13 +1967,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2;
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */
+ record = 1008;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)524, (unsigned)1) < 0) /* Record in middle node before insertion point */
+ record = 524;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)577, (unsigned)1) < 0) /* Record in middle node after insertion point */
+ record = 577;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */
TEST_ERROR
- if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
+ record = 568;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1851,13 +2077,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1797; /* Right-most record in right internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1859; /* Right-most record in right-most leaf */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -1877,16 +2103,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1828; /* Next-to-right-most record in right-most internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1860; /* Right-most record in right-most internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1891; /* Right-most record in right-most leaf */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1903,13 +2129,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 63; /* Left-most record in left-most internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 1; /* Left-most record in left-most leaf */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to left-most leaf, to force a 1->2 node split on left leaf */
@@ -1923,16 +2149,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 63; /* Left-most record in left-most internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 32; /* Left-most record in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left-most leaf */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -1949,16 +2175,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 504; /* Record in internal node just before insertion point */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 568; /* Record in internal node just after insertion point */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 506; /* Record in leaf node just after insertion point */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Add another record to middle leaf, to force a node split on middle leaf */
@@ -1972,19 +2198,19 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 946; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 504; /* Left-most record of split in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 537; /* Middle record of split in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 568; /* Right-most record of split in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 506; /* Record in leaf node just after insertion point */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2081,13 +2307,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1318; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3114; /* Right-most record in right internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3145; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2105,13 +2331,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1822; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3114; /* Right-most record in right internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3146; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2128,13 +2354,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1822; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 436; /* Left-most record in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 374; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to redistribute */
@@ -2150,13 +2376,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1570; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 61; /* Left-most record in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2253,13 +2479,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 4555; /* Right-most record in right internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 4586; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2277,16 +2503,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3704; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 4555; /* Right-most record in right internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 4387; /* Right-most record in right leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
PASSED();
@@ -2303,13 +2529,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 2759; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 932; /* Left-most record in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 870; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Force left-most internal node to split */
@@ -2325,16 +2551,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 870; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1814; /* Next-to-left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 61; /* Left-most record in left internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 0; /* Left-most record in left leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2436,19 +2662,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 2267; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3199; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3137; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2468,19 +2694,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3104; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3137; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3135; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2498,21 +2724,21 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1574; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3104; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
record = 2862; /* Record to left of insertion point in right internal node (now) */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
#endif /* NONE */
record = 3137; /* Record to right of insertion point in right internal node (now) */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 3135; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2619,19 +2845,19 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 1952; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 2884; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 2822; /* Record just after insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Insert records to fill up middle internal node */
@@ -2647,19 +2873,19 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 2789; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 2822; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 2823; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2677,24 +2903,24 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam,
if(check_stats(bt2, &bt2_stat) < 0)
TEST_ERROR
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 2789; /* Middle record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
record = 3703; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
#ifdef NONE
record = 3049; /* Record to left of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
#endif /* NONE */
record = 2822; /* Record to right of insertion point in middle internal node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 2823; /* Record just above insertion point in leaf node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
/* Check for closing & re-opening the B-tree */
@@ -2810,9 +3036,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
@@ -2849,9 +3074,8 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Re-open v2 B-tree */
if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f)))
@@ -2969,6 +3193,2019 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_update_basic
+ *
+ * Purpose: Basic tests for the v2 B-tree update operation
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, December 23, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_basic(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ herr_t ret; /* Generic error return value */
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /*
+ * Test insert record into empty v2 B-tree
+ */
+ TESTING("B-tree update: inserting first record in empty B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ record.key = 42;
+ record.val = 72;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attempt to find non-existant record in B-tree with 1 record */
+ /* (Should not be found, but not fail) */
+ find.key = 10;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Try again with NULL 'op' */
+ /* (Should not be found, but not fail) */
+ if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in B-tree with 1 record */
+ find.key = 42;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != 72)
+ TEST_ERROR
+
+ /* Try again with NULL 'op' */
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in B-tree with 1 record */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in B-tree with 1 record */
+ find.key = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 42)
+ TEST_ERROR
+ if(find.val != 72)
+ TEST_ERROR
+
+ PASSED();
+
+
+ /*
+ * Test update only record into v2 B-tree
+ */
+ TESTING("B-tree update: update only record in B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ modify.key = 42;
+ modify.val = 43;
+ if(H5B2_update(bt2, dxpl, &modify, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attempt to find non-existant record in B-tree with 1 record */
+ /* (Should not be found, but not fail) */
+ find.key = 10;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Try again with NULL 'op' */
+ /* (Should not be found, but not fail) */
+ if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find modified record in B-tree with 1 record */
+ find.key = 42;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != 43)
+ TEST_ERROR
+
+ /* Try again with NULL 'op' */
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in B-tree with 1 record */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in B-tree with 1 record */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 42)
+ TEST_ERROR
+ if(find.val != 43)
+ TEST_ERROR
+
+ PASSED();
+
+
+ /*
+ * Test inserting more records into v2 B-tree
+ */
+ TESTING("B-tree update: insert several records");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /*
+ * Test inserting second record into v2 B-tree, before all other records
+ */
+ record.key = 34;
+ record.val = 11;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /*
+ * Test inserting third record into v2 B-tree, after all other records
+ */
+ record.key = 56;
+ record.val = 12;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /*
+ * Test inserting fourth record into v2 B-tree, in the middle of other records
+ */
+ record.key = 38;
+ record.val = 13;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attempt to find non-existant record in level-0 B-tree with several records */
+ /* (Should not be found, but not fail) */
+ find.key = 10;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in level-0 B-tree with several records */
+ find.key = 56;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ TEST_ERROR
+ if(find.val != 12)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in B-tree with several records */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in B-tree with several records */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 34)
+ TEST_ERROR
+ if(find.val != 11)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 38)
+ TEST_ERROR
+ if(find.val != 13)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 42)
+ TEST_ERROR
+ if(find.val != 43)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 56)
+ TEST_ERROR
+ if(find.val != 12)
+ TEST_ERROR
+
+ PASSED();
+
+
+ /*
+ * Test updating all existing records in v2 B-tree
+ */
+ TESTING("B-tree update: update several records");
+
+ record.key = 34;
+ modify.key = 34;
+ modify.val = 21;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+ record.key = 38;
+ modify.key = 38;
+ modify.val = 23;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+ record.key = 42;
+ modify.key = 42;
+ modify.val = 24;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+ record.key = 56;
+ modify.key = 56;
+ modify.val = 22;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attempt to find non-existant record in level-0 B-tree with several records */
+ /* (Should not be found, but not fail) */
+ find.key = 41;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in level-0 B-tree with several record */
+ find.key = 56;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ TEST_ERROR
+ if(find.val != 22)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in B-tree with several records */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in B-tree with several records */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 34)
+ TEST_ERROR
+ if(find.val != 21)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 38)
+ TEST_ERROR
+ if(find.val != 23)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 42)
+ TEST_ERROR
+ if(find.val != 24)
+ TEST_ERROR
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0)
+ TEST_ERROR
+ if(find.key != 56)
+ TEST_ERROR
+ if(find.val != 22)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ PASSED();
+
+
+ /* All tests passed */
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_update_basic() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_split_root
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to split the root node and force the tree to depth 1.
+ * It also continues to add a few more records to each of the
+ * left and right leaf nodes after the split
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, December 23, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_split_root(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
+
+ /*
+ * Test inserting enough records into v2 B-tree to split the root node
+ */
+ TESTING("B-tree update: split root");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert records to fill root leaf node */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC - 1); u++) {
+ record.key = u + 2;
+ record.val = u * 2 + 4;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 0;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC - 1);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Insert record to split root leaf node */
+ record.key = INSERT_SPLIT_ROOT_NREC_REC + 1;
+ record.val = (INSERT_SPLIT_ROOT_NREC_REC - 1) * 2 + 4;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 2;
+ idx.val = 4;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Modify all records */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + 2;
+ modify.key = u + 2;
+ modify.val = u * 2 + 5;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 2;
+ idx.val = 5;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ TEST_ERROR
+
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Insert a couple more records, on the left side of the B-tree */
+ record.key = 0;
+ record.val = 1;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = 1;
+ record.val = 3;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + 2);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 33;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 1;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2))
+ TEST_ERROR
+
+ /* Attempt to find non-existant record in level-1 B-tree */
+ /* (Should not be found, but not fail) */
+ find.key = 800;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in root of level-1 B-tree */
+ find.key = 33;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.key != 33)
+ TEST_ERROR
+ if(find.val != 67)
+ TEST_ERROR
+
+ /* Attempt to find existant record in leaf of level-1 B-tree */
+ find.key = 56;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.key != 56)
+ TEST_ERROR
+ if(find.val != 113)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in level-1 B-tree */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in root of level-1 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)33, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 33)
+ TEST_ERROR
+ if(find.val != 67)
+ TEST_ERROR
+
+ /* Attempt to index existing record in left leaf of level-1 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 0)
+ TEST_ERROR
+ if(find.val != 1)
+ TEST_ERROR
+
+ /* Attempt to index existing record in right leaf of level-1 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)50, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 50)
+ TEST_ERROR
+ if(find.val != 101)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_split_root() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_level1_2leaf_redistrib
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to split the root node and force the tree to depth 1.
+ * It continues to add a more records to the each of the
+ * left and right leaf nodes after the split to force a 2 node
+ * redistribution
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 26, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (l->r)");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
+ record.val = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 10;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+
+ /* Force redistribution from left node into right node */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
+ record.key = u;
+ record.val = u + 9;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4);
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ PASSED();
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (r->l)");
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u;
+ record.val = u + 9;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Force redistribution from left node into right node */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) {
+ record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
+ record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 9;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_level1_2leaf_redistrib() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_level1_side_split
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to split the root node and force the tree to depth 1.
+ * It continues to add a more records to the each of the
+ * left and right leaf nodes after the split to force a 2 node
+ * split, adding another node to the B-tree
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 26, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (l->r)");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
+ record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Force left node to split */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u;
+ record.val = u + 10;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 31;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = 64;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ PASSED();
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (r->l)");
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u;
+ record.val = u + 10;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Force right node to split */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
+ record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 63;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = 95;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_level1_side_split() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_level1_3leaf_redistrib
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to split the root node and force the tree to depth 1.
+ * It continues to add a more records to the each of the
+ * left and right leaf nodes after the split to force a 2 node
+ * split, adding another node to the B-tree, then continues to
+ * add records until a 3 node redistribution occurs
+ *
+ * Return: Success: 0
+ *
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 26, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: redistribute 3 leaves in level 1 B-tree");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1);
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC);
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Force left node to split */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Insert records to force middle node to redistribute */
+ for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); u++) {
+ record.key = u + INSERT_SPLIT_ROOT_NREC_REC;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 52;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = 107;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 2) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1))
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_level1_3leaf_redistrib() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_level1_middle_split
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to split the root node and force the tree to depth 1.
+ * It continues to add a more records to the each of the
+ * left and right leaf nodes after the split to force a 2 node
+ * split, adding another node to the B-tree, then continues to
+ * add records until a 3 node split occurs
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 26, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ unsigned u; /* Local index variable */
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: split middle leaf into 2 leaves in level 1 B-tree");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 leaves */
+ for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) {
+ record.key = u + (INSERT_SPLIT_ROOT_NREC_REC * 2);
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Force split from left node into right node */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 2); u++) {
+ record.key = u;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 1;
+ bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 63;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = 95;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+ record.key = 128;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC * 3))
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_level1_middle_split() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_make_level2
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts enough
+ * records to make a level 2 B-tree
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, December 26, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t idx; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: make level 2 B-tree (l->r)");
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 internal nodes */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ record.key = u + 2; /* Leave a gap for later insertion */
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+ for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = u + 4; /* Leave a gap for later insertion */
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 1347;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Add some extra records to left-most leaf */
+ record.key = 0;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = 1;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Add some extra records to middle leaf */
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 2;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 3;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
+ TEST_ERROR
+
+ /* Attempt to find non-existant record in level-2 B-tree */
+ /* (Should not be found, but not fail) */
+ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in root of level-2 B-tree */
+ find.key = 1347;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (1347 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 1347;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in internal node of level-2 B-tree */
+ find.key = 513;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (513 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 513;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in leaf of level-2 B-tree */
+ find.key = 555;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 555;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in level-2 B-tree */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in root of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1347, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 1347)
+ TEST_ERROR
+ if(find.val != (1347 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in internal node of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 513)
+ TEST_ERROR
+ if(find.val != (513 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in leaf of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 555)
+ TEST_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ PASSED();
+
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: make level 2 B-tree (r->l)");
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 internal nodes */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - u;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+ for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - (u +2); /* Leave a gap for later insertion */
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 1344;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Add some extra records to right-most leaf */
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 2;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 3;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Add some extra records to middle leaf */
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9));
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 1;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4))
+ TEST_ERROR
+
+ /* Attempt to find non-existant record in level-2 B-tree */
+ /* (Should not be found, but not fail) */
+ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in root of level-2 B-tree */
+ find.key = 1344;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (1344 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 1344;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in internal node of level-2 B-tree */
+ find.key = 512;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (512 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 512;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in leaf of level-2 B-tree */
+ find.key = 555;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 555;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in level-2 B-tree */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in root of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1344, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 1344)
+ TEST_ERROR
+ if(find.val != (1344 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in internal node of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)512, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 512)
+ TEST_ERROR
+ if(find.val != (512 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in leaf of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 555)
+ TEST_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ PASSED();
+
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: make level 2 B-tree (l+r->middle)");
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert enough records to force root to split into 2 internal nodes */
+ for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) {
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 3) - u;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+ for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) {
+ record.key = u - ((INSERT_SPLIT_ROOT_NREC_REC * 9) - 2); /* Leave a gap for later insertion */
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 2;
+ bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41);
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+ record.key = 1345;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Add some extra records to right-most leaf */
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 4;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 5;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Add some extra records to middle leaf */
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 2;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 3;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Add some extra records to left-most leaf */
+ record.key = 0;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ record.key = 1;
+ record.val = record.key * 2;
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ idx.key = 0;
+ idx.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 6))
+ TEST_ERROR
+
+ /* Attempt to find non-existant record in level-2 B-tree */
+ /* (Should not be found, but not fail) */
+ find.key = INSERT_SPLIT_ROOT_NREC_REC * 42;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Attempt to find existant record in root of level-2 B-tree */
+ find.key = 1345;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (1345 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 1345;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in internal node of level-2 B-tree */
+ find.key = 513;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (513 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 513;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
+ TEST_ERROR
+
+ /* Attempt to find existant record in leaf of level-2 B-tree */
+ find.key = 555;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Check with B-tree */
+ record.key = 555;
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
+ TEST_ERROR
+
+ /* Attempt to index non-existant record in level-2 B-tree */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Attempt to index existing record in level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1345, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 1345)
+ TEST_ERROR
+ if(find.val != (1345 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in internal node of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 513)
+ TEST_ERROR
+ if(find.val != (513 * 2))
+ TEST_ERROR
+
+ /* Attempt to index existing record in leaf of level-2 B-tree */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != 555)
+ TEST_ERROR
+ if(find.val != (555 * 2))
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return 1;
+} /* test_update_make_level2() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_update_lots
+ *
+ * Purpose: Basic tests for the B-tree v2 code. This test inserts many
+ * records in random order, enough to make at a level 4 B-tree.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, December 27, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_update_lots(hid_t fapl, const H5B2_create_t *cparam,
+ const bt2_test_param_t *tparam)
+{
+ hid_t file = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+ time_t curr_time; /* Current time, for seeding random number generator */
+ H5B2_test_rec_t *records; /* Record #'s for random insertion */
+ H5B2_test_rec_t record; /* Record to insert into tree */
+ H5B2_test_rec_t modify; /* Modified value */
+ H5B2_test_rec_t find; /* Record to find */
+ H5B2_test_rec_t iter; /* Index within B-tree, for iterator */
+ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */
+ hsize_t nrec; /* Number of records in B-tree */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic error return value */
+
+ /* Initialize random number seed */
+ curr_time = HDtime(NULL);
+#ifdef QAK
+curr_time = 1451342093;
+HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
+#endif /* QAK */
+ HDsrandom((unsigned)curr_time);
+
+ /*
+ * Test inserting many records into v2 B-tree
+ */
+ TESTING("B-tree update: create random level 4 B-tree");
+
+ /* Allocate space for the records */
+ if(NULL == (records = (H5B2_test_rec_t *)HDmalloc(sizeof(H5B2_test_rec_t) * INSERT_MANY_REC)))
+ TEST_ERROR
+
+ /* Initialize record #'s */
+ for(u = 0; u < INSERT_MANY_REC; u++) {
+ records[u].key = u;
+ records[u].val = u * 2;
+ } /* end for */
+
+ /* Shuffle record #'s */
+ for(u = 0; u < INSERT_MANY_REC; u++) {
+ H5B2_test_rec_t temp_rec; /* Temporary record */
+ unsigned swap_idx; /* Location to swap with when shuffling */
+
+ swap_idx = ((unsigned)HDrandom() % (INSERT_MANY_REC - u)) + u;
+ temp_rec = records[u];
+ records[u] = records[swap_idx];
+ records[swap_idx] = temp_rec;
+ } /* end for */
+
+ /* Create the file for the test */
+ if(create_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Insert random records */
+ for(u = 0; u < INSERT_MANY_REC; u++) {
+ record = records[u];
+ if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0)
+ FAIL_STACK_ERROR
+ } /* end for */
+
+ /* Check up on B-tree */
+ bt2_stat.depth = 4;
+ bt2_stat.nrecords = INSERT_MANY_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ STACK_ERROR
+ file = -1;
+
+ /* Re-open the file for the test */
+ if(reopen_file(&file, &f, fapl) < 0)
+ TEST_ERROR
+
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f)))
+ FAIL_STACK_ERROR
+
+ /* Check up on B-tree after re-open */
+ bt2_stat.depth = 4;
+ bt2_stat.nrecords = INSERT_MANY_REC;
+ if(check_stats(bt2, &bt2_stat) < 0)
+ TEST_ERROR
+
+ /* Iterate over B-tree to check records have been inserted correctly */
+ iter.key = 0;
+ iter.val = 0;
+ if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &iter) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the index is correct */
+ if(iter.key != INSERT_MANY_REC)
+ TEST_ERROR
+
+ /* Attempt to find non-existant record in level-4 B-tree */
+ /* (Should not be found, but not fail) */
+ find.key = INSERT_MANY_REC * 2;
+ find.val = (hsize_t)-1;
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE)
+ TEST_ERROR
+ if(find.val != (hsize_t)-1)
+ TEST_ERROR
+
+ /* Find random records */
+ for(u = 0; u < FIND_MANY_REC; u++) {
+ /* Pick random record */
+ find.key = (hsize_t)(HDrandom() % INSERT_MANY_REC);
+ find.val = (hsize_t)-1;
+
+ /* Attempt to find existant record in level-4 B-tree */
+ if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE)
+ FAIL_STACK_ERROR
+ if(find.val != (find.key * 2))
+ TEST_ERROR
+ } /* end for */
+
+ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL);
+ } H5E_END_TRY;
+ /* Should fail */
+ if(ret != FAIL)
+ TEST_ERROR
+
+ /* Find random records */
+ for(u = 0; u < FIND_MANY_REC; u++) {
+ hsize_t idx; /* Record index */
+
+ /* Pick random record */
+ idx = (hsize_t)(HDrandom() % INSERT_MANY_REC);
+
+ /* Reset find record */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+
+ /* Attempt to find existant record in level-4 B-tree */
+ /* (in increasing order) */
+ if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != idx)
+ TEST_ERROR
+ if(find.val != (find.key * 2))
+ TEST_ERROR
+
+ /* Reset find record */
+ find.key = (hsize_t)-1;
+ find.val = (hsize_t)-1;
+
+ /* Attempt to find existant record in level-4 B-tree */
+ /* (in decreasing order) */
+ if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, index_rec_cb, &find) < 0)
+ FAIL_STACK_ERROR
+ if(find.key != (INSERT_MANY_REC - (idx + 1)))
+ TEST_ERROR
+ if(find.val != (find.key * 2))
+ TEST_ERROR
+ } /* end for */
+
+ PASSED();
+
+ TESTING("B-tree update: update record in level 4 B-tree");
+
+ /* Check for closing & re-opening the B-tree */
+ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0)
+ TEST_ERROR
+
+ record.key = INSERT_MANY_REC / 2;
+ modify.key = INSERT_MANY_REC / 2;
+ modify.val = record.key * 3;
+ if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0)
+ FAIL_STACK_ERROR
+
+ /* Query the number of records in the B-tree */
+ if(H5B2_get_nrec(bt2, &nrec) < 0)
+ FAIL_STACK_ERROR
+
+ /* Make certain that the # of records is correct */
+ if(nrec != INSERT_MANY_REC)
+ TEST_ERROR
+
+ /* Close the v2 B-tree */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ PASSED();
+
+ HDfree(records);
+
+ return 0;
+
+error:
+ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ H5Fclose(file);
+ } H5E_END_TRY;
+ HDfree(records);
+
+ return 1;
+} /* test_update_lots() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_remove_basic
*
* Purpose: Basic tests for the B-tree v2 code
@@ -3367,13 +5604,13 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check up on B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = (INSERT_SPLIT_ROOT_NREC * 2) - 2;
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 0;
@@ -3386,10 +5623,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
@@ -3411,7 +5648,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check up on B-tree */
record = 0;
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 1;
@@ -3424,10 +5661,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
@@ -3449,7 +5686,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check up on B-tree */
record = INSERT_SPLIT_ROOT_NREC;
- if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0)
TEST_ERROR
rrecord = 0;
@@ -3462,10 +5699,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Make certain that the leaf nodes didn't redistribute */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
@@ -3547,10 +5784,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 94; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Query the number of records in the B-tree */
@@ -3595,10 +5832,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 90; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
@@ -3631,10 +5868,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 64; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 90; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
PASSED();
@@ -3667,10 +5904,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 64; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 91; /* Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
/* Close the v2 B-tree */
@@ -3744,7 +5981,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -3817,7 +6054,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -3923,7 +6160,7 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4049,13 +6286,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 4;
@@ -4095,13 +6332,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 4;
@@ -4141,13 +6378,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 63; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 125; /* Center-Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 4;
@@ -4183,13 +6420,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 63; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 126; /* Center-Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
record = 188; /* Center-Right record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 4;
@@ -4276,7 +6513,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4337,7 +6574,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4424,7 +6661,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4485,7 +6722,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 39; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4572,7 +6809,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4717,7 +6954,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 62; /* Left-most record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0)
TEST_ERROR
ninfo.depth = 1;
ninfo.nrec = 2;
@@ -4909,7 +7146,7 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
ninfo.depth = 0;
- ninfo.nrec = INSERT_SPLIT_ROOT_NREC - u;
+ ninfo.nrec = (uint16_t)(INSERT_SPLIT_ROOT_NREC - u);
record = 31; /* Middle record in root node */
if(check_node_info(bt2, dxpl, record, &ninfo) < 0)
TEST_ERROR
@@ -5001,7 +7238,7 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -5287,7 +7524,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t *
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -5437,7 +7674,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t *
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -5587,7 +7824,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -5738,7 +7975,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -5889,7 +8126,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -6015,7 +8252,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -6141,7 +8378,7 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -6268,7 +8505,7 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam,
/* Check record values in root of B-tree */
record = 1889; /* Left record in root node */
- if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0)
+ if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0)
TEST_ERROR
ninfo.depth = 2;
ninfo.nrec = 2;
@@ -6379,9 +8616,8 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam,
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, bt2_addr) < 0)
@@ -6535,9 +8771,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Re-shuffle record #'s */
for(u = 0; u < INSERT_MANY; u++) {
@@ -6631,9 +8866,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Re-open v2 B-tree */
if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f)))
@@ -6720,9 +8954,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Re-open v2 B-tree */
if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f)))
@@ -6806,9 +9039,8 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Re-open v2 B-tree */
if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f)))
@@ -7157,9 +9389,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
@@ -7202,9 +9433,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
@@ -7260,9 +9490,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
@@ -7318,9 +9547,8 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam)
STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(f) < 0) {
+ if(H5AC_ignore_tags(f) < 0)
STACK_ERROR
- }
/* Create the v2 B-tree & get its address */
if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
@@ -7605,6 +9833,146 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_open_twice_diff
+ *
+ * Purpose: Open a v2 B-tree twice, through different "top" file
+ * handles, with an intermediate file open that takes the "shared"
+ * file handle from the first B-tree's file pointer.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 18, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam)
+{
+ char filename[1024]; /* Filename to use */
+ char filename_tmp[1024]; /* Temporary file name */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ hid_t file0 = -1; /* File ID */
+ hid_t file00 = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5F_t *f2 = NULL; /* Internal file object pointer */
+ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */
+ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */
+ H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */
+ haddr_t bt2_addr; /* Address of B-tree created */
+
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /*
+ * Display testing message
+ */
+ TESTING("open B-tree twice, through different file handles");
+
+ /* Create the file to work on */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ FAIL_STACK_ERROR
+
+ /* Ignore metadata tags in the file's cache */
+ if(H5AC_ignore_tags(f) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create the v2 B-tree & get its address */
+ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0)
+ TEST_ERROR
+
+ /* Re-open v2 B-tree */
+ if(NULL == (bt2_2 = H5B2_open(f, dxpl, bt2_addr, f)))
+ FAIL_STACK_ERROR
+
+ /* Close the second v2 B-tree wrapper */
+ if(H5B2_close(bt2_2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2_2 = NULL;
+
+ /* Re-open the file */
+ /* (So that there is something holding the file open when the extensible
+ * array is closed)
+ */
+ if((file0 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the first v2 B-tree wrapper */
+ if(H5B2_close(bt2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2 = NULL;
+
+ /* Close the file */
+ /* (close before second file, to detect error on internal B-tree header's
+ * shared file information)
+ */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ file = -1;
+
+ /* Open a different file */
+ /* (This re-allocates the 'top' file pointer and assigns it a different
+ * 'shared' file pointer, making the file pointer in the fixed array's
+ * header stale)
+ */
+ h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp));
+ if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Re-open the file with the v2 B-tree array */
+ if((file2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f2 = (H5F_t *)H5I_object(file2)))
+ FAIL_STACK_ERROR
+
+ /* Open the B-tree through the second file handle */
+ if(NULL == (bt2_2 = H5B2_open(f2, dxpl, bt2_addr, f2)))
+ FAIL_STACK_ERROR
+
+ /* Close the extra file handles */
+ if(H5Fclose(file0) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file00) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the second v2 B-tree */
+ if(H5B2_close(bt2_2, dxpl) < 0)
+ FAIL_STACK_ERROR
+ bt2_2 = NULL;
+
+ /* Close file */
+ if(H5Fclose(file2) < 0)
+ FAIL_STACK_ERROR
+
+ /* All tests passed */
+ PASSED();
+
+ /* All tests passed */
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ if(bt2)
+ H5B2_close(bt2, dxpl);
+ if(bt2)
+ H5B2_close(bt2_2, dxpl);
+ H5Fclose(file);
+ H5Fclose(file2);
+ H5Fclose(file0);
+ H5Fclose(file00);
+ } H5E_END_TRY;
+ return(1);
+} /* test_open_twice_diff() */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Test the B-tree v2 code
@@ -7621,7 +9989,7 @@ error:
int
main(void)
{
- H5B2_create_t cparam; /* Creation parameters for v2 B-tree */
+ H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */
bt2_test_param_t tparam; /* Test parameters for v2 B-tree */
hid_t fapl = -1; /* File access property list for data files */
unsigned nerrors = 0; /* Cumulative error count */
@@ -7641,8 +10009,7 @@ main(void)
printf("***Express test mode on. Some tests may be skipped\n");
/* Initialize v2 B-tree creation parameters */
- init_cparam(&cparam);
-
+ init_cparam(&cparam, &cparam2);
/* Loop over re-opening B-tree during tests */
for(reopen = FALSE; reopen <= TRUE; reopen++) {
@@ -7656,7 +10023,7 @@ main(void)
} /* end else */
/* Test B-tree record insertion */
- /* Iteration, find & index routines tested in these routines as well */
+ /* (Iteration, find & index routines exercised in these routines as well) */
nerrors += test_insert_basic(fapl, &cparam, &tparam);
nerrors += test_insert_split_root(fapl, &cparam, &tparam);
nerrors += test_insert_level1_2leaf_redistrib(fapl, &cparam, &tparam);
@@ -7675,6 +10042,20 @@ main(void)
else
nerrors += test_insert_lots(fapl, &cparam, &tparam);
+ /* Test B-tree record update (ie. insert/modify) */
+ /* (Iteration, find & index routines exercised in these routines as well) */
+ nerrors += test_update_basic(fapl, &cparam2, &tparam);
+ nerrors += test_update_split_root(fapl, &cparam2, &tparam);
+ nerrors += test_update_level1_2leaf_redistrib(fapl, &cparam2, &tparam);
+ nerrors += test_update_level1_side_split(fapl, &cparam2, &tparam);
+ nerrors += test_update_level1_3leaf_redistrib(fapl, &cparam2, &tparam);
+ nerrors += test_update_level1_middle_split(fapl, &cparam2, &tparam);
+ nerrors += test_update_make_level2(fapl, &cparam2, &tparam);
+ if(ExpressMode > 1)
+ printf("***Express test mode on. test_update_lots skipped\n");
+ else
+ nerrors += test_update_lots(fapl, &cparam2, &tparam);
+
/* Test B-tree record removal */
/* Querying the number of records routine also tested in these routines as well */
nerrors += test_remove_basic(fapl, &cparam, &tparam);
@@ -7712,6 +10093,9 @@ main(void)
nerrors += test_modify(fapl, &cparam, &tparam);
} /* end for */
+ /* Test opening B-trees twice */
+ nerrors += test_open_twice_diff(fapl, &cparam);
+
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 80ba2eb..470f7a1 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -112,103 +112,105 @@ static unsigned check_invalid_tag_application(void);
static void
print_entry_type_to_screen(int id)
{
- printf("Type = ");
+ HDfprintf(stdout, "Type = ");
switch (id) {
- case 0:
- printf("B-tree Node(0)");
+ case H5AC_BT_ID:
+ HDfprintf(stdout, "v1 B-tree Node");
break;
- case 1:
- printf("Symbol Table Node(1)");
+ case H5AC_SNODE_ID:
+ HDfprintf(stdout, "Symbol Table Node");
break;
- case 2:
- printf("Local Heap Prefix(2)");
+ case H5AC_LHEAP_PRFX_ID:
+ HDfprintf(stdout, "Local Heap Prefix");
break;
- case 3:
- printf("Local Heap Data Block(3)");
+ case H5AC_LHEAP_DBLK_ID:
+ HDfprintf(stdout, "Local Heap Data Block");
break;
- case 4:
- printf("Global Heap(4)");
+ case H5AC_GHEAP_ID:
+ HDfprintf(stdout, "Global Heap");
break;
- case 5:
- printf("Object Header(5)");
+ case H5AC_OHDR_ID:
+ HDfprintf(stdout, "Object Header");
break;
- case 6:
- printf("Object Header Chunk(6)");
+ case H5AC_OHDR_CHK_ID:
+ HDfprintf(stdout, "Object Header Chunk");
break;
- case 7:
- printf("v2 B-tree Header(7)");
+ case H5AC_BT2_HDR_ID:
+ HDfprintf(stdout, "v2 B-tree Header");
break;
- case 8:
- printf("v2 B-tree Internal Node(8)");
+ case H5AC_BT2_INT_ID:
+ HDfprintf(stdout, "v2 B-tree Internal Node");
break;
- case 9:
- printf("v2 B-tree Leaf Node(9)");
+ case H5AC_BT2_LEAF_ID:
+ HDfprintf(stdout, "v2 B-tree Leaf Node");
break;
- case 10:
- printf("Fractal Heap Header(10)");
+ case H5AC_FHEAP_HDR_ID:
+ HDfprintf(stdout, "Fractal Heap Header");
break;
- case 11:
- printf("Fractal Heap Direct Block(11)");
+ case H5AC_FHEAP_DBLOCK_ID:
+ HDfprintf(stdout, "Fractal Heap Direct Block");
break;
- case 12:
- printf("Fractal Heap Indirect Block(12)");
+ case H5AC_FHEAP_IBLOCK_ID:
+ HDfprintf(stdout, "Fractal Heap Indirect Block");
break;
- case 13:
- printf("Free Space Header(13)");
+ case H5AC_FSPACE_HDR_ID:
+ HDfprintf(stdout, "Free Space Header");
break;
- case 14:
- printf("Free Space Section(14)");
+ case H5AC_FSPACE_SINFO_ID:
+ HDfprintf(stdout, "Free Space Section");
break;
- case 15:
- printf("Shared Object Header Message Master Table(15)");
+ case H5AC_SOHM_TABLE_ID:
+ HDfprintf(stdout, "Shared Object Header Message Master Table");
break;
- case 16:
- printf("Shared Message Index Stored As A List(16)");
+ case H5AC_SOHM_LIST_ID:
+ HDfprintf(stdout, "Shared Message Index Stored As A List");
break;
- case 17:
- printf("Extensible Array Header(17)");
+ case H5AC_EARRAY_HDR_ID:
+ HDfprintf(stdout, "Extensible Array Header");
break;
- case 18:
- printf("Extensible Array Index Block(18)");
+ case H5AC_EARRAY_IBLOCK_ID:
+ HDfprintf(stdout, "Extensible Array Index Block");
break;
- case 19:
- printf("Extensible Array Super Block(19)");
+ case H5AC_EARRAY_SBLOCK_ID:
+ HDfprintf(stdout, "Extensible Array Super Block");
break;
- case 20:
- printf("Extensible Array Data Block(20)");
+ case H5AC_EARRAY_DBLOCK_ID:
+ HDfprintf(stdout, "Extensible Array Data Block");
break;
- case 21:
- printf("Extensible Array Data Block Page(21)");
+ case H5AC_EARRAY_DBLK_PAGE_ID:
+ HDfprintf(stdout, "Extensible Array Data Block Page");
break;
- case 22:
- printf("Chunk Proxy(22)");
+ case H5AC_FARRAY_HDR_ID:
+ HDfprintf(stdout, "Fixed Array Header");
break;
- case 23:
- printf("Fixed Array Header(23)");
+ case H5AC_FARRAY_DBLOCK_ID:
+ HDfprintf(stdout, "Fixed Array Data Block");
break;
- case 24:
- printf("Fixed Array Data Block(24)");
+ case H5AC_FARRAY_DBLK_PAGE_ID:
+ HDfprintf(stdout, "Fixed Array Data Block Page");
break;
- case 25:
- printf("Fixed Array Data Block Page(25)");
+ case H5AC_SUPERBLOCK_ID:
+ HDfprintf(stdout, "File Superblock");
break;
- case 26:
- printf("File Superblock(26)");
+ case H5AC_DRVRINFO_ID:
+ HDfprintf(stdout, "Driver Info Block");
break;
- case 27:
- printf("Test Entry(27)");
+ case H5AC_TEST_ID:
+ HDfprintf(stdout, "Test Entry");
break;
- case 28:
- printf("Number of Types(28)");
+ case H5AC_NTYPES:
+ HDfprintf(stdout, "BADNESS: Number of Types");
break;
default:
- printf("*Unknown*");
+ HDfprintf(stdout, "BADNESS: *Unknown*");
break;
} /* end switch */
+ HDfprintf(stdout, " (%d)", id);
+
} /* print_entry_type_to_screen */
@@ -225,8 +227,6 @@ print_entry_type_to_screen(int id)
* Programmer: Mike McGreevy
* January 25, 2010
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int print_index(hid_t fid) {
diff --git a/test/dsets.c b/test/dsets.c
index 47d8185..f123a55 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -388,14 +388,14 @@ test_create(hid_t file)
static herr_t
test_simple_io(const char *env_h5_drvr, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file = -1, dataset = -1, space = -1, xfer = -1;
- int i, j, n;
- hsize_t dims[2];
- void *tconv_buf = NULL;
- int f = -1;
- haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file = -1, dataset = -1, space = -1, xfer = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ void *tconv_buf = NULL;
+ int f = -1;
+ haddr_t offset;
+ int rdata[DSET_DIM1][DSET_DIM2];
TESTING("simple I/O");
@@ -465,7 +465,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
f = HDopen(filename, O_RDONLY, 0);
HDlseek(f, (off_t)offset, SEEK_SET);
- HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2);
+ if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ goto error;
/* Check that the values read are the same as the values written */
for(i = 0; i < DSET_DIM1; i++) {
@@ -6702,7 +6703,7 @@ test_random_chunks(hid_t fapl)
if(H5Fclose(file) < 0) TEST_ERROR;
- /* Create file for second test */
+ /* Create second file */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
/* Create dataspace with unlimited maximum dimensions */
@@ -7475,7 +7476,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- if(rdata2[i] != i) {
+ if(rdata2[i] != i) {
printf(" Read different values than written in the chunk.\n");
printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i);
TEST_ERROR
@@ -9146,38 +9147,38 @@ main(void)
nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
+ nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
nerrors += (test_tconv(file) < 0 ? 1 : 0);
nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
- nerrors += (test_multiopen (file) < 0 ? 1 : 0);
- nerrors += (test_types(file) < 0 ? 1 : 0);
- nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_multiopen (file) < 0 ? 1 : 0);
+ nerrors += (test_types(file) < 0 ? 1 : 0);
+ nerrors += (test_userblock_offset(envval, my_fapl) < 0 ? 1 : 0);
nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
- nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
- nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
- nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
- nerrors += (test_filters_endianess() < 0 ? 1 : 0);
- nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_endianess() < 0 ? 1 : 0);
+ nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -9187,9 +9188,9 @@ main(void)
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
goto error;
diff --git a/test/dtypes.c b/test/dtypes.c
index 326294f..984b6c6 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1789,6 +1789,13 @@ test_compound_9(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata.str = NULL;
+
if(H5Dclose(dset_id) < 0)
goto error;
if(H5Tclose(cmpd_tid) < 0)
@@ -1815,6 +1822,12 @@ test_compound_9(void)
goto error;
} /* end if */
+ if((space_id = H5Dget_space(dset_id)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't get space\n");
+ goto error;
+ } /* end if */
+
if((cmpd_tid = H5Dget_type(dset_id)) < 0) {
H5_FAILED(); AT();
printf("cannot open dataset\n");
@@ -1842,10 +1855,19 @@ test_compound_9(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't read data\n");
+ goto error;
+ } /* end if */
+ rdata.str = NULL;
+
if(rdata.str) HDfree(rdata.str);
if(H5Dclose(dset_id) < 0)
goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
if(H5Tclose(cmpd_tid) < 0)
goto error;
if(H5Tclose(dup_tid) < 0)
@@ -2020,12 +2042,17 @@ test_compound_10(void)
printf("incorrect VL read data\n");
goto error;
}
-
- HDfree(t1);
- HDfree(t2);
- HDfree(wdata[i].str);
- HDfree(rdata[i].str);
} /* end for */
+ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
if(H5Dclose(dset_id) < 0)
goto error;
@@ -2090,6 +2117,8 @@ test_compound_11(void)
hid_t big_tid, little_tid; /* Datatype IDs for type conversion */
hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */
hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */
+ hid_t space_id; /* Dataspace for buffer elements */
+ hsize_t dim[1]; /* Dimensions for dataspace */
void *buf = NULL; /* Conversion buffer */
void *buf_orig = NULL; /* Copy of original conversion buffer */
void *bkg = NULL; /* Background buffer */
@@ -2138,6 +2167,13 @@ test_compound_11(void)
/* Make copy of buffer before conversion */
HDmemcpy(buf_orig,buf,sizeof(big_t)*NTESTELEM);
+ dim[0] = NTESTELEM;
+ if((space_id = H5Screate_simple(1, dim, NULL)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't create space\n");
+ goto error;
+ } /* end if */
+
/* Make copies of the 'big' and 'little' datatypes, so the type
* conversion routine doesn't use the same ones this time and next time
*/
@@ -2169,8 +2205,12 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Build source and destination types for conversion routine */
if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
@@ -2209,8 +2249,12 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Unregister the conversion routine */
if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR
@@ -2243,12 +2287,17 @@ test_compound_11(void)
(unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1);
TEST_ERROR
} /* end if */
- HDfree(((little_t *)buf)[u].s1);
} /* end for */
+ if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim data\n");
+ goto error;
+ } /* end if */
/* Free everything */
for(u=0; u<NTESTELEM; u++)
HDfree(((big_t *)buf_orig)[u].s1);
+ if(H5Sclose(space_id) < 0) TEST_ERROR
if(H5Tclose(opaq_dst_tid) < 0) TEST_ERROR
if(H5Tclose(opaq_src_tid) < 0) TEST_ERROR
if(H5Tclose(little_tid2) < 0) TEST_ERROR
@@ -2727,6 +2776,18 @@ test_compound_14(void)
goto error;
} /* end if */
+ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata1.str = NULL;
+ if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata2.str = NULL;
if(H5Dclose(dset1_id) < 0)
goto error;
if(H5Dclose(dset2_id) < 0)
@@ -2761,6 +2822,12 @@ test_compound_14(void)
goto error;
} /* end if */
+ if((space_id = H5Dget_space(dset2_id)) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't get space\n");
+ goto error;
+ } /* end if */
+
rdata1.c1 = rdata1.c2 = 0;
if(rdata1.str) HDfree(rdata1.str);
@@ -2796,13 +2863,25 @@ test_compound_14(void)
goto error;
} /* end if */
- if(rdata1.str) HDfree(rdata1.str);
- if(rdata2.str) HDfree(rdata2.str);
+ if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata1.str = NULL;
+ if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ H5_FAILED(); AT();
+ printf("Can't reclaim read data\n");
+ goto error;
+ } /* end if */
+ rdata2.str = NULL;
if(H5Dclose(dset1_id) < 0)
goto error;
if(H5Dclose(dset2_id) < 0)
goto error;
+ if(H5Sclose(space_id) < 0)
+ goto error;
if(H5Tclose(cmpd_m1_tid) < 0)
goto error;
if(H5Tclose(cmpd_m2_tid) < 0)
diff --git a/test/dynlib3.c b/test/dynlib3.c
index b3a02ed..e509a52 100644
--- a/test/dynlib3.c
+++ b/test/dynlib3.c
@@ -81,7 +81,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
void *outbuf = NULL; /* Pointer to new buffer */
unsigned char *dst; /* Temporary pointer to destination buffer */
- dst = (unsigned char *)(outbuf = malloc(nbytes + SUFFIX_LEN));
+ dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0));
/* Copy raw data */
memcpy((void*)dst, (void*)(*buf), nbytes);
@@ -91,7 +91,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts,
memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN);
/* Free input buffer */
- free(*buf);
+ H5free_memory(*buf);
/* Set return values */
*buf_size = nbytes + SUFFIX_LEN;
diff --git a/test/earray.c b/test/earray.c
index 368ee42..95733e9 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -185,6 +185,7 @@ static herr_t earray_cache_test_free_icr(void *thing);
/* Local variables */
const char *FILENAME[] = {
"earray",
+ "earray_tmp",
NULL
};
@@ -332,10 +333,10 @@ finish_tparam(earray_test_param_t *tparam)
*-------------------------------------------------------------------------
*/
static int
-create_file(hid_t fapl, hid_t *file, H5F_t **f)
+create_file(unsigned flags, hid_t fapl, hid_t *file, H5F_t **f)
{
/* Create the file to work on */
- if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((*file = H5Fcreate(filename_g, flags, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
@@ -343,9 +344,8 @@ create_file(hid_t fapl, hid_t *file, H5F_t **f)
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0) {
+ if(H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
- }
/* Success */
return(0);
@@ -454,17 +454,19 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
/* (actually will close & re-open the file as well) */
if(tparam->reopen_array) {
/* Close array, if given */
- if(ea) {
+ if(ea && *ea) {
if(H5EA_close(*ea, dxpl) < 0)
FAIL_STACK_ERROR
*ea = NULL;
} /* end if */
/* Close file */
- if(H5Fclose(*file) < 0)
- FAIL_STACK_ERROR
- *file = (-1);
- *f = NULL;
+ if(*file) {
+ if(H5Fclose(*file) < 0)
+ FAIL_STACK_ERROR
+ *file = (-1);
+ *f = NULL;
+ } /* end if */
/* Re-open the file */
if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
@@ -475,15 +477,13 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0) {
+ if(H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
- }
/* Re-open array, if given */
- if(ea) {
+ if(ea)
if(NULL == (*ea = H5EA_open(*f, dxpl, ea_addr, NULL)))
FAIL_STACK_ERROR
- } /* end if */
} /* end if */
/* Success */
@@ -893,7 +893,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1008,7 +1008,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
/* Set invalid max. # of elements per data block page bits */
if(test_cparam.idx_blk_elmts > 0) {
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1;
+ test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1);
H5E_BEGIN_TRY {
ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
@@ -1035,7 +1035,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE
TEST_ERROR
} /* end if */
HDmemcpy(&test_cparam, cparam, sizeof(test_cparam));
- test_cparam.max_dblk_page_nelmts_bits = test_cparam.max_nelmts_bits + 1;
+ test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1);
H5E_BEGIN_TRY {
ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL);
} H5E_END_TRY;
@@ -1115,7 +1115,7 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1188,7 +1188,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1271,6 +1271,148 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_open_twice_diff
+ *
+ * Purpose: Open an extensible array twice, through different "top" file
+ * handles, with an intermediate file open that takes the "shared"
+ * file handle from the first extensible array's file pointer.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 18, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
+{
+ char filename_tmp[EARRAY_FILENAME_LEN]; /* Temporary file name */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ hid_t file0 = -1; /* File ID */
+ hid_t file00 = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5F_t *f2 = NULL; /* Internal file object pointer */
+ H5EA_t *ea = NULL; /* Extensible array wrapper */
+ H5EA_t *ea2 = NULL; /* Extensible array wrapper */
+ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */
+
+ /* Create file & retrieve pointer to internal file object */
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
+ TEST_ERROR
+
+ /*
+ * Display testing message
+ */
+ TESTING("open extensible array twice, through different file handles");
+
+ /* Create array */
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0)
+ TEST_ERROR
+
+ /* Open the array again, through the first file handle */
+ if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
+ FAIL_STACK_ERROR
+
+ /* Verify the creation parameters */
+ if(verify_cparam(ea, cparam) < 0)
+ TEST_ERROR
+ if(verify_cparam(ea2, cparam) < 0)
+ TEST_ERROR
+
+ /* Close the second extensible array wrapper */
+ if(H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ ea2 = NULL;
+
+ /* Re-open the file */
+ /* (So that there is something holding the file open when the extensible
+ * array is closed)
+ */
+ if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check for closing & re-opening the file */
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Verify the creation parameters */
+ if(verify_cparam(ea, cparam) < 0)
+ TEST_ERROR
+
+ /* Close the first extensible array wrapper */
+ if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ ea = NULL;
+
+ /* Close the first file */
+ /* (close before second file, to detect error on internal array header's
+ * shared file information)
+ */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ file = -1;
+
+ /* Open a different file */
+ /* (This re-allocates the 'top' file pointer and assigns it a different
+ * 'shared' file pointer, making the file pointer in the extensible array's
+ * header stale)
+ */
+ h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp));
+ if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Re-open the file with the extensible array */
+ if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f2 = (H5F_t *)H5I_object(file2)))
+ FAIL_STACK_ERROR
+
+ /* Open the extensible array through the second file handle */
+ if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL)))
+ FAIL_STACK_ERROR
+
+ /* Verify the creation parameters */
+ if(verify_cparam(ea2, cparam) < 0)
+ TEST_ERROR
+
+ /* Close the extra file handles */
+ if(H5Fclose(file0) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file00) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close array, delete array, close file & verify file is empty */
+ if(finish(file2, fapl, f2, ea2, ea_addr) < 0)
+ TEST_ERROR
+
+ /* All tests passed */
+ PASSED()
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(ea)
+ H5EA_close(ea, H5P_DATASET_XFER_DEFAULT);
+ if(ea2)
+ H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT);
+ H5Fclose(file);
+ H5Fclose(file2);
+ H5Fclose(file0);
+ H5Fclose(file00);
+ } H5E_END_TRY;
+
+ return 1;
+} /* test_open_twice_diff() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_delete_open
*
* Purpose: Delete opened extensible array (& open deleted array)
@@ -1294,7 +1436,7 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam)
h5_stat_size_t file_size; /* File size, after deleting array */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1483,7 +1625,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR
hsize_t idx; /* Index value of element */
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/*
@@ -1758,7 +1900,7 @@ eiter_fw_next(void *_eiter)
*
*-------------------------------------------------------------------------
*/
-static hssize_t
+static H5_ATTR_PURE hssize_t
eiter_fw_max(const void *_eiter)
{
const eiter_fw_t *eiter = (const eiter_fw_t *)_eiter;
@@ -1976,7 +2118,7 @@ eiter_rv_next(void *_eiter)
*
*-------------------------------------------------------------------------
*/
-static hssize_t
+static H5_ATTR_PURE hssize_t
eiter_rv_max(const void *_eiter)
{
const eiter_rv_t *eiter = (const eiter_rv_t *)_eiter;
@@ -2228,7 +2370,7 @@ eiter_rnd_next(void *_eiter)
*
*-------------------------------------------------------------------------
*/
-static hssize_t
+static H5_ATTR_PURE hssize_t
eiter_rnd_max(const void *_eiter)
{
const eiter_rnd_t *eiter = (const eiter_rnd_t *)_eiter;
@@ -2449,7 +2591,7 @@ eiter_cyc_next(void *_eiter)
*
*-------------------------------------------------------------------------
*/
-static hssize_t
+static H5_ATTR_PURE hssize_t
eiter_cyc_max(const void *_eiter)
{
const eiter_cyc_t *eiter = (const eiter_cyc_t *)_eiter;
@@ -2537,7 +2679,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
@@ -2711,7 +2853,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam,
TESTING(test_str);
/* Create file & retrieve pointer to internal file object */
- if(create_file(fapl, &file, &f) < 0)
+ if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0)
TEST_ERROR
/* Create array */
@@ -2871,7 +3013,7 @@ main(void)
/* Seed random #'s */
curr_time = HDtime(NULL);
- HDsrandom((unsigned long)curr_time);
+ HDsrandom((unsigned)curr_time);
/* Create an empty file to retrieve size */
{
@@ -2922,6 +3064,7 @@ main(void)
nerrors += test_create(fapl, &cparam, &tparam);
nerrors += test_reopen(fapl, &cparam, &tparam);
nerrors += test_open_twice(fapl, &cparam, &tparam);
+ nerrors += test_open_twice_diff(fapl, &cparam, &tparam);
nerrors += test_delete_open(fapl, &cparam, &tparam);
nerrors += test_flush_depend(fapl, &cparam, &tparam);
diff --git a/test/error_test.c b/test/error_test.c
index 4e4c0ef..ee181b1 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -498,7 +498,7 @@ test_create(void)
if(err_num != 0) TEST_ERROR
/* Push an error with a long description */
- if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR;
+ if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR;
/* Check the number of errors on stack */
err_num = H5Eget_num(estack_id);
@@ -543,7 +543,7 @@ test_copy(void)
herr_t ret; /* Generic return value */
/* Push an error with a long description */
- if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR;
+ if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR;
/* Check the number of errors on stack */
err_num = H5Eget_num(H5E_DEFAULT);
diff --git a/test/farray.c b/test/farray.c
index e3e59da..50a9856 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -102,6 +102,7 @@ struct farray_test_param_t {
/* Local variables */
const char *FILENAME[] = {
"farray",
+ "farray_tmp",
NULL
};
@@ -159,9 +160,8 @@ create_file(hid_t fapl, hid_t *file, H5F_t **f)
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0) {
+ if(H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
- }
/* Success */
return(0);
@@ -274,17 +274,19 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
/* (actually will close & re-open the file as well) */
if(tparam->reopen_array) {
/* Close array, if given */
- if(fa) {
+ if(fa && *fa) {
if(H5FA_close(*fa, dxpl) < 0)
FAIL_STACK_ERROR
*fa = NULL;
} /* end if */
/* Close file */
- if(H5Fclose(*file) < 0)
- FAIL_STACK_ERROR
- *file = (-1);
- *f = NULL;
+ if(*file) {
+ if(H5Fclose(*file) < 0)
+ FAIL_STACK_ERROR
+ *file = (-1);
+ *f = NULL;
+ } /* end if */
/* Re-open the file */
if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
@@ -295,15 +297,13 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl,
FAIL_STACK_ERROR
/* Ignore metadata tags in the file's cache */
- if(H5AC_ignore_tags(*f) < 0) {
+ if(H5AC_ignore_tags(*f) < 0)
FAIL_STACK_ERROR
- }
/* Re-open array, if given */
- if(fa) {
+ if(fa)
if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, NULL)))
FAIL_STACK_ERROR
- } /* end if */
} /* end if */
/* Success */
@@ -722,6 +722,144 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_open_twice_diff
+ *
+ * Purpose: Open a fixed array twice, through different "top" file
+ * handles, with an intermediate file open that takes the "shared"
+ * file handle from the first fixed array's file pointer.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 18, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam)
+{
+ char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */
+ hid_t file = -1; /* File ID */
+ hid_t file2 = -1; /* File ID */
+ hid_t file0 = -1; /* File ID */
+ hid_t file00 = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5F_t *f2 = NULL; /* Internal file object pointer */
+ H5FA_t *fa = NULL; /* Fixed array wrapper */
+ H5FA_t *fa2 = NULL; /* Fixed array wrapper */
+ haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */
+
+ /*
+ * Display testing message
+ */
+ TESTING("open fixed array twice, through different file handles");
+
+ /* Create file & retrieve pointer to internal file object */
+ if(create_file(fapl, &file, &f) < 0)
+ TEST_ERROR
+
+ /* Create array */
+ if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0)
+ TEST_ERROR
+
+ /* Open the array again, through the first file handle */
+ if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
+ FAIL_STACK_ERROR
+
+ /* Verify the creation parameters */
+ if(verify_cparam(fa, cparam) < 0)
+ TEST_ERROR
+ if(verify_cparam(fa2, cparam) < 0)
+ TEST_ERROR
+
+ /* Close the second fixed array wrapper */
+ if(H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ fa2 = NULL;
+
+ /* Re-open the file */
+ /* (So that there is something holding the file open when the extensible
+ * array is closed)
+ */
+ if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Check for closing & re-opening the file */
+ if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0)
+ TEST_ERROR
+
+ /* Close the first fixed array wrapper */
+ if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+ fa = NULL;
+
+ /* Close the first file */
+ /* (close before second file, to detect error on internal array header's
+ * shared file information)
+ */
+ if(H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ file = -1;
+
+ /* Open a different file */
+ /* (This re-allocates the 'top' file pointer and assigns it a different
+ * 'shared' file pointer, making the file pointer in the fixed array's
+ * header stale)
+ */
+ h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp));
+ if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Re-open the file with the fixed array */
+ if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f2 = (H5F_t *)H5I_object(file2)))
+ FAIL_STACK_ERROR
+
+ /* Open the fixed array through the second file handle */
+ if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL)))
+ FAIL_STACK_ERROR
+
+ /* Verify the creation parameters */
+ if(verify_cparam(fa2, cparam) < 0)
+ TEST_ERROR
+
+ /* Close the extra file handles */
+ if(H5Fclose(file0) < 0)
+ FAIL_STACK_ERROR
+ if(H5Fclose(file00) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close array, delete array, close file & verify file is empty */
+ if(finish(file2, fapl, f2, fa2, fa_addr) < 0)
+ TEST_ERROR
+
+ /* All tests passed */
+ PASSED()
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(fa)
+ H5FA_close(fa, H5P_DATASET_XFER_DEFAULT);
+ if(fa2)
+ H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT);
+ H5Fclose(file);
+ H5Fclose(file2);
+ H5Fclose(file0);
+ H5Fclose(file00);
+ } H5E_END_TRY;
+
+ return 1;
+} /* test_open_twice_diff() */
+
+
+/*-------------------------------------------------------------------------
* Function: test_delete_open
*
* Purpose: Delete opened fixed array (& open deleted array)
@@ -1535,7 +1673,7 @@ main(void)
/* Seed random #'s */
curr_time = HDtime(NULL);
- HDsrandom((unsigned long)curr_time);
+ HDsrandom((unsigned)curr_time);
/* Create an empty file to retrieve size */
{
@@ -1586,6 +1724,7 @@ main(void)
nerrors += test_create(fapl, &cparam, &tparam);
nerrors += test_reopen(fapl, &cparam, &tparam);
nerrors += test_open_twice(fapl, &cparam, &tparam);
+ nerrors += test_open_twice_diff(fapl, &cparam, &tparam);
nerrors += test_delete_open(fapl, &cparam, &tparam);
/* Iterate over the type of capacity tests */
diff --git a/test/fheap.c b/test/fheap.c
index 25784a9..61a8298 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -470,16 +470,16 @@ get_del_string(const fheap_test_param_t *tparam)
/* Remove half of total objects from heap */
if(tparam->del_dir == FHEAP_DEL_FORWARD)
if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
- str = HDstrdup("(all - forward)");
+ str = H5MM_strdup("(all - forward)");
else
- str = HDstrdup("(half, refill, all - forward)");
+ str = H5MM_strdup("(half, refill, all - forward)");
else if(tparam->del_dir == FHEAP_DEL_REVERSE)
if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL)
- str = HDstrdup("(all - reverse)");
+ str = H5MM_strdup("(all - reverse)");
else
- str = HDstrdup("(half, refill, all - reverse)");
+ str = H5MM_strdup("(half, refill, all - reverse)");
else
- str = HDstrdup("(all - deleting heap)");
+ str = H5MM_strdup("(all - deleting heap)");
return(str);
} /* get_del_string() */
diff --git a/test/file_image.c b/test/file_image.c
index 52d0b28..6d1845f 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -156,8 +156,8 @@ error:
if(H5Pclose(fapl_1) < 0) retval = 1;
if(H5Pclose(fapl_2) < 0) retval = 1;
HDfree(buffer);
- HDfree(temp);
- HDfree(temp2);
+ H5free_memory(temp);
+ H5free_memory(temp2);
if(retval == 0)
PASSED();
diff --git a/test/links.c b/test/links.c
index db5922b..c87d2b6 100644
--- a/test/links.c
+++ b/test/links.c
@@ -136,7 +136,7 @@ const char *FILENAME[] = {
#define H5L_DIM1 100
#define H5L_DIM2 100
-#define FILTER_FILESIZE_MAX_FRACTION 0.9F
+#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F
/* Creation order macros */
#define CORDER_GROUP_NAME "corder_group"
@@ -548,8 +548,27 @@ cklinks(hid_t fapl, hbool_t new_format)
HDputs(" expected file location.");
TEST_ERROR
} /* end if */
+ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
/* Symbolic link */
if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
@@ -3848,7 +3867,6 @@ external_set_elink_fapl3(hbool_t new_format)
{
hid_t core_fapl = -1, stdio_fapl = -1;
hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
- int ret;
if(new_format)
TESTING("H5Pset/get_fapl() (w/new group format)")
@@ -3907,11 +3925,11 @@ external_set_elink_fapl3(hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Pclose(l_fapl);
- H5Pclose(lapl_id);
- H5Pclose(new_lapl_id);
- H5Pclose(core_fapl);
- H5Pclose(stdio_fapl);
+ H5Pclose(l_fapl);
+ H5Pclose(lapl_id);
+ H5Pclose(new_lapl_id);
+ H5Pclose(core_fapl);
+ H5Pclose(stdio_fapl);
} H5E_END_TRY;
return -1;
} /* end external_set_elink_fapl3() */
@@ -10986,6 +11004,7 @@ link_info_by_idx(hid_t fapl)
char filename[NAME_BUF_SIZE];/* File name */
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11027,9 +11046,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -11069,9 +11088,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
@@ -11111,9 +11130,9 @@ link_info_by_idx(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Close the group */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -11168,6 +11187,7 @@ link_info_by_idx_old(hid_t fapl)
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
@@ -11279,9 +11299,9 @@ link_info_by_idx_old(hid_t fapl)
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
} H5E_END_TRY;
- if(ret >= 0) TEST_ERROR
+ if(name_len >= 0) TEST_ERROR
/* Verify state of group */
if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
@@ -12039,7 +12059,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12067,11 +12087,11 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR
@@ -12112,7 +12132,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;
@@ -12469,7 +12489,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, with H5Giterate */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
@@ -12489,7 +12509,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip);
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12517,11 +12537,11 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Skip over some links in group, with H5Giterate */
- iter_info->nskipped = gskip = max_links / 2;
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
iter_info->order = order;
iter_info->stop = -1;
iter_info->ncalled = 0;
- iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip);
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR
@@ -12562,7 +12582,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order,
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Iterate over links in group, stopping in the middle, with H5Giterate() */
- iter_info->nskipped = gskip = 0;
+ iter_info->nskipped = (unsigned)(gskip = 0);
iter_info->order = order;
iter_info->stop = 3;
iter_info->ncalled = 0;
diff --git a/test/objcopy.c b/test/objcopy.c
index 82be446..cd978f2 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -197,7 +197,7 @@ addr_insert(H5O_info_t *oi)
*
*-------------------------------------------------------------------------
*/
-static hbool_t
+static H5_ATTR_PURE hbool_t
addr_lookup(H5O_info_t *oi)
{
size_t n;
@@ -512,8 +512,12 @@ test_copy_attach_attribute_vl(hid_t loc_id)
ret_value = 0;
done:
- if(tid >0 && sid > 0)
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ if(tid >0 && sid > 0) {
+ hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER);
+ H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL);
+ H5Dvlen_reclaim(tid, sid, dxpl_id, buf);
+ H5Pclose(dxpl_id);
+ }
if(sid > 0)
H5Sclose(sid);
if(tid > 0)
@@ -1243,12 +1247,11 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
if(offset1 != offset2) TEST_ERROR
if(size1 != size2) TEST_ERROR
- if(strcmp(name1, name2) != 0) TEST_ERROR
+ if(HDstrcmp(name1, name2) != 0) TEST_ERROR
}
- /* Remove external file information from the dcpls */
-
- /* reset external file information from the dcpls */
+ /* Reset external file information from the dcpls */
+ /* (Directly removing default property causes memory leak) */
if (H5P_reset_external_file_test(dcpl) < 0) TEST_ERROR
if (H5P_reset_external_file_test(dcpl2) < 0) TEST_ERROR
}
@@ -2311,7 +2314,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
#endif /* H5_CLEAR_MEMORY */
for(i = 0; i < DIM_SIZE_1; i++) {
buf[i].a = i;
- buf[i].d = 1.0F / (i + 1);
+ buf[i].d = (double)1.0F / (double)(i + 1);
} /* end for */
/* Initialize the filenames */
@@ -2443,9 +2446,9 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* set initial data values */
for(i = 0; i < DIM_SIZE_1; i++) {
- buf1d[i] = (float)(i / 2.0F);
+ buf1d[i] = (float)i / 2.0F;
for(j = 0; j < DIM_SIZE_2; j++)
- buf2d[i][j] = (float)(i + (j / 100.0F));
+ buf2d[i][j] = (float)i + ((float)j / 100.0F);
} /* end for */
/* Initialize the filenames */
@@ -2695,10 +2698,10 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED, fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Ocopy(fid_src, NAME_DATASET_CHUNKED2, fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* open the dataset for copy */
+ /* open the dataset NAME_DATASET_CHUNKED in SRC file */
if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
- /* open the destination dataset */
+ /* open the copied dataset NAME_DATASET_CHUNKED at destination */
if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check if the datasets are equal */
@@ -2710,10 +2713,10 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* close the source dataset */
if(H5Dclose(did) < 0) TEST_ERROR
- /* open the dataset for copy */
+ /* open the dataset NAME_DATASET_CHUNKED_SINGLE in SRC file */
if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
- /* open the destination dataset */
+ /* open the copied dataset NAME_DATASET_CHUNKED2 at destination */
if((did2 = H5Dopen2(fid_dst, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check if the datasets are equal */
@@ -2786,9 +2789,9 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* set initial data values */
for(i = 0; i < DIM_SIZE_1; i++) {
- buf1d[i] = (float)(i / 10.0F);
+ buf1d[i] = (float)i / 10.0F;
for(j = 0; j < DIM_SIZE_2; j++)
- buf2d[i][j] = (float)(i + (j / 100.0F));
+ buf2d[i][j] = (float)i + ((float)j / 100.0F);
} /* end for */
/* Initialize the filenames */
@@ -2836,6 +2839,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* close the dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+
/* Set 2-D dataspace dimensions */
dim2d[0]=DIM_SIZE_1;
dim2d[1]=DIM_SIZE_2;
@@ -2874,6 +2878,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* close the dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+
/* close the SRC file */
if(H5Fclose(fid_src) < 0) TEST_ERROR
@@ -2906,6 +2911,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* close the source dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+
/* open the dataset for copy */
if((did = H5Dopen2(fid_src, NAME_DATASET_CHUNKED2, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -2994,8 +3000,8 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
/* Set dataspace dimensions */
- dim2d[0]=DIM_SIZE_1;
- dim2d[1]=DIM_SIZE_2;
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
/* create dataspace */
if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
@@ -3110,7 +3116,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* set initial data values */
for (i=0; i<DIM_SIZE_1; i++)
for (j=0; j<DIM_SIZE_2; j++)
- buf[i][j] = (float)(i+j/100.0F);
+ buf[i][j] = (float)i + (float)j / 100.0F;
/* Initialize the filenames */
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
@@ -4026,6 +4032,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
hid_t tid = -1; /* Datatype ID */
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -4109,7 +4116,12 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -4125,6 +4137,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
@@ -4156,6 +4169,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
@@ -4208,6 +4222,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* close the dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+
/* close the SRC file */
if(H5Fclose(fid_src) < 0) TEST_ERROR
@@ -4247,7 +4262,12 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -4263,6 +4283,8 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
+ H5Pclose(pid);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
@@ -4294,6 +4316,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -4384,7 +4407,12 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -4400,6 +4428,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
@@ -4547,6 +4576,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t tid = -1; /* Datatype ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
hsize_t dim2d[2]; /* Dataset dimensions */
hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */
hvl_t buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
@@ -4646,7 +4676,12 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -4665,6 +4700,7 @@ error:
H5Dclose(did);
H5Pclose(pid);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
H5Fclose(fid_dst);
@@ -6354,6 +6390,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -6453,7 +6490,12 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid_copy) < 0) TEST_ERROR
@@ -6470,6 +6512,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
H5Sclose(sid);
@@ -6501,6 +6544,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
hid_t tid = -1, tid_copy=-1; /* Datatype ID */
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -6593,7 +6637,12 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid_copy) < 0) TEST_ERROR
@@ -6609,6 +6658,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
H5Sclose(sid);
@@ -6641,6 +6691,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -6741,7 +6792,12 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid_copy) < 0) TEST_ERROR
@@ -6758,6 +6814,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
H5Sclose(sid);
@@ -6790,6 +6847,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -6891,7 +6949,12 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid_copy) < 0) TEST_ERROR
@@ -6908,6 +6971,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
H5Sclose(sid);
@@ -6940,6 +7004,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j, k; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7046,7 +7111,12 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -7063,6 +7133,8 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
+ H5Pclose(pid);
H5Tclose(tid);
H5Tclose(tid2);
H5Sclose(sid);
@@ -7095,6 +7167,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j, k; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7200,7 +7273,12 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
if(H5Fclose(fid_dst) < 0) TEST_ERROR
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -7217,6 +7295,8 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
+ H5Pclose(pid);
H5Tclose(tid);
H5Tclose(tid2);
H5Sclose(sid);
@@ -7245,10 +7325,11 @@ static int
test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
{
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
- hid_t tid = -1, tid2=-1; /* Datatype ID */
+ hid_t tid = -1, tid2=-1; /* Datatype ID */
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j, k; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7301,7 +7382,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create nested VL datatype */
if((tid2 = H5Tvlen_create(tid)) < 0) TEST_ERROR
- /* create and set chunk plist */
+ /* create and set chunk plist */
if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
if(H5Pset_chunk(pid, 1, chunk_dim1d) < 0) TEST_ERROR
@@ -7317,6 +7398,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* close the dataset */
if(H5Dclose(did) < 0) TEST_ERROR
+
/* close the SRC file */
if(H5Fclose(fid_src) < 0) TEST_ERROR
@@ -7355,7 +7437,12 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -7373,6 +7460,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid2);
H5Sclose(sid);
@@ -7405,6 +7493,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j, k; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7512,7 +7601,12 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -7530,6 +7624,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid2);
H5Sclose(sid);
@@ -7572,6 +7667,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t sid = -1; /* Dataspace ID */
hid_t did = -1; /* Dataset ID */
hid_t did2 = -1; /* Dataset ID */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7582,12 +7678,12 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* set initial data values */
for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = i * (i - 1);
+ buf[i].a = (int)(i * (i - 1));
buf[i].b.len = i+1;
buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
for(j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
- buf[i].c = 1.0F / (i + 1.0F);
+ buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
/* Initialize the filenames */
@@ -7661,7 +7757,12 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid2) < 0) TEST_ERROR
@@ -7678,6 +7779,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
H5Tclose(tid2);
H5Tclose(tid);
H5Sclose(sid);
@@ -7710,6 +7812,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */
@@ -7721,12 +7824,12 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* set initial data values */
for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = i * (i - 1);
+ buf[i].a = (int)(i * (i - 1));
buf[i].b.len = i+1;
buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
for(j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
- buf[i].c = 1.0F / (i + 1.0F);
+ buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
/* Initialize the filenames */
@@ -7807,7 +7910,12 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid2) < 0) TEST_ERROR
@@ -7824,6 +7932,8 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
+ H5Pclose(pid);
H5Tclose(tid2);
H5Tclose(tid);
H5Sclose(sid);
@@ -7856,6 +7966,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
hid_t sid = -1; /* Dataspace ID */
hid_t pid = -1; /* Dataset creation property list ID */
hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t dxpl_id = -1; /* Dataset transfer property list ID */
unsigned int i, j; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */
@@ -7866,12 +7977,12 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* set initial data values */
for(i = 0; i < DIM_SIZE_1; i++) {
- buf[i].a = i * (i - 1);
+ buf[i].a = (int)(i * (i - 1));
buf[i].b.len = i+1;
buf[i].b.p = (int *)HDmalloc(buf[i].b.len * sizeof(int));
for(j = 0; j < buf[i].b.len; j++)
((int *)buf[i].b.p)[j] = (int)(i * 10 + j);
- buf[i].c = 1.0F / (i + 1.0F);
+ buf[i].c = 1.0F / ((float)i + 1.0F);
} /* end for */
/* Initialize the filenames */
@@ -7952,7 +8063,12 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* Reclaim vlen buffer */
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
+ if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
+ if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Pclose(dxpl_id) < 0) TEST_ERROR
+ } /* end if */
/* close datatype */
if(H5Tclose(tid2) < 0) TEST_ERROR
@@ -7969,6 +8085,8 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Pclose(dxpl_id);
+ H5Pclose(pid);
H5Tclose(tid2);
H5Tclose(tid);
H5Sclose(sid);
@@ -12364,7 +12482,7 @@ main(void)
nerrors += test_copy_old_layout(fcpl_dst, dst_fapl);
nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_iterate(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
- }
+ } /* end if */
/* TODO: not implemented
nerrors += test_copy_mount(src_fapl);
diff --git a/test/ohdr.c b/test/ohdr.c
index 53aa18f..87c0b46 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -835,8 +835,8 @@ main(void)
if(H5Fclose(file) < 0)
TEST_ERROR
- /* Test object header creation metadata cache issues */
- if(test_ohdr_cache(filename, fapl) < 0)
+ /* Test object header creation metadata cache issues */
+ if(test_ohdr_cache(filename, fapl) < 0)
TEST_ERROR
} /* end for */
@@ -845,7 +845,7 @@ main(void)
puts("All object header tests passed.");
h5_cleanup(FILENAME, fapl);
- return(0);
+ return 0;
error:
puts("*** TESTS FAILED ***");
@@ -853,6 +853,6 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- return(1);
+ return 1;
} /* end main() */
diff --git a/test/tarray.c b/test/tarray.c
index 9c79f41..cb5fef9 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -178,7 +178,7 @@ test_array_funcs(void)
{
hid_t type; /* Datatype ID */
hsize_t tdims1[] = {ARRAY1_DIM1};
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_norm_t norm;
H5T_cset_t cset;
@@ -190,13 +190,13 @@ test_array_funcs(void)
CHECK(type, FAIL, "H5Tarray_create2");
size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ CHECK(size, 0, "H5Tget_precision");
size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ CHECK(size, 0, "H5Tget_size");
size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ CHECK(size, 0, "H5Tget_ebias");
ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
@@ -541,7 +541,7 @@ test_array_compound_atomic(void)
for(i = 0; i < SPACE1_DIM1; i++)
for(j = 0; j < ARRAY1_DIM1; j++) {
wdata[i][j].i = i * 10 + j;
- wdata[i][j].f = (float)(i * 2.5F + j);
+ wdata[i][j].f = (float)i * 2.5F + (float)j;
} /* end for */
/* Create file */
@@ -745,7 +745,7 @@ test_array_compound_array(void)
for(j=0; j<ARRAY1_DIM1; j++) {
wdata[i][j].i=i*10+j;
for(k=0; k<ARRAY1_DIM1; k++)
- wdata[i][j].f[k]=(float)(i * 10.0F + j * 2.5F + k);
+ wdata[i][j].f[k] = (float)i * 10.0F + (float)j * 2.5F + (float)k;
} /* end for */
/* Create file */
@@ -962,22 +962,22 @@ void test_array_free_custom(void *mem, void *info);
****************************************************************/
void *test_array_alloc_custom(size_t size, void *info)
{
- void *ret_value=NULL; /* Pointer to return */
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ void *ret_value = NULL; /* Pointer to return */
+ size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if((ret_value=HDmalloc(extra+size))!=NULL) {
- *(size_t *)ret_value=size;
- *mem_used+=size;
+ if((ret_value = HDmalloc(extra+size)) != NULL) {
+ *(size_t *)ret_value = size;
+ *mem_used += size;
} /* end if */
- ret_value=((unsigned char *)ret_value)+extra;
- return(ret_value);
+ ret_value = ((unsigned char *)ret_value) + extra;
+ return ret_value;
}
/****************************************************************
@@ -990,19 +990,19 @@ void *test_array_alloc_custom(size_t size, void *info)
****************************************************************/
void test_array_free_custom(void *_mem, void *info)
{
- unsigned char *mem;
- int *mem_used=(int *)info; /* Get the pointer to the memory used */
- size_t extra; /* Extra space needed */
+ unsigned char *mem = NULL;
+ size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
/*
* This weird contortion is required on the DEC Alpha to keep the
* alignment correct - QAK
*/
- extra=MAX(sizeof(void *),sizeof(size_t));
+ extra = MAX(sizeof(void *), sizeof(size_t));
- if(_mem!=NULL) {
- mem=((unsigned char *)_mem)-extra;
- *mem_used-=*(size_t *)mem;
+ if(_mem != NULL) {
+ mem = ((unsigned char *)_mem) - extra;
+ *mem_used -= *(size_t *)mem;
HDfree(mem);
} /* end if */
}
@@ -1031,8 +1031,8 @@ test_array_vlen_atomic(void)
H5T_class_t mclass; /* Datatype class for VL */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k; /* counting variables */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k; /* counting variables */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1041,10 +1041,10 @@ test_array_vlen_atomic(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
- wdata[i][j].len=i+j+1;
+ wdata[i][j].p=HDmalloc((size_t)(i+j+1) * sizeof(unsigned int));
+ wdata[i][j].len = (size_t)(i+j+1);
for(k=0; k<(i+j+1); k++)
- ((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
+ ((unsigned int *)wdata[i][j].p)[k] = (unsigned int)(i*100+j*10+k);
} /* end for */
/* Create file */
@@ -1242,8 +1242,8 @@ test_array_vlen_array(void)
H5T_class_t mclass; /* Datatype class for VL */
hid_t xfer_pid; /* Dataset transfer property list ID */
hsize_t size; /* Number of bytes which will be used */
- int mem_used=0; /* Memory used during allocation */
- int i,j,k,l; /* Index variables */
+ size_t mem_used=0; /* Memory used during allocation */
+ int i,j,k,l; /* Index variables */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1252,11 +1252,11 @@ test_array_vlen_array(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
- wdata[i][j].len=i+j+1;
+ wdata[i][j].p = HDmalloc((size_t)(i+j+1) * sizeof(unsigned int) * (size_t)ARRAY1_DIM1);
+ wdata[i][j].len = (size_t)(i+j+1);
for(k=0; k<(i+j+1); k++)
for(l=0; l<ARRAY1_DIM1; l++)
- ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l]=i*1000+j*100+k*10+l;
+ ((unsigned int *)wdata[i][j].p)[k*ARRAY1_DIM1+l] = (unsigned int)(i*1000+j*100+k*10+l);
} /* end for */
/* Create file */
@@ -1505,8 +1505,7 @@ test_array_bkg(void)
int i, j;
unsigned ndims[3] = {1,1,1};
- typedef struct
- {
+ typedef struct {
int a[ALEN];
float b[ALEN];
double c[ALEN];
@@ -1514,10 +1513,9 @@ test_array_bkg(void)
CmpField cf[LENGTH];
CmpField cfr[LENGTH];
- CmpDTSinfo dtsinfo;
+ CmpDTSinfo *dtsinfo = NULL;
- typedef struct
- {
+ typedef struct {
float b[ALEN];
} fld_t;
@@ -1529,42 +1527,43 @@ test_array_bkg(void)
/* Initialize the data */
/* ------------------- */
- for (i = 0; i < LENGTH; i++)
- {
- for (j = 0; j < ALEN; j++)
- {
- cf[i].a[j] = 100*(i+1) + j;
- cf[i].b[j] = (float)(100.0F*(i+1) + 0.01F*j);
- cf[i].c[j] = (double)(100.0F*(i+1) + 0.02F*j);
- }
- }
+ dtsinfo = (CmpDTSinfo *)HDmalloc(sizeof(CmpDTSinfo));
+ CHECK(dtsinfo, NULL, "HDmalloc");
+ HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo));
+ for (i = 0; i < LENGTH; i++) {
+ for (j = 0; j < ALEN; j++) {
+ cf[i].a[j] = 100 * (i + 1) + j;
+ cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j;
+ cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j);
+ } /* end for */
+ } /* end for */
/* Set the number of data members */
/* ------------------------------ */
- dtsinfo.nsubfields = 3;
+ dtsinfo->nsubfields = 3;
/* Initialize the offsets */
/* ----------------------- */
- dtsinfo.offset[0] = HOFFSET(CmpField, a);
- dtsinfo.offset[1] = HOFFSET(CmpField, b);
- dtsinfo.offset[2] = HOFFSET(CmpField, c);
+ dtsinfo->offset[0] = HOFFSET(CmpField, a);
+ dtsinfo->offset[1] = HOFFSET(CmpField, b);
+ dtsinfo->offset[2] = HOFFSET(CmpField, c);
/* Initialize the data type IDs */
/* ---------------------------- */
- dtsinfo.datatype[0] = H5T_NATIVE_INT;
- dtsinfo.datatype[1] = H5T_NATIVE_FLOAT;
- dtsinfo.datatype[2] = H5T_NATIVE_DOUBLE;
+ dtsinfo->datatype[0] = H5T_NATIVE_INT;
+ dtsinfo->datatype[1] = H5T_NATIVE_FLOAT;
+ dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE;
/* Initialize the names of data members */
/* ------------------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char));
- strcpy(dtsinfo.name[0], "One");
- strcpy(dtsinfo.name[1], "Two");
- strcpy(dtsinfo.name[2], "Three");
+ strcpy(dtsinfo->name[0], "One");
+ strcpy(dtsinfo->name[1], "Two");
+ strcpy(dtsinfo->name[2], "Three");
/* Create file */
@@ -1585,17 +1584,16 @@ test_array_bkg(void)
/* Add members to the compound data type */
/* -------------------------------------- */
- for ( i = 0; i < dtsinfo.nsubfields; i++)
- {
- array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima);
+ for ( i = 0; i < dtsinfo->nsubfields; i++) {
+ array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima);
CHECK(array_dt, FAIL, "H5Tarray_create2");
- status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt);
+ status = H5Tinsert (type, dtsinfo->name[i], dtsinfo->offset[i], array_dt);
CHECK(status, FAIL, "H5Tinsert");
status = H5Tclose(array_dt);
CHECK(status, FAIL, "H5Tclose");
- }
+ } /* end for */
/* Create the dataset */
/* ------------------ */
@@ -1617,23 +1615,23 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
+ } /* end if */
if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
+ } /* end if */
if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
/* Release memory resources */
/* ------------------------ */
- for (i = 0; i < dtsinfo.nsubfields; i++)
- HDfree(dtsinfo.name[i]);
+ for (i = 0; i < dtsinfo->nsubfields; i++)
+ HDfree(dtsinfo->name[i]);
/* Release IDs */
@@ -1651,9 +1649,9 @@ test_array_bkg(void)
CHECK(status, FAIL, "H5Fclose");
-/******************************/
-/* Reopen the file and update */
-/******************************/
+ /******************************/
+ /* Reopen the file and update */
+ /******************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1674,7 +1672,7 @@ test_array_bkg(void)
/* -------------------------------- */
for (i=0; i< LENGTH; i++)
for (j = 0; j < ALEN; j++)
- cf[i].b[j]=fld[i].b[j] = 1.313F;
+ cf[i].b[j] = fld[i].b[j] = 1.313F;
status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld);
CHECK(status, FAIL, "H5Dwrite");
@@ -1688,7 +1686,7 @@ test_array_bkg(void)
if(!H5_FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) {
TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(double)fld[i].b[j],(int)i,(int)j,(double)fldr[i].b[j]);
continue;
- }
+ } /* end if */
status = H5Tclose (type);
CHECK(status, FAIL, "H5Tclose");
@@ -1710,17 +1708,17 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
+ } /* end if */
if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
+ } /* end if */
if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
@@ -1731,9 +1729,9 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
-/****************************************************/
-/* Reopen the file and print out all the data again */
-/****************************************************/
+ /****************************************************/
+ /* Reopen the file and print out all the data again */
+ /****************************************************/
fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid, FAIL, "H5Fopen");
@@ -1759,17 +1757,17 @@ test_array_bkg(void)
if(cf[i].a[j]!=cfr[i].a[j]) {
TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]);
continue;
- }
+ } /* end if */
if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) {
TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]);
continue;
- }
+ } /* end if */
if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) {
TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]);
continue;
- }
- }
- }
+ } /* end if */
+ } /* end for */
+ } /* end for */
status = H5Dclose(dataset);
CHECK(status, FAIL, "H5Dclose");
@@ -1779,6 +1777,8 @@ test_array_bkg(void)
status = H5Fclose(fid);
CHECK(status, FAIL, "H5Fclose");
+
+ HDfree(dtsinfo);
} /* end test_array_bkg() */
/****************************************************************
diff --git a/test/tfile.c b/test/tfile.c
index c36045b..927ecab 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -3715,5 +3715,7 @@ cleanup_file(void)
HDremove(FILE3);
HDremove(FILE4);
HDremove(FILE5);
+ HDremove(FILE6);
+ HDremove(FILE7);
}
diff --git a/test/tgenprop.c b/test/tgenprop.c
index c4f3a3f..b670c0d 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -1780,7 +1780,7 @@ test_genprop_path(void)
CHECK_PTR(path, "H5P_get_class_path_test");
if(HDstrcmp(path,CLASS1_PATH)!=0)
TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH);
- HDfree(path);
+ H5free_memory(path);
/* Create another new generic class, derived from first class */
cid2 = H5Pcreate_class(cid1,CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL);
@@ -1805,7 +1805,7 @@ test_genprop_path(void)
VERIFY(ret, 1, "H5Pequal");
/* Release the path string */
- HDfree(path);
+ H5free_memory(path);
/* Close class */
ret = H5Pclose_class(cid3);
diff --git a/test/tmisc.c b/test/tmisc.c
index 1298f6b..011486a 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -462,7 +462,8 @@ static void test_misc2_write_attribute(void)
ret = H5Aread(att1, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- HDfree(data_check.string);
+ ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Aclose(att1);
CHECK(ret, FAIL, "HAclose");
@@ -487,7 +488,8 @@ static void test_misc2_write_attribute(void)
ret = H5Aread(att2, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- HDfree(data_check.string);
+ ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Dvlen_reclaim");
ret = H5Aclose(att2);
CHECK(ret, FAIL, "HAclose");
@@ -514,6 +516,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
{
hid_t file, root, att;
hid_t type;
+ hid_t space;
herr_t ret;
misc2_struct data_check;
@@ -528,10 +531,17 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
att = H5Aopen(root, att_name, H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
+ space = H5Aget_space(att);
+ CHECK(space, FAIL, "H5Aget_space");
+
ret = H5Aread(att, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- HDfree(data_check.string);
+ ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Dvlen_reclaim");
+
+ ret = H5Sclose(space);
+ CHECK(ret, FAIL, "H5Sclose");
ret = H5Aclose(att);
CHECK(ret, FAIL, "H5Aclose");
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 02bd59d..dbc3083 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -604,7 +604,7 @@ static void test_write_vl_string_attribute(void)
if(HDstrcmp(string_att_check,string_att) != 0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- HDfree(string_att_check);
+ H5free_memory(string_att_check);
string_att_check = NULL;
ret = H5Aclose(att);
@@ -626,7 +626,7 @@ static void test_write_vl_string_attribute(void)
if(HDstrcmp(string_att_check,string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- HDfree(string_att_check);
+ H5free_memory(string_att_check);
string_att_check = NULL;
/* The attribute string written is freed below, in the test_read_vl_string_attribute() test */
@@ -687,7 +687,7 @@ static void test_read_vl_string_attribute(void)
if(HDstrcmp(string_att_check,string_att) != 0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check);
- HDfree(string_att_check);
+ H5free_memory(string_att_check);
string_att_check = NULL;
ret = H5Aclose(att);
@@ -704,7 +704,7 @@ static void test_read_vl_string_attribute(void)
if(HDstrcmp(string_att_check,string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
- HDfree(string_att_check);
+ H5free_memory(string_att_check);
string_att_check = NULL;
}
@@ -762,7 +762,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch
if(HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
- HDfree(data_read);
+ ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read);
+ CHECK(ret, FAIL, "H5Dvlen_reclaim");
}
/****************************************************************