summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-09-14 21:02:43 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-09-14 21:02:43 (GMT)
commit7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4 (patch)
treee18b6cefc2cc51c58ebacec1d6a9051742754f71 /test
parentc1c384878ba58193120c3da804d761542c47bd7d (diff)
parent052efd9bde06ea2427beffd3ea493cbc53a17608 (diff)
downloadhdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.zip
hdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.tar.gz
hdf5-7f817fea7c50cea4305bc14fcaf4d80fb3dc42e4.tar.bz2
Merge branch 'develop' into evict_on_close
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/CMakeTests.cmake142
-rw-r--r--test/H5srcdir.h42
-rw-r--r--test/Makefile.am5
-rw-r--r--test/big.c8
-rw-r--r--test/bittests.c64
-rw-r--r--test/cmpd_dset.c185
-rw-r--r--test/dsets.c659
-rw-r--r--test/dt_arith.c32
-rw-r--r--test/dtypes.c18
-rw-r--r--test/dynlib4.c104
-rw-r--r--test/error_test.c10
-rw-r--r--test/fheap.c12
-rw-r--r--test/file_image.c16
-rw-r--r--test/fillval.c44
-rw-r--r--test/filter_fail.c1
-rw-r--r--test/flush1.c28
-rw-r--r--test/flush2.c15
-rw-r--r--test/freespace.c16
-rw-r--r--test/gen_plist.c5
-rw-r--r--test/getname.c89
-rw-r--r--test/gheap.c68
-rw-r--r--test/h5test.c100
-rw-r--r--test/h5test.h1
-rw-r--r--test/hyperslab.c20
-rw-r--r--test/lheap.c12
-rw-r--r--test/links.c276
-rw-r--r--test/links_env.c8
-rw-r--r--test/mf.c200
-rw-r--r--test/mtime.c2
-rw-r--r--test/objcopy.c320
-rw-r--r--test/ohdr.c1
-rw-r--r--test/plugin.c41
-rw-r--r--test/set_extent.c6
-rw-r--r--test/tchecksum.c4
-rw-r--r--test/test_plugin.sh.in4
-rw-r--r--test/testframe.c55
-rw-r--r--test/testhdf5.c3
-rw-r--r--test/tfile.c19
-rw-r--r--test/tgenprop.c6
-rw-r--r--test/th5o.c34
-rw-r--r--test/th5s.c20
-rw-r--r--test/theap.c3
-rw-r--r--test/titerate.c14
-rw-r--r--test/tmeta.c2
-rw-r--r--test/trefer.c28
-rw-r--r--test/tselect.c30
-rw-r--r--test/tskiplist.c3
-rw-r--r--test/tsohm.c83
-rw-r--r--test/ttsafe.c3
-rw-r--r--test/ttst.c5
-rw-r--r--test/tunicode.c42
-rw-r--r--test/tvltypes.c94
-rw-r--r--test/unlink.c1
-rw-r--r--test/vds.c1
-rw-r--r--test/vfd.c566
56 files changed, 2335 insertions, 1236 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 19603ca..6e6a0b9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -83,6 +83,7 @@ endif (BUILD_SHARED_LIBS)
)
set (TEST2_PLUGIN_LIBS
dynlib2
+ dynlib4
)
foreach (test_lib ${TEST_PLUGIN_LIBS})
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index dacf4ba..1e7940a 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -44,41 +44,17 @@ set (HDF5_TEST_FILES
)
foreach (h5_tfile ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_tfile ${HDF5_TEST_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (h5_tfile ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_DIR}/testfiles/${h5_tfile} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_tfile ${HDF5_TEST_FILES})
endforeach (vfdtest ${VFD_LIST})
@@ -96,41 +72,17 @@ set (HDF5_REFERENCE_FILES
)
foreach (ref_file ${HDF5_REFERENCE_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (ref_file ${HDF5_REFERENCE_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (ref_file ${HDF5_REFERENCE_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (ref_file ${HDF5_REFERENCE_FILES})
endforeach (vfdtest ${VFD_LIST})
@@ -191,33 +143,11 @@ set (HDF5_REFERENCE_PLIST_FILES
)
foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile}
- )
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIB_files")
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile} ${dest}/${plistfile}
- )
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile} ${dest}/def_${plistfile}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files")
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (plistfile ${HDF5_REFERENCE_PLIST_FILES})
@@ -264,45 +194,25 @@ set (HDF5_REFERENCE_TEST_FILES
)
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIBSH_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
if (HDF5_TEST_VFD)
foreach (vfdtest ${VFD_LIST})
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
- set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_TEST_LIB_files")
if (BUILD_SHARED_LIBS)
- set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}")
- add_custom_command (
- TARGET ${HDF5_TEST_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_TEST_LIBSH_files")
endif (BUILD_SHARED_LIBS)
endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES})
endforeach (vfdtest ${VFD_LIST})
endif (HDF5_TEST_VFD)
+add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list})
+if (BUILD_SHARED_LIBS)
+ add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list})
+endif()
# Remove any output file left over from previous test run
add_test (NAME H5TEST-clear-testhdf5-objects
@@ -1158,17 +1068,17 @@ if (HDF5_TEST_VFD)
set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
-# if (NOT CYGWIN)
-# set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
-# endif (NOT CYGWIN)
+ if (NOT CYGWIN)
+ set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
+ endif (NOT CYGWIN)
if (BUILD_SHARED_LIBS)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
-# if (NOT CYGWIN)
-# set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
-# endif (NOT CYGWIN)
+ if (NOT CYGWIN)
+ set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
+ endif (NOT CYGWIN)
endif (BUILD_SHARED_LIBS)
if (HDF5_TEST_FHEAP_VFD)
add_test (NAME VFD-${vfdname}-fheap
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 81624d8..2f04295 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -31,26 +31,9 @@ static char srcdir_path[1024] = "";
/* Buffer to construct file in and return pointer to */
static char srcdir_testpath[1024] = "";
-/* Append the test file name to the srcdir path and return the whole string */
-static const char *H5_get_srcdir_filename(const char *filename)
-{
- const char *srcdir = HDgetenv("srcdir");
-
- /* Check for using the srcdir from configure time */
- if(NULL == srcdir)
- srcdir = config_srcdir;
-
- /* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) {
- HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename);
- return(srcdir_testpath);
- } /* end if */
- else
- return(NULL);
-}
-
/* Just return the srcdir path */
-static const char *H5_get_srcdir(void)
+static const char *
+H5_get_srcdir(void)
{
const char *srcdir = HDgetenv("srcdir");
@@ -65,6 +48,25 @@ static const char *H5_get_srcdir(void)
} /* end if */
else
return(NULL);
-}
+} /* end H5_get_srcdir() */
+
+/* Append the test file name to the srcdir path and return the whole string */
+static const char *H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = H5_get_srcdir();
+
+ /* Check for error */
+ if(NULL == srcdir)
+ return(NULL);
+ else {
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+ } /* end else */
+} /* end H5_get_srcdir_filename() */
#endif /* _H5SRCDIR_H */
diff --git a/test/Makefile.am b/test/Makefile.am
index a7c39f3..7d062f4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -84,12 +84,13 @@ if HAVE_SHARED_CONDITIONAL
# The libh5test library provides common support code for the tests.
noinst_LTLIBRARIES=libh5test.la
- # The libdynlib1 and libdynlib2 library for testing plugin module plugin.c.
+ # The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
# Build it as shared library if configure is enabled for shared library.
- lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la
+ lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
libdynlib1_la_SOURCES=dynlib1.c
libdynlib2_la_SOURCES=dynlib2.c
libdynlib3_la_SOURCES=dynlib3.c
+ libdynlib4_la_SOURCES=dynlib4.c
install-exec-hook:
$(RM) $(DESTDIR)$(libdir)/*dynlib*
diff --git a/test/big.c b/test/big.c
index 7a3fd21..0505e54 100644
--- a/test/big.c
+++ b/test/big.c
@@ -129,8 +129,8 @@ randll(hsize_t limit, int current_index)
/* does not overlap with any previous writes */
while(overlap != 0 && tries < MAX_TRIES)
{
- acc = HDrandom();
- acc *= HDrandom();
+ acc = (hsize_t)HDrandom();
+ acc *= (hsize_t)HDrandom();
acc = acc % limit;
overlap = 0;
@@ -508,7 +508,7 @@ reader(char *filename, hid_t fapl)
if('#' != ln[0])
break;
i = (int)HDstrtol(ln + 1, &s, 10);
- hs_offset[0] = HDstrtoll(s, NULL, 0);
+ hs_offset[0] = HDstrtoull(s, NULL, 0);
HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], "");
HDfflush(stdout);
@@ -801,7 +801,7 @@ main (int ac, char **av)
/* seed = (unsigned long)1155438845; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
#endif /* QAK */
- HDsrandom(seed);
+ HDsrandom((unsigned)seed);
/* run VFD-specific test */
if(H5FD_SEC2 == driver) {
diff --git a/test/bittests.c b/test/bittests.c
index c4dfe4c..38e419d 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -88,7 +88,7 @@ test_find (void)
/* Try all combinations of one byte */
for(i = 0; i < 8 * (int)sizeof(v1); i++) {
HDmemset(v1, 0, sizeof v1);
- v1[i / 8] = 1 << (i % 8);
+ v1[i / 8] = (uint8_t)(1 << (i % 8));
n = H5T__bit_find(v1, (size_t)0, 8 * sizeof(v1), H5T_BIT_LSB, TRUE);
if((ssize_t)i != n) {
H5_FAILED();
@@ -120,8 +120,8 @@ test_find (void)
/* Try all combinations of one byte */
for (i=0; i<8*(int)sizeof(v1); i++) {
- memset (v1, 0xff, sizeof v1);
- v1[i/8] &= ~(1<<(i%8));
+ HDmemset(v1, 0xff, sizeof v1);
+ v1[i / 8] &= (uint8_t)~(1 << (i % 8));
n = H5T__bit_find (v1, (size_t)0, 8*sizeof(v1), H5T_BIT_LSB, FALSE);
if ((ssize_t)i!=n) {
H5_FAILED();
@@ -175,12 +175,12 @@ test_copy (void)
TESTING("bit copy operations");
for (i=0; i<NTESTS; i++) {
- s_offset = HDrand() % (8*sizeof v1);
- d_offset = HDrand() % (8*sizeof v2);
+ s_offset = (size_t)HDrand() % (8 * sizeof v1);
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
size = (unsigned)HDrand() % MIN (8*sizeof(v1), 8*sizeof(v2));
size = MIN3 (size, 8*sizeof(v1)-s_offset, 8*sizeof(v2)-d_offset);
- memset (v1, 0xff, sizeof v1);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v1, 0xff, sizeof v1);
+ HDmemset(v2, 0x00, sizeof v2);
/* Copy some bits to v2 and make sure something was copied */
H5T__bit_copy (v2, d_offset, v1, s_offset, size);
@@ -297,21 +297,21 @@ test_shift (void)
TESTING("bit shift operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- shift_dist = HDrand() % size;
+ shift_dist = (ssize_t)((size_t)HDrand() % size);
/*-------- LEFT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
/* Look for the ones */
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
- if ((size_t)n!=offset+shift_dist) {
+ if(n != (ssize_t)offset + shift_dist) {
H5_FAILED();
printf (" Unable to find first bit in destination "
"(n=%d)\n", (int)n);
@@ -331,7 +331,7 @@ test_shift (void)
}
/*-------- RIGHT-shift some bits and make sure something was shifted --------*/
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, -shift_dist, offset, size);
@@ -350,7 +350,7 @@ test_shift (void)
* that reverse searches work as expected.
*/
n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
- if (n!=(ssize_t)(offset+size-shift_dist-1)) {
+ if(n != (ssize_t)(offset + size) - shift_dist - 1) {
H5_FAILED();
printf (" Unable to find last bit in destination "
"(reverse, n=%d)\n", (int)n);
@@ -362,11 +362,11 @@ test_shift (void)
/* Randomly decide shift direction */
if(size % 2 == 0)
- shift_dist = size;
+ shift_dist = (ssize_t)size;
else
shift_dist = -((ssize_t)size);
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
H5T__bit_shift (vector, shift_dist, offset, size);
@@ -430,12 +430,12 @@ test_increment (void)
TESTING("bit increment operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
if(size>1) /* if size=6, make a sequence like 011111 */
H5T__bit_set (vector, offset, size-1, 1);
else /* if size=1, just set this one bit to 1 */
@@ -517,13 +517,13 @@ test_decrement (void)
TESTING("bit decrement operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after decrement */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* decrement the sequence by one */
H5T__bit_dec (vector, offset, size);
@@ -589,13 +589,13 @@ test_negate (void)
TESTING("bit negate operations");
for (i=0; i<NTESTS; i++) {
- offset = HDrand() % (8*sizeof vector);
- size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
+ offset = (size_t)HDrand() % (8 * sizeof vector);
+ size = (size_t)HDrand() % (8 * sizeof(vector) - offset);
/* Don't want size to be 0 */
if(size == 0) continue;
/* All-zero sequence will become 111111(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
/* negate the sequence */
H5T__bit_neg (vector, offset, size);
@@ -622,7 +622,7 @@ test_negate (void)
}
/* All-one sequence will become 000000(size=6) after negating */
- memset (vector, 0x00, sizeof vector);
+ HDmemset(vector, 0x00, sizeof vector);
H5T__bit_set (vector, offset, size, 1);
/* negate the sequence */
@@ -689,10 +689,10 @@ test_set (void)
TESTING("bit set operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0x00, sizeof v2);
+ HDmemset(v2, 0x00, sizeof v2);
/* Set some bits in v2 */
H5T__bit_set (v2, d_offset, size, TRUE);
@@ -806,10 +806,10 @@ test_clear (void)
TESTING("bit clear operations");
for (i=0; i<NTESTS; i++) {
- d_offset = HDrand() % (8*sizeof v2);
- size = (unsigned)HDrand() % (8*sizeof(v2));
+ d_offset = (size_t)HDrand() % (8 * sizeof v2);
+ size = (size_t)HDrand() % (8 * sizeof(v2));
size = MIN (size, 8*sizeof(v2)-d_offset);
- memset (v2, 0xff, sizeof v2);
+ HDmemset(v2, 0xff, sizeof v2);
/* Clear some bits in v2 */
H5T__bit_set (v2, d_offset, size, FALSE);
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 22bf3a2..311b9bb 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -102,15 +102,18 @@ typedef struct {
float f, g, h[16], i, j;
double k, l, m, n;
} stype1;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
double k, l, m, n;
long o, p, q;
} stype2;
+
typedef struct {
int a, b, c[8], d, e;
} stype3;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
@@ -147,7 +150,7 @@ typedef struct {
* Moved this part of code from MAIN to TEST_COMPOUND function.
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_compound (char *filename, hid_t fapl)
{
/* First dataset */
@@ -868,31 +871,31 @@ error:
*-------------------------------------------------------------------------
*/
static void
-initialize_stype1(unsigned char *buf, const size_t num)
+initialize_stype1(unsigned char *buf, size_t num)
{
int i, j;
stype1 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype1*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype1 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = i / 7 + 1;
+ s_ptr->l = i / 7 + 2;
+ s_ptr->m = i / 7 + 3;
+ s_ptr->n = i / 7 + 4;
}
}
@@ -911,35 +914,35 @@ initialize_stype1(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype2(unsigned char *buf, const size_t num)
+initialize_stype2(unsigned char *buf, size_t num)
{
size_t i, j;
stype2 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype2*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype2 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
}
}
@@ -958,19 +961,19 @@ initialize_stype2(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype3(unsigned char *buf, const size_t num)
+initialize_stype3(unsigned char *buf, size_t num)
{
int i, j;
stype3 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype3*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype3 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
}
@@ -989,39 +992,39 @@ initialize_stype3(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype4(unsigned char *buf, const size_t num)
+initialize_stype4(unsigned char *buf, size_t num)
{
size_t i, j;
stype4 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype4*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
-
- s_ptr->r = i*5+1;
- s_ptr->s = i*5+2;
- s_ptr->t = i*5+3;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype4 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
+
+ s_ptr->r = (long long)(i * 5 + 1);
+ s_ptr->s = (long long)(i * 5 + 2);
+ s_ptr->t = (long long)(i * 5 + 3);
}
}
@@ -1349,7 +1352,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_src_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1554,7 +1557,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_dst_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1763,7 +1766,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_pack_ooo(void)
{
hid_t cmpd, sub_cmpd; /* Datatype IDs */
@@ -1788,7 +1791,7 @@ test_pack_ooo(void)
for(i=0; i<PACK_NMEMBS; i++) {
/* Generate index into free_order array */
num_free = PACK_NMEMBS - i;
- j = HDrand() % num_free;
+ j = (unsigned)HDrandom() % num_free;
/* Update order array at the randomly generated (but guaranteed to be
* free) location */
@@ -1800,7 +1803,7 @@ test_pack_ooo(void)
} /* end for */
/* Generate order to insert inner compound type */
- sub_cmpd_order = HDrand() % PACK_NMEMBS;
+ sub_cmpd_order = (unsigned)HDrandom() % PACK_NMEMBS;
for(extra_space=0; extra_space<2; extra_space ++) {
if(extra_space)
@@ -1995,7 +1998,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_ooo_order(char *filename)
{
hid_t file = -1; /* File ID */
diff --git a/test/dsets.c b/test/dsets.c
index bca57e5..fe6a0c0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2952,25 +2952,34 @@ test_nbit_float(hid_t file)
/* Define user-defined single-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F32BE);
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -2980,9 +2989,8 @@ test_nbit_float(hid_t file)
*/
TESTING(" nbit float (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -2993,17 +3001,17 @@ test_nbit_float(hid_t file)
TESTING(" nbit float (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of int = size of float
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3016,10 +3024,14 @@ test_nbit_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3077,25 +3089,34 @@ test_nbit_double(hid_t file)
/* Define user-defined doule-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F64BE);
- if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
+ FAIL_STACK_ERROR
offset = 5;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 51;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)8) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)8) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)255) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3106,9 +3127,8 @@ test_nbit_double(hid_t file)
*/
TESTING(" nbit double (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3118,17 +3138,17 @@ test_nbit_double(hid_t file)
TESTING(" nbit double (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of long long = size of double
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3141,10 +3161,14 @@ test_nbit_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3330,73 +3354,103 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory compound datatype before setting the order */
- mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset compound datatype and insert some atomic types */
- cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].f = float_val[i][j];
-
- /* some even-numbered integer values are negtive */
- if((i*size[1]+j+1)%2 == 0) {
- orig_data[i][j].i = -orig_data[i][j].i;
- orig_data[i][j].s = (short)-orig_data[i][j].s;
+ for(i = 0; i < (size_t)size[0]; i++)
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].f = float_val[i][j];
+
+ /* some even-numbered integer values are negtive */
+ if((i * size[1] + j + 1) % 2 == 0) {
+ orig_data[i][j].i = -orig_data[i][j].i;
+ orig_data[i][j].s = (short)-orig_data[i][j].s;
+ }
}
- }
PASSED();
@@ -3407,9 +3461,8 @@ test_nbit_compound(hid_t file)
*/
TESTING(" nbit compound (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3419,9 +3472,8 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3429,12 +3481,12 @@ test_nbit_compound(hid_t file)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
+ for(i = 0; i < size[0]; i++) {
+ for(j = 0; j < size[1]; j++) {
if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) ||
((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) ||
- (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f))
+ (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f)))
{
H5_FAILED();
printf(" Read different values than written.\n");
@@ -3448,15 +3500,24 @@ test_nbit_compound(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3525,119 +3586,169 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- v_tid=H5Tcopy(H5T_NATIVE_UINT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. of atomic compound datatype members */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory atomic compound datatype before setting the order */
- mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset atomic compound datatype and insert some atomic types */
- cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset of the other data member */
- if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
- if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
+ if(H5Tset_precision(v_tid,precision[3]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(v_tid,offset[3]) < 0)
+ FAIL_STACK_ERROR
/* Create the simple array datatype */
- base_tid = H5Tcopy(H5T_NATIVE_CHAR);
- if(H5Tset_precision(base_tid,precision[4]) < 0) goto error;
- if(H5Tset_offset(base_tid,offset[4]) < 0) goto error;
- array_tid = H5Tarray_create2(base_tid, 2, array_dims);
+ if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(base_tid,precision[4]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(base_tid,offset[4]) < 0)
+ FAIL_STACK_ERROR
+ if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create the complex memory and dataset array datatype */
- array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims);
- mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims);
+ if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
+ if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create a memory complex compound datatype before setting the order */
- mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) goto error;
+ if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset other complex compound member datatype */
- if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset complex compound datatype and insert members */
- cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) goto error;
+ if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].a.f = float_val[i][j];
-
- power = HDpow(2.0F, (double)precision[3]);
- orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- power = HDpow(2.0F, (double)(precision[4]-1));
- orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
- } /* end for */
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].d[m][n].f = float_val[i][j];
- } /* end for */
- } /* end for */
+ orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].a.f = float_val[i][j];
+
+ power = HDpow(2.0F, (double)precision[3]);
+ orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[4]-1));
+ orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
+ } /* end for */
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].d[m][n].f = float_val[i][j];
+ } /* end for */
+ } /* end for */
PASSED();
@@ -3648,9 +3759,8 @@ test_nbit_compound_2(hid_t file)
*/
TESTING(" nbit compound complex (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3660,9 +3770,8 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3683,63 +3792,77 @@ test_nbit_compound_2(hid_t file)
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]);
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- b_failed = 0;
- d_failed = 0;
+ for(j=0; j<(size_t)size[1]; j++) {
+ b_failed = 0;
+ d_failed = 0;
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
b_failed = 1;
goto out;
- }
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
- ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
- ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
- (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f &&
- new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) {
- d_failed = 1;
- goto out;
- }
-
- out:
- if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
- ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
- ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
- (new_data[i][j].a.f==new_data[i][j].a.f &&
- new_data[i][j].a.f != new_data[i][j].a.f)||
- new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- goto error;
+ }
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
+ ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
+ ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
+ (new_data[i][j].d[m][n].f == new_data[i][j].d[m][n].f && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
+ d_failed = 1;
+ goto out;
+ }
+
+out:
+ if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
+ ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
+ ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
+ (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
+ new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
- }
}
/*----------------------------------------------------------------------
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(v_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid2) < 0) goto error;
- if(H5Tclose(cmpd_tid1) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid2) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid1) < 0) goto error;
- if(H5Tclose(array_tid) < 0) goto error;
- if(H5Tclose(base_tid) < 0) goto error;
- if(H5Tclose(array_cmplx_tid) < 0) goto error;
- if(H5Tclose(mem_array_cmplx_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(base_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3832,7 +3955,7 @@ test_nbit_compound_3(hid_t file)
for(i = 0; i < (size_t)size[0]; i++) {
power = HDpow(2.0F, 17.0F - 1.0F);
HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
- orig_data[i].i = HDrandom() % (long)power;
+ orig_data[i].i = (int)(HDrandom() % (long)power);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -4203,7 +4326,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (rand() % 1234567) / 2;
+ orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4587,7 +4710,7 @@ test_scaleoffset_float(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -4718,10 +4841,10 @@ test_scaleoffset_float_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4829,10 +4952,10 @@ test_scaleoffset_double(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
+ if((i* size[1] + j + 1) % 2 == 0)
orig_data[i][j] = -orig_data[i][j];
}
@@ -4960,10 +5083,10 @@ test_scaleoffset_double_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -5958,7 +6081,7 @@ test_set_local(hid_t fapl)
for(j=0; j<dims[1]; j++) {
/* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
- if(!H5_DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) {
+ if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
H5_FAILED();
printf(" Line %d: Read different values than written.\n",__LINE__);
printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
@@ -6717,7 +6840,7 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)j + (i * MISSING_CHUNK_DIM);
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
rdata2[i][j] = 911;
}
} /* end for */
@@ -7635,7 +7758,7 @@ test_chunk_cache(hid_t fapl)
/* Set new rdcc settings on fapl */
nslots_2 = nslots_1 * 2;
nbytes_2 = nbytes_1 * 2;
- w0_2 = w0_1 / 2.0F;
+ w0_2 = w0_1 / (double)2.0F;
if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -8074,7 +8197,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_chunk_fast(const char *env_h5_driver, hid_t fapl)
+test_chunk_fast(hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
hid_t fid = -1; /* File ID */
@@ -8135,7 +8258,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
unsigned ndims; /* Current # of dims to test */
/* Loop over dataspace ranks to test */
@@ -8435,7 +8558,7 @@ test_reopen_chunk_fast(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -8566,7 +8689,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9192,7 +9315,7 @@ test_fixed_array(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9564,10 +9687,10 @@ test_single_chunk(hid_t fapl)
TEST_ERROR
for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
- wbuf[i] = n++;
+ wbuf[i] = (int)n++;
for(i = n = 0; i < (50* 100); i++)
- t_wbuf[i] = n++;
+ t_wbuf[i] = (int)n++;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
@@ -9575,7 +9698,7 @@ test_single_chunk(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9866,7 +9989,7 @@ test_unfiltered_edge_chunks(hid_t fapl)
/* Initialize write buffer */
for(i=0; i<dim[0]; i++)
for(j=0; j<dim[1]; j++)
- wbuf[i][j] = (char)(2 * i) - (char)j;
+ wbuf[i][j] = (char)((2 * i) - j);
/* Reset byte counts */
count_nbytes_read = (size_t)0;
@@ -11944,7 +12067,7 @@ main(void)
nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 639ad52..064ee69 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -20,8 +20,6 @@
* Purpose: Tests the data type interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
/* Number of elements in each random test */
@@ -3094,8 +3092,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
if (FLT_FLOAT==dst_type) {
hw_f = (float)(*((double*)aligned));
hw = (unsigned char*)&hw_f;
- underflow = HDfabs(*((double*)aligned)) < FLT_MIN;
- overflow = HDfabs(*((double*)aligned)) > FLT_MAX;
+ underflow = HDfabs(*((double*)aligned)) < (double)FLT_MIN;
+ overflow = HDfabs(*((double*)aligned)) > (double)FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
hw_d = *((double*)aligned);
hw = (unsigned char*)&hw_d;
@@ -3109,12 +3107,12 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
} else {
HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double));
if (FLT_FLOAT==dst_type) {
- hw_f = *((long double*)aligned);
+ hw_f = (float)*((long double*)aligned);
hw = (unsigned char*)&hw_f;
underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN;
overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX;
} else if (FLT_DOUBLE==dst_type) {
- hw_d = *((long double*)aligned);
+ hw_d = (double)*((long double*)aligned);
hw = (unsigned char*)&hw_d;
underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN;
overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX;
@@ -3227,15 +3225,15 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
long double x;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
- check_mant[0] = HDfrexpl(x, check_expo+0);
- check_mant[1] = HDfrexpl(hw_ld, check_expo+1);
+ check_mant[0] = (double)HDfrexpl(x, check_expo+0);
+ check_mant[1] = (double)HDfrexpl(hw_ld, check_expo+1);
#endif
}
/* Special check for denormalized values */
if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) {
- int expo_diff=check_expo[0]-check_expo[1];
- int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1;
- double epsilon=1.0F;
+ int expo_diff = check_expo[0] - check_expo[1];
+ int valid_bits = (int)((dst_ebias + dst_msize) + (size_t)MIN(check_expo[0], check_expo[1])) - 1;
+ double epsilon = 1.0F;
/* Re-scale the mantissas based on any exponent difference */
if(expo_diff!=0)
@@ -3249,8 +3247,8 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
continue;
} /* end if */
else {
- if (check_expo[0]==check_expo[1] &&
- HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON)
+ if(check_expo[0] == check_expo[1] &&
+ HDfabs(check_mant[0] - check_mant[1]) < (double)FP_EPSILON)
continue;
} /* end else */
}
@@ -4217,10 +4215,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
if(dendian==H5T_ORDER_LE && dst_type==FLT_LDOUBLE) {
- unsigned int q;
- for(q=dst_nbits/8; q<dst_size; q++) {
- buf[j*dst_size+q] = 0x00;
- }
+ size_t q;
+
+ for(q = dst_nbits / 8; q < dst_size; q++)
+ buf[j * dst_size + q] = 0x00;
}
#endif
diff --git a/test/dtypes.c b/test/dtypes.c
index 984b6c6..f247bd9 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -20,8 +20,6 @@
* Purpose: Tests the datatype interface (H5T)
*/
-#include <math.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
#include "H5Iprivate.h" /* For checking that datatype id's don't leak */
@@ -1927,12 +1925,12 @@ test_compound_10(void)
for(i=0; i<ARRAY_DIM; i++) {
wdata[i].i1 = i*10+i;
wdata[i].str = HDstrdup("C string A");
- wdata[i].str[9] += (char)i;
+ wdata[i].str[9] = (char)(wdata[i].str[9] + i);
wdata[i].i2 = i*1000+i*10;
wdata[i].text.p = (void*)HDstrdup("variable-length text A\0");
len = wdata[i].text.len = HDstrlen((char*)wdata[i].text.p)+1;
- ((char*)(wdata[i].text.p))[len-2] += (char)i;
+ ((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i);
((char*)(wdata[i].text.p))[len-1] = '\0';
}
@@ -2185,7 +2183,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2229,7 +2227,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2267,7 +2265,7 @@ test_compound_11(void)
/* Verify converted buffer is correct */
for(u=0; u<NTESTELEM; u++) {
- if(((big_t *)buf_orig)[u].d1!=((little_t *)buf)[u].d1) {
+ if(!H5_DBL_ABS_EQUAL(((big_t *)buf_orig)[u].d1, ((little_t *)buf)[u].d1)) {
printf("Error, line #%d: buf_orig[%u].d1=%f, buf[%u].d1=%f\n",__LINE__,
(unsigned)u,((big_t *)buf_orig)[u].d1,(unsigned)u,((little_t *)buf)[u].d1);
TEST_ERROR
@@ -2489,7 +2487,7 @@ test_compound_13(void)
/* Check the data. */
for (u = 0; u < COMPOUND13_ARRAY_SIZE + 1; u++)
if(data_out.x[u] != data_in.x[u]) TEST_ERROR
- if(data_out.y != data_in.y) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(data_out.y, data_in.y)) TEST_ERROR
/* Release all resources. */
if(H5Aclose(attid) < 0) FAIL_STACK_ERROR
@@ -6115,7 +6113,7 @@ test_int_float_except(void)
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf[u];
- if(*floatp != buf_float[u]) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(*floatp, buf_float[u])) TEST_ERROR
} /* end for */
/* Check for proper exceptions */
@@ -6136,7 +6134,7 @@ test_int_float_except(void)
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
floatp = (float *)&buf2[u];
- if(*floatp != buf2_float[u]) TEST_ERROR
+ if(!H5_FLT_ABS_EQUAL(*floatp, buf2_float[u])) TEST_ERROR
} /* end for */
/* Check for proper exceptions */
diff --git a/test/dynlib4.c b/test/dynlib4.c
new file mode 100644
index 0000000..8da0270
--- /dev/null
+++ b/test/dynlib4.c
@@ -0,0 +1,104 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic document set and is *
+ * linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access *
+ * to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "H5PLextern.h"
+
+#define H5Z_FILTER_DYNLIB4 260
+
+#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str)
+
+static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_DYNLIB4[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIB4, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlib4", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_filter_dynlib4
+ *
+ * Purpose: A dynlib4 filter method that adds on and subtract from
+ * the original value with another value. It will be built
+ * as a shared library. plugin.c test will load and use
+ * this filter library. Designed to call a HDF function.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ int *int_ptr = (int *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+ int add_on = 0;
+ unsigned ver_info[3];
+
+ /* Check for the library version */
+ if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion");
+ return(0);
+ }
+ /* Check for the correct number of parameters */
+ if(cd_nelmts == 0)
+ return(0);
+
+ /* Check that permanent parameters are set correctly */
+ if(cd_values[0] > 9)
+ return(0);
+
+ if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) {
+ PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match");
+ return(0);
+ }
+
+ add_on = (int)cd_values[0];
+
+ if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Substract the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ -= add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end if */
+ else { /*write*/
+ /* Add the "add on" value to all the data values */
+ while(buf_left > 0) {
+ *int_ptr++ += add_on;
+ buf_left -= sizeof(int);
+ } /* end while */
+ } /* end else */
+
+ return nbytes;
+} /* end H5Z_filter_dynlib4() */
+
diff --git a/test/error_test.c b/test/error_test.c
index ee181b1..b150656 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -270,7 +270,7 @@ error:
static herr_t
error_stack(void)
{
- int err_num;
+ ssize_t err_num;
const char *FUNC_error_stack = "error_stack";
if((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
@@ -284,7 +284,7 @@ error_stack(void)
/* Make it push error, force this function to fail */
if((err_num = H5Eget_num(ERR_STACK)) == 0) {
H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
- "Get number test failed, returned %d", err_num);
+ "Get number test failed, returned %d", (int)err_num);
goto error;
} /* end if */
@@ -354,7 +354,7 @@ test_long_desc(void)
/* Create the long part of the error description */
for(u = 0; u < LONG_DESC_SIZE; u++)
- long_desc[u] = 'A' + (u % 26);
+ long_desc[u] = (char)('A' + (u % 26));
long_desc[LONG_DESC_SIZE - 1] = '\0';
/* Clear the default error stack */
@@ -487,7 +487,7 @@ test_create(void)
{
const char *err_func = "test_create"; /* Function name for pushing error */
const char *err_msg = "Error message"; /* Error message for pushing error */
- int err_num; /* Number of errors on stack */
+ ssize_t err_num; /* Number of errors on stack */
hid_t estack_id; /* Error stack ID */
/* Create an empty error stack */
@@ -538,7 +538,7 @@ test_copy(void)
{
const char *err_func = "test_copy"; /* Function name for pushing error */
const char *err_msg = "Error message"; /* Error message for pushing error */
- int err_num; /* Number of errors on stack */
+ ssize_t err_num; /* Number of errors on stack */
hid_t estack_id; /* Error stack ID */
herr_t ret; /* Generic return value */
diff --git a/test/fheap.c b/test/fheap.c
index a59c27f..8e364de 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -13758,7 +13758,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
unsigned char obj_type; /* Type of storage for object */
fheap_heap_state_t state; /* State of fractal heap */
unsigned deflate_level; /* Deflation level */
- unsigned old_actual_id_len = 0; /* Old actual ID length */
+ size_t old_actual_id_len =0 ; /* Old actual ID length */
hbool_t huge_ids_direct; /* Are 'huge' objects directly acccessed? */
const char *base_desc = "insert 'huge' object into heap with I/O filters, then remove %s"; /* Test description */
@@ -15741,7 +15741,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Loop over adding objects to the heap, until the size limit is reached */
total_obj_added = 0;
while(total_obj_added < size_limit) {
- unsigned size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
+ size_t size_range = (tmp_cparam.managed.start_block_size / 8); /* Object size range */
/* Determine the size of the range for this object */
/* (50% of the objects inserted will use the initial size range,
@@ -16061,9 +16061,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* Change size of data to write */
if(u < 20)
- obj_size = (size_t)(obj_size * 1.3F);
+ obj_size = (size_t)((float)obj_size * 1.3F);
else
- obj_size = (size_t)(obj_size / 1.3F);
+ obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
@@ -16110,9 +16110,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam)
/* Change size of data to write */
if(u < 20)
- obj_size = (size_t)(obj_size * 1.3F);
+ obj_size = (size_t)((float)obj_size * 1.3F);
else
- obj_size = (size_t)(obj_size / 1.3F);
+ obj_size = (size_t)((float)obj_size / 1.3F);
} /* end for */
/* Close the fractal heap */
diff --git a/test/file_image.c b/test/file_image.c
index 6d1845f..dd0a483 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -22,7 +22,6 @@
*************************************************************/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Fprivate.h" /* required to test property removals */
#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
@@ -633,7 +632,8 @@ test_core(void)
VERIFY(ret == 0, "fstat failed");
size = (size_t)sb.st_size;
file_image = (unsigned char *)HDmalloc(size);
- HDread(fd, file_image, size);
+ if(HDread(fd, file_image, size) < 0)
+ FAIL_PUTS_ERROR("unable to read from file descriptor");
ret = HDclose(fd);
VERIFY(ret == 0, "close failed");
@@ -868,9 +868,11 @@ test_get_file_image(const char * test_banner,
VERIFY(fd >= 0, "HDopen() failed.");
if(user) {
+ HDoff_t off;
+
/* Position at userblock */
- ret = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET);
- VERIFY(ret >= 0, "HDlseek() failed.");
+ off = HDlseek(fd, (off_t)USERBLOCK_SIZE, SEEK_SET);
+ VERIFY(off >= 0, "HDlseek() failed.");
}
/* read the test file from disk into the buffer */
@@ -1317,7 +1319,7 @@ main(void)
h5_reset();
- printf("Testing File Image Functionality.\n");
+ HDprintf("Testing File Image Functionality.\n");
errors += test_properties();
errors += test_callbacks();
@@ -1378,12 +1380,12 @@ main(void)
h5_restore_err();
if(errors) {
- printf("***** %d File Image TEST%s FAILED! *****\n",
+ HDprintf("***** %d File Image TEST%s FAILED! *****\n",
errors, errors > 1 ? "S" : "");
return 1;
}
- printf("All File Image tests passed.\n");
+ HDprintf("All File Image tests passed.\n");
return 0;
}
diff --git a/test/fillval.c b/test/fillval.c
index 1ea2ae6..3f713e9 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -623,7 +623,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset9)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if( rd_c.a!=0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z != '\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
@@ -696,7 +696,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
if((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0) goto error;
if((dcpl = H5Dget_create_plist(dset8)) < 0) goto error;
if(H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0) goto error;
- if(rd_c.a != 0 || rd_c.y != fill_ctype.y || rd_c.x != 0 || rd_c.z!='\0') {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') {
H5_FAILED();
puts(" Got wrong fill value");
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n",
@@ -789,7 +789,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for (i=0; i<1000; i++) {
for (j=0; j<5; j++)
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL,
one, NULL) < 0) goto error;
@@ -811,9 +811,9 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
} else if(datatype==H5T_COMPOUND) {
if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT,
&rd_c) < 0) goto error;
- if(fill_time!=H5D_FILL_TIME_NEVER && (rd_c.a!=fill_c.a ||
- rd_c.x!=fill_c.x || rd_c.y!=fill_c.y ||
- rd_c.z!=fill_c.z)) {
+ if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) ||
+ rd_c.x != fill_c.x || !H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) ||
+ rd_c.z != fill_c.z)) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c"
@@ -879,8 +879,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
/* Verify values, except if no fill value written */
if(fill_time != H5D_FILL_TIME_NEVER) {
for(u = 0; u < nelmts; u++) {
- if(buf_c[u].a != fill_c.a || buf_c[u].x != fill_c.x ||
- buf_c[u].y != fill_c.y || buf_c[u].z != fill_c.z) {
+ if(!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
+ !H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
HDfprintf(stdout," Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c"
@@ -938,7 +938,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
goto error;
for(i = 0; i < 1000; i++) {
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % cur_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
odd += (int)(hs_offset[j]%2);
} /* end for */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
@@ -993,8 +993,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
}
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1012,8 +1012,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
should_be_c.x=buf_c[0].x;
should_be_c.y=buf_c[0].y;
should_be_c.z=buf_c[0].z;
- if( rd_c.a!=should_be_c.a || rd_c.x!=should_be_c.x ||
- rd_c.y!=should_be_c.y || rd_c.z!=should_be_c.z) {
+ if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
+ !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
H5_FAILED();
HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
@@ -1438,9 +1438,11 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
int (*release_rtn)(void *);
size_t val_size; /* Size of element */
- void *val_rd, *should_be, *init_val, *odd_val, *even_val;
+ void *val_rd, *odd_val;
+ const void *init_val, *should_be, *even_val;
int val_rd_i, init_val_i = 9999;
- comp_vl_datatype val_rd_c, init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype init_val_c = {87, "baz", "mumble", 129};
+ comp_vl_datatype val_rd_c;
void *buf = NULL;
unsigned odd; /* Whether an odd or even coord. was read */
unsigned i, j; /* Local index variables */
@@ -1495,7 +1497,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0; j < 5; j++)
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
/* Select the random element */
if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR
@@ -1548,7 +1550,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % start_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % start_size[j];
odd += (unsigned)(hs_offset[j] % 2);
} /* end for */
@@ -1586,7 +1588,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1625,7 +1627,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % max_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % max_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1666,7 +1668,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
@@ -1759,7 +1761,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
for(i = 0; i < 1000; i++) {
/* Set offset for random element */
for(j = 0, odd = 0; j < 5; j++) {
- hs_offset[j] = rand() % extend_size[j];
+ hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
if(hs_offset[j] >= start_size[j])
odd = 1;
else
diff --git a/test/filter_fail.c b/test/filter_fail.c
index 0b92abb..c7248cc 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -22,7 +22,6 @@
*/
#include "h5test.h"
-#include "H5srcdir.h"
#define DSET_NAME "dset_fail"
#define H5Z_FILTER_FAIL_TEST 312
diff --git a/test/flush1.c b/test/flush1.c
index f15a05a..f1169ea 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -68,13 +68,8 @@ create_file(char* name, hid_t fapl)
/* Write some data */
for(i = 0; i < ds_size[0]; i++)
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
for(j = 0; j < (size_t)ds_size[1]; j++)
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
+ the_data[i][j] = (double)i / (double)(j + 1);
if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) FAIL_STACK_ERROR
/* Create some groups */
@@ -124,25 +119,15 @@ extend_file(hid_t file)
goto error;
/* Write some data */
- for (i=0; i<ds_size[0]; i++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- for (j=0; j<(size_t)ds_size[1]; j++) {
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
- }
- }
- if (H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT,
- the_data) < 0) goto error;
-
+ for(i = 0; i < ds_size[0]; i++)
+ for(j = 0; j < (size_t)ds_size[1]; j++)
+ the_data[i][j] = (double)i / (double)(j + 1);
+ if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error;
return file;
error:
- HD_exit(1);
-
+ HD_exit(1);
}
/*-------------------------------------------------------------------------
@@ -206,3 +191,4 @@ error:
HD_exit(1);
return 1;
}
+
diff --git a/test/flush2.c b/test/flush2.c
index e86d646..7dc45be 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -63,22 +63,15 @@ check_dset(hid_t file, const char* name)
assert(100 == ds_size[0] && 100 == ds_size[1]);
/* Read some data */
- if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT,
- the_data) < 0) goto error;
+ if(H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, H5P_DEFAULT, the_data) < 0) goto error;
for(i = 0; i < (size_t)ds_size[0]; i++)
for(j = 0; j < (size_t)ds_size[1]; j++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- error = fabs(the_data[i][j] - (double)(hssize_t)i / ((hssize_t)j + 1));
- if(error > 0.0001F) {
+ error = HDfabs(the_data[i][j] - (double)i / (double)(j + 1));
+ if(error > (double)0.0001F) {
H5_FAILED();
printf(" dset[%lu][%lu] = %g\n",
(unsigned long)i, (unsigned long)j, the_data[i][j]);
- printf(" should be %g\n",
- (double)(hssize_t)i/(hssize_t)(j+1));
+ printf(" should be %g\n", (double)i / (double)(j + 1));
goto error;
}
}
diff --git a/test/freespace.c b/test/freespace.c
index 6e680c3..1c28bc2 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -455,7 +455,7 @@ test_fs_create(hid_t fapl)
h5_stat_size_t file_size, empty_size; /* File size */
frspace_state_t state; /* State of free space*/
H5FS_create_t cparam, test_cparam; /* creation parameters */
- size_t nclasses;
+ uint16_t nclasses;
unsigned init_flags=0;
TESTING("the creation/close/reopen/deletion of the free-space manager");
@@ -589,7 +589,7 @@ test_fs_sect_add(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -921,7 +921,7 @@ test_fs_sect_find(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1302,7 +1302,7 @@ test_fs_sect_merge(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1768,7 +1768,7 @@ test_fs_sect_shrink(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2106,7 +2106,7 @@ test_fs_sect_change_class(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2396,7 +2396,7 @@ test_fs_sect_extend(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
@@ -2744,7 +2744,7 @@ test_fs_sect_iterate(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
TEST_free_section_t *sect_node=NULL;
diff --git a/test/gen_plist.c b/test/gen_plist.c
index b45eeeb..c617ad0 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -17,11 +17,6 @@
* generate plist file
*/
-#include <assert.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
#include "H5private.h"
#include "hdf5.h"
diff --git a/test/getname.c b/test/getname.c
index 2700b49..e6d26ce 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2433,6 +2433,7 @@ test_obj_ref(hid_t fapl)
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
int tu32[SPACE1_DIM1]; /* Int data */
+ ssize_t namelen; /* Length of the name */
int i; /* counting variables */
char buf[100];
@@ -2575,104 +2576,104 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to normal dataset in root group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
*buf = '\0';
/* Check H5Rget_name returns the correct length of the name when name is NULL */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(namelen != 9) TEST_ERROR
/* Make sure size parameter is ignored */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(namelen != 9) TEST_ERROR
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(tid1, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf));
if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
PASSED()
/* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */
@@ -2682,12 +2683,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset hidden by a mounted file");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
@@ -2698,12 +2699,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset that has been unlinked");
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Close disk dataspace */
diff --git a/test/gheap.c b/test/gheap.c
index 3f66d35..317e306 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -81,7 +81,7 @@ test_1 (hid_t fapl)
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -104,16 +104,16 @@ test_1 (hid_t fapl)
* a clean file, the addresses allocated for the collections should also
* be monotonically increasing.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i);
+ status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if(status < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
- } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) {
+ } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) {
H5_FAILED();
puts(" Collection addresses are not monotonically increasing");
nerrors++;
@@ -123,11 +123,11 @@ test_1 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for(i = 0; i < 1024; i++) {
- size = i + 1;
- HDmemset(out, 'A' + i % 26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u + 1;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) {
+ if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
@@ -177,7 +177,7 @@ test_2 (hid_t fapl)
H5HG_t obj[1024];
uint8_t out[1024];
uint8_t in[1024];
- int i;
+ size_t u;
size_t size;
int nerrors = 0;
char filename[1024];
@@ -197,11 +197,11 @@ test_2 (hid_t fapl)
/*
* Write the objects, monotonically decreasing in length.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = 1024 - u;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i)<0) {
+ if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u) < 0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
nerrors++;
@@ -211,11 +211,11 @@ test_2 (hid_t fapl)
/*
* Now try to read each object back.
*/
- for (i=0; i<1024; i++) {
- size = 1024-i;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = 1024 - u;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) {
+ if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj + u, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
nerrors++;
@@ -263,7 +263,7 @@ test_3 (hid_t fapl)
H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -282,11 +282,11 @@ test_3 (hid_t fapl)
}
/* Create some stuff */
- for (i=0; i<1024; i++) {
- size = i%30+100;
- memset (out, 'A'+i%26, size);
+ for(u = 0; u < 1024; u++) {
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i);
+ status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
@@ -295,8 +295,8 @@ test_3 (hid_t fapl)
}
/* Remove everything */
- for (i=0; i<1024; i++) {
- status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i);
+ for(u = 0; u < 1024; u++) {
+ status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to remove object");
@@ -342,7 +342,7 @@ test_4 (hid_t fapl)
H5F_t *f = NULL;
H5HG_t obj[1024];
uint8_t out[1024];
- int i;
+ size_t u;
size_t size;
herr_t status;
int nerrors = 0;
@@ -360,12 +360,12 @@ test_4 (hid_t fapl)
goto error;
}
- for (i=0; i<1024; i++) {
+ for(u = 0; u < 1024; u++) {
/* Insert */
- size = i%30+100;
- memset (out, 'A'+i%26, size);
+ size = u % 30 + 100;
+ HDmemset(out, (int)('A' + u % 26), size);
H5Eclear2(H5E_DEFAULT);
- status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i);
+ status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj + u);
if (status<0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
@@ -377,15 +377,15 @@ test_4 (hid_t fapl)
* next one has already been inserted. That is, insert A, B, C;
* remove B, insert D, E, F; remove E; etc.
*/
- if (1==i%3) {
+ if(1 == (u % 3)) {
H5Eclear2(H5E_DEFAULT);
- status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i-1);
+ status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj + u - 1);
if (status<0) {
H5_FAILED();
puts(" Unable to remove object");
nerrors++;
}
- memset (obj+i-1, 0, sizeof *obj);
+ HDmemset(obj + u - 1, 0, sizeof *obj);
}
}
diff --git a/test/h5test.c b/test/h5test.c
index 6267137..aea5dc7 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -782,21 +782,18 @@ h5_rmprefix(const char *filename)
/*-------------------------------------------------------------------------
- * Function: h5_fileaccess
+ * Function: h5_fileaccess
*
- * Purpose: Returns a file access template which is the default template
- * but with a file driver set according to the constant or
- * environment variable HDF5_DRIVER
+ * Purpose: Returns a file access template which is the default template
+ * but with a file driver set according to the constant or
+ * environment variable HDF5_DRIVER
*
- * Return: Success: A file access property list
- *
- * Failure: -1
+ * Return: Success: A file access property list
+ * Failure: -1
*
* Programmer: Robb Matzke
* Thursday, November 19, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -804,45 +801,56 @@ h5_fileaccess(void)
{
const char *val = NULL;
const char *name;
- char s[1024];
- hid_t fapl = -1;
+ char s[1024];
+ hid_t fapl = -1;
/* First use the environment variable, then the constant */
val = HDgetenv("HDF5_DRIVER");
#ifdef HDF5_DRIVER
- if (!val)
+ if(!val)
val = HDF5_DRIVER;
#endif
- if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
return -1;
- if (!val || !*val)
- return fapl; /*use default*/
+ if(!val || !*val)
+ return fapl; /* use default */
HDstrncpy(s, val, sizeof s);
s[sizeof(s)-1] = '\0';
- if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl;
+ if(NULL == (name = HDstrtok(s, " \t\n\r")))
+ return fapl;
- if (!HDstrcmp(name, "sec2")) {
+ if(!HDstrcmp(name, "sec2")) {
/* Unix read() and write() system calls */
- if (H5Pset_fapl_sec2(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "stdio")) {
+ if (H5Pset_fapl_sec2(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "stdio")) {
/* Standard C fread() and fwrite() system calls */
- if (H5Pset_fapl_stdio(fapl)<0) return -1;
- } else if (!HDstrcmp(name, "core")) {
+ if (H5Pset_fapl_stdio(fapl) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core")) {
/* In-memory driver settings (backing store on, 1 MB increment) */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- } else if (!HDstrcmp(name, "core_paged")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "core_paged")) {
/* In-memory driver with write tracking and paging on */
- if (H5Pset_fapl_core(fapl, (size_t)1, TRUE)<0) return -1;
- if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096)<0) return -1;
- } else if (!HDstrcmp(name, "split")) {
+ if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0)
+ return -1;
+ if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0)
+ return -1;
+ }
+ else if(!HDstrcmp(name, "split")) {
/* Split meta data and raw data each using default driver */
- if (H5Pset_fapl_split(fapl,
+ if(H5Pset_fapl_split(fapl,
"-m.h5", H5P_DEFAULT,
- "-r.h5", H5P_DEFAULT)<0)
+ "-r.h5", H5P_DEFAULT) < 0)
return -1;
- } else if (!HDstrcmp(name, "multi")) {
+ }
+ else if(!HDstrcmp(name, "multi")) {
/* Multi-file driver, general case of the split driver */
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl[H5FD_MEM_NTYPES];
@@ -858,45 +866,47 @@ h5_fileaccess(void)
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
- memb_fapl[mt] = H5P_DEFAULT;
- sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
+ memb_fapl[mt] = H5P_DEFAULT;
+ HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]);
memb_name[mt] = sv[mt];
memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10);
} /* end for */
- if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name,
- memb_addr, FALSE)<0) {
+ if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
return -1;
- }
- } else if (!HDstrcmp(name, "family")) {
+ }
+ else if(!HDstrcmp(name, "family")) {
hsize_t fam_size = 100*1024*1024; /*100 MB*/
/* Family of files, each 1MB and using the default driver */
- if ((val=HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024);
- if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
+ if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0)
return -1;
- } else if (!HDstrcmp(name, "log")) {
+ }
+ else if(!HDstrcmp(name, "log")) {
unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC;
/* Log file access */
- if ((val = HDstrtok(NULL, " \t\n\r")))
+ if((val = HDstrtok(NULL, " \t\n\r")))
log_flags = (unsigned)HDstrtol(val, NULL, 0);
-
- if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
+ if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0)
return -1;
- } else if (!HDstrcmp(name, "direct")) {
+ }
+ else if(!HDstrcmp(name, "direct")) {
#ifdef H5_HAVE_DIRECT
/* Linux direct read() and write() system calls. Set memory boundary, file block size,
* and copy buffer size to the default values. */
- if (H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0)
+ if(H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0)
return -1;
#endif
- } else if(!HDstrcmp(name, "latest")) {
+ }
+ else if(!HDstrcmp(name, "latest")) {
/* use the latest format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
- } else {
+ }
+ else {
/* Unknown driver */
return -1;
}
diff --git a/test/h5test.h b/test/h5test.h
index 575497b..6806e8f 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -166,6 +166,7 @@ H5TEST_DLL void TestParseCmdLine(int argc, char *argv[]);
H5TEST_DLL void PerformTests(void);
H5TEST_DLL void TestSummary(void);
H5TEST_DLL void TestCleanup(void);
+H5TEST_DLL void TestShutdown(void);
H5TEST_DLL void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[]));
H5TEST_DLL int GetTestVerbosity(void);
H5TEST_DLL int SetTestVerbosity(int newval);
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 2cf47b1..9ba5731 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -223,7 +223,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
for(v = (size_t)dst_offset[1]; v < dst_offset[1] + dy; v++)
for(w = (size_t)dst_offset[2]; w < dst_offset[2] + dz; w++)
ref_value -= dst[u * ny * nz + v * nz + w];
- ref_value += fill_value * dx * dy * dz;
+ ref_value += fill_value * (unsigned)dx * (unsigned)dy * (unsigned)dz;
/* Fill the hyperslab with some value */
H5VM_hyper_fill(ndims, hs_size, dst_size, dst_offset, dst, fill_value);
@@ -819,8 +819,8 @@ test_transpose(size_t nx, size_t ny)
size[1] = ny;
src_stride[0] = 0;
src_stride[1] = sizeof(*src);
- dst_stride[0] = (ssize_t)((1 - nx * ny) * sizeof(*src));
- dst_stride[1] = (ssize_t)(nx * sizeof(*src));
+ dst_stride[0] = (hsize_t)((1 - nx * ny) * sizeof(*src));
+ dst_stride[1] = (hsize_t)(nx * sizeof(*src));
/* Copy and transpose */
if(nx == ny)
@@ -923,7 +923,7 @@ test_sub_super(size_t nx, size_t ny)
/* Setup */
size[0] = nx;
size[1] = ny;
- src_stride[0] = (ssize_t)(2 * ny);
+ src_stride[0] = (hsize_t)(2 * ny);
src_stride[1] = 2;
dst_stride[0] = 0;
dst_stride[1] = 1;
@@ -972,9 +972,9 @@ test_sub_super(size_t nx, size_t ny)
src_stride[1] = 1;
src_stride[2] = 0;
src_stride[3] = 0;
- dst_stride[0] = (ssize_t)(2 * ny);
- dst_stride[1] = (ssize_t)(2 * sizeof(uint8_t) - 4 * ny);
- dst_stride[2] = (ssize_t)(2 * ny - 2 * sizeof(uint8_t));
+ dst_stride[0] = (hsize_t)(2 * ny);
+ dst_stride[1] = (hsize_t)(2 * sizeof(uint8_t) - 4 * ny);
+ dst_stride[2] = (hsize_t)(2 * ny - 2 * sizeof(uint8_t));
dst_stride[3] = sizeof(uint8_t);
/* Copy */
@@ -1144,9 +1144,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
/* Check offsets */
for(u = 0; u < n; u++) {
/* Get random coordinate */
- coords[0] = (hssize_t)(HDrandom() % z);
- coords[1] = (hssize_t)(HDrandom() % y);
- coords[2] = (hssize_t)(HDrandom() % x);
+ coords[0] = (hsize_t)((size_t)HDrandom() % z);
+ coords[1] = (hsize_t)((size_t)HDrandom() % y);
+ coords[2] = (hsize_t)((size_t)HDrandom() % x);
/* Get offset of coordinate */
off = H5VM_array_offset(ARRAY_OFFSET_NDIMS, dims, coords);
diff --git a/test/lheap.c b/test/lheap.c
index 2f3359f..61323a9 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -158,9 +158,9 @@ main(void)
if (strcmp(s, buf)) {
H5_FAILED();
- printf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
- printf(" got: \"%s\"\n", s);
- printf(" ans: \"%s\"\n", buf);
+ HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i]));
+ HDprintf(" got: \"%s\"\n", s);
+ HDprintf(" ans: \"%s\"\n", buf);
goto error;
}
@@ -191,7 +191,7 @@ main(void)
}
else {
H5_FAILED();
- printf("***cannot open the pre-created non-default sizes test file (%s)\n",
+ HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n",
testfile);
goto error;
} /* end else */
@@ -201,13 +201,13 @@ main(void)
/* Verify symbol table messages are cached */
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
- puts("All local heap tests passed.");
+ HDputs("All local heap tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Fclose(file);
} H5E_END_TRY;
diff --git a/test/links.c b/test/links.c
index 639a2d8..f60a88a 100644
--- a/test/links.c
+++ b/test/links.c
@@ -7303,6 +7303,281 @@ error:
/*-------------------------------------------------------------------------
+ * Function: external_link_with_committed_datatype
+ *
+ * Purpose: Test to verify the problem described in HDFFV-9940 is resolved.
+ * (A) Attach an attribute to an externally linked group in the target file.
+ * The attribute's datatype is a committed datatype to the root group
+ * in the main file.
+ * (B) Create a dataset to an externally group in the target file.
+ * The dataset's datatype is a committed datatype to the root group
+ * in the main file.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: This is copied and modified from the customer's test program that
+ * exposed the problem.
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t gid1 = -1, gid2 = -1; /* Group IDs */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t sid2 = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t atid = -1; /* Attribute's datatype ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t dtid = -1; /* Dataset's datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ int wdata = 99; /* Attribute data written */
+ int wbuf[60]; /* Data buffer for writing */
+ int rbuf[60]; /* Data buffer for reading */
+ int i; /* Local index variable */
+ char filename1[NAME_BUF_SIZE]; /* File name for main file */
+ char filename2[NAME_BUF_SIZE]; /* File name for target file */
+ hsize_t dims[2] = {5, 12}; /* Dimension sizes */
+ hsize_t chunks[2] = {3, 7}; /* Chunk sizes */
+
+ if(new_format)
+ TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)")
+ else
+ TESTING("attach committed datatype to external group's attribute/dataset")
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+
+
+ /* Main file */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create external link from main file to target file */
+ if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Create target file */
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ /* Create group in target file */
+ if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
+ /* Close the file */
+ if(H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the group which is externally linked to target file */
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a copy of integer datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Commit the datatype to the main file root group */
+ if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create dataspace */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Attach an attribute with the committed datatype to the group */
+ if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Write data to the attribute */
+ if(H5Awrite(aid, tid, &wdata) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attribute's datatype */
+ if((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is not committed */
+ if(H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the attribute */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create a chunked dataset */
+ if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunks) < 0)
+ FAIL_STACK_ERROR
+
+ /* Initialize data buffers */
+ for(i = 0; i < 60; i++) {
+ wbuf[i] = i;
+ rbuf[i] = 0;
+ }
+
+ /* Create a dataset with the committed datatype in the group */
+ if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the dataset's datatype */
+ if((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is not committed */
+ if(H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset creation property list */
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataspaces */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the datatypes */
+ if(H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* Open the mainfile */
+ if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the committed datatype in the mainfile */
+ if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the datatype is committed */
+ if(H5Tcommitted(tid) == FALSE)
+ FAIL_STACK_ERROR
+
+ /* Open the group which is externally linked to target file */
+ if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the attribute attached to the group */
+ if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attribute's datatype */
+ if((atid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the attribute's datatype is not committed */
+ if(H5Tcommitted(atid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Close the attribute */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Delete the attribute */
+ if(H5Adelete(gid1, "myAttribute") < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the dataset in the group */
+ if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the dataset's datatype */
+ if((dtid = H5Dget_type(did)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the dataset's datatype is not committed */
+ if(H5Tcommitted(dtid) == TRUE)
+ FAIL_STACK_ERROR
+
+ /* Read the dataset */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ FAIL_STACK_ERROR
+
+ /* Compare the data read should be the same as wbuf */
+ if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0)
+ FAIL_STACK_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid1) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the datatypes */
+ if(H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(atid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(dtid) < 0)
+ FAIL_STACK_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid1) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid2);
+ H5Fclose(fid1);
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+
+ H5Aclose(aid);
+ H5Dclose(did);
+
+ H5Sclose(sid);
+ H5Sclose(sid2);
+
+ H5Tclose(tid);
+ H5Aclose(atid);
+ H5Aclose(dtid);
+
+ H5Pclose(dcpl);
+ } H5E_END_TRY
+
+ return -1;
+} /* end external_link_with_committed_datatype() */
+
+
+/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
* Purpose: Check that the functionality of hard links can be duplicated
@@ -14624,6 +14899,7 @@ main(void)
nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
} /* end for */
/* These tests assume that external links are a form of UD links,
diff --git a/test/links_env.c b/test/links_env.c
index b3fec38..b9ecafa 100644
--- a/test/links_env.c
+++ b/test/links_env.c
@@ -173,11 +173,11 @@ main(void)
/* Results */
if(nerrors) {
- printf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
+ HDprintf("***** %d External Link (HDF5_EXT_PREFIX) test%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "s");
- exit(1);
+ HDexit(1);
}
- printf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
+ HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n");
/* clean up tmp directory created by external link tests */
HDrmdir(TMPDIR);
@@ -185,6 +185,6 @@ main(void)
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
return 1;
}
diff --git a/test/mf.c b/test/mf.c
index a36b1ec..e3d1845 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -5995,6 +5995,169 @@ error:
/*
+ * Test a bug that occurs when an allocator with zero size left and an unaligned
+ * endpoint is extended to allocate an aligned object
+ */
+static unsigned
+test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
+{
+ hid_t file = -1; /* File ID */
+ hid_t copied_fapl = -1; /* FAPL to use for this test */
+ char filename[FILENAME_LEN]; /* Filename to use */
+ H5F_t *f = NULL; /* Internal file object pointer */
+ H5FD_mem_t type;
+ haddr_t addr1, addr2;
+ hsize_t block_size;
+ hsize_t align;
+ hbool_t split = FALSE, multi = FALSE;
+
+ TESTING("H5MF_alloc() bug 1");
+
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Copy fapl */
+ if((copied_fapl = H5Pcopy(fapl)) < 0)
+ TEST_ERROR
+
+ /* Get metadata block size */
+ if(H5Pget_meta_block_size(copied_fapl, &block_size) < 0)
+ TEST_ERROR
+
+ /* Set alignment to equal block size / 2 */
+ align = block_size / 2;
+ if(H5Pset_alignment(copied_fapl, 0, align) < 0)
+ TEST_ERROR
+
+ /* Check for split or multi driver */
+ if(!HDstrcmp(env_h5_drvr, "split"))
+ split = TRUE;
+ else if(!HDstrcmp(env_h5_drvr, "multi"))
+ multi = TRUE;
+
+ /* Add alignment to member files for split/multi driver */
+ if(split || multi) {
+ hid_t memb_fapl;
+
+ /* Creat fapl */
+ if((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR
+
+ /* Set alignment. Note that it is the block size of the parent FAPL that
+ * is important here. */
+ if(H5Pset_alignment(memb_fapl, 0, align) < 0)
+ TEST_ERROR
+
+ if(split) {
+ /* Set split driver with new FAPLs */
+ if(H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
+ hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
+ char *memb_name[H5FD_MEM_NTYPES];
+ haddr_t memb_addr[H5FD_MEM_NTYPES];
+ hbool_t relax;
+ H5FD_mem_t mt;
+
+ /* Get current multi settings */
+ HDmemset(memb_name, 0, sizeof memb_name);
+ if(H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0)
+ TEST_ERROR
+
+ /* Populate memb_fapl_arr, patch memb_addr so member file addresses
+ * are aligned */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ memb_fapl_arr[mt] = memb_fapl;
+ memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
+ } /* end for */
+
+ /* Set multi driver with new FAPLs */
+ if(H5Pset_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, (const char * const *)memb_name, memb_addr, relax) < 0)
+ TEST_ERROR
+
+ /* Free memb_name */
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ free(memb_name[mt]);
+ } /* end else */
+
+ /* Close memb_fapl */
+ if(H5Pclose(memb_fapl) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Reopen the file with alignment */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0)
+ TEST_ERROR
+
+ /* Get a pointer to the internal file object */
+ if(NULL == (f = (H5F_t *)H5I_object(file)))
+ TEST_ERROR
+
+ /* Allocate a block of size align from meta_aggr. This should create an
+ * aggregator that extends to the end of the file, with
+ * block_size / 2 bytes remaining, and the end of the file aligned */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, align);
+
+ /* Verify that the allocated block is aligned */
+ if(addr1 % align) TEST_ERROR
+
+ /* Allocate a block of size align from meta_aggr. This should force the
+ * aggregator to extend to the end of the file, with 0 bytes remaining, and
+ * the end of the file aligned */
+ type = H5FD_MEM_SUPER;
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, align);
+
+ /* Verify that the allocated block is aligned */
+ if(addr2 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed align after the previous */
+ if((addr2 - addr1) != align) TEST_ERROR
+
+ /* Allocate a block of size block_size + 1 from meta_aggr. This should
+ * force the aggregator to extend to the end of the file, with 0 bytes
+ * remaining, and the end of the file unaligned */
+ type = H5FD_MEM_SUPER;
+ addr1 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, block_size + (hsize_t)1);
+
+ /* Verify that the allocated block is aligned */
+ if(addr1 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed block_size / 2 after the
+ * previous */
+ if((addr1 - addr2) != align) TEST_ERROR
+
+ /* Allocate a block of size 1. This should extend the aggregator from
+ * the previous allocation, and align the new block */
+ type = H5FD_MEM_SUPER;
+ addr2 = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)1);
+
+ /* Verify that the allocated block is aligned */
+ if(addr2 % align) TEST_ERROR
+
+ /* Verify that the allocated block is placed 3 * (block_size / 2) after
+ * the previous */
+ if((addr2 - addr1) != (3 * align)) TEST_ERROR
+
+ PASSED()
+
+ /* Close file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+
+ return(0);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(file);
+ } H5E_END_TRY;
+ return(1);
+} /* test_mf_bug1() */
+
+
+/*
* Verify that the file's free-space manager persists where there are free sections in the manager
*/
static unsigned
@@ -7502,32 +7665,32 @@ main(void)
/* Tests for alignment */
for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
- switch(curr_test) {
+ switch(curr_test) {
case TEST_NORMAL: /* set alignment = 1024 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
- TEST_ERROR
+ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0)
+ TEST_ERROR
break;
case TEST_AGGR_SMALL: /* set alignment = 4096 */
- if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
- TEST_ERROR
+ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN4096) < 0)
+ TEST_ERROR
break;
case TEST_NTESTS:
default:
TEST_ERROR;
- break;
- } /* end switch */
-
- nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl);
- nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
- } /* end if */
+ break;
+ } /* end switch */
+
+ nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl);
+ nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl);
+ } /* end for */
/* tests to verify that file's free-space managers are persistent */
nerrors += test_mf_fs_drivers(fapl);
@@ -7535,6 +7698,9 @@ main(void)
/* tests for file space management */
nerrors += test_filespace_drivers(fapl);
+ /* tests for specific bugs */
+ nerrors += test_mf_bug1(env_h5_drvr, fapl);
+
if(H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
h5_cleanup(FILENAME, fapl);
diff --git a/test/mtime.c b/test/mtime.c
index 0c0c923..88ed31c 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -114,7 +114,7 @@ main(void)
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
H5_FAILED();
tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
diff --git a/test/objcopy.c b/test/objcopy.c
index 1c95dc7..f4b1561 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -20,8 +20,7 @@
* Purpose: Test H5Ocopy().
*/
-#include <time.h>
-#include "h5test.h"
+#include "testhdf5.h"
#include "H5srcdir.h"
/*
@@ -166,6 +165,13 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
static int
compare_idx_type(hid_t fapl, hid_t did, H5D_chunk_index_t new_type, H5D_chunk_index_t old_type);
+static int
+test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl);
+static int
+attach_attribute_compound_vlstr(hid_t loc_id);
+static int
+compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
+
/*-------------------------------------------------------------------------
* Function: addr_insert
@@ -545,6 +551,7 @@ done:
return ret_value;
} /* end of attach_attribute_vl */
+
/*-------------------------------------------------------------------------
* Function: test_copy_attach_attributes
@@ -5528,6 +5535,312 @@ error:
return 1;
} /* end test_copy_dataset_simple_empty */
+/*-------------------------------------------------------------------------
+ * Function: attach_attribute_compound_vlstr
+ *
+ * Purpose: Attach a compound datatype with a variable length string to the object
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Aug 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+attach_attribute_compound_vlstr(hid_t loc_id)
+{
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t vl_str_tid = -1; /* Variable length string datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hsize_t dim1 = 1; /* Dimension size */
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ s1 buf; /* Buffer */
+ int ret_value = -1; /* Return value */
+
+ /* Create dataspace */
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ goto done;
+
+ /* Create an integer datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto done;
+
+ /* Create a variable length string */
+ if((vl_str_tid = H5Tcopy(H5T_C_S1)) < 0)
+ goto done;
+ if(H5Tset_size(vl_str_tid, H5T_VARIABLE) < 0)
+ goto done;
+
+ /* Create a compound datatype with a variable length string and an integer */
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0)
+ goto done;
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid) < 0)
+ goto done;
+ if(H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid) < 0)
+ goto done;
+
+ /* Attach an attribute to the object */
+ if((aid = H5Acreate2(loc_id, "attr_cmpd_vlstr", cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto done;
+
+ /* Write to the attribute */
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+ if(H5Awrite(aid, cmpd_tid, &buf) < 0)
+ goto done;
+
+ ret_value = 0;
+
+done:
+ if(sid > 0)
+ H5Sclose(sid);
+ if(tid > 0)
+ H5Tclose(tid);
+ if(vl_str_tid > 0)
+ H5Tclose(vl_str_tid);
+ if(cmpd_tid > 0)
+ H5Tclose(cmpd_tid);
+ if(aid > 0)
+ H5Aclose(aid);
+ return ret_value;
+} /* attach_attribute_compound_vlstr */
+
+/*-------------------------------------------------------------------------
+ * Function: compare_attribute_compound_vlstr
+ *
+ * Purpose: Compare data of the attributes attached to the two objects.
+ * The attribute is a compound datatype with a variable length string.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; Aug 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
+{
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ s1 rbuf; /* Buffer for data read */
+ s1 rbuf2; /* Buffer for data read */
+
+ /* Open the attributes attached to the objects */
+ if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if((aid2 = H5Aopen_by_idx(loc2, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Get the attributes' datatypes */
+ if((tid = H5Aget_type(aid)) < 0)
+ FAIL_STACK_ERROR
+ if((tid2 = H5Aget_type(aid2)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Read the attributes */
+ if(H5Aread(aid, tid, &rbuf) < 0)
+ FAIL_STACK_ERROR
+ if(H5Aread(aid2, tid2, &rbuf2) < 0)
+ FAIL_STACK_ERROR
+
+ /* Compare the attributes' data */
+ if(rbuf.i != rbuf2.i)
+ FAIL_STACK_ERROR
+ if(HDstrlen(rbuf.v) != HDstrlen(rbuf2.v))
+ FAIL_STACK_ERROR
+ if(HDmemcmp(rbuf.v, rbuf2.v, HDstrlen(rbuf.v)))
+ FAIL_STACK_ERROR
+
+ /* Close the attributes */
+ if(H5Aclose(aid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Aclose(aid2) < 0)
+ FAIL_STACK_ERROR
+ return TRUE;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid);
+ H5Aclose(aid2);
+ H5Tclose(tid);
+ H5Tclose(tid2);
+ } H5E_END_TRY;
+ return FALSE;
+
+} /* compare_attribute_compound_vlstr() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_attribute_compound_vlstr
+ *
+ * Purpose: Create a simple dataset and a group in SRC file.
+ * Both has an attribute with a compound datatype consisting
+ * of a variable length string
+ * Copy the dataset and the group to DST file
+ * This is for HDFFV-7991
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_attribute_compound_vlstr(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 sid = -1; /* Dataspace ID */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_filename[NAME_BUF_SIZE]; /* Source file name */
+ char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+
+ TESTING("H5Ocopy(): attribute with compound datatype consisting of variable length string");
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* set dataspace dimensions */
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
+
+ /* create 2D dataspace */
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0)
+ FAIL_STACK_ERROR
+
+ /* create 2D int dataset at SRC file */
+ if((did = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0)
+ FAIL_STACK_ERROR
+
+ /* attach an attribute to the dataset */
+ if(attach_attribute_compound_vlstr(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the dataset */
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* create a group */
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* attach attribute to the group */
+ if(attach_attribute_compound_vlstr(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the group */
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
+
+
+ /* open the source file with read-only */
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* copy the dataset from SRC to DST */
+ if(H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* open the src dataset */
+ if((did = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* open the destination dataset */
+ if((did2 = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* compare the data of the attributes attached to the two datasets */
+ if(compare_attribute_compound_vlstr(did, did2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the datasets */
+ if(H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ /* Copy the group */
+ if(H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ /* Open the src group */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ /* Open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* compare the data of the attributes attached to the two groups */
+ if(compare_attribute_compound_vlstr(gid, gid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the groups */
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Gclose(gid2) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0)
+ FAIL_STACK_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid2);
+ H5Aclose(aid);
+ H5Dclose(did2);
+ H5Dclose(did);
+ H5Gclose(gid);
+ H5Gclose(gid2);
+ H5Sclose(sid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_attribute_compound_vlstr() */
+
/*-------------------------------------------------------------------------
* Function: test_copy_dataset_compressed_vl
@@ -10234,7 +10547,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if((aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* write data into file */
- if(H5Awrite(aid, tid, buf) < 0) TEST_ERROR
+ //if(H5Awrite(aid, tid, buf) < 0) TEST_ERROR
/* close the datatype */
if(H5Tclose(tid) < 0) TEST_ERROR
@@ -13480,6 +13793,7 @@ main(void)
nerrors += test_copy_dataset_compact_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_compressed_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_attribute_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
+ nerrors += test_copy_attribute_compound_vlstr(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_compact_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_contig_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
nerrors += test_copy_dataset_chunked_named_vl(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
diff --git a/test/ohdr.c b/test/ohdr.c
index aa1ac85..5642c41 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -17,7 +17,6 @@
* Tuesday, November 24, 1998
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Iprivate.h"
/*
diff --git a/test/plugin.c b/test/plugin.c
index a3082d2..3086e90 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -17,8 +17,6 @@
*
* Purpose: Tests the plugin module (H5PL)
*/
-#include <stdlib.h>
-#include <time.h>
#include "h5test.h"
#include "H5srcdir.h"
@@ -33,6 +31,7 @@
#define H5Z_FILTER_DYNLIB1 257
#define H5Z_FILTER_DYNLIB2 258
#define H5Z_FILTER_DYNLIB3 259
+#define H5Z_FILTER_DYNLIB4 260
const char *FILENAME[] = {
"plugin",
@@ -44,6 +43,7 @@ const char *FILENAME[] = {
#define DSET_DEFLATE_NAME "deflate"
#define DSET_DYNLIB1_NAME "dynlib1"
#define DSET_DYNLIB2_NAME "dynlib2"
+#define DSET_DYNLIB4_NAME "dynlib4"
/* Parameters for internal filter test */
#define FILTER_CHUNK_DIM1 2
@@ -65,6 +65,7 @@ const char *FILENAME[] = {
int points_deflate[DSET_DIM1][DSET_DIM2],
points_dynlib1[DSET_DIM1][DSET_DIM2],
points_dynlib2[DSET_DIM1][DSET_DIM2],
+ points_dynlib4[DSET_DIM1][DSET_DIM2],
points_bzip2[DSET_DIM1][DSET_DIM2];
@@ -306,6 +307,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
points_dynlib1[i][j] = points[i][j];
} else if(!HDstrcmp(name, DSET_DYNLIB2_NAME)) {
points_dynlib2[i][j] = points[i][j];
+ } else if(!HDstrcmp(name, DSET_DYNLIB4_NAME)) {
+ points_dynlib4[i][j] = points[i][j];
}
}
}
@@ -344,6 +347,7 @@ test_filters_for_datasets(hid_t file)
hid_t dc; /* Dataset creation property list ID */
const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
unsigned int compress_level = 9;
+ unsigned int dynlib4_values[4];
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -402,6 +406,27 @@ test_filters_for_datasets(hid_t file)
* for this filter. */
if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) goto error;
+ /*----------------------------------------------------------
+ * STEP 4: Test DYNLIB4 by itself.
+ *----------------------------------------------------------
+ */
+ puts("Testing DYNLIB4 filter");
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
+ if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error;
+ dynlib4_values[0] = 9;
+ if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) goto error;
+ if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) goto error;
+
+ if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) goto error;
+
+ /* Clean up objects used for this test */
+ if(H5Pclose (dc) < 0) goto error;
+
+ /* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for
+ * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
+ * for this filter. */
+ if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) goto error;
+
return 0;
error:
@@ -519,6 +544,18 @@ test_read_with_filters(hid_t file)
if(H5Dclose(dset) < 0) TEST_ERROR
+ /*----------------------------------------------------------
+ * STEP 4: Test DYNLIB4 by itself.
+ *----------------------------------------------------------
+ */
+ TESTING("Testing DYNLIB4 filter");
+
+ if((dset = H5Dopen2(file,DSET_DYNLIB4_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+
+ if(test_read_data(dset, (int *)points_dynlib4) < 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
return 0;
error:
diff --git a/test/set_extent.c b/test/set_extent.c
index fd3270b..a992419 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -348,11 +348,9 @@ static int do_ranks( hid_t fapl, hbool_t new_format )
/* Iterate over different index types, but only if using the new format
*/
- for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES;
- index_type++) {
+ for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) {
/* Standard test */
- if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters,
- FALSE, index_type) < 0) {
+ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray"
diff --git a/test/tchecksum.c b/test/tchecksum.c
index cb7c023..ca6c227 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -189,7 +189,7 @@ test_chksum_large(void)
/* Initialize buffer w/known data */
for(u = 0; u < BUF_LEN; u++)
- large_buf[u] = u * 3;
+ large_buf[u] = (uint8_t)(u * 3);
/* Buffer w/real data */
chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
@@ -247,7 +247,7 @@ test_checksum(void)
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE void
+H5_ATTR_PURE H5_ATTR_CONST void
cleanup_checksum(void)
{
/* no file to clean */
diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in
index 43e76c4..1cd87e3 100644
--- a/test/test_plugin.sh.in
+++ b/test/test_plugin.sh.in
@@ -31,11 +31,11 @@ FROM_DIR=`pwd`/.libs
case $(uname) in
CYGWIN* )
PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*"
- PLUGIN_LIB2="$FROM_DIR/cygdynlib2*"
+ PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*"
;;
*)
PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*"
- PLUGIN_LIB2="$FROM_DIR/libdynlib2.*"
+ PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*"
;;
esac
PLUGIN_LIBDIR1=testdir1
diff --git a/test/testframe.c b/test/testframe.c
index 1c56f88..c2db235 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -26,7 +26,6 @@
/*
* Definitions for the testing structure.
*/
-#define MAXNUMOFTESTS 60
#define MAXTESTNAME 16
#define MAXTESTDESC 64
@@ -49,8 +48,9 @@ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */
static int Summary = 0; /* Show test summary. Default is no. */
static int CleanUp = 1; /* Do cleanup or not. Default is yes. */
static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */
-static TestStruct Test[MAXNUMOFTESTS];
-static int Index = 0;
+static TestStruct *Test = NULL; /* Array of tests */
+static unsigned TestAlloc = 0; /* Size of the Test array */
+static unsigned Index = 0;
static const void *Test_parameters = NULL;
static const char *TestProgName = NULL;
static void (*TestPrivateUsage)(void) = NULL;
@@ -74,14 +74,9 @@ void
AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), const char *TheDescr, const void *Parameters)
{
/* Sanity checking */
- if (Index >= MAXNUMOFTESTS) {
- printf("Too many tests added, increase MAXNUMOFTESTS(%d).\n",
- MAXNUMOFTESTS);
- exit(EXIT_FAILURE);
- } /* end if */
if (HDstrlen(TheDescr) >= MAXTESTDESC) {
- printf("Test description too long, increase MAXTESTDESC(%d).\n",
- MAXTESTDESC);
+ printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n",
+ TheDescr, MAXTESTDESC);
exit(EXIT_FAILURE);
} /* end if */
if (HDstrlen(TheName) >= MAXTESTNAME) {
@@ -90,9 +85,25 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con
exit(EXIT_FAILURE);
} /* end if */
+ /* Check for increasing the Test array size */
+ if(Index >= TestAlloc) {
+ TestStruct *newTest = Test; /* New array of tests */
+ unsigned newAlloc = MAX(1, TestAlloc * 2); /* New array size */
+
+ /* Reallocate array */
+ if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) {
+ printf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc);
+ exit(EXIT_FAILURE);
+ } /* end if */
+
+ /* Update info */
+ Test = newTest;
+ TestAlloc = newAlloc;
+ } /* end if */
+
/* Set up test function */
HDstrcpy(Test[Index].Description, TheDescr);
- if (*TheName != '-'){
+ if(*TheName != '-') {
HDstrcpy(Test[Index].Name, TheName);
Test[Index].SkipFlag = 0;
}
@@ -153,7 +164,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
*/
void TestUsage(void)
{
- int i;
+ unsigned i;
print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n",
TestProgName, (TestPrivateUsage ? "<extra options>" : ""));
@@ -250,7 +261,7 @@ void TestParseCmdLine(int argc, char *argv[])
else if (((HDstrcmp(*argv, "-only") == 0) ||
(HDstrcmp(*argv, "-o") == 0))) {
if(argc > 0) {
- int Loop;
+ unsigned Loop;
--argc; ++argv;
@@ -296,7 +307,7 @@ void TestParseCmdLine(int argc, char *argv[])
*/
void PerformTests(void)
{
- int Loop;
+ unsigned Loop;
for (Loop = 0; Loop < Index; Loop++)
if (Test[Loop].SkipFlag) {
@@ -329,7 +340,7 @@ void PerformTests(void)
*/
void TestSummary(void)
{
- int Loop;
+ unsigned Loop;
print_func("Summary of Test Results:\n");
print_func("Name of Test Errors Description of Test\n");
@@ -351,7 +362,7 @@ void TestSummary(void)
*/
void TestCleanup(void)
{
- int Loop;
+ unsigned Loop;
MESSAGE(2, ("\nCleaning Up temp files...\n\n"));
@@ -363,6 +374,16 @@ void TestCleanup(void)
/*
+ * Shutdown the test infrastructure
+ */
+void TestShutdown(void)
+{
+ if(Test)
+ HDfree(Test);
+}
+
+
+/*
* Retrieve the verbosity level for the testing framework
*/
H5_ATTR_PURE int GetTestVerbosity(void)
@@ -554,7 +575,7 @@ TestErrPrintf(const char *format, ...)
*/
void SetTest(const char *testname, int action)
{
- int Loop;
+ unsigned Loop;
switch (action){
case SKIPTEST:
diff --git a/test/testhdf5.c b/test/testhdf5.c
index eade815..0e7303e 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -86,6 +86,9 @@ main(int argc, char *argv[])
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
/* Exit failure if errors encountered; else exit success. */
/* No need to print anything since PerformTests() already does. */
if (GetTestNumErrs() > 0)
diff --git a/test/tfile.c b/test/tfile.c
index 74f3b86..833d2d9 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -1858,7 +1858,7 @@ test_file_open_overlap(void)
hid_t did1, did2;
hid_t gid;
hid_t sid;
- int nobjs; /* # of open objects */
+ ssize_t nobjs; /* # of open objects */
unsigned intent;
herr_t ret; /* Generic return value */
@@ -2197,8 +2197,9 @@ test_file_double_file_dataset_open(hbool_t new_format)
hsize_t max_dims1[1] = {H5S_UNLIMITED}; /* Maximum dimesion sizes for extensible array index */
hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes for v2 B-tree index */
hsize_t chunks[1] = {2}, chunks2[2] = {4, 5}; /* Chunk dimension sizes */
- char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
- char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */
+ hsize_t size; /* File size */
+ const char* data[] = {"String 1", "String 2", "String 3", "String 4", "String 5"}; /* Input Data */
+ const char* e_data[] = {"String 1", "String 2", "String 3", "String 4", "String 5", "String 6", "String 7"}; /* Input Data */
char* buffer[5]; /* Output buffer */
int wbuf[4] = {1, 2, 3, 4}; /* Input data */
herr_t ret; /* Generic return value */
@@ -2432,8 +2433,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(did1, FAIL, "H5Dopen2");
/* First file's get storage size */
- ret = H5Dget_storage_size(did1);
- CHECK(ret, FAIL, "H5Dget_storage_size");
+ size = H5Dget_storage_size(did1);
+ CHECK(size, 0, "H5Dget_storage_size");
/* Second file open */
fid2 = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -2452,8 +2453,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
CHECK(ret, FAIL, "H5Fclose");
/* Second file's get storage size */
- ret = H5Dget_storage_size(did2);
- CHECK(ret, FAIL, "H5Dget_storage_size");
+ size = H5Dget_storage_size(did2);
+ CHECK(size, 0, "H5Dget_storage_size");
/* Second file's dataset close */
ret = H5Dclose(did2);
@@ -2775,7 +2776,7 @@ test_rw_noupdate(void)
diff = HDdifftime(sb2.st_mtime, sb1.st_mtime);
/* Check That Timestamps Are Equal */
- if(diff > 0.0F) {
+ if(diff > (double)0.0F) {
/* Output message about test being performed */
MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time.\n"));
} /* end if */
@@ -2808,7 +2809,7 @@ test_rw_noupdate(void)
/* Ensure That Timestamps Are Equal */
diff = HDdifftime(sb2.st_mtime, sb1.st_mtime);
- ret = (diff > 0.0F);
+ ret = (diff > (double)0.0F);
VERIFY(ret, 0, "Timestamp");
} /* end else */
} /* end test_rw_noupdate() */
diff --git a/test/tgenprop.c b/test/tgenprop.c
index b670c0d..e6f9692 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -784,7 +784,7 @@ test_genprop_basic_list_prop(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
@@ -821,7 +821,7 @@ test_genprop_basic_list_prop(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
@@ -1241,7 +1241,7 @@ test_genprop_list_callback(void)
ret = H5Pget(lid1, PROP4_NAME,&prop4_value);
CHECK_I(ret, "H5Pget");
/* Verify the floating-poing value in this way to avoid compiler warning. */
- if(!H5_FLT_ABS_EQUAL(prop4_value,(double)*PROP4_DEF_VALUE))
+ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE))
printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n",
"H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__);
diff --git a/test/th5o.c b/test/th5o.c
index 3be5d12..125e11b 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -920,6 +920,7 @@ test_h5o_comment(void)
const char *dtype_comment = "datatype comment";
char check_comment[64];
ssize_t comment_len = 0;
+ ssize_t len;
herr_t ret; /* Value returned from API calls */
int ret_value;
@@ -1008,8 +1009,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(fid, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(fid, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(file_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1022,8 +1023,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(grp, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(grp, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(grp_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1036,8 +1037,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dtype, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(dtype, check_comment, (size_t)comment_len+1);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1050,8 +1051,8 @@ test_h5o_comment(void)
comment_len = H5Oget_comment(dset, NULL, (size_t)0);
CHECK(comment_len, FAIL, "H5Oget_comment");
- ret = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment(dset, check_comment, (size_t)comment_len+1);
+ CHECK(ret, len, "H5Oget_comment");
ret_value = HDstrcmp(dset_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment");
@@ -1092,6 +1093,7 @@ test_h5o_comment_by_name(void)
const char *dtype_comment = "datatype comment by name";
char check_comment[64];
ssize_t comment_len = 0;
+ ssize_t len;
herr_t ret; /* Value returned from API calls */
int ret_value;
@@ -1179,8 +1181,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, ".", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(file_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1193,8 +1195,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "group", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, "group", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(grp_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1203,8 +1205,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(grp, "datatype", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment");
+ len = H5Oget_comment_by_name(grp, "datatype", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment");
ret_value = HDstrcmp(dtype_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
@@ -1213,8 +1215,8 @@ test_h5o_comment_by_name(void)
comment_len = H5Oget_comment_by_name(fid, "dataset", NULL, (size_t)0, H5P_DEFAULT);
CHECK(comment_len, FAIL, "H5Oget_comment_by_name");
- ret = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ len = H5Oget_comment_by_name(fid, "dataset", check_comment, (size_t)comment_len+1, H5P_DEFAULT);
+ CHECK(len, FAIL, "H5Oget_comment_by_name");
ret_value = HDstrcmp(dset_comment, check_comment);
VERIFY(ret_value, 0, "H5Oget_comment_by_name");
diff --git a/test/th5s.c b/test/th5s.c
index a478803..664c23a 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -551,18 +551,18 @@ test_h5s_zero_dim(void)
MESSAGE(5, ("Testing Dataspace with zero dimension size\n"));
/* Initialize the data */
- for(i=0; i<SPACE1_DIM2; i++)
- for(j=0; j<SPACE1_DIM3; j++) {
- wdata[i][j] = i + j;
+ for(i = 0; i < SPACE1_DIM2; i++)
+ for(j = 0; j < SPACE1_DIM3; j++) {
+ wdata[i][j] = (int)(i + j);
rdata[i][j] = 7;
- wdata_short[i][j] = i + j;
+ wdata_short[i][j] = (short)(i + j);
rdata_short[i][j] = 7;
}
- for(i=0; i<SPACE1_DIM1; i++)
- for(j=0; j<SPACE1_DIM2; j++)
- for(k=0; k<SPACE1_DIM3; k++)
- wdata_real[i][j][k] = i + j + k;
+ for(i = 0; i < SPACE1_DIM1; i++)
+ for(j = 0; j < SPACE1_DIM2; j++)
+ for(k = 0; k < SPACE1_DIM3; k++)
+ wdata_real[i][j][k] = (int)(i + j + k);
/* Test with different space allocation times */
for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
@@ -1647,7 +1647,7 @@ test_h5s_chunk(void)
/* Initialize float array */
for(i = 0; i < 50000; i++)
for(j = 0; j < 3; j++)
- chunk_data_flt[i][j] = (float)((i + 1) * 2.5F - j * 100.3F);
+ chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F;
status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
CHECK(status, FAIL, "H5Dwrite");
@@ -1683,7 +1683,7 @@ test_h5s_chunk(void)
for(i=0; i<50000; i++) {
for(j=0; j<3; j++) {
/* Check if the two values are within 0.001% range. */
- if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], chunk_data_flt[i][j], 0.00001F))
+ if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]);
} /* end for */
} /* end for */
diff --git a/test/theap.c b/test/theap.c
index 230ec4d..2d509bf 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -31,9 +31,6 @@
2/18/03 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5HPprivate.h"
diff --git a/test/titerate.c b/test/titerate.c
index f61842a..9f0b900 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -283,7 +283,8 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test all objects in group, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Literate");
@@ -308,7 +309,8 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test all objects in group, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Literate");
@@ -462,7 +464,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test all attributes on dataset, when callback always returns 1 */
/* This also tests the "restarting" ability, because the index changes */
info.command = RET_TWO;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 2, "H5Aiterate2");
@@ -488,7 +491,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
/* Test all attributes on dataset, when callback changes return value */
/* This also tests the "restarting" ability, because the index changes */
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
- idx = i = 0;
+ i = 0;
+ idx = 0;
while((ret = H5Aiterate2(dataset, H5_INDEX_NAME, H5_ITER_INC, &idx, aiter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
VERIFY(ret, 1, "H5Aiterate2");
@@ -672,7 +676,7 @@ test_iter_group_large(hid_t fapl)
ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
CHECK(ret, FAIL, "H5Literate");
for(i = 1; i < 100; i++) {
- hsize_t idx = i;
+ hsize_t idx = (hsize_t)i;
curr_name = &names[i];
ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
diff --git a/test/tmeta.c b/test/tmeta.c
index e69c057..43fdeac 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -123,7 +123,7 @@ test_metadata(void)
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE void
+H5_ATTR_PURE H5_ATTR_CONST void
cleanup_metadata(void)
{
/* no file to clean */
diff --git a/test/trefer.c b/test/trefer.c
index cb0f44e..433239a 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -84,8 +84,8 @@ test_reference_params(void)
int i; /* counting variables */
const char *write_comment = "Foo!"; /* Comments for group */
hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
herr_t ret; /* Generic return value */
- size_t name_size; /* Size of reference name */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
@@ -120,7 +120,7 @@ test_reference_params(void)
CHECK(dataset, FAIL, "H5Dcreate2");
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3;
+ *tu32++ = (unsigned)i * 3;
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -266,6 +266,7 @@ test_reference_obj(void)
const char *write_comment="Foo!"; /* Comments for group */
char read_comment[10];
H5O_type_t obj_type; /* Object type */
+ ssize_t size; /* Comment length */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -301,7 +302,7 @@ test_reference_obj(void)
CHECK(dataset, FAIL, "H5Dcreate2");
for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++=i*3;
+ *tu32++ = (unsigned)i * 3;
/* Write selection to disk */
ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -432,8 +433,8 @@ test_reference_obj(void)
CHECK(group, FAIL, "H5Rdereference2");
/* Get group's comment */
- ret = H5Oget_comment(group, read_comment, (size_t)10);
- CHECK(ret, FAIL, "H5Oget_comment");
+ size = H5Oget_comment(group, read_comment, (size_t)10);
+ CHECK(size, FAIL, "H5Oget_comment");
/* Check for correct comment value */
if(HDstrcmp(write_comment, read_comment) != 0)
@@ -557,7 +558,7 @@ test_reference_region(void)
CHECK(dset2, FAIL, "H5Dcreate2");
for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
- *tu8++ = i * 3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -762,7 +763,7 @@ test_reference_region(void)
VERIFY(ret, 36, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -790,7 +791,7 @@ test_reference_region(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -945,7 +946,7 @@ test_reference_region_1D(void)
CHECK(dset3, FAIL, "H5Dcreate2");
for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
- *tu8++ = i * 3;
+ *tu8++ = (uint8_t)(i * 3);
/* Write selection to disk */
ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -1068,7 +1069,7 @@ test_reference_region_1D(void)
VERIFY(ret, 30, "H5Sget_select_npoints");
ret = (int)H5Sget_select_hyper_nblocks(sid3);
VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -1120,7 +1121,7 @@ test_reference_region_1D(void)
VERIFY(ret, 10, "H5Sget_select_npoints");
ret = (int)H5Sget_select_elem_npoints(sid3);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc(ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY(coords[0], coord1[0][0], "Element Coordinates");
@@ -1329,6 +1330,7 @@ test_reference_group(void)
char objname[NAME_SIZE]; /* Buffer to store name */
H5O_info_t oinfo; /* Object info struct */
int count = 0; /* Count within iterated group */
+ ssize_t size; /* Name length */
herr_t ret;
/* Create file with a group and a dataset containing an object reference to the group */
@@ -1409,8 +1411,8 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gget_info");
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
- ret = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_name_by_idx");
+ size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Lget_name_by_idx");
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT);
diff --git a/test/tselect.c b/test/tselect.c
index 73b8015..9230d8b 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -720,7 +720,7 @@ test_select_all(hid_t xfer_plist)
for(i=0, tbuf=wbuf; i<SPACE4_DIM1; i++)
for(j=0; j<SPACE4_DIM2; j++)
for(k=0; k<SPACE4_DIM3; k++)
- *tbuf++ = (uint8_t)(((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k;
+ *tbuf++ = (uint8_t)((((i * SPACE4_DIM2) + j) * SPACE4_DIM3) + k);
/* Create file */
fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -7188,8 +7188,8 @@ test_select_fill_point(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_points; u++) {
- points[u][0] = (hsize_t)(points[u][0] + real_offset[0]);
- points[u][1] = (hsize_t)(points[u][1] + real_offset[1]);
+ points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
+ points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7269,8 +7269,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Verify memory buffer the hard way... */
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
- if((u >= (unsigned)(start[0] + real_offset[0]) && u < (unsigned)(start[0] + count[0] + real_offset[0]))
- && (v >= (unsigned)(start[1] + real_offset[1]) && v < (unsigned)(start[1] + count[1] + real_offset[1]))) {
+ if((u >= (unsigned)((hssize_t)start[0] + real_offset[0]) && u < (unsigned)((hssize_t)(start[0] + count[0]) + real_offset[0]))
+ && (v >= (unsigned)((hssize_t)start[1] + real_offset[1]) && v < (unsigned)((hssize_t)(start[1] + count[1]) + real_offset[1]))) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
} /* end if */
@@ -7288,8 +7288,8 @@ test_select_fill_hyper_simple(hssize_t *offset)
/* Set the coordinates of the selection (with the offset) */
for(u = 0, num_points = 0; u < (unsigned)count[0]; u++)
for(v = 0; v < (unsigned)count[1]; v++, num_points++) {
- points[num_points][0] = (hsize_t)(u + start[0] + real_offset[0]);
- points[num_points][1] = (hsize_t)(v + start[1] + real_offset[1]);
+ points[num_points][0] = (hsize_t)((hssize_t)(u + start[0]) + real_offset[0]);
+ points[num_points][1] = (hsize_t)((hssize_t)(v + start[1]) + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7379,7 +7379,7 @@ test_select_fill_hyper_regular(hssize_t *offset)
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) {
+ if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
break;
@@ -7396,8 +7396,8 @@ test_select_fill_hyper_regular(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_points; u++) {
- points[u][0] = (hsize_t)(points[u][0] + real_offset[0]);
- points[u][1] = (hsize_t)(points[u][1] + real_offset[1]);
+ points[u][0] = (hsize_t)((hssize_t)points[u][0] + real_offset[0]);
+ points[u][1] = (hsize_t)((hssize_t)points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -7502,7 +7502,7 @@ test_select_fill_hyper_irregular(hssize_t *offset)
for(u = 0, tbuf = wbuf; u < SPACE7_DIM1; u++)
for(v = 0; v < SPACE7_DIM2; v++, tbuf++) {
for(w = 0; w < (unsigned)num_points; w++) {
- if(u == (unsigned)(points[w][0] + real_offset[0]) && v == (unsigned)(points[w][1] + real_offset[1])) {
+ if(u == (unsigned)((hssize_t)points[w][0] + real_offset[0]) && v == (unsigned)((hssize_t)points[w][1] + real_offset[1])) {
if(*tbuf != (unsigned)fill_value)
TestErrPrintf("Error! v=%u, u=%u, *tbuf=%u, fill_value=%u\n", v, u, *tbuf, (unsigned)fill_value);
break;
@@ -7519,8 +7519,8 @@ test_select_fill_hyper_irregular(hssize_t *offset)
/* Add in the offset */
for(u = 0; u < (unsigned)num_iter_points; u++) {
- iter_points[u][0] = (hsize_t)(iter_points[u][0] + real_offset[0]);
- iter_points[u][1] = (hsize_t)(iter_points[u][1] + real_offset[1]);
+ iter_points[u][0] = (hsize_t)((hssize_t)iter_points[u][0] + real_offset[0]);
+ iter_points[u][1] = (hsize_t)((hssize_t)iter_points[u][1] + real_offset[1]);
} /* end for */
/* Iterate through selection, verifying correct data */
@@ -13652,9 +13652,9 @@ test_hyper_unlim(void)
VERIFY(start2[0], start[0], "H5Sget_select_bounds");
VERIFY(start2[1], start[1], "H5Sget_select_bounds");
VERIFY(start2[2], start[2], "H5Sget_select_bounds");
- VERIFY(count2[0], start[0] + (stride[0] * (count[0] - (hsize_t)1)) + block[0] - (hsize_t)1, "H5Sget_select_bounds");
+ VERIFY(count2[0], (long)(start[0] + (stride[0] * (count[0] - 1)) + block[0] - 1), "H5Sget_select_bounds");
VERIFY(count2[1], H5S_UNLIMITED, "H5Sget_select_bounds");
- VERIFY(count2[2], start[2] + (stride[2] * (count[2] - (hsize_t)1)) + block[2] - (hsize_t)1, "H5Sget_select_bounds");
+ VERIFY(count2[2], (long)(start[2] + (stride[2] * (count[2] - 1)) + block[2] - 1), "H5Sget_select_bounds");
/* Close the dataspace */
ret = H5Sclose(sid);
diff --git a/test/tskiplist.c b/test/tskiplist.c
index 62c5f8e..f413674 100644
--- a/test/tskiplist.c
+++ b/test/tskiplist.c
@@ -31,9 +31,6 @@
11/15/04 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5SLprivate.h"
diff --git a/test/tsohm.c b/test/tsohm.c
index b3ffac7..9d56fcc 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -1681,8 +1681,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create a unique name and value for each attribute */
- attr_string1[0] = attr_name[0] = (x / 10) + '0';
- attr_string1[1] = attr_name[1] = (x % 10) + '0';
+ attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
/* Create an attribute on the group */
attr_id = H5Acreate2(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1721,8 +1721,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
for(x=0; x<NUM_ATTRIBUTES; ++x)
{
/* Create the same name and value for each attribute as before */
- attr_string1[0] = attr_name[0] = (x / 10) + '0';
- attr_string1[1] = attr_name[1] = (x % 10) + '0';
+ attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
/* Create an attribute on the group */
attr_id = H5Acreate2(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT);
@@ -1940,8 +1940,8 @@ static void size2_verify(void)
for(x = 0; x < NUM_ATTRIBUTES; ++x) {
/* Create the name and correct value for each attribute */
- attr_correct_string[0] = attr_name[0] = (x / 10) + '0';
- attr_correct_string[1] = attr_name[1] = (x % 10) + '0';
+ attr_correct_string[0] = attr_name[0] = (char)((x / 10) + '0');
+ attr_correct_string[1] = attr_name[1] = (char)((x % 10) + '0');
attr1_id = H5Aopen(group1_id, attr_name, H5P_DEFAULT);
CHECK_I(attr1_id, "H5Aopen");
@@ -2197,7 +2197,7 @@ static void test_sohm_size2(int close_reopen)
/* The files with indexes shouldn't be that much bigger than an
* empty file.
*/
- if(list_index_med.empty_size > norm_sizes.empty_size * OVERHEAD_ALLOWED)
+ if(list_index_med.empty_size > (h5_stat_size_t)((float)norm_sizes.empty_size * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
@@ -2258,7 +2258,7 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.dsets2 >= btree_index.dsets2)
VERIFY(list_index_med.dsets2, 1, "h5_get_file_size");
- if(btree_index.dsets2 > list_index_small.dsets2 * OVERHEAD_ALLOWED)
+ if(btree_index.dsets2 > (h5_stat_size_t)((float)list_index_small.dsets2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.dsets2, list_index_small.dsets2, "h5_get_file_size");
if(list_index_small.dsets2 >= norm_sizes.dsets2)
VERIFY(btree_index.dsets2, 1, "h5_get_file_size");
@@ -2267,7 +2267,7 @@ static void test_sohm_size2(int close_reopen)
* It seems that the small lists tends to be pretty big anyway. Allow
* for it to have twice as much overhead.
*/
- if(list_index_small.dsets2 > btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED)
+ if(list_index_small.dsets2 > (h5_stat_size_t)((float)btree_index.dsets2 * OVERHEAD_ALLOWED * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The lists should have grown the least since they share messages and
* have no extra overhead. The normal file should have grown more than
@@ -2291,7 +2291,7 @@ static void test_sohm_size2(int close_reopen)
*/
if(list_index_med.interleaved >= btree_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.interleaved > list_index_small.interleaved * OVERHEAD_ALLOWED)
+ if(btree_index.interleaved > (h5_stat_size_t)((float)list_index_small.interleaved * OVERHEAD_ALLOWED))
VERIFY(btree_index.interleaved, list_index_small.interleaved, "h5_get_file_size");
if(list_index_small.interleaved >= norm_sizes.interleaved)
VERIFY(0, 1, "h5_get_file_size");
@@ -2318,22 +2318,21 @@ static void test_sohm_size2(int close_reopen)
* that started as a B-tree.
* Add in OVERHEAD_ALLOWED as a fudge factor here, since the allocation
* of file space can be hard to predict.
-
*/
- if(btree_index.attrs1 > list_index_small.attrs1 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_small.attrs1 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs1, list_index_small.attrs1, "h5_get_file_size");
- if(btree_index.attrs1 > list_index_med.attrs1 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs1 > (h5_stat_size_t)((float)list_index_med.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_small.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* Neither of the converted lists should be too much bigger than
* the index that was originally a B-tree.
*/
- if(list_index_small.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs1 > btree_index.attrs1 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs1 > (h5_stat_size_t)((float)btree_index.attrs1 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The "normal" file should have had less overhead, so should gain less
* size than any of the other indexes since none of these attribute
@@ -2349,7 +2348,7 @@ static void test_sohm_size2(int close_reopen)
/* Give it some overhead (for checkin to move messages into continuation message) */
if((list_index_small.attrs1 - list_index_small.interleaved) >
- ((btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
+ (h5_stat_size_t)((float)(btree_index.attrs1 - btree_index.interleaved) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
@@ -2357,13 +2356,13 @@ static void test_sohm_size2(int close_reopen)
* of sizes. The big list index is still too big to be smaller than a
* normal file. The B-tree indexes should all be about the same size.
*/
- if(btree_index.attrs2 > list_index_small.attrs2 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_small.attrs2 * OVERHEAD_ALLOWED))
VERIFY(btree_index.attrs2, list_index_small.attrs2, "h5_get_file_size");
- if(list_index_small.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED)
+ if(list_index_small.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(btree_index.attrs2 > list_index_med.attrs2 * OVERHEAD_ALLOWED)
+ if(btree_index.attrs2 > (h5_stat_size_t)((float)list_index_med.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
- if(list_index_med.attrs2 > btree_index.attrs2 * OVERHEAD_ALLOWED)
+ if(list_index_med.attrs2 > (h5_stat_size_t)((float)btree_index.attrs2 * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if(list_index_med.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
@@ -2451,17 +2450,17 @@ static void test_sohm_size2(int close_reopen)
VERIFY((mult_index_btree.dsets1 - mult_index_btree.second_dset), (btree_index.dsets1 - btree_index.second_dset), "h5_get_file_size");
if((mult_index_med.dsets2 - mult_index_med.dsets1) >
- (list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.dsets2 - list_index_med.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.dsets2 - mult_index_btree.dsets1) >
- (btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.dsets2 - btree_index.dsets1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_med.interleaved - mult_index_med.dsets2) >
- (list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.interleaved - list_index_med.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.interleaved - mult_index_btree.dsets2) >
- (btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.interleaved - btree_index.dsets2) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* When all the attributes are added, only the index holding attributes
@@ -2470,10 +2469,10 @@ static void test_sohm_size2(int close_reopen)
* will take.
*/
if((mult_index_med.attrs2 - mult_index_med.attrs1) >
- (list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
if((mult_index_btree.attrs2 - mult_index_btree.attrs1) >
- (btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED)
+ (h5_stat_size_t)((float)(btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED))
VERIFY(0, 1, "h5_get_file_size");
/* The final file size for both of the multiple index files should be
@@ -2483,9 +2482,9 @@ static void test_sohm_size2(int close_reopen)
VERIFY(0, 1, "h5_get_file_size");
if(mult_index_btree.attrs2 >= norm_sizes.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_med.attrs2 * OVERHEAD_ALLOWED < btree_index.attrs2)
+ if((h5_stat_size_t)((float)mult_index_med.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(mult_index_btree.attrs2 * OVERHEAD_ALLOWED < btree_index.attrs2)
+ if((h5_stat_size_t)((float)mult_index_btree.attrs2 * OVERHEAD_ALLOWED) < btree_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
@@ -2554,39 +2553,39 @@ static void test_sohm_size2(int close_reopen)
if(share_tiny_index.empty_size != type_space_index.empty_size)
VERIFY(share_tiny_index.empty_size, type_space_index.empty_size, "h5_get_file_size");
- if(share_tiny_index.first_dset >= type_space_index.first_dset * OVERHEAD_ALLOWED)
+ if(share_tiny_index.first_dset >= (h5_stat_size_t)((float)type_space_index.first_dset * OVERHEAD_ALLOWED))
VERIFY(share_tiny_index.first_dset, type_space_index.first_dset, "h5_get_file_size");
if(share_tiny_index.first_dset < type_space_index.first_dset)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.second_dset >= type_space_index.second_dset)
VERIFY(share_tiny_index.second_dset, type_space_index.second_dset, "h5_get_file_size");
- if(share_tiny_index.second_dset * OVERHEAD_ALLOWED < type_space_index.second_dset)
+ if((h5_stat_size_t)((float)share_tiny_index.second_dset * OVERHEAD_ALLOWED) < type_space_index.second_dset)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.dsets1 >= type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets1 * OVERHEAD_ALLOWED < type_space_index.dsets1)
+ if((h5_stat_size_t)((float)share_tiny_index.dsets1 * OVERHEAD_ALLOWED) < type_space_index.dsets1)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.dsets2 >= type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.dsets2 * OVERHEAD_ALLOWED < type_space_index.dsets2)
+ if((h5_stat_size_t)((float)share_tiny_index.dsets2 * OVERHEAD_ALLOWED) < type_space_index.dsets2)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.interleaved >= type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.interleaved * OVERHEAD_ALLOWED < type_space_index.interleaved)
+ if((h5_stat_size_t)((float)share_tiny_index.interleaved * OVERHEAD_ALLOWED) < type_space_index.interleaved)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.attrs1 >= type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs1 * OVERHEAD_ALLOWED < type_space_index.attrs1)
+ if((h5_stat_size_t)((float)share_tiny_index.attrs1 * OVERHEAD_ALLOWED) < type_space_index.attrs1)
VERIFY(0, 1, "h5_get_file_size");
if(share_tiny_index.attrs2 >= type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
- if(share_tiny_index.attrs2 * OVERHEAD_ALLOWED < type_space_index.attrs2)
+ if((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
} /* end test_sohm_size2() */
@@ -2616,7 +2615,7 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id,
CHECK_I(dset_id, "H5Dcreate2");
/* Write data to dataset */
- wdata = x + 'a';
+ wdata = (char)(x + 'a');
ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata);
CHECK_I(ret, "H5Dwrite");
@@ -2764,9 +2763,9 @@ static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
deleted_filesize = h5_get_file_size(FILENAME, H5P_DEFAULT);
/* The two filesizes should be almost the same */
- if(norm_filesize > deleted_filesize * OVERHEAD_ALLOWED)
+ if(norm_filesize > (h5_stat_size_t)((float)deleted_filesize * OVERHEAD_ALLOWED))
VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size");
- if(deleted_filesize > norm_filesize * OVERHEAD_ALLOWED)
+ if(deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED))
VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size");
}
@@ -3887,8 +3886,8 @@ test_sohm_external_dtype(void)
orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t));
for(i=0; i<NX*NY; i++) {
s_ptr = (s1_t*)orig + i;
- s_ptr->a = i*3 + 1;
- s_ptr->b = i*3 + 2;
+ s_ptr->a = (int)(i * 3 + 1);
+ s_ptr->b = (int)(i * 3 + 2);
}
/* Write the data to the dataset1 */
diff --git a/test/ttsafe.c b/test/ttsafe.c
index 1fb9446..bfd24ba 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -143,6 +143,9 @@ int main(int argc, char *argv[])
if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
TestCleanup();
+ /* Release test infrastructure */
+ TestShutdown();
+
return GetTestNumErrs();
} /* end main() */
diff --git a/test/ttst.c b/test/ttst.c
index b869b63..a7c43a2 100644
--- a/test/ttst.c
+++ b/test/ttst.c
@@ -33,9 +33,6 @@
12/9/02 - Started coding
*/
-#include <time.h>
-#include <stdlib.h>
-
#include "testhdf5.h"
#include "H5STprivate.h"
@@ -126,7 +123,7 @@ test_tst_init(void)
curr_time=HDtime(NULL);
HDsrandom((unsigned)curr_time);
for(u=0; u<num_uniq_words; u++) {
- v=u+(HDrandom()%(num_uniq_words-u));
+ v = u + ((size_t)HDrandom() % (num_uniq_words - u));
if(u!=v) {
tmp_word=rand_uniq_words[u];
rand_uniq_words[u]=rand_uniq_words[v];
diff --git a/test/tunicode.c b/test/tunicode.c
index 93c00c5..2bba9ae 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -14,10 +14,6 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Unicode test */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
#include "testhdf5.h"
#define NUM_CHARS 16
@@ -388,6 +384,7 @@ void test_objnames(hid_t fid, const char* string)
char path_buf[MAX_PATH_LENGTH];
hsize_t dims=1;
hobj_ref_t obj_ref;
+ ssize_t size;
herr_t ret;
/* Create a group with a UTF-8 name */
@@ -399,8 +396,8 @@ void test_objnames(hid_t fid, const char* string)
*/
ret = H5Oset_comment_by_name(fid, string, string, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oset_comment_by_name");
- ret = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_comment_by_name");
+ size = H5Oget_comment_by_name(fid, string, read_buf, (size_t)MAX_STRING_LENGTH, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Oget_comment_by_name");
ret = H5Gclose(grp_id);
CHECK(ret, FAIL, "H5Gclose");
@@ -514,6 +511,7 @@ void test_attrname(hid_t fid, const char * string)
hid_t dtype_id, space_id;
hsize_t dims=1;
char read_buf[MAX_STRING_LENGTH];
+ ssize_t size;
herr_t ret;
/* Create a new group and give it an attribute whose
@@ -532,8 +530,8 @@ void test_attrname(hid_t fid, const char * string)
/* Create the attribute and check that its name is correct */
attr_id = H5Acreate2(group_id, string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
- ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
- CHECK(ret, FAIL, "H5Aget_name");
+ size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
+ CHECK(size, FAIL, "H5Aget_name");
ret = strcmp(read_buf, string);
VERIFY(ret, 0, "strcmp");
read_buf[0] = '\0';
@@ -744,25 +742,25 @@ static hid_t mkstr(size_t len, H5T_str_t strpad)
unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos)
{
if (c < 0x80) {
- test_string[cur_pos] = c;
+ test_string[cur_pos] = (char)c;
cur_pos++;
}
else if (c < 0x800) {
- test_string[cur_pos] = (0xC0 | c>>6);
- test_string[cur_pos+1] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xC0 | c >> 6);
+ test_string[cur_pos + 1] = (char)(0x80 | (c & 0x3F));
cur_pos += 2;
}
else if (c < 0x10000) {
- test_string[cur_pos] = (0xE0 | c>>12);
- test_string[cur_pos+1] = (0x80 | (c>>6 & 0x3F));
- test_string[cur_pos+2] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xE0 | c >> 12);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c & 0x3F));
cur_pos += 3;
}
else if (c < 0x200000) {
- test_string[cur_pos] = (0xF0 | c>>18);
- test_string[cur_pos+1] = (0x80 | (c>>12 & 0x3F));
- test_string[cur_pos+2] = (0x80 | (c>>6 & 0x3F));
- test_string[cur_pos+3] = (0x80 | (c & 0x3F));
+ test_string[cur_pos] = (char)(0xF0 | c >> 18);
+ test_string[cur_pos + 1] = (char)(0x80 | (c >> 12 & 0x3F));
+ test_string[cur_pos + 2] = (char)(0x80 | (c >> 6 & 0x3F));
+ test_string[cur_pos + 3] = (char)(0x80 | (c & 0x3F));
cur_pos += 4;
}
@@ -775,13 +773,13 @@ unsigned int write_char(unsigned int c, char * test_string, unsigned int cur_pos
* could confuse printf (e.g., '\n'). */
void dump_string(const char * string)
{
- unsigned int length;
- unsigned int x;
+ size_t length;
+ size_t x;
printf("The string was:\n %s", string);
printf("Or in hex:\n");
- length = strlen(string);
+ length = HDstrlen(string);
for(x=0; x<length; x++)
printf("%x ", string[x] & (0x000000FF));
@@ -814,7 +812,7 @@ void test_unicode(void)
/* We need to avoid unprintable characters (codes 0-31) and the
* . and / characters, since they aren't allowed in path names.
*/
- unicode_point = (HDrandom() % (MAX_CODE_POINT-32)) + 32;
+ unicode_point = (unsigned)(HDrandom() % (MAX_CODE_POINT-32)) + 32;
if(unicode_point != 46 && unicode_point != 47)
cur_pos = write_char(unicode_point, test_string, cur_pos);
}
diff --git a/test/tvltypes.c b/test/tvltypes.c
index b7bbaee..f8a6a91 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -169,7 +169,7 @@ static void
test_vltypes_funcs(void)
{
hid_t type; /* Datatype ID */
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_norm_t norm;
H5T_cset_t cset;
@@ -183,16 +183,16 @@ test_vltypes_funcs(void)
type = H5Tvlen_create (H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
- size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ size = H5Tget_precision(type);
+ CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ size = H5Tget_size(type);
+ CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ size = H5Tget_ebias(type);
+ CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
inpad = H5Tget_inpad(type);
@@ -558,7 +558,7 @@ rewrite_vltypes_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -730,8 +730,8 @@ test_vltypes_vlen_compound(void)
wdata[i].p=HDmalloc((i+1)*sizeof(s1));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -865,7 +865,7 @@ rewrite_vltypes_vlen_compound(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -876,8 +876,8 @@ rewrite_vltypes_vlen_compound(void)
wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
for(j = 0; j < (i + increment); j++) {
- ((s1 *)wdata[i].p)[j].i = i * 40 + j;
- ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -1016,17 +1016,17 @@ test_vltypes_compound_vlen_vlen(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE3_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
- wdata[i].v.len=i+L1_INCM;
- for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
- t1->len=j+L2_INCM;
- for(k=0; k<j+L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
- }
+ for(i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ wdata[i].v.len = i + L1_INCM;
+ for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ t1->len = j + L2_INCM;
+ for(k = 0; k < j + L2_INCM; k++)
+ ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k;
+ } /* end for */
} /* end for */
/* Create file */
@@ -1477,13 +1477,13 @@ test_vltypes_compound_vlen_atomic(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int));
+ wdata[i].v.len = i + 1;
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -1688,7 +1688,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1696,8 +1696,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = i * 40;
- wdata[i].f = (float)((i * 50) / 3.0F);
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
for(j = 0; j < (i + increment); j++)
@@ -1960,7 +1960,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1969,7 +1969,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2048,7 +2048,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2224,7 +2224,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2316,7 +2316,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
@@ -2325,7 +2325,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2597,6 +2597,10 @@ test_vltypes_fill_value(void)
}
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2700,6 +2704,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2897,6 +2905,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
diff --git a/test/unlink.c b/test/unlink.c
index 7169365..9222596 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -25,7 +25,6 @@
/* Define this macro to indicate that the testing APIs should be available */
#define H5G_TESTING
-#include <time.h>
#include "h5test.h"
#include "H5Gpkg.h" /* Groups */
diff --git a/test/vds.c b/test/vds.c
index 50523f0..2fd492a 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -19,7 +19,6 @@
* Purpose: Tests datasets with virtual layout.
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Dprivate.h" /* For H5D_VIRTUAL_DEF_LIST_SIZE */
typedef enum {
diff --git a/test/vfd.c b/test/vfd.c
index 708474c..c19e0d0 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -27,8 +27,13 @@
#define FAMILY_SIZE (1*KB)
#define FAMILY_SIZE2 (5*KB)
#define MULTI_SIZE 128
+
#define CORE_INCREMENT (4*KB)
-#define CORE_PAGE_SIZE (1024 * 1024)
+#define CORE_PAGE_SIZE (1024*KB)
+#define CORE_DSET_NAME "core dset"
+#define CORE_DSET_DIM1 1024
+#define CORE_DSET_DIM2 32
+
#define DSET1_NAME "dset1"
#define DSET1_DIM1 1024
#define DSET1_DIM2 32
@@ -80,68 +85,76 @@ const char *FILENAME[] = {
static herr_t
test_sec2(void)
{
- hid_t file = -1;
- hid_t fapl = -1;
- hid_t access_fapl = -1;
- char filename[1024];
- int *fhandle = NULL;
- hsize_t file_size = 0;
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ char filename[1024]; /* filename */
+ void *os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
TESTING("SEC2 file driver");
- h5_reset();
-
/* Set property list and file name for SEC2 driver. */
- fapl = h5_fileaccess();
- if(H5Pset_fapl_sec2(fapl) < 0)
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if(H5Pset_fapl_sec2(fapl_id) < 0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if((access_fapl = H5Fget_access_plist(file)) < 0)
+ if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_SEC2 != H5Pget_driver(access_fapl))
+ if(H5FD_SEC2 != H5Pget_driver(fapl_id_out))
TEST_ERROR;
/* ...and close the property list */
- if(H5Pclose(access_fapl) < 0)
+ if(H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- /* Check file handle API */
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
- TEST_ERROR;
- if(*fhandle < 0)
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
+ */
+ if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if(os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
- TEST_ERROR;
- /* There is no guarantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. It's 2KB right now.
+ /* There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * Currently it should be around 2 KB.
*/
+ if(H5Fget_filesize(fid, &file_size) < 0)
+ TEST_ERROR;
if(file_size < 1 * KB || file_size > 4 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
+
+ /* Close and delete the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[0], fapl_id);
- if(H5Fclose(file) < 0)
+ /* Close the fapl */
+ if(H5Pclose(fapl_id) < 0)
TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(file);
+ H5Pclose(fapl_id);
+ H5Pclose(fapl_id_out);
+ H5Fclose(fid);
} H5E_END_TRY;
return -1;
-}
+} /* end test_sec2() */
/*-------------------------------------------------------------------------
@@ -160,218 +173,318 @@ error:
static herr_t
test_core(void)
{
- hid_t file=(-1), fapl, access_fapl = -1;
- char filename[1024];
- void *fhandle=NULL;
- hsize_t file_size;
- hbool_t use_write_tracking;
- size_t write_tracking_page_size;
- int *points = NULL, *check = NULL, *p1, *p2;
- hid_t dset1=-1, space1=-1;
- hsize_t dims1[2];
- int i, j, n;
+ hid_t fid = -1; /* file ID */
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */
+ hid_t did = -1; /* dataset ID */
+ hid_t sid = -1; /* dataspace ID */
+ char filename[1024]; /* filename */
+ void *os_file_handle = NULL; /* OS file handle */
+ hsize_t file_size; /* file size */
+ size_t increment; /* core VFD increment */
+ hbool_t backing_store; /* use backing store? */
+ hbool_t use_write_tracking; /* write tracking flag */
+ size_t write_tracking_page_size; /* write tracking page size */
+ int *data_w = NULL; /* data written to the dataset */
+ int *data_r = NULL; /* data read from the dataset */
+ int val; /* data value */
+ int *pw = NULL, *pr = NULL; /* pointers for iterating over
+ data arrays (write & read) */
+ hsize_t dims[2]; /* dataspace dimensions */
+ int i, j; /* iterators */
+ htri_t status; /* return value from H5Lexists */
TESTING("CORE file driver");
- h5_reset();
+ /* Get a file access property list and fix up the file name */
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
- /* Set property list and file name for CORE driver */
- fapl = h5_fileaccess();
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ /************************************************************************
+ * Check that the backing store flag works by creating a file, close
+ * it, and ensure that the file does not exist.
+ ************************************************************************/
+
+ /* Make sure it's not present at the start of the test */
+ if(HDaccess(filename, F_OK) != -1)
+ if(HDremove(filename) < 0)
+ FAIL_PUTS_ERROR("unable to remove backing store file");
+ /* Create and close file w/ backing store off */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
+ TEST_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0)
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ /* Check for the backing store file */
+ if(HDaccess(filename, F_OK) != -1)
+ FAIL_PUTS_ERROR("file created when backing store set to FALSE");
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+
+ /************************************************************************
+ * Check basic core VFD operation and properties. This is done with the
+ * backing store on so a file will be created for later use.
+ ************************************************************************/
+
+ /* Turn the backing store on */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+
+ /* Check that write tracking is off by default and that the default
+ * page size is non-zero.
+ */
+ if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
+ TEST_ERROR;
+ if(FALSE != use_write_tracking)
+ FAIL_PUTS_ERROR("write tracking should be off by default");
+ if(0 == write_tracking_page_size)
+ FAIL_PUTS_ERROR("write tracking page size should never be zero");
+
+ /* Set core VFD properties */
+ if(H5Pset_core_write_tracking(fapl_id, TRUE, CORE_PAGE_SIZE) < 0)
+ TEST_ERROR;
+
+ /* Create the file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
- if ((access_fapl = H5Fget_access_plist(file)) < 0)
+ if((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
/* Check that the driver is correct */
- if(H5FD_CORE != H5Pget_driver(access_fapl))
+ if(H5FD_CORE != H5Pget_driver(fapl_id_out))
TEST_ERROR;
+ /* Get the basic VFD properties from the fapl and ensure that
+ * they are correct.
+ */
+ if(H5Pget_fapl_core(fapl_id_out, &increment, &backing_store) < 0)
+ TEST_ERROR
+ if(increment != (size_t)CORE_INCREMENT)
+ FAIL_PUTS_ERROR("incorrect increment from file fapl");
+ if(backing_store != TRUE)
+ FAIL_PUTS_ERROR("incorrect backing store flag from file fapl");
+
/* Check that the backing store write tracking info was saved */
- if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0)
+ /* TODO: There is a bug where H5Fget_access_plist() does not return
+ * the write tracking properties. Until this bug is fixed, just
+ * test the main fapl_id.
+ */
+ if(H5Pget_core_write_tracking(fapl_id, &use_write_tracking, &write_tracking_page_size) < 0)
TEST_ERROR;
if(TRUE != use_write_tracking)
- TEST_ERROR;
+ FAIL_PUTS_ERROR("write tracking flag incorrect in fapl obtained from H5Fget_access_plist");
if(CORE_PAGE_SIZE != write_tracking_page_size)
- TEST_ERROR;
+ FAIL_PUTS_ERROR("write tracking page size incorrect in fapl obtained from H5Fget_access_plist");
- /* ...and close the property list */
- if (H5Pclose(access_fapl) < 0)
+ /* Close the property list */
+ if(H5Pclose(fapl_id_out) < 0)
TEST_ERROR;
- if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
- TEST_ERROR;
- if(fhandle==NULL)
- {
- printf("fhandle==NULL\n");
- TEST_ERROR;
- }
-
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* Check that we can get an operating-system-specific handle from
+ * the library.
+ */
+ if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0)
TEST_ERROR;
+ if(os_file_handle == NULL)
+ FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle");
/* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. Why is this 4KB?
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
*/
- if(file_size<2*KB || file_size>6*KB)
+ if(H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
+ if(file_size < 2 * KB || file_size > 6 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
- if(H5Fclose(file) < 0)
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
+ /************************************************************************
+ * Make changes to the file with the backing store flag OFF to ensure
+ * that they ARE NOT propagated.
+ ************************************************************************/
+
/* Open the file with backing store off for read and write.
- * Changes won't be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
+ * Changes won't be saved in file.
+ */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, FALSE) < 0)
TEST_ERROR;
-
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
/* Allocate memory for data set. */
- if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
- TEST_ERROR;
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
- TEST_ERROR;
+ if(NULL == (data_w = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for input array");
+ if(NULL == (data_r = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ FAIL_PUTS_ERROR("unable to allocate memory for output array");
- /* Initialize the dset1 */
- p1 = points;
- for(i = n = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- *p1++ = n++;
+ /* Initialize the buffers */
+ val = 0;
+ pw = data_w;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ *pw++ = val++;
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
- /* Create the data space1 */
- dims1[0] = DSET1_DIM1;
- dims1[1] = DSET1_DIM2;
- if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
+ /* Create the dataspace */
+ dims[0] = CORE_DSET_DIM1;
+ dims[1] = CORE_DSET_DIM2;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ /* Close and reopen the dataset */
+ if(H5Dclose(did) < 0)
TEST_ERROR;
-
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ pw = data_w;
+ pr = data_r;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ if(*pr++ != *pw++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
+ printf(" Read different values than written in data set.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
- if(H5Dclose(dset1) < 0)
+ /* Close everything except the dataspace ID (needed below)*/
+ if(H5Dclose(did) < 0)
TEST_ERROR;
-
- if(H5Fclose(file) < 0)
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- /* Open the file with backing store on for read and write.
- * Changes will be saved in file. */
- if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ /* Reopen the file and ensure that the dataset does not exist */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
-
- if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ status = H5Lexists(fid, CORE_DSET_NAME, H5P_DEFAULT);
+ if(status < 0)
TEST_ERROR;
+ if(status > 0)
+ FAIL_PUTS_ERROR("core VFD dataset created in file when backing store disabled");
- /* Create the dset1 */
- if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- /* Write the data to the dset1 */
- if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+
+ /************************************************************************
+ * Make changes to the file with the backing store flag ON to ensure
+ * that they ARE propagated.
+ ************************************************************************/
+
+ /* Open the file with backing store on for read and write.
+ * Changes will be saved in file.
+ */
+ if(H5Pset_fapl_core(fapl_id, (size_t)CORE_INCREMENT, TRUE) < 0)
+ TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
+ /* Create the dataset */
+ if((did = H5Dcreate2(fid, CORE_DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
- if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
+ /* Write the data to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_w) < 0)
TEST_ERROR;
- /* Reallocate memory for reading buffer. */
- HDassert(check);
- HDfree(check);
- if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ /* Close everything and reopen */
+ if(H5Dclose(did) < 0)
+ TEST_ERROR;
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR;
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR;
+ if((did = H5Dopen2(fid, CORE_DSET_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- /* Read the data back from dset1 */
- if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
+ /* Read the data back from the dataset */
+ HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
- p1 = points;
- p2 = check;
- for(i = 0; i < DSET1_DIM1; i++)
- for(j = 0; j < DSET1_DIM2; j++)
- if(*p1++ != *p2++) {
+ pw = data_w;
+ pr = data_r;
+ for(i = 0; i < CORE_DSET_DIM1; i++)
+ for(j = 0; j < CORE_DSET_DIM2; j++)
+ if(*pw++ != *pr++) {
H5_FAILED();
- printf(" Read different values than written in data set 1.\n");
+ printf(" Read different values than written in data set.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
- /* Check file size API */
- if(H5Fget_filesize(file, &file_size) < 0)
+ /* Check file size API.
+ * There is no garantee the size of metadata in file is constant.
+ * Just try to check if it's reasonable.
+ *
+ * TODO: Needs justification of why is this is a reasonable size.
+ */
+ if(H5Fget_filesize(fid, &file_size) < 0)
TEST_ERROR;
+ if(file_size < 64 * KB || file_size > 256 * KB)
+ FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize");
- /* There is no garantee the size of metadata in file is constant.
- * Just try to check if it's reasonable. */
- if(file_size<64*KB || file_size>256*KB)
+ /* Close everything */
+ if(H5Sclose(sid) < 0)
TEST_ERROR;
-
- if(H5Sclose(space1) < 0)
+ if(H5Dclose(did) < 0)
TEST_ERROR;
- if(H5Dclose(dset1) < 0)
- TEST_ERROR;
- if(H5Fclose(file) < 0)
+
+ HDfree(data_w);
+ HDfree(data_r);
+
+ /* Close and delete the file */
+ if(H5Fclose(fid) < 0)
TEST_ERROR;
- HDassert(points);
- HDfree(points);
- HDassert(check);
- HDfree(check);
+ h5_delete_test_file(FILENAME[1], fapl_id);
- h5_cleanup(FILENAME, fapl);
+ /* Close the fapl */
+ if(H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(file);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(fapl_id_out);
+ H5Pclose(fapl_id);
+ H5Fclose(fid);
} H5E_END_TRY;
- if(points)
- HDfree(points);
- if(check)
- HDfree(check);
+ if(data_w)
+ HDfree(data_w);
+ if(data_r)
+ HDfree(data_r);
return -1;
-}
+} /* end test_core() */
/*-------------------------------------------------------------------------
@@ -391,7 +504,7 @@ static herr_t
test_direct(void)
{
#ifdef H5_HAVE_DIRECT
- hid_t file=(-1), fapl, access_fapl = -1;
+ hid_t file=-1, fapl=-1, access_fapl = -1;
hid_t dset1=-1, dset2=-1, space1=-1, space2=-1;
char filename[1024];
int *fhandle=NULL;
@@ -400,7 +513,7 @@ test_direct(void)
size_t mbound;
size_t fbsize;
size_t cbsize;
- int *points = NULL, *check = NULL, *p1, *p2;
+ int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
int wdata2[DSET2_DIM] = {11,12,13,14};
int rdata2[DSET2_DIM];
int i, j, n;
@@ -413,11 +526,10 @@ test_direct(void)
return 0;
#else /*H5_HAVE_DIRECT*/
- h5_reset();
-
/* Set property list and file name for Direct driver. Set memory alignment boundary
* and file block size to 512 which is the minimum for Linux 2.6. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[5], fapl, filename, sizeof filename);
@@ -559,14 +671,19 @@ test_direct(void)
TEST_ERROR;
if(H5Dclose(dset2) < 0)
TEST_ERROR;
- if(H5Fclose(file) < 0)
- TEST_ERROR;
- HDassert(points);
+
HDfree(points);
- HDassert(check);
HDfree(check);
- h5_cleanup(FILENAME, fapl);
+ /* Close and delete the file */
+ if(H5Fclose(file) < 0)
+ TEST_ERROR;
+ h5_delete_test_file(FILENAME[5], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
+
PASSED();
return 0;
@@ -607,7 +724,7 @@ error:
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
- hid_t file;
+ hid_t file=-1;
char first_name[1024];
char wrong_name[1024];
int i;
@@ -678,7 +795,7 @@ error:
static herr_t
test_family(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), space=(-1), dset=(-1);
+ hid_t file=-1, fapl=-1, fapl2=-1, space=-1, dset=-1;
hid_t access_fapl = -1;
char filename[1024];
char dname[]="dataset";
@@ -690,14 +807,12 @@ test_family(void)
TESTING("FAMILY file driver");
- h5_reset();
-
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
@@ -804,10 +919,15 @@ test_family(void)
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[2], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -815,7 +935,8 @@ error:
H5E_BEGIN_TRY {
H5Sclose(space);
H5Dclose(dset);
- H5Pclose (fapl2);
+ H5Pclose(fapl);
+ H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
return -1;
@@ -843,8 +964,8 @@ error:
static herr_t
test_family_compat(void)
{
- hid_t file = (-1), fapl;
- hid_t dset;
+ hid_t file = -1, fapl = -1;
+ hid_t dset = -1;
char dname[]="dataset";
char filename[1024];
char pathname[1024], pathname_individual[1024];
@@ -853,16 +974,14 @@ test_family_compat(void)
TESTING("FAMILY file driver backward compatibility");
- h5_reset();
-
/* Set property list and file name for FAMILY driver */
- fapl = h5_fileaccess();
-
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
- h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
- h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
+ h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof(filename));
+ h5_fixname(FILENAME[3], fapl, newname, sizeof(newname));
pathname[0] = '\0';
HDstrcat(pathname, filename);
@@ -904,10 +1023,14 @@ test_family_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[3], fapl);
- h5_cleanup(FILENAME, fapl);
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
PASSED();
@@ -940,7 +1063,7 @@ error:
static herr_t
test_multi_opens(char *fname)
{
- hid_t file;
+ hid_t file=-1;
char super_name[1024]; /*name string "%%s-s.h5"*/
char sf_name[1024]; /*name string "multi_file-s.h5"*/
@@ -972,8 +1095,8 @@ test_multi_opens(char *fname)
static herr_t
test_multi(void)
{
- hid_t file=(-1), fapl, fapl2=(-1), dset=(-1), space=(-1);
- hid_t root, attr, aspace, atype;
+ hid_t file=-1, fapl=-1, fapl2=-1, dset=-1, space=-1;
+ hid_t root=-1, attr=-1, aspace=-1, atype=-1;
hid_t access_fapl = -1;
char filename[1024];
int *fhandle2=NULL, *fhandle=NULL;
@@ -992,16 +1115,15 @@ test_multi(void)
TESTING("MULTI file driver");
- h5_reset();
-
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
- HDmemset(memb_map, 0, sizeof memb_map);
- HDmemset(memb_fapl, 0, sizeof memb_fapl);
- HDmemset(memb_name, 0, sizeof memb_name);
- HDmemset(memb_addr, 0, sizeof memb_addr);
- HDmemset(sv, 0, sizeof sv);
+ HDmemset(memb_map, 0, sizeof(memb_map));
+ HDmemset(memb_fapl, 0, sizeof(memb_fapl));
+ HDmemset(memb_name, 0, sizeof(memb_name));
+ HDmemset(memb_addr, 0, sizeof(memb_addr));
+ HDmemset(sv, 0, sizeof(sv));
for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
memb_fapl[mt] = H5P_DEFAULT;
@@ -1118,7 +1240,7 @@ test_multi(void)
/* Create and write attribute for the root group. */
if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ TEST_ERROR
/* Attribute string. */
if((atype = H5Tcopy(H5T_C_S1)) < 0)
@@ -1148,10 +1270,15 @@ test_multi(void)
if(H5Aclose(attr) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[4], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1191,7 +1318,7 @@ error:
static herr_t
test_multi_compat(void)
{
- hid_t file=(-1), fapl, dset=(-1), space=(-1);
+ hid_t file=-1, fapl=-1, dset=-1, space=-1;
char newname[1024];
char filename_s[1024], newname_s[1024];
char filename_r[1024], newname_r[1024];
@@ -1206,10 +1333,9 @@ test_multi_compat(void)
TESTING("MULTI file driver backward compatibility");
- h5_reset();
-
/* Set file access property list for MULTI driver */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
HDmemset(memb_map, 0, sizeof memb_map);
HDmemset(memb_fapl, 0, sizeof memb_fapl);
@@ -1317,10 +1443,15 @@ test_multi_compat(void)
if(H5Dclose(dset) < 0)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[9], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1363,10 +1494,9 @@ test_log(void)
TESTING("LOG file driver");
- h5_reset();
-
/* Set property list and file name for log driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
@@ -1403,10 +1533,15 @@ test_log(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[6], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1444,10 +1579,9 @@ test_stdio(void)
TESTING("STDIO file driver");
- h5_reset();
-
/* Set property list and file name for STDIO driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_stdio(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[7], fapl, filename, sizeof filename);
@@ -1483,10 +1617,15 @@ test_stdio(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[7], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1536,10 +1675,9 @@ test_windows(void)
#else /* H5_HAVE_WINDOWS */
- h5_reset();
-
/* Set property list and file name for WINDOWS driver. */
- fapl = h5_fileaccess();
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
if(H5Pset_fapl_windows(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -1575,10 +1713,15 @@ test_windows(void)
if(file_size < 1 * KB || file_size > 4 * KB)
TEST_ERROR;
+ /* Close and delete the file */
if(H5Fclose(file) < 0)
TEST_ERROR;
+ h5_delete_test_file(FILENAME[8], fapl);
+
+ /* Close the fapl */
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR;
- h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
@@ -1590,7 +1733,7 @@ error:
return -1;
#endif /* H5_HAVE_WINDOWS */
-}
+} /* end test_windows() */
@@ -1612,7 +1755,9 @@ main(void)
{
int nerrors = 0;
- printf("Testing basic Virtual File Driver functionality.\n");
+ h5_reset();
+
+ HDprintf("Testing basic Virtual File Driver functionality.\n");
nerrors += test_sec2() < 0 ? 1 : 0;
nerrors += test_core() < 0 ? 1 : 0;
@@ -1626,12 +1771,13 @@ main(void)
nerrors += test_windows() < 0 ? 1 : 0;
if(nerrors) {
- printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
+ HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
nerrors, nerrors > 1 ? "S" : "");
return 1;
- }
+ } /* end if */
+
+ HDprintf("All Virtual File Driver tests passed.\n");
- printf("All Virtual File Driver tests passed.\n");
return 0;
-}
+} /* end main() */