summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-12-21 18:55:54 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-12-21 18:55:54 (GMT)
commitea0f5d813bb26ec536f468d47f79bf93fb5a9401 (patch)
tree9d1f2cec912ce29b877327ada906721b98d5f0c5 /test
parent26b328aec8e10b9101c76bc049b6b5045b5f00a5 (diff)
parent9ceca0f89a0d27a6dfaeb3dd0cab2680281c5b60 (diff)
downloadhdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.zip
hdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.tar.gz
hdf5-ea0f5d813bb26ec536f468d47f79bf93fb5a9401.tar.bz2
[svn-r28715] - merge from trunk
- fix farray, earray, and btree test to use correct function to retrieve internal file struct.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt8
-rw-r--r--test/Makefile.am14
-rw-r--r--test/accum.c118
-rw-r--r--test/big.c16
-rw-r--r--test/btree2.c182
-rw-r--r--test/cache_tagging.c127
-rw-r--r--test/dsets.c67
-rw-r--r--test/earray.c197
-rw-r--r--test/farray.c163
-rw-r--r--test/file_image.c97
-rw-r--r--test/lheap.c101
-rw-r--r--test/links.c11
-rw-r--r--test/objcopy.c54
-rw-r--r--test/ohdr.c8
-rw-r--r--test/th5o.c1
-rw-r--r--test/vds.c6
16 files changed, 812 insertions, 358 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ac7278a..a4bc8e9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -251,11 +251,7 @@ set (H5_TESTS
ohdr
stab
gheap
- #cache
- #cache_api
- #cache_tagging
pool
- #hyperslab
istore
bittests
dt_arith
@@ -278,7 +274,6 @@ set (H5_TESTS
app_ref
enum
set_extent
- #ttsafe
getname
vfd
ntypes
@@ -293,11 +288,8 @@ set (H5_TESTS
earray
btree2
fheap
- #error_test
- #err_compat
tcheck_version
testmeta
- #links_env
file_image
enc_dec_plist
enc_dec_plist_cross_platform
diff --git a/test/Makefile.am b/test/Makefile.am
index 514317d..0667be0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -39,16 +39,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 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.
@@ -152,9 +150,9 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
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 6561a8a..3fb290b 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/big.c b/test/big.c
index e6e2f86..7a3fd21 100644
--- a/test/big.c
+++ b/test/big.c
@@ -73,10 +73,10 @@
/* Define Small, Large, Extra Large, Huge File which
* corrspond to less than 2GB, 2GB, 4GB, and tens of GB file size.
- * NOFILE stands for "no file" to be tested.
+ * NO_FILE stands for "no file" to be tested.
*/
-typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NOFILE} fsizes_t;
-fsizes_t file_size= NOFILE;
+typedef enum fsizes_t { SFILE, LFILE, XLFILE, HUGEFILE, NO_FILE} fsizes_t;
+fsizes_t file_size= NO_FILE;
const char *FILENAME[] = {
"big",
@@ -210,7 +210,7 @@ static fsizes_t
supports_big(void)
{
int fd = -1;
- fsizes_t fsize = NOFILE;
+ fsizes_t fsize = NO_FILE;
if((fd=HDopen("y.h5", O_RDWR|O_TRUNC|O_CREAT, 0666)) < 0)
goto error;
@@ -377,9 +377,9 @@ writer (char* filename, hid_t fapl, fsizes_t testsize, int wrt_n)
size2[0] /= 32;
break;
- case NOFILE:
+ case NO_FILE:
/* what to do?? */
- HDfprintf(stdout, "Unexpected file size of NOFILE\n");
+ HDfprintf(stdout, "Unexpected file size of NO_FILE\n");
goto error;
break;
@@ -599,7 +599,7 @@ test_sec2(hid_t fapl)
fsizes_t testsize;
testsize = supports_big();
- if(testsize == NOFILE) {
+ if(testsize == NO_FILE) {
HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n");
goto quit;
}
@@ -634,7 +634,7 @@ test_stdio(hid_t fapl)
fsizes_t testsize;
testsize = supports_big();
- if(testsize == NOFILE) {
+ if(testsize == NO_FILE) {
HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n");
goto quit;
}
diff --git a/test/btree2.c b/test/btree2.c
index c266b31..3ac5ef4 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -39,6 +39,7 @@
const char *FILENAME[] = {
"btree2",
+ "btree2_tmp",
NULL
};
@@ -116,9 +117,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);
@@ -2818,9 +2818,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)
@@ -2857,9 +2856,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)))
@@ -4917,7 +4915,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
@@ -6387,9 +6385,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)
@@ -6543,9 +6540,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++) {
@@ -6639,9 +6635,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)))
@@ -6728,9 +6723,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)))
@@ -6814,9 +6808,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)))
@@ -7165,9 +7158,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)
@@ -7210,9 +7202,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)
@@ -7268,9 +7259,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)
@@ -7326,9 +7316,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)
@@ -7613,6 +7602,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 *)H5VL_object(file)))
+ 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 *)H5VL_object(file2)))
+ 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
@@ -7720,6 +7849,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 34c391f..e5d494b 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) {
@@ -2463,6 +2463,9 @@ check_dataset_write_tags(hid_t fcpl, int type)
for (i=0; i<10; i++)
if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR;
+ /* Verify object header for dataset */
+ if ( verify_tag(fid, H5AC_OHDR_ID, d_tag) < 0 ) TEST_ERROR;
+
/* verify no other entries present */
if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR;
diff --git a/test/dsets.c b/test/dsets.c
index c0e8702..a9cda93 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 */
@@ -7474,7 +7475,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
@@ -9145,38 +9146,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
@@ -9186,9 +9187,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/earray.c b/test/earray.c
index c71e53b..80c720c 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -193,6 +193,7 @@ static herr_t earray_cache_test_free_icr(void *thing);
/* Local variables */
const char *FILENAME[] = {
"earray",
+ "earray_tmp",
NULL
};
@@ -340,10 +341,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 */
@@ -351,9 +352,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);
@@ -462,17 +462,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)
@@ -483,15 +485,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 */
@@ -901,7 +901,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
/*
@@ -1016,7 +1016,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;
@@ -1043,7 +1043,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;
@@ -1123,7 +1123,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
/*
@@ -1196,7 +1196,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
/*
@@ -1279,6 +1279,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 *)H5VL_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)
@@ -1302,7 +1444,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
/*
@@ -1491,7 +1633,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
/*
@@ -1766,7 +1908,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;
@@ -1984,7 +2126,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;
@@ -2236,7 +2378,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;
@@ -2457,7 +2599,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;
@@ -2545,7 +2687,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 */
@@ -2719,7 +2861,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 */
@@ -2879,7 +3021,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 */
{
@@ -2930,6 +3072,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/farray.c b/test/farray.c
index 440dd82..2ea2a37 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -110,6 +110,7 @@ struct farray_test_param_t {
/* Local variables */
const char *FILENAME[] = {
"farray",
+ "farray_tmp",
NULL
};
@@ -167,9 +168,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);
@@ -282,17 +282,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)
@@ -303,15 +305,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 */
@@ -730,6 +730,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 *)H5VL_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)
@@ -1543,7 +1681,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 */
{
@@ -1594,6 +1732,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/file_image.c b/test/file_image.c
index d9c782a..52d0b28 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -41,6 +41,8 @@
#define FAMILY_SIZE (2 * 1024)
+#define USERBLOCK_SIZE 512
+
const char *FILENAME[] = {
"file_image_core_test",
NULL
@@ -549,7 +551,7 @@ test_core(void)
VERIFY(fapl >= 0, "fapl creation failed");
/* Set up the core VFD */
- ret = H5Pset_fapl_core(fapl, 0, 0);
+ ret = H5Pset_fapl_core(fapl, (size_t)0, 0);
VERIFY(ret >= 0, "setting core driver in fapl failed");
tmp = h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -665,12 +667,17 @@ error:
* Programmer: John Mainzer
* Tuesday, November 15, 2011
*
+ * Modifications:
+ * Vailin Choi; July 2013
+ * Add the creation of user block to the file as indicated by the parameter "user".
+ *
******************************************************************************
*/
static int
test_get_file_image(const char * test_banner,
const int file_name_num,
- hid_t fapl)
+ hid_t fapl,
+ hbool_t user)
{
char file_name[1024] = "\0";
void * insertion_ptr = NULL;
@@ -694,6 +701,8 @@ test_get_file_image(const char * test_banner,
ssize_t image_size;
ssize_t file_size;
h5_stat_t stat_buf;
+ hid_t fcpl = -1;
+ herr_t ret;
TESTING(test_banner);
@@ -708,8 +717,15 @@ test_get_file_image(const char * test_banner,
h5_fixname(FILENAME2[file_name_num], fapl, file_name, sizeof(file_name));
VERIFY(HDstrlen(file_name)>0, "h5_fixname failed");
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ VERIFY(fcpl >= 0, "H5Pcreate");
+ if(user) {
+ ret = H5Pset_userblock(fcpl, (hsize_t)USERBLOCK_SIZE);
+ VERIFY(ret >=0, "H5Pset_userblock");
+ }
+
/* create the file */
- file_id = H5Fcreate(file_name, 0, H5P_DEFAULT, fapl);
+ file_id = H5Fcreate(file_name, 0, fcpl, fapl);
VERIFY(file_id >= 0, "H5Fcreate() failed.");
/* Set up data space for new new data set */
@@ -761,11 +777,15 @@ test_get_file_image(const char * test_banner,
ssize_t member_size;
ssize_t size_remaining;
+ /*
+ * Modifications need to be made to accommodate userblock when
+ * H5Fget_file_image() works for family driver
+ */
i = 0;
file_size = 0;
do {
- HDsnprintf(member_file_name, 1024, file_name, i);
+ HDsnprintf(member_file_name, (size_t)1024, file_name, i);
/* get the size of the member file */
result = HDstat(member_file_name, &stat_buf);
@@ -829,6 +849,10 @@ test_get_file_image(const char * test_banner,
* the remainder of the file is all '\0's.
*/
file_size = (ssize_t)stat_buf.st_size;
+ if(user) {
+ VERIFY(file_size > USERBLOCK_SIZE, "file size !> userblock size.");
+ file_size -= USERBLOCK_SIZE;
+ }
/* with latest mods to truncate call in core file drive,
* file size should match image size
@@ -843,6 +867,12 @@ test_get_file_image(const char * test_banner,
fd = HDopen(file_name, O_RDONLY, 0666);
VERIFY(fd >= 0, "HDopen() failed.");
+ if(user) {
+ /* Position at userblock */
+ ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET);
+ VERIFY(ret >= 0, "HDlseek() failed.");
+ }
+
/* read the test file from disk into the buffer */
bytes_read = HDread(fd, file_image_ptr, (size_t)file_size);
VERIFY(bytes_read == file_size, "HDread() failed.");
@@ -930,7 +960,6 @@ test_get_file_image_error_rejection(void)
void * image_ptr = NULL;
int data[100];
int i;
- int result;
hid_t fapl_id = -1;
hid_t file_id = -1;
hid_t dset_id = -1;
@@ -1273,13 +1302,18 @@ test_get_file_image_error_rejection(void)
error:
return 1;
-}
+} /* test_get_file_image_error_rejection() */
+/*
+ * Modifications:
+ * Add testing for file image with or without user block in the file.
+ */
int
main(void)
{
int errors = 0;
hid_t fapl;
+ unsigned user;
h5_reset();
@@ -1289,29 +1323,34 @@ main(void)
errors += test_callbacks();
errors += test_core();
- /* test H5Fget_file_image() with sec2 driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_sec2(fapl) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with sec2 driver",
- 0, fapl);
-
- /* test H5Fget_file_image() with stdio driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_stdio(fapl) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with stdio driver",
- 1, fapl);
-
- /* test H5Fget_file_image() with core driver */
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0)
- errors++;
- else
- errors += test_get_file_image("H5Fget_file_image() with core driver",
- 2, fapl);
+ /* Perform tests with/without user block */
+ for(user = FALSE; user <= TRUE; user++) {
+
+ /* test H5Fget_file_image() with sec2 driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if(H5Pset_fapl_sec2(fapl) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with sec2 driver",
+ 0, fapl, user);
+
+ /* test H5Fget_file_image() with stdio driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if(H5Pset_fapl_stdio(fapl) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with stdio driver",
+ 1, fapl, user);
+
+ /* test H5Fget_file_image() with core driver */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ if(H5Pset_fapl_core(fapl, (size_t)(64 *1024), TRUE) < 0)
+ errors++;
+ else
+ errors += test_get_file_image("H5Fget_file_image() with core driver",
+ 2, fapl, user);
+
+ } /* end for */
#if 0
/* at present, H5Fget_file_image() rejects files opened with the
diff --git a/test/lheap.c b/test/lheap.c
index f1cad93..1d5a487 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -44,36 +44,34 @@ const char *FILENAME[] = {
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Create a file, create a local heap, write data into the local
- * heap, close the file, open the file, read data out of the
- * local heap, close the file.
+ * Purpose: Create a file, create a local heap, write data into the local
+ * heap, close the file, open the file, read data out of the
+ * local heap, close the file.
*
- * Return: Success: zero
+ * Return: Success: zero
*
- * Failure: non-zero
+ * Failure: non-zero
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
- hid_t fapl=H5P_DEFAULT; /*file access properties */
- hid_t file=-1; /*hdf5 file */
- H5F_t *f=NULL; /*hdf5 file pointer */
- char filename[1024]; /*file name */
- haddr_t heap_addr; /*local heap address */
- H5HL_t *heap = NULL; /*local heap */
- size_t obj[NOBJS]; /*offsets within the heap */
- int i, j; /*miscellaneous counters */
- char buf[1024]; /*the value to store */
- const char *s; /*value to read */
+ hid_t fapl = H5P_DEFAULT; /* file access properties */
+ hid_t file = -1; /* hdf5 file */
+ H5F_t *f = NULL; /* hdf5 file pointer */
+ char filename[1024]; /* file name */
+ haddr_t heap_addr; /* local heap address */
+ H5HL_t *heap = NULL; /* local heap */
+ size_t obj[NOBJS]; /* offsets within the heap */
+ int i, j; /* miscellaneous counters */
+ char buf[1024]; /* the value to store */
+ const char *s; /* value to read */
/* Reset library */
h5_reset();
@@ -85,22 +83,22 @@ main(void)
*/
TESTING("local heap write");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- goto error;
+ if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)))
+ goto error;
if(NULL == (f = (H5F_t *)H5VL_object(file))) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
- if (H5AC_ignore_tags(f) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ if(FAIL == H5AC_ignore_tags(f)) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
- if(H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ if(FAIL == H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/)) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC__NO_FLAGS_SET))) {
H5_FAILED();
@@ -114,18 +112,19 @@ main(void)
if(j > 4)
buf[j] = '\0';
- if((size_t)(-1) == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
- }
+ if(UFAIL == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
+ }
}
- if(H5HL_unprotect(heap) < 0) {
+ if(FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if (H5Fclose(file)<0) goto error;
+ if (FAIL == H5Fclose(file))
+ goto error;
PASSED();
/*
@@ -134,16 +133,17 @@ main(void)
TESTING("local heap read");
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error;
+ if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)))
+ goto error;
if(NULL == (f = (H5F_t *)H5VL_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if (H5AC_ignore_tags(f) < 0) {
- H5_FAILED();
- H5Eprint2(H5E_DEFAULT, stdout);
- goto error;
+ if (FAIL == H5AC_ignore_tags(f)) {
+ H5_FAILED();
+ H5Eprint2(H5E_DEFAULT, stdout);
+ goto error;
}
for(i = 0; i < NOBJS; i++) {
sprintf(buf, "%03d-", i);
@@ -172,14 +172,15 @@ main(void)
goto error;
}
- if(H5HL_unprotect(heap) < 0) {
+ if(FAIL == H5HL_unprotect(heap)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
- if (H5Fclose(file)<0) goto error;
+ if (FAIL == H5Fclose(file))
+ goto error;
PASSED();
/* Check opening existing file non-default sizes of lengths and addresses */
@@ -191,8 +192,10 @@ main(void)
if(file >= 0){
if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dclose(dset) < 0) TEST_ERROR
- if(H5Fclose(file) < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0)
+ TEST_ERROR
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
}
else {
H5_FAILED();
@@ -214,7 +217,7 @@ main(void)
error:
puts("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
- H5Fclose(file);
+ H5Fclose(file);
} H5E_END_TRY;
return 1;
}
diff --git a/test/links.c b/test/links.c
index db5922b..2886304 100644
--- a/test/links.c
+++ b/test/links.c
@@ -3848,7 +3848,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 +3906,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() */
diff --git a/test/objcopy.c b/test/objcopy.c
index 82be446..f3806cd 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -1243,12 +1243,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 +2310,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 +2442,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 +2694,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 +2709,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 +2785,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 +2835,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 +2874,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 +2907,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 +2996,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 +3112,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);
@@ -4208,6 +4210,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
@@ -7245,7 +7248,7 @@ 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 */
@@ -7301,7 +7304,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 +7320,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
@@ -7582,12 +7586,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 */
@@ -7721,12 +7725,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 */
@@ -7866,12 +7870,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 */
@@ -12364,7 +12368,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 bcad826..51e68cc 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/th5o.c b/test/th5o.c
index 497ccc8..3be5d12 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -1335,6 +1335,7 @@ test_h5o_getinfo_same_file(void)
} /* test_h5o_getinfo_same_file() */
+
/****************************************************************
**
diff --git a/test/vds.c b/test/vds.c
index ba5fd71..eff01c1 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -37,7 +37,7 @@ const char *FILENAME[] = {
"vds_virt_1",
"vds_src_0",
"vds_src_1",
- "vds%_src",
+ "vds%%_src",
NULL
};
@@ -1156,7 +1156,7 @@ test_basic_io(unsigned config, hid_t fapl)
char vfilename2[FILENAME_BUF_SIZE];
char srcfilenamepct[FILENAME_BUF_SIZE];
char srcfilenamepct_map[FILENAME_BUF_SIZE];
- const char *srcfilenamepct_map_orig = "vds%%_src";
+ const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
hid_t vfile2 = -1; /* File with copied virtual dset */
@@ -6383,7 +6383,7 @@ test_printf(unsigned config, hid_t fapl)
const char *printf_srcfilename_map_orig = "vds_src_%b";
char srcfilenamepct[FILENAME_BUF_SIZE];
char srcfilenamepct_map[FILENAME_BUF_SIZE];
- const char *srcfilenamepct_map_orig = "vds%%_src";
+ const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
hid_t dcpl = -1; /* Dataset creation property list */