diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-05 12:32:01 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-05 12:32:01 (GMT) |
commit | 59a8b10b881b33a9d47243c16600be18e697a68c (patch) | |
tree | 73937c6bcc8773661945b606ca3d648cb8b54808 | |
parent | 42bd90edc82445a9758937a5149874b79266a733 (diff) | |
download | hdf5-59a8b10b881b33a9d47243c16600be18e697a68c.zip hdf5-59a8b10b881b33a9d47243c16600be18e697a68c.tar.gz hdf5-59a8b10b881b33a9d47243c16600be18e697a68c.tar.bz2 |
Merge fixes and code reconciliation wit develop
37 files changed, 1763 insertions, 1532 deletions
@@ -3332,6 +3332,7 @@ ./tools/test/h5dump/CMakeTestsPBITS.cmake ./tools/test/h5dump/CMakeTestsXML.cmake ./tools/test/h5dump/CMakeTestsVDS.cmake +./tools/test/h5dump/CMakeVFDTests.cmake ./tools/src/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeTests.cmake diff --git a/bin/genparser b/bin/genparser index 8cf6ec2..e6aee5b 100755 --- a/bin/genparser +++ b/bin/genparser @@ -218,7 +218,7 @@ perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5 # will simply ignore them, but we want to avoid those warnings. for f in ${path_to_hl_src}/H5LTparse.c ${path_to_hl_src}/H5LTanalyze.c do - echo '#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 ' >> tmp.out + echo '#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out diff --git a/bin/make_err b/bin/make_err index bfe8861..a6461d4 100755 --- a/bin/make_err +++ b/bin/make_err @@ -244,7 +244,7 @@ sub create_init ($) { print HEADER "/* Major error codes */\n"; print HEADER "/*********************/\n\n"; foreach $name (keys %major) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; @@ -260,7 +260,7 @@ sub create_init ($) { # Iterate over all the minor errors in each section for $name ( @{$section_list{$sect_name}}) { - print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n"; + print HEADER " "x(0*$indent),"HDassert(${name}_g==(-1));\n"; print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n"; print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n"; print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n"; diff --git a/bin/snapshot b/bin/snapshot index 5c78fc8..bde68a5 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -130,9 +130,9 @@ DISPLAYUSAGE() set - cat <<EOF Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [help] - [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>] - [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd] - [exec <command>] [module-load <module-list>] [op-configure <option>] + [clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>] + [zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd] + [exec <command>] [module-load <module-list>] [op-configure <option>] [--<option>] all: Run all commands (checkout, test & release) [Default is all] @@ -149,8 +149,8 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h setenv <name> <value>: Set environment variable <name> to <value>. setenvN <N> <name> <value> ...: - Set environment variable with <N> values. - E.g., setenvN 3 x a b c is same as setenv x="a b c". + Set environment variable with <N> values. + E.g., setenvN 3 x a b c is same as setenv x="a b c". srcdir: Use srcdir option (does not imply other commands) "snapshot srcdir" is equivalent to "snapshot srcdir all" "snapshot srcdir checkout" is equivalent to "snapshot checkout" @@ -168,7 +168,7 @@ Usage: $PROGNAME [all] [checkout] [ftp <URL> [diff] [test] [srcdir] [release] [h Use <dir> as the release directory [Default is $ReleaseDir_default] check-vfd: - Run make check-vfd instead of just make check. + Run make check-vfd instead of just make check. exttest <testscript>; Run testscript; exec <command>: diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index b26165a..8a44767 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -15,36 +15,42 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +set (VFD_LIST + sec2 + stdio + core + split + multi + family +) + +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") - add_test ( - NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tattr_basic.h5 - tattr_compound.h5 - tattr_dtype.h5 - tattr_multi.h5 - tattr_scalar.h5 - tfattrs.h5 - titerate.h5 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} - ) - add_test ( +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + add_test ( + NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 + titerate.h5 + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} + ) + add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -55,13 +61,13 @@ -D "TEST_OUTPUT=${vfdname}-cpp_testhdf5.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) - endif () - endmacro () + ) + set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) + set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) +endforeach () diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 0a39568..82d63af 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -195,7 +195,22 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 6.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa") + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized") + endif () + + # Append more extra warning flags that only gcc 7.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") + endif () + + # Append more extra warning flags that only gcc 8.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") + endif () + + # Append more extra warning flags that only gcc 9.x+ know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) + set (H5_CFLAGS4 "${H5_CFLAGS4} Wattribute-alias=2 -Wmissing-profile") endif () endif () diff --git a/config/conclude.am b/config/conclude.am index 27cd7ee..6e96ba2 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -68,7 +68,7 @@ all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS) # make install-doc doesn't do anything outside of doc directory, but # Makefiles should recognize it. # UPDATE: docs no longer reside in this build tree, so this target -# is depreciated. +# is deprecated. install-doc uninstall-doc: @echo "Nothing to be done." diff --git a/config/gnu-fflags b/config/gnu-fflags index 6b5e6a1..3fc112d 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -25,9 +25,8 @@ # if test X = "X$f9x_flags_set"; then f9x_version="`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 |grep 'gcc version' |\ - sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" if test X != "X$f9x_version"; then -# is_mpi="`$FC $FCFLAGS $H5_FCFLAGS -help 2>&1 |grep 'link MPI'`" f9x_vendor=`echo $f9x_version |sed 's/\([a-z]*\).*/\1/'` f9x_version=`echo $f9x_version |sed 's/[-a-z]//g'` if test X = "X$f9x_vendor" -a X != "X$f9x_version"; then @@ -37,24 +36,38 @@ if test X = "X$f9x_flags_set"; then echo "compiler '$FC' is GNU $f9x_vendor-$f9x_version" fi - # Some version numbers + # Get the compiler version numbers f9x_vers_major=`echo $f9x_version | cut -f1 -d.` f9x_vers_minor=`echo $f9x_version | cut -f2 -d.` f9x_vers_patch=`echo $f9x_version | cut -f3 -d.` test -n "$f9x_vers_major" || f9x_vers_major=0 test -n "$f9x_vers_minor" || f9x_vers_minor=0 test -n "$f9x_vers_patch" || f9x_vers_patch=0 - f9x_vers_all=`expr $f9x_vers_major '*' 1000000 + $f9x_vers_minor '*' 1000 + $f9x_vers_patch` fi fi -# Common GNU flags for various situations if test "X-gfortran" = "X-$f9x_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + + FC_BASENAME=gfortran + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + + # Need Fortran 2008 support for storage_size() in gcc 4.6 on + # (2008ts in some versions) + if test $f9x_vers_major -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + elif test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008ts" + else + H5_FCFLAGS="$H5_FCFLAGS -std=f2003" + fi + + + ############################### + # Architecture-specific flags # + ############################### arch= - # Architecture-specific flags # Nothing currently. (Uncomment code below and modify to add any) #case "$host_os-$host_cpu" in # *-i686) @@ -62,43 +75,116 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # ;; #esac - # Host-specific flags - # Nothing currently. (Uncomment code below and modify to add any) - #case "`hostname`" in - # sleipnir.ncsa.uiuc.edu) - # arch="$arch -pipe" - # ;; - #esac + H5_FCFLAGS="$H5_FCFLAGS $arch" - # General - FC_BASENAME=gfortran - F9XSUFFIXFLAG="" - FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" + ############## + # Production # + ############## - # Turn off warnings for passing non-ANSI types to BIND(). - # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. - H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" - - # Production PROD_FCFLAGS= - # Debug - DEBUG_FCFLAGS="-fbounds-check" + ######### + # Debug # + ######### + + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then + DEBUG_FCFLAGS="-fcheck=all" + else + DEBUG_FCFLAGS="-fbounds-check" + fi + + ########### + # Symbols # + ########### - # Symbols SYMBOLS_FCFLAGS="-g" NO_SYMBOLS_FCFLAGS="-s" - # Profiling + ############# + # Profiling # + ############# + PROFILE_FCFLAGS="-pg" - # Optimization - HIGH_OPT_FCFLAGS="-O2" - DEBUG_OPT_FCFLAGS="-O0" + ################ + # Optimization # + ################ + + if test $f9x_vers_major -le 4; then + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= + else + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-Og" + fi NO_OPT_FCFLAGS="-O0" - # Flags are set + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" + H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Wcharacter-truncation" + + ############################# + # Version-specific warnings # + ############################# + + # gfortran 4.3 (nothing new) + + # gfortran 4.4 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 4; then + H5_FCFLAGS="$H5_FCFLAGS -Warray-temporaries -Wintrinsics-std" + fi + + # gfortran 4.5 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS -Wimplicit-procedure" + fi + + # gfortran 4.6 (nothing new) + + # gfortran 4.7 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 7; then + H5_FCFLAGS="$H5_FCFLAGS -Wreal-q-constant -Wfunction-elimination" + fi + + # gfortran 4.8 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -Wrealloc-lhs -Wrealloc-lhs-all" + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + fi + + # gfortran 4.9 (nothing new) + + # gfortran 5 + if test $f9x_vers_major -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS -Wuse-without-only" + fi + + # gfortran 6 + if test $f9x_vers_major -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS -Winteger-division" + fi + + # gfortran 7 (nothing new) + + # gfortran 8 + if test $f9x_vers_major -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -Wfrontend-loop-interchange" + fi + + # gfortran 9 (nothing new) + + ################# + # Flags are set # + ################# f9x_flags_set=yes fi diff --git a/config/gnu-flags b/config/gnu-flags index 7df72c7..6355ccf 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -14,7 +14,7 @@ # This file should be sourced into configure if the compiler is the # GNU gcc compiler or a derivative. It is careful not to do anything -# if the compiler is not GNU; otherwise `cc_flags_set' is set to `yes' +# if the compiler is not GNU; otherwise 'cc_flags_set' is set to 'yes' # # Get the compiler version in a way that works for gcc @@ -23,7 +23,7 @@ # cc_vendor: The compiler name: gcc # cc_version: Version number: 2.91.60, 2.7.2.1 # -if test X = "X$cc_flags_set"; then +if test "X-" = "X-$cc_flags_set"; then # PathScale compiler spits out gcc version string too. Need to # filter it out. # icc beginning with version 12 includes a "gcc version compatiblilty" @@ -37,26 +37,27 @@ if test X = "X$cc_flags_set"; then cc_vendor=`echo $cc_version |sed 's/\([a-z]*\).*/\1/'` cc_version=`echo $cc_version |sed 's/[-a-z]//g'` if test X = "X$cc_vendor" -a X != "X$cc_version"; then - cc_vendor=gcc + cc_vendor=gcc fi if test "-" != "$cc_vendor-$cc_version"; then - echo "compiler '$CC' is GNU $cc_vendor-$cc_version" + echo "compiler '$CC' is GNU $cc_vendor-$cc_version" fi - # Some version numbers + # Get the compiler version numbers cc_vers_major=`echo $cc_version | cut -f1 -d.` cc_vers_minor=`echo $cc_version | cut -f2 -d.` cc_vers_patch=`echo $cc_version | cut -f3 -d.` test -n "$cc_vers_major" || cc_vers_major=0 test -n "$cc_vers_minor" || cc_vers_minor=0 test -n "$cc_vers_patch" || cc_vers_patch=0 - cc_vers_all=`expr $cc_vers_major '*' 1000000 + $cc_vers_minor '*' 1000 + $cc_vers_patch` fi -# Common GCC flags for various situations -case "$cc_vendor-$cc_version" in - gcc*) - # Architecture-specific flags +if test "X-gcc" = "X-$cc_vendor"; then + + ############################### + # Architecture-specific flags # + ############################### + arch= case "$host_os-$host_cpu" in # FreeBSD sets the information from "uname -m" to the general machine @@ -96,377 +97,205 @@ case "$cc_vendor-$cc_version" in ;; esac - # Host-specific flags - case "`hostname`" in - sleipnir.ncsa.uiuc.edu) - arch="$arch -pipe" - ;; - esac + H5_CFLAGS="$H5_CFLAGS $arch" - # General flags - # - # Note that some of the flags listed here really should be developer - # flags (listed in a separate variable, below) but we put them here - # because they are not raised by the current code and we'd like to - # know if they do start showing up. - # - # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) - # warnings that are emitted. If you need it, add it from the - # environment variable at configure time. - H5_CFLAGS="$H5_CFLAGS $arch -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" - H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" - H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" - H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" - H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum" - H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" + ############## + # Production # + ############## - # Production # NDEBUG is handled explicitly by the configure script - case "$cc_vendor-$cc_version" in - gcc-4.*) + if test $cc_vers_major -le 4; then PROD_CFLAGS= - ;; - gcc-[56789].*) + else PROD_CFLAGS="-fstdarg-opt" - ;; - *) - # gcc automatically inlines based on the optimization level - # this is just a failsafe - PROD_CFLAGS="-finline-functions" - ;; - esac + fi + + ######### + # Debug # + ######### - # Debug # NDEBUG is handled explicitly by the configure script # -g is handled by the symbols flags - case "$cc_vendor-$cc_version" in - gcc-[56789].*) - DEBUG_CFLAGS="-ftrapv -fno-common" - ;; - *) + if test $cc_vers_major -le 4; then DEBUG_CFLAGS= - ;; - esac + else + DEBUG_CFLAGS="-ftrapv -fno-common" + fi - # Developer warnings (suggestions from gcc, not code problems) - DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn" - NO_DEVELOPER_WARNING_CFLAGS="-Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn" + ########### + # Symbols # + ########### - # Symbols NO_SYMBOLS_CFLAGS="-s" SYMBOLS_CFLAGS="-g -fno-omit-frame-pointer" - # Profile + ############# + # Profiling # + ############# + PROFILE_CFLAGS="-pg" - # Optimization - case "$cc_vendor-$cc_version" in - gcc-4.*) + ################ + # Optimization # + ################ + + if test $cc_vers_major -le 4; then HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS= - ;; - gcc-[56789].*) + else HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS="-Og" - ;; - *) - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS= - ;; - esac + fi NO_OPT_CFLAGS="-O0" - # Flags are set - cc_flags_set=yes - ;; -esac - -# Version specific GCC flags -# -# Please follow the pattern below by adding new versions at the top, copying -# the information from the previous version and adding modifications to that. -case "$cc_vendor-$cc_version" in - -# When the gcc 7.x release is out, we should check for additional flags to -# include and break it out into it's own section, like the other versions -# below. -QAK - gcc-[6789].*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - - # Append warning flags that only gcc 6.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa" - ;; - - gcc-5*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - - # Append warning flags that only gcc 5.x+ knows about - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" - ;; - - gcc-4.9*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - - # Append warning flags that only gcc 4.9+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdate-time" - ;; + ############ + # Warnings # + ############ - gcc-4.8*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) + ########### + # General # + ########### - # Append warning flags that only gcc 4.3+ knows about + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - - # Append warning flags that only gcc 4.8+ knows about - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" - ;; - - gcc-4.7*) - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it from the + # environment variable at configure time. # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" - - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - - # Append warning flags that only gcc 4.7+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" - ;; - - gcc-4.6*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" - - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) - - # Append warning flags that only gcc 4.3+ knows about + # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add + # it to the developer flags. # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" + H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" + H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" + H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" + H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" + H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + ###################### + # Developer warnings # + ###################### - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + # (suggestions from gcc, not code problems) + # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) + DEVELOPER_WARNING_CFLAGS="-Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn -Wformat-nonliteral" + NO_DEVELOPER_WARNING_CFLAGS="-Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn" - # Append warning flags that only gcc 4.6+ knows about - H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" - ;; + ####################### + # gcc 4 special cases # + ####################### - gcc-4.5*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then + H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + fi - # Append warning flags that only gcc 4.2+ knows about - # (none, or incorporated in -Wall / -Wextra now) + # -Wvolatile-register-var was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.2-4.3 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then + H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + fi - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + # -Wstrict-aliasing was later incorporated into -Wall and + # only needs to be specified explicitly for gcc 4.5-4.6 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing" + fi - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + fi - # Append warning flags that only gcc 4.5+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" - ;; + # -Wvla was later incorporated into -Wpedantic and + # only needs to be specified explicitly for gcc 4 + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then + H5_CFLAGS="$H5_CFLAGS -Wvla" + fi - gcc-4.4*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + ############################# + # Version-specific warnings # + ############################# - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + # gcc 4.3 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" + fi - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + # gcc 4.4 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + fi - # Append warning flags that only gcc 4.4+ knows about - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" - ;; + # gcc 4.5 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + fi - gcc-4.3*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 4.6 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + # gcc 4.7 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + fi - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + # gcc 4.8 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + fi - # Append warning flags that only gcc 4.3+ knows about - # - # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wvla" - ;; + # gcc 4.9 + if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + fi - gcc-4.2*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 5 + if test $cc_vers_major -ge 5; then + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" + # gcc 6 + if test $cc_vers_major -ge 6; then + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + fi - # Append warning flags that only gcc 4.2+ knows about - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" - ;; + # gcc 7 + if test $cc_vers_major -ge 7; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + fi - gcc-4.1*) - # Disable warnings about using 'long long' type - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + # gcc 8 + if test $cc_vers_major -ge 8; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" + fi - # Append warning flags that only gcc 4.1+ knows about - # -Wvolatile-register-var was later incorporated into -Wall and - # needs to be specified explicitly for gcc 4.1-4.3. - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" - ;; + # gcc 9 + if test $cc_vers_major -ge 9; then + H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" + fi -esac + ################# + # Flags are set # + ################# + cc_flags_set=yes +fi # Clear cc info if no flags set if test "X$cc_flags_set" = "X"; then - cc_vendor= - cc_version= + cc_vendor= + cc_version= fi diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 08b0212..1ff499f 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -693,10 +693,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5z_flags[17] = (int_f)H5Z_SO_FLOAT_ESCALE; h5z_flags[18] = (int_f)H5Z_SO_INT; h5z_flags[19] = (int_f)H5Z_SO_INT_MINBITS_DEFAULT; -/* - * H5A flags - */ - /* * H5 Generic flags introduced in version 1.8 @@ -275,6 +275,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int enough_room(hid_t fapl) { @@ -315,6 +323,7 @@ done: return ret_value; } +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/cache_image.c b/test/cache_image.c index 5967ecc..3725787 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -3658,8 +3658,7 @@ cache_image_smoke_check_2(void) if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + /* 4) Open the file. * * Verify that the metadata cache is instructed to load the @@ -4565,7 +4564,6 @@ cache_image_smoke_check_4(void) FUNC, failure_mssg); return !pass; - } /* cache_image_smoke_check_4() */ @@ -5028,8 +5026,7 @@ cache_image_smoke_check_5(void) */ i = min_group; while ( ( pass ) && ( i <= max_group ) ) { - - sprintf(process_group_name, "/process_%d", i); + sprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } diff --git a/test/error_test.c b/test/error_test.c index 580234a..1de9065 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -320,6 +320,14 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'full_desc' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static herr_t test_long_desc(void) { @@ -374,6 +382,7 @@ error: return -1; } /* end test_long_desc() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- diff --git a/test/fheap.c b/test/fheap.c index e38d263..48261ef 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -539,6 +539,14 @@ get_fill_size(const fheap_test_param_t *tparam) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * test_desc in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int begin_test(fheap_test_param_t *tparam, const char *base_desc, fheap_heap_ids_t *keep_ids, size_t *fill_size) @@ -567,6 +575,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, /* Success */ return(0); } /* end begin_test() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -683,6 +692,7 @@ open_heap(char *filename, hid_t fapl, const H5HF_create_t *cparam, /* Close (empty) heap */ if(H5HF_close(*fh) < 0) FAIL_STACK_ERROR + *fh = NULL; } /* end if */ /* Close file */ @@ -759,6 +769,7 @@ reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr, /* Close (empty) heap */ if(H5HF_close(*fh) < 0) FAIL_STACK_ERROR + *fh = NULL; /* Re-open heap */ if(NULL == (*fh = H5HF_open(f, fh_addr))) @@ -766,10 +777,10 @@ reopen_heap(H5F_t *f, H5HF_t **fh, haddr_t fh_addr, } /* end if */ /* Success */ - return(0); + return 0; error: - return(-1); + return -1; } /* end reopen_heap() */ @@ -1906,6 +1917,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Delete heap */ if(H5HF_delete(f, fh_addr) < 0) @@ -1926,15 +1938,15 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_create() */ @@ -2020,6 +2032,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Check for closing & re-opening the file */ if(tparam->reopen_heap) { @@ -2083,7 +2096,7 @@ error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_reopen() */ @@ -2250,7 +2263,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -2258,11 +2271,11 @@ error: H5HF_close(fh); if(fh2) H5HF_close(fh2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(file); + H5Fclose(file2); } H5E_END_TRY; - return(1); + return 1; } /* test_open_twice() */ @@ -2366,6 +2379,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(fh2) { /* Close opened heap */ H5HF_close(fh2); + fh2 = NULL; /* Indicate error */ TEST_ERROR @@ -2403,6 +2417,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) if(fh) { /* Close opened heap */ H5HF_close(fh); + fh = NULL; /* Indicate error */ TEST_ERROR @@ -2423,7 +2438,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -2431,9 +2446,9 @@ error: H5HF_close(fh); if(fh2) H5HF_close(fh2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_delete_open() */ @@ -2769,15 +2784,15 @@ test_id_limits(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_id_limits() */ @@ -2878,6 +2893,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Close the file */ @@ -2891,15 +2907,15 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_filtered_create() */ @@ -3022,7 +3038,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR - + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -3031,15 +3047,15 @@ test_size(hid_t fapl, H5HF_create_t *cparam, hid_t fcpl) /* All tests passed */ PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(fh) H5HF_close(fh); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_size() */ @@ -6645,6 +6661,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara /* Close the fractal heap */ if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -6836,6 +6853,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara /* Close the fractal heap */ if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7003,6 +7021,7 @@ test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t /* Close the fractal heap */ if(H5HF_close(fh) < 0) FAIL_STACK_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7241,6 +7260,7 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t /* Close the fractal heap */ if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7543,6 +7563,7 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param /* Close the fractal heap */ if(H5HF_close(fh) < 0) TEST_ERROR + fh = NULL; /* Close the file */ if(H5Fclose(file) < 0) @@ -7599,7 +7620,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */ struct a_type_t1 { char a[10]; - char b[29]; + char b[40]; } obj1, obj2; /* Objects to insert/remove */ size_t id_len; /* Size of fractal heap IDs */ fheap_heap_state_t state; /* State of fractal heap */ @@ -7640,14 +7661,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ */ TESTING("incremental object insertion and removal") + HDmemset(&obj1, 0, sizeof(obj1)); + HDmemset(&obj2, 0, sizeof(obj2)); for(i = 0; i < 100; i++) { - HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); - for(j = 0; j < i; j++) { - HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); - if(H5HF_remove(fh, heap_id[j]) < 0) FAIL_STACK_ERROR + + HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); if(H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0) FAIL_STACK_ERROR } /* end for */ @@ -7658,6 +7679,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Insert object */ HDmemset(heap_id[i], 0, id_len); + HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); if(H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0) FAIL_STACK_ERROR } /* end for */ @@ -13685,15 +13707,15 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam H5HF_create_t tmp_cparam; /* Local heap creation parameters */ fheap_heap_ids_t keep_ids; /* Structure to retain heap IDs */ size_t id_len; /* Size of fractal heap IDs */ - h5_stat_size_t empty_size; /* Size of a file with an empty heap */ - h5_stat_size_t file_size; /* Size of file currently */ + h5_stat_size_t empty_size; /* Size of a file with an empty heap */ + h5_stat_size_t file_size; /* Size of file currently */ unsigned char *heap_id = NULL; /* Heap ID for object */ size_t obj_size; /* Size of object */ size_t robj_size; /* Size of object read */ unsigned char obj_type; /* Type of storage for object */ fheap_heap_state_t state; /* State of fractal heap */ unsigned deflate_level; /* Deflation level */ - size_t 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 */ diff --git a/test/file_image.c b/test/file_image.c index 12f0a18..3249c83 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -671,6 +671,14 @@ error: * ****************************************************************************** */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'member_file_name' in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" static int test_get_file_image(const char * test_banner, const int file_name_num, @@ -937,6 +945,7 @@ test_get_file_image(const char * test_banner, error: return 1; } /* end test_get_file_image() */ +#pragma GCC diagnostic pop /****************************************************************************** diff --git a/test/gheap.c b/test/gheap.c index bf0f18a..32e2785 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -15,9 +15,9 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Tuesday, March 31, 1998 * - * Purpose: Tests the global heap. The global heap is the set of all - * collections but the collections are not related to one - * another by anything that appears in the file format. + * Purpose: Tests the global heap. The global heap is the set of all + * collections but the collections are not related to one + * another by anything that appears in the file format. */ #include "h5test.h" #include "H5ACprivate.h" @@ -60,33 +60,31 @@ const char *FILENAME[] = { /*------------------------------------------------------------------------- * Function: test_1 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_1 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("monotonically increasing lengths"); @@ -97,10 +95,10 @@ test_1 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -116,11 +114,12 @@ test_1 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if(status < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; - } else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { + } + else if(u && H5F_addr_gt(obj[u - 1].addr, obj[u].addr)) { H5_FAILED(); - puts(" Collection addresses are not monotonically increasing"); + HDputs(" Collection addresses are not monotonically increasing"); nerrors++; } } @@ -134,11 +133,12 @@ test_1 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if(HDmemcmp(in, out, size)) { + } + else if(HDmemcmp(in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -147,15 +147,17 @@ test_1 (hid_t fapl) HDfree(obj); obj = NULL; - if(H5Fclose(file) < 0) goto error; - if(nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); @@ -166,32 +168,30 @@ error: /*------------------------------------------------------------------------- * Function: test_2 * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_2 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - uint8_t in[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + uint8_t in[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + int nerrors = 0; + char filename[1024]; TESTING("monotonically decreasing lengths"); @@ -202,10 +202,10 @@ test_2 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -216,9 +216,9 @@ test_2 (hid_t fapl) size = GHEAP_TEST_NOBJS - u; HDmemset(out, (int)('A' + u % 26), size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, size, out, obj + u) < 0) { + if(H5HG_insert(f, size, out, obj + u) < 0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -232,11 +232,12 @@ test_2 (hid_t fapl) H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, obj + u, in, NULL)) { H5_FAILED(); - puts(" Unable to read object"); + HDputs(" Unable to read object"); nerrors++; - } else if (memcmp (in, out, size)) { + } + else if (memcmp (in, out, size)) { H5_FAILED(); - puts(" Value read doesn't match value written"); + HDputs(" Value read doesn't match value written"); nerrors++; } } @@ -245,15 +246,17 @@ test_2 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); @@ -264,32 +267,30 @@ test_2 (hid_t fapl) /*------------------------------------------------------------------------- * Function: test_3 * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_3 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("complete object removal"); @@ -300,11 +301,11 @@ test_3 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; } /* Create some stuff */ @@ -315,7 +316,7 @@ test_3 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } } @@ -325,7 +326,7 @@ test_3 (hid_t fapl) status = H5HG_remove(f, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } } @@ -334,15 +335,17 @@ test_3 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); @@ -353,33 +356,31 @@ test_3 (hid_t fapl) /*------------------------------------------------------------------------- * Function: test_4 * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_4 (hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t *obj = NULL; - uint8_t out[GHEAP_TEST_NOBJS]; - size_t u; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; + H5HG_t *obj = NULL; + uint8_t out[GHEAP_TEST_NOBJS]; + size_t u; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("partial object removal"); @@ -390,10 +391,10 @@ test_4 (hid_t fapl) /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } @@ -405,21 +406,20 @@ test_4 (hid_t fapl) status = H5HG_insert(f, size, out, obj + u); if (status<0) { H5_FAILED(); - puts(" Unable to insert object into global heap"); + HDputs(" Unable to insert object into global heap"); nerrors++; } - /* - * Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ + /* Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ if(1 == (u % 3)) { H5Eclear2(H5E_DEFAULT); status = H5HG_remove(f, obj + u - 1); if (status<0) { H5_FAILED(); - puts(" Unable to remove object"); + HDputs(" Unable to remove object"); nerrors++; } HDmemset(obj + u - 1, 0, sizeof *obj); @@ -430,15 +430,17 @@ test_4 (hid_t fapl) HDfree(obj); obj = NULL; - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); @@ -449,32 +451,30 @@ test_4 (hid_t fapl) /*------------------------------------------------------------------------- * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Neil Fortner * Monday, October 26, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; + hid_t file = H5I_INVALID_HID; + H5F_t *f = NULL; unsigned i, j; - H5HG_t *obj = NULL; - herr_t status; - int nerrors=0; - char filename[1024]; + H5HG_t *obj = NULL; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("out of order indices"); @@ -487,16 +487,18 @@ test_ooo_indices(hid_t fapl) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; - } /* end if */ + } /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around */ - for(i=0; i<66; i++) { + * entries, until the indices wrap around. + */ + for(i = 0; i < 66; i++) { /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. */ + * can be deleted. + */ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); status = H5HG_insert(f, sizeof(j), &j, &obj[j]); @@ -506,7 +508,7 @@ test_ooo_indices(hid_t fapl) /* Check that the index is as expected */ if(obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1) GHEAP_REPEATED_ERR(" Unexpected global heap index"); - } /* end for */ + } /* Remove the previous 1000 entries */ if(i>0) @@ -515,20 +517,21 @@ test_ooo_indices(hid_t fapl) status = H5HG_remove(f, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); - } /* end for */ - } /* end for */ + } + } /* The indices should have "wrapped around" on the last iteration */ HDassert(obj[534].idx == 65535); HDassert(obj[535].idx == 1); /* Reopen the file */ - if (H5Fclose(file)<0) goto error; + if (H5Fclose(file) < 0) + goto error; if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - puts(" Unable to open file"); + HDputs(" Unable to open file"); goto error; } /* end if */ @@ -538,14 +541,15 @@ test_ooo_indices(hid_t fapl) goto error; if(i != j) { H5_FAILED(); - puts(" Incorrect read value"); + HDputs(" Incorrect read value"); goto error; - } /* end if */ - } /* end for */ - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + } + } + if(H5Fclose(file) < 0) + goto error; + if(nerrors) + goto error; HDfree(obj); obj = NULL; @@ -554,7 +558,7 @@ test_ooo_indices(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(obj) HDfree(obj); @@ -563,60 +567,58 @@ test_ooo_indices(hid_t fapl) /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests global heap. + * Purpose: Tests global heap. * - * Return: Success: zero - * - * Failure: non-zero - * - * Programmer: Robb Matzke - * Tuesday, March 31, 1998 - * - * Modifications: + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main (void) { - int nerrors=0; - hid_t fapl; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); - fapl = h5_fileaccess(); + if ((fapl_id = h5_fileaccess()) < 0) + goto error; /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; - nerrors += test_1(fapl); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); - nerrors += test_ooo_indices(fapl); + nerrors += test_1(fapl_id); + nerrors += test_2(fapl_id); + nerrors += test_3(fapl_id); + nerrors += test_4(fapl_id); + nerrors += test_ooo_indices(fapl_id); /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) goto error; - puts("All global heap tests passed."); + + HDputs("All global heap tests passed."); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + h5_cleanup(FILENAME, fapl_id); + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDputs("*** TESTS FAILED ***"); + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/h5test.c b/test/h5test.c index 0d7603f..cd5b1b1 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -225,6 +225,14 @@ h5_clean_files(const char *base_name[], hid_t fapl) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * sub_filename in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" void h5_delete_test_file(const char *base_name, hid_t fapl) { @@ -267,13 +275,14 @@ h5_delete_test_file(const char *base_name, hid_t fapl) for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); HDremove(sub_filename); - } /* end for */ + } } else { HDremove(filename); - } /* end if */ + } /* end driver selection tree */ return; } /* end h5_delete_test_file() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -610,7 +619,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX * could be of value -1 if it is not defined. */ - isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO==driver); + isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver); /* Check HDF5_NOCLEANUP environment setting. * (The #ifdef is needed to prevent compile failure in case MPI is not @@ -805,8 +814,8 @@ h5_rmprefix(const char *filename) * 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: H5I_INVALID_HID * * Programmer: Robb Matzke * Thursday, November 19, 1998 @@ -819,7 +828,7 @@ h5_fileaccess(void) const char *val = NULL; const char *name; char s[1024]; - hid_t fapl = -1; + hid_t fapl = H5I_INVALID_HID; /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); @@ -1192,7 +1201,7 @@ h5_set_info_object(void) int ret_value=0; /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ + if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){ char *next, *valp; valp = envp = next = HDstrdup(envp); @@ -1254,7 +1263,7 @@ h5_set_info_object(void) /* actually set the darned thing */ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); + HDprintf("MPI_Info_set failed\n"); ret_value = -1; } } @@ -1317,6 +1326,14 @@ h5_dump_info_object(MPI_Info info) * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * temp in the code below, but early (4.4.7, at least) gcc only + * allows diagnostic pragmas to be toggled outside of functions. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-nonliteral" h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl) { @@ -1418,6 +1435,7 @@ h5_get_file_size(const char *filename, hid_t fapl) return(-1); } /* end get_file_size() */ +#pragma GCC diagnostic pop /* * This routine is designed to provide equivalent functionality to 'printf' @@ -1430,9 +1448,9 @@ print_func(const char *format, ...) va_list arglist; int ret_value; - va_start(arglist, format); + HDva_start(arglist, format); ret_value = vprintf(format, arglist); - va_end(arglist); + HDva_end(arglist); return ret_value; } @@ -1517,7 +1535,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) int len; static char* env = NULL; - assert(name); + HDassert(name); MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); @@ -1525,7 +1543,7 @@ getenv_all(MPI_Comm comm, int root, const char* name) if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(comm, &mpi_rank); MPI_Comm_size(comm, &mpi_size); - assert(root < mpi_size); + HDassert(root < mpi_size); /* The root task does the getenv call * and sends the result to the other tasks */ @@ -1643,15 +1661,11 @@ error: * * Purpose: Callback function for h5_verify_cached_stabs. * - * Return: Success: 0 - * - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Tuesday, April 12, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1659,9 +1673,9 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata) { if(oinfo->type == H5O_TYPE_GROUP) - return(H5G__verify_cached_stabs_test(oid)); + return H5G__verify_cached_stabs_test(oid); else - return(0); + return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ diff --git a/test/h5test.h b/test/h5test.h index afd3a4c..1b057a6 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -102,7 +102,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * the H5_FAILED() macro is invoked automatically when an API function fails. */ #define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-62s",WHAT); fflush(stdout);} +#define TESTING_2(WHAT) {printf(" Testing %-60s",WHAT); fflush(stdout);} #define PASSED() {puts(" PASSED");fflush(stdout);} #define H5_FAILED() {puts("*FAILED*");fflush(stdout);} #define H5_WARNING() {puts("*WARNING*");fflush(stdout);} @@ -6114,7 +6114,7 @@ test_mf_fs_persist_split(void) TESTING("File's free-space managers are persistent for split-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6124,7 +6124,7 @@ test_mf_fs_persist_split(void) /* File creation property list template */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the split file driver. */ SKIPPED(); @@ -6436,14 +6436,14 @@ test_mf_fs_persist_multi(void) TESTING("File's free-space managers are persistent for multi-file"); - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); HDfprintf(stdout, " Persistent FSMs disabled in multi file driver.\n"); return 0; /* <========== note return */ - /* for now, we don't support persistent free space managers + /* for now, we don't support persistent free space managers * with the multi file driver. */ SKIPPED(); @@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Addresses for small raw data blocks */ haddr_t gaddr1; /* Addresses for large data blocks */ hbool_t split = FALSE, multi = FALSE; @@ -7661,7 +7661,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 3 small meta data blocks: addr1, addr2, addr3 */ + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -7673,7 +7673,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR if(found_addr != addr2) @@ -7735,7 +7735,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR - /* Verify that the small meta data manager is there */ + /* Verify that the small metadata manager is there */ H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7755,7 +7755,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(H5MF__open_fstype(f, fs_type) < 0) TEST_ERROR - /* Verify that the freed block with addr2 is found from the small meta data manager */ + /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)(f->shared->fs_page_size-(addr3+TBLOCK_SIZE50)), f->shared->fs_man[fs_type], &found_addr) < 0) TEST_ERROR @@ -7838,7 +7838,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1; /* Address for small meta data block */ + haddr_t addr1; /* Address for small metadata block */ haddr_t saddr1; /* Address for small raw data block */ haddr_t gaddr1; /* Address for large data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -7872,14 +7872,14 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); /* Try to shrink the block with addr1 */ if((status = H5MF_try_shrink(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE50)) < 0) FAIL_STACK_ERROR - /* Couldn't shrink due to the section (remaining space in the page) is in the small meta data free-space manager */ + /* Couldn't shrink due to the section (remaining space in the page) is in the small metadata free-space manager */ if(status == TRUE) TEST_ERROR /* Allocate a small raw data block with saddr1 */ @@ -7961,7 +7961,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) hid_t fid = -1; /* File ID */ hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2, addr3; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2, addr3; /* Addresses for small metadata blocks */ haddr_t saddr1; /* Address for small raw data block */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ htri_t was_extended; /* Whether the block can be extended or not */ @@ -7993,7 +7993,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate a small meta data block with addr1 */ + /* Allocate a small metadata block with addr1 */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE98); /* Try extending the block with addr1 at EOF not crossing page boundary */ @@ -8001,7 +8001,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Should succeed */ if(was_extended != TRUE) TEST_ERROR - /* Allocate 2 small meta data blocks with addr2 and addr3--will be on another meta data page */ + /* Allocate 2 small metadata blocks with addr2 and addr3--will be on another metadata page */ addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE100); addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE150); @@ -8028,7 +8028,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) /* Free the block with addr1 */ H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248); - /* Allocate a new meta data block with addr1 */ + /* Allocate a new metadata block with addr1 */ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */ /* The block is right next to the threshold */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286); @@ -8409,7 +8409,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) hid_t fcpl = -1; /* File creation property list */ H5F_t *f = NULL; /* Internal file object pointer */ haddr_t addr2, addr3, addr4, addr5; /* Addresses for blocks */ - haddr_t addr9, addr10, addr11; /* Address for small meta data blocks */ + haddr_t addr9, addr10, addr11; /* Address for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ H5FS_stat_t fs_stat; /* Information for free-space manager */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8445,7 +8445,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) FAIL_STACK_ERROR - /* Allocate 2 small meta data blocks: addr1, addr2 */ + /* Allocate 2 small metadata blocks: addr1, addr2 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); @@ -8464,13 +8464,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(saddr2 != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR - /* Allocate a small meta data block with addr3--there is no free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr3--there is no free-space section big enough to fulfill the request */ addr3 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE4020); /* Should be on the third page and page aligned */ if(addr3 % TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr4--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr4--there is a free-space section big enough to fulfill the request */ addr4 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* Should not be page aligned */ if(!(addr4 % TBLOCK_SIZE4096)) @@ -8479,7 +8479,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr4 != (addr2 + TBLOCK_SIZE50)) TEST_ERROR - /* Allocate a small meta data block with addr5--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr5--there is a free-space section big enough to fulfill the request */ addr5 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE40); /* Should not be page aligned */ if(!(addr5 % TBLOCK_SIZE4096)) @@ -8489,16 +8489,16 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(addr5 != (addr3 + TBLOCK_SIZE4020)) TEST_ERROR - /* Allocate a small meta data block with addr6--taking up the remaining space in the first page */ + /* Allocate a small metadata block with addr6--taking up the remaining space in the first page */ if(family) H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3080); else H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3088); - /* Allocate a small meta data block with addr7--taking up the remaining space in the third page */ + /* Allocate a small metadata block with addr7--taking up the remaining space in the third page */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE36); - /* Allocate 2 small meta data blocks: addr8, addr9--there is no free-space to fulfill the request */ + /* Allocate 2 small metadata blocks: addr8, addr9--there is no free-space to fulfill the request */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE50); addr9 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); @@ -8514,13 +8514,13 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) if(fs_stat.tot_space != TBLOCK_SIZE4096) TEST_ERROR - /* Allocate a small meta data block with addr10--there is a free-space section big enough to fulfill the request */ + /* Allocate a small metadata block with addr10--there is a free-space section big enough to fulfill the request */ addr10 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3900); /* The block should be next to the block with addr9 */ if(addr10 != (addr9 + TBLOCK_SIZE80)) TEST_ERROR - /* Allocate a small meta data block with addr11 */ + /* Allocate a small metadata block with addr11 */ /* The current free-space section is unable to fulfill the request; obtain a page from the large manager */ addr11 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE80); /* The address of the block should be the same the freed block with saddr1 */ @@ -8575,7 +8575,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) hid_t fcpl2 = -1; /* File creation property list ID */ hid_t fapl_new = -1; /* File access property list ID */ H5F_t *f = NULL; /* Internal file object pointer */ - haddr_t addr1, addr2; /* Addresses for small meta data blocks */ + haddr_t addr1, addr2; /* Addresses for small metadata blocks */ haddr_t saddr1, saddr2; /* Addresses for small raw data blocks */ haddr_t gaddr1, gaddr2; /* Addresses for blocks */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -8729,7 +8729,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Disable small data block mechanism */ if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR - /* Disable meta data block mechanism */ + /* Disable metadata block mechanism */ if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) TEST_ERROR @@ -8741,7 +8741,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(fid))) TEST_ERROR - /* Allocate 2 small meta data blocks */ + /* Allocate 2 small metadata blocks */ addr1 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE50); diff --git a/test/swmr.c b/test/swmr.c index 0b352e2..e03d0c5 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6484,106 +6484,104 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) if(childpid == 0) { /* Child process */ hid_t child_fid1 = -1; /* File ID */ hid_t child_fid2 = -1; /* File ID */ - hid_t child_did1 = -1, child_did2 = -1; - hid_t child_sid = -1; - hsize_t tdims[1]; - int rbuf[2] = {0, 0}; - int child_notify = 0; + hid_t child_did1 = -1, child_did2 = -1; + hid_t child_sid = -1; + hsize_t tdims[1]; + int rbuf[2] = {0, 0}; + int child_notify = 0; - /* Close unused write end for out_pdf */ - if(HDclose(out_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close unused write end for out_pdf */ + if(HDclose(out_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - /* close unused read end for in_pdf */ - if(HDclose(in_pdf[0]) < 0) - HDexit(EXIT_FAILURE); + /* close unused read end for in_pdf */ + if(HDclose(in_pdf[0]) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 1) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 1) + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Open the file 2 times */ - if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + /* Open the file 2 times */ + if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) - HDexit(EXIT_FAILURE); + if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0) + HDexit(EXIT_FAILURE); - /* Open the dataset 2 times */ - if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); - if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) - HDexit(EXIT_FAILURE); + /* Open the dataset 2 times */ + if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); + if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace via did1 */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); - if(tdims[0] != 1) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace via did1 */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); + if(tdims[0] != 1) + HDexit(EXIT_FAILURE); - /* Read from the dataset via did2 */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset via did2 */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 99) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 99) + HDexit(EXIT_FAILURE); - /* Notify parent process */ - child_notify = 2; - if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); + /* Notify parent process */ + child_notify = 2; + if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Wait for notification from parent process */ - while(child_notify != 3) { - if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) - HDexit(EXIT_FAILURE); - } + /* Wait for notification from parent process */ + while(child_notify != 3) + if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) + HDexit(EXIT_FAILURE); - /* Refresh dataset via did1 */ - if(H5Drefresh(child_did1) < 0) - HDexit(EXIT_FAILURE); + /* Refresh dataset via did1 */ + if(H5Drefresh(child_did1) < 0) + HDexit(EXIT_FAILURE); - /* Get the dataset's dataspace and verify */ - if((child_sid = H5Dget_space(child_did1)) < 0) - HDexit(EXIT_FAILURE); - if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) - HDexit(EXIT_FAILURE); + /* Get the dataset's dataspace and verify */ + if((child_sid = H5Dget_space(child_did1)) < 0) + HDexit(EXIT_FAILURE); + if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0) + HDexit(EXIT_FAILURE); - if(tdims[0] != 2) - HDexit(EXIT_FAILURE); + if(tdims[0] != 2) + HDexit(EXIT_FAILURE); - /* Read from the dataset */ - if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - HDexit(EXIT_FAILURE); + /* Read from the dataset */ + if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + HDexit(EXIT_FAILURE); - /* Verify the data is correct */ - if(rbuf[0] != 100 || rbuf[1] != 100) - HDexit(EXIT_FAILURE); + /* Verify the data is correct */ + if(rbuf[0] != 100 || rbuf[1] != 100) + HDexit(EXIT_FAILURE); - /* Close the 2 datasets */ - if(H5Dclose(child_did1) < 0) - HDexit(EXIT_FAILURE); - if(H5Dclose(child_did2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 datasets */ + if(H5Dclose(child_did1) < 0) + HDexit(EXIT_FAILURE); + if(H5Dclose(child_did2) < 0) + HDexit(EXIT_FAILURE); - /* Close the 2 files */ - if(H5Fclose(child_fid1) < 0) - HDexit(EXIT_FAILURE); - if(H5Fclose(child_fid2) < 0) - HDexit(EXIT_FAILURE); + /* Close the 2 files */ + if(H5Fclose(child_fid1) < 0) + HDexit(EXIT_FAILURE); + if(H5Fclose(child_fid2) < 0) + HDexit(EXIT_FAILURE); - /* Close the pipes */ - if(HDclose(out_pdf[0]) < 0) - HDexit(EXIT_FAILURE); - if(HDclose(in_pdf[1]) < 0) - HDexit(EXIT_FAILURE); + /* Close the pipes */ + if(HDclose(out_pdf[0]) < 0) + HDexit(EXIT_FAILURE); + if(HDclose(in_pdf[1]) < 0) + HDexit(EXIT_FAILURE); - HDexit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* Close unused read end for out_pdf */ @@ -6618,8 +6616,8 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) /* Wait for notification from child process */ while(notify != 2) { - if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) - FAIL_STACK_ERROR; + if(HDread(in_pdf[0], ¬ify, sizeof(int)) < 0) + FAIL_STACK_ERROR; } /* Cork the metadata cache, to prevent the object header from being @@ -7043,7 +7041,7 @@ main(void) */ driver = HDgetenv("HDF5_DRIVER"); if(!H5FD_supports_swmr_test(driver)) { - printf("This VFD does not support SWMR I/O\n"); + HDprintf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } /* end if */ @@ -7133,7 +7131,7 @@ main(void) if(nerrors) goto error; - printf("All tests passed.\n"); + HDprintf("All tests passed.\n"); h5_cleanup(FILENAME, fapl); @@ -7141,7 +7139,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d SWMR TEST%s FAILED! *****\n", + HDprintf("***** %d SWMR TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; diff --git a/test/tattr.c b/test/tattr.c index 7e07ee0..6edbc69 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -571,107 +571,118 @@ test_attr_flush(hid_t fapl) static void test_attr_plist(hid_t fapl) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t plist; /* Property list ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {ATTR1_DIM1}; - H5T_cset_t cset; /* Character set for attributes */ - herr_t ret; /* Generic return value */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dsid = H5I_INVALID_HID; /* Dataspace ID (for dataset) */ + hid_t asid = H5I_INVALID_HID; /* Dataspace ID (for attribute) */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t acpl_id = H5I_INVALID_HID; /* Attribute creation property list ID */ + hid_t aapl_id = H5I_INVALID_HID; /* Attribute access property list ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + H5T_cset_t cset; /* Character set for attributes */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Attribute Property Lists\n")); /* Create file */ - fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid1, FAIL, "H5Fcreate"); + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create dataspace for dataset */ - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - CHECK(sid1, FAIL, "H5Screate_simple"); + dsid = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(dsid, H5I_INVALID_HID, "H5Screate_simple"); /* Create a dataset */ - dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); - CHECK(dataset, FAIL, "H5Dcreate2"); + did = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, dsid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Create dataspace for attribute */ - sid2 = H5Screate_simple(ATTR1_RANK, dims2, NULL); - CHECK(sid2, FAIL, "H5Screate_simple"); + asid = H5Screate_simple(ATTR1_RANK, dims2, NULL); + CHECK(asid, H5I_INVALID_HID, "H5Screate_simple"); - /* Create default property list for attribute */ - plist = H5Pcreate(H5P_ATTRIBUTE_CREATE); - CHECK(plist, FAIL, "H5Pcreate"); + /* Create default creation property list for attribute */ + acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE); + CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate"); + + /* Create default access property list for attribute + * This currently has no properties, but we need to test its creation + * and use. + */ + aapl_id = H5Pcreate(H5P_ATTRIBUTE_ACCESS); + CHECK(aapl_id, H5I_INVALID_HID, "H5Pcreate"); /* Get the character encoding and ensure that it is the default (ASCII) */ - ret = H5Pget_char_encoding(plist, &cset); + ret = H5Pget_char_encoding(acpl_id, &cset); CHECK(ret, FAIL, "H5Pget_char_encoding"); VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding"); /* Create an attribute for the dataset using the property list */ - attr = H5Acreate2(dataset, ATTR1_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate2"); + aid = H5Acreate2(did, ATTR1_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); - /* Close the property list, and get the attribute's property list */ - ret = H5Pclose(plist); + /* Close the property list, and get the attribute's creation property list */ + ret = H5Pclose(acpl_id); CHECK(ret, FAIL, "H5Pclose"); - plist = H5Aget_create_plist(attr); - CHECK(plist, FAIL, "H5Aget_create_plist"); + acpl_id = H5Aget_create_plist(aid); + CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist"); /* Get the character encoding and ensure that it is the default (ASCII) */ - ret = H5Pget_char_encoding(plist, &cset); + ret = H5Pget_char_encoding(acpl_id, &cset); CHECK(ret, FAIL, "H5Pget_char_encoding"); VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding"); /* Close the property list and attribute */ - ret = H5Pclose(plist); + ret = H5Pclose(acpl_id); CHECK(ret, FAIL, "H5Pclose"); - ret = H5Aclose(attr); + ret = H5Aclose(aid); CHECK(ret, FAIL, "H5Aclose"); /* Create a new property list and modify it to use a different encoding */ - plist = H5Pcreate(H5P_ATTRIBUTE_CREATE); - CHECK(plist, FAIL, "H5Pcreate"); - ret = H5Pset_char_encoding(plist, H5T_CSET_UTF8); + acpl_id = H5Pcreate(H5P_ATTRIBUTE_CREATE); + CHECK(acpl_id, H5I_INVALID_HID, "H5Pcreate"); + ret = H5Pset_char_encoding(acpl_id, H5T_CSET_UTF8); CHECK(ret, FAIL, "H5Pset_char_encoding"); /* Get the character encoding and ensure that it has been changed */ - ret = H5Pget_char_encoding(plist, &cset); + ret = H5Pget_char_encoding(acpl_id, &cset); CHECK(ret, FAIL, "H5Pget_char_encoding"); VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding"); /* Create an attribute for the dataset using the modified property list */ - attr = H5Acreate2(dataset, ATTR2_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate2"); + aid = H5Acreate2(did, ATTR2_NAME, H5T_NATIVE_INT, asid, acpl_id, aapl_id); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Close the property list and attribute */ - ret = H5Pclose(plist); + ret = H5Pclose(acpl_id); CHECK(ret, FAIL, "H5Pclose"); - ret = H5Aclose(attr); + ret = H5Aclose(aid); CHECK(ret, FAIL, "H5Aclose"); /* Re-open the second attribute and ensure that its character encoding is correct */ - attr = H5Aopen(dataset, ATTR2_NAME, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Aopen"); - plist = H5Aget_create_plist(attr); - CHECK(plist, FAIL, "H5Aget_create_plist"); - ret = H5Pget_char_encoding(plist, &cset); + aid = H5Aopen(did, ATTR2_NAME, H5P_DEFAULT); + CHECK(aid, H5I_INVALID_HID, "H5Aopen"); + acpl_id = H5Aget_create_plist(aid); + CHECK(acpl_id, H5I_INVALID_HID, "H5Aget_create_plist"); + ret = H5Pget_char_encoding(acpl_id, &cset); CHECK(ret, FAIL, "H5Pget_char_encoding"); VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding"); /* Close everything */ - ret=H5Sclose(sid1); + ret = H5Sclose(dsid); CHECK(ret, FAIL, "H5Sclose"); - ret=H5Sclose(sid2); + ret = H5Sclose(asid); CHECK(ret, FAIL, "H5Sclose"); - ret = H5Pclose(plist); + ret = H5Pclose(aapl_id); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(acpl_id); CHECK(ret, FAIL, "H5Pclose"); - ret=H5Aclose(attr); + ret = H5Aclose(aid); CHECK(ret, FAIL, "H5Aclose"); - ret=H5Dclose(dataset); + ret = H5Dclose(did); CHECK(ret, FAIL, "H5Dclose"); - ret=H5Fclose(fid1); + ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_plist() */ @@ -2166,9 +2177,14 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -2297,9 +2313,14 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Enable creation order tracking on attributes, so creation order tests work */ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED); @@ -2432,7 +2453,6 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) if (use_min_dset_oh) CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); - /* Close file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); @@ -2450,9 +2470,14 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } /* Enable creation order tracking on attributes, so creation order tests work */ ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED); @@ -2642,9 +2667,14 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, H5I_INVALID_HID, "H5Screate"); - /* Query the group creation properties */ - dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); + } /* Retrieve limits for compact/dense attribute storage */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -2807,8 +2837,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1); CHECK(ret, FAIL, "H5Pset_file_space_strategy"); } - fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); if (use_min_dset_oh) CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); @@ -2829,9 +2859,14 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (use_min_dset_oh) { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } else { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -2957,9 +2992,14 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Change limits on compact/dense attribute storage */ max_compact = 0; @@ -3124,9 +3164,14 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) sid = H5Screate(H5S_SCALAR); CHECK(sid, FAIL, "H5Screate"); - /* Query the group creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create a dataset */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -3654,9 +3699,14 @@ test_attr_big(hid_t fcpl, hid_t fapl) big_sid = H5Screate_simple(ATTR6_RANK, dims, NULL); CHECK(big_sid, FAIL, "H5Screate_simple"); - /* Query the group creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + /* need DCPL to query the group creation properties */ + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Retrieve limits for compact/dense attribute storage */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -4128,7 +4178,6 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); - /* Close dataspaces */ ret = H5Sclose(sid); @@ -4350,8 +4399,13 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Get creation order indexing on object */ ret = H5Pget_attr_creation_order(dcpl, &crt_order_flags); @@ -4473,8 +4527,13 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -4673,8 +4732,13 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -5008,8 +5072,13 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -5419,8 +5488,13 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Set attribute creation order tracking & indexing for object */ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); @@ -5762,8 +5836,13 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -5974,8 +6053,13 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -6917,8 +7001,13 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7278,8 +7367,13 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7625,8 +7719,13 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -7879,8 +7978,13 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(sid, FAIL, "H5Screate"); /* Create dataset creation property list */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Query the attribute creation properties */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); @@ -8180,8 +8284,13 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -8511,8 +8620,13 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -8957,8 +9071,13 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -9326,8 +9445,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) } /* end if */ /* Set up to query the object creation properties */ - dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g); - CHECK(dcpl, FAIL, "H5Pcreate"); + if (dcpl_g == H5P_DEFAULT) { + dcpl = H5Pcreate(H5P_DATASET_CREATE); + CHECK(dcpl, FAIL, "H5Pcreate"); + } else { + dcpl = H5Pcopy(dcpl_g); + CHECK(dcpl, FAIL, "H5Pcopy"); + } /* Create datasets */ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); @@ -9735,7 +9859,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) hid_t tid; /* Datatype ID */ hid_t gcpl; /* Group creation property list */ hsize_t dims[2] = {10, 100}; /* Attribute dimensions */ - char aname[4]; /* Attribute name */ + char aname[16]; /* Attribute name */ unsigned i; /* index */ herr_t ret; /* Generic return status */ htri_t tri_ret; /* htri_t return status */ @@ -10739,7 +10863,7 @@ test_attr_bug9(hid_t fcpl, hid_t fapl) /**************************************************************** ** -** test_attr_delete_dense(): +** test_attr_delete_dense(): ** This is to verify the error as described in HDFFV-9277 ** is fixed when deleting the last "large" attribute that ** is stored densely. @@ -10853,9 +10977,8 @@ test_attr(void) fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl, FAIL, "H5Pcreate"); - /* files with fcpl make all attributes (> 1 byte) shared - * i.e., all of them :-) - */ + /* files with fcpl2 make all attributes ( > 1 byte) shared + * (i.e. all of them :-) */ fcpl2 = H5Pcopy(fcpl); CHECK(fcpl2, FAIL, "H5Pcopy"); ret = H5Pset_shared_mesg_nindexes(fcpl2, (unsigned)1); @@ -10883,11 +11006,10 @@ test_attr(void) if(new_format) { MESSAGE(7, ("testing with new file format\n")); my_fapl = fapl2; - } /* end if */ - else { + } else { MESSAGE(7, ("testing with old file format\n")); my_fapl = fapl; - } /* end else */ + } /* These next two tests use the same file information */ test_attr_basic_write(my_fapl); /* Test basic H5A writing code */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 5031846..d5e767f 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1774,7 +1774,7 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for first class */ - path=H5P_get_class_path_test(cid1); + path = H5P_get_class_path_test(cid1); CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); @@ -1789,7 +1789,7 @@ test_genprop_path(void) CHECK_I(ret, "H5Pregister2"); /* Get full path for second class */ - path=H5P_get_class_path_test(cid2); + path = H5P_get_class_path_test(cid2); CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS2_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH); diff --git a/test/th5s.c b/test/th5s.c index fa6bba3..ed205df 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -91,12 +91,22 @@ struct space4_struct { unsigned u; float f; char c2; - } space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */ +} space4_data={'v',987123,-3.14F,'g'}; /* Test data for 4th dataspace */ - -/* Used in test_h5s_encode_irregular_exceed32() and test_h5s_encode_points_exceed32() */ +/* + * Testing configuration defines used by: + * test_h5s_encode_regular_hyper() + * test_h5s_encode_irregular_hyper() + * test_h5s_encode_points() + */ +#define CONFIG_8 1 +#define CONFIG_16 2 +#define CONFIG_32 3 +#define POWER8 256 /* 2^8 */ +#define POWER16 65536 /* 2^16 */ #define POWER32 4294967296 /* 2^32 */ + /**************************************************************** ** ** test_h5s_basic(): Test basic H5S (dataspace) code. @@ -1200,6 +1210,7 @@ test_h5s_encode(void) sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); + /* Set the hyperslab selection */ ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); @@ -1212,7 +1223,7 @@ test_h5s_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret_id = H5Sdecode(sbuf); + ret_id = H5Sdecode(sbuf); } H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Sdecode"); @@ -1229,22 +1240,26 @@ test_h5s_encode(void) VERIFY(n, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, "H5Sget_simple_extent_npoints"); + /* Retrieve and verify the dataspace rank */ rank = H5Sget_simple_extent_ndims(decoded_sid1); CHECK(rank, FAIL, "H5Sget_simple_extent_ndims"); VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims"); + /* Retrieve and verify the dataspace dimensions */ rank = H5Sget_simple_extent_dims(decoded_sid1, tdims, NULL); CHECK(rank, FAIL, "H5Sget_simple_extent_dims"); VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims"); - /* Verify hyperslabe selection */ + /* Verify the type of dataspace selection */ sel_type = H5Sget_select_type(decoded_sid1); VERIFY(sel_type, H5S_SEL_HYPERSLABS, "H5Sget_select_type"); + /* Verify the number of hyperslab blocks */ nblocks = H5Sget_select_hyper_nblocks(decoded_sid1); VERIFY(nblocks, 2*2*2, "H5Sget_select_hyper_nblocks"); + /* Close the dataspaces */ ret = H5Sclose(sid1); CHECK(ret, FAIL, "H5Sclose"); @@ -1272,10 +1287,11 @@ test_h5s_encode(void) decoded_sid2=H5Sdecode(null_sbuf); CHECK(decoded_sid2, FAIL, "H5Sdecode"); - /* Verify decoded dataspace */ + /* Verify the decoded dataspace type */ space_type = H5Sget_simple_extent_type(decoded_sid2); VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type"); + /* Close the dataspaces */ ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); @@ -1313,20 +1329,26 @@ test_h5s_encode(void) CHECK(n, FAIL, "H5Sget_simple_extent_npoints"); VERIFY(n, 1, "H5Sget_simple_extent_npoints"); + /* Retrieve and verify the dataspace rank */ rank = H5Sget_simple_extent_ndims(decoded_sid3); CHECK(rank, FAIL, "H5Sget_simple_extent_ndims"); VERIFY(rank, 0, "H5Sget_simple_extent_ndims"); + /* Close the dataspaces */ ret = H5Sclose(sid3); CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(decoded_sid3); CHECK(ret, FAIL, "H5Sclose"); - HDfree(sbuf); - HDfree(null_sbuf); - HDfree(scalar_buf); -} /* test_h5s_encode() */ + /* Release resources */ + if(sbuf) + HDfree(sbuf); + if(null_sbuf) + HDfree(null_sbuf); + if(scalar_buf) + HDfree(scalar_buf); +} /* test_h5s_encode() */ /**************************************************************** ** @@ -1336,14 +1358,14 @@ test_h5s_encode(void) static void test_h5s_scalar_write(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - int rank; /* Logical rank of dataspace */ - hsize_t tdims[4]; /* Dimension array to test with */ - hssize_t n; /* Number of dataspace elements */ - H5S_class_t ext_type; /* Extent type */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + int rank; /* Logical rank of dataspace */ + hsize_t tdims[4]; /* Dimension array to test with */ + hssize_t n; /* Number of dataspace elements */ + H5S_class_t ext_type; /* Extent type */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Scalar Dataspace Manipulation during Writing\n")); @@ -1362,14 +1384,17 @@ test_h5s_scalar_write(void) sid1 = H5Screate_simple(SPACE3_RANK, NULL, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); + /* Retrieve the number of elements in the dataspace selection */ n = H5Sget_simple_extent_npoints(sid1); CHECK(n, FAIL, "H5Sget_simple_extent_npoints"); VERIFY(n, 1, "H5Sget_simple_extent_npoints"); + /* Get the dataspace rank */ rank = H5Sget_simple_extent_ndims(sid1); CHECK(rank, FAIL, "H5Sget_simple_extent_ndims"); VERIFY(rank, SPACE3_RANK, "H5Sget_simple_extent_ndims"); + /* Get the dataspace dimension sizes */ rank = H5Sget_simple_extent_dims(sid1, tdims, NULL); VERIFY(rank, 0, "H5Sget_simple_extent_dims"); @@ -1381,6 +1406,7 @@ test_h5s_scalar_write(void) dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); + /* Write to the dataset */ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &space3_data); CHECK(ret, FAIL, "H5Dwrite"); @@ -1395,7 +1421,7 @@ test_h5s_scalar_write(void) /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -} /* test_h5s_scalar_write() */ +} /* test_h5s_scalar_write() */ /**************************************************************** ** diff --git a/test/titerate.c b/test/titerate.c index 696784d..6a75d5b 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -945,7 +945,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) searched_err_t *searched_err = (searched_err_t *)_client_data; if (searched_err == NULL) - return -1; + return H5_ITER_ERROR; /* If the searched error message is found, stop the iteration */ if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) @@ -989,6 +989,7 @@ static void test_corrupted_attnamelen(void) /* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should occur in the decoding stage, so some arguments are not needed. */ err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL); + VERIFY(err_status, FAIL, "H5Aiterate2"); /* Make sure the intended error was caught */ if(err_status == -1) diff --git a/test/trefer.c b/test/trefer.c index 1f85b07..78139d2 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -615,7 +615,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); CHECK(sid1, FAIL, "H5Screate_simple"); - /* Create the reference dataset */ + /* Create a dataset */ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Dcreate2"); @@ -1849,10 +1849,10 @@ test_reference(void) /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); - test_reference_params(); /* Test for correct parameter checking */ - test_reference_obj(); /* Test basic H5R object reference code */ + test_reference_params(); /* Test for correct parameter checking */ + test_reference_obj(); /* Test basic H5R object reference code */ - /* Loop through all the combinations of low/high version bounds */ + /* Loop through all the combinations of low/high version bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { @@ -1866,10 +1866,10 @@ test_reference(void) } /* end high bound */ } /* end low bound */ - test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ - test_reference_group(); /* Test operations on dereferenced groups */ + test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + test_reference_group(); /* Test operations on dereferenced groups */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_reference_compat(); /* Test operations with old API routines */ + test_reference_compat(); /* Test operations with old API routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_reference() */ diff --git a/test/tselect.c b/test/tselect.c index 3c93e7a..90e7508 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -157,6 +157,12 @@ #define SPACERE5_DIM3 12 #define SPACERE5_DIM4 8 +/* Information for Space update diminfo test */ +#define SPACEUD1_DIM0 20 +#define SPACEUD3_DIM0 9 +#define SPACEUD3_DIM1 12 +#define SPACEUD3_DIM2 13 + /* #defines for shape same / different rank tests */ #define SS_DR_MAX_RANK 5 @@ -167,6 +173,9 @@ #define SPACE13_DIM3 50 #define SPACE13_NPOINTS 4 +/* Information for testing selection iterators */ +#define SEL_ITER_MAX_SEQ 256 + /* Location comparison function */ static int compare_size_t(const void *s1, const void *s2); @@ -1308,14 +1317,8 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) { + if(HDmemcmp(rbuf, wbuf, sizeof(uint16_t) * 30 * 12)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -1432,14 +1435,8 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) { + if(HDmemcmp(rbuf,wbuf,sizeof(uint16_t)*2*SPACE8_DIM3*SPACE8_DIM2*SPACE8_DIM1)) TestErrPrintf("Error: hyperslab values don't match!\n"); -#ifdef QAK - for(i=0, tbuf=wbuf; i<12; i++) - for(j=0; j<30; j++) - printf("i=%d, j=%d, *wbuf=%u, *rbuf=%u\n",i,j,(unsigned)*(wbuf+i*30+j),(unsigned)*(rbuf+i*30+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -3537,13 +3534,13 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /**************************************************************** ** -** test_select_hyper_checker_board_dr(): Test H5S (dataspace) -** selection code with checkerboard source and target having +** test_select_hyper_checker_board_dr(): Test H5S (dataspace) +** selection code with checkerboard source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5S_shape_same in isolation, so now we try to do ** I/O. ** -** This is just an initial smoke check, so we will work +** This is just an initial smoke check, so we will work ** with a slice through a cube only. ** ****************************************************************/ @@ -3743,15 +3740,8 @@ test_select_hyper_copy(void) CHECK(ret, FAIL, "H5Dread"); /* Compare data read with data written out */ - if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) { + if(HDmemcmp(rbuf,rbuf2,sizeof(uint16_t)*SPACE3_DIM1*SPACE3_DIM2)) TestErrPrintf("hyperslab values don't match! Line=%d\n",__LINE__); -#ifdef QAK - for(i=0; i<SPACE3_DIM1; i++) - for(j=0; j<SPACE3_DIM2; j++) - if((unsigned)*(rbuf+i*SPACE3_DIM2+j)!=(unsigned)*(rbuf2+i*SPACE3_DIM2+j)) - printf("i=%d, j=%d, *rbuf=%u, *rbuf2=%u\n",i,j,(unsigned)*(rbuf+i*SPACE3_DIM2+j),(unsigned)*(rbuf2+i*SPACE3_DIM2+j)); -#endif /* QAK */ - } /* end if */ /* Close memory dataspace */ ret = H5Sclose(sid2); @@ -5220,7 +5210,7 @@ test_select_hyper_union_3d(void) tmp2_space = H5Scombine_select(sid2,H5S_SELECT_OR,tmp_space); CHECK(tmp2_space, FAIL, "H5Scombin_select"); - npoints = H5Sget_select_npoints(tmp2_space); + npoints = (hsize_t)H5Sget_select_npoints(tmp2_space); VERIFY(npoints, 15*26, "H5Sget_select_npoints"); /* Create a dataset */ @@ -5902,42 +5892,29 @@ test_select_hyper_union_random_5d(hid_t read_plist) CHECK(sid2, FAIL, "H5Screate_simple"); /* Get initial random # seed */ - seed=(unsigned)time(NULL)+(unsigned)clock(); + seed = (unsigned)HDtime(NULL) + (unsigned)HDclock(); /* Crunch through a bunch of random hyperslab reads from the file dataset */ for(test_num=0; test_num<NRAND_HYPER; test_num++) { /* Save random # seed for later use */ /* (Used in case of errors, to regenerate the hyperslab sequence) */ -#ifndef QAK - seed+=(unsigned)clock(); -#else /* QAK */ - seed=987909620; -#endif /* QAK */ + seed += (unsigned)HDclock(); HDsrandom(seed); -#ifdef QAK -printf("test_num=%d, seed=%u\n",test_num,seed); -#endif /* QAK */ -#ifndef QAK for(i=0; i<NHYPERSLABS; i++) { -#else /* QAK */ - for(i=0; i<2; i++) { -#endif /* QAK */ -#ifdef QAK -printf("hyperslab=%d\n",i); -#endif /* QAK */ /* Select random hyperslab location & size for selection */ for(j=0; j<SPACE5_RANK; j++) { start[j] = ((hsize_t)HDrandom() % dims1[j]); count[j] = (((hsize_t)HDrandom() % (dims1[j] - start[j])) + 1); -#ifdef QAK -printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[j],j,(int)(start[j]+count[j]-1)); -#endif /* QAK */ } /* end for */ /* Select hyperslab */ ret = H5Sselect_hyperslab(sid1, (i == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, NULL, count, NULL); CHECK(ret, FAIL, "H5Sselect_hyperslab"); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ } /* end for */ /* Get the number of elements selected */ @@ -5953,49 +5930,21 @@ printf("start[%d]=%d, count[%d]=%d (end[%d]=%d)\n",j,(int)start[j],j,(int)count[ npoints2 = H5Sget_select_npoints(sid2); VERIFY(npoints, npoints2, "H5Sget_select_npoints"); -#ifdef QAK -printf("random I/O, before H5Dread(), npoints=%lu\n",(unsigned long)npoints); -{ - hsize_t blocks[128][2][SPACE5_RANK]; - hssize_t nblocks; - int k; - - nblocks=H5Sget_select_hyper_nblocks(sid1); - printf("nblocks=%d\n",(int)nblocks); - H5Sget_select_hyper_blocklist(sid1,0,nblocks,blocks); - for(j=0; j<nblocks; j++) { - printf("Block #%d, start = {",j); - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][0][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}, end = {"); - } /* end for */ - for(k=0; k<SPACE5_RANK; k++) { - printf("%d",blocks[j][1][k]); - if(k<(SPACE5_RANK-1)) - printf(", "); - else - printf("}\n"); - } /* end for */ - } /* end for */ -} -#endif /* QAK */ /* Read selection from disk */ ret=H5Dread(dataset,H5T_NATIVE_INT,sid2,sid1,read_plist,rbuf); CHECK(ret, FAIL, "H5Dread"); -#ifdef QAK -printf("random I/O, after H5Dread()\n"); -#endif /* QAK */ + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); + break; + } /* end if */ /* Compare data read with data written out */ tbuf=rbuf; ret = H5Diterate(wbuf,H5T_NATIVE_INT,sid1,test_select_hyper_iter2,&tbuf); - if(ret<0) { - TestErrPrintf("Random hyperslabs for seed %u failed!\n",seed); + if(ret < 0) { + TestErrPrintf("Random hyperslabs for seed %u failed!\n", seed); break; - } + } /* end if */ /* Set the read buffer back to all zeroes */ HDmemset(rbuf, 0, (size_t)SPACE6_DIM1); @@ -6282,9 +6231,6 @@ test_select_point_chunk(void) herr_t ret; /* Generic return value */ unsigned *data_out; /* output buffer */ -#ifdef LATER - unsigned *tmpdata_out; /* output buffer */ -#endif /* LATER */ hsize_t start[SPACE7_RANK]; /* hyperslab offset */ hsize_t count[SPACE7_RANK]; /* size of the hyperslab */ @@ -8155,53 +8101,53 @@ test_shape_same(void) /* Compare "all" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(all_sid,all_sid); + check = H5S_select_shape_same_test(all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ tmp_sid=H5Scopy(all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(all_sid,tmp_sid); + check = H5S_select_shape_same_test(all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(all_sid,none_sid); + check = H5S_select_shape_same_test(all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(all_sid,single_pt_sid); + check = H5S_select_shape_same_test(all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(all_sid,mult_pt_sid); + check = H5S_select_shape_same_test(all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(all_sid,none_hyper_sid); + check = H5S_select_shape_same_test(all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8214,53 +8160,53 @@ test_shape_same(void) /* Compare "none" selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(none_sid,none_sid); + check = H5S_select_shape_same_test(none_sid,none_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(none_sid); + tmp_sid = H5Scopy(none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(none_sid,tmp_sid); + check = H5S_select_shape_same_test(none_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(none_sid,all_sid); + check = H5S_select_shape_same_test(none_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(none_sid,single_pt_sid); + check = H5S_select_shape_same_test(none_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(none_sid,mult_pt_sid); + check = H5S_select_shape_same_test(none_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(none_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(none_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(none_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(none_sid,none_hyper_sid); + check = H5S_select_shape_same_test(none_sid,none_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8273,49 +8219,49 @@ test_shape_same(void) /* Compare single point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_pt_sid); + tmp_sid = H5Scopy(single_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(single_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_pt_sid,all_sid); + check = H5S_select_shape_same_test(single_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_pt_sid,none_sid); + check = H5S_select_shape_same_test(single_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_pt_sid,single_hyper_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ @@ -8332,53 +8278,53 @@ test_shape_same(void) /* Compare multiple point selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,mult_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(mult_pt_sid); + tmp_sid = H5Scopy(mult_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(mult_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(mult_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,all_sid); + check = H5S_select_shape_same_test(mult_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_sid); + check = H5S_select_shape_same_test(mult_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); + check = H5S_select_shape_same_test(mult_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8391,45 +8337,45 @@ test_shape_same(void) /* Compare single "normal" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_sid); + tmp_sid = H5Scopy(single_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ @@ -8437,7 +8383,7 @@ test_shape_same(void) VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET @@ -8462,7 +8408,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8489,7 +8435,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8505,53 +8451,53 @@ test_shape_same(void) /* Compare single "all" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_all_sid); + tmp_sid = H5Scopy(single_hyper_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,all_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); #ifdef NOT_YET @@ -8576,7 +8522,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8603,7 +8549,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_all_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8619,53 +8565,53 @@ test_shape_same(void) /* Compare single "point" hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_pt_sid); + tmp_sid = H5Scopy(single_hyper_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,all_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_pt_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); + check = H5S_select_shape_same_test(single_hyper_pt_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against scalar "all" hyperslab selection */ @@ -8678,53 +8624,53 @@ test_shape_same(void) /* Compare regular, strided hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,regular_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(regular_hyper_sid); + tmp_sid = H5Scopy(regular_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,all_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against irregular hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,irreg_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Construct point selection which matches regular, strided hyperslab selection */ @@ -8733,8 +8679,8 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ - for(u=2; u<11; u+=2) { - for(v=0; v<2; v++) { + for(u = 2; u < 11; u += 2) { + for(v = 0; v < 2; v++) { coord2[v][0]=u; coord2[v][1]=(v*2)+2; } /* end for */ ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (size_t)2, (const hsize_t *)coord2); @@ -8742,7 +8688,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8758,17 +8704,17 @@ test_shape_same(void) CHECK(ret, FAIL, "H5Sselect_none"); /* Select sequence of rows for hyperslab selection */ - for(u=2; u<11; u+=2) { - start[0]=u; start[1]=3; - stride[0]=1; stride[1]=2; - count[0]=1; count[1]=2; - block[0]=1; block[1]=1; + for(u = 2; u < 11; u += 2) { + start[0] = u; start[1] = 3; + stride[0] = 1; stride[1] = 2; + count[0] = 1; count[1] = 2; + block[0] = 1; block[1] = 1; ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_OR,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8780,15 +8726,15 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select regular, strided hyperslab selection at an offset */ - start[0]=1; start[1]=1; - stride[0]=2; stride[1]=2; - count[0]=5; count[1]=2; - block[0]=1; block[1]=1; + start[0] = 1; start[1] = 1; + stride[0] = 2; stride[1] = 2; + count[0] = 5; count[1] = 2; + block[0] = 1; block[1] = 1; ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_SET,start,stride,count,block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(regular_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -8804,53 +8750,53 @@ test_shape_same(void) /* Compare irregular hyperslab selection to all the selections created */ /* Compare against itself */ - check=H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,irreg_hyper_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(irreg_hyper_sid); + tmp_sid = H5Scopy(irreg_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,all_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "none" selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,none_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against single point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against multiple point selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,mult_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "plain" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "all" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_all_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "single point" single hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,single_hyper_pt_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against regular, strided hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,regular_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Compare against "no" hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,none_hyper_sid); VERIFY(check, FALSE, "H5S_select_shape_same_test"); /* Construct hyperslab selection which matches irregular hyperslab selection */ @@ -8876,7 +8822,7 @@ test_shape_same(void) } /* end for */ /* Compare against hyperslab selection */ - check=H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); + check = H5S_select_shape_same_test(irreg_hyper_sid,tmp_sid); VERIFY(check, TRUE, "H5S_select_shape_same_test"); ret = H5Sclose(tmp_sid); @@ -9042,27 +8988,27 @@ test_shape_same(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_1(): +** test_shape_same_dr__smoke_check_1(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** all of it. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select (10 X 10 X 1) hyper slabs in each, three with -** the slab parallel to the xy plane, three parallel to the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select (10 X 10 X 1) hyper slabs in each, three with +** the slab parallel to the xy plane, three parallel to the ** xz plane, and three parallel to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the full 2 D space against any hyperslab parallel to the -** yz plane in the 3 D space, and FALSE when comparing the +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the full 2 D space against any hyperslab parallel to the +** yz plane in the 3 D space, and FALSE when comparing the ** full 2 D space against the other two hyper slabs. ** -** Also create two additional 3 D data spaces (10 X 10 X 10), -** and select a (10 X 10 X 2) hyper slab parallel to the yz -** axis in one of them, and two parallel (10 X 10 X 1) hyper -** slabs parallel to the yz axis in the other. -** H5S_select_shape_same() should return FALSE when comparing +** Also create two additional 3 D data spaces (10 X 10 X 10), +** and select a (10 X 10 X 2) hyper slab parallel to the yz +** axis in one of them, and two parallel (10 X 10 X 1) hyper +** slabs parallel to the yz axis in the other. +** H5S_select_shape_same() should return FALSE when comparing ** each to the 2 D selection. ** ****************************************************************/ @@ -9333,9 +9279,9 @@ test_shape_same_dr__smoke_check_1(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_2(): +** test_shape_same_dr__smoke_check_2(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** a "checker board" hyper slab as follows: ** ** * * - - * * - - * * @@ -9349,27 +9295,27 @@ test_shape_same_dr__smoke_check_1(void) ** * * - - * * - - * * ** * * - - * * - - * * ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar (10 X 10 X 1) checker board hyper -** slabs in each, three with the slab parallel to the xy -** plane, three parallel to the xz plane, and three parallel +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar (10 X 10 X 1) checker board hyper +** slabs in each, three with the slab parallel to the xy +** plane, three parallel to the xz plane, and three parallel ** to the yz plane. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when comparing -** the 2 D space checker board selection against a checker -** board hyperslab parallel to the yz plane in the 3 D -** space, and FALSE when comparing the 2 D checkerboard -** selection against two hyper slabs parallel to the xy +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when comparing +** the 2 D space checker board selection against a checker +** board hyperslab parallel to the yz plane in the 3 D +** space, and FALSE when comparing the 2 D checkerboard +** selection against two hyper slabs parallel to the xy ** or xz planes. ** -** Also create an additional 3 D data spaces (10 X 10 X 10), -** and select a checker board parallel with the yz axis, -** save with some squares being on different planes. -** H5S_select_shape_same() should return FALSE when +** Also create an additional 3 D data spaces (10 X 10 X 10), +** and select a checker board parallel with the yz axis, +** save with some squares being on different planes. +** H5S_select_shape_same() should return FALSE when ** comparing this selection to the 2 D selection. ** ****************************************************************/ @@ -9652,7 +9598,7 @@ test_shape_same_dr__smoke_check_2(void) start[0] = 4; /* This test gets the right answer, but it fails the shape same - * test in an unexpected point. Bring this up with Quincey, as + * test in an unexpected point. Bring this up with Quincey, as * the oddness looks like it is not related to my code. * -- JRM */ @@ -9741,9 +9687,9 @@ test_shape_same_dr__smoke_check_2(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_3(): +** test_shape_same_dr__smoke_check_3(): ** -** Create a square, 2 D data space (10 X 10), and select an +** Create a square, 2 D data space (10 X 10), and select an ** irregular hyper slab as follows: ** ** y @@ -9759,22 +9705,22 @@ test_shape_same_dr__smoke_check_2(void) ** 0 - - - - - - - - - - ** 0 1 2 3 4 5 6 7 8 9 x ** -** where asterisks indicate selected elements, and dashes +** where asterisks indicate selected elements, and dashes ** indicate unselected elements. ** -** Similarly, create nine, 3 D data spaces (10 X 10 X 10), -** and select similar irregular hyper slabs in each, three -** with the slab parallel to the xy plane, three parallel -** to the xz plane, and three parallel to the yz plane. -** Further, translate the irregular slab in 2/3rds of the +** Similarly, create nine, 3 D data spaces (10 X 10 X 10), +** and select similar irregular hyper slabs in each, three +** with the slab parallel to the xy plane, three parallel +** to the xz plane, and three parallel to the yz plane. +** Further, translate the irregular slab in 2/3rds of the ** cases. ** -** Assuming that z is the fastest changing dimension, -** H5S_select_shape_same() should return TRUE when -** comparing the 2 D irregular hyperslab selection -** against the irregular hyperslab selections parallel -** to the yz plane in the 3 D space, and FALSE when -** comparing it against the irregular hyper slabs +** Assuming that z is the fastest changing dimension, +** H5S_select_shape_same() should return TRUE when +** comparing the 2 D irregular hyperslab selection +** against the irregular hyperslab selections parallel +** to the yz plane in the 3 D space, and FALSE when +** comparing it against the irregular hyper slabs ** selections parallel to the xy or xz planes. ** ****************************************************************/ @@ -10258,9 +10204,9 @@ test_shape_same_dr__smoke_check_3(void) /**************************************************************** ** -** test_shape_same_dr__smoke_check_4(): +** test_shape_same_dr__smoke_check_4(): ** -** Create a square, 2 D data space (10 X 10), and select +** Create a square, 2 D data space (10 X 10), and select ** the entire space. ** ** Similarly, create 3 D and 4 D data spaces: @@ -10281,7 +10227,7 @@ test_shape_same_dr__smoke_check_3(void) ** And select these entire spaces as well. ** ** Compare the 2 D space against all the other spaces -** with H5S_select_shape_same(). The (1 X 10 X 10) & +** with H5S_select_shape_same(). The (1 X 10 X 10) & ** (1 X 1 X 10 X 10) should return TRUE. All others ** should return FALSE. ** @@ -10478,12 +10424,12 @@ test_shape_same_dr__smoke_check_4(void) /**************************************************************** ** ** test_shape_same_dr__full_space_vs_slice(): Tests selection -** of a full n-cube data space vs an n-dimensional slice of -** of an m-cube (m > n) in a call to H5S_select_shape_same(). -** Note that this test does not require the n-cube and the +** of a full n-cube data space vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5S_select_shape_same(). +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10499,7 +10445,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; hid_t n_cube_0_sid; /* the fully selected hyper cube */ hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ @@ -10520,16 +10466,16 @@ test_shape_same_dr__full_space_vs_slice(int test_num, HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 <= offset ); HDassert( offset < large_rank ); - HDassert( edge_size > 0 ); - HDassert( edge_size <= 1000 ); + HDassert( edge_size > 0 ); + HDassert( edge_size <= 1000 ); - sprintf(test_desc_0, - "\tn-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset, (int)dim_selected[0], @@ -10610,27 +10556,27 @@ test_shape_same_dr__full_space_vs_slice(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_full_space_vs_slice_tests(): +** test_shape_same_dr__run_full_space_vs_slice_tests(): ** ** Run the est_shape_same_dr__full_space_vs_slice() test ** over a variety of ranks and offsets. ** -** At present, we test H5S_select_shape_same() with +** At present, we test H5S_select_shape_same() with ** fully selected 1, 2, 3, and 4 cubes as one parameter, and ** 1, 2, 3, and 4 dimensional slices through a n-cube of rank -** no more than 5 (and at least the rank of the slice). -** We stop at rank 5, as Quincey suggested that it would be +** no more than 5 (and at least the rank of the slice). +** We stop at rank 5, as Quincey suggested that it would be ** sufficient. ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank for the fully selected n cube equals the +** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the ** m-cube (m >= n). ** ** 2) The dimensions selected in the slice through the m-cube -** are the dimesnions with the most quickly changing +** are the dimesnions with the most quickly changing ** indices. ** ****************************************************************/ @@ -10736,7 +10682,7 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) dim_selected, expected_result ); - + z++; } while((z < 2) && (large_rank >= 1)); @@ -10759,15 +10705,15 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) /**************************************************************** ** -** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube data space vs +** test_shape_same_dr__checkerboard(): Tests selection of a +** "checker board" subset of a full n-cube data space vs ** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional ** spaces. @@ -10784,14 +10730,14 @@ test_shape_same_dr__checkerboard(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; int dims_selected = 0; - hid_t n_cube_0_sid; /* the checker board selected - * hyper cube + hid_t n_cube_0_sid; /* the checker board selected + * hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a - * checkerboard slice is selected + hid_t n_cube_1_sid; /* the hyper cube in which a + * checkerboard slice is selected */ hsize_t dims[SS_DR_MAX_RANK]; hsize_t base_start[2]; @@ -10813,8 +10759,8 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); HDassert( 0 < checker_size ); - HDassert( checker_size <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( checker_size <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= offset ); HDassert( offset < (int)edge_size ); @@ -10825,13 +10771,13 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, (int)edge_size, (int)checker_size, @@ -10871,17 +10817,17 @@ test_shape_same_dr__checkerboard(int test_num, * * * - - * * - - * * * * * - - * * - - * * * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * 3-D and 4-D ascii art is somewhat painful, so I'll * leave those selections to your imagination. :-) * * Note, that since the edge_size and checker_size are - * parameters that are passed in, the selection need + * parameters that are passed in, the selection need * not look exactly like the selection shown above. - * At present, the function allows checker sizes that - * are not even divisors of the edge size -- thus + * At present, the function allows checker sizes that + * are not even divisors of the edge size -- thus * something like the following is also possible: * * * * * - - - * * * - @@ -10895,14 +10841,14 @@ test_shape_same_dr__checkerboard(int test_num, * * * * - - - * * * - * - - - * * * - - - * * - * As the above pattern can't be selected in one + * As the above pattern can't be selected in one * call to H5Sselect_hyperslab(), and since the * values in the start, stride, count, and block - * arrays will be repeated over all entries in + * arrays will be repeated over all entries in * the selected space case, and over all selected * dimensions in the selected hyperslab case, we - * compute these values first and store them in - * in the base_start, base_stride, base_count, + * compute these values first and store them in + * in the base_start, base_stride, base_count, * and base_block arrays. */ @@ -10912,9 +10858,9 @@ test_shape_same_dr__checkerboard(int test_num, base_stride[0] = 2 * checker_size; base_stride[1] = 2 * checker_size; - /* Note that the following computation depends on the C99 - * requirement that integer division discard any fraction - * (truncation towards zero) to function correctly. As we + /* Note that the following computation depends on the C99 + * requirement that integer division discard any fraction + * (truncation towards zero) to function correctly. As we * now require C99, this shouldn't be a problem, but noting * it may save us some pain if we are ever obliged to support * pre-C99 compilers again. @@ -10931,7 +10877,7 @@ test_shape_same_dr__checkerboard(int test_num, base_block[0] = checker_size; base_block[1] = checker_size; - /* now setup start, stride, count, and block arrays for + /* now setup start, stride, count, and block arrays for * the first call to H5Sselect_hyperslab(). */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -10945,10 +10891,10 @@ test_shape_same_dr__checkerboard(int test_num, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* if small_rank == 1, or if edge_size == checker_size, we + /* if small_rank == 1, or if edge_size == checker_size, we * are done, as either there is no added dimension in which * to place offset selected "checkers". - * + * * Otherwise, set up start, stride, count and block, and * make the additional selection. */ @@ -10968,7 +10914,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Some how, it seems that selections can extend beyond the + * Some how, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -10991,8 +10937,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Now select the checkerboard selection in the (possibly larger) n-cube. - * - * Since we have already calculated the base start, stride, count, + * + * Since we have already calculated the base start, stride, count, * and block, re-use the values in setting up start, stride, count, * and block. */ @@ -11036,10 +10982,10 @@ test_shape_same_dr__checkerboard(int test_num, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* As before, if the number of dimensions selected is less than or - * equal to 1, or if edge_size == checker_size, we are done, as - * either there is no added dimension in which to place offset selected - * "checkers", or the hyperslab is completely occupied by one + /* As before, if the number of dimensions selected is less than or + * equal to 1, or if edge_size == checker_size, we are done, as + * either there is no added dimension in which to place offset selected + * "checkers", or the hyperslab is completely occupied by one * "checker". * * Otherwise, set up start, stride, count and block, and @@ -11069,7 +11015,7 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * - * Again, it seems that selections can extend beyond the + * Again, it seems that selections can extend beyond the * boundaries of the target data space -- hence the following * code to manually clip the selection back to the data space * proper. @@ -11102,23 +11048,23 @@ test_shape_same_dr__checkerboard(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_checkerboard_tests(): +** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as -** one parameter, and 1, 2, 3, and 4 dimensional checkerboard -** slices through a n-cube of rank no more than 5 (and at -** least the rank of the slice). +** In this set of tests, we test H5S_select_shape_same() +** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as +** one parameter, and 1, 2, 3, and 4 dimensional checkerboard +** slices through a n-cube of rank no more than 5 (and at +** least the rank of the slice). ** -** All the n-cubes will have lengths of the same size, so +** All the n-cubes will have lengths of the same size, so ** H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the checker board slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the checker board slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the checkerboard slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the checkerboard slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11169,7 +11115,7 @@ test_shape_same_dr__run_checkerboard_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11373,17 +11319,17 @@ test_shape_same_dr__run_checkerboard_tests(void) /**************************************************************** ** -** test_shape_same_dr__irregular(): +** test_shape_same_dr__irregular(): ** -** Tests selection of an "irregular" subset of a full +** Tests selection of an "irregular" subset of a full ** n-cube data space vs an identical "irregular" subset ** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5S_select_shape_same(). ** -** Note that this test does not require the n-cube and the +** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if -** they don't). +** H5S_select_shape_same() should always return FALSE if +** they don't). ** ****************************************************************/ static void @@ -11396,7 +11342,7 @@ test_shape_same_dr__irregular(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int edge_size = 10; int i; int j; @@ -11405,7 +11351,7 @@ test_shape_same_dr__irregular(int test_num, hid_t n_cube_0_sid; /* the hyper cube containing * an irregular selection */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * slice contains an irregular * selection. */ @@ -11441,7 +11387,7 @@ test_shape_same_dr__irregular(int test_num, hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t *(starts[SS_DR_MAX_RANK]) = + hsize_t *(starts[SS_DR_MAX_RANK]) = {start_0, start_1, start_2, start_3, start_4}; hsize_t *(strides[SS_DR_MAX_RANK]) = {stride_0, stride_1, stride_2, stride_3, stride_4}; @@ -11464,8 +11410,8 @@ test_shape_same_dr__irregular(int test_num, HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); HDassert( large_rank <= SS_DR_MAX_RANK ); - HDassert( 9 <= edge_size ); - HDassert( edge_size <= 1000 ); + HDassert( 9 <= edge_size ); + HDassert( edge_size <= 1000 ); HDassert( 0 <= slice_offset ); HDassert( slice_offset < edge_size ); HDassert( -2 <= pattern_offset ); @@ -11478,16 +11424,16 @@ test_shape_same_dr__irregular(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, - "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", + sprintf(test_desc_0, + "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + sprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, - edge_size, + edge_size, slice_offset, pattern_offset, (int)dim_selected[0], (int)dim_selected[1], @@ -11506,11 +11452,11 @@ test_shape_same_dr__irregular(int test_num, CHECK(n_cube_0_sid, FAIL, "H5Screate_simple"); /* Select an "irregular" pattern in the small n-cube. This - * pattern can be though of a set of four 3 x 2 x 2 X 2 - * four dimensional prisims, each parallel to one of the - * axies and none of them intersecting with the other. + * pattern can be though of a set of four 3 x 2 x 2 X 2 + * four dimensional prisims, each parallel to one of the + * axies and none of them intersecting with the other. * - * In the lesser dimensional cases, this 4D pattern is + * In the lesser dimensional cases, this 4D pattern is * projected onto the lower dimensional space. * * In the 1-D case, the projection of the pattern looks @@ -11535,12 +11481,12 @@ test_shape_same_dr__irregular(int test_num, * 0 - - - - - - - - - - * 0 1 2 3 4 5 6 7 8 9 x * - * In both cases, asterisks indicate selected elements, + * In both cases, asterisks indicate selected elements, * and dashes indicate unselected elements. * * Note that is this case, since the edge size is fixed, - * the pattern does not change. However, we do use the - * displacement parameter to allow it to be moved around + * the pattern does not change. However, we do use the + * displacement parameter to allow it to be moved around * within the n-cube or hyper slab. */ @@ -11555,7 +11501,7 @@ test_shape_same_dr__irregular(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ - /* finally, clip the selection to ensure that it lies fully + /* finally, clip the selection to ensure that it lies fully * within the n-cube. */ ret = H5Sselect_hyperslab(n_cube_0_sid, H5S_SELECT_AND, @@ -11594,8 +11540,8 @@ test_shape_same_dr__irregular(int test_num, /* Now select the irregular selection in the (possibly larger) n-cube. - * - * Basic idea is to project the pattern used in the smaller n-cube + * + * Basic idea is to project the pattern used in the smaller n-cube * onto the dimensions selected in the larger n-cube, with the displacement * specified. */ @@ -11648,25 +11594,25 @@ test_shape_same_dr__irregular(int test_num, /**************************************************************** ** -** test_shape_same_dr__run_irregular_tests(): +** test_shape_same_dr__run_irregular_tests(): ** -** In this set of tests, we test H5S_select_shape_same() -** with an "irregular" subselection of 1, 2, 3, and 4 cubes as -** one parameter, and irregular subselections of 1, 2, 3, -** and 4 dimensional slices through a n-cube of rank no more -** than 5 (and at least the rank of the slice) as the other. -** Note that the "irregular" selection may be offset between +** In this set of tests, we test H5S_select_shape_same() +** with an "irregular" subselection of 1, 2, 3, and 4 cubes as +** one parameter, and irregular subselections of 1, 2, 3, +** and 4 dimensional slices through a n-cube of rank no more +** than 5 (and at least the rank of the slice) as the other. +** Note that the "irregular" selection may be offset between ** the n-cube and the slice. ** ** All the irregular selections will be identical (modulo rank) ** so H5S_select_shape_same() should return true iff: ** -** 1) the rank of the n cube equals the number of dimensions -** selected in the irregular slice through the m-cube +** 1) the rank of the n cube equals the number of dimensions +** selected in the irregular slice through the m-cube ** (m >= n). ** -** 2) The dimensions selected in the irregular slice -** through the m-cube are the dimensions with the most +** 2) The dimensions selected in the irregular slice +** through the m-cube are the dimensions with the most ** quickly changing indices. ** ****************************************************************/ @@ -11717,7 +11663,7 @@ test_shape_same_dr__run_irregular_tests(void) dim_selected[4] = FALSE; else dim_selected[4] = TRUE; - + /* compute the expected result: */ i = 0; @@ -11863,8 +11809,8 @@ test_shape_same_dr__run_irregular_tests(void) /**************************************************************** ** -** test_shape_same_dr(): Tests selections on dataspace with -** different ranks, to verify that "shape same" routine +** test_shape_same_dr(): Tests selections on dataspace with +** different ranks, to verify that "shape same" routine ** is now handling this case correctly. ** ****************************************************************/ diff --git a/test/tsohm.c b/test/tsohm.c index 93ba14f..4329514 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -11,13 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*********************************************************** -* -* Test program: tsohm -* -* Test Shared Object Header Messages -* -*************************************************************/ +/* + * Purpose: Test Shared Object Header Messages + */ #include "testhdf5.h" @@ -25,9 +21,9 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* suppress error about including H5Fpkg */ #define H5F_TESTING -#include "H5Fpkg.h" /* File access */ +#include "H5Fpkg.h" /* File access */ /* Default SOHM values */ #define DEF_NUM_INDEXES 0 @@ -178,14 +174,11 @@ static void test_sohm_extlink(void); /**************************************************************** ** -** verify_fcpl_values(): Helper function for test_sohm_fcpl. -** Verifies that the *_in and *_out parameters are equal. +** verify_fcpl_values(): Verifies that FCPL is set as expected. ** ****************************************************************/ static void -verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, - const unsigned *flags_expected, const unsigned *minsizes_expected, - unsigned l2b, unsigned b2l) +verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, const unsigned *flags_expected, const unsigned *minsizes_expected, unsigned l2b, unsigned b2l) { unsigned nindexes_actual; unsigned list_size; @@ -197,6 +190,7 @@ verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, ret = H5Pget_shared_mesg_nindexes(fcpl_id, &nindexes_actual); CHECK_I(ret, "H5Pget_shared_mesg_nindexes"); VERIFY(nindexes_actual, nindexes_expected, "H5Pget_shared_mesg_nindexes"); + /* Index flags and minsizes */ for(x=0; x<nindexes_actual; ++x) { unsigned flags_i; @@ -223,11 +217,11 @@ verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected, static void test_sohm_fcpl(void) { - hid_t fid = -1; - hid_t fcpl_id = -1; - hid_t fcpl2_id = -1; - unsigned x; - herr_t ret; /* Generic return value */ + hid_t fid = -1; + hid_t fcpl_id = -1; + hid_t fcpl2_id = -1; + unsigned x; + herr_t ret; MESSAGE(5, ("Testing File Creation Properties for Shared Messages\n")); @@ -320,9 +314,8 @@ test_sohm_fcpl(void) CHECK_I(ret, "H5Fclose"); /* Actually, the list max can be exactly 1 greater than the - * btree min, but no more. Also, the errors above shouldn't - * have corrupted the fcpl, although we do need to reset the - * second index that we changed above. + * btree min, but no more. + * Reset the second index. */ ret = H5Pset_shared_mesg_index(fcpl_id, 1, test_type_flags[1], 15); CHECK_I(ret, "H5Pset_shared_mesg_index"); @@ -333,9 +326,10 @@ test_sohm_fcpl(void) ret = H5Fclose(fid); CHECK_I(ret, "H5Fclose"); - /* Test edge cases; H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be - * valid values. Also, creating a file with uninitialized indexes - * (indexes 3-5) should work. + /* Test edge cases: + * H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be valid + * values. + * Creating a file with uninitialized indexes should work. (TODO: not implemented?) */ ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); @@ -344,7 +338,6 @@ test_sohm_fcpl(void) fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); CHECK_I(fid, "H5Fcreate"); - /* Clean up */ ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); @@ -352,7 +345,6 @@ test_sohm_fcpl(void) CHECK_I(ret, "H5Fclose"); } /* test_sohm_fcpl */ - /**************************************************************** ** @@ -385,7 +377,6 @@ test_sohm_fcpl_errors(void) verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L); - /* Test giving bogus values to H5P* functions */ H5E_BEGIN_TRY { /* Trying to create too many indexes should fail */ ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES + 1); @@ -484,7 +475,7 @@ error: H5Tclose(dtype1_id); } H5E_END_TRY return -1; -} /* make_dtype_1 */ +} /* make_dtype1 */ /*------------------------------------------------------------------------- @@ -587,12 +578,12 @@ error: * * Purpose: Creates object headers that use a large datatype message. * - * Set test_file_closing to 1 to add file closing and reopening + * Set test_file_closing to TRUE to add file closing and reopening * whenever possible (to test that SOHMs are written correctly * on disk and not just in memory). * - * Return: Success: file ID (may not be the same one passed in) - * Failure: Negative + * Return: Success: file ID (may not be the same one passed in) + * Failure: H5I_INVALID_HID * * Programmer: James Laird * Monday, April 10, 2006 @@ -600,13 +591,13 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; - hid_t dtype1_id = -1; - hid_t space_id = -1; - hid_t dset_id = -1; + hid_t dtype1_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; hsize_t dim1[1]; int x; @@ -626,12 +617,12 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos HDmemset(&rdata, 0, sizeof(rdata)); \ if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \ H5_FAILED(); AT(); \ - printf("Can't read data\n"); \ + HDprintf("Can't read data\n"); \ goto error; \ } \ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \ H5_FAILED(); AT(); \ - printf("incorrect read data\n"); \ + HDprintf("incorrect read data\n"); \ goto error; \ } \ } /* TSOHM_S1H_VERIFY_DATA() definition */ @@ -640,7 +631,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos * local disks. Don't close and reopen if express testing is enabled. */ if(GetTestExpress() > 1) - test_file_closing = 0; + test_file_closing = FALSE; /* Intialize wdata */ HDmemset(&wdata, 0, sizeof(wdata)); @@ -658,17 +649,18 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos /* Intialize rdata */ HDmemset(&rdata, 0, sizeof(rdata)); - if((dtype1_id = make_dtype_1()) < 0) TEST_ERROR + dtype1_id = make_dtype_1(); + if(dtype1_id < 0) TEST_ERROR - /* Create the dataspace and dataset */ dim1[0] = 1; - if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) TEST_ERROR + space_id = H5Screate_simple(1, dim1, NULL); + if(space_id < 0) TEST_ERROR - if((dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + dset_id = H5Dcreate2(file, DSETNAME[0], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_id < 0) FAIL_STACK_ERROR /* Test writing and reading */ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR - TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id) if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR @@ -702,7 +694,8 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos * this increases the amount of space saved by sharing the datatype message */ for(x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) { - if((dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset_id < 0) TEST_ERROR if(H5Dclose(dset_id) < 0) TEST_ERROR if(test_file_closing) @@ -721,6 +714,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos if(H5Dclose(dset_id) < 0) TEST_ERROR if(H5Tclose(dtype1_id) < 0) TEST_ERROR + return file; error: @@ -730,7 +724,8 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos H5Dclose(dset_id); H5Fclose(file); } H5E_END_TRY - return -1; + + return H5I_INVALID_HID; #undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */ } /* size1_helper */ @@ -747,25 +742,30 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos *---------------------------------------------------------------------------- */ static h5_stat_size_t -getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned open_close, H5O_info_t *oinfo) +getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, + hbool_t test_file_closing, H5O_info_t *oinfo) { - hid_t file = -1; + hid_t fid = H5I_INVALID_HID; herr_t ret; - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, open_close); - CHECK_I(file, "size1_helper"); + /* If test_file_closing is TRUE, you will get back a different ID, + * which will need to be closed. The helper will close your passed-in + * ID. + */ + fid = size1_helper(fid, filename, fapl_id, test_file_closing); + CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - return h5_get_file_size(FILENAME, fapl_id); -} /* getsize_testsize1 */ + return h5_get_file_size(filename, fapl_id); +} /* getsize_testsize1() */ /*------------------------------------------------------------------------- @@ -787,13 +787,14 @@ test_sohm_size1(void) unsigned use_shared = 0; unsigned use_btree = 0; - unsigned open_close = 0; h5_stat_size_t file_sizes[9]; unsigned size_index = 0; hsize_t oh_sizes[3]; unsigned oh_size_index = 0; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ hsize_t norm_oh_size; +#endif /* Jira HDFFV-10646 */ hsize_t sohm_oh_size; hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; @@ -819,7 +820,6 @@ test_sohm_size1(void) /* Create a FAPL with "semi" close degree, to detect dangling IDs */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); CHECK_I(fapl_id, "H5Pcreate"); - ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI); CHECK_I(ret, "H5Pset_fclose_degree"); @@ -829,6 +829,7 @@ test_sohm_size1(void) for (use_shared = 0; use_shared < 2; use_shared++) { for (use_btree = 0; use_btree < 2; use_btree++) { + hbool_t test_open_close; /* cannot use btree indexing without shared messages; skip case */ if (use_btree && !use_shared) @@ -864,8 +865,10 @@ test_sohm_size1(void) file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id); /* size of populated file, with different populating behaviors */ - for (open_close = 0; open_close < 2; open_close++) - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, open_close, &oinfo); + test_open_close = TRUE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + test_open_close = FALSE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); oh_sizes[oh_size_index++] = oinfo.hdr.space.total; ret = H5Pclose(fcpl_id); @@ -890,7 +893,9 @@ test_sohm_size1(void) norm_empty_filesize = file_sizes[0]; norm_final_filesize = file_sizes[1]; norm_final_filesize2 = file_sizes[2]; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ norm_oh_size = oh_sizes[0]; +#endif /* Jira HDFFV-10646 */ sohm_empty_filesize = file_sizes[3]; sohm_final_filesize = file_sizes[4]; @@ -928,16 +933,16 @@ test_sohm_size1(void) VERIFY(sohm_btree_empty_filesize, 1, "h5_get_file_size"); /* When full, the sohm btree file should be smaller than the normal file. - * The sohm list file should be at least as small, since it doesn't need the - * overhead of a B-tree. + * The sohm list file should be at least as small, since it doesn't need + * the overhead of a B-tree. */ if(sohm_btree_final_filesize >= norm_final_filesize) VERIFY(sohm_btree_final_filesize, 1, "h5_get_file_size"); if(sohm_final_filesize > sohm_btree_final_filesize) VERIFY(sohm_final_filesize, 1, "h5_get_file_size"); - /* Comparative sizes shouldn't change even if we open and close the file */ - + /* Comparative sizes shouldn't change even if we open and close the file + */ if(sohm_btree_final_filesize2 >= norm_final_filesize2) VERIFY(sohm_btree_final_filesize2, 1, "h5_get_file_size"); if(sohm_final_filesize2 > sohm_btree_final_filesize2) @@ -946,7 +951,7 @@ test_sohm_size1(void) } /* test_sohm_size1 */ -/*------------------------------------------------------------------------- +/*--------------------------------------------------------------------------- * Function: test_sohm_size_consistency_open_create * * Purpose: Tests that header size is different depending on file open @@ -957,8 +962,9 @@ test_sohm_size1(void) * Programmer: Jacob Smith * 2018 November 1 * - *------------------------------------------------------------------------- + *--------------------------------------------------------------------------- */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ static void test_sohm_size_consistency_open_create(void) { @@ -976,7 +982,8 @@ test_sohm_size_consistency_open_create(void) unsigned btree_min = 10; herr_t ret; - MESSAGE(5, ("Testing that header size is consistent between H5Fopen and H5Fcreate\n")); + MESSAGE(5, \ + ("Testing that header size is consistent between H5Fopen and H5Fcreate\n")); /* Create a FAPL with "semi" close degree, to detect dangling IDs */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); @@ -1013,11 +1020,11 @@ test_sohm_size_consistency_open_create(void) * Add messages to previously-created file */ file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id); CHECK_I(file, "H5Fopen"); - file = size1_helper(file, FILENAME, fapl_id, 0); + file = size1_helper(file, FILENAME, fapl_id, FALSE); CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK_I(ret, "H5Oget_info_by_name"); oh_size_open = oinfo.hdr.space.total; @@ -1028,7 +1035,7 @@ test_sohm_size_consistency_open_create(void) * Add messages to a newly-created file */ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); CHECK_I(file, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, 0); + file = size1_helper(file, FILENAME, fapl_id, FALSE); CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ @@ -1048,6 +1055,7 @@ test_sohm_size_consistency_open_create(void) ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); } /* test_sohm_size_consistency_open_create */ +#endif /* Jira HDFFV-10645 */ /*------------------------------------------------------------------------- @@ -1131,7 +1139,7 @@ sohm_attr_helper(hid_t fcpl_id) ret = H5Gclose(group_id); CHECK_I(ret, "H5Gclose"); ret = H5Tclose(type_id); - CHECK_I(ret, "H5Tclose") + CHECK_I(ret, "H5Tclose"); /* Flush the file to force data to be written */ ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL); @@ -1178,7 +1186,8 @@ sohm_attr_helper(hid_t fcpl_id) static void test_sohm_attrs(void) { - hid_t fcpl_id; + hid_t bad_fid = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; unsigned i = 0; #define TSOHM_TSA_NFLAGS_1 7 unsigned flags1[TSOHM_TSA_NFLAGS_1] = { @@ -1238,7 +1247,8 @@ test_sohm_attrs(void) MESSAGE(5, ("Testing that shared messages work with attributes\n")); - /* No shared messages */ + /* No shared messages + */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); CHECK_I(fcpl_id, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0); @@ -1295,8 +1305,8 @@ test_sohm_attrs(void) ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - VERIFY(ret, -1, "H5Fcreate"); + bad_fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(bad_fid, H5I_INVALID_HID, "H5Fcreate"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); @@ -1328,7 +1338,6 @@ test_sohm_attrs(void) } /* test_sohm_attrs */ - /*------------------------------------------------------------------------- * Function: size2_verify_plist1 @@ -1386,7 +1395,7 @@ size2_verify_plist1(hid_t plist) ret = H5Pget_fill_value(plist, dtype1_id, &fill1); CHECK_I(ret, "H5Pget_fill_value"); - ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); + ret = HDmemcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype1_id); @@ -1485,15 +1494,15 @@ size2_verify_plist2(hid_t plist) static void size2_dump_struct(const char *name, size2_helper_struct *sizes) { - puts(name); - printf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); - printf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); - printf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); - printf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); - printf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); - printf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); - printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); - printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); + HDputs(name); + HDprintf(" empty size: %llu\n", (unsigned long long)sizes->empty_size); + HDprintf(" first dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->first_dset, (unsigned long long)(sizes->first_dset - sizes->empty_size)); + HDprintf("second dataset: %llu \tdelta: %llu\n", (unsigned long long)sizes->second_dset, (unsigned long long)(sizes->second_dset - sizes->first_dset)); + HDprintf(" dsets 1: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets1, (unsigned long long)(sizes->dsets1 - sizes->second_dset)); + HDprintf(" dsets 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->dsets2, (unsigned long long)(sizes->dsets2 - sizes->dsets1)); + HDprintf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2)); + HDprintf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved)); + HDprintf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1)); } /* size2_dump_struct */ #endif /* NOT_NOW */ @@ -1715,7 +1724,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size group_id = H5Gopen2(file_id, "group", H5P_DEFAULT); CHECK_I(group_id, "H5Gopen2"); } - } /* for each dataset */ + } /* Close file and get its size now */ ret = H5Gclose(group_id); @@ -1732,7 +1741,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(group_id, "H5Gcreate2"); /* Create NUM_DATASETS datasets in the new group */ - for(x=0; x<NUM_DATASETS; x+=2) { + for(x=0; x<NUM_DATASETS; x+=2) + { dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype1_id, dspace1_id, H5P_DEFAULT, dcpl1_id, H5P_DEFAULT); CHECK_I(dset_id, "H5Dcreate2"); @@ -1768,7 +1778,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); CHECK_I(group_id, "H5Gopen2"); } - } /* for each even dataset */ + } /* Close file and get its size now */ ret = H5Gclose(group_id); @@ -1810,7 +1820,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size group_id = H5Gopen2(file_id, "group", H5P_DEFAULT); CHECK_I(group_id, "H5Gopen2"); } - } /* for each attribute */ + } /* Close file and get its size now */ ret = H5Gclose(group_id); @@ -1826,7 +1836,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); CHECK_I(group_id, "H5Gopen2"); - for(x=0; x<NUM_ATTRIBUTES; ++x) { + for(x=0; x<NUM_ATTRIBUTES; ++x) + { /* Create the same name and value for each attribute as before */ attr_string1[0] = attr_name[0] = (char)((x / 10) + '0'); attr_string1[1] = attr_name[1] = (char)((x % 10) + '0'); @@ -1849,8 +1860,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); CHECK_I(group_id, "H5Gopen2"); } - } /* for each attribute */ - + } /* Close file and get its size now */ ret = H5Gclose(group_id); CHECK_I(ret, "H5Gclose"); @@ -2068,7 +2078,7 @@ size2_verify(void) CHECK_I(attr1_id, "H5Aclose"); ret = H5Aclose(attr2_id); CHECK_I(attr2_id, "H5Aclose"); - } /* for each attribute */ + } /* Close everything */ ret = H5Tclose(attr_type_id); @@ -2697,7 +2707,7 @@ test_sohm_size2(int close_reopen) VERIFY(0, 1, "h5_get_file_size"); 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() */ +} /* test_sohm_size2 */ /*------------------------------------------------------------------------- @@ -2716,21 +2726,19 @@ test_sohm_size2(int close_reopen) static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x) { - hid_t dset_id = -1; - hid_t attr_id = -1; - char wdata; + hid_t dset_id = -1; + hid_t attr_id = -1; + char wdata; herr_t ret; dset_id = H5Dcreate2(file_id, DSETNAME[x], H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, dcpl_id[x], H5P_DEFAULT); CHECK_I(dset_id, "H5Dcreate2"); - wdata = (char)(x + 'a'); ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata); CHECK_I(ret, "H5Dwrite"); attr_id = H5Acreate2(dset_id, "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, H5P_DEFAULT); CHECK_I(attr_id, "H5Acreate2"); - ret = H5Awrite(attr_id, H5T_NATIVE_CHAR, &wdata); CHECK_I(ret, "H5Awrite"); @@ -2764,7 +2772,6 @@ delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT); CHECK_I(dset_id, "H5Dopen2"); - rdata = '\0'; ret = H5Dread(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &rdata); CHECK_I(ret, "H5Dread"); @@ -2772,13 +2779,11 @@ delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT); CHECK_I(attr_id, "H5Aopen"); - rdata = '\0'; ret = H5Aread(attr_id, H5T_NATIVE_CHAR, &rdata); CHECK_I(ret, "H5Dread"); VERIFY(rdata, (x + 'a'), "H5Dread"); - /* Cleanup */ ret = H5Aclose(attr_id); CHECK_I(ret, "H5Aclose"); ret = H5Dclose(dset_id); @@ -3019,7 +3024,7 @@ test_sohm_delete(void) ret = H5Pclose(dcpl_id[x]); CHECK_I(ret, "H5Pclose"); } /* end for */ -} /* end test_sohm_delete() */ +} /* test_sohm_delete */ /*------------------------------------------------------------------------- @@ -3348,7 +3353,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) hsize_t out_dims[2]; hsize_t out_maxdims[2]; int x; - int old_nerrs; /* Number of errors when entering this routine */ + int old_nerrs; /* Number of errors when entering this routine */ herr_t ret; hsize_t *space_dims[3]; @@ -3454,28 +3459,25 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) CHECK_I(orig_space_id, "H5Screate_simple"); dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset1_id, "H5Dcreate2"); - if(close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1); /* Create another dataset starting with the same dataspace */ dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset2_id, "H5Dcreate2"); - - if(close_reopen) + if (close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2); /* Create a third dataset with the same dataspace */ dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset3_id, "H5Dcreate2"); - - if(close_reopen) + if (close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); /* Extend the first dataset */ ret = H5Dset_extent(dset1_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) + if (close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); space_dims[0] = dims2; @@ -3495,7 +3497,6 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) /* Extend the third dataset */ ret = H5Dset_extent(dset3_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if(close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); @@ -3550,13 +3551,13 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) */ dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT); CHECK_I(dset3_id, "H5Dcreate2"); - if (close_reopen) + if(close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); /* Extend the third dataset */ ret = H5Dset_extent(dset3_id, dims2); CHECK_I(ret, "H5Dset_extent"); - if (close_reopen) + if(close_reopen) TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3); TSOHM_VDE_VERIFY_SPACES(space_dims); @@ -3577,7 +3578,7 @@ verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen) ret = H5Pclose(dcpl_id); CHECK_I(ret, "H5Pclose"); - /* Complaini if this test generated errors */ + /* Complain if this test generated errors */ if(old_nerrs == GetTestNumErrs()) return(0); else @@ -3790,12 +3791,11 @@ test_sohm_external_dtype(void) ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig); CHECK_I(ret, "H5Dwrite"); + /* Close references to the first file */ ret = H5Dclose(dataset2); CHECK_I(ret, "H5Dclose"); - ret = H5Tclose(dset1_tid); CHECK_I(ret, "H5Tclose"); - ret = H5Fclose(file1); CHECK_I(ret, "H5Fclose"); @@ -3809,13 +3809,11 @@ test_sohm_external_dtype(void) dtype_class = H5Tget_class(dset2_tid); VERIFY(dtype_class, H5T_COMPOUND, "H5Tget_class"); + /* Cleanup */ ret = H5Tclose(dset2_tid); CHECK_I(ret, "H5Tclose"); - ret = H5Dclose(dataset2); CHECK_I(ret, "H5Dclose"); - - /* Cleanup */ ret = H5Sclose(space); CHECK_I(ret, "H5Sclose"); ret = H5Tclose(s1_tid); @@ -3838,7 +3836,7 @@ test_sohm(void) { MESSAGE(5, ("Testing Shared Object Header Messages\n")); - test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl(); /* Test SOHMs and file creation plists */ test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ test_sohm_size1(); /* Tests the sizes of files with one SOHM */ #if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ @@ -3856,17 +3854,17 @@ test_sohm(void) test_sohm_extend_dset(); /* Test extending shared datasets */ test_sohm_external_dtype(); /* Test using datatype in another file */ -} /* test_sohm() */ +} /* test_sohm */ /*------------------------------------------------------------------------- - * Function: cleanup_sohm + * Function: cleanup_sohm * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: James Laird + * Programmer: James Laird * October 9, 2006 * * Modifications: @@ -3876,8 +3874,8 @@ test_sohm(void) void cleanup_sohm(void) { - remove(FILENAME); - remove(FILENAME_SRC); - remove(FILENAME_DST); + HDremove(FILENAME); + HDremove(FILENAME_SRC); + HDremove(FILENAME_DST); } /* cleanup_sohm */ diff --git a/test/tunicode.c b/test/tunicode.c index 5a60036..255dc50 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -854,7 +854,7 @@ void test_unicode(void) */ void cleanup_unicode(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/vds_env.c b/test/vds_env.c index 1c2dba9..bd1e3ee 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -22,7 +22,7 @@ const char *FILENAME[] = { "vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", - "vds_env_%%_src2", + "vds_env%%_src2", NULL }; @@ -130,11 +130,14 @@ test_vds_prefix_second(unsigned config, hid_t fapl) /* Create source file if requested */ if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } else { srcfile[0] = vfile; @@ -211,11 +214,14 @@ test_vds_prefix_second(unsigned config, hid_t fapl) /* Reopen srcdset and srcfile if config option specified */ if(config & TEST_IO_CLOSE_SRC) { if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); + if(NULL == HDgetcwd(buffer, 1024)) + TEST_ERROR + if(HDchdir(TMPDIR) < 0) + TEST_ERROR if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - HDchdir(buffer); + if(HDchdir(buffer) < 0) + TEST_ERROR } if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 7db99de..0726da2 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -15,32 +15,32 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) +set (VFD_LIST + sec2 + stdio + core + split + multi + family +) - set (H5P_VFD_TESTS - t_pflush1 - t_pflush2 - ) +set (H5P_VFD_TESTS + t_pflush1 + t_pflush2 +) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") endforeach () - macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - foreach (h5_test ${H5P_VFD_TESTS}) - add_test ( +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + foreach (h5_test ${H5P_VFD_TESTS}) + add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -51,16 +51,22 @@ endforeach () -D "TEST_OUTPUT=${vfdname}-${h5_test}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} - ) - endforeach () - endif () - endmacro () + ) + set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} + ) + endforeach () + endif () +endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## - # Run test with different Virtual File Driver - foreach (h5_vfd ${VFD_LIST}) - ADD_VFD_TEST (${h5_vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (h5_vfd ${VFD_LIST}) + ADD_VFD_TEST (${h5_vfd} 0) +endforeach () diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 4bc1526..8dc4282 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -158,7 +158,7 @@ static hbool_t print_int_type(h5tools_str_t *buffer, hid_t type, int ind); static hbool_t print_float_type(h5tools_str_t *buffer, hid_t type, int ind); static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); - + /*------------------------------------------------------------------------- * Function: usage * @@ -237,7 +237,6 @@ usage (void) PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n"); } - /*------------------------------------------------------------------------- * Function: print_string @@ -315,7 +314,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) return nprint; } - + /*------------------------------------------------------------------------- * Function: print_obj_name * @@ -364,7 +363,7 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_native_type * @@ -489,7 +488,7 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_ieee_type * @@ -527,7 +526,7 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_precision * @@ -619,7 +618,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) } } - + /*------------------------------------------------------------------------- * Function: print_int_type * @@ -693,7 +692,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_float_type * @@ -807,7 +806,7 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_cmpd_type * @@ -860,7 +859,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_enum_type * @@ -985,7 +984,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_string_type * @@ -1086,7 +1085,7 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_reference_type * @@ -1124,7 +1123,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_opaque_type * @@ -1160,7 +1159,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_vlen_type * @@ -1190,7 +1189,7 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*--------------------------------------------------------------------------- * Purpose: Print information about an array type * @@ -1237,7 +1236,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_bitfield_type * @@ -1345,7 +1344,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) (unsigned long)H5Tget_size(type), (unsigned)data_class); } - + /*------------------------------------------------------------------------- * Function: dump_dataset_values * @@ -1475,7 +1474,7 @@ dump_dataset_values(hid_t dset) PRINTVALSTREAM(rawoutstream, "\n"); } - + /*------------------------------------------------------------------------- * Function: list_attr * @@ -1662,7 +1661,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain return 0; } - + /*------------------------------------------------------------------------- * Function: dataset_list1 * @@ -1727,7 +1726,7 @@ dataset_list1(hid_t dset) return 0; } - + /*------------------------------------------------------------------------- * Function: dataset_list2 * @@ -1962,7 +1961,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) return 0; } /* end dataset_list2() */ - + /*------------------------------------------------------------------------- * Function: datatype_list2 * @@ -2004,7 +2003,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) return 0; } - + /*------------------------------------------------------------------------- * Function: list_obj * @@ -2160,7 +2159,7 @@ done: } /* end list_obj() */ - + /*------------------------------------------------------------------------- * Function: list_lnk * @@ -2354,7 +2353,7 @@ done: return 0; } /* end list_lnk() */ - + /*------------------------------------------------------------------------- * Function: visit_obj * @@ -2434,7 +2433,7 @@ done: return retval; } - + /*------------------------------------------------------------------------- * Function: get_width * @@ -2550,7 +2549,7 @@ out: return ret; } - + /*------------------------------------------------------------------------- * Function: leave * @@ -2573,7 +2572,7 @@ leave(int ret) HDexit(ret); } - + /*------------------------------------------------------------------------- * Function: main * @@ -2772,6 +2771,7 @@ main(int argc, const char *argv[]) } /* end switch */ } /* end for */ } else { + HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]); usage(); leave(EXIT_FAILURE); } diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 8109b93..b3ccc3f 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -74,14 +74,14 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ unsigned max_dset_rank; /* Maximum rank of dataset */ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */ hsize_t max_dset_dims; /* Maximum dimension size of dataset */ - unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ + unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ @@ -257,7 +257,7 @@ leave(int ret) } - + /*------------------------------------------------------------------------- * Function: usage * @@ -297,7 +297,7 @@ static void usage(const char *prog) HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); } - + /*------------------------------------------------------------------------- * Function: ceil_log10 * @@ -324,7 +324,7 @@ ceil_log10(unsigned long x) return ret; } /* ceil_log10() */ - + /*------------------------------------------------------------------------- * Function: attribute_stats * @@ -374,7 +374,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) return 0; } /* end attribute_stats() */ - + /*------------------------------------------------------------------------- * Function: group_stats * @@ -456,7 +456,7 @@ done: return ret_value; } /* end group_stats() */ - + /*------------------------------------------------------------------------- * Function: dataset_stats * @@ -648,7 +648,7 @@ done: return ret_value; } /* end dataset_stats() */ - + /*------------------------------------------------------------------------- * Function: datatype_stats * @@ -680,7 +680,7 @@ done: return ret_value; } /* end datatype_stats() */ - + /*------------------------------------------------------------------------- * Function: obj_stats * @@ -736,7 +736,7 @@ done: return ret_value; } /* end obj_stats() */ - + /*------------------------------------------------------------------------- * Function: lnk_stats * @@ -834,7 +834,7 @@ freespace_stats(hid_t fid, iter_t *iter) return 0; } /* end freespace_stats() */ - + /*------------------------------------------------------------------------- * Function: hand_free * @@ -863,7 +863,7 @@ hand_free(struct handler_t *hand) } /* end if */ } /* end hand_free() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -1041,7 +1041,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: iter_free * @@ -1106,7 +1106,7 @@ iter_free(iter_t *iter) } /* end if */ } /* end iter_free() */ - + /*------------------------------------------------------------------------- * Function: print_file_info * @@ -1138,7 +1138,7 @@ print_file_info(const iter_t *iter) return 0; } /* print_file_info() */ - + /*------------------------------------------------------------------------- * Function: print_file_metadata * @@ -1198,7 +1198,7 @@ print_file_metadata(const iter_t *iter) return 0; } /* print_file_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_group_info * @@ -1255,7 +1255,7 @@ print_group_info(const iter_t *iter) return 0; } /* print_group_info() */ - + /*------------------------------------------------------------------------- * Function: print_group_metadata * @@ -1282,7 +1282,7 @@ print_group_metadata(const iter_t *iter) return 0; } /* print_group_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_info * @@ -1369,7 +1369,7 @@ print_dataset_info(const iter_t *iter) return 0; } /* print_dataset_info() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_metadata * @@ -1398,7 +1398,7 @@ print_dset_metadata(const iter_t *iter) return 0; } /* print_dset_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dset_dtype_meta * @@ -1439,7 +1439,7 @@ print_dset_dtype_meta(const iter_t *iter) return 0; } /* print_dset_dtype_meta() */ - + /*------------------------------------------------------------------------- * Function: print_attr_info * @@ -1488,7 +1488,7 @@ print_attr_info(const iter_t *iter) return 0; } /* print_attr_info() */ - + /*------------------------------------------------------------------------- * Function: print_freespace_info * @@ -1538,7 +1538,7 @@ print_freespace_info(const iter_t *iter) return 0; } /* print_freespace_info() */ - + /*------------------------------------------------------------------------- * Function: print_storage_summary * @@ -1602,7 +1602,7 @@ print_storage_summary(const iter_t *iter) return 0; } /* print_storage_summary() */ - + /*------------------------------------------------------------------------- * Function: print_file_statistics * @@ -1649,7 +1649,7 @@ print_file_statistics(const iter_t *iter) if(display_summary) print_storage_summary(iter); } /* print_file_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_object_statistics * @@ -1672,7 +1672,7 @@ print_object_statistics(const char *name) printf("Object name %s\n", name); } /* print_object_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_statistics * @@ -1698,7 +1698,7 @@ print_statistics(const char *name, const iter_t *iter) print_file_statistics(iter); } /* print_statistics() */ - + /*------------------------------------------------------------------------- * Function: main * diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 111c120..8f6fe45 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -1152,3 +1152,13 @@ if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) endif () + +############################################################################## +############################################################################## +### V F D T E S T S ### +############################################################################## +############################################################################## + +if (HDF5_TEST_VFD) + include (CMakeVFDTests.cmake) +endif () diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake new file mode 100644 index 0000000..0a345ef --- /dev/null +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -0,0 +1,91 @@ +# +# 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 COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +set (VFD_H5DUMP_LIST + sec2 + stdio + core + core_paged + split + multi + family +) + +if (DIRECT_VFD) + set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct) +endif () + +# -------------------------------------------------------------------- +# Copy all the HDF5 files from the source directory into the test directory +# -------------------------------------------------------------------- +set (HDF5_VFD_H5DUMP_FILES + packedbits +) + +foreach (vfdtest ${VFD_H5DUMP_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + foreach (h5_tfile ${HDF5_VFD_H5DUMP_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.h5" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.h5" "HDF5_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.ddl" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.ddl" "HDF5_VFD_H5DUMP_files") + endforeach () +endforeach () + +add_custom_target(HDF5_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_VFD_H5DUMP tests" DEPENDS ${HDF5_VFD_H5DUMP_files_list}) + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + +if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") +else () + set (tgt_ext "-shared") +endif () + +macro (ADD_VFD_H5DUMP_TEST vfdname resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5DUMP_VFD-${vfdname}-${resultfile}-h5dump + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5dump${tgt_ext}>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (H5DUMP_VFD-${vfdname}-${resultfile}-h5dump PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# Run test with different Virtual File Driver +foreach (vfd ${VFD_H5DUMP_LIST}) + # test for signed/unsigned datasets + ADD_VFD_H5DUMP_TEST (${vfd} packedbits 0 --enable-error-stack packedbits.h5) +endforeach () diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index fe43ecd..63c4033 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1888,7 +1888,7 @@ static void gent_str2(void) int i; - char buf[LENSTR+10]; + char buf[LENSTR+20]; char buf2[3*LENSTR2]; hsize_t sdim; @@ -7531,16 +7531,6 @@ gent_nodata(void) { hid_t fid, dataset, space; hsize_t dims[2]; - uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits; - uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits; - uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits; - uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits; - int8_t dset8[F66_XDIM][F66_YDIM8], val8bits; - int16_t dset16[F66_XDIM][F66_YDIM16], val16bits; - int32_t dset32[F66_XDIM][F66_YDIM32], val32bits; - int64_t dset64[F66_XDIM][F66_YDIM64], val64bits; - double dsetdbl[F66_XDIM][F66_YDIM8]; - unsigned int i, j; fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index cd20f77..a28a282 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -727,6 +727,7 @@ set (FILE15 h5repack_named_dtypes.h5) set (FILE16 tfamily%05d.h5) # located in common testfiles folder set (FILE18 h5repack_layout2.h5) + set (FILE19 h5repack_layout3.h5) set (FILE_REF h5repack_refs.h5) set (FILE_ATTR_REF h5repack_attr_refs.h5) set (FILEV1 1_vds.h5) @@ -869,11 +870,11 @@ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") endif () set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) + set (last_test "H5REPACK-testh5repack_detect_szip") - add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repacktest>) - set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) - set (last_test "H5REPACK-h5repacktest") - +# add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repacktest>) +# set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) +# set (last_test "H5REPACK-h5repacktest") # # The tests # We use the files generated by h5repacktst @@ -1194,14 +1195,14 @@ # Use first dset to test. #--------------------------------------------------------------------------- # chunk to chunk - specify chunk dim bigger than any current dim - ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) + ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 ${FILE19} chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) # chunk to contiguous - ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) + ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 ${FILE19} chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) # chunk to compact - convert big dataset (should be > 64k) for this purpose, # should remain as original layout (chunk) - ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) + ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 ${FILE19} chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) #-------------------------------------------------------------------------- # Test -f for some specific cases. Chunked dataset with unlimited max dims. @@ -1211,16 +1212,16 @@ # - should not change max dims from unlimit # chunk dim is bigger than dataset dim. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE) + ADD_H5_VERIFY_TEST (error1 "TEST" 0 ${FILE19} chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE) # chunk dim is bigger than dataset dim. ( dset size > 64k ) - ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE) + ADD_H5_VERIFY_TEST (error2 "TEST" 0 ${FILE19} chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE) # chunk dims are smaller than dataset dims. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE) + ADD_H5_VERIFY_TEST (error3 "TEST" 0 ${FILE19} chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE) # file input - should not fail - ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) + ADD_H5_TEST (error4 "TEST" ${FILE19} -f NONE) #-------------------------------------------------------------------------- # Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset @@ -1228,9 +1229,9 @@ # (HDFFV-8214) #-------------------------------------------------------------------------- # chunk dim is bigger than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) + ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 ${FILE19} chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) # chunk dim is smaller than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) + ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 ${FILE19} chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index f88f147..6399ee0 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -16,18 +16,18 @@ ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) +set (VFD_LIST + sec2 + stdio + core + split + multi + family +) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () ############################################################################## ############################################################################## @@ -35,20 +35,61 @@ ############################################################################## ############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + add_test ( + NAME H5REPACK-${vfdname}-h5repacktest-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + bounds_latest_latest.h5 + h5repack_attr.h5 + h5repack_attr_refs.h5 + h5repack_deflate.h5 + h5repack_early.h5 + h5repack_ext.h5 + h5repack_fill.h5 + h5repack_filters.h5 + h5repack_fletcher.h5 + h5repack_hlink.h5 + h5repack_layout.h5 + h5repack_layouto.h5 + h5repack_layout2.h5 + h5repack_layout3.h5 + h5repack_layout.UD.h5 + h5repack_named_dtypes.h5 + h5repack_nested_8bit_enum.h5 + h5repack_nested_8bit_enum_deflated.h5 + h5repack_nbit.h5 + h5repack_objs.h5 + h5repack_refs.h5 + h5repack_shuffle.h5 + h5repack_soffset.h5 + h5repack_szip.h5 + # fsm + h5repack_aggr.h5 + h5repack_fsm_aggr_nopersist.h5 + h5repack_fsm_aggr_persist.h5 + h5repack_none.h5 + h5repack_paged_nopersist.h5 + h5repack_paged_persist.h5 + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} + ) add_test ( - NAME H5REPACK-VFD-${vfdname}-h5repacktest - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=h5repacktest" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + NAME H5REPACK_VFD-${vfdname}-h5repacktest + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-h5repacktest.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - endmacro () + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS H5REPACK_VFD-${vfdname}-h5repacktest-clear-objects) + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () ############################################################################## ############################################################################## @@ -56,7 +97,7 @@ ############################################################################## ############################################################################## - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) +endforeach () |