From afc010179ce9bed6b9a432fe7531070e5fa589f1 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 18 Feb 2019 15:14:43 -0600 Subject: Update version on hdf5_1_10 branch to 1.10.6-snap0. --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 4 ++-- configure.ac | 2 +- java/src/hdf/hdf5lib/H5.java | 4 ++-- java/test/TestH5.java | 4 ++-- release_docs/RELEASE.txt | 2 +- src/H5public.h | 6 +++--- .../testfiles/h5repack_layout.h5-plugin_version_test.ddl | 14 +++++++------- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.txt b/README.txt index 3a3864c..6f9543c 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.10.5-snap1 currently under development +HDF5 version 1.10.6-snap0 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 7e3c91d..38ee874 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.10.5-snap1, currently under development" +PROJECT_NUMBER = "1.10.6-snap0, currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 4d6af03..5bb4617 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -34,8 +34,8 @@ cmake_minimum_required (VERSION 3.10) # CTEST_SOURCE_NAME - source folder ############################################################################## -set (CTEST_SOURCE_VERSION "1.10.5") -set (CTEST_SOURCE_VERSEXT "-snap1") +set (CTEST_SOURCE_VERSION "1.10.6") +set (CTEST_SOURCE_VERSEXT "-snap0") ############################################################################## # handle input parameters to script. diff --git a/configure.ac b/configure.ac index 5d997b0..7248637 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.10.5-snap1], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.10.6-snap0], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 255a8ec..34c3be3 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -212,7 +212,7 @@ import hdf.hdf5lib.structs.H5O_info_t; * exception handlers to print out the HDF-5 error stack. *
* - * @version HDF5 1.10.5
+ * @version HDF5 1.10.6
* See also: hdf.hdf5lib.HDFArray
* hdf.hdf5lib.HDF5Constants
* hdf.hdf5lib.HDF5CDataTypes
@@ -235,7 +235,7 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 10, 5 }; + public final static int LIB_VERSION[] = { 1, 10, 6 }; public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 6122c14..bb8b38d 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -162,7 +162,7 @@ public class TestH5 { */ @Test public void testH5get_libversion() { - int libversion[] = { 1, 10, 5 }; + int libversion[] = { 1, 10, 6 }; try { H5.H5get_libversion(libversion); @@ -201,7 +201,7 @@ public class TestH5 { */ @Test public void testH5check_version() { - int majnum = 1, minnum = 10, relnum = 5; + int majnum = 1, minnum = 10, relnum = 6; try { H5.H5check_version(majnum, minnum, relnum); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 353d63b..939b586 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.10.5-snap1 currently under development +HDF5 version 1.10.6-snap0 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 1ff2954..e73ce8b 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -93,10 +93,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 10 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 5 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "snap1" /* For pre-releases like snap0 */ +#define H5_VERS_RELEASE 6 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_SUBRELEASE "snap0" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.10.5-snap1" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.10.6-snap0" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl index 341a404..15d326a 100644 --- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl +++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl @@ -11,7 +11,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -33,7 +33,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -55,7 +55,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -77,7 +77,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -99,7 +99,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -121,7 +121,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { @@ -143,7 +143,7 @@ GROUP "/" { USER_DEFINED_FILTER { FILTER_ID 260 COMMENT dynlib4 - PARAMS { 9 1 10 5 } + PARAMS { 9 1 10 6 } } } FILLVALUE { -- cgit v0.12 From cd1838e063796aa3b486144c2573098e973de52c Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 19 Feb 2019 14:08:54 -0600 Subject: Update so version numbers. fix 2 typos. --- config/lt_vers.am | 24 ++--- release_docs/HISTORY-1_10.txt | 0 release_docs/README_HDF5_CMake | 23 +++++ release_docs/README_HPC | 206 +++++++++++++++++++++++++++++++++++++++++ release_docs/RELEASE.txt | 4 +- 5 files changed, 243 insertions(+), 14 deletions(-) mode change 100755 => 100644 release_docs/HISTORY-1_10.txt create mode 100644 release_docs/README_HDF5_CMake create mode 100644 release_docs/README_HPC diff --git a/config/lt_vers.am b/config/lt_vers.am index 8b63c22..84bff2d 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -16,7 +16,7 @@ ## See libtool versioning documentation online. ## After making changes, run bin/reconfigure to update other configure related ## files like Makefile.in. -LT_VERS_INTERFACE = 103 +LT_VERS_INTERFACE = 104 LT_VERS_REVISION = 0 LT_VERS_AGE = 0 @@ -39,31 +39,31 @@ LT_VERS_AGE = 0 ## the effects of the H5_V1_x_COMPAT flag. ## ## Version numbers for wrapper shared library files. -LT_CXX_VERS_INTERFACE = 103 +LT_CXX_VERS_INTERFACE = 104 LT_CXX_VERS_REVISION = 0 -LT_CXX_VERS_AGE = 0 +LT_CXX_VERS_AGE = 1 -LT_F_VERS_INTERFACE = 101 -LT_F_VERS_REVISION = 2 -LT_F_VERS_AGE = 1 +LT_F_VERS_INTERFACE = 102 +LT_F_VERS_REVISION = 0 +LT_F_VERS_AGE = 0 LT_HL_VERS_INTERFACE = 101 -LT_HL_VERS_REVISION = 1 +LT_HL_VERS_REVISION = 2 LT_HL_VERS_AGE = 1 LT_HL_CXX_VERS_INTERFACE = 101 -LT_HL_CXX_VERS_REVISION = 2 +LT_HL_CXX_VERS_REVISION = 3 LT_HL_CXX_VERS_AGE = 1 LT_HL_F_VERS_INTERFACE = 100 -LT_HL_F_VERS_REVISION = 3 +LT_HL_F_VERS_REVISION = 4 LT_HL_F_VERS_AGE = 0 -LT_JAVA_VERS_INTERFACE = 103 +LT_JAVA_VERS_INTERFACE = 104 LT_JAVA_VERS_REVISION = 0 -LT_JAVA_VERS_AGE = 3 +LT_JAVA_VERS_AGE = 4 LT_TOOLS_VERS_INTERFACE = 101 -LT_TOOLS_VERS_REVISION = 1 +LT_TOOLS_VERS_REVISION = 2 LT_TOOLS_VERS_AGE = 1 diff --git a/release_docs/HISTORY-1_10.txt b/release_docs/HISTORY-1_10.txt old mode 100755 new mode 100644 diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake new file mode 100644 index 0000000..484710d --- /dev/null +++ b/release_docs/README_HDF5_CMake @@ -0,0 +1,23 @@ +This tar file contains + + build-unix.sh script to build HDF5 with CMake on unix machines + build-unix-hpc.sh script to build HDF5 with CMake on unix machines and run + tests with batch scripts (sbatch). + CTestScript.cmake + HDF5config.cmake CMake scripts for building HDF5 + HDF5options.cmake + hdf5-1.10.5-pre1 HDF5 1.10.5-pre1 source + SZip.tar.gz source for building SZIP + ZLib.tar.gz source for building ZLIB + +For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in +hdf5-1.10.5-pre1/release_docs, or +https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake. + +For more information about building HDF5 with CMake on HPC machines, including +cross compiling on Cray XC40, see README_HPC in hdf5-1.10.5-pre1/release_docs. + + + + + diff --git a/release_docs/README_HPC b/release_docs/README_HPC new file mode 100644 index 0000000..67a5d6c --- /dev/null +++ b/release_docs/README_HPC @@ -0,0 +1,206 @@ +************************************************************************ +* Using CMake to build and test HDF5 source on HPC machines * +************************************************************************ + + Contents + +Section I: Prerequisites +Section II: Obtain HDF5 source +Section III: Using ctest command to build and test +Section IV: Cross compiling +Section V: Manual alternatives +Section VI: Other cross compiling options + +************************************************************************ + +======================================================================== +I. Prerequisites +======================================================================== + 1. Create a working directory that is accessible from the compute nodes for + running tests; the working directory should be in a scratch space or a + parallel file system space since testing will use this space. Building + from HDF5 source in a 'home' directory typically results in test + failures and should be avoided. + + 2. Load modules for desired compilers, module for cmake version 3.10 or greater, + and set any needed environment variables for compilers (i.e., CC, FC, CXX). + Unload any problematic modules (i.e., craype-hugepages2M). + +======================================================================== +II. Obtain HDF5 source +======================================================================== +Obtain HDF5 source code from the HDF5 repository using a git command or +from a release tar file in a working directory: + + git clone https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git + [-b branch] [source directory] + +If no branch is specified, then the 'develop' version will be checked out. +If no source directory is specified, then the source will be located in the +'hdf5' directory. The Cmake scripts expect the source to be in a directory +named hdf5-, where 'version string' uses the format '1.xx.xx'. +For example, for the current 'develop' version, the "hdf5" directory should +be renamed "hdf5-1.11.4", or for the first hdf5_1_10_5 pre-release version, +it should be renamed "hdf5-1.10.5-pre1". + +If the version number is not known a priori, the version string +can be obtained by running bin/h5vers in the top level directory of the source clone, and +the source directory renamed 'hdf5-'. + +Release or snapshot tar files may also be extracted and used. + +======================================================================== +III. Using ctest command to build and test +======================================================================== + +The ctest command [1]: + + ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log + +will configure, build, test and package HDF5 from the downloaded source +after the setup steps outlined below are followed. + +CMake option variables are available to allow running test programs in batch +scripts on compute nodes and to cross-compile for compute node hardware using +a cross-compiling emulator. The setup steps will make default settings for +parallel or serial only builds available to the CMake command. + + 1. For the current 'develop' version the "hdf5" directory should be renamed + "hdf5-1.11.4". + + 2. Three cmake script files need to be copied to the working directory, or + have symbolic links to them, created in the working directory: + + hdf5-1.11.4/config/cmake/scripts/HDF5config.cmake + hdf5-1.11.4/config/cmake/scripts/CTestScript.cmake + hdf5-1.11.4/config/cmake/scripts/HDF5options.cmake + + should be copied to the working directory. + + 3. The resulting contents of the working directory are then: + + CTestScript.cmake + HDF5config.cmake + HDF5options.cmake + hdf5-1.11.4 + + Additionally, when the ctest command runs [1], it will add a build directory + in the working directory. + + 4. The following options (among others) can be added to the ctest + command [1], following '-S HDF5config.cmake,' and separated by ',': + + HPC=sbatch (or 'bsub' or 'raybsub') indicates which type of batch + files to use for running tests. If omitted, test + will run on the local machine or login node. + + KNL=true to cross-compile for KNL compute nodes on CrayXC40 + (see section IV) + + MPI=true enables parallel, disables c++, java, and threadsafe + + LOCAL_BATCH_SCRIPT_ARGS="--account=" to supply user account + information for batch jobs + + The HPC options will add BUILD_GENERATOR=Unix for the three HPC options. + An example ctest command for a parallel build on a system using sbatch is + + ctest -S HDF5config.cmake,HPC=sbatch,MPI=true -C Release -V -O hdf5.log + + Adding the option 'KNL=true' to the above list will compile for KNL nodes, + for example, on 'mutrino' and other CrayXC40 machines. + + Changing -V to -VV will produce more logging information in HDF5.log. + + More detailed CMake information can be found in the HDF5 source in + release_docs/INSTALL_CMake.txt. + +======================================================================== +IV. Cross-compiling +======================================================================== +For cross-compiling on Cray, set environment variables CC=cc, FC=ftn +and CXX=CC (for c++) after all compiler modules are loaded since switching +compiler modules may unset or reset these variables. + +CMake provides options for cross-compiling. To cross-compile for KNL hardware +on mutrino and other CrayXC40 machines, add HPC=sbatch,KNL=true to the +ctest command line. This will set the following options from the +config/cmake/scripts/HPC/sbatch-HDF5options.cmake file: + + set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell") + set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl") + set (LOCAL_BATCH_SCRIPT_NAME "knl_ctestS.sl") + set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "knl_ctestP.sl") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake") + +On the Cray XC40 the craype-haswell module is needed for configuring, and the +craype-mic-knl module is needed for building to run on the KNL nodes. CMake +with the above options will swap modules after configuring is complete, +but before compiling programs for KNL. + +The sbatch script arguments for running jobs on KNL nodes may differ on CrayXC40 +machines other than mutrino. The batch scripts knl_ctestS.sl and knl_ctestP.sl +have the correct arguments for mutrino: "#SBATCH -p knl -C quad,cache". For +cori, another CrayXC40, that line is replaced by "#SBATCH -C knl,quad,cache". +For cori (and other machines), the values in LOCAL_BATCH_SCRIPT_NAME and +LOCAL_BATCH_SCRIPT_PARALLEL_NAME in the config/cmake/scripts/HPC/sbatch-HDF5options.cmake +file can be replaced by cori_knl_ctestS.sl and cori_knl_ctestS.sl, or the lines +can be edited in the batch files in hdf5-1.11.4/bin/batch. + +======================================================================== +V. Manual alternatives +======================================================================== +If using ctest is undesirable, one can create a build directory and run the cmake +configure command, for example + +"/projects/Mutrino/hpcsoft/cle6.0/common/cmake/3.10.2/bin/cmake" +-C "/hdf5-1.11.4/config/cmake/cacheinit.cmake" +-DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=ON +-DHDF5_BUILD_JAVA:BOOL=OFF +-DCMAKE_INSTALL_PREFIX:PATH=/HDF_Group/HDF5/1.11.4 +-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF +-DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF +-DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_THREADSAFE:BOOL=OFF +-DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DLOCAL_BATCH_TEST:BOOL=ON +-DMPIEXEC_EXECUTABLE:STRING=srun -DMPIEXEC_NUMPROC_FLAG:STRING=-n +-DMPIEXEC_MAX_NUMPROCS:STRING=6 +-DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake +-DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl +-DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl -DSITE:STRING=mutrino +-DBUILDNAME:STRING=par-knl_GCC493-SHARED-Linux-4.4.156-94.61.1.16335.0.PTF.1107299-default-x86_64 +"-GUnix Makefiles" "" "/hdf5-1.11.4" + +followed by make and batch jobs to run tests. + +To cross-compile on CrayXC40, run the configure command with the craype-haswell +module loaded, then switch to the craype-mic-knl module for the build process. + +Tests on machines using slurm can be run with + +"sbatch -p knl -C quad,cache ctestS.sl" + +or + +"sbatch -p knl -C quad,cache ctestP.sl" + +for parallel builds. + +Tests on machines using LSF will typically use "bsub ctestS.lsf", etc. + +======================================================================== +VI. Other cross compiling options +======================================================================== +Settings for two other cross-compiling options are also in the config/toolchain +files which do not seem to be necessary with the Cray PrgEnv-* modules + +1. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR CMake + variable would allow the use of an appropriate H5Tinit.c file with type + information generated on a compute node to be used when cross compiling + for those compute nodes. The use of the variables in lines 110 and 111 + of HDF5options.cmake file seem to preclude needing this option with the + available Cray modules and CMake option. + +2. HDF5_BATCH_H5DETECT and associated CMake variables. This option when + properly configured will run H5detect in a batch job on a compute node + at the beginning of the CMake build process. It was also found to be + unnecessary with the available Cray modules and CMake options. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 939b586..baa0456 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -199,7 +199,7 @@ New Features Parallel Library: ----------------- - - Changed the default behavior in parallel when reading the same dataset in its entirely + - Changed the default behavior in parallel when reading the same dataset in its entirety (i.e. H5S_ALL dataset selection) which is being read by all the processes collectively. The dataset must be contiguous, less than 2GB, and of an atomic datatype. The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from @@ -348,7 +348,7 @@ Bug Fixes since HDF5-1.10.4 release The slow down is due to the search of the "tag_list" to find out the "corked" status of an object and "uncork" it if so. - Improve porformance by skipping the search of the "tag_list" + Improve performance by skipping the search of the "tag_list" if there are no "corked" objects when closing an object. (VC - 2019/02/06) -- cgit v0.12 From 1353f9552eaabf9f17b9043ed1d9a3d97fb5ba87 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 19 Feb 2019 14:12:38 -0600 Subject: Add new files to MANIFEST. --- MANIFEST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST b/MANIFEST index c16dde5..66cbb00 100644 --- a/MANIFEST +++ b/MANIFEST @@ -462,6 +462,8 @@ ./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt ./release_docs/RELEASE.txt +./release_docs/README_HDF5_CMake +./release_docs/README_HPC ./release_docs/USING_HDF5_CMake.txt ./release_docs/USING_HDF5_VS.txt -- cgit v0.12 From b7d6f11182f148c0d0fff8d077d7fa342080d98c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 21 Feb 2019 13:23:59 -0600 Subject: HDFFV-10703 - Update CMake variable handling --- CMakeLists.txt | 6 +- bin/batch/cori_knl_ctestS.sl.in.cmake | 2 +- c++/examples/CMakeTests.cmake | 8 +-- config/cmake/hdf5-config-version.cmake.in | 50 ++++++------- config/cmake/hdf5-config.cmake.in | 26 +++---- config/cmake/jrunTest.cmake | 8 +-- config/cmake/userblockTest.cmake | 8 +-- config/cmake_ext_mod/ConfigureChecks.cmake | 18 +++-- config/cmake_ext_mod/HDFUseCXX.cmake | 4 +- config/cmake_ext_mod/runTest.cmake | 8 +-- examples/CMakeTests.cmake | 12 ++-- fortran/examples/CMakeTests.cmake | 12 ++-- fortran/test/CMakeTests.cmake | 2 +- hl/examples/CMakeTests.cmake | 4 +- hl/fortran/test/CMakeLists.txt | 4 +- hl/fortran/test/CMakeTests.cmake | 4 +- hl/test/CMakeTests.cmake | 4 +- hl/tools/h5watch/CMakeTests.cmake | 2 +- java/examples/datasets/CMakeLists.txt | 11 ++- java/examples/datatypes/CMakeLists.txt | 4 +- java/examples/groups/CMakeLists.txt | 14 ++-- java/examples/intro/CMakeLists.txt | 4 +- test/CMakeLists.txt | 20 +++--- test/CMakeTests.cmake | 40 +++++------ test/CMakeVFDTests.cmake | 14 ++-- test/flushrefreshTest.cmake | 102 +++++++++++++-------------- testpar/CMakeLists.txt | 4 +- testpar/CMakeTests.cmake | 18 ++--- testpar/CMakeVFDTests.cmake | 22 +++--- tools/test/h5copy/CMakeTests.cmake | 34 ++++----- tools/test/h5diff/CMakeTests.cmake | 16 ++--- tools/test/h5dump/CMakeTests.cmake | 22 +++--- tools/test/h5dump/CMakeTestsPBITS.cmake | 6 +- tools/test/h5dump/CMakeTestsVDS.cmake | 14 ++-- tools/test/h5dump/CMakeTestsXML.cmake | 6 +- tools/test/h5format_convert/CMakeTests.cmake | 76 ++++++++------------ tools/test/h5import/CMakeTests.cmake | 4 +- tools/test/h5jam/CMakeTests.cmake | 8 +-- tools/test/h5ls/CMakeTests.cmake | 10 +-- tools/test/h5ls/CMakeTestsVDS.cmake | 10 +-- tools/test/h5repack/CMakeTests.cmake | 36 +++++----- tools/test/h5repack/CMakeVFDTests.cmake | 2 +- tools/test/h5stat/CMakeTests.cmake | 14 ++-- tools/test/misc/CMakeTestsClear.cmake | 24 +++---- tools/test/misc/CMakeTestsMkgrp.cmake | 4 +- 45 files changed, 350 insertions(+), 371 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e93231..8cad454 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project (HDF5 C) # set CMAKE_INSTALL_PREFIX to the required install path. # Make install can be used to install all components for system-wide use. # -if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") +if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n" "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n" @@ -314,7 +314,7 @@ set (HDF5_PACKAGE_NAME "HDF5") set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}") set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}") set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}") -if (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") +if (H5_VERS_SUBRELEASE) set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}") else () set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") @@ -828,7 +828,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}") # Building with PGI requires CMake 3.3 or greater because previous versions # of CMake add the wrong compiler flag for the PGI Fortran compiler. - if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3") + if (CMAKE_Fortran_COMPILER_ID MATCHES "PGI" AND CMAKE_VERSION VERSION_LESS "3.3") message (FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** ") endif () diff --git a/bin/batch/cori_knl_ctestS.sl.in.cmake b/bin/batch/cori_knl_ctestS.sl.in.cmake index bcb4881..c6d9e83 100644 --- a/bin/batch/cori_knl_ctestS.sl.in.cmake +++ b/bin/batch/cori_knl_ctestS.sl.in.cmake @@ -1,6 +1,6 @@ #!/bin/bash -#SBATCH -C knl,quad, cache +#SBATCH -C knl,quad,cache #SBATCH --nodes=1 #SBATCH -t 00:30:00 #SBATCH --mail-type=BEGIN,END,FAIL diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index bd1f95b..58bdb68 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -26,7 +26,7 @@ SDSextendible.h5 Select.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "CPP_ex-clear-objects") @@ -46,7 +46,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "CPP_ex_${example}") @@ -66,7 +66,7 @@ h5tutr_groups.h5 h5tutr_subset.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "CPP_ex_tutr-clear-objects") @@ -86,7 +86,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "CPP_ex_${example}") diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in index 8e16725..575c1ab 100644 --- a/config/cmake/hdf5-config-version.cmake.in +++ b/config/cmake/hdf5-config-version.cmake.in @@ -21,38 +21,38 @@ set (PACKAGE_VERSION "@HDF5_VERSION_STRING@") -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) +if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) -else () - if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@") +else() + if("@H5_VERS_MAJOR@.@H5_VERS_MINOR@" MATCHES "^([0-9]+)\\.([0-9]+)") + set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}") + else() + set(CVF_VERSION_MAJOR "@HDF5_VERSION_STRING@") + set(CVF_VERSION_MINOR "") + endif() + + if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND + (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR)) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() - # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ - if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@") - - # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x - set (PACKAGE_VERSION_COMPATIBLE TRUE) - - if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@") - set (PACKAGE_VERSION_EXACT TRUE) - - if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@") - # not using this yet - endif () - endif () - else () - set (PACKAGE_VERSION_COMPATIBLE FALSE) - endif () - endif () -endif () # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() -endif () +endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif () +endif() diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 3bd9e1d..b1ef0ac 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -127,14 +127,14 @@ endif () # Handle requested components: list (REMOVE_DUPLICATES ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) - if (${comp} STREQUAL "shared") + if (comp STREQUAL "shared") list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN) set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@/shared") endif () - elseif (${comp} STREQUAL "static") + elseif (comp STREQUAL "static") list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) @@ -146,32 +146,32 @@ endforeach () foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) set (hdf5_comp2) - if (${comp} STREQUAL "C") + if (comp STREQUAL "C") set (hdf5_comp "hdf5") - elseif (${comp} STREQUAL "CXX") + elseif (comp STREQUAL "CXX") set (hdf5_comp "hdf5_cpp") - elseif (${comp} STREQUAL "HL") + elseif (comp STREQUAL "HL") set (hdf5_comp "hdf5_hl") - elseif (${comp} STREQUAL "CXX_HL") + elseif (comp STREQUAL "CXX_HL") set (hdf5_comp "hdf5_hl_cpp") - elseif (${comp} STREQUAL "Java") + elseif (comp STREQUAL "Java") set (hdf5_comp "hdf5_java") - elseif (${comp} STREQUAL "Tools") + elseif (comp STREQUAL "Tools") set (hdf5_comp "hdf5_tools") - elseif (${comp} STREQUAL "Fortran") + elseif (comp STREQUAL "Fortran") set (hdf5_comp2 "hdf5_f90cstub") set (hdf5_comp "hdf5_fortran") - elseif (${comp} STREQUAL "Fortran_HL") + elseif (comp STREQUAL "Fortran_HL") set (hdf5_comp2 "hdf5_hl_f90cstub") set (hdf5_comp "hdf5_hl_fortran") endif () - if (${comp} STREQUAL "Java") + if (comp STREQUAL "Java") list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}" HAVE_COMP) else () list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP) endif () if (${HAVE_COMP} LESS 0) - if (${comp} STREQUAL "Java") + if (comp STREQUAL "Java") set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 0) else () set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0) @@ -186,7 +186,7 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp2}-${libtype} @HDF5_PACKAGE@::${hdf5_comp}-${libtype}) endif () - elseif (${comp} STREQUAL "Java") + elseif (comp STREQUAL "Java") set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) set (${COMP_LIBRARY} ${${COMP_LIBRARY}} hdf5::${hdf5_comp}) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 23f297c..d5cd903 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -142,8 +142,8 @@ if (NOT TEST_SKIP_COMPARE) foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT ${str_act} STREQUAL ${str_ref}) - if (NOT str_act STREQUAL "") + if (NOT str_act STREQUAL str_ref) + if (str_act) set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () @@ -194,8 +194,8 @@ if (NOT TEST_SKIP_COMPARE) foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT ${str_act} STREQUAL ${str_ref}) - if (NOT ${str_act} STREQUAL "") + if (NOT str_act STREQUAL str_ref) + if (str_act) set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 9af7e5b..4a580d0 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -62,7 +62,7 @@ if (TEST_CHECKUB STREQUAL "YES") OUTPUT_VARIABLE TEST_OUT ERROR_VARIABLE TEST_ERROR ) - if (NOT ${TEST_RESULT} STREQUAL "0") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}") endif () file (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN) @@ -70,7 +70,7 @@ if (TEST_CHECKUB STREQUAL "YES") math( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" ) - if (NOT TEST_O_STRING_LEN STREQUAL "0") + if (TEST_O_STRING_LEN) #$JAM_BIN/getub -c $s2 $origfile > $cmpfile EXECUTE_PROCESS ( COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} @@ -108,7 +108,7 @@ if (TEST_CHECKUB STREQUAL "YES") message (STATUS "COMPARE Result: ${TEST_RESULT}: ${TEST_STRING_SIZE}=${TEST_U_STRING_LEN}+${TEST_O_STRING_LEN}") # if the return value is !=${TEST_EXPECT} bail out - if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + if (NOT TEST_RESULT EQUAL TEST_EXPECT) message (FATAL_ERROR "Failed: The output of ${TEST_HFILE}-ub did not match ${TEST_HFILE}.\n${TEST_ERROR}") endif () else () @@ -121,7 +121,7 @@ else () OUTPUT_VARIABLE TEST_OUT ERROR_VARIABLE TEST_ERROR ) - if (NOT TEST_H_STRING_LEN STREQUAL "0") + if (TEST_H_STRING_LEN) message (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty") endif () endif () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 986280f..cc9de79 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -229,7 +229,7 @@ macro (HDF_FUNCTION_TEST OTHER_TEST) endif () #message (STATUS "Performing ${OTHER_TEST}") - TRY_COMPILE (${OTHER_TEST} + try_compile (${OTHER_TEST} ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}" @@ -274,12 +274,10 @@ if (NOT WINDOWS) # functionality so clock_gettime and CLOCK_MONOTONIC are defined # correctly. This was later updated to 200112L so that # posix_memalign() is visible for the direct VFD code on Linux - # systems. Even later, this was changed to 200809L to support - # pread/pwrite in VFDs. - # + # systems. # POSIX feature information can be found in the gcc manual at: # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html - set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L) + set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L) # Need to add this so that O_DIRECT is visible for the direct # VFD on Linux systems. @@ -288,7 +286,7 @@ if (NOT WINDOWS) option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON) if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN) set (msg "Performing TEST_LFS_WORKS") - TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE + try_run (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE ${CMAKE_BINARY_DIR} ${HDF_RESOURCES_EXT_DIR}/HDFTests.c COMPILE_DEFINITIONS "-DTEST_LFS_WORKS" @@ -445,7 +443,7 @@ if (NOT WINDOWS) # Check a bunch of time functions #----------------------------------------------------------------------------- CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY) - foreach (test + foreach (time_test HAVE_TM_GMTOFF HAVE___TM_GMTOFF # HAVE_TIMEZONE @@ -455,7 +453,7 @@ if (NOT WINDOWS) HAVE_TM_ZONE HAVE_STRUCT_TM_TM_ZONE ) - HDF_FUNCTION_TEST (${test}) + HDF_FUNCTION_TEST (${time_test}) endforeach () if (NOT CYGWIN AND NOT MINGW) HDF_FUNCTION_TEST (HAVE_TIMEZONE) @@ -559,7 +557,7 @@ endif () # Check a bunch of other functions #----------------------------------------------------------------------------- if (NOT WINDOWS) - foreach (test + foreach (other_test HAVE_ATTRIBUTE HAVE_C99_FUNC # STDC_HEADERS @@ -568,7 +566,7 @@ if (NOT WINDOWS) SYSTEM_SCOPE_THREADS HAVE_SOCKLEN_T ) - HDF_FUNCTION_TEST (${test}) + HDF_FUNCTION_TEST (${other_test}) endforeach () endif () diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index efaa556..8d98147 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -96,7 +96,7 @@ endmacro () # Check a bunch of cxx functions #----------------------------------------------------------------------------- if (CMAKE_CXX_COMPILER_LOADED) - foreach (test + foreach (cxx_test OLD_HEADER_FILENAME HDF_NO_NAMESPACE HDF_NO_STD @@ -104,6 +104,6 @@ if (CMAKE_CXX_COMPILER_LOADED) NO_STATIC_CAST CXX_HAVE_OFFSETOF ) - HDF_CXX_FUNCTION_TEST (${test}) + HDF_CXX_FUNCTION_TEST (${cxx_test}) endforeach () endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 48402a2..13e8a4d 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -218,8 +218,8 @@ if (NOT TEST_SKIP_COMPARE) foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT ${str_act} STREQUAL ${str_ref}) - if (NOT str_act STREQUAL "") + if (NOT str_act STREQUAL str_ref) + if (str_act) set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () @@ -270,8 +270,8 @@ if (NOT TEST_SKIP_COMPARE) foreach (line RANGE 0 ${_FP_LEN}) list (GET test_act ${line} str_act) list (GET test_ref ${line} str_ref) - if (NOT ${str_act} STREQUAL ${str_ref}) - if (NOT ${str_act} STREQUAL "") + if (NOT str_act STREQUAL str_ref) + if (str_act) set (TEST_RESULT 1) message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index cb47c78..1058566 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -71,7 +71,7 @@ vds-simpleIO.h5 vds-eiger.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "EXAMPLES-clear-objects") @@ -91,7 +91,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "EXAMPLES-${example}") @@ -150,7 +150,7 @@ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (EXAMPLES-shared-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "EXAMPLES-shared-clear-objects") @@ -171,7 +171,7 @@ ) endif () set_tests_properties (EXAMPLES-shared-${example} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (EXAMPLES-shared-${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "EXAMPLES-shared-${example}") @@ -194,7 +194,7 @@ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) endif () set (last_test "MPI_TEST_EXAMPLES-ph5example") @@ -214,7 +214,7 @@ ) endif () set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test}) endif () set (last_test "MPI_TEST_EXAMPLES-shared-ph5example") diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index face086..efbb209 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -37,7 +37,7 @@ SDScompound.h5 test.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex-clear-objects") @@ -62,7 +62,7 @@ SDScompound.h5 test.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex-shared-clear-objects") @@ -83,7 +83,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex_${example}") @@ -102,7 +102,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex-shared_${example}") @@ -124,7 +124,7 @@ foreach (example ${F2003_examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex_${example}") @@ -143,7 +143,7 @@ foreach (example ${F2003_examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex-shared_${example}") diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 2824ef7..5fa10f4 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -58,7 +58,7 @@ add_test ( vds.h5 visit.h5 ) -if (NOT "${last_test}" STREQUAL "") +if (last_test) set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "FORTRAN_testhdf5-clear-objects") diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 166fa7c..c1fd6c2 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -51,7 +51,7 @@ add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ ex_table_12.h5 ex_ds1.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "HL_ex-clear-objects") @@ -71,7 +71,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "HL_ex_${example}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 923989d..fca2852 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -70,8 +70,8 @@ macro (ADD_H5_FORTRAN_EXE file) endif () endmacro () -foreach (test ${H5_TESTS}) - ADD_H5_FORTRAN_EXE(${test}) +foreach (h5_test ${H5_TESTS}) + ADD_H5_FORTRAN_EXE(${h5_test}) endforeach () include (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 04a49dc..54cc6ef 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -87,6 +87,6 @@ if (BUILD_SHARED_LIBS) ) endif () -foreach (test ${H5_TESTS}) - ADD_H5_FORTRAN_TEST(${test}) +foreach (h5_test ${H5_TESTS}) + ADD_H5_FORTRAN_TEST(${h5_test}) endforeach () diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 4e945bc..477a165 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -61,7 +61,7 @@ macro (HL_ADD_TEST hl_name) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} @@ -104,7 +104,7 @@ add_test ( testfl_packet_table_vlen.h5 test_table.h5 ) -if (NOT "${last_test}" STREQUAL "") +if (last_test) set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "HL_test-clear-objects") diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 13d5e47..a4d3fa2 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -147,7 +147,7 @@ if (NOT SWMR_INCOMPAT) -E remove WATCH.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5WATCH-clearall-objects") diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 1375372..c327c86 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -71,7 +71,7 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -MACRO (ADD_H5_TEST resultfile resultcode) +macro (ADD_H5_TEST resultfile resultcode) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_datasets-${resultfile} @@ -87,16 +87,15 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_REFERENCE=datasets/${resultfile}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_datasets-${resultfile}") -ENDMACRO () +endmacro () if (BUILD_TESTING) - foreach (example ${HDF_JAVA_EXAMPLES}) - if ("${example}" STREQUAL "H5Ex_D_External") + if (example STREQUAL "H5Ex_D_External") add_test ( NAME JAVA_datasets-${example}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -112,7 +111,7 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 4a8b2a4..0fef370 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -72,7 +72,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_REFERENCE=datatypes/${resultfile}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_datatypes-${resultfile}") @@ -86,7 +86,7 @@ if (BUILD_TESTING) -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 2c5d33b..b31a186 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -55,7 +55,7 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES}) endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) -MACRO (ADD_H5_TEST resultfile resultcode) +macro (ADD_H5_TEST resultfile resultcode) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") add_test ( NAME JAVA_groups-${resultfile} @@ -71,16 +71,16 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_REFERENCE=groups/${resultfile}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_groups-${resultfile}") -ENDMACRO () +endmacro () if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) - if (NOT "${example}" STREQUAL "H5Ex_G_Iterate" AND NOT "${example}" STREQUAL "H5Ex_G_Visit") - if ("${example}" STREQUAL "H5Ex_G_Compact") + if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") + if (example STREQUAL "H5Ex_G_Compact") add_test ( NAME JAVA_groups-${example}-clear-h5s COMMAND ${CMAKE_COMMAND} @@ -96,7 +96,7 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_groups-${example}-clear-h5s") @@ -108,7 +108,7 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_groups-${example}-copy-objects") diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 8d56b86..8c94a09 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -73,7 +73,7 @@ MACRO (ADD_H5_TEST resultfile resultcode) -D "TEST_REFERENCE=intro/${resultfile}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "JAVA_intro-${resultfile}") @@ -88,7 +88,7 @@ if (BUILD_TESTING) -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fa303ed..42fc3a6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -261,9 +261,9 @@ set (H5_TESTS_MULTIPLE ttsafe ) # Only build single source tests here -foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5_TESTS_MULTIPLE) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5_TESTS_MULTIPLE) + ADD_H5_EXE(${h5_test}) endif () endforeach () @@ -346,15 +346,15 @@ set (H5_CHECK_TESTS flushrefresh ) -foreach (test ${H5_CHECK_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_CHECK_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () #-- Adding test for libinfo set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) file (WRITE ${GREP_RUNNER} "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") -if (\${TEST_RESULT} STREQUAL \"0\") +if (NOT TEST_RESULT) message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") else () message (STATUS \"COMMAND Result: \${TEST_RESULT}\") @@ -379,8 +379,8 @@ set (H5_SWMR_TESTS swmr_writer ) -foreach (test ${H5_SWMR_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_SWMR_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () set (H5_VDS_SWMR_TESTS @@ -389,8 +389,8 @@ set (H5_VDS_SWMR_TESTS vds_swmr_writer ) -foreach (test ${H5_VDS_SWMR_TESTS}) - ADD_H5_EXE(${test}) +foreach (h5_test ${H5_VDS_SWMR_TESTS}) + ADD_H5_EXE(${h5_test}) endforeach () #-- Adding test for accum_swmr_reader diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index a8dd647..eccf9d4 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -544,33 +544,33 @@ set (H5TEST_SEPARATE_TESTS flush1 flush2 ) -foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) +foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-${test} COMMAND $) - set_tests_properties (H5TEST-${test} PROPERTIES + add_test (NAME H5TEST-${h5_test} COMMAND $) + set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) else () - if ("${test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-${test} + if ("${h5_test}" STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" ) else () - add_test (NAME H5TEST-${test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + add_test (NAME H5TEST-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${test}.txt" + -D "TEST_OUTPUT=${h5_test}.txt" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5TEST-${test} PROPERTIES + set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST @@ -595,25 +595,25 @@ if (BUILD_SHARED_LIBS) ) set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects) - foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) - if ("${test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-shared-${test} + foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) + if ("${h5_test}" STREQUAL "big" AND CYGWIN) + add_test (NAME H5TEST-shared-${h5_test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) else () - add_test (NAME H5TEST-shared-${test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + add_test (NAME H5TEST-shared-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${test}.txt" + -D "TEST_OUTPUT=${h5_test}.txt" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5TEST-shared-${test} PROPERTIES + set_tests_properties (H5TEST-shared-${h5_test} PROPERTIES FIXTURES_REQUIRED shared_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared @@ -1182,8 +1182,8 @@ if (HDF5_BUILD_GENERATORS) gen_plist ) - foreach (gen ${H5_GENERATORS}) - ADD_H5_GENERATOR (${gen}) + foreach (h5_gen ${H5_GENERATORS}) + ADD_H5_GENERATOR (${h5_gen}) endforeach () endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 569f215..a4cf26d 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -111,7 +111,7 @@ endif () macro (CHECK_VFD_TEST vfdtest vfdname resultcode) if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") - if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug") + if (NOT BUILD_SHARED_LIBS AND NOT HDF_CFG_NAME MATCHES "Debug") add_test ( NAME VFD-${vfdname}-${vfdtest}-clear-objects COMMAND ${CMAKE_COMMAND} @@ -316,12 +316,12 @@ endif () endmacro () macro (ADD_VFD_TEST vfdname resultcode) - foreach (test ${H5_TESTS}) - if (NOT ${test} IN_LIST H5_VFD_SKIP_TESTS) + foreach (h5_test ${H5_TESTS}) + if (NOT h5_test IN_LIST H5_VFD_SKIP_TESTS) if (WIN32) - CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) + CHECK_VFD_TEST (${h5_test} ${vfdname} ${resultcode}) else () - DO_VFD_TEST (${test} ${vfdname} ${resultcode}) + DO_VFD_TEST (${h5_test} ${vfdname} ${resultcode}) endif () endif () endforeach () @@ -394,6 +394,6 @@ endif () endmacro () # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) + foreach (h5_vfd ${VFD_LIST}) + ADD_VFD_TEST (${h5_vfd} 0) endforeach () diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index f66ee64..aa18c8a 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -53,7 +53,7 @@ if (TEST_ENV_VAR) #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") endif () -message(STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}") +message (STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}") execute_process ( COMMAND ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM} RESULT_VARIABLE SCRIPT_RESULT @@ -61,34 +61,34 @@ execute_process ( OUTPUT_VARIABLE SCRIPT_OUTPUT WORKING_DIRECTORY ${TEST_FOLDER} ) -message(STATUS "Background: ${SCRIPT_OUTPUT}") -if (NOT "${SCRIPT_RESULT}" STREQUAL "0") +message (STATUS "Background: ${SCRIPT_OUTPUT}") +if (SCRIPT_RESULT) message (FATAL_ERROR "Failed: The background script failed ${SCRIPT_RESULT}: ${SCRIPT_ERR}") endif () -set(verification_done "0") -while(verification_done LESS "1") - message(STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") - if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) +set (verification_done "0") +while (verification_done LESS "1") + message (STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") + if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) # Error exit script - set(verification_done "3") - elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + set (verification_done "3") + elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) - message(STATUS "v1:${v1} len_v1:${len_v1}") - if (NOT "${len_v1}" STREQUAL "0") + message (STATUS "v1:${v1} len_v1:${len_v1}") + if (len_v1) list (GET v1 0 param1) list (GET v1 -1 param2) endif () - file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) - message(STATUS "PARAM1:${param1} PARAM2:${param2}") + file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message (STATUS "PARAM1:${param1} PARAM2:${param2}") - if(${param1} MATCHES "VERIFICATION_DONE") - set(verification_done "1") - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete") - message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") - else() - message(STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") + if (param1 MATCHES "VERIFICATION_DONE") + set (verification_done "1") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete") + message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else () + message (STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") execute_process ( COMMAND ${TEST_PROGRAM} ${param1} ${param2} RESULT_VARIABLE TEST_RESULT @@ -98,40 +98,40 @@ while(verification_done LESS "1") ERROR_VARIABLE TEST_ERROR WORKING_DIRECTORY ${TEST_FOLDER} ) - message(STATUS "flush verification: ${TEST_OUT}") - if (NOT "${TEST_RESULT}" STREQUAL "0") + message (STATUS "flush verification: ${TEST_OUT}") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The flush verification failed ${TEST_RESULT}: ${TEST_ERROR}") endif () - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done") - endif() - else() - message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done") + endif () + else () + message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) - endif() -endwhile() + endif () +endwhile () -while(verification_done LESS "2") - message(STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") - if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) +while (verification_done LESS "2") + message (STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") + if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) # Error exit script - set(verification_done "3") - elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + set (verification_done "3") + elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) - message(STATUS "v1:${v1} len_v1:${len_v1}") - if (NOT "${len_v1}" STREQUAL "0") + message (STATUS "v1:${v1} len_v1:${len_v1}") + if (len_v1) list (GET v1 0 param1) list (GET v1 -1 param2) endif () - file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) - message(STATUS "PARAM1:${param1} PARAM2:${param2}") + file (REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message (STATUS "PARAM1:${param1} PARAM2:${param2}") - if(${param1} MATCHES "VERIFICATION_DONE") - set(verification_done "2") - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete") - message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") - else() - message(STATUS "execute: ${TEST_PROGRAM} ${param1}") + if (param1 MATCHES "VERIFICATION_DONE") + set (verification_done "2") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete") + message (STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else () + message (STATUS "execute: ${TEST_PROGRAM} ${param1}") execute_process ( COMMAND ${TEST_PROGRAM} ${param1} RESULT_VARIABLE TEST_RESULT @@ -141,22 +141,22 @@ while(verification_done LESS "2") ERROR_VARIABLE TEST_ERROR WORKING_DIRECTORY ${TEST_FOLDER} ) - message(STATUS "refresh verification: ${TEST_OUT}") - if (NOT "${TEST_RESULT}" STREQUAL "0") + message (STATUS "refresh verification: ${TEST_OUT}") + if (TEST_RESULT) message (FATAL_ERROR "Failed: The refresh verification failed ${TEST_RESULT}: ${TEST_ERROR}") endif () - file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done") - endif() - else() - message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + file (WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done") + endif () + else () + message (STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) - endif() -endwhile() + endif () +endwhile () message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the return value is !=${TEST_EXPECT} bail out -if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") +if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 71459c7..96ce0c0 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -58,8 +58,8 @@ set (H5P_TESTS t_filters_parallel ) -foreach (testp ${H5P_TESTS}) - ADD_H5P_EXE(${testp}) +foreach (h5_testp ${H5P_TESTS}) + ADD_H5P_EXE(${h5_testp}) endforeach () include (CMakeTests.cmake) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 12ccc58..214801b 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -26,7 +26,7 @@ add_test (NAME MPI_TEST-clear-testphdf5-objects set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5) set (SKIP_testphdf5 "") -#if (${HDF5_OPENMPI_VERSION_SKIP}) +#if (HDF5_OPENMPI_VERSION_SKIP) # set (SKIP_testphdf5 "${SKIP_testphdf5};-x;ecdsetw") #endif () @@ -36,12 +36,12 @@ set_tests_properties (MPI_TEST_testphdf5 PROPERTIES ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) -if (NOT "${last_test}" STREQUAL "") +if (last_test) set_tests_properties (MPI_TEST_testphdf5 PROPERTIES DEPENDS ${last_test}) endif () set (last_test "MPI_TEST_testphdf5") -#if (${HDF5_OPENMPI_VERSION_SKIP}) +#if (HDF5_OPENMPI_VERSION_SKIP) # list (REMOVE_ITEM H5P_TESTS t_shapesame) #endif () @@ -74,17 +74,17 @@ add_test (NAME MPI_TEST-clear-objects ) set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects) -foreach (testp ${H5P_TESTS}) - add_test (NAME MPI_TEST_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - set_tests_properties (MPI_TEST_${testp} PROPERTIES +foreach (h5_testp ${H5P_TESTS}) + add_test (NAME MPI_TEST_${h5_testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + set_tests_properties (MPI_TEST_${h5_testp} PROPERTIES FIXTURES_REQUIRED par_clear_objects ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (MPI_TEST_${testp} PROPERTIES DEPENDS ${last_test}) + if (last_test) + set_tests_properties (MPI_TEST_${h5_testp} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "MPI_TEST_${testp}") + set (last_test "MPI_TEST_${h5_testp}") endforeach () # The t_pflush1 test is hard-coded to fail. diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index de16a31..c0b848b 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -39,27 +39,27 @@ endforeach () macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - foreach (test ${H5P_VFD_TESTS}) + foreach (h5_test ${H5P_VFD_TESTS}) add_test ( - NAME MPI_TEST_VFD-${vfdname}-${test}-clear-objects + NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ${vfdname}-shared/${vfdname}-${test}.out - ${vfdname}-shared/${vfdname}-${test}.out.err + ${vfdname}-shared/${vfdname}-${h5_test}.out + ${vfdname}-shared/${vfdname}-${h5_test}.out.err ) add_test ( - NAME MPI_TEST_VFD-${vfdname}-${test} + NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${test}.out" + -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}-${test} PROPERTIES - DEPENDS MPI_TEST_VFD-${vfdname}-${test}-clear-objects + set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES + DEPENDS MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} ) @@ -68,6 +68,6 @@ endforeach () endmacro () # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) + foreach (h5_vfd ${VFD_LIST}) + ADD_VFD_TEST (${h5_vfd} 0) endforeach () diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index f31068b..85a8788 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -70,7 +70,7 @@ COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -78,13 +78,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -106,7 +106,7 @@ COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -114,13 +114,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -152,7 +152,7 @@ COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test}) endif () else () @@ -165,13 +165,13 @@ ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -193,7 +193,7 @@ COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -206,13 +206,13 @@ ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -226,10 +226,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -272,7 +272,7 @@ testfiles/${testname}.out.h5.out testfiles/${testname}.out.h5.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -335,7 +335,7 @@ testfiles/${testname}_ERR.out.h5.out testfiles/${testname}_ERR.out.h5.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" @@ -443,7 +443,7 @@ h5copy_misc1.out.out.err ) set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5COPY-clearall-objects") diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 1376e0d..6bce3f7 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -354,10 +354,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -369,7 +369,7 @@ testfiles/${resultfile}.out testfiles/${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -396,10 +396,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} ${ARGN}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -411,7 +411,7 @@ PAR/testfiles/${resultfile}.out PAR/testfiles/${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (MPI_TEST_H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -444,7 +444,7 @@ testfiles/${resultfile}.out testfiles/${resultfile}.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -925,7 +925,7 @@ h5diff_vlstr.out.err ) set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DIFF-clearall-objects") diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 126d972..ed3449b 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -404,7 +404,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DUMP-${testname}") @@ -417,7 +417,7 @@ testfiles/std/h5dump-${testname}.out testfiles/std/h5dump-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -454,10 +454,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -490,10 +490,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -526,10 +526,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -569,10 +569,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -1147,7 +1147,7 @@ zerodim.out.err ) set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DUMP-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 4f3ee9f..a8ccb7d 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -124,10 +124,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (NOT ${resultcode} STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_pbits_test}" STREQUAL "") + if (last_pbits_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) endif () else () @@ -275,7 +275,7 @@ tpbitsUnsignedLongLong16.out.err ) set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (NOT "${last_pbits_test}" STREQUAL "") + if (last_pbits_test) set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) endif () set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 922e79e..d7e3b88 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -120,10 +120,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -159,10 +159,10 @@ ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" ) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -197,10 +197,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -276,7 +276,7 @@ vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test}) endif () set (last_VDS_test "H5DUMP_VDS-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index de87d2f..e48cec1 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -178,10 +178,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_xml_test}" STREQUAL "") + if (last_xml_test) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () else () @@ -357,7 +357,7 @@ tvlstr.h5.out.err ) set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (NOT "${last_xml_test}" STREQUAL "") + if (last_xml_test) set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) endif () set (last_test "H5DUMP-XML-clearall-objects") diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 5792d40..5599c1b 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -108,10 +108,10 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - if (NOT "${testfile}" STREQUAL "") + if (${testfile}) add_test ( NAME H5FC-${testname}-${testfile}-tmpfile COMMAND ${CMAKE_COMMAND} @@ -161,7 +161,7 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -197,48 +197,30 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - if (NOT "${testfile}" STREQUAL "") - add_test ( - NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 - ) - set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") - add_test ( - NAME H5FC-${testname}-${testfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS=${ARGN};outtmp.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") - set (last_test "H5FC-${testname}-${testfile}") - else () - add_test ( - NAME H5FC-${testname}-NA - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") - set (last_test "H5FC-${testname}-NA") - endif () + add_test ( + NAME H5FC-${testname}-${testfile}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname}-${testfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -D "TEST_ERRREF=${resultfile}.err" + -D "TEST_MASK_ERROR=true" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set (last_test "H5FC-${testname}-${testfile}") endif () endmacro () @@ -253,7 +235,7 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -300,7 +282,7 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -343,7 +325,7 @@ ./testfiles/${testname}_chk.out ./testfiles/${testname}_chk.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -449,7 +431,7 @@ chktmp.h5 dmptmp.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5FC-clearall-objects") diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 7d76fba..1090640 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -99,7 +99,7 @@ # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () else () @@ -499,7 +499,7 @@ binuin32.bin binuin32.conf ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5IMPORT-clear-objects") diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 2d00b86..677ba5c 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -55,7 +55,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -91,7 +91,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -205,7 +205,7 @@ set (compare_test "") endif () endif () - if (NOT "${compare_test}" STREQUAL "") + if (${compare_test}) add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects COMMAND ${CMAKE_COMMAND} @@ -244,7 +244,7 @@ -D "TEST_OFILE=NULL" -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) - if (NOT "${compare_test}" STREQUAL "") + if (${compare_test}) set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1) else () set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 116d097..95af5ab 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -139,10 +139,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -174,10 +174,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -354,7 +354,7 @@ tvldtypes2be.out.err ) set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5LS-clearall-objects") diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 2b6f61e..562a892 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -85,10 +85,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -123,10 +123,10 @@ ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -193,7 +193,7 @@ tvds_layout-5.out.err ) set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5LS_VDS-clearall-objects") diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index c2a2be7..2ad12ad 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -162,7 +162,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5REPACK-h5repack-${testname}") @@ -174,7 +174,7 @@ testfiles/h5repack-${testname}.out testfiles/h5repack-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -208,7 +208,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -240,7 +240,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -272,7 +272,7 @@ NAME H5REPACK_CMP-${testname} COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -284,7 +284,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -320,7 +320,7 @@ NAME H5REPACK_MASK-${testname} COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -332,7 +332,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -371,7 +371,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -414,7 +414,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -458,7 +458,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -471,7 +471,7 @@ COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) - if ("${resultcode}" STREQUAL "0") + if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -533,7 +533,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -570,7 +570,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -601,7 +601,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -624,7 +624,7 @@ testfiles/out-${testname}_N.${testname}.h5 testfiles/out-${testname}_M.${testname}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -656,7 +656,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -901,7 +901,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} ) set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () endif () diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index 2042f31..e100e3c 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -47,7 +47,7 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index ec8c9b1..737f4b5 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -97,10 +97,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -111,7 +111,7 @@ ${resultfile}.out ${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -133,10 +133,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -147,7 +147,7 @@ ${resultfile}.out ${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -182,7 +182,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${CLEAR_LIST} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5STAT-clearall-objects") diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index c46ac59..24774fd 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -94,7 +94,7 @@ testfiles/${testname}.out testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -122,7 +122,7 @@ testfiles/${testname}.out testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -152,7 +152,7 @@ testfiles/${testname}.out.err testfiles/${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -188,7 +188,7 @@ testfiles/${testname}.out.err testfiles/${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -223,7 +223,7 @@ ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR_RET-${testname}") @@ -242,7 +242,7 @@ testfiles/${testname}_after_size.out.err testfiles/${testname}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -302,7 +302,7 @@ -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testfile}.h5" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clr_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-clr_open_chk-copy_${testname}.h5") @@ -312,7 +312,7 @@ add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND $ ${testfile}.h5) set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}") set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES DEPENDS ${last_test}) endif () @@ -356,7 +356,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) mod_h5clear_mdc_image2.h5 ${HDF5_TEST_FILES} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-clearall-objects") @@ -368,7 +368,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_${h5_file}") @@ -381,7 +381,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_orig_${h5_file}") @@ -393,7 +393,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_mod_h5clr_mdc_image2.h5 PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_mod_h5clr_mdc_image2.h5") diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index e99983b..db3b7e4 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -73,7 +73,7 @@ ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -174,7 +174,7 @@ h5mkgrp_nested_mult_lp.out.err ) set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5MKGRP-clearall-objects") -- cgit v0.12 From 2cb70b01eadbed1363ea4418fa1d36e636d9998d Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Thu, 21 Feb 2019 22:28:17 -0600 Subject: Minor fix in h5str_sprintf for NULL region references --- java/src/jni/h5aImp.c | 2 +- java/src/jni/h5dImp.c | 2 +- java/src/jni/h5util.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index e47515d..eaa356e 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -1389,7 +1389,7 @@ Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (hdset_reg_ref_t *) HDmalloc((size_t)n * sizeof(hdset_reg_ref_t)))) + if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer"); if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0) diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 55f3d16..5500847 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -1633,7 +1633,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (hdset_reg_ref_t *) HDmalloc((size_t)n * sizeof(hdset_reg_ref_t)))) + if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0) diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 7857965..5454dce 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -978,7 +978,7 @@ h5str_sprintf case H5T_REFERENCE: { - if (h5str_is_zero(cptr, 99)) { + if (h5str_is_zero(cptr, typeSize)) { if (!h5str_append(out_str, "NULL")) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); break; -- cgit v0.12 From 62dce9ab87da6da7a6eb5abb6d5d4577cb1c3bd6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 22 Feb 2019 12:46:43 -0600 Subject: HDFFV-10552 Revert H5O_*1 functions for compatibility --- MANIFEST | 1 + src/CMakeLists.txt | 1 + src/H5Odeprec.c | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Opublic.h | 14 +++ src/Makefile.am | 2 +- 5 files changed, 353 insertions(+), 1 deletion(-) create mode 100644 src/H5Odeprec.c diff --git a/MANIFEST b/MANIFEST index 66cbb00..73858a0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -768,6 +768,7 @@ ./src/H5Ocont.c ./src/H5Ocopy.c ./src/H5Odbg.c +./src/H5Odeprec.c ./src/H5Odrvinfo.c ./src/H5Odtype.c ./src/H5Oefl.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b7ead9..01434ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -423,6 +423,7 @@ set (H5O_SOURCES ${HDF5_SRC_DIR}/H5Ocont.c ${HDF5_SRC_DIR}/H5Ocopy.c ${HDF5_SRC_DIR}/H5Odbg.c + ${HDF5_SRC_DIR}/H5Odeprec.c ${HDF5_SRC_DIR}/H5Odrvinfo.c ${HDF5_SRC_DIR}/H5Odtype.c ${HDF5_SRC_DIR}/H5Oefl.c diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c new file mode 100644 index 0000000..fc0abc3 --- /dev/null +++ b/src/H5Odeprec.c @@ -0,0 +1,336 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Purpose: Deprecated functions from the H5O interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +/* Compatibility function prototypes to replace non-versioned function for use by macro in next version + * see HDFFV-10552 +#ifndef H5_NO_DEPRECATED_SYMBOLS + */ + +/*------------------------------------------------------------------------- + * Function: H5Oget_info1 + * + * Purpose: Retrieve information about an object. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) +{ + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", loc_id, oinfo); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Retrieve the object's information */ + if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name1 + * + * Purpose: Retrieve information about an object. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Retrieve the object's information */ + if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_name1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_idx1 + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'name' found */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo, + lapl_id); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name || !*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Retrieve the object's information */ + if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + +done: + /* Release the object location */ + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Ovisit1 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 25 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data) +{ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); + + /* Check args */ + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Call internal object visitation routine */ + if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Ovisit_by_name1 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 24 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) +{ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, + lapl_id); + + /* Check args */ + if(!obj_name || !*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Call internal object visitation routine */ + if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit_by_name1() */ + +/* Compatibility function prototypes to replace non-versioned function for use by macro in next version + * see HDFFV-10552 +#endif (* H5_NO_DEPRECATED_SYMBOLS *) + */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index e779627..cbccc7a 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -211,6 +211,20 @@ H5_DLL herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id); +/* Compatibility function prototypes to replace non-versioned function for use by macro in next version */ +H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo); +H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, + hid_t lapl_id); +H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, + hid_t lapl_id); + +H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data); +H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, + void *op_data, hid_t lapl_id); + /* Symbols defined for compatibility with previous versions of the HDF5 API. * * Use of these symbols is deprecated. diff --git a/src/Makefile.am b/src/Makefile.am index 7d472f3..10ef8c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -80,7 +80,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ + H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \ H5Ochunk.c \ H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ -- cgit v0.12 From 675be2a4a48253ed2622b9c45f8beabaa872c18d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 22 Feb 2019 13:13:42 -0600 Subject: HDFFV-10552 Change to use H5G_loc_info --- src/H5Odeprec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index fc0abc3..33ed787 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -102,8 +102,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: FUNC_LEAVE_API(ret_value) @@ -142,7 +142,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: -- cgit v0.12 From d628025b500a9480ce08ced10d566a700d82f8e3 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 22 Feb 2019 14:11:26 -0800 Subject: Updated H5err.txt to replace a global variable that was removed during the metadata cache logging changes (to maintain binary compatibility). --- src/H5err.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/H5err.txt b/src/H5err.txt index 3eeb38a..aa172e8 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -181,6 +181,7 @@ MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action MINOR, CACHE, H5E_LOGGING, Failure in the cache logging framework +MINOR, CACHE, H5E_LOGFAIL, old H5E_LOGGING_g (maintained for binary compatibility) MINOR, CACHE, H5E_CANTCORK, Unable to cork an object MINOR, CACHE, H5E_CANTUNCORK, Unable to uncork an object -- cgit v0.12 From a372f76ea6961ec02b5d0c867fc1611cb36241d5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 26 Feb 2019 10:44:57 -0600 Subject: Fix typos --- java/src/hdf/hdf5lib/H5.java | 4 ++++ test/CMakeVFDTests.cmake | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 34c3be3..4a651ea 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -3214,6 +3214,8 @@ public class H5 implements java.io.Serializable { * @param file_id * IN: Identifier of the target file. * + * @return true if the file-level is set to create minimized dataset object headers, false if not. + * * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ @@ -6945,6 +6947,8 @@ public class H5 implements java.io.Serializable { * @param dcpl_id * IN: Dataset creation property list * + * @return true if the given dcpl is set to create minimized dataset object headers, false if not. + * * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index a4cf26d..791f75c 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -199,7 +199,7 @@ endif () ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err ) - add_test (NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -- cgit v0.12 From 81f446d31169e464f87148b061c9816a4197e622 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 27 Feb 2019 11:15:58 -0600 Subject: Correct CMake examples for a binary install --- config/cmake/HDF5_Examples.cmake.in | 2 - config/cmake/HDF5_Examples_options.cmake | 103 +++++++++++++++++++++++++++++++ release_docs/USING_CMake_Examples.txt | 22 +++++-- 3 files changed, 119 insertions(+), 8 deletions(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 6951b09..a2d38f5 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -103,8 +103,6 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PAC if(WIN32) include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) else() include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake) - include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) endif() diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/HDF5_Examples_options.cmake index 386e99c..6e4b510 100755 --- a/config/cmake/HDF5_Examples_options.cmake +++ b/config/cmake/HDF5_Examples_options.cmake @@ -57,3 +57,106 @@ #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCOMPARE_TESTING:BOOL=ON") ############################################################################################# +# Do not edit below this line +############################################################################################# +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if (APPLE) + # Compiler choice + execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set (ENV{CC} "${XCODE_CC}") + set (ENV{CXX} "${XCODE_CXX}") + if (NOT NO_MAC_FORTRAN) + # Shared fortran is not supported, build static + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + endif () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +else () + set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") +endif () + +#----------------------------------------------------------------------------- +set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +## -------------------------- +if (CTEST_USE_TAR_SOURCE) + ## Uncompress source if tar or zip file provided + ## -------------------------- + if (WIN32) + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else () + message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif () + + if (NOT rv EQUAL 0) + message (STATUS "extracting... [error-(${rv}) clean up]") + file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message (FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") + endif () +endif() + +#----------------------------------------------------------------------------- +## Clear the build directory +## -------------------------- +set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) +else () + file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif () + +# Use multiple CPU cores to build +include (ProcessorCount) +ProcessorCount (N) +if (NOT N EQUAL 0) + if (NOT WIN32) + set (CTEST_BUILD_FLAGS -j${N}) + endif () + set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif () +set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" +) + +#----------------------------------------------------------------------------- +## -- set output to english +set ($ENV{LC_MESSAGES} "en_EN") + +#----------------------------------------------------------------------------- +configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") +## NORMAL process +## -------------------------- +ctest_start (Experimental) +ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +if (${res} LESS 0 OR ${res} GREATER 0) + file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") +endif () +if (LOCAL_SUBMIT) + ctest_submit (PARTS Configure Notes) +endif () +ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) +if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") +endif () +if (LOCAL_SUBMIT) + ctest_submit (PARTS Build) +endif () +ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if (${res} LESS 0 OR ${res} GREATER 0) + file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") +endif () +if (LOCAL_SUBMIT) + ctest_submit (PARTS Test) +endif () +if (${res} LESS 0 OR ${res} GREATER 0) + message (FATAL_ERROR "tests FAILED") +endif () +#----------------------------------------------------------------------------- +############################################################################################################## +message (STATUS "DONE") diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index d5fae39..ea1ac05 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -22,7 +22,7 @@ I. Preconditions 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF5 1.10.x product requires a minimum CMake version - of 3.2.2. + of 3.10.2. 2. You have installed the HDF5 library built with CMake, by executing the HDF Install Utility (the *.msi file in the binary package for @@ -39,11 +39,13 @@ II. Building HDF5 Examples with CMake Files in the HDF5 install directory: HDF5Examples folder HDF5_Examples.cmake + HDF5_Examples_options.cmake Default installation process: Create a directory to run the examples, i.e. \test_hdf5. Copy HDF5Examples folder to this directory. Copy HDF5_Examples.cmake to this directory. + Copy HDF5_Examples_options.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed with the CTEST_SOURCE_NAME script option. The default installation folder is defined for the platform. @@ -54,8 +56,9 @@ Default installation process: with the CTEST_CONFIGURATION_TYPE script option. Note that this must be the same as the value used with the -C command line option. The default build configuration is defined to build and use static libraries. - Shared libraries can be used with the STATIC_ONLY script option set to "NO". - Other options can be changed by editing the HDF5_Examples.cmake file. + + Shared libraries and other options can be changed by editing the + HDF5_Examples_options.cmake file. If the defaults are okay, execute from this directory: ctest -S HDF5_Examples.cmake -C Release -V -O test.log @@ -69,9 +72,16 @@ Default installation process: ======================================================================== -III. Other changes to the HDF5_Examples.cmake file +III. Defaults in the HDF5_Examples_options.cmake file ======================================================================== -Line 45-48: uncomment to use a source tarball or zipfile; - Add script option "TAR_SOURCE=MySource.tar". +#### DEFAULT: ### +#### BUILD_SHARED_LIBS:BOOL=OFF ### +#### HDF_BUILD_C:BOOL=ON ### +#### HDF_BUILD_CXX:BOOL=OFF ### +#### HDF_BUILD_FORTRAN:BOOL=OFF ### +#### HDF_BUILD_JAVA:BOOL=OFF ### +#### BUILD_TESTING:BOOL=OFF ### +#### HDF_ENABLE_PARALLEL:BOOL=OFF ### +#### HDF_ENABLE_THREADSAFE:BOOL=OFF ### -- cgit v0.12 From 8a864f91eba77c9ca24c7efc5d9b4477fd26c77c Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Mon, 4 Mar 2019 10:22:51 -0600 Subject: HDFFV-10705: Fixed memory leak in scale offset filter. --- src/H5Zscaleoffset.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index cdf31a4..0026749 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1174,6 +1174,8 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out); + /* free the original buffer */ + H5MM_xfree(*buf); /* convert to dataset datatype endianness order if needed */ if(need_convert) @@ -1272,6 +1274,9 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { HDmemcpy(outbuf + buf_offset, *buf, nbytes); + /* free the original buffer */ + H5MM_xfree(*buf); + *buf = outbuf; outbuf = NULL; *buf_size = size_out; -- cgit v0.12 From 35b6085c6058ea31182fe4f4dc2ae6f8195d63c9 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Mon, 4 Mar 2019 16:09:26 -0600 Subject: HDFFV-10705: added a release note. --- release_docs/RELEASE.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index baa0456..965b98d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -327,6 +327,13 @@ Bug Fixes since HDF5-1.10.4 release Library ------- + - Fixed memory leak in scale offset filter + + The data buffer was not freed in a special case like the general case. + It caused the memory usage to grow. + + (RL - 2019/3/4, HDFFV-10705) + - Fix hangs with collective metadata reads during chunked dataset I/O In the parallel library, it was discovered that when a particular -- cgit v0.12 From 1848184afec2867fbe46363b30b9281fc6827f4a Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Thu, 7 Mar 2019 10:10:11 -0600 Subject: Minor change: revised the note from the previous commit about HDFFV-10705. --- release_docs/RELEASE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 965b98d..2658664 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -330,7 +330,8 @@ Bug Fixes since HDF5-1.10.4 release - Fixed memory leak in scale offset filter The data buffer was not freed in a special case like the general case. - It caused the memory usage to grow. + The special case is when the MinBits is the same as the number of bits in + the datatype's precision. It caused the memory usage to grow. (RL - 2019/3/4, HDFFV-10705) -- cgit v0.12 From 2f3c34c649b8ec04d399296fa6203f68615e55a0 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 8 Mar 2019 09:56:09 -0600 Subject: Revised the entry of bug fix for HDFFV-10705. --- release_docs/RELEASE.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2658664..3b68ba0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -329,9 +329,11 @@ Bug Fixes since HDF5-1.10.4 release ------- - Fixed memory leak in scale offset filter - The data buffer was not freed in a special case like the general case. - The special case is when the MinBits is the same as the number of bits in - the datatype's precision. It caused the memory usage to grow. + In a special case where the MinBits is the same as the number of bits in + the datatype's precision, the filter's data buffer was not freed, causing + the memory usage to grow. In general the buffer was freed correctly. The + Minbits are the minimal number of bits to store the data values. Please + see the reference manual for H5Pset_scaleoffset for the detail. (RL - 2019/3/4, HDFFV-10705) -- cgit v0.12 From a8443acaa76b79ebe74624af363008f0163a44f8 Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Wed, 6 Mar 2019 16:57:42 -0600 Subject: Fix issue with direct chunk write not updating the "last chunk" index cache. Fix issues involving datasets being "no allocated" when they contain cached raw data. --- release_docs/RELEASE.txt | 12 +++++ src/H5Dchunk.c | 40 ++++++++++++++-- src/H5Dcompact.c | 1 + src/H5Dcontig.c | 25 ++++++++++ src/H5Defl.c | 1 + src/H5Dint.c | 3 +- src/H5Dio.c | 4 +- src/H5Dpkg.h | 9 +++- src/H5Dvirtual.c | 50 ++++++++++++++++++++ src/H5Olayout.c | 6 ++- test/direct_chunk.c | 121 +++++++++++++++++++++++++++++++++++++++-------- 11 files changed, 243 insertions(+), 29 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 3b68ba0..77f7f4e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -327,6 +327,18 @@ Bug Fixes since HDF5-1.10.4 release Library ------- + - Fixed a bug that would cause an error or cause fill values to be + incorrectly read from a chunked dataset using the "single chunk" index if + the data was held in cache and there was no data on disk. + + (NAF - 2019/03/06) + + - Fixed a bug that could cause an error or cause fill values to be + incorrectly read from a dataset that was written to using H5Dwrite_chunk + if the dataset was not closed after writing. + + (NAF - 2019/03/06, HDFFV-10716) + - Fixed memory leak in scale offset filter In a special case where the MinBits is the same as the number of bits in diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 553d75c..89c182d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -331,6 +331,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ H5D__chunk_construct, H5D__chunk_init, H5D__chunk_is_space_alloc, + H5D__chunk_is_data_cached, H5D__chunk_io_init, H5D__chunk_read, H5D__chunk_write, @@ -358,6 +359,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{ NULL, NULL, NULL, + NULL, #ifdef H5_HAVE_PARALLEL NULL, NULL, @@ -412,10 +414,13 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) + /* Sanity checks */ + HDassert(layout->type == H5D_CHUNKED); + io_info.dset = dset; /* Allocate dataspace and initialize it if it hasn't been. */ - if(!(*layout->ops->is_space_alloc)(&layout->storage)) + if(!H5D__chunk_is_space_alloc(&layout->storage)) /* Allocate storage */ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") @@ -453,13 +458,17 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, if(0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset)) /* If there are no filters and we are overwriting the chunk we can just set values */ need_insert = FALSE; - else + else { /* Otherwise, create the chunk it if it doesn't exist, or reallocate the chunk * if its size has changed. */ if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") + /* Cache the new chunk information */ + H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata); + } /* end else */ + /* Make sure the address of the chunk is returned. */ if(!H5F_addr_defined(udata.chunk_block.offset)) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined") @@ -524,7 +533,8 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, *filters = 0; /* Allocate dataspace and initialize it if it hasn't been. */ - if(!(*layout->ops->is_space_alloc)(&layout->storage)) + if(!H5D__chunk_is_space_alloc(&layout->storage) + && !H5D__chunk_is_data_cached(dset->shared)) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized") /* Calculate the index of this chunk */ @@ -1037,6 +1047,30 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage) /*------------------------------------------------------------------------- + * Function: H5D__chunk_is_data_cached + * + * Purpose: Query if raw data is cached for dataset + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednessday, March 6, 2016 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(shared_dset); + + FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0) +} /* end H5D__chunk_is_data_cached() */ + + +/*------------------------------------------------------------------------- * Function: H5D__chunk_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index c0c2a80..651aaf4 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -80,6 +80,7 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D__compact_construct, NULL, H5D__compact_is_space_alloc, + NULL, H5D__compact_io_init, H5D__contig_read, H5D__contig_write, diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index ad12ba0..c2e9bfc 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -118,6 +118,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_construct, H5D__contig_init, H5D__contig_is_space_alloc, + H5D__contig_is_data_cached, H5D__contig_io_init, H5D__contig_read, H5D__contig_write, @@ -538,6 +539,30 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage) /*------------------------------------------------------------------------- + * Function: H5D__contig_is_data_cached + * + * Purpose: Query if raw data is cached for dataset + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednessday, March 6, 2016 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5D__contig_is_data_cached(const H5D_shared_t *shared_dset) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(shared_dset); + + FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0) +} /* end H5D__contig_is_data_cached() */ + + +/*------------------------------------------------------------------------- * Function: H5D__contig_io_init * * Purpose: Performs initialization before any sort of I/O on the raw data diff --git a/src/H5Defl.c b/src/H5Defl.c index b2f9b29..42b3947 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -91,6 +91,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D__efl_construct, NULL, H5D__efl_is_space_alloc, + NULL, H5D__efl_io_init, H5D__contig_read, H5D__contig_write, diff --git a/src/H5Dint.c b/src/H5Dint.c index ea4245b..d3cad8f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2878,7 +2878,8 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) *------------------------------------------------------------------------- */ if(H5D_CHUNKED == dset->shared->layout.type) { - if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) + if(shrink && ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage) + || (dset->shared->layout.ops->is_data_cached && (*dset->shared->layout.ops->is_data_cached)(dset->shared)))) /* Remove excess chunks */ if(H5D__chunk_prune_by_extent(dset, curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks") diff --git a/src/H5Dio.c b/src/H5Dio.c index 8abcd81..a03f780 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -546,7 +546,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * has been overwritten. So just proceed in reading. */ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && - !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) { + !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) && + !(dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) { H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */ /* Retrieve dataset's fill-value properties */ @@ -578,6 +579,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Sanity check that space is allocated, if there are elements */ if(nelmts > 0) HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) + || (dataset->shared->layout.ops->is_data_cached && (*dataset->shared->layout.ops->is_data_cached)(dataset->shared)) || dataset->shared->dcpl_cache.efl.nused > 0 || dataset->shared->layout.type == H5D_COMPACT); diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index da74d11..d4fd34d 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -113,12 +113,14 @@ typedef struct H5D_type_info_t { /* Forward declaration of structs used below */ struct H5D_io_info_t; struct H5D_chunk_map_t; +typedef struct H5D_shared_t H5D_shared_t; /* Function pointers for I/O on particular types of dataset layouts */ typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset); typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset, hid_t dapl_id); typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage); +typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset); typedef herr_t (*H5D_layout_io_init_func_t)(const struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, @@ -144,6 +146,7 @@ typedef struct H5D_layout_ops_t { H5D_layout_construct_func_t construct; /* Layout constructor for new datasets */ H5D_layout_init_func_t init; /* Layout initializer for dataset */ H5D_layout_is_space_alloc_func_t is_space_alloc; /* Query routine to determine if storage is allocated */ + H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */ H5D_layout_io_init_func_t io_init; /* I/O initialization routine */ H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */ H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */ @@ -429,7 +432,7 @@ typedef struct H5D_rdcdc_t { * created once for a given dataset. Thus, if a dataset is opened twice, * there will be two IDs and two H5D_t structs, both sharing one H5D_shared_t. */ -typedef struct H5D_shared_t { +struct H5D_shared_t { size_t fo_count; /* Reference count */ hbool_t closing; /* Flag to indicate dataset is closing */ hid_t type_id; /* ID for dataset's datatype */ @@ -459,7 +462,7 @@ typedef struct H5D_shared_t { H5D_append_flush_t append_flush; /* Append flush property information */ char *extfile_prefix; /* expanded external file prefix */ char *vds_prefix; /* expanded vds prefix */ -} H5D_shared_t; +}; struct H5D_t { H5O_loc_t oloc; /* Object header location */ @@ -624,6 +627,7 @@ H5_DLL herr_t H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned upd /* Functions that operate on contiguous storage */ H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage); H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage); +H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset); H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info); H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, @@ -642,6 +646,7 @@ H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/); H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); +H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes); diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 1d2b191..2e8ca5d 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -78,6 +78,7 @@ /********************/ /* Layout operation callbacks */ +static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset); static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm); @@ -121,6 +122,7 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{ NULL, H5D__virtual_init, H5D__virtual_is_space_alloc, + H5D__virtual_is_data_cached, NULL, H5D__virtual_read, H5D__virtual_write, @@ -2235,6 +2237,54 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) /*------------------------------------------------------------------------- + * Function: H5D__virtual_is_data_cached + * + * Purpose: Query if raw data is cached for dataset + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednessday, March 6, 2016 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) +{ + const H5O_storage_virtual_t *storage; /* Convenience pointer */ + size_t i, j; /* Local index variables */ + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(shared_dset); + storage = &shared_dset->layout.storage.u.virt; + + /* Iterate over mappings */ + for(i = 0; i < storage->list_nused; i++) + /* Check for "printf" source dataset resolution */ + if(storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) { + /* Iterate over sub-source dsets */ + for(j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++) + /* Check for cahced data in source dset */ + if(storage->list[i].sub_dset[j].dset + && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached + && storage->list[i].sub_dset[j].dset->shared->layout.ops->is_data_cached(storage->list[i].sub_dset[j].dset->shared)) + HGOTO_DONE(TRUE); + } /* end if */ + else + if(storage->list[i].source_dset.dset + && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached + && storage->list[i].source_dset.dset->shared->layout.ops->is_data_cached(storage->list[i].source_dset.dset->shared)) + HGOTO_DONE(TRUE); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__virtual_is_data_cached() */ + + +/*------------------------------------------------------------------------- * Function: H5D__virtual_pre_io * * Purpose: Project all virtual mappings onto mem_space, with the diff --git a/src/H5Olayout.c b/src/H5Olayout.c index d0c7f3e..ba63a16 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -1045,7 +1045,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, layout_dst->storage.u.contig.size = H5S_extent_nelem(udata->src_space_extent) * H5T_get_size(udata->src_dtype); - if(H5D__contig_is_space_alloc(&layout_src->storage)) { + if(H5D__contig_is_space_alloc(&layout_src->storage) + || (cpy_info->shared_fo && H5D__contig_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) { /* copy contiguous raw data */ if(H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage") @@ -1054,7 +1055,8 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, break; case H5D_CHUNKED: - if(H5D__chunk_is_space_alloc(&layout_src->storage)) { + if(H5D__chunk_is_space_alloc(&layout_src->storage) + || (cpy_info->shared_fo && H5D__chunk_is_data_cached((const H5D_shared_t *)cpy_info->shared_fo))) { /* Create chunked layout */ if(H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 1c5862d..f68fb93 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -58,6 +58,14 @@ #define OVERWRITE_CHUNK_NY 2 #define OVERWRITE_VALUE 42 +/* Test configurations */ +#define CONFIG_LATEST 0x01 +#define CONFIG_REOPEN_FILE 0x02 +#define CONFIG_REOPEN_DSET 0x04 +#define CONFIG_DIRECT_WRITE 0x08 +#define CONFIG_DIRECT_READ 0x10 +#define CONFIG_END 0x20 + /* Defines used in test_single_chunk_latest() */ #define FILE "single_latest.h5" #define DATASET "dataset" @@ -1973,7 +1981,7 @@ error: } /* test_read_unallocated_chunk() */ /*------------------------------------------------------------------------- - * Function: test_single_chunk_latest + * Function: test_single_chunk * * Purpose: This is to verify the fix for jira issue HDFFV-10425. * The problem was due to a bug in the internal ilbrary routine @@ -1989,13 +1997,16 @@ error: * index for the dataset. * Verify that the data read is the same as the written data. * + * Since expanded to test multiple combinations of cases + * involving a single chunk + * * Return: Success: 0 * Failure: 1 * *------------------------------------------------------------------------- */ static int -test_single_chunk_latest(void) +test_single_chunk(unsigned config) { hid_t fid; /* File ID */ hid_t fapl; /* File access property list ID */ @@ -2005,11 +2016,12 @@ test_single_chunk_latest(void) hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */ hsize_t offset[2] = {0,0}; /* Offset for writing */ + uint32_t filters; /* Filter mask out */ int wdata[DIM0][DIM1]; /* Write buffer */ int rdata[DIM0][DIM1]; /* Read buffer */ int i, j; /* Local index variable */ - TESTING("H5Dwrite_chunk with single chunk and latest format"); + TESTING("Single chunk I/O"); /* Initialize data */ for (i=0; i"); + if(config & CONFIG_LATEST) { + if(need_comma) + printf(", "); + printf("latest format"); + need_comma = TRUE; + } /* end if */ + if(config & CONFIG_REOPEN_FILE) { + if(need_comma) + printf(", "); + printf("reopen file"); + need_comma = TRUE; + } /* end if */ + else if(config & CONFIG_REOPEN_DSET) { + if(need_comma) + printf(", "); + printf("reopen dataset"); + need_comma = TRUE; + } /* end if */ + if(config & CONFIG_DIRECT_WRITE) { + if(need_comma) + printf(", "); + printf("direct write"); + need_comma = TRUE; + } /* end if */ + if(config & CONFIG_DIRECT_READ) { + if(need_comma) + printf(", "); + printf("direct read"); + need_comma = TRUE; + } /* end if */ + printf(":\n"); + fflush(stdout); + + nerrors += test_single_chunk(config); + } /* end for */ if(H5Fclose(file_id) < 0) goto error; @@ -2165,3 +2245,4 @@ error: HDputs("*** TESTS FAILED ***"); return EXIT_FAILURE; } + -- cgit v0.12 From cc0a892704bcd5a15d919d346202a066d551b183 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Mon, 25 Mar 2019 10:00:31 -0500 Subject: HDFFV-10738 Wrong INTENT for H5LTread_dataset_double_f Fixed. Also fixed INTENT issues for H5DS, H5IM and H5TB when reading or getting. --- hl/fortran/src/H5DSff.F90 | 34 +++++++++++++++++----------------- hl/fortran/src/H5HL_buildiface.F90 | 16 ++++++++-------- hl/fortran/src/H5IMff.F90 | 4 ++-- hl/fortran/src/H5TBff.F90 | 8 ++++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/hl/fortran/src/H5DSff.F90 b/hl/fortran/src/H5DSff.F90 index 2dca479..5488bb2 100644 --- a/hl/fortran/src/H5DSff.F90 +++ b/hl/fortran/src/H5DSff.F90 @@ -304,7 +304,7 @@ CONTAINS IMPLICIT NONE INTEGER(hid_t), INTENT(in) :: did ! The dataset INTEGER , INTENT(in) :: idx ! The dimension - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label INTEGER(SIZE_T), INTENT(in) :: label_len ! Length of label END FUNCTION H5DSset_label_c END INTERFACE @@ -337,11 +337,11 @@ CONTAINS IMPLICIT NONE - INTEGER(hid_t), INTENT(in) :: did ! The dataget - INTEGER , INTENT(in) :: idx ! The dimension - CHARACTER(LEN=*), INTENT(in) :: label ! The label - INTEGER(size_t) , INTENT(inout) :: size ! The length of the label buffer - INTEGER :: errcode ! Error code + INTEGER(hid_t), INTENT(in) :: did ! The dataget + INTEGER , INTENT(in) :: idx ! The dimension + CHARACTER(LEN=*), INTENT(INOUT) :: label ! The label + INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the label buffer + INTEGER :: errcode ! Error code INTEGER :: c_idx INTERFACE @@ -352,7 +352,7 @@ CONTAINS IMPLICIT NONE INTEGER(hid_t), INTENT(in) :: did ! The dataget INTEGER , INTENT(in) :: idx ! The dimension - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: label ! The label + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: label ! The label INTEGER(SIZE_T), INTENT(inout) :: size ! Length of label END FUNCTION H5DSget_label_c END INTERFACE @@ -386,8 +386,8 @@ CONTAINS IMPLICIT NONE INTEGER(hid_t), INTENT(in) :: did ! The dataget - CHARACTER(LEN=*), INTENT(out) :: name ! The name - INTEGER(size_t) , INTENT(inout) :: size ! The length of the name buffer + CHARACTER(LEN=*), INTENT(INOUT) :: name ! The name + INTEGER(size_t) , INTENT(INOUT) :: size ! The length of the name buffer INTEGER :: errcode ! Error code INTERFACE @@ -397,7 +397,7 @@ CONTAINS IMPORT :: HID_T, SIZE_T IMPLICIT NONE INTEGER(hid_t), INTENT(in) :: did ! The dataget - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(out) :: name ! The name + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(INOUT) :: name ! The name INTEGER(SIZE_T), INTENT(inout) :: size ! Length of name END FUNCTION H5DSget_scale_name_c END INTERFACE @@ -426,10 +426,10 @@ CONTAINS SUBROUTINE H5DSget_num_scales_f( did, idx, num_scales, errcode) IMPLICIT NONE - INTEGER(hid_t), INTENT(in) :: did ! the dataset - INTEGER , INTENT(in) :: idx ! the dimension of did to query - INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did - INTEGER :: errcode ! error code + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER , INTENT(in) :: idx ! the dimension of did to query + INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did + INTEGER :: errcode ! error code INTEGER :: c_idx INTERFACE @@ -437,9 +437,9 @@ CONTAINS BIND(C,NAME='h5dsget_num_scales_c') IMPORT :: HID_T IMPLICIT NONE - INTEGER(hid_t), INTENT(in) :: did ! the dataset - INTEGER , INTENT(in) :: idx ! the dimension of did to query - INTEGER , INTENT(out) :: num_scales ! the number of Dimension Scales associated with did + INTEGER(hid_t), INTENT(in) :: did ! the dataset + INTEGER , INTENT(in) :: idx ! the dimension of did to query + INTEGER , INTENT(INOUT) :: num_scales ! the number of Dimension Scales associated with did END FUNCTION H5DSget_num_scales_c END INTERFACE diff --git a/hl/fortran/src/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90 index dda8d56..1c5d9c8 100644 --- a/hl/fortran/src/H5HL_buildiface.F90 +++ b/hl/fortran/src/H5HL_buildiface.F90 @@ -293,7 +293,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id' WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' @@ -354,7 +354,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' @@ -414,7 +414,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' @@ -510,7 +510,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: type_id' - WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' @@ -540,7 +540,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' INTEGER(hid_t) , INTENT(IN) :: loc_id' WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(IN) :: dset_name' WRITE(11,'(A)') ' INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims' - WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' @@ -712,7 +712,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start' WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords' WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1' @@ -778,7 +778,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: start' WRITE(11,'(A)') ' INTEGER(hsize_t), INTENT(in) :: nrecords' WRITE(11,'(A)') ' INTEGER(size_t), INTENT(in) :: type_size' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf' WRITE(11,'(A)') ' INTEGER :: errcode ' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' @@ -809,7 +809,7 @@ PROGRAM H5HL_buildiface WRITE(11,'(A)') ' CHARACTER(LEN=*), INTENT(in) :: field_name' WRITE(11,'(A)') ' INTEGER(hid_t), INTENT(in) :: field_type' WRITE(11,'(A)') ' INTEGER, INTENT(in) :: field_index' - WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(in), DIMENSION(*), TARGET :: buf' + WRITE(11,'(A)') ' REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(IN), DIMENSION(*), TARGET :: buf' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen' WRITE(11,'(A)') ' INTEGER(size_t) :: namelen1' WRITE(11,'(A)') ' INTEGER :: errcode' diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90 index 6646828..ac4b794 100644 --- a/hl/fortran/src/H5IMff.F90 +++ b/hl/fortran/src/H5IMff.F90 @@ -539,7 +539,7 @@ CONTAINS INTEGER, INTENT(in) :: pal_number ! palette number INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions INTEGER :: errcode ! error code - INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen ! name length INTERFACE INTEGER FUNCTION h5imget_palette_info_c(loc_id,namelen,dset_name,pal_number,dims) & @@ -551,7 +551,7 @@ CONTAINS CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset INTEGER, INTENT(in) :: pal_number ! palette number INTEGER(hsize_t), DIMENSION(*), INTENT(inout) :: dims ! dimensions - INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen ! name length END FUNCTION h5imget_palette_info_c END INTERFACE diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 2575b24..d18d023 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -532,7 +532,7 @@ CONTAINS INTEGER(hsize_t), INTENT(in) :: start ! start record INTEGER(hsize_t), INTENT(in) :: nrecords ! records INTEGER(size_t), INTENT(in) :: type_size ! type size - INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer + INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length INTEGER(size_t) :: namelen1 @@ -564,7 +564,7 @@ CONTAINS INTEGER(hsize_t), INTENT(in) :: start ! start record INTEGER(hsize_t), INTENT(in) :: nrecords ! records INTEGER(size_t), INTENT(in) :: type_size ! type size - CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length INTEGER(size_t) :: namelen1 ! name length @@ -687,7 +687,7 @@ CONTAINS INTEGER(hsize_t), INTENT(in) :: start ! start record INTEGER(hsize_t), INTENT(in) :: nrecords ! records INTEGER(size_t), INTENT(in) :: type_size ! type size - INTEGER, INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer + INTEGER, INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length TYPE(C_PTR) :: f_ptr @@ -716,7 +716,7 @@ CONTAINS INTEGER(hsize_t), INTENT(in) :: start ! start record INTEGER(hsize_t), INTENT(in) :: nrecords ! records INTEGER(size_t), INTENT(in) :: type_size ! type size - CHARACTER(LEN=*), INTENT(in), DIMENSION(*), TARGET :: buf ! data buffer + CHARACTER(LEN=*), INTENT(INOUT), DIMENSION(*), TARGET :: buf ! data buffer INTEGER :: errcode ! error code INTEGER(size_t) :: namelen ! name length TYPE(C_PTR) :: f_ptr -- cgit v0.12 From ad3a510e61017fa6da64b46e45120172d27376c2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 28 Mar 2019 13:42:49 -0500 Subject: Correct Examples for packaging --- config/cmake/HDF5_Examples.cmake.in | 2 + config/cmake/HDF5_Examples_options.cmake | 103 ------------------------------- config/cmake/README.txt.cmake.in | 2 +- release_docs/USING_CMake_Examples.txt | 2 + 4 files changed, 5 insertions(+), 104 deletions(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index a2d38f5..6951b09 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -103,6 +103,8 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PAC if(WIN32) include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake) + include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) else() include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake) + include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) endif() diff --git a/config/cmake/HDF5_Examples_options.cmake b/config/cmake/HDF5_Examples_options.cmake index 6e4b510..386e99c 100755 --- a/config/cmake/HDF5_Examples_options.cmake +++ b/config/cmake/HDF5_Examples_options.cmake @@ -57,106 +57,3 @@ #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCOMPARE_TESTING:BOOL=ON") ############################################################################################# -# Do not edit below this line -############################################################################################# -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if (APPLE) - # Compiler choice - execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set (ENV{CC} "${XCODE_CC}") - set (ENV{CXX} "${XCODE_CXX}") - if (NOT NO_MAC_FORTRAN) - # Shared fortran is not supported, build static - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - else () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") - endif () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -else () - set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}") -endif () - -#----------------------------------------------------------------------------- -set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -## -------------------------- -if (CTEST_USE_TAR_SOURCE) - ## Uncompress source if tar or zip file provided - ## -------------------------- - if (WIN32) - message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") - execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) - else () - message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") - execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) - endif () - - if (NOT rv EQUAL 0) - message (STATUS "extracting... [error-(${rv}) clean up]") - file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") - message (FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") - endif () -endif() - -#----------------------------------------------------------------------------- -## Clear the build directory -## -------------------------- -set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY}) -else () - file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") -endif () - -# Use multiple CPU cores to build -include (ProcessorCount) -ProcessorCount (N) -if (NOT N EQUAL 0) - if (NOT WIN32) - set (CTEST_BUILD_FLAGS -j${N}) - endif () - set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif () -set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" -) - -#----------------------------------------------------------------------------- -## -- set output to english -set ($ENV{LC_MESSAGES} "en_EN") - -#----------------------------------------------------------------------------- -configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) -ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") -## NORMAL process -## -------------------------- -ctest_start (Experimental) -ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -if (${res} LESS 0 OR ${res} GREATER 0) - file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n") -endif () -if (LOCAL_SUBMIT) - ctest_submit (PARTS Configure Notes) -endif () -ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND APPEND RETURN_VALUE res NUMBER_ERRORS errval) -if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n") -endif () -if (LOCAL_SUBMIT) - ctest_submit (PARTS Build) -endif () -ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) -if (${res} LESS 0 OR ${res} GREATER 0) - file(APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n") -endif () -if (LOCAL_SUBMIT) - ctest_submit (PARTS Test) -endif () -if (${res} LESS 0 OR ${res} GREATER 0) - message (FATAL_ERROR "tests FAILED") -endif () -#----------------------------------------------------------------------------- -############################################################################################################## -message (STATUS "DONE") diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index be6ddc1..b29d50b 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -34,9 +34,9 @@ utility should be installed. To test the installation with the examples; Create a directory to run the examples. Copy HDF5Examples folder to this directory. + Copy CTestScript.cmake to this directory. Copy HDF5_Examples.cmake to this directory. Copy HDF5_Examples_options.cmake to this directory. - Copy CTestScript.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed with the CTEST_SOURCE_NAME script option. The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@". diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index ea1ac05..ea352fe 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -38,12 +38,14 @@ II. Building HDF5 Examples with CMake Files in the HDF5 install directory: HDF5Examples folder + CTestScript.cmake HDF5_Examples.cmake HDF5_Examples_options.cmake Default installation process: Create a directory to run the examples, i.e. \test_hdf5. Copy HDF5Examples folder to this directory. + Copy CTestScript.cmake to this directory. Copy HDF5_Examples.cmake to this directory. Copy HDF5_Examples_options.cmake to this directory. The default source folder is defined as "HDF5Examples". It can be changed -- cgit v0.12 From 8c34530608aa0b8afad6108d9ddb633850e0b351 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 28 Mar 2019 16:41:30 -0500 Subject: Allow option to select NAMESPACE --- CMakeInstallation.cmake | 4 +- CMakeLists.txt | 2 +- config/cmake/cacheinit.cmake | 2 + config/cmake_ext_mod/HDFLibMacros.cmake | 73 ++++++--------------------------- 4 files changed, 17 insertions(+), 64 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 7a0746a..874db37 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -33,7 +33,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) EXPORT ${HDF5_EXPORTED_TARGETS} DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5 FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${HDF5_PACKAGE}:: + NAMESPACE ${PACKAGE_NAMESPACE} COMPONENT configinstall ) endif () @@ -45,7 +45,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) export ( TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT} FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${HDF5_PACKAGE}:: + NAMESPACE ${PACKAGE_NAMESPACE} ) endif () endif () diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cad454..a70ec4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -744,7 +744,7 @@ endif () option (BUILD_TESTING "Build HDF5 Unit Testing" ON) if (BUILD_TESTING) set (DART_TESTING_TIMEOUT 1200 - CACHE INTEGER + CACHE STRING "Timeout in seconds for each test (default 1200=20minutes)" ) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index d5c5e52..9b59de3 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -19,6 +19,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) +set (HDF_PACKAGE_NAMESPACE "${HDF5_PACKAGE}::" CACHE STRING "Name for HDF package namespace" FORCE) + set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_BUILD_GENERATORS ON CACHE BOOL "Build Test Generators" FORCE) diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index 2eda66c..b4edcc9 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -14,25 +14,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) # May need to build JPEG with PIC on x64 machines with gcc # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (JPEG - SVN_REPOSITORY ${JPEG_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - ) - elseif (${compress_type} MATCHES "GIT") + if (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (JPEG GIT_REPOSITORY ${JPEG_URL} GIT_TAG ${JPEG_BRANCH} @@ -49,6 +31,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (JPEG @@ -67,6 +50,7 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) endif () externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) @@ -100,33 +84,14 @@ macro (PACKAGE_JPEG_LIBRARY compress_type) COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jconfig.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") add_dependencies (JPEG-GenHeader-Copy JPEG) endif () endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (SZIP - SVN_REPOSITORY ${SZIP_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - -DSZIP_ENABLE_ENCODING:BOOL=${encoding} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - ) - elseif (${compress_type} MATCHES "GIT") + if (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (SZIP GIT_REPOSITORY ${SZIP_URL} GIT_TAG ${SZIP_BRANCH} @@ -144,6 +109,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (SZIP @@ -163,6 +129,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DSZIP_ENABLE_ENCODING:BOOL=${encoding} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) endif () externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) @@ -196,32 +163,14 @@ macro (PACKAGE_SZIP_LIBRARY compress_type) COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") add_dependencies (SZIP-GenHeader-Copy SZIP) endif () endmacro () #------------------------------------------------------------------------------- macro (EXTERNAL_ZLIB_LIBRARY compress_type) - if (${compress_type} MATCHES "SVN") - EXTERNALPROJECT_ADD (ZLIB - SVN_REPOSITORY ${ZLIB_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} - -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} - -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} - -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} - ) - elseif (${compress_type} MATCHES "GIT") + if (${compress_type} MATCHES "GIT") EXTERNALPROJECT_ADD (ZLIB GIT_REPOSITORY ${ZLIB_URL} GIT_TAG ${ZLIB_BRANCH} @@ -238,6 +187,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) elseif (${compress_type} MATCHES "TGZ") EXTERNALPROJECT_ADD (ZLIB @@ -256,6 +206,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DCMAKE_PDB_OUTPUT_DIRECTORY:PATH=${CMAKE_PDB_OUTPUT_DIRECTORY} -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + -DPACKAGE_NAMESPACE=${HDF_PACKAGE_NAMESPACE} ) endif () externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) @@ -294,7 +245,7 @@ macro (PACKAGE_ZLIB_LIBRARY compress_type) COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" ) set (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) - if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ") + if (${compress_type} MATCHES "GIT" OR ${compress_type} MATCHES "TGZ") add_dependencies (ZLIB-GenHeader-Copy ZLIB) endif () endmacro () -- cgit v0.12 From 5894e19ad5432f599dd5deba2f4cc0e224c92bc3 Mon Sep 17 00:00:00 2001 From: hdftest Date: Mon, 1 Apr 2019 17:02:17 -0500 Subject: Snapshot version 1.10 release 6 (snap0)\nUpdate version to 1.10.6-snap1) --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 6f9543c..ae340d1 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.10.6-snap0 currently under development +HDF5 version 1.10.6-snap1 currently under development ------------------------------------------------------------------------------ Please refer to the release_docs/INSTALL file for installation instructions. diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 38ee874..d94190b 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.10.6-snap0, currently under development" +PROJECT_NUMBER = "1.10.6-snap1, currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 5bb4617..8f0c9fa 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -35,7 +35,7 @@ cmake_minimum_required (VERSION 3.10) ############################################################################## set (CTEST_SOURCE_VERSION "1.10.6") -set (CTEST_SOURCE_VERSEXT "-snap0") +set (CTEST_SOURCE_VERSEXT "-snap1") ############################################################################## # handle input parameters to script. diff --git a/configure.ac b/configure.ac index 7248637..19c3ed1 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.10.6-snap0], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.10.6-snap1], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 77f7f4e..ce8b8a5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.10.6-snap0 currently under development +HDF5 version 1.10.6-snap1 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index e73ce8b..0252549 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,9 +94,9 @@ extern "C" { #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 10 /* For minor interface/format changes */ #define H5_VERS_RELEASE 6 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "snap0" /* For pre-releases like snap0 */ +#define H5_VERS_SUBRELEASE "snap1" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.10.6-snap0" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.10.6-snap1" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) -- cgit v0.12 From f3546fb4b0276687a04aaef1b01b087d0a25ff30 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Apr 2019 10:48:37 -0500 Subject: Update namespace handling --- CMakeInstallation.cmake | 4 +-- config/cmake/cacheinit.cmake | 2 +- config/cmake/hdf5-config.cmake.in | 4 +-- config/cmake/mccacheinit.cmake | 2 ++ config/cmake_ext_mod/HDFLibMacros.cmake | 49 +++++++++++++++++---------------- test/CMakeVFDTests.cmake | 4 +-- 6 files changed, 34 insertions(+), 31 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 874db37..3ae5b8b 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -33,7 +33,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) EXPORT ${HDF5_EXPORTED_TARGETS} DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/hdf5 FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${PACKAGE_NAMESPACE} + NAMESPACE ${HDF_PACKAGE_NAMESPACE} COMPONENT configinstall ) endif () @@ -45,7 +45,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) export ( TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} ${HDF5_UTILS_TO_EXPORT} FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake - NAMESPACE ${PACKAGE_NAMESPACE} + NAMESPACE ${HDF_PACKAGE_NAMESPACE} ) endif () endif () diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 9b59de3..5254115 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -19,7 +19,7 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) -set (HDF_PACKAGE_NAMESPACE "${HDF5_PACKAGE}::" CACHE STRING "Name for HDF package namespace" FORCE) +set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace (can be empty)" FORCE) set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index b1ef0ac..d0f1d00 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -108,10 +108,10 @@ set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) # project which has already built hdf5 as a subproject #----------------------------------------------------------------------------- if (NOT TARGET "@HDF5_PACKAGE@") - if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib") + if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif () - if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip") + if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) endif () include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 577144b..c35f51f 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -23,6 +23,8 @@ set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) +set (HDF_PACKAGE_NAMESPACE "hdf5::" CACHE STRING "Name for HDF package namespace" FORCE) + set (HDF5_BUILD_CPP_LIB ON CACHE BOOL "Build HDF5 C++ Library" FORCE) set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index b4edcc9..9df2b4b 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -57,17 +57,17 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic) ##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target jpeg-static - add_library(jpeg-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "") - add_dependencies (jpeg-static JPEG) - set (JPEG_STATIC_LIBRARY "jpeg-static") + add_library(${HDF_PACKAGE_NAMESPACE}jpeg-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-static "jpeg" STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-static JPEG) + set (JPEG_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}jpeg-static") set (JPEG_LIBRARIES ${JPEG_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target jpeg-shared - add_library(jpeg-shared SHARED IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "") - add_dependencies (jpeg-shared JPEG) - set (JPEG_SHARED_LIBRARY "jpeg-shared") + add_library(${HDF_PACKAGE_NAMESPACE}jpeg-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}jpeg-shared "jpeg" SHARED "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}jpeg-shared JPEG) + set (JPEG_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}jpeg-shared") set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY}) endif () @@ -136,17 +136,17 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) ##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target szip-static - add_library(szip-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "") - add_dependencies (szip-static SZIP) - set (SZIP_STATIC_LIBRARY "szip-static") + add_library(${HDF_PACKAGE_NAMESPACE}szip-static STATIC IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-static "szip" STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-static SZIP) + set (SZIP_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-static") set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target szip-shared - add_library(szip-shared SHARED IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "") - add_dependencies (szip-shared SZIP) - set (SZIP_SHARED_LIBRARY "szip-shared") + add_library(${HDF_PACKAGE_NAMESPACE}szip-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}szip-shared "szip" SHARED "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}szip-shared SZIP) + set (SZIP_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}szip-shared") set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY}) endif () @@ -218,17 +218,18 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) endif () ##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake) # Create imported target zlib-static - add_library(zlib-static STATIC IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "") - add_dependencies (zlib-static ZLIB) - set (ZLIB_STATIC_LIBRARY "zlib-static") + add_library(${HDF_PACKAGE_NAMESPACE}zlib-static STATIC IMPORTED) +# add_library(${HDF_PACKAGE_NAMESPACE}zlib-static ALIAS zlib-static) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-static ${ZLIB_LIB_NAME} STATIC "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-static ZLIB) + set (ZLIB_STATIC_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-static") set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY}) if (BUILD_SHARED_LIBS) # Create imported target zlib-shared - add_library(zlib-shared SHARED IMPORTED) - HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "") - add_dependencies (zlib-shared ZLIB) - set (ZLIB_SHARED_LIBRARY "zlib-shared") + add_library(${HDF_PACKAGE_NAMESPACE}zlib-shared SHARED IMPORTED) + HDF_IMPORT_SET_LIB_OPTIONS (${HDF_PACKAGE_NAMESPACE}zlib-shared ${ZLIB_LIB_NAME} SHARED "") + add_dependencies (${HDF_PACKAGE_NAMESPACE}zlib-shared ZLIB) + set (ZLIB_SHARED_LIBRARY "${HDF_PACKAGE_NAMESPACE}zlib-shared") set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY}) endif () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 791f75c..64ccacd 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -142,7 +142,7 @@ endif () ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err ) - add_test (NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -163,7 +163,7 @@ endif () COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}" ) if (BUILD_SHARED_LIBS) - add_test (NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" ) endif () -- cgit v0.12 From 7dfec79e315df8c9001ec10f8d4ff7bba39ff924 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Apr 2019 11:55:01 -0500 Subject: CMake fixes --- testpar/CMakeTests.cmake | 2 +- tools/test/misc/CMakeTestsMkgrp.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 214801b..4095bd9 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -89,7 +89,7 @@ endforeach () # The t_pflush1 test is hard-coded to fail. set_tests_properties (MPI_TEST_t_pflush1 PROPERTIES WILL_FAIL "true") -#set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") +#set_property (MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") set_tests_properties (MPI_TEST_t_pflush2 PROPERTIES DEPENDS MPI_TEST_t_pflush1) set_tests_properties (MPI_TEST_t_prestart PROPERTIES DEPENDS MPI_TEST_t_pshutdown) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index db3b7e4..87d3a20 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -76,7 +76,7 @@ if (last_test) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () - else (HDF5_ENABLE_USING_MEMCHECKER) + else () set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) add_test ( NAME H5MKGRP-${resultfile}-h5ls -- cgit v0.12 From ca1165f3ab5121e433eb8ffa4de74e061c8b3cd1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 4 Apr 2019 13:26:14 -0500 Subject: Update java m4 scripts --- m4/ax_check_class.m4 | 75 ++++------------------------------------------- m4/ax_check_classpath.m4 | 6 ++-- m4/ax_check_java_home.m4 | 6 ++-- m4/ax_check_junit.m4 | 4 +-- m4/ax_check_rqrd_class.m4 | 6 ++-- m4/ax_java_check_class.m4 | 8 ++--- m4/ax_java_options.m4 | 4 +-- m4/ax_jni_include_dir.m4 | 61 +++++++++++++++++++++++++------------- m4/ax_prog_jar.m4 | 4 +-- m4/ax_prog_java.m4 | 6 ++-- m4/ax_prog_java_cc.m4 | 6 ++-- m4/ax_prog_java_works.m4 | 51 +++----------------------------- m4/ax_prog_javac.m4 | 6 ++-- m4/ax_prog_javac_works.m4 | 6 ++-- m4/ax_prog_javadoc.m4 | 4 +-- m4/ax_prog_javah.m4 | 16 +++++----- m4/ax_try_compile_java.m4 | 8 ++--- m4/ax_try_run_java.m4 | 4 +-- 18 files changed, 96 insertions(+), 185 deletions(-) diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 index 098aa77..e673c2d 100644 --- a/m4/ax_check_class.m4 +++ b/m4/ax_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_class.html # =========================================================================== # # SYNOPSIS @@ -36,7 +36,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -51,83 +51,18 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 12 AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) AC_DEFUN([AX_CHECK_CLASS],[ AC_REQUIRE([AX_PROG_JAVA]) ac_var_name=`echo $1 | sed 's/\./_/g'` -dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is +dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ -if test x$ac_cv_prog_uudecode_base64 = xyes; then -dnl /** -dnl * Test.java: used to test dynamicaly if a class exists. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl Class lib; -dnl if (argv.length < 1) -dnl { -dnl System.err.println ("Missing argument"); -dnl System.exit (77); -dnl } -dnl try -dnl { -dnl lib = Class.forName (argv[0]); -dnl } -dnl catch (ClassNotFoundException e) -dnl { -dnl System.exit (1); -dnl } -dnl lib = null; -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ -AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt -ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV -ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp -VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM -amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi -AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B -AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA -AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN -uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK -AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA -JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA -JwAAAAIAKA== -==== -EOF - if $UUDECODE Test.uue; then - : - else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no - fi - rm -f Test.uue - if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then - eval "ac_cv_class_$ac_var_name=yes" - else - eval "ac_cv_class_$ac_var_name=no" - fi - rm -f Test.class -else AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) -fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val @@ -137,7 +72,7 @@ else ifelse([$3], , :, [$3]) fi ]) -dnl for some reason the above statment didn't fall though here? +dnl for some reason the above statement didn't fall though here? dnl do scripts have variable scoping? eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" AC_MSG_RESULT($ac_var_val) diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 index 3c9081a..e08a253 100644 --- a/m4/ax_check_classpath.m4 +++ b/m4/ax_check_classpath.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html # =========================================================================== # # SYNOPSIS @@ -33,7 +33,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -48,7 +48,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) AC_DEFUN([AX_CHECK_CLASSPATH],[ diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 index cfe8f58..1d60387 100644 --- a/m4/ax_check_java_home.m4 +++ b/m4/ax_check_java_home.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html # =========================================================================== # # SYNOPSIS @@ -28,7 +28,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -43,7 +43,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 index 39b52d1..44dd70d 100644 --- a/m4/ax_check_junit.m4 +++ b/m4/ax_check_junit.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html # =========================================================================== # # SYNOPSIS @@ -45,7 +45,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) AC_DEFUN([AX_CHECK_JUNIT],[ diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 index 8f14241..baa041a 100644 --- a/m4/ax_check_rqrd_class.m4 +++ b/m4/ax_check_rqrd_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html # =========================================================================== # # SYNOPSIS @@ -35,7 +35,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -50,7 +50,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) AC_DEFUN([AX_CHECK_RQRD_CLASS],[ diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 index 917638a..c9d60f7 100644 --- a/m4/ax_java_check_class.m4 +++ b/m4/ax_java_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html # =========================================================================== # # SYNOPSIS @@ -15,7 +15,7 @@ # # The macro tries to compile a minimal program importing . Some # newer compilers moan about the failure to use this but fail or produce a -# class file anyway. All moaing is sunk to /dev/null since I only wanted +# class file anyway. All moaning is sunk to /dev/null since I only wanted # to know if the class could be imported. This is a recommended followup # to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. # @@ -34,7 +34,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -49,7 +49,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 12 AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) AC_DEFUN([AX_JAVA_CHECK_CLASS],[ diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 index 36c10d9..722d788 100644 --- a/m4/ax_java_options.m4 +++ b/m4/ax_java_options.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# https://www.gnu.org/software/autoconf-archive/ax_java_options.html # =========================================================================== # # SYNOPSIS @@ -27,7 +27,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) AC_DEFUN([AX_JAVA_OPTIONS],[ diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 index becb33a..ae7a5f0 100644 --- a/m4/ax_jni_include_dir.m4 +++ b/m4/ax_jni_include_dir.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html # =========================================================================== # # SYNOPSIS @@ -32,6 +32,10 @@ # # - at the configure level, setenv JAVAC # +# This macro depends on AC_CANONICAL_HOST which requires that config.guess +# and config.sub be distributed along with the source code. See autoconf +# manual for details. +# # Note: This macro can work with the autoconf M4 macros for Java programs. # This particular macro is not part of the original set of macros. # @@ -44,11 +48,13 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 15 AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) AC_DEFUN([AX_JNI_INCLUDE_DIR],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + JNI_INCLUDE_DIRS="" if test "x$JAVA_HOME" != x; then @@ -66,14 +72,17 @@ else fi case "$host_os" in - darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere - case "$_JTOPDIR" in - /System/Library/Frameworks/JavaVM.framework/*) - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; - esac;; - *) _JINC="$_JTOPDIR/include";; + darwin*) # Apple Java headers are inside the Xcode bundle. + macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') + if @<:@ "$macos_version" -gt "7" @:>@; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi + ;; + *) _JINC="$_JTOPDIR/include";; esac _AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) _AS_ECHO_LOG([_JINC=$_JINC]) @@ -81,13 +90,21 @@ _AS_ECHO_LOG([_JINC=$_JINC]) # On Mac OS X 10.6.4, jni.h is a symlink: # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h # -> ../../CurrentJDK/Headers/jni.h. -AC_CHECK_FILE([$_JINC/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], - [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - AC_CHECK_FILE([$_JTOPDIR/include/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], - AC_MSG_ERROR([cannot find JDK header files])) - ]) +AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, +[ + if test -f "$_JINC/jni.h"; then + ac_cv_jni_header_path="$_JINC" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + ac_cv_jni_header_path="$_JTOPDIR/include" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + ac_cv_jni_header_path=none + fi + fi +]) # get the likely subdirectories for system specific java includes case "$host_os" in @@ -102,13 +119,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";; *) _JNI_INC_SUBDIRS="genunix";; esac -# add any subdirectories that are present -for JINCSUBDIR in $_JNI_INC_SUBDIRS -do +if test "x$ac_cv_jni_header_path" != "xnone"; then + # add any subdirectories that are present + for JINCSUBDIR in $_JNI_INC_SUBDIRS + do if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" fi -done + done +fi ]) # _ACJNI_FOLLOW_SYMLINKS diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 index 3c60fca..d474912 100644 --- a/m4/ax_prog_jar.m4 +++ b/m4/ax_prog_jar.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html # =========================================================================== # # SYNOPSIS @@ -37,7 +37,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) AC_DEFUN([AX_PROG_JAR],[ diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 index 03961db..c2e6964 100644 --- a/m4/ax_prog_java.m4 +++ b/m4/ax_prog_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html # =========================================================================== # # SYNOPSIS @@ -85,7 +85,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -100,7 +100,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 10 AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) AC_DEFUN([AX_PROG_JAVA],[ diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 index 3df064f..ce9612d 100644 --- a/m4/ax_prog_java_cc.m4 +++ b/m4/ax_prog_java_cc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html # =========================================================================== # # SYNOPSIS @@ -56,7 +56,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -71,7 +71,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 4 +#serial 5 # AX_PROG_JAVA_CC([COMPILER ...]) # -------------------------- diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 index 54e132a..bc70526 100644 --- a/m4/ax_prog_java_works.m4 +++ b/m4/ax_prog_java_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,57 +47,16 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 11 AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) AC_DEFUN([AX_PROG_JAVA_WORKS], [ -AC_PATH_PROG(UUDECODE, uudecode, [no]) -if test x$UUDECODE != xno; then -AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ -dnl /** -dnl * Test.java: used to test if java compiler works. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s -YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG -aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB -AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB -AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= -==== -EOF -if $UUDECODE Test.uue; then - ac_cv_prog_uudecode_base64=yes -else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no -fi -rm -f Test.uue]) -fi -if test x$ac_cv_prog_uudecode_base64 != xyes; then - rm -f Test.class - AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AX_PROG_JAVAC fi -fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class @@ -111,7 +70,6 @@ public static void main (String args[]) { } } EOF changequote([, ])dnl -if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else @@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi -fi if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else @@ -127,7 +84,7 @@ else cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi -rm -fr $JAVA_TEST $CLASS_TEST Test.uue +rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ] diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 index d061243..8abb733 100644 --- a/m4/ax_prog_javac.m4 +++ b/m4/ax_prog_javac.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html # =========================================================================== # # SYNOPSIS @@ -49,7 +49,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -64,7 +64,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) AC_DEFUN([AX_PROG_JAVAC],[ diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 index 7dfa1e3..9b48149 100644 --- a/m4/ax_prog_javac_works.m4 +++ b/m4/ax_prog_javac_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,7 +47,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) AC_DEFUN([AX_PROG_JAVAC_WORKS],[ diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 index bcb6045..b9fcea4 100644 --- a/m4/ax_prog_javadoc.m4 +++ b/m4/ax_prog_javadoc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html # =========================================================================== # # SYNOPSIS @@ -38,7 +38,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) AC_DEFUN([AX_PROG_JAVADOC],[ diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 index cefc616..935ec89 100644 --- a/m4/ax_prog_javah.m4 +++ b/m4/ax_prog_javah.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html # =========================================================================== # # SYNOPSIS @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 11 AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) AC_DEFUN([AX_PROG_JAVAH],[ @@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) AS_IF([test -n "$ac_cv_path_JAVAH"], [ - AC_TRY_CPP([#include ],,[ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])],[],[ ac_save_CPPFLAGS="$CPPFLAGS" - _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" AS_CASE([$build_os], - [cygwin*], + [cygwin*|mingw*], [ac_machdep=win32], [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" - AC_TRY_CPP([#include ], - ac_save_CPPFLAGS="$CPPFLAGS", - AC_MSG_WARN([unable to include ])) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], + [ac_save_CPPFLAGS="$CPPFLAGS"], + [AC_MSG_WARN([unable to include ])]) CPPFLAGS="$ac_save_CPPFLAGS"]) ]) ]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 index a8ed6b2..245c36c 100644 --- a/m4/ax_try_compile_java.m4 +++ b/m4/ax_try_compile_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 10 AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) AC_DEFUN([AX_TRY_COMPILE_JAVA],[ @@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined. else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat Test.java >&AS_MESSAGE_LOG_FD -ifelse([$4], , , [ rm -fr Test.java Test.class +ifelse([$4], , , [ rm -f Test.java Test.class $4 ])dnl fi -rm -fr Test.java Test.class]) +rm -f Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 index c680f03..2ebb86d 100644 --- a/m4/ax_try_run_java.m4 +++ b/m4/ax_try_run_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) AC_DEFUN([AX_TRY_RUN_JAVA],[ -- cgit v0.12 From 4feb2100591c802ea450dc26dae4e0546479fa96 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 10 Apr 2019 10:58:59 -0500 Subject: Make corresponding changes for version bounds in V110. This is based on PR#1639 merged to develop branch. --- test/h5test.c | 24 ++++++ test/h5test.h | 1 + test/ohdr.c | 52 ++----------- test/tfile.c | 41 +++++------ test/trefer.c | 230 ++++++++++++++++++++++++++++++++++------------------------ 5 files changed, 184 insertions(+), 164 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index 62eb6bf..0d7603f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -97,6 +97,16 @@ static const char *multi_letters = "msbrglo"; /* The # of seconds to wait for the message file--used by h5_wait_message() */ #define MESSAGE_TIMEOUT 300 /* Timeout in seconds */ +/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */ +/* This is used by h5_get_version_string() */ +const char *LIBVER_NAMES[] = { + "earliest", /* H5F_LIBVER_EARLIEST = 0 */ + "v18", /* H5F_LIBVER_V18 = 1 */ + "v110", /* H5F_LIBVER_V110 = 2 */ + "latest", /* H5F_LIBVER_V112 = 3 */ + NULL +}; + /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; @@ -1931,3 +1941,17 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ +/*------------------------------------------------------------------------- + * Function: h5_get_version_string + * + * Purpose: Get the string that corresponds to the libvery version bound. + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +char * +h5_get_version_string(H5F_libver_t libver) +{ + return(LIBVER_NAMES[libver]); +} /* end of h5_get_version_string */ diff --git a/test/h5test.h b/test/h5test.h index 8e87192..afd3a4c 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -142,6 +142,7 @@ H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); +H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver); /* Functions that will replace VFD-dependent functions that violate * the single responsibility principle. Unlike their predecessors, diff --git a/test/ohdr.c b/test/ohdr.c index 3f61660..73ae8ac 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1628,46 +1628,6 @@ error: return FAIL; } /* test_unknown() */ -#define STR_EARLIEST "earliest" -#define STR_V18 "v18" -#define STR_LATEST "latest" -static char * -version_string(H5F_libver_t libver) -{ - char *str = NULL; - - str = (char *) HDmalloc(20); - if (str == NULL) { - HDfprintf(stderr, "Allocation failed\n"); - HDexit(1); - } - - switch(libver) { - case H5F_LIBVER_EARLIEST: - HDstrcpy(str, STR_EARLIEST); - break; - - case H5F_LIBVER_V18: - HDstrcpy(str, STR_V18); - break; - - case H5F_LIBVER_V110: - HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110); - HDstrcpy(str, STR_LATEST); - break; - - case H5F_LIBVER_ERROR: - case H5F_LIBVER_NBOUNDS: - default: - HDsprintf(str, "%ld", (long)libver); - break; - } /* end switch */ - - /* Return the formed version bound string */ - return str; -} /* end of version_string */ - - /*------------------------------------------------------------------------- * Function: main * @@ -1696,7 +1656,6 @@ main(void) H5O_loc_t oh_loc; /* Object header locations */ H5F_libver_t low, high; /* File format bounds */ time_t time_new, ro; - char msg[80]; /* Message for file format version */ int i; /* Local index variable */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t ret; /* Generic return value */ @@ -1713,8 +1672,9 @@ main(void) /* Loop through all the combinations of low/high library format bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - char *low_string = NULL; - char *high_string = NULL; + char *low_string = NULL; /* Message for library version low bound */ + char *high_string = NULL; /* Message for library version high bound */ + char msg[80]; /* Message for file format version */ /* Set version bounds before opening the file */ H5E_BEGIN_TRY { @@ -1725,13 +1685,11 @@ main(void) continue; /* Display info about testing */ - low_string = version_string(low); - high_string = version_string(high); + low_string = h5_get_version_string(low); + high_string = h5_get_version_string(high); sprintf(msg, "Using file format version: (%s, %s)", low_string, high_string); HDputs(msg); - HDfree(high_string); - HDfree(low_string); /* test on object continuation block */ if(test_cont(filename, fapl) < 0) diff --git a/test/tfile.c b/test/tfile.c index 2784204..a0a165f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5341,7 +5341,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } H5E_END_TRY; /* Get the internal file pointer if the create succeeds */ - if((ok = fid >= 0)) { + if(fid >= 0) { f = (H5F_t *)H5I_object(fid); CHECK(f, NULL, "H5I_object"); } @@ -5353,32 +5353,32 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) if(is_swmr) { /* SWMR is enabled */ if(high == H5F_LIBVER_LATEST) { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fcreate"); + VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds"); VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); } else /* Should fail */ - VERIFY(ok, FALSE, "H5Fcreate"); + VERIFY(fid >= 0, FALSE, "H5Fcreate"); } else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fcreate"); + VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); switch(low) { case H5F_LIBVER_EARLIEST: - ok = (f->shared->sblock->super_vers == 0 || - f->shared->sblock->super_vers == 1 || - f->shared->sblock->super_vers == 2); + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; case H5F_LIBVER_V18: - ok = (f->shared->sblock->super_vers == 2); + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; case H5F_LIBVER_V110: - ok = (f->shared->sblock->super_vers == 3); + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); break; @@ -5390,7 +5390,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } /* end switch */ } - if(ok) { /* Close the file */ + if(fid >= 0) { /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } @@ -5482,7 +5482,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) hid_t new_fapl = -1; /* File access property list */ unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ - hbool_t ok; /* The result is ok or not */ herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ @@ -5521,7 +5520,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) } H5E_END_TRY; /* Get the internal file pointer if the open succeeds */ - if((ok = fid >= 0)) { + if(fid >= 0) { f = (H5F_t *)H5I_object(fid); CHECK(f, NULL, "H5I_object"); } @@ -5531,24 +5530,22 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) case 3: if(high == H5F_LIBVER_LATEST) { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); } else /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); break; case 2: if(is_swmr) /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); - - ok = f->shared->low_bound >= H5F_LIBVER_V18; - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); /* Close the file */ ret = H5Fclose(fid); @@ -5559,10 +5556,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) case 1: case 0: if(is_swmr) /* Should fail */ - VERIFY(ok, FALSE, "H5Fopen"); + VERIFY(fid >= 0, FALSE, "H5Fopen"); else { /* Should succeed */ - VERIFY(ok, TRUE, "H5Fopen"); - VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); diff --git a/test/trefer.c b/test/trefer.c index b7a1d59..1f85b07 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -503,7 +503,7 @@ test_reference_obj(void) ** ****************************************************************/ static void -test_reference_region(hbool_t new_format) +test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) { hid_t fid1; /* HDF5 File IDs */ hid_t fapl = -1; /* File access property list */ @@ -549,11 +549,7 @@ test_reference_region(hbool_t new_format) hsize_t start3, count3, block3; /* Output message about test being performed */ - if(new_format) { - MESSAGE(5, ("Testing Dataset Region Reference Functions for new format\n")); - } else { - MESSAGE(5, ("Testing Dataset Region Reference Functions for old format\n")); - } + MESSAGE(5, ("Testing Object Reference Functions\n")); /* Allocate write & read buffers */ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); @@ -564,12 +560,12 @@ test_reference_region(hbool_t new_format) /* Set to use the latest file format */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - if(new_format) { - ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - CHECK(ret, FAIL, "H5Pset_libver_bounds"); - } - /* Create file */ + /* Set the low/high version bounds in fapl */ + ret = H5Pset_libver_bounds(fapl, libver_low, libver_high); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create file with the fapl */ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); @@ -676,19 +672,32 @@ test_reference_region(hbool_t new_format) VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Store third dataset region */ - ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); - CHECK(ret, FAIL, "H5Rcreate"); - ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[2], &obj_type); - CHECK(ret, FAIL, "H5Rget_obj_type2"); - VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + H5E_BEGIN_TRY { + ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2); + } H5E_END_TRY; + + if(libver_high < H5F_LIBVER_V110) + VERIFY(ret, FAIL, "H5Rcreate"); + else { + CHECK(ret, FAIL, "H5Rcreate"); + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[2], &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type2"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + } /* Store fourth dataset region */ - ret = H5Rcreate(&wbuf[3], fid1, "/Dataset3", H5R_DATASET_REGION, sid3); - CHECK(ret, FAIL, "H5Rcreate"); - ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[3], &obj_type); - CHECK(ret, FAIL, "H5Rget_obj_type2"); - VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + H5E_BEGIN_TRY { + ret = H5Rcreate(&wbuf[3], fid1, "/Dataset3", H5R_DATASET_REGION, sid3); + } H5E_END_TRY; + if(libver_high < H5F_LIBVER_V110) + VERIFY(ret, FAIL, "H5Rcreate"); + else { + CHECK(ret, FAIL, "H5Rcreate"); + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[3], &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type2"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + } /* Write selection to disk */ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); @@ -791,25 +800,27 @@ test_reference_region(hbool_t new_format) /* Try to open the referenced dataset with dataspace exceeding 32 bits */ - dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[3]); - CHECK(dset3, FAIL, "H5Rdereference2"); - - /* Check what H5Rget_obj_type2 function returns */ - ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[3], &obj_type); - CHECK(ret, FAIL, "H5Rget_obj_type2"); - VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); - - /* Check information in the referenced dataset */ - sid3 = H5Dget_space(dset3); - CHECK(sid3, FAIL, "H5Dget_space"); - ret_particles = H5Sget_select_npoints(sid3); - VERIFY(ret_particles, total_particles, "H5Sget_select_npoints"); - - /* Close the dataspace and dataset */ - ret = H5Sclose(sid3); - CHECK(ret, FAIL, "H5Sclose"); - ret = H5Dclose(dset3); - CHECK(ret, FAIL, "H5Dclose"); + if(libver_high == H5F_LIBVER_V110) { + dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[3]); + CHECK(dset3, FAIL, "H5Rdereference2"); + + /* Check what H5Rget_obj_type2 function returns */ + ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[3], &obj_type); + CHECK(ret, FAIL, "H5Rget_obj_type2"); + VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2"); + + /* Check information in the referenced dataset */ + sid3 = H5Dget_space(dset3); + CHECK(sid3, FAIL, "H5Dget_space"); + ret_particles = H5Sget_select_npoints(sid3); + VERIFY(ret_particles, total_particles, "H5Sget_select_npoints"); + + /* Close the dataspace and dataset */ + ret = H5Sclose(sid3); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Dclose(dset3); + CHECK(ret, FAIL, "H5Dclose"); + } /* Try to open objects */ dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]); @@ -906,30 +917,33 @@ test_reference_region(hbool_t new_format) ret = H5Sclose(sid2); CHECK(ret, FAIL, "H5Sclose"); - /* Get the unlimited selection */ - sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]); - CHECK(sid2, FAIL, "H5Rget_region"); - - /* Verify correct hyperslab selected */ - hssize_ret = H5Sget_select_npoints(sid2); - VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); - tri_ret = H5Sis_regular_hyperslab(sid2); - CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab"); - VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result"); - ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block); - CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); - VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates"); - VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates"); - VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates"); - VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates"); - VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates"); - VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates"); - /* Close region space */ - ret = H5Sclose(sid2); - CHECK(ret, FAIL, "H5Sclose"); + /* Get the unlimited selection */ + if(libver_high == H5F_LIBVER_V110) { + sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]); + CHECK(sid2, FAIL, "H5Rget_region"); + + /* Verify correct hyperslab selected */ + hssize_ret = H5Sget_select_npoints(sid2); + VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); + tri_ret = H5Sis_regular_hyperslab(sid2); + CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab"); + VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result"); + ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block); + CHECK(ret, FAIL, "H5Sget_regular_hyperslab"); + VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates"); + VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates"); + VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates"); + VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates"); + VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates"); + VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates"); + + /* Close region space */ + ret = H5Sclose(sid2); + CHECK(ret, FAIL, "H5Sclose"); + } /* Close first space */ ret = H5Sclose(sid1); @@ -973,32 +987,33 @@ test_reference_region(hbool_t new_format) ** ****************************************************************/ static void -test_reference_region_1D(hbool_t new_format) +test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset3; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid3; /* Dataspace ID #3 */ - hid_t dapl_id; /* Dataset access property list */ - hsize_t dims1[] = {SPACE1_DIM1}, - dims3[] = {SPACE3_DIM1}; - hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hsize_t low[SPACE3_RANK]; /* Selection bounds */ - hsize_t high[SPACE3_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ - uint8_t *tu8; /* Temporary pointer to uint8 data */ - H5O_type_t obj_type; /* Object type */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t fapl = -1; /* File access property list */ + hid_t dset1, /* Dataset ID */ + dset3; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid3; /* Dataspace ID #3 */ + hid_t dapl_id; /* Dataset access property list */ + hsize_t dims1[] = {SPACE1_DIM1}, + dims3[] = {SPACE3_DIM1}; + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t *coords; /* Coordinate buffer */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + *rbuf; /* buffer read from disk */ + uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ + *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t *tu8; /* Temporary pointer to uint8 data */ + H5O_type_t obj_type; /* Object type */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n")); @@ -1009,8 +1024,16 @@ test_reference_region_1D(hbool_t new_format) dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1); drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1); - /* Create file */ - fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + /* Create the file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set the low/high version bounds in fapl */ + ret = H5Pset_libver_bounds(fapl, libver_low, libver_high); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create file with the fapl */ + fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid1, FAIL, "H5Fcreate"); /* Create dataspace for datasets */ @@ -1106,7 +1129,7 @@ test_reference_region_1D(hbool_t new_format) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file */ - fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl); CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ @@ -1240,6 +1263,10 @@ test_reference_region_1D(hbool_t new_format) ret = H5Pclose(dapl_id); CHECK(ret, FAIL, "H5Pclose"); + /* Close file access property list */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + /* Close file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); @@ -1817,15 +1844,28 @@ test_reference_compat(void) void test_reference(void) { + H5F_libver_t low, high; /* Low and high bounds */ + /* 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_region(FALSE); /* Test basic H5R dataset region reference code */ - test_reference_region(TRUE); /* Test basic H5R dataset region reference code */ - test_reference_region_1D(FALSE); /* Test H5R dataset region reference code for 1-D datasets */ - test_reference_region_1D(TRUE); /* Test H5R dataset region reference code for 1-D datasets */ + + /* 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++) { + + /* Invalid combinations, just continue */ + if(high == H5F_LIBVER_EARLIEST || high < low) + continue; + + test_reference_region(low, high); /* Test basic H5R dataset region reference code */ + test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */ + + } /* 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 */ #ifndef H5_NO_DEPRECATED_SYMBOLS -- cgit v0.12 From 76b4748e78b2de806114100f7b82133b6983c60c Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 10 Apr 2019 11:36:10 -0500 Subject: Make corresponding changes for setting API context for fapl and libver_bounds to be used later in dataspace selection. This is based on PR #1640 merged to develop branch. --- src/H5CX.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5CXprivate.h | 4 ++ 2 files changed, 124 insertions(+) diff --git a/src/H5CX.c b/src/H5CX.c index 6b5e510..7cf283a 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -186,6 +186,10 @@ typedef struct H5CX_t { hid_t lapl_id; /* LAPL ID for API operation */ H5P_genplist_t *lapl; /* Link Access Property List */ + /* FAPL */ + hid_t fapl_id; /* FAPL ID for API operation */ + H5P_genplist_t *fapl; /* File Access Property List */ + /* Internal: Object tagging info */ haddr_t tag; /* Current object's tag (ohdr chunk #0 address) */ @@ -270,6 +274,12 @@ typedef struct H5CX_t { /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + + /* Cached FAPL properties */ + H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */ + hbool_t low_bound_valid; /* Whether low_bound property is valid */ + H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */ + hbool_t high_bound_valid; /* Whether high_bound property is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -319,6 +329,13 @@ typedef struct H5CX_lapl_cache_t { size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ } H5CX_lapl_cache_t; +/* Typedef for cached default file access property list information */ +/* (Same as the cached DXPL struct, above, except for the default DCPL) */ +typedef struct H5CX_fapl_cache_t { + H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */ + H5F_libver_t high_bound; /* high_bound property for H5Pset_libver_bounds */ +} H5CX_fapl_cache_t; + /********************/ /* Local Prototypes */ @@ -350,6 +367,9 @@ static H5CX_dxpl_cache_t H5CX_def_dxpl_cache; /* Define a "default" link access property list cache structure to use for default LAPLs */ static H5CX_lapl_cache_t H5CX_def_lapl_cache; +/* Define a "default" file access property list cache structure to use for default FAPLs */ +static H5CX_fapl_cache_t H5CX_def_fapl_cache; + /* Declare a static free list to manage H5CX_node_t structs */ H5FL_DEFINE_STATIC(H5CX_node_t); @@ -370,6 +390,7 @@ H5CX__init_package(void) { H5P_genplist_t *dx_plist; /* Data transfer property list */ H5P_genplist_t *la_plist; /* Link access property list */ + H5P_genplist_t *fa_plist; /* File access property list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -469,6 +490,22 @@ H5CX__init_package(void) if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse") + /* Reset the "default FAPL cache" information */ + HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t)); + + /* Get the default FAPL cache information */ + + /* Get the default file access property list */ + if(NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + + /* Get low_bound */ + if(H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + + if(H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__init_package() */ @@ -593,6 +630,7 @@ H5CX__push_common(H5CX_node_t *cnode) /* Set non-zero context info */ cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT; cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT; cnode->ctx.tag = H5AC__INVALID_TAG; cnode->ctx.ring = H5AC_RING_USER; @@ -724,6 +762,43 @@ H5CX_set_dxpl(hid_t dxpl_id) /*------------------------------------------------------------------------- + * Function: H5CX_set_libver_bounds + * + * Purpose: Sets the low/high bounds according to "f" for the current API call context. + * When "f" is NULL, the low/high bounds are set to latest format. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Vailin Choi + * March 27, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_libver_bounds(H5F_t *f) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f); + (*head)->ctx.high_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_HIGH_BOUND(f); + + /* Mark the values as valid */ + (*head)->ctx.low_bound_valid = TRUE; + (*head)->ctx.high_bound_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_libver_bounds() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_set_lapl * * Purpose: Sets the LAPL for the current API call context. @@ -792,6 +867,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, *acspl_id = *libclass->def_plist_id; else { htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */ + htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */ #ifdef H5CX_DEBUG /* Sanity check the access property list class */ @@ -805,6 +881,12 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, else if(is_lapl) (*head)->ctx.lapl_id = *acspl_id; + /* Check for file access property and set API context if so */ + if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class") + else if(is_fapl) + (*head)->ctx.fapl_id = *acspl_id; + #ifdef H5_HAVE_PARALLEL /* If this routine is not guaranteed to be collective (i.e. it doesn't * modify the structural metadata in a file), check if the application @@ -1853,6 +1935,44 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_get_libver_bounds + * + * Purpose: Retrieves the low/high bounds for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Vailin Choi + * March 27, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(low_bound); + HDassert(high_bound); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id); + + H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_LOW_BOUND_NAME, low_bound) + H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound) + + /* Get the values */ + *low_bound = (*head)->ctx.low_bound; + *high_bound = (*head)->ctx.high_bound; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_libver_bounds() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_set_tag * * Purpose: Sets the object tag for the current API call context. diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index a091292..6c01119 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -60,6 +60,7 @@ H5_DLL hbool_t H5CX_is_def_dxpl(void); /* "Setter" routines for API context info */ H5_DLL void H5CX_set_dxpl(hid_t dxpl_id); H5_DLL void H5CX_set_lapl(hid_t lapl_id); +H5_DLL herr_t H5CX_set_libver_bounds(H5F_t *f); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); @@ -101,6 +102,9 @@ H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct); /* "Getter" routines for LAPL properties cached in API context */ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks); +/* "Getter" routines for FAPL properties cached in API context */ +H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound); + /* "Setter" routines for API context info */ H5_DLL void H5CX_set_tag(haddr_t tag); H5_DLL void H5CX_set_ring(H5AC_ring_t ring); -- cgit v0.12 From 670c6c1389c1c66598a365a9bfe2b19237d9e93a Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 10 Apr 2019 14:24:53 -0500 Subject: Make corresponding changes for moving dataspace selection-specific coding to the callbacks. This is based on the PR #1642 merged to the develop branch. --- src/H5Sall.c | 44 +++++++++++++++++++++++------ src/H5Shyper.c | 85 +++++++++++++++++++++++++++++++++++++++++++-------------- src/H5Snone.c | 45 +++++++++++++++++++++++------- src/H5Spkg.h | 3 +- src/H5Spoint.c | 69 ++++++++++++++++++++++++++++++++++++---------- src/H5Sselect.c | 69 ++++------------------------------------------ 6 files changed, 195 insertions(+), 120 deletions(-) diff --git a/src/H5Sall.c b/src/H5Sall.c index 1377022..ea5e1ab 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -38,8 +38,7 @@ static herr_t H5S__all_release(H5S_t *space); static htri_t H5S__all_is_valid(const H5S_t *space); static hssize_t H5S__all_serial_size(const H5S_t *space, H5F_t *f); static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); -static herr_t H5S__all_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off); static int H5S__all_unlim_dim(const H5S_t *space); @@ -539,10 +538,8 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_all_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -557,22 +554,51 @@ H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t H5_ATTR_UNUSED **p) +H5S__all_deserialize(H5S_t **space, const uint8_t **p) { + uint32_t version; /* Version number */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_STATIC - HDassert(space); HDassert(p); HDassert(*p); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c. + This is needed for decoding virtual layout in H5O__layout_decode() */ + + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(*p, version); + + /* Skip over the remainder of the header */ + *p += 8; + /* Change to "all" selection */ - if(H5S_select_all(space, TRUE) < 0) + if(H5S_select_all(tmp_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* H5S__all_deserialize() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index c19de54..746d9a0 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -87,8 +87,7 @@ static herr_t H5S__hyper_release(H5S_t *space); static htri_t H5S__hyper_is_valid(const H5S_t *space); static hssize_t H5S__hyper_serial_size(const H5S_t *space, H5F_t *f); static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); -static herr_t H5S__hyper_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset); static int H5S__hyper_unlim_dim(const H5S_t *space); @@ -2273,12 +2272,11 @@ static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ - uint8_t *pp = (*p); /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hsize_t temp_off; /* Offset in a given dimension */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ @@ -2479,10 +2477,8 @@ done: Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S__hyper_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -2497,27 +2493,65 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags, - const uint8_t **p) +H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) { - unsigned rank; /* Rank of points */ - const uint8_t *pp; /* Local pointer for decoding */ - hsize_t start[H5O_LAYOUT_NDIMS]; /* Hyperslab start information */ - hsize_t block[H5O_LAYOUT_NDIMS]; /* Hyperslab block information */ - unsigned u; /* Local counting variable */ - herr_t ret_value = FAIL; /* Return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + hsize_t dims[H5S_MAX_RANK]; /* Dimenion sizes */ + hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */ + hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */ + uint32_t version; /* Version number */ + uint8_t flags = 0; /* Flags */ + unsigned rank; /* Rank of points */ + const uint8_t *pp; /* Local pointer for decoding */ + unsigned u; /* Local counting variable */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC /* Check args */ - HDassert(space); HDassert(p); pp = (*p); HDassert(pp); - /* Deserialize slabs to select */ - /* (The header and rank have already beed decoded) */ - rank = space->extent.rank; /* Retrieve rank from space */ + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(pp, version); + + if(version >= (uint32_t)2) { + /* Decode flags */ + flags = *(pp)++; + + /* Skip over the remainder of the header */ + pp += 4; + } else + /* Skip over the remainder of the header */ + pp += 8; + + /* Decode the rank of the point selection */ + UINT32DECODE(pp,rank); + + if(!*space) { + /* Patch the rank of the allocated dataspace */ + (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + } /* end if */ + else + /* Verify the rank of the provided dataspace */ + if(rank != tmp_space->extent.rank) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") if(flags & H5S_HYPER_REGULAR) { hsize_t stride[H5O_LAYOUT_NDIMS]; /* Hyperslab stride information */ @@ -2537,7 +2571,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl } /* end for */ /* Select the hyperslab to the current selection */ - if((ret_value = H5S_select_hyperslab(space, H5S_SELECT_SET, start, stride, count, block)) < 0) + if((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") } /* end if */ else { @@ -2571,7 +2605,7 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl *tblock = (*tend - *tstart) + 1; /* Select or add the hyperslab to the current selection */ - if((ret_value = H5S_select_hyperslab(space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0) + if((ret_value = H5S_select_hyperslab(tmp_space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") } /* end for */ } /* end else */ @@ -2579,7 +2613,16 @@ H5S__hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fl /* Update decoding pointer */ *p = pp; + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_deserialize() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index e71b599..0005b99 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -39,8 +39,7 @@ static herr_t H5S_none_release(H5S_t *space); static htri_t H5S_none_is_valid(const H5S_t *space); static hssize_t H5S_none_serial_size(const H5S_t *space, H5F_t *f); static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); -static herr_t H5S_none_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S_none_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off); static int H5S__none_unlim_dim(const H5S_t *space); @@ -515,10 +514,8 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_none_deserialize(space, version, flags, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -533,22 +530,50 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t H5_ATTR_UNUSED **p) +H5S_none_deserialize(H5S_t **space, const uint8_t **p) { - herr_t ret_value = SUCCEED; /* return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + uint32_t version; /* Version number */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT - HDassert(space); HDassert(p); HDassert(*p); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(*p, version); + + /* Skip over the remainder of the header */ + *p += 8; + /* Change to "none" selection */ - if(H5S_select_none(space) < 0) + if(H5S_select_none(tmp_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_none_deserialize() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index f6bd3d1..9219998 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -163,8 +163,7 @@ typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space, H5F_t *f); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p, H5F_t *f); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p); /* Method to determine smallest n-D bounding box containing the current selection */ typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); /* Method to determine linear offset of initial element in selection within dataspace */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 2363352..4165ffd 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -40,8 +40,7 @@ static herr_t H5S_point_release(H5S_t *space); static htri_t H5S_point_is_valid(const H5S_t *space); static hssize_t H5S_point_serial_size(const H5S_t *space, H5F_t *f); static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); -static herr_t H5S_point_deserialize(H5S_t *space, uint32_t version, uint8_t flags, - const uint8_t **p); +static herr_t H5S_point_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off); static int H5S__point_unlim_dim(const H5S_t *space); @@ -939,7 +938,7 @@ static herr_t H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) { H5S_pnt_node_t *curr; /* Point information nodes */ - uint8_t *pp = (*p); /* Local pointer for decoding */ + uint8_t *pp; /* Local pointer for encoding */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ @@ -954,6 +953,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) /* Check args */ HDassert(space); HDassert(p); + pp = (*p); HDassert(pp); /* Get bounding box for the selection */ @@ -1019,10 +1019,8 @@ done: Deserialize the current selection from a user-provided buffer. USAGE herr_t H5S_point_deserialize(space, p) - H5S_t *space; IN/OUT: Dataspace pointer to place + H5S_t **space; IN/OUT: Dataspace pointer to place selection into - uint32_t version IN: Selection version - uint8_t flags IN: Selection flags uint8 **p; OUT: Pointer to buffer holding serialized selection. Will be advanced to end of serialized selection. @@ -1037,13 +1035,15 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, - const uint8_t **p) +H5S_point_deserialize(H5S_t **space, const uint8_t **p) { - H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */ + uint32_t version; /* Version number */ hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ - const uint8_t *pp = (*p); /* Local pointer for decoding */ - hsize_t num_elem = 0; /* Number of elements in selection */ + const uint8_t *pp; /* Local pointer for decoding */ + size_t num_elem = 0; /* Number of elements in selection */ unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1051,13 +1051,43 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(space); HDassert(p); + pp = (*p); HDassert(pp); + /* As part of the efforts to push all selection-type specific coding + to the callbacks, the coding for the allocation of a null dataspace + is moved from H5S_select_deserialize() in H5Sselect.c to here. + This is needed for decoding virtual layout in H5O__layout_decode() */ + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Decode version */ + UINT32DECODE(pp, version); + + /* Skip over the remainder of the header */ + pp += 8; + + /* Decode the rank of the point selection */ + UINT32DECODE(pp,rank); + + if(!*space) { + /* Patch the rank of the allocated dataspace */ + (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + } /* end if */ + else + /* Verify the rank of the provided dataspace */ + if(rank != tmp_space->extent.rank) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") + /* Deserialize points to select */ - /* (The header and rank have already beed decoded) */ - rank = space->extent.rank; /* Retrieve rank from space */ UINT32DECODE(pp, num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ @@ -1070,13 +1100,22 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ UINT32DECODE(pp, *tcoord); /* Select points */ - if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0) + if(H5S_select_elements(tmp_space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") /* Update decoding pointer */ *p = pp; + /* Return space to the caller if allocated */ + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + /* Free the coordinate array if necessary */ if(coord != NULL) H5MM_xfree(coord); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 3a7ad7a..d52d5ff 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -458,101 +458,44 @@ H5S_select_valid(const H5S_t *space) herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p) { - H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either - *space or a newly allocated one */ uint32_t sel_type; /* Pointer to the selection type */ - uint32_t version; /* Version number */ - uint8_t flags = 0; /* Flags */ herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) HDassert(space); - /* Allocate space if not provided */ - if(!*space) { - if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") - } /* end if */ - else - tmp_space = *space; + /* Selection-type specific coding is moved to the callbacks. */ /* Decode selection type */ UINT32DECODE(*p, sel_type); - /* Decode version */ - UINT32DECODE(*p, version); - - if(version >= (uint32_t)2) { - /* Decode flags */ - flags = *(*p)++; - - /* Check for unknown flags */ - if(flags & ~H5S_SELECT_FLAG_BITS) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection") - - /* Skip over the remainder of the header */ - *p += 4; - } /* end if */ - else - /* Skip over the remainder of the header */ - *p += 8; - - /* Decode and check or patch rank for point and hyperslab selections */ - if((sel_type == H5S_SEL_POINTS) || (sel_type == H5S_SEL_HYPERSLABS)) { - uint32_t rank; /* Rank of dataspace */ - - /* Decode the rank of the point selection */ - UINT32DECODE(*p,rank); - - if(!*space) { - hsize_t dims[H5S_MAX_RANK]; - - /* Patch the rank of the allocated dataspace */ - (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); - if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") - } /* end if */ - else - /* Verify the rank of the provided dataspace */ - if(rank != tmp_space->extent.rank) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of serialized selection does not match dataspace") - } /* end if */ - /* Make routine for selection type */ switch(sel_type) { case H5S_SEL_POINTS: /* Sequence of points selected */ - ret_value = (*H5S_sel_point->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_point->deserialize)(space, p); break; case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */ - ret_value = (*H5S_sel_hyper->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_hyper->deserialize)(space, p); break; case H5S_SEL_ALL: /* Entire extent selected */ - ret_value = (*H5S_sel_all->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_all->deserialize)(space, p); break; case H5S_SEL_NONE: /* Nothing selected */ - ret_value = (*H5S_sel_none->deserialize)(tmp_space, version, flags, p); + ret_value = (*H5S_sel_all->deserialize)(space, p); break; default: break; } + if(ret_value < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") - /* Return space to the caller if allocated */ - if(!*space) - *space = tmp_space; - done: - /* Free temporary space if not passed to caller (only happens on error) */ - if(!*space && tmp_space) - if(H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") - FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_deserialize() */ -- cgit v0.12 From 3e30d019214eaee6f345f45eae478e7f464df8ad Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 10 Apr 2019 17:22:06 -0500 Subject: Make corresponding changes for hyperslab encoding incorrect length (HDFFV-10271). This is based on PR #1644 merged to develop branch. The fix for the incorrect length was already checked in to 1.10 on Dec 2017. --- test/th5s.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/test/th5s.c b/test/th5s.c index 9d5273f..fa6bba3 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -2690,6 +2690,83 @@ test_h5s_encode_points_exceed32(void) /**************************************************************** ** +** test_h5s_encode_length(): +** Test to verify HDFFV-10271 is fixed. +** Verify that version 2 hyperslab encoding length is correct. +** +** See "RFC: H5Sencode/H5Sdecode Format Change" for the +** description of the encoding format. +** +****************************************************************/ +static void +test_h5s_encode_length(void) +{ + hid_t sid; /* Dataspace ID */ + hid_t decoded_sid; /* Dataspace ID from H5Sdecode2 */ + size_t sbuf_size=0; /* Buffer size for H5Sencode2/1 */ + unsigned char *sbuf=NULL; /* Buffer for H5Sencode2/1 */ + hsize_t dims[1] = {500}; /* Dimension size */ + hsize_t start, count, block, stride; /* Hyperslab selection specifications */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Version 2 Hyperslab Encoding Length is correct\n")); + + /* Create dataspace */ + sid = H5Screate_simple(1, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Setting H5S_UNLIMITED in count will use version 2 for hyperslab encoding */ + start = 0; + stride = 10; + block = 4; + count = H5S_UNLIMITED; + + /* Set hyperslab selection */ + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Encode simple data space in a buffer */ + ret = H5Sencode(sid, NULL, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode"); + + /* Allocate the buffer */ + if(sbuf_size > 0) { + sbuf = (unsigned char*)HDcalloc((size_t)1, sbuf_size); + CHECK(sbuf, NULL, "H5Sencode2"); + } + + /* Encode the dataspace */ + ret = H5Sencode(sid, sbuf, &sbuf_size); + CHECK(ret, FAIL, "H5Sencode"); + + /* Verify that length stored at this location in the buffer is correct */ + VERIFY((uint32_t)sbuf[40], 36, "Length for encoding version 2"); + VERIFY((uint32_t)sbuf[35], 2, "Hyperslab encoding version is 2"); + + /* Decode from the dataspace buffer and return an object handle */ + decoded_sid = H5Sdecode(sbuf); + CHECK(decoded_sid, FAIL, "H5Sdecode"); + + /* Verify that the original and the decoded dataspace are equal */ + VERIFY(H5Sget_select_npoints(sid), H5Sget_select_npoints(decoded_sid), "Compare npoints"); + + /* Close the decoded dataspace */ + ret = H5Sclose(decoded_sid); + CHECK(ret, FAIL, "H5Sclose"); + + /* Free the buffer */ + if(sbuf) + HDfree(sbuf); + + /* Close the original dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + +} /* test_h5s_encode_length() */ + +/**************************************************************** +** ** test_h5s(): Main H5S (dataspace) testing routine. ** ****************************************************************/ @@ -2706,6 +2783,7 @@ test_h5s(void) test_h5s_encode_regular_exceed32(); /* Test encoding regular hyperslab selection that exceeds 32 bits */ test_h5s_encode_irregular_exceed32(); /* Testing encoding irregular hyperslab selection that exceeds 32 bits */ test_h5s_encode_points_exceed32(); /* Testing encoding point selection that exceeds 32 bits */ + test_h5s_encode_length(); /* Test version 2 hyperslab encoding length is correct */ test_h5s_scalar_write(); /* Test scalar H5S writing code */ test_h5s_scalar_read(); /* Test scalar H5S reading code */ -- cgit v0.12 From 36149c8a669146eb73750f03b8dd85a1f1c02c2e Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 18 Apr 2019 18:14:17 -0500 Subject: Make the corresponding fix for HDFFV-10579 H5Arename fails when creation order of attributes is tracked. --- src/H5Adense.c | 30 ++++++++++++++++ test/tattr.c | 107 +++++++++++++++++++++++++++++++++------------------------ 2 files changed, 92 insertions(+), 45 deletions(-) diff --git a/src/H5Adense.c b/src/H5Adense.c index 40a7a9a..c6aa8e0 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -915,6 +915,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, H5HF_t *fheap = NULL; /* Fractal heap handle */ H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order ndex */ H5A_t *attr_copy = NULL; /* Copy of attribute to rename */ htri_t attr_sharable; /* Flag indicating attributes are sharable */ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ @@ -994,6 +995,33 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, if(H5A__set_version(f, attr_copy) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version") + /* Need to remove the attribute from the creation order index v2 B-tree */ + if(ainfo->index_corder) { + htri_t corder_attr_exists; /* Attribute exists in v2 B-tree */ + + /* Open the creation order index v2 B-tree */ + HDassert(H5F_addr_defined(ainfo->corder_bt2_addr)); + if(NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index") + + /* Set up the creation order to search for */ + udata.corder = attr_copy->shared->crt_idx; + + if((corder_attr_exists = H5B2_find(bt2_corder, &udata, NULL, NULL)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index") + + if(corder_attr_exists) { + H5A_bt2_ud_rm_t rm_udata; + + /* Set up the creation order in user data for the v2 B-tree 'record remove' callback */ + rm_udata.common.corder = attr_copy->shared->crt_idx; + + /* Remove the record from the creation order index v2 B-tree */ + if(H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree") + } + } + /* Insert renamed attribute back into dense storage */ /* (Possibly making it shared) */ if(H5A__dense_insert(f, ainfo, attr_copy) < 0) @@ -1041,6 +1069,8 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") if(bt2_name && H5B2_close(bt2_name) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + if(bt2_corder && H5B2_close(bt2_corder) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") if(attr_copy) H5O_msg_free(H5O_ATTR_ID, attr_copy); diff --git a/test/tattr.c b/test/tattr.c index 9b6ae90..7e07ee0 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -2604,6 +2604,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) H5O_info_t oinfo; /* Object info */ unsigned u; /* Local index variable */ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); + unsigned use_corder; /* Track creation order or not */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -2620,7 +2621,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pset_file_space_strategy"); } fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); if (use_min_dset_oh) CHECK(H5Pclose(fcpl), FAIL, "H5Pclose"); @@ -2635,71 +2636,87 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); - CHECK(fid, FAIL, "H5Fopen"); + CHECK(fid, H5I_INVALID_HID, "H5Fopen"); /* Create dataspace for dataset */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + 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, FAIL, "H5Pcreate"); - - /* Create a dataset */ - dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(dataset, FAIL, "H5Dcreate2"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcopy"); /* Retrieve limits for compact/dense attribute storage */ ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); CHECK(ret, FAIL, "H5Pget_attr_phase_change"); - /* Close property list */ - ret = H5Pclose(dcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Using creation order or not */ + for(use_corder = FALSE; use_corder <= TRUE; use_corder++) { - /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test"); + if(use_corder) { + ret = H5Pset_attr_creation_order(dcpl, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED); + CHECK(ret, FAIL, "H5Pset_attr_creation_order"); + } - /* Add attributes, until well into dense storage */ - for(u = 0; u < (max_compact * 2); u++) { - /* Create attribute */ - sprintf(attrname, "attr %02u", u); - attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Acreate2"); + /* Create a dataset */ + dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); - /* Write data into the attribute */ - ret = H5Awrite(attr, H5T_NATIVE_UINT, &u); - CHECK(ret, FAIL, "H5Awrite"); + /* Check on dataset's attribute storage status */ + is_dense = H5O_is_attr_dense_test(dataset); + VERIFY(is_dense, FALSE, "H5O__is_attr_dense_test"); - /* Close attribute */ - ret = H5Aclose(attr); - CHECK(ret, FAIL, "H5Aclose"); + /* Add attributes, until well into dense storage */ + for(u = 0; u < (max_compact * 2); u++) { + /* Create attribute */ + sprintf(attrname, "attr %02u", u); + attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); + + /* Write data into the attribute */ + ret = H5Awrite(attr, H5T_NATIVE_UINT, &u); + CHECK(ret, FAIL, "H5Awrite"); - /* Rename attribute */ - sprintf(new_attrname, "new attr %02u", u); + /* Close attribute */ + ret = H5Aclose(attr); + CHECK(ret, FAIL, "H5Aclose"); - /* Rename attribute */ - ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT); - CHECK(ret, FAIL, "H5Arename_by_name"); + /* Rename attribute */ + sprintf(new_attrname, "new attr %02u", u); - /* Check # of attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); - CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); - } /* end for */ + /* Rename attribute */ + ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Arename_by_name"); - /* Check on dataset's attribute storage status */ - is_dense = H5O_is_attr_dense_test(dataset); - VERIFY(is_dense, TRUE, "H5O_is_attr_dense_test"); + /* Check # of attributes */ + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info"); + VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); + } /* end for */ + + /* Check on dataset's attribute storage status */ + is_dense = H5O_is_attr_dense_test(dataset); + VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + if(!use_corder) { + /* Unlink dataset with attributes */ + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + } + + } /* end for use_corder */ /* Close dataspace */ ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); - /* Close Dataset */ - ret = H5Dclose(dataset); - CHECK(ret, FAIL, "H5Dclose"); + /* Close property list */ + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Pclose"); /* Close file */ ret = H5Fclose(fid); @@ -2708,11 +2725,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Re-open file */ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); - CHECK(fid, FAIL, "H5Fopen"); + CHECK(fid, H5I_INVALID_HID, "H5Fopen"); /* Open dataset */ dataset = H5Dopen2(fid, DSET1_NAME, H5P_DEFAULT); - CHECK(dataset, FAIL, "H5Dopen2"); + CHECK(dataset, H5I_INVALID_HID, "H5Dopen2"); /* Verify renamed attributes */ for(u = 0; u < (max_compact * 2); u++) { @@ -2721,7 +2738,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Open attribute */ sprintf(attrname, "new attr %02u", u); attr = H5Aopen(dataset, attrname, H5P_DEFAULT); - CHECK(attr, FAIL, "H5Aopen"); + CHECK(attr, H5I_INVALID_HID, "H5Aopen"); /* Read data from the attribute */ ret = H5Aread(attr, H5T_NATIVE_UINT, &value); -- cgit v0.12 From 1f934ae2c6e13ca020e489efa0447bc8cc74db09 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 23 Apr 2019 15:04:50 -0500 Subject: Make corresponding changes for H5Sencode based on PR #1645 to develop branch. The core changes are to revert previous modifications now that we use API context for fapl. --- src/H5Dmpio.c | 13 +- src/H5Dvirtual.c | 35 +---- src/H5Ffake.c | 14 +- src/H5Fprivate.h | 2 +- src/H5P.c | 11 +- src/H5Pdapl.c | 8 +- src/H5Pdcpl.c | 39 ++---- src/H5Pdxpl.c | 28 ++-- src/H5Pencdec.c | 20 ++- src/H5Pfapl.c | 22 ++-- src/H5Pfcpl.c | 16 +-- src/H5Pgcpl.c | 8 +- src/H5Plapl.c | 13 +- src/H5Pocpl.c | 4 +- src/H5Ppkg.h | 16 +-- src/H5Pprivate.h | 7 +- src/H5Pstrcpl.c | 4 +- src/H5Rint.c | 7 +- src/H5S.c | 22 ++-- src/H5Sall.c | 20 ++- src/H5Shyper.c | 388 ++++++++++++++++++++++++------------------------------- src/H5Snone.c | 18 ++- src/H5Spkg.h | 12 +- src/H5Spoint.c | 129 ++++++------------ src/H5Sprivate.h | 14 +- src/H5Sselect.c | 9 +- src/H5T.c | 4 +- test/vds.c | 5 +- 28 files changed, 362 insertions(+), 526 deletions(-) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 6803b60..930e9ca 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2728,7 +2728,6 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty int *send_displacements = NULL; int scatter_recvcount_int; int mpi_rank, mpi_size, mpi_code; - hid_t fapl_id = -1; /* File access property list for H5S_encode() */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC @@ -2742,9 +2741,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi rank") if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") - - if((fapl_id = H5F_get_access_plist(io_info->dset->oloc.file, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") + + /* Set to latest format for encoding dataspace */ + H5CX_set_libver_bounds(NULL); if (*local_chunk_array_num_entries) if (NULL == (send_requests = (MPI_Request *) H5MM_malloc(*local_chunk_array_num_entries * sizeof(MPI_Request)))) @@ -2851,7 +2850,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Determine size of serialized chunk file dataspace, plus the size of * the data being written */ - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to get encoded dataspace size") if ((iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) @@ -2864,7 +2863,7 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Serialize the chunk's file dataspace into the buffer */ mod_data_p = mod_data[num_send_requests]; - if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size, fapl_id) < 0) + if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace") /* Initialize iterator for memory selection */ @@ -2969,8 +2968,6 @@ done: H5MM_free(num_assigned_chunks_array); if (shared_chunks_info_array) H5MM_free(shared_chunks_info_array); - if (H5Pclose(fapl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "couldn't close FAPL") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_redistribute_shared_chunks() */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 2e8ca5d..e591440 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -419,11 +419,6 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */ uint32_t chksum; /* Checksum for heap data */ size_t i; /* Local index variable */ - H5P_genplist_t *fapl_plist; /* The file access property list */ - hid_t new_fapl_id; /* The file access property list ID */ - H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */ - H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */ - H5F_t *tmp_f = NULL; /* Pointer to faked file structure */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -436,22 +431,8 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Create block if # of used entries > 0 */ if(layout->storage.u.virt.list_nused > 0) { - /* Make a copy of the default file access property list */ - if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Set latest format in fapl_plist for virtual layout encoding */ - if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") - if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") - /* Copy and return the fapl id */ - if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") - - /* Allocate "fake" file structure with the fapl setting */ - if(NULL == (tmp_f = H5F_fake_alloc((uint8_t)0, new_fapl_id))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") + /* Set the low/high bounds according to 'f' for the API context */ + H5CX_set_libver_bounds(f); /* Allocate array for caching results of strlen */ if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t)))) @@ -482,12 +463,12 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) block_size += str_size[(2 * i) + 1]; /* Source selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select, tmp_f)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; /* Virtual dataset selection */ - if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, tmp_f)) < 0) + if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") block_size += (size_t)select_serial_size; } /* end for */ @@ -524,11 +505,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p, tmp_f) < 0) + if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") /* Virtual selection */ - if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p, tmp_f) < 0) + if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") } /* end for */ @@ -542,10 +523,6 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) } /* end if */ done: - /* Release fake file structure */ - if(tmp_f && H5F_fake_free(tmp_f) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct") - heap_block = (uint8_t *)H5MM_xfree(heap_block); str_size = (size_t *)H5MM_xfree(str_size); diff --git a/src/H5Ffake.c b/src/H5Ffake.c index d199cf0..7e44cfc 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -42,10 +42,9 @@ *------------------------------------------------------------------------- */ H5F_t * -H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id) +H5F_fake_alloc(uint8_t sizeof_size) { H5F_t *f = NULL; /* Pointer to fake file struct */ - H5P_genplist_t *plist; /* Property list */ H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -62,17 +61,6 @@ H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id) else f->shared->sizeof_size = sizeof_size; - /* Set low/high bounds according to the setting in fapl_id */ - /* See H5F_new() in H5Fint.c */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") - - if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions") - if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions") - - /* Set return value */ ret_value = f; done: diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0c2f5f2..d60c08f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -827,7 +827,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad H5_DLL void H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ -H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id); +H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Superblock related routines */ diff --git a/src/H5P.c b/src/H5P.c index 180e005..9d3b903 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -840,10 +840,7 @@ herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) { H5P_genplist_t *plist; /* Property list to query */ - H5P_genplist_t *fapl_plist; - hid_t new_fapl_id; - H5F_libver_t low_bound = H5F_LIBVER_V110; - H5F_libver_t high_bound = H5F_LIBVER_V110; + hid_t temp_fapl_id = H5P_DEFAULT; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) @@ -853,8 +850,12 @@ H5Pencode(hid_t plist_id, void *buf, size_t *nalloc) if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + /* Call the internal encode routine */ - if((ret_value = H5P__encode(plist, TRUE, buf, nalloc, H5P_FILE_ACCESS_DEFAULT)) < 0) + if((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to encode property list"); done: diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index ad2ae4c..da06297 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -121,7 +121,7 @@ static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /* Property list callbacks */ -static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); static herr_t H5P__dapl_vds_file_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_vds_file_pref_get(hid_t prop_id, const char* name, size_t size, void* value); @@ -135,7 +135,7 @@ static herr_t H5P__dapl_vds_file_pref_close(const char* name, size_t size, void* /* Property list callbacks */ static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); @@ -562,7 +562,7 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) { const char *efile_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -1157,7 +1157,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size) { const H5D_vds_view_t *view = (const H5D_vds_view_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 6211b5b..07fa9b7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -152,7 +152,7 @@ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ static herr_t H5P__dcrt_layout_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value); @@ -160,14 +160,14 @@ static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t s static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_fill_value_dec(const void **pp, void *value); static herr_t H5P__dcrt_fill_value_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_copy(const char *name, size_t size, void *value); static herr_t H5P__dcrt_fill_value_close(const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_get(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); static herr_t H5P__dcrt_ext_file_list_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_copy(const char *name, size_t size, void *value); @@ -379,18 +379,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) +H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) { const H5O_layout_t *layout = (const H5O_layout_t *)value; /* Create local aliases for values */ - H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ uint8_t **pp = (uint8_t **)_pp; uint8_t *tmp_p; size_t tmp_size; size_t u; /* Local index variable */ - H5P_genplist_t *fapl_plist; /* The file access property list */ - hid_t new_fapl_id; /* The file access property list ID */ - H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */ - H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */ herr_t ret_value = SUCCEED; /* Return value */ @@ -400,20 +395,6 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) HDassert(layout); HDassert(size); - /* Make a copy of the default file access property list */ - if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Set latest format in fapl_plist */ - /* This will eventually be used by VDS to encode datasets via H5S_encode() */ - if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions") - if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions") - - if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") - if(NULL != *pp) { /* Encode layout type */ *(*pp)++ = (uint8_t)layout->type; @@ -460,14 +441,14 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size, new_fapl_id) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += (size_t)(*pp - tmp_p); /* Virtual dataset selection. Same notes as above apply. */ tmp_size = (size_t)-1; tmp_p = *pp; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size, new_fapl_id) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += (size_t)(*pp - tmp_p); } /* end for */ @@ -500,14 +481,14 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size, void *_udata) /* Source selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size, new_fapl_id) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") *size += tmp_size; /* Virtual dataset selection */ tmp_size = (size_t)0; tmp_p = NULL; - if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size, new_fapl_id) < 0) + if(H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") *size += tmp_size; } /* end for */ @@ -1013,7 +994,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) { const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ size_t dt_size = 0; /* Size of encoded datatype */ @@ -1416,7 +1397,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) { const H5O_efl_t *efl = (const H5O_efl_t *)value; /* Create local aliases for values */ size_t len = 0; /* String length of slot name */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 1c97589..e33bc05 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -172,21 +172,21 @@ static herr_t H5P__dxfr_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_bkgr_buf_type_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_bkgr_buf_type_dec(const void **pp, void *value); -static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_btree_split_ratio_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_btree_split_ratio_dec(const void **pp, void *value); -static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_io_xfer_mode_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_io_xfer_mode_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_mpio_collective_opt_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_mpio_collective_opt_dec(const void **pp, void *value); -static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); -static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size, void *udata); +static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_copy(const char* name, size_t size, void* value); @@ -421,7 +421,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) { const H5T_bkg_t *bkgr_buf_type = (const H5T_bkg_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -494,7 +494,7 @@ H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) { const double *btree_split_ratio = (const double *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -655,7 +655,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) { const H5Z_data_xform_t *data_xform_prop = *(const H5Z_data_xform_t * const *)value; /* Create local alias for values */ const char *pexp = NULL; /* Pointer to transform expression */ @@ -1743,7 +1743,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) { const H5FD_mpio_xfer_t *xfer_mode = (const H5FD_mpio_xfer_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1816,7 +1816,7 @@ H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) { const H5FD_mpio_collective_opt_t *coll_opt = (const H5FD_mpio_collective_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1889,7 +1889,7 @@ H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) { const H5FD_mpio_chunk_opt_t *chunk_opt = (const H5FD_mpio_chunk_opt_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -2073,7 +2073,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) { const H5Z_EDC_t *check = (const H5Z_EDC_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 3332098..16dd5a8 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -52,7 +52,6 @@ typedef struct { hbool_t encode; /* Whether the property list should be encoded */ size_t *enc_size_ptr; /* Pointer to size of encoded buffer */ void **pp; /* Pointer to encoding buffer pointer */ - hid_t fapl_id; /* File access property list */ } H5P_enc_iter_ud_t; @@ -91,7 +90,7 @@ typedef struct { *------------------------------------------------------------------------- */ herr_t -H5P__encode_size_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_size_t(const void *value, void **_pp, size_t *size) { uint64_t enc_value = (uint64_t)*(const size_t *)value; /* Property value to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -133,7 +132,7 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNU *------------------------------------------------------------------------- */ herr_t -H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) { uint64_t enc_value = (uint64_t)*(const hsize_t *)value; /* Property value to encode */ unsigned enc_size = H5VM_limit_enc_size(enc_value); /* Size of encoded property */ @@ -174,7 +173,7 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UN *------------------------------------------------------------------------- */ herr_t -H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_unsigned(const void *value, void **_pp, size_t *size) { uint8_t **pp = (uint8_t **)_pp; @@ -213,7 +212,7 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void H5_ATTR_U *------------------------------------------------------------------------- */ herr_t -H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) { uint8_t **pp = (uint8_t **)_pp; @@ -249,7 +248,7 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UN *------------------------------------------------------------------------- */ herr_t -H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) { uint8_t **pp = (uint8_t **)_pp; @@ -284,7 +283,7 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UN *------------------------------------------------------------------------- */ herr_t -H5P__encode_double(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_double(const void *value, void **_pp, size_t *size) { uint8_t **pp = (uint8_t **)_pp; @@ -333,7 +332,6 @@ static int H5P__encode_cb(H5P_genprop_t *prop, void *_udata) { H5P_enc_iter_ud_t *udata = (H5P_enc_iter_ud_t *)_udata; /* Pointer to user data */ - H5P_enc_cb_info_t cb_udata; /* User data for property iteration callback */ int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -357,8 +355,7 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) /* Encode (or not, if *(udata->pp) is NULL) the property value */ prop_value_len = 0; - cb_udata.fapl_id = udata->fapl_id; - if((prop->encode)(prop->value, udata->pp, &prop_value_len, &cb_udata) < 0) + if((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") *(udata->enc_size_ptr) += prop_value_len; } /* end if */ @@ -393,7 +390,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, - size_t *nalloc, hid_t fapl_id) + size_t *nalloc) { H5P_enc_iter_ud_t udata; /* User data for property iteration callback */ uint8_t *p = (uint8_t *)buf; /* Temporary pointer to encoding buffer */ @@ -428,7 +425,6 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, udata.encode = encode; udata.enc_size_ptr = &encode_size; udata.pp = (void **)&p; - udata.fapl_id = fapl_id; /* Iterate over all properties in property list, encoding them */ idx = 0; diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index e5a0a63..b5fe527 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -298,18 +298,18 @@ static int H5P__facc_file_image_info_cmp(const void *value1, const void *value2, static herr_t H5P__facc_file_image_info_close(const char *name, size_t size, void *value); /* encode & decode callbacks */ -static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_config_dec(const void **_pp, void *value); static int H5P__facc_cache_config_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value); -static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value); static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value); /* Metadata cache log location property callbacks */ -static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size); static herr_t H5P_facc_mdc_log_location_dec(const void **_pp, void *value); static herr_t H5P_facc_mdc_log_location_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P_facc_mdc_log_location_copy(const char *name, size_t size, void *value); @@ -318,7 +318,7 @@ static herr_t H5P_facc_mdc_log_location_close(const char *name, size_t size, voi /* Metadata cache image property callbacks */ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, size_t H5_ATTR_UNUSED size); -static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); @@ -3020,7 +3020,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) { const H5AC_cache_image_config_t *config = (const H5AC_cache_image_config_t *)value; /* Create local aliases for value */ uint8_t **pp = (uint8_t **)_pp; @@ -3446,7 +3446,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) { const H5AC_cache_config_t *config = (const H5AC_cache_config_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3726,7 +3726,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) { const H5F_close_degree_t *fclose_degree = (const H5F_close_degree_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -3799,7 +3799,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) { const H5FD_mem_t *type = (const H5FD_mem_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -4299,7 +4299,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) { const char *log_location = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -4599,7 +4599,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) { const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 8751b70..f90dae5 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -132,13 +132,13 @@ static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); /* property callbacks */ -static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__fcrt_btree_rank_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *value); -static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value); @@ -722,7 +722,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) { const unsigned *btree_k = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1013,7 +1013,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) { const unsigned *type_flags = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1106,7 +1106,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) { const unsigned *minsizes = (const unsigned *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; @@ -1388,7 +1388,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size) { const H5F_fspace_strategy_t *strategy = (const H5F_fspace_strategy_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index a719616..6f1fab1 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -69,9 +69,9 @@ static herr_t H5P__gcrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__gcrt_group_info_dec(const void **_pp, void *value); -static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__gcrt_link_info_dec(const void **_pp, void *value); @@ -546,7 +546,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; @@ -634,7 +634,7 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) *------------------------------------------------------------------------- */ static herr_t -H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)value; /* Create local aliases for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 4a95991..99d98f8 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -114,7 +114,7 @@ static herr_t H5P__lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ static herr_t H5P__lacc_elink_pref_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__lacc_elink_pref_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_pref_copy(const char* name, size_t size, void* value); @@ -122,7 +122,7 @@ static int H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size static herr_t H5P__lacc_elink_pref_close(const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_set(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__lacc_elink_fapl_dec(const void **_pp, void *value); static herr_t H5P__lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__lacc_elink_fapl_copy(const char* name, size_t size, void* value); @@ -338,11 +338,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *_udata) +H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) { const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ uint8_t **pp = (uint8_t **)_pp; - H5P_enc_cb_info_t *udata = (H5P_enc_cb_info_t *)_udata; /* User data for encode callback */ H5P_genplist_t *fapl_plist; /* Pointer to property list */ hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */ size_t fapl_size = 0; /* FAPL's encoded size */ @@ -365,7 +364,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *_uda /* Encode the property list, if non-default */ /* (if *pp == NULL, will only compute the size) */ if(non_default_fapl) { - if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size, udata->fapl_id) < 0) + if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") if(*pp) { @@ -380,7 +379,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size, void *_uda UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode the plist */ - if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size, udata->fapl_id) < 0) + if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") *pp += fapl_size; @@ -689,7 +688,7 @@ H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) { const char *elink_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index b3c472e..be41e32 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -90,7 +90,7 @@ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ -static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); static herr_t H5P__ocrt_pipeline_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocrt_pipeline_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -1459,7 +1459,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) { const H5O_pline_t *pline = (const H5O_pline_t *)value; uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index c59a53a..60b2363 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -176,21 +176,21 @@ H5_DLL hid_t H5P__new_plist_of_type(H5P_plist_type_t type); /* Encode/decode routines */ H5_DLL herr_t H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, - void *buf, size_t *nalloc, hid_t fapl_id); + void *buf, size_t *nalloc); H5_DLL hid_t H5P__decode(const void *buf); -H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size, void *udata); -H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size, void *udata); -H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size, void *udata); -H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size, void *udata); -H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size, void *udata); -H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size, void *udat); +H5_DLL herr_t H5P__encode_hsize_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_size_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_unsigned(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_uint8_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_hbool_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__encode_double(const void *value, void **_pp, size_t *size); H5_DLL herr_t H5P__decode_hsize_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_size_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); -H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, void *udata); +H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index a18df06..460e16b 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -86,14 +86,9 @@ typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); /* Move encode/decode callback typedefs from H5Ppublic.h: not exposed to user */ /* Add a parameter to encode callback */ -typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size, void *udata); +typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); -/* User data passed to encode callback */ -typedef struct H5P_enc_cb_info_t { - hid_t fapl_id; /* File access property list */ -} H5P_enc_cb_info_t; - /* * Each library property list class has a variable of this type that contains * class variables and methods used to initialize the class. diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index b84d69b..fb91356 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -69,7 +69,7 @@ static herr_t H5P__strcrt_reg_prop(H5P_genclass_t *pclass); /* encode & decode callbacks */ -static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void *udata); +static herr_t H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__strcrt_char_encoding_dec(const void **_pp, void *value); @@ -227,7 +227,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size, void H5_ATTR_UNUSED *udata) +H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) { const H5T_cset_t *encoding = (const H5T_cset_t *)value; /* Create local alias for values */ uint8_t **pp = (uint8_t **)_pp; diff --git a/src/H5Rint.c b/src/H5Rint.c index 1465ee1..159bcca 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -242,6 +242,9 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, obj_loc.path = &path; H5G_loc_reset(&obj_loc); + /* Set the FAPL for the API context */ + H5CX_set_libver_bounds(loc->oloc->file); + /* Find the object */ if(H5G_loc_find(loc, name, &obj_loc) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "object not found") @@ -290,7 +293,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, HDmemset(ref, 0, H5R_DSET_REG_REF_BUF_SIZE); /* Get the amount of space required to serialize the selection */ - if ((buf_size = H5S_SELECT_SERIAL_SIZE(space, loc->oloc->file)) < 0) + if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection") /* Increase buffer size to allow for the dataset OID */ @@ -306,7 +309,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); /* Serialize the selection into heap buffer */ - if (H5S_SELECT_SERIALIZE(space, &p, loc->oloc->file) < 0) + if (H5S_SELECT_SERIALIZE(space, &p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") /* Save the serialized buffer for later */ diff --git a/src/H5S.c b/src/H5S.c index bd21caf..e582db7 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -23,6 +23,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ @@ -1595,6 +1596,7 @@ herr_t H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) { H5S_t *dspace; + hid_t temp_fapl_id = H5P_DEFAULT; herr_t ret_value=SUCCEED; FUNC_ENTER_API(FAIL) @@ -1602,10 +1604,14 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) /* Check argument and retrieve object */ if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - if(H5S_encode(dspace, (unsigned char **)&buf, nalloc, H5P_FILE_ACCESS_DEFAULT)<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") + if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") done: FUNC_LEAVE_API(ret_value) @@ -1629,7 +1635,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) +H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) { H5F_t *f = NULL; /* Fake file structure*/ size_t extent_size; /* Size of serialized dataspace extent */ @@ -1640,7 +1646,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0, fapl_id))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ @@ -1648,7 +1654,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") /* Find out the size of buffer needed for selection */ - if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj, f)) < 0) + if((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); @@ -1678,7 +1684,7 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id) /* Encode the selection part of dataspace. */ *p = pp; - if(H5S_SELECT_SERIALIZE(obj, p, f) < 0) + if(H5S_SELECT_SERIALIZE(obj, p) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") } /* end else */ @@ -1772,7 +1778,7 @@ H5S_decode(const unsigned char **p) sizeof_size = *pp++; /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc(sizeof_size, H5P_FILE_ACCESS_DEFAULT))) + if(NULL == (f = H5F_fake_alloc(sizeof_size))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode size of extent information */ diff --git a/src/H5Sall.c b/src/H5Sall.c index ea5e1ab..1738615 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -36,8 +36,8 @@ static herr_t H5S__all_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S__all_release(H5S_t *space); static htri_t H5S__all_is_valid(const H5S_t *space); -static hssize_t H5S__all_serial_size(const H5S_t *space, H5F_t *f); -static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); +static hssize_t H5S__all_serial_size(const H5S_t *space); +static herr_t H5S__all_serialize(const H5S_t *space, uint8_t **p); static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off); @@ -55,7 +55,7 @@ static herr_t H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S__all_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S__all_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); +static herr_t H5S__all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); static herr_t H5S__all_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S__all_iter_release(H5S_sel_iter_t *sel_iter); @@ -267,7 +267,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S__all_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - hsize_t nelem; IN: Number of elements to advance by + size_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -278,7 +278,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) +H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem) { FUNC_ENTER_STATIC_NOERR @@ -456,9 +456,8 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space) Determine the number of bytes needed to store the serialized "all" selection information. USAGE - hssize_t H5S_all_serial_size(space, f) + hssize_t H5S_all_serial_size(space) H5S_t *space; IN: Dataspace pointer to query - H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -470,7 +469,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) +H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_STATIC_NOERR @@ -490,12 +489,11 @@ H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S__all_serialize(space, p, f) + herr_t H5S__all_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. - H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -507,7 +505,7 @@ H5S__all_serial_size (const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) +H5S__all_serialize(const H5S_t *space, uint8_t **p) { uint8_t *pp = (*p); /* Local pointer for decoding */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 746d9a0..55913e0 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -21,12 +21,13 @@ #include "H5Smodule.h" /* This source code file is part of the H5S module */ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* ID Functions */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /* Format version bounds for dataspace hyperslab selection */ const unsigned H5O_sds_hyper_ver_bounds[] = { @@ -85,8 +86,8 @@ static herr_t H5S__hyper_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S__hyper_release(H5S_t *space); static htri_t H5S__hyper_is_valid(const H5S_t *space); -static hssize_t H5S__hyper_serial_size(const H5S_t *space, H5F_t *f); -static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); +static hssize_t H5S__hyper_serial_size(const H5S_t *space); +static herr_t H5S__hyper_serialize(const H5S_t *space, uint8_t **p); static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset); @@ -106,7 +107,7 @@ static herr_t H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords static herr_t H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter); -static herr_t H5S__hyper_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); +static herr_t H5S__hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); static herr_t H5S__hyper_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S__hyper_iter_release(H5S_sel_iter_t *sel_iter); /* Static function for optimizing hyperslab */ @@ -687,7 +688,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S__hyper_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) +H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) { unsigned ndims; /* Number of dimensions of dataset */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ @@ -737,14 +738,14 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) temp_dim=fast_dim; while(temp_dim>=0) { if(temp_dim==fast_dim) { - hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t block_elem; /* Number of elements left in a block */ /* Compute the number of elements left in block */ block_elem = tdiminfo[temp_dim].block - iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem=MIN(nelem,block_elem); + actual_elem=(size_t)MIN(nelem,block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim] += actual_elem; @@ -808,7 +809,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) /* Increment absolute position */ if(curr_dim==fast_dim) { - hsize_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ + size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ hsize_t span_elem; /* Number of elements left in a span */ /* Compute the number of elements left in block */ @@ -1871,8 +1872,9 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans) PURPOSE Get the number of hyperslab blocks in current hyperslab selection USAGE - hsize_t H5S__get_select_hyper_nblocks(space) + hsize_t H5S__get_select_hyper_nblocks(space, app_ref) H5S_t *space; IN: Dataspace ptr of selection to query + hbool_t app_ref; IN: Whether this is an appl. ref. call RETURNS The number of hyperslab blocks in selection on success, negative on failure DESCRIPTION @@ -1883,7 +1885,7 @@ H5S__hyper_span_nblocks(const H5S_hyper_span_info_t *spans) REVISION LOG --------------------------------------------------------------------------*/ static hsize_t -H5S__get_select_hyper_nblocks(const H5S_t *space) +H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) { hsize_t ret_value = 0; /* Return value */ @@ -1898,7 +1900,8 @@ H5S__get_select_hyper_nblocks(const H5S_t *space) /* Check each dimension */ for(ret_value = 1, u = 0; u < space->extent.rank; u++) - ret_value *= space->select.sel_info.hslab->app_diminfo[u].count; + ret_value *= (app_ref ? space->select.sel_info.hslab->app_diminfo[u].count : + space->select.sel_info.hslab->opt_diminfo[u].count); } /* end if */ else ret_value = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); @@ -1941,7 +1944,7 @@ H5Sget_select_hyper_nblocks(hid_t spaceid) if(space->select.sel_info.hslab->unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot get number of blocks for unlimited selection") - ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space); + ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space, TRUE); done: FUNC_LEAVE_API(ret_value) @@ -1950,88 +1953,52 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_hyper_set_offset_size + H5S_hyper_get_version_enc_size PURPOSE - Determine the offset size (4 or 8 bytes) to use for encoding hyperslab selection info - USAGE - hssize_t H5S_hyper_set_offset_size(space, block_count, bounds_end, version, offset_size) - const H5S_t *space: IN: The maximum size of the hyperslab selection info - hsize_t block_count: IN: The number of blocks in the selection - hsize_t bounds_end: IN: The selection high bounds - uint32_t version: IN: The version used for encoding - uint8_t *offset_size: OUT: The offset size - - RETURNS - The offset size - DESCRIPTION - Determine the offset size for encoding hyperslab selection info based on the - the input parameter "version". This is for release 1.10. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5S_hyper_set_offset_size(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], uint32_t version, uint8_t *offset_size) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - switch(version) { - case H5S_HYPER_VERSION_1: - *offset_size = H5S_INFO_SIZE_4; - break; - - case H5S_HYPER_VERSION_2: - *offset_size = H5S_INFO_SIZE_8; - break; - - default: - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper offset size") - break; - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_hyper_set_offset_size() */ - - -/*-------------------------------------------------------------------------- - NAME - H5S_hyper_set_version - PURPOSE - Determine the version to use for encoding hyperslab selection info + Determine the version and encoded size to use for encoding hyperslab selection info See tables 2 & 3 in the RFC: H5Sencode/H5Sdecode Format Change USAGE - hssize_t H5S_hyper_set_version(space, block_count, bounds_end, f, version) + hssize_t H5S_hyper_get_version_enc_size(space, block_count, version, enc_size) const H5S_t *space: IN: The dataspace hsize_t block_count: IN: The number of blocks in the selection - hsize_t bounds_end: IN: The selection high bounds - H5F_t *f: IN: The file pointer uint32_t *version: OUT: The version to use for encoding + uint8_t *enc_size: OUT: The encoded size to use RETURNS - The version to use + The version and the size to encode hyperslab selection info DESCRIPTION Determine the version to use for encoding hyperslab selection info based on whether the number of blocks or the selection high bounds exceeds (2^32 - 1). + Then determine the encoded size based on version. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +H5S_hyper_get_version_enc_size(const H5S_t *space, hsize_t block_count, uint32_t *version, uint8_t *enc_size) { + hsize_t bounds_start[H5S_MAX_RANK]; /* Starting coordinate of bounding box */ + hsize_t bounds_end[H5S_MAX_RANK]; /* Opposite coordinate of bounding box */ hbool_t count_up_version = FALSE; /* Whether number of blocks exceed (2^32 - 1) */ hbool_t bound_up_version = FALSE; /* Whether high bounds exceed (2^32 - 1) */ + H5F_libver_t low_bound; /* The 'low' bound of library format versions */ + H5F_libver_t high_bound; /* The 'high' bound of library format versions */ unsigned u; /* Local index veriable */ uint32_t tmp_version; /* Temporay version */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + + if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ + /* Get bounding box for the selection */ + if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + } + /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */ if(block_count > H5S_UINT32_MAX) count_up_version = TRUE; @@ -2041,6 +2008,10 @@ H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_en bound_up_version = TRUE; } + /* Get the file's low_bound and high_bound */ + if(H5CX_get_libver_bounds(&low_bound, &high_bound) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context") + /* Use version 2 for unlimited selection */ if(space->select.sel_info.hslab->unlim_dim >= 0) tmp_version = H5S_HYPER_VERSION_2; @@ -2052,7 +2023,7 @@ H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_en else /* block_count < 4: version 1 */ /* block_count >= 4: determined by low bound */ - tmp_version = (block_count < 4) ? H5S_HYPER_VERSION_1 : H5O_sds_hyper_ver_bounds[H5F_LOW_BOUND(f)]; + tmp_version = (block_count < 4) ? H5S_HYPER_VERSION_1 : H5O_sds_hyper_ver_bounds[low_bound]; } else { /* Fail for irregular hyperslab if exceeds 32 bits */ @@ -2064,14 +2035,29 @@ H5S_hyper_set_version(const H5S_t *space, hsize_t block_count, hsize_t bounds_en } /* Version bounds check */ - if(tmp_version > H5O_sds_hyper_ver_bounds[H5F_HIGH_BOUND(f)]) + if(tmp_version > H5O_sds_hyper_ver_bounds[high_bound]) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace hyperslab selection version out of bounds") *version = tmp_version; + /* Determine the encoded size based on version */ + switch(tmp_version) { + case H5S_HYPER_VERSION_1: + *enc_size = H5S_SELECT_INFO_ENC_SIZE_4; + break; + + case H5S_HYPER_VERSION_2: + *enc_size = H5S_SELECT_INFO_ENC_SIZE_8; + break; + + default: + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper encoded size") + break; + } + done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_hyper_set_version() */ +} /* H5S_hyper_get_version_enc_size() */ /*-------------------------------------------------------------------------- @@ -2081,9 +2067,8 @@ done: Determine the number of bytes needed to store the serialized hyperslab selection information. USAGE - hssize_t H5S_hyper_serial_size(space, H5F_t *f) + hssize_t H5S_hyper_serial_size(space) H5S_t *space; IN: Dataspace pointer to query - H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -2095,44 +2080,23 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S__hyper_serial_size(const H5S_t *space, H5F_t *f) +H5S__hyper_serial_size(const H5S_t *space) { hsize_t block_count = 0; /* block counter for regular hyperslabs */ - hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds */ - hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds */ uint32_t version; /* Version number */ - uint8_t offset_size; /* Offset size */ - unsigned u; /* Local index variable */ + uint8_t enc_size; /* Encoded size of hyperslab selection info */ hssize_t ret_value = -1; /* return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Get bounding box for the selection */ - HDmemset(bounds_end, 0, sizeof(bounds_end)); - if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ - /* Determine the number of blocks */ - if(H5S__hyper_is_regular(space)) { - /* Check each dimension */ - for(block_count = 1, u = 0; u < space->extent.rank; u++) - block_count *= space->select.sel_info.hslab->opt_diminfo[u].count; - } /* end if */ - else - /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ - block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); - - /* Get bounding box for the selection */ - if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") - } - - /* Determine the version */ - if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + /* Determine the number of blocks */ + if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ + block_count = H5S__get_select_hyper_nblocks(space, FALSE); - /* Determine the offset size */ - if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) + /* Determine the version and the encoded size */ + if(H5S_hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") if(version == H5S_HYPER_VERSION_2) { @@ -2140,19 +2104,19 @@ H5S__hyper_serial_size(const H5S_t *space, H5F_t *f) /* Size required is always: * + + + * + + - * (4 (start/stride/count/block) * * ) = + * (4 (start/stride/count/block) * * ) = * 17 + (4 * 8 * rank) bytes */ - HDassert(offset_size == 8); + HDassert(enc_size == 8); ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank); } else { HDassert(version == H5S_HYPER_VERSION_1); - HDassert(offset_size == 4); + HDassert(enc_size == 4); /* Version 1 */ /* Basic number of bytes required to serialize hyperslab selection: * + + + * + + <# of blocks (4 bytes)> + - * (2 (starting/ending offset) * * * <# of blocks) = + * (2 (starting/ending offset) * * * <# of blocks) = * = 24 bytes + (2 * 4 * rank * block_count) */ ret_value = 24; @@ -2257,7 +2221,6 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. - H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -2269,7 +2232,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) +H5S__hyper_serialize(const H5S_t *space, uint8_t **p) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ uint8_t *pp; /* Local pointer for encoding */ @@ -2281,14 +2244,13 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ uint8_t flags = 0; /* Flags for message */ - hsize_t block_count; /* block counter for regular hyperslabs */ + hsize_t block_count = 0; /* block counter for regular hyperslabs */ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ unsigned ndims; /* Rank of the dataspace */ - unsigned u; /* Local counting variable */ + unsigned i, u; /* Local counting variable */ int done; /* Whether we are done with the iteration */ - uint8_t offset_size; - hsize_t bounds_start[H5S_MAX_RANK]; - hsize_t bounds_end[H5S_MAX_RANK]; + hbool_t is_regular; /* Whether selection is regular */ + uint8_t enc_size; /* Encoded size */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2303,38 +2265,23 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) ndims = space->extent.rank; diminfo = space->select.sel_info.hslab->opt_diminfo; - if(space->select.sel_info.hslab->unlim_dim < 0) { /* ! H5S_UNLIMITED */ - /* Calculate the # of blocks */ - if(H5S__hyper_is_regular(space)) { - /* Check each dimension */ - for(block_count = 1, u = 0; u < ndims; u++) - block_count *= diminfo[u].count; - } /* end if */ - else - /* Spin through hyperslab spans, adding 8 * rank bytes for each block */ - block_count = H5S__hyper_span_nblocks(space->select.sel_info.hslab->span_lst); - - /* Get bounding box */ - if(H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") - } + /* Calculate the # of blocks */ + if(space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ + block_count = H5S__get_select_hyper_nblocks(space, FALSE); /* Determine the version to use */ - if(H5S_hyper_set_version(space, block_count, bounds_end, f, &version) < 0) + if(H5S_hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") - /* Determine the size of offset info */ - if(H5S_hyper_set_offset_size(space, block_count, bounds_end, version, &offset_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") - - if(H5S__hyper_is_regular(space) && version == H5S_HYPER_VERSION_2) + is_regular = H5S__hyper_is_regular(space); + if(is_regular && version == H5S_HYPER_VERSION_2) flags |= H5S_HYPER_REGULAR; /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ UINT32ENCODE(pp, version); /* Store the version number */ - if(version == 2) + if(version == H5S_HYPER_VERSION_2) *(pp)++ = flags; /* Store the flags */ else UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ @@ -2346,105 +2293,110 @@ H5S__hyper_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) /* Encode number of dimensions */ UINT32ENCODE(pp, (uint32_t)ndims); - /* If flags indicates a regular hyperslab or unlimited dimension, encode opt_diminfo */ - if(flags & H5S_HYPER_REGULAR) { - unsigned i; - - HDassert(H5S_UNLIMITED == HSIZE_UNDEF); - HDassert(version == H5S_HYPER_VERSION_2); - - /* Iterate over dimensions */ - /* Encode start/stride/block/count */ - for(i = 0; i < space->extent.rank; i++) { - UINT64ENCODE(pp, diminfo[i].start); - UINT64ENCODE(pp, diminfo[i].stride); - UINT64ENCODE(pp, diminfo[i].count); - UINT64ENCODE(pp, diminfo[i].block); - } /* end for */ - len += (4 * space->extent.rank * 8); - } /* end if */ /* Check for a "regular" hyperslab selection */ - else if(H5S__hyper_is_regular(space)) { - HDassert(version == H5S_HYPER_VERSION_1); + if(is_regular) { - /* Set some convienence values */ - fast_dim = ndims - 1; - /* Encode number of hyperslabs */ - H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); - UINT32ENCODE(pp, (uint32_t)block_count); - len += 4; + /* If flags indicates a regular hyperslab or unlimited dimension, encode opt_diminfo */ + if(version == H5S_HYPER_VERSION_2) { - /* Now serialize the information for the regular hyperslab */ + HDassert(H5S_UNLIMITED == HSIZE_UNDEF); + HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_8); - /* Build the tables of count sizes as well as the initial offset */ - for(u = 0; u < ndims; u++) { - tmp_count[u] = diminfo[u].count; - offset[u] = diminfo[u].start; - } /* end for */ + /* Iterate over dimensions */ + /* Encode start/stride/block/count */ + for(i = 0; i < space->extent.rank; i++) { + UINT64ENCODE(pp, diminfo[i].start); + UINT64ENCODE(pp, diminfo[i].stride); + UINT64ENCODE(pp, diminfo[i].count); + UINT64ENCODE(pp, diminfo[i].block); + } /* end for */ + len += (4 * space->extent.rank * 8); + } else { + HDassert(version == H5S_HYPER_VERSION_1); + HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4); - /* We're not done with the iteration */ - done = FALSE; + /* Set some convienence values */ + fast_dim = ndims - 1; - /* Go iterate over the hyperslabs */ - while(done == FALSE) { - /* Iterate over the blocks in the fastest dimension */ - while(tmp_count[fast_dim] > 0) { - /* Add 8 bytes times the rank for each hyperslab selected */ - len += 8 * ndims; + /* Encode number of hyperslabs */ + H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); + UINT32ENCODE(pp, (uint32_t)block_count); + len += 4; - /* Encode hyperslab starting location */ - for(u = 0; u < ndims; u++) - UINT32ENCODE(pp, (uint32_t)offset[u]); + /* Now serialize the information for the regular hyperslab */ - /* Encode hyperslab ending location */ - for(u = 0; u < ndims; u++) - UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1))); + /* Build the tables of count sizes as well as the initial offset */ + for(u = 0; u < ndims; u++) { + tmp_count[u] = diminfo[u].count; + offset[u] = diminfo[u].start; + } /* end for */ - /* Move the offset to the next sequence to start */ - offset[fast_dim]+=diminfo[fast_dim].stride; + /* We're not done with the iteration */ + done = FALSE; - /* Decrement the block count */ - tmp_count[fast_dim]--; - } /* end while */ + /* Go iterate over the hyperslabs */ + while(done == FALSE) { + /* Iterate over the blocks in the fastest dimension */ + while(tmp_count[fast_dim] > 0) { + /* Add 8 bytes times the rank for each hyperslab selected */ + len += 8 * ndims; - /* Work on other dimensions if necessary */ - if(fast_dim > 0) { - int temp_dim; /* Temporary rank holder */ + /* Encode hyperslab starting location */ + for(u = 0; u < ndims; u++) + UINT32ENCODE(pp, (uint32_t)offset[u]); - /* Reset the block counts */ - tmp_count[fast_dim] = diminfo[fast_dim].count; + /* Encode hyperslab ending location */ + for(u = 0; u < ndims; u++) + UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1))); + + /* Move the offset to the next sequence to start */ + offset[fast_dim]+=diminfo[fast_dim].stride; - /* Bubble up the decrement to the slower changing dimensions */ - temp_dim = (int)fast_dim - 1; - while(temp_dim >= 0 && done == FALSE) { /* Decrement the block count */ - tmp_count[temp_dim]--; + tmp_count[fast_dim]--; + } /* end while */ - /* Check if we have more blocks left */ - if(tmp_count[temp_dim] > 0) - break; + /* Work on other dimensions if necessary */ + if(fast_dim > 0) { + int temp_dim; /* Temporary rank holder */ - /* Check for getting out of iterator */ - if(temp_dim == 0) - done = TRUE; + /* Reset the block counts */ + tmp_count[fast_dim] = diminfo[fast_dim].count; - /* Reset the block count in this dimension */ - tmp_count[temp_dim] = diminfo[temp_dim].count; + /* Bubble up the decrement to the slower changing dimensions */ + temp_dim = (int)fast_dim - 1; + while(temp_dim >= 0 && done == FALSE) { + /* Decrement the block count */ + tmp_count[temp_dim]--; - /* Wrapped a dimension, go up to next dimension */ - temp_dim--; - } /* end while */ - } /* end if */ - else - break; /* Break out now, for 1-D selections */ + /* Check if we have more blocks left */ + if(tmp_count[temp_dim] > 0) + break; - /* Re-compute offset array */ - for(u = 0; u < ndims; u++) - offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]); - } /* end while */ - } /* end if */ - else { + /* Check for getting out of iterator */ + if(temp_dim == 0) + done = TRUE; + + /* Reset the block count in this dimension */ + tmp_count[temp_dim] = diminfo[temp_dim].count; + + /* Wrapped a dimension, go up to next dimension */ + temp_dim--; + } /* end while */ + } /* end if */ + else + break; /* Break out now, for 1-D selections */ + + /* Re-compute offset array */ + for(u = 0; u < ndims; u++) + offset[u] = diminfo[u].start + diminfo[u].stride * (diminfo[u].count - tmp_count[u]); + } /* end while */ + } /* end if */ + + } else { /* irregular */ HDassert(version == H5S_HYPER_VERSION_1); + HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4); + /* Encode number of hyperslabs */ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); UINT32ENCODE(pp, (uint32_t)block_count); @@ -2500,7 +2452,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) hsize_t dims[H5S_MAX_RANK]; /* Dimenion sizes */ hsize_t start[H5S_MAX_RANK]; /* Hyperslab start information */ hsize_t block[H5S_MAX_RANK]; /* Hyperslab block information */ - uint32_t version; /* Version number */ + uint32_t version; /* Version number */ /* Encoded size */ uint8_t flags = 0; /* Flags */ unsigned rank; /* Rank of points */ const uint8_t *pp; /* Local pointer for decoding */ @@ -2529,7 +2481,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); - if(version >= (uint32_t)2) { + if(version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ flags = *(pp)++; @@ -2559,7 +2511,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Sanity checks */ HDassert(H5S_UNLIMITED == HSIZE_UNDEF); - HDassert(version >= 2); + HDassert(version >= H5S_HYPER_VERSION_2); /* Iterate over dimensions */ for(u = 0; u < rank; u++) { diff --git a/src/H5Snone.c b/src/H5Snone.c index 0005b99..aa98035 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -37,8 +37,8 @@ static herr_t H5S_none_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_none_release(H5S_t *space); static htri_t H5S_none_is_valid(const H5S_t *space); -static hssize_t H5S_none_serial_size(const H5S_t *space, H5F_t *f); -static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); +static hssize_t H5S_none_serial_size(const H5S_t *space); +static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p); static herr_t H5S_none_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_none_offset(const H5S_t *space, hsize_t *off); @@ -56,7 +56,7 @@ static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); +static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); static herr_t H5S_none_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_none_iter_release(H5S_sel_iter_t *sel_iter); @@ -250,7 +250,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) USAGE herr_t H5S_none_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - hsize_t nelem; IN: Number of elements to advance by + size_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -261,7 +261,7 @@ H5S_none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_UNUSED nelem) +H5S_none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -434,7 +434,6 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) USAGE hssize_t H5S_none_serial_size(space, f) H5S_t *space; IN: Dataspace pointer to query - H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -446,7 +445,7 @@ H5S_none_is_valid(const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) +H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -466,12 +465,11 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_none_serialize(space, p, f) + herr_t H5S_none_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. - H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -483,7 +481,7 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space, H5F_t H5_ATTR_UNUSED *f) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5S_t *space, uint8_t **p, H5F_t H5_ATTR_UNUSED *f) +H5S_none_serialize(const H5S_t *space, uint8_t **p) { uint8_t *pp = (*p); /* Local pointer for decoding */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 9219998..3edf4c3 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -50,9 +50,9 @@ #define H5S_ALL_VERSION_1 1 /* Size of point/offset info for H5S_SEL_POINTS/H5S_SEL_HYPER */ -#define H5S_INFO_SIZE_4 0x04 /* 4 bytes: 32 bits */ -#define H5S_INFO_SIZE_8 0x08 /* 8 bytes: 64 bits */ -#define H5S_SELECT_INFO_SIZE_BITS (H5S_INFO_SIZE_4|H5S_INFO_SIZE_8) +#define H5S_SELECT_INFO_ENC_SIZE_4 0x04 /* 4 bytes: 32 bits */ +#define H5S_SELECT_INFO_ENC_SIZE_8 0x08 /* 8 bytes: 64 bits */ +#define H5S_SELECT_INFO_ENC_SIZE_BITS (H5S_SELECT_INFO_ENC_SIZE_4|H5S_SELECT_INFO_ENC_SIZE_8) #define H5S_UINT32_MAX 4294967295 /* 2^32 - 1 */ @@ -159,9 +159,9 @@ typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space); /* Method to determine if current selection is valid for dataspace */ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space); /* Method to determine number of bytes required to store current selection */ -typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space, H5F_t *f); +typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p, H5F_t *f); +typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p); /* Method to determine smallest n-D bounding box containing the current selection */ @@ -244,7 +244,7 @@ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ typedef htri_t (*H5S_sel_iter_has_next_block_func_t)(const H5S_sel_iter_t *iter); /* Method to move selection iterator to the next element in the selection */ -typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, hsize_t nelem); +typedef herr_t (*H5S_sel_iter_next_func_t)(H5S_sel_iter_t *iter, size_t nelem); /* Method to move selection iterator to the next block in the selection */ typedef herr_t (*H5S_sel_iter_next_block_func_t)(H5S_sel_iter_t *iter); /* Method to release iterator for current selection */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 4165ffd..604b58b 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -38,8 +38,8 @@ static herr_t H5S_point_get_seq_list(const H5S_t *space, unsigned flags, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); static herr_t H5S_point_release(H5S_t *space); static htri_t H5S_point_is_valid(const H5S_t *space); -static hssize_t H5S_point_serial_size(const H5S_t *space, H5F_t *f); -static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); +static hssize_t H5S_point_serial_size(const H5S_t *space); +static herr_t H5S_point_serialize(const H5S_t *space, uint8_t **p); static herr_t H5S_point_deserialize(H5S_t **space, const uint8_t **p); static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S_point_offset(const H5S_t *space, hsize_t *off); @@ -51,6 +51,8 @@ static void H5S_point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S_point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S_point_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); +static herr_t + H5S_point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size); /* Selection iteration callbacks */ static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); @@ -753,20 +755,19 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_point_set_version + H5S_point_get_version_enc_size PURPOSE - Determine the version to use for encoding points selection info + Determine the version and the size (4 bytes) to encode point selection info USAGE - hssize_t H5S_point_set_version(space, bounds_end, f, version) + hssize_t H5S_point_get_version_enc_size(space, uint32_t *version, uint8_t *enc_size const H5S_t *space; IN: The dataspace - hsize_t bounds_end: IN: The selection high bounds - H5F_t *f: IN: The file pointer uint32_t *version: OUT: The version to use for encoding + uint8_t *enc_size: OUT: The size to use for encoding RETURNS - The version to use + The version and the encoded size to use DESCRIPTION - Determine the version to use for encoding points selection info: - For 1.10, return 1 + Determine the version and the encoded size to use for encoding points selection info. + Detect whether the number of points or the high bound exceeds 2^32 -1. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS @@ -774,15 +775,20 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_set_version(const H5S_t *space, hsize_t bounds_end[], H5F_t *f, uint32_t *version) +H5S_point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t *enc_size) { hbool_t exceed = FALSE; + hsize_t bounds_start[H5S_MAX_RANK]; + hsize_t bounds_end[H5S_MAX_RANK]; unsigned u; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT - *version = H5S_POINT_VERSION_1; + /* Get bounding box for the selection */ + HDmemset(bounds_end, 0, sizeof(bounds_end)); + if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") /* Determine whether the number of points or the high bounds in the selection exceed (2^32 - 1) */ for(u = 0; u < space->extent.rank; u++) @@ -796,47 +802,12 @@ H5S_point_set_version(const H5S_t *space, hsize_t bounds_end[], H5F_t *f, uint32 else if(exceed) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "The end of bounding box in point selection exceeds 2^32") + *version = H5S_POINT_VERSION_1; + *enc_size = H5S_SELECT_INFO_ENC_SIZE_4; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5S_point_set_version() */ - - -/*-------------------------------------------------------------------------- - NAME - H5S_point_set_info_size - PURPOSE - Determine the size of point info to use for encoding selection info - USAGE - hssize_t H5S_point_set_info_size(space, bounds_end, version, point_size) - const H5S_t *space: IN: Dataspace ID of selection to query - hsize_t bounds_end[]: IN: The selection high bounds - uint32_t version: IN: The version used for encoding - uint8_t *point_size: OUT: The size of point info - RETURNS - The size of the points selection info - DESCRIPTION - Determine the size for encoding points selection info: - For 1.10, return 4 - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5S_point_set_info_size(const H5S_t *space, hsize_t H5_ATTR_UNUSED bounds_end[], uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED *point_size) -{ - hsize_t max_size = 0; - unsigned u; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(version == H5S_POINT_VERSION_1); - - *point_size = H5S_INFO_SIZE_4; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5S_point_set_info_size() */ +} /* H5S_point_get_version_enc_size() */ /*-------------------------------------------------------------------------- @@ -846,9 +817,8 @@ H5S_point_set_info_size(const H5S_t *space, hsize_t H5_ATTR_UNUSED bounds_end[], Determine the number of bytes needed to store the serialized point selection information. USAGE - hssize_t H5S_point_serial_size(space, f) + hssize_t H5S_point_serial_size(space) H5S_t *space; IN: Dataspace pointer to query - H5F_t *f; IN: File pointer RETURNS The number of bytes required on success, negative on an error. DESCRIPTION @@ -860,34 +830,23 @@ H5S_point_set_info_size(const H5S_t *space, hsize_t H5_ATTR_UNUSED bounds_end[], REVISION LOG --------------------------------------------------------------------------*/ static hssize_t -H5S_point_serial_size (const H5S_t *space, H5F_t *f) +H5S_point_serial_size (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ - hsize_t bounds_start[H5S_MAX_RANK]; - hsize_t bounds_end[H5S_MAX_RANK]; uint32_t version; /* Version number */ - uint8_t point_size; /* Size of point info */ + uint8_t enc_size; /* Size of point info */ hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(space); - /* Get bounding box for the selection */ - HDmemset(bounds_end, 0, sizeof(bounds_end)); - if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") - /* Determine the version */ - if(H5S_point_set_version(space, bounds_end, f, &version) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") - - /* Determine the size of point info */ - if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + if(H5S_point_get_version_enc_size(space, &version, &enc_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") HDassert(version == H5S_POINT_VERSION_1); - HDassert(point_size == H5S_INFO_SIZE_4); + HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4); /* Basic number of bytes required to serialize point selection: */ /* @@ -896,14 +855,14 @@ H5S_point_serial_size (const H5S_t *space, H5F_t *f) */ ret_value=20; - /* */ - ret_value += point_size; + /* */ + ret_value += enc_size; /* Count points in selection */ curr=space->select.sel_info.pnt_lst->head; while(curr!=NULL) { - /* Add bytes times the rank for each element selected */ - ret_value += point_size * space->extent.rank; + /* Add bytes times the rank for each element selected */ + ret_value += enc_size * space->extent.rank; curr = curr->next; } /* end while */ @@ -918,12 +877,11 @@ done: PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_point_serialize(space, p, f) + herr_t H5S_point_serialize(space, p) const H5S_t *space; IN: Dataspace with selection to serialize uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. - H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -935,7 +893,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) +H5S_point_serialize (const H5S_t *space, uint8_t **p) { H5S_pnt_node_t *curr; /* Point information nodes */ uint8_t *pp; /* Local pointer for encoding */ @@ -943,9 +901,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) uint32_t len=0; /* number of bytes used */ unsigned u; /* local counting variable */ uint32_t version; /* Version number */ - uint8_t point_size; /* Size of point info */ - hsize_t bounds_start[H5S_MAX_RANK]; - hsize_t bounds_end[H5S_MAX_RANK]; + uint8_t enc_size; /* Size of point info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -956,20 +912,11 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p, H5F_t *f) pp = (*p); HDassert(pp); - /* Get bounding box for the selection */ - HDmemset(bounds_end, 0, sizeof(bounds_end)); - if(H5S_point_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") - /* Determine the version */ - if(H5S_point_set_version(space, bounds_end, f, &version) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") - - /* Determine the size of point info */ - if(H5S_point_set_info_size(space, bounds_end, version, &point_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version") + if(H5S_point_get_version_enc_size(space, &version, &enc_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") - HDassert(point_size == H5S_INFO_SIZE_4); + HDassert(enc_size == H5S_SELECT_INFO_ENC_SIZE_4); HDassert(version == H5S_POINT_VERSION_1); /* Store the preamble information */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index e46c43b..cbdd208 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -149,8 +149,8 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.type->get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) ((*(S)->select.type->is_valid)(S)) #define H5S_SELECT_RELEASE(S) ((*(S)->select.type->release)(S)) -#define H5S_SELECT_SERIAL_SIZE(S,F) ((*(S)->select.type->serial_size)(S,F)) -#define H5S_SELECT_SERIALIZE(S,BUF,F) ((*(S)->select.type->serialize)(S,BUF,F)) +#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.type->serial_size)(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.type->serialize)(S,BUF)) #define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.type->bounds)(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) ((*(S)->select.type->offset)(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.type->is_contiguous)(S)) @@ -175,8 +175,8 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN)) #define H5S_SELECT_VALID(S) (H5S_select_valid(S)) #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) -#define H5S_SELECT_SERIAL_SIZE(S,F) (H5S_select_serial_size(S,F)) -#define H5S_SELECT_SERIALIZE(S,BUF,F) (H5S_select_serialize(S,BUF,F)) +#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S)) +#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF)) #define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END)) #define H5S_SELECT_OFFSET(S, OFFSET) (H5S_get_select_offset(S, OFFSET)) #define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S)) @@ -220,7 +220,7 @@ H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space/*o H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]); H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds); -H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id); +H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc); H5_DLL H5S_t *H5S_decode(const unsigned char **p); H5_DLL herr_t H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -255,8 +255,8 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space, H5F_t *f); -H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); +H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t **p); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); H5_DLL htri_t H5S_select_is_regular(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index d52d5ff..6b10811 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -223,7 +223,7 @@ done: *------------------------------------------------------------------------- */ hssize_t -H5S_select_serial_size(const H5S_t *space, H5F_t *f) +H5S_select_serial_size(const H5S_t *space) { hssize_t ret_value = -1; /* Return value */ @@ -232,7 +232,7 @@ H5S_select_serial_size(const H5S_t *space, H5F_t *f) HDassert(space); /* Call the selection type's serial_size function */ - ret_value=(*space->select.type->serial_size)(space, f); + ret_value=(*space->select.type->serial_size)(space); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serial_size() */ @@ -249,7 +249,6 @@ H5S_select_serial_size(const H5S_t *space, H5F_t *f) uint8_t **p; OUT: Pointer to buffer to put serialized selection. Will be advanced to end of serialized selection. - H5F_t *f; IN: File pointer RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -264,7 +263,7 @@ H5S_select_serial_size(const H5S_t *space, H5F_t *f) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) +H5S_select_serialize(const H5S_t *space, uint8_t **p) { herr_t ret_value=SUCCEED; /* Return value */ @@ -274,7 +273,7 @@ H5S_select_serialize(const H5S_t *space, uint8_t **p, H5F_t *f) HDassert(p); /* Call the selection type's serialize function */ - ret_value=(*space->select.type->serialize)(space,p,f); + ret_value=(*space->select.type->serialize)(space,p); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_serialize() */ diff --git a/src/H5T.c b/src/H5T.c index 023a65f..fe2c5b1 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2961,7 +2961,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -3016,7 +3016,7 @@ H5T_decode(size_t buf_size, const unsigned char *buf) FUNC_ENTER_NOAPI_NOINIT /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((uint8_t)0, H5P_FILE_ACCESS_DEFAULT))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ diff --git a/test/vds.c b/test/vds.c index 66e137f..e4f886e 100644 --- a/test/vds.c +++ b/test/vds.c @@ -619,9 +619,8 @@ test_api(test_api_config_t config, hid_t fapl) /* Get examination DCPL */ - - /* Should be a value of 174, not 213. HDFFV-10469 */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)174) < 0) + /* Correct previous fix for HDFFV-10469 */ + if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ -- cgit v0.12 From 4867de9631d9ffd8f4186df27b3c69283ca0fee5 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 24 Apr 2019 09:37:41 -0500 Subject: Added new C++ wrappers - HDFFV-10622 Description: Added wrappers for H5Pset/get_create_intermediate_group: // Specifies in property list whether to create missing // intermediate groups void setCreateIntermediateGroup(bool crt_intmd_group) const; // Determines whether property is set to enable creating missing // intermediate groups bool getCreateIntermediateGroup() const; Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test) --- c++/src/H5LcreatProp.cpp | 40 +++++++++++++++ c++/src/H5LcreatProp.h | 8 +++ c++/src/H5Location.cpp | 7 ++- c++/test/tobject.cpp | 128 ++++++++++++++++++++++++++++++++++++++++++++--- release_docs/RELEASE.txt | 6 +++ 5 files changed, 177 insertions(+), 12 deletions(-) diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 695c1fe..bde9339 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -103,6 +103,46 @@ LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList& original) : PropLi LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) {} //-------------------------------------------------------------------------- +// Function: LinkCreatPropList::setCreateIntermediateGroup +///\brief Specifies in property list whether to create missing +/// intermediate groups. +///\param crt_intmd_group - IN: Flag specifying whether to create +/// intermediate groups upon the creation of an object +///\exception H5::PropListIException +// April, 2019 +//-------------------------------------------------------------------------- +void LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const +{ + herr_t ret_value = H5Pset_create_intermediate_group(id, (unsigned)crt_intmd_group); + // Throw exception if H5Pset_create_intermediate_group returns failure + if (ret_value < 0) + { + throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed"); + } +} + +//-------------------------------------------------------------------------- +// Function: LinkCreatPropList::getCreateIntermediateGroup +///\brief Determines whether property is set to enable creating missing +/// intermediate groups. +///\return true if creating intermediate groups is enabled, and false, otherwise +///\exception H5::PropListIException +// April, 2019 +//-------------------------------------------------------------------------- +bool LinkCreatPropList::getCreateIntermediateGroup() const +{ + unsigned crt_intmd_group; + herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group); + // Throw exception if H5Pget_create_intermediate_group returns failure + if (ret_value < 0) + { + throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed"); + } + + return((bool)crt_intmd_group); +} + +//-------------------------------------------------------------------------- // Function: LinkCreatPropList::setCharEncoding ///\brief Sets the character encoding of the string. /// diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h index f6e10bf..908ef63 100644 --- a/c++/src/H5LcreatProp.h +++ b/c++/src/H5LcreatProp.h @@ -40,6 +40,14 @@ class H5_DLLCPP LinkCreatPropList : public PropList { // using the property list id. LinkCreatPropList (const hid_t plist_id); + // Specifies in property list whether to create missing + // intermediate groups + void setCreateIntermediateGroup(bool crt_intmd_group) const; + + // Determines whether property is set to enable creating missing + // intermediate groups + bool getCreateIntermediateGroup() const; + // Sets the character encoding of the string. void setCharEncoding(H5T_cset_t encoding) const; diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2c49016..2641960 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1066,7 +1066,7 @@ void H5Location::link(const char *curr_name, const Group& new_loc, hid_t lcpl_id = lcpl.getId(); hid_t lapl_id = lapl.getId(); - ret_value = H5Lcreate_hard(getId(), curr_name, new_loc.getId(), new_name, H5P_DEFAULT, H5P_DEFAULT); + ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id); if (ret_value < 0) throwException("link", "creating link failed"); } @@ -1102,14 +1102,13 @@ void H5Location::link(const H5std_string& curr_name, const Group& new_loc, /// H5Lcreate_hard APIs in the HDF5 C Reference Manual. // March 2018 //-------------------------------------------------------------------------- -void H5Location::link(const char *curr_name, const hid_t same_loc, - const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const +void H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, const LinkCreatPropList& lcpl, const LinkAccPropList& lapl) const { herr_t ret_value = -1; hid_t lcpl_id = lcpl.getId(); hid_t lapl_id = lapl.getId(); - ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, H5P_DEFAULT, H5P_DEFAULT); + ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id); if (ret_value < 0) throwException("link", "creating link failed"); diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 537716f..232ece2 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -609,10 +609,121 @@ static void test_getobjectinfo_same_file() catch (Exception& E) { cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl; - issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg()); + issue_fail_msg("test_getobjectinfo_same_file()", __LINE__, __FILE__, E.getCDetailMsg()); + } + +} // test_getobjectinfo_same_file + +/*------------------------------------------------------------------------- + * Function: test_intermediate_groups + * + * Purpose Test that intermediate groups are created as specified by + * the property setting. + * + * Return None + * + * April, 2019 + *------------------------------------------------------------------------- + */ +const H5std_string FILE_INTERGRPS("tobject_intergrps.h5"); +const H5std_string GROUP10NAME("/group10"); +const H5std_string GROUP11NAME("/group10/group11"); +const H5std_string GROUP12NAME("/group10/group11/group12"); +const H5std_string GROUP13NAME("/group10/group11/group12/group13"); +const H5std_string GROUP14NAME("/group10/group11/group12/group13/group14"); +const H5std_string GROUP14FROM13NAME("group14"); +const H5std_string GROUP20NAME("/group20"); +const H5std_string GROUP21NAME("/group20/group21"); +const H5std_string GROUP22NAME("group21/group22"); +const H5std_string GROUP22FULLNAME("/group20/group21/group22"); +static void test_intermediate_groups() +{ + // Output message about test being performed + SUBTEST("Group::set/getCreateIntermediateGroup"); + + try { + // Create a new HDF5 file + H5File file(FILE_INTERGRPS, H5F_ACC_TRUNC); + + // Create a link create property list and set the "create + // intermediate groups" flag + LinkCreatPropList lcpl; + lcpl.setCreateIntermediateGroup(true); + + // Verify value of create missing groups flag + bool crt_int_grps = lcpl.getCreateIntermediateGroup(); + verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__); + + // Create GROUP12NAME with creating missing groups + Group grp12(file.createGroup(GROUP12NAME, lcpl)); + + // Missing groups: GROUP10NAME and GROUP11NAME + + // Create GROUP14NAME without the use of link create plist, should + // fail because group GROUP13NAME is missing + try { + Group grp14_nopl(file.createGroup(GROUP14NAME)); + } catch (FileIException& expected1) {} // Failure is ignored + + // Create GROUP14NAME with the flag to create missing groups set + // to FALSE, should fail because group GROUP13NAME is missing + + // Reset flag to not create missing groups + lcpl.setCreateIntermediateGroup(false); + + // Verify value of create missing groups flag + crt_int_grps = lcpl.getCreateIntermediateGroup(); + verify_val(crt_int_grps, false, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__); + + try { + Group grp14_false(file.createGroup(GROUP14NAME, lcpl)); + } catch (FileIException& expected2) {} // Failure is ignored + + // Set the flag to create missing groups set to TRUE + lcpl.setCreateIntermediateGroup(true); + crt_int_grps = lcpl.getCreateIntermediateGroup(); + verify_val(crt_int_grps, true, "LinkCreatPropList::getCreateIntermediateGroup", __LINE__, __FILE__); + + + // Create GROUP14NAME with the use of link create plist + Group grp14(file.createGroup(GROUP14NAME, lcpl)); + + // Missing groups: GROUP13NAME + + // Create group GROUP20NAME + Group grp20(file.createGroup(GROUP20NAME)); + + // Create group GROUP22NAME with missing group GROUP21NAME + Group grp22(grp20.createGroup(GROUP22NAME, lcpl)); + + // Close groups and file + grp12.close(); + grp14.close(); + grp20.close(); + grp22.close(); + file.close(); + + // Reopen the file + file.openFile(FILE_INTERGRPS, H5F_ACC_RDWR); + + // Open the missing groups and various combinations + Group grp10(file.openGroup(GROUP10NAME)); + Group grp11(file.openGroup(GROUP11NAME)); + Group grp13(file.openGroup(GROUP13NAME)); + Group grp14from13(grp13.openGroup(GROUP14FROM13NAME)); + Group grp21(file.openGroup(GROUP21NAME)); + Group grp22fromfile(file.openGroup(GROUP22FULLNAME)); + + PASSED(); + } // end of try block + // catch all other exceptions + catch (Exception& E) + { + cerr << " in Exception " << E.getCFuncName() << "detail: " << E.getCDetailMsg() << endl; + issue_fail_msg("test_intermediate_groups()", __LINE__, __FILE__, E.getCDetailMsg()); } -} // test_h5o_getinfo_same_file +} // test_intermediate_groups /*------------------------------------------------------------------------- * Function: test_object @@ -631,12 +742,13 @@ void test_object() // Output message about test being performed MESSAGE(5, ("Testing Object Functions\n")); - test_get_objname(); // Test get object name from groups/datasets - test_existance(); // Test check for object existance - test_get_objname_ontypes(); // Test get object name from types - test_get_objtype(); // Test get object type - test_open_object_header(); // Test object header functions (H5O) - test_getobjectinfo_same_file(); // Test object info in same file + test_get_objname(); // Test get object name from groups/datasets + test_existance(); // Test check for object existance + test_get_objname_ontypes(); // Test get object name from types + test_get_objtype(); // Test get object type + test_open_object_header(); // Test object header functions (H5O) + test_getobjectinfo_same_file(); // Test object info in same file + test_intermediate_groups(); // Test intermediate group property } // test_object diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ce8b8a5..264fec9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -247,6 +247,12 @@ New Features C++ Library: ------------ + - Added new wrappers for H5Pset/get_create_intermediate_group() + LinkCreatPropList::setCreateIntermediateGroup() + LinkCreatPropList::getCreateIntermediateGroup() + + (BMR - 2019/04/22, HDFFV-10622) + - Added new function to the C++ interface Added wrapper for H5Ovisit2: -- cgit v0.12 From eb2476bc41d30e856a453990a0b0fdc89e3f5ad5 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Tue, 30 Apr 2019 15:35:09 -0500 Subject: Fix Java JUnit-TestH5P failure on 32-bit arch --- java/src/jni/h5pFCPLImp.c | 2 +- release_docs/RELEASE.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c index 34ac065..cc7c264 100644 --- a/java/src/jni/h5pFCPLImp.c +++ b/java/src/jni/h5pFCPLImp.c @@ -240,7 +240,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1sym_1k done: if (theArray) - UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0); + UNPIN_INT_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */ diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 264fec9..a3f2232 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -263,6 +263,10 @@ New Features Java Library: ---------------- + - Fix a failure in JUnit-TestH5P on 32-bit architectures + + (JTH - 2019/04/30) + - Rewrote the JNI error handling to be much cleaner (JTH - 2019/02/12) -- cgit v0.12 From 519685d05cdb53e6e641587863c45773cca571db Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 16 May 2019 13:19:56 -0500 Subject: Address daily test failure for hdf5_1_10: Fix the testhdf5 failing test in the selection code which segfaults. --- src/H5Dchunk.c | 2 +- src/H5Spoint.c | 6 +++--- src/H5Sprivate.h | 2 +- src/H5Sselect.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 89c182d..d24c6d4 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2077,7 +2077,7 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u } /* end else */ /* Move memory selection iterator to next element in selection */ - if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (hsize_t)1) < 0) + if(H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location") done: diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 604b58b..04d829f 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -59,7 +59,7 @@ static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); +static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); static herr_t H5S_point_iter_next_block(H5S_sel_iter_t *sel_iter); static herr_t H5S_point_iter_release(H5S_sel_iter_t *sel_iter); @@ -279,7 +279,7 @@ done: USAGE herr_t H5S_point_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN: Pointer to selection iterator - hsize_t nelem; IN: Number of elements to advance by + size_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -290,7 +290,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) +H5S_point_iter_next(H5S_sel_iter_t *iter, size_t nelem) { FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index cbdd208..cf9338e 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -306,7 +306,7 @@ H5_DLL hsize_t H5S_hyper_get_first_inc_block(const H5S_t *space, H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords); H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter); -H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, hsize_t nelem); +H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 6b10811..3ab4d28 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1165,7 +1165,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) USAGE herr_t H5S_select_iter_next(iter, nelem) H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change - hsize_t nelem; IN: Number of elements to advance by + size_t nelem; IN: Number of elements to advance by RETURNS Non-negative on success, negative on failure. DESCRIPTION @@ -1180,7 +1180,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_iter_next(H5S_sel_iter_t *iter, hsize_t nelem) +H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) { herr_t ret_value = FAIL; /* Return value */ -- cgit v0.12 From d628d1d8c897917c7a07affd565c7744d4ae6057 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 17 May 2019 15:48:38 -0500 Subject: Fix message command syntax --- config/cmake/HDF5UseFortran.cmake | 10 +++++----- config/cmake/jrunTest.cmake | 8 ++++---- config/cmake/userblockTest.cmake | 4 ++-- config/cmake/vfdTest.cmake | 4 ++-- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/HDFUseFortran.cmake | 6 +++--- config/cmake_ext_mod/grepTest.cmake | 4 ++-- config/cmake_ext_mod/runTest.cmake | 8 ++++---- java/CMakeLists.txt | 4 ++-- test/flushrefreshTest.cmake | 4 ++-- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 03597f2..279e077 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -376,11 +376,11 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) set (${RETURN_VAR} ${OUTPUT_VAR}) - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") - #message ( "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ") - #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message (STATUS "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ") + #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message (STATUS "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ") + #message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") if (${COMPILE_RESULT_VAR}) if (${RUN_RESULT_VAR} MATCHES 1) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index d5cd903..95c7583 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -24,7 +24,7 @@ if (NOT TEST_LIBRARY_DIRECTORY) message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") @@ -145,7 +145,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT str_act STREQUAL str_ref) if (str_act) set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () @@ -197,7 +197,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT str_act STREQUAL str_ref) if (str_act) set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () @@ -245,5 +245,5 @@ if (TEST_GREP_COMPARE) endif () # everything went fine... -message ("${TEST_PROGRAM} Passed") +message (STATUS "${TEST_PROGRAM} Passed") diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 4a580d0..0e9d01b 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -20,7 +20,7 @@ if (NOT TEST_GET_PROGRAM) message (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined") endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_HFILE) message (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined") @@ -127,5 +127,5 @@ else () endif () # everything went fine... -message ("Passed: The output of CHECK matched expectation") +message (STATUS "Passed: The output of CHECK matched expectation") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index b616958..8e186e9 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -17,7 +17,7 @@ if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") @@ -73,4 +73,4 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # everything went fine... -message ("Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") +message (STATUS "Passed: The ${TEST_PROGRAM} program used vfd ${TEST_VFD}") diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index cc9de79..bbd5170 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -656,7 +656,7 @@ if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES " set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll") set (PRINT_LL_FOUND 1) else () - message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") + message (STATUS "Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}") endif () else () file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index c68c921..de66e33 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -65,9 +65,9 @@ macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE) OUTPUT_VARIABLE OUTPUT ) -# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") -# message ( "Test result ${OUTPUT}") -# message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") +# message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") +# message (STATUS "Test result ${OUTPUT}") +# message (STATUS "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") if (${RESULT_VAR}) set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}") diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 1417204..fe8af03 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -20,7 +20,7 @@ endif () # message (STATUS "Require TEST_ARGS to be defined") #endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") @@ -71,5 +71,5 @@ if (TEST_EXPECT) endif () # everything went fine... -message ("Passed: The output of ${TEST_PROGRAM} matched") +message (STATUS "Passed: The output of ${TEST_PROGRAM} matched") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 13e8a4d..c9508f3 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -18,7 +18,7 @@ if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") @@ -221,7 +221,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT str_act STREQUAL str_ref) if (str_act) set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () @@ -273,7 +273,7 @@ if (NOT TEST_SKIP_COMPARE) if (NOT str_act STREQUAL str_ref) if (str_act) set (TEST_RESULT 1) - message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") endif () endif () endforeach () @@ -321,5 +321,5 @@ if (TEST_GREP_COMPARE) endif () # everything went fine... -message ("${TEST_PROGRAM} Passed") +message (STATUS "${TEST_PROGRAM} Passed") diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index ffc3b94..528b24f 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -11,8 +11,8 @@ include (${HDF_RESOURCES_DIR}/UseJava.cmake) message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}") find_package (JNI) -message ("JNI_LIBRARIES=${JNI_LIBRARIES}") -message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") +message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") +message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") if (WIN32) diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index aa18c8a..73210ef 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -18,7 +18,7 @@ if (NOT TEST_PROGRAM) message (FATAL_ERROR "Require TEST_PROGRAM to be defined") endif () if (NOT TEST_FOLDER) - message ( FATAL_ERROR "Require TEST_FOLDER to be defined") + message (FATAL_ERROR "Require TEST_FOLDER to be defined") endif () if (NOT TEST_OUTPUT) message (FATAL_ERROR "Require TEST_OUTPUT to be defined") @@ -169,4 +169,4 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # everything went fine... -message ("Passed") +message (STATUS "Passed") -- cgit v0.12 From c59817f3436cdd30059520df7d12eea0512e59b4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 31 May 2019 12:34:37 -0500 Subject: Update cmake macros and java arg format --- MANIFEST | 2 + bin/batch/ctest.qsub.in.cmake | 21 ++++ config/cmake/jrunTest.cmake | 24 ++++- config/cmake/scripts/CTestScript.cmake | 12 ++- config/cmake/scripts/HDF5config.cmake | 9 +- config/cmake/scripts/HPC/qsub-HDF5options.cmake | 51 +++++++++ config/cmake_ext_mod/grepTest.cmake | 137 +++++++++++++++++++++--- config/gnu-flags | 18 ++-- java/src/jni/h5Imp.c | 2 +- java/src/jni/h5eImp.c | 68 ++++++------ java/src/jni/h5fImp.c | 52 ++++----- java/src/jni/h5gImp.c | 20 ++-- java/src/jni/h5sImp.c | 12 +-- java/src/jni/h5util.c | 4 +- 14 files changed, 321 insertions(+), 111 deletions(-) create mode 100644 bin/batch/ctest.qsub.in.cmake create mode 100644 config/cmake/scripts/HPC/qsub-HDF5options.cmake diff --git a/MANIFEST b/MANIFEST index 73858a0..5dd7659 100644 --- a/MANIFEST +++ b/MANIFEST @@ -103,6 +103,7 @@ ./bin/batch/knl_ctestP.sl.in.cmake ./bin/batch/knl_ctestS.sl.in.cmake ./bin/batch/knl_H5detect.sl.in.cmake +./bin/batch/ctest.qsub.in.cmake ./bin/batch/ray_ctestP.lsf.in.cmake ./bin/batch/ray_ctestS.lsf.in.cmake ./bin/batch/raybsub @@ -3367,6 +3368,7 @@ # CMake-specific HPC Scripts ./config/cmake/scripts/HPC/sbatch-HDF5options.cmake ./config/cmake/scripts/HPC/bsub-HDF5options.cmake +./config/cmake/scripts/HPC/qsub-HDF5options.cmake ./config/cmake/scripts/HPC/raybsub-HDF5options.cmake # Files generated by autogen diff --git a/bin/batch/ctest.qsub.in.cmake b/bin/batch/ctest.qsub.in.cmake new file mode 100644 index 0000000..702fca7 --- /dev/null +++ b/bin/batch/ctest.qsub.in.cmake @@ -0,0 +1,21 @@ +#!/bin/bash -l +if [ $# -gt 0 ]; then + SUMMARY_FILE=$1 +fi +ACCOUNT_ID=@ACCOUNT_ID@ + +echo "Run parallel test command. Test output will be in build/${SUMMARY_FILE}" +CTEST_CMD=`which ctest` + +#SKIPTESTS <> + +cd @HDF5_BINARY_DIR@ +if [[ $SUMMARY_FILE == *"ctestS"* ]]; then + CMD="${CTEST_CMD} . -E MPI_TEST_ -C Release -j 32 -T test" +else + CMD="${CTEST_CMD} . -R MPI_TEST_ ${SKIP_TESTS} -C Release -T test" +fi + +qsub -t 60 -n 1 -q debug-flat-quad -A ${ACCOUNT_ID} ${CMD} >& ${SUMMARY_FILE} + +echo "Done running ctest parallel command." diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 95c7583..fc49275 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -51,6 +51,8 @@ message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defa if (WIN32 AND NOT MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") +else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") endif () # run the test program, capture the stdout/stderr and the result var @@ -64,6 +66,7 @@ execute_process ( RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT ERROR_VARIABLE TEST_ERROR ) @@ -126,11 +129,22 @@ if (NOT TEST_SKIP_COMPARE) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () - # now compare the output with the reference - execute_process ( - COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} - RESULT_VARIABLE TEST_RESULT - ) + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_RESULT 1) + endif () + endif () + if (TEST_RESULT) set (TEST_RESULT 0) file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index e234057..e1fe85a 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -280,7 +280,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub") execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME}) else () - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME}) + if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "qsub") + execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME} ctestS.out) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME}) + endif() endif () message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) @@ -299,7 +303,11 @@ message (STATUS "Dashboard script configuration:\n${vars}\n") if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub") execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) else () - execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "qsub") + execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME} ctestP.out) + else () + execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}) + endif () endif () message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml") execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 8f0c9fa..2a80277 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -44,7 +44,7 @@ set (CTEST_SOURCE_VERSEXT "-snap1") #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 #MODEL - CDash group name -#HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub +#HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub, qsub #MPI - enable MPI; if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -177,8 +177,8 @@ if (NOT DEFINED HPC) endif () endif () else () + set (CTEST_SITE "${SITE_OS_NAME}") set (CTEST_CMAKE_GENERATOR "Unix Makefiles") - include (${CTEST_SOURCE_DIRECTORY}/config/cmake/scripts/HPC/${HPC}-HDF5options.cmake) endif () ################################################################### @@ -203,7 +203,7 @@ endif () ##### Following controls source update ##### #set (LOCAL_UPDATE "TRUE") set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git") -set (REPOSITORY_BRANCH "hdf5_1_10_5") +set (REPOSITORY_BRANCH "hdf5_1_10_6") #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows #set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") @@ -228,6 +228,9 @@ if (WIN32) else () set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake) + if (DEFINED HPC) + include (${CTEST_SOURCE_DIRECTORY}/config/cmake/scripts/HPC/${HPC}-HDF5options.cmake) + endif () include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake) if (APPLE) if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg") diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake new file mode 100644 index 0000000..51c3891 --- /dev/null +++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake @@ -0,0 +1,51 @@ +# +# 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. +# +############################################################################################# +#### Change default configuration of options in config/cmake/cacheinit.cmake file ### +#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### +############################################################################################# + +### uncomment/comment and change the following lines for other configuration options + +############################################################################################# +### enable parallel builds +if (DEFINED MPI) + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") +endif () +############################################################################################# +### options to run test scripts in batch commands +set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub") +set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctest.qsub") +if (DEFINED KNL) + ### some additions and alternatives to cross compile on haswell for knl + set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake") +endif () +set (LOCAL_BATCH_SCRIPT_COMMAND "qsub") +set (LOCAL_BATCH_TEST "TRUE") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=${LOCAL_BATCH_SCRIPT_NAME}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_EXECUTABLE:STRING=aprun") +# Option to suppress writing job statistics; to avoid issues with h5diff comparisons. +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_PREFLAGS:STRING=-q") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-n") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6") +set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DACCOUNT_ID:STRING=${LOCAL_BATCH_SCRIPT_ARGS}") + +############################################################################################# +############################################################################################# diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index fe8af03..4b58639 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -29,14 +29,35 @@ endif () # message (STATUS "Require TEST_EXPECT to be defined") #endif () if (NOT TEST_FILTER) - message (STATUS "Require TEST_FILTER to be defined") + message (STATUS "Optional TEST_FILTER to be defined") endif () if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif () +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +if (TEST_LIBRARY_DIRECTORY) + if (WIN32 AND NOT MINGW) + set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") + else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") + endif () +endif () + +if (TEST_ENV_VAR) + set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") +endif () + # run the test program, capture the stdout/stderr and the result var execute_process ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} @@ -49,24 +70,114 @@ execute_process ( ) message (STATUS "COMMAND Result: ${TEST_RESULT}") + message (STATUS "COMMAND Error: ${TEST_ERROR}") -# now grep the output with the reference +# remove special output file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) +string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") +if (TEST_FIND_RESULT GREATER 0) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +endif () -# TEST_REFERENCE should always be matched -string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) -string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) -if (NOT TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") +# if the TEST_ERRREF exists grep the error output with the error reference +if (TEST_ERRREF) + # if the .err file exists grep the error output with the error reference before comparing stdout + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) + + # TEST_ERRREF should always be matched + string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM}) + string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_RESULT) + if (NOT TEST_RESULT) + message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}") + endif () + endif () + + #always compare output file to reference unless this must be skipped + if (NOT TEST_SKIP_COMPARE) + if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif () + if (NOT TEST_SORT_COMPARE) + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + else () + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2) + list (SORT v1) + list (SORT v2) + if (NOT v1 STREQUAL v2) + set(TEST_RESULT 1) + endif () + endif () + + if (TEST_RESULT) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (len_act GREATER 0 AND len_ref GREATER 0) + math (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT str_act STREQUAL str_ref) + if (str_act) + set (TEST_RESULT 1) + message (STATUS "line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif () + endif () + endforeach () + else () + if (len_act EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty") + endif () + if (len_ref EQUAL 0) + message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty") + endif () + endif () + if (NOT len_act EQUAL len_ref) + set (TEST_RESULT 1) + endif () + endif () + + message (STATUS "COMPARE Result: ${TEST_RESULT}") + + # again, if return value is !=0 scream and shout + if (TEST_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif () + endif () + endif () +else () + # else grep the output with the reference + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) + if (NOT TEST_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif () endif () -string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) -if (TEST_EXPECT) - # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match - string (LENGTH "${TEST_MATCH}" TEST_RESULT) - if (TEST_RESULT) - message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + +if (TEST_FILTER) + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (TEST_EXPECT) + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match + string (LENGTH "${TEST_MATCH}" TEST_RESULT) + if (TEST_RESULT) + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif () endif () endif () diff --git a/config/gnu-flags b/config/gnu-flags index 225f072..7df72c7 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -37,10 +37,10 @@ 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 @@ -87,7 +87,7 @@ case "$cc_vendor-$cc_version" in case "$host_os-$host_cpu" in # cygwin needs the "-std=c99" flag removed, so make # a specific case for Cygwin without the flag and a default - # case to add the flag everywhere else + # case to add the flag everywhere else cygwin-*) ;; @@ -111,7 +111,7 @@ case "$cc_vendor-$cc_version" in # 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 + # 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" @@ -126,7 +126,7 @@ case "$cc_vendor-$cc_version" in gcc-4.*) PROD_CFLAGS= ;; - gcc-[56].*) + gcc-[56789].*) PROD_CFLAGS="-fstdarg-opt" ;; *) @@ -140,7 +140,7 @@ case "$cc_vendor-$cc_version" in # NDEBUG is handled explicitly by the configure script # -g is handled by the symbols flags case "$cc_vendor-$cc_version" in - gcc-[56].*) + gcc-[56789].*) DEBUG_CFLAGS="-ftrapv -fno-common" ;; *) @@ -165,7 +165,7 @@ case "$cc_vendor-$cc_version" in HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS= ;; - gcc-[56].*) + gcc-[56789].*) HIGH_OPT_CFLAGS="-O3" DEBUG_OPT_CFLAGS="-Og" ;; @@ -190,7 +190,7 @@ 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-6*) + gcc-[6789].*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c index 99c91fd..f0dd691 100644 --- a/java/src/jni/h5Imp.c +++ b/java/src/jni/h5Imp.c @@ -127,7 +127,7 @@ done: if (libversionArray) UNPIN_INT_ARRAY(ENVONLY, libversion, libversionArray, (status < 0) ? JNI_ABORT : 0); - return (jint)status; + return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5get_1libversion */ /* diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 4ab00df..937323e 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -62,11 +62,11 @@ static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *cb_data); */ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { unsigned int is_stack = 0; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eauto_is_v2: invalid stack ID"); @@ -85,14 +85,14 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eregister_1class - (JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version) + (JNIEnv *env, jclass clss, jstring cls_name, jstring lib_name, jstring version) { const char* the_cls_name = NULL; const char* the_lib_name = NULL; const char* the_version = NULL; hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (NULL == cls_name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: class name is NULL"); @@ -126,9 +126,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eunregister_1class - (JNIEnv *env, jclass cls, jlong cls_id) + (JNIEnv *env, jclass clss, jlong cls_id) { - UNUSED(cls); + UNUSED(clss); if (cls_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eunregister_class: invalid error class ID"); @@ -147,9 +147,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1msg - (JNIEnv *env, jclass cls, jlong err_id) + (JNIEnv *env, jclass clss, jlong err_id) { - UNUSED(cls); + UNUSED(clss); if (err_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_msg: invalid error message ID"); @@ -168,13 +168,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1msg - (JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg) + (JNIEnv *env, jclass clss, jlong err_id, jint msg_type, jstring err_msg) { H5E_type_t error_msg_type = (H5E_type_t)msg_type; const char *the_err_msg = NULL; hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (err_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID"); @@ -200,11 +200,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1stack - (JNIEnv *env, jclass cls) + (JNIEnv *env, jclass clss) { hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Ecreate_stack()) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -220,11 +220,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1current_1stack - (JNIEnv *env, jclass cls) + (JNIEnv *env, jclass clss) { hid_t ret_val = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Eget_current_stack()) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -240,9 +240,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1stack - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_stack: invalid error stack ID"); @@ -261,11 +261,11 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eprint2 - (JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj) + (JNIEnv *env, jclass clss, jlong stk_id, jobject stream_obj) { herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eprint2: invalid error stack ID"); @@ -290,13 +290,13 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1class_1name - (JNIEnv *env, jclass cls, jlong cls_id) + (JNIEnv *env, jclass clss, jlong cls_id) { jstring str = NULL; ssize_t buf_size; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); if (cls_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: invalid error class ID"); @@ -332,9 +332,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eset_current_stack: invalid error stack ID"); @@ -353,9 +353,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epop - (JNIEnv *env, jclass cls, jlong stk_id, jlong count) + (JNIEnv *env, jclass clss, jlong stk_id, jlong count) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epop: invalid error stack ID"); @@ -374,7 +374,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epush2 - (JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname, + (JNIEnv *env, jclass clss, jlong stk_id, jstring filename, jstring funcname, jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc) { const char *fName = NULL; @@ -382,7 +382,7 @@ Java_hdf_hdf5lib_H5_H5Epush2 const char *errMsg = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error stack ID"); @@ -423,9 +423,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclear2 - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclear2: invalid error stack ID"); @@ -444,7 +444,7 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg - (JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list) + (JNIEnv *env, jclass clss, jlong msg_id, jintArray error_msg_type_list) { H5E_type_t error_msg_type; jstring str = NULL; @@ -452,7 +452,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg jint *theArray = NULL; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); if (msg_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid error message ID"); @@ -496,11 +496,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1num - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass clss, jlong stk_id) { ssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if (stk_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_num: invalid error stack ID"); @@ -587,11 +587,11 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 - (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) + (JNIEnv *env, jclass clss, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) { cb_wrapper wrapper = { callback_op, op_data }; - UNUSED(cls); + UNUSED(clss); ENVPTR->GetJavaVM(ENVONLY, &jvm); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 52b0970..115e8f4 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -118,13 +118,13 @@ done: */ JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Fget_1name - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { jstring str = NULL; ssize_t buf_size; char *namePtr = NULL; - UNUSED(cls); + UNUSED(clss); /* Get the length of the name */ if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0) @@ -225,11 +225,11 @@ done: */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1intent - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { unsigned intent = 0; - UNUSED(cls); + UNUSED(clss); if (H5Fget_intent((hid_t)file_id, &intent) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -323,11 +323,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1freespace - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { hssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Fget_freespace((hid_t)file_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -363,7 +363,7 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids - (JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs, + (JNIEnv *env, jclass clss, jlong file_id, jint types, jlong maxObjs, jlongArray obj_id_list) { jboolean isCopy; @@ -373,7 +373,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids jlong *obj_id_listP = NULL; hid_t *id_list = NULL; - UNUSED(cls); + UNUSED(clss); if (NULL == obj_id_list) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list is NULL"); @@ -411,11 +411,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1count - (JNIEnv *env, jclass cls, jlong file_id, jint types) + (JNIEnv *env, jclass clss, jlong file_id, jint types) { ssize_t ret_val = -1; - UNUSED(cls); + UNUSED(clss); if ((ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -451,11 +451,11 @@ done: */ JNIEXPORT jdouble JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { double rate = 0.0; - UNUSED(cls); + UNUSED(clss); if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -471,7 +471,7 @@ done: */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size - (JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache) + (JNIEnv *env, jclass clss, jlong file_id, jlongArray metadata_cache) { jboolean isCopy; size_t max_size = 0, min_clean_size = 0, cur_size = 0; @@ -479,7 +479,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size jsize size = 0; int cur_num_entries = -1; - UNUSED(cls); + UNUSED(clss); if (NULL == metadata_cache) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata cache array is NULL"); @@ -557,9 +557,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -575,9 +575,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fclear_elink_file_cache((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -593,9 +593,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstart_swmr_write((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -611,9 +611,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstart_mdc_logging((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -629,9 +629,9 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging - (JNIEnv *env, jclass cls, jlong file_id) + (JNIEnv *env, jclass clss, jlong file_id) { - UNUSED(cls); + UNUSED(clss); if (H5Fstop_mdc_logging((hid_t)file_id) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -647,7 +647,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status - (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status) + (JNIEnv *env, jclass clss, jlong file_id, jbooleanArray mdc_logging_status) { jboolean *mdc_logging_status_ptr = NULL; jboolean isCopy; @@ -655,7 +655,7 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status hbool_t is_currently_logging; jsize size; - UNUSED(cls); + UNUSED(clss); if (NULL == mdc_logging_status) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status is NULL"); diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c index b579f31..79b1b65 100644 --- a/java/src/jni/h5gImp.c +++ b/java/src/jni/h5gImp.c @@ -148,11 +148,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate_1anon - (JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id) + (JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id) { hid_t group_id = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -198,11 +198,11 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Gget_1create_1plist - (JNIEnv *env, jclass cls, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id) { hid_t plist_id = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if ((plist_id = H5Gget_create_plist((hid_t)loc_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -218,12 +218,12 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info - (JNIEnv *env, jclass cls, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id) { H5G_info_t group_info; jobject obj = NULL; - UNUSED(cls); + UNUSED(clss); if (H5Gget_info((hid_t)loc_id, &group_info) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -242,14 +242,14 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name - (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id) + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong lapl_id) { H5G_info_t group_info; const char *grpName = NULL; jobject obj = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL"); @@ -278,7 +278,7 @@ done: */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx - (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type, + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_type, jint order, jlong n, jlong lapl_id) { H5_iter_order_t corder = (H5_iter_order_t)order; @@ -288,7 +288,7 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx jobject obj = NULL; herr_t ret_val = FAIL; - UNUSED(cls); + UNUSED(clss); if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_idx: group name is NULL"); diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 087cda8..3c675b8 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -1129,14 +1129,14 @@ done: */ JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Sencode - (JNIEnv *env, jclass cls, jlong obj_id) + (JNIEnv *env, jclass clss, jlong obj_id) { unsigned char *bufPtr = NULL; size_t buf_size = 0; herr_t status = FAIL; jbyteArray returnedArray = NULL; - UNUSED(cls); + UNUSED(clss); if (obj_id < 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID"); @@ -1173,13 +1173,13 @@ done: */ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sdecode - (JNIEnv *env, jclass cls, jbyteArray buf) + (JNIEnv *env, jclass clss, jbyteArray buf) { jboolean isCopy; jbyte *bufP = NULL; hid_t sid = H5I_INVALID_HID; - UNUSED(cls); + UNUSED(clss); if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sdecode: buffer is NULL"); @@ -1203,11 +1203,11 @@ done: */ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab - (JNIEnv *env, jclass cls, jlong obj_id) + (JNIEnv *env, jclass clss, jlong obj_id) { htri_t bval = JNI_FALSE; - UNUSED(cls); + UNUSED(clss); if ((bval = H5Sis_regular_hyperslab((hid_t)obj_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 5454dce..af83caa 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -3453,7 +3453,7 @@ done: */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset - (JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) + (JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) { const char *file_export = NULL; const char *object_name = NULL; @@ -3464,7 +3464,7 @@ Java_hdf_hdf5lib_H5_H5export_1dataset hid_t dataset_id = H5I_INVALID_HID; FILE *stream = NULL; - UNUSED(cls); + UNUSED(clss); if (NULL == file_export_name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL"); -- cgit v0.12 From 1a2df2a6c3dcfc4c1030e6ba4d3da351f46a9d4f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 10 Jun 2019 13:16:11 -0500 Subject: Updates from develop --- config/cmake/UseJava.cmake | 1149 ++++++++++++++---------------- config/cmake/UseJavaClassFilelist.cmake | 23 +- config/cmake/UseJavaSymlinks.cmake | 19 +- config/cmake_ext_mod/FindSZIP.cmake | 232 +++--- config/cmake_ext_mod/HDFUseFortran.cmake | 2 +- java/src/jni/h5tImp.c | 2 +- testpar/CMakeTests.cmake | 37 +- 7 files changed, 689 insertions(+), 775 deletions(-) diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 754d742..1f6b04c 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -1,437 +1,373 @@ # Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. -#.rst: -# UseJava -# ------- -# -# Use Module for Java -# -# This file provides functions for Java. It is assumed that -# FindJava.cmake has already been loaded. See FindJava.cmake for -# information on how to load Java into your CMake project. -# -# :: -# -# add_jar(target_name -# [SOURCES] source1 [source2 ...] [resource1 ...] -# [INCLUDE_JARS jar1 [jar2 ...]] -# [ENTRY_POINT entry] -# [VERSION version] -# [OUTPUT_NAME name] -# [OUTPUT_DIR dir] -# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]] -# ) -# -# This command creates a .jar. It compiles the given -# source files (source) and adds the given resource files (resource) to -# the jar file. Source files can be java files or listing files -# (prefixed by '@'). If only resource files are given then just a jar file -# is created. The list of include jars are added to the classpath when -# compiling the java sources and also to the dependencies of the target. -# INCLUDE_JARS also accepts other target names created by add_jar. For -# backwards compatibility, jar files listed as sources are ignored (as -# they have been since the first version of this module). -# -# The default OUTPUT_DIR can also be changed by setting the variable -# CMAKE_JAVA_TARGET_OUTPUT_DIR. -# -# Optionally, using option GENERATE_NATIVE_HEADERS, native header files can be generated -# for methods declared as native. These files provide the connective glue that allow your -# Java and C code to interact. An INTERFACE target will be created for an easy usage -# of generated files. Sub-option DESTINATION can be used to specify output directory for -# generated header files. -# -# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK. -# -# Additional instructions: -# -# :: -# -# To add compile flags to the target you can set these flags with -# the following variable: -# -# -# -# :: -# -# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) -# -# -# -# :: -# -# To add a path or a jar file to the class path you can do this -# with the CMAKE_JAVA_INCLUDE_PATH variable. -# -# -# -# :: -# -# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) -# -# -# -# :: -# -# To use a different output name for the target you can set it with: -# -# -# -# :: -# -# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) -# -# -# -# :: -# -# To use a different output directory than CMAKE_CURRENT_BINARY_DIR -# you can set it with: -# -# -# -# :: -# -# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) -# -# -# -# :: -# -# To define an entry point in your jar you can set it with the ENTRY_POINT -# named argument: -# -# -# -# :: -# -# add_jar(example ENTRY_POINT com/examples/MyProject/Main) -# -# -# -# :: -# -# To define a custom manifest for the jar, you can set it with the manifest -# named argument: -# -# -# -# :: -# -# add_jar(example MANIFEST /path/to/manifest) -# -# -# -# :: -# -# To add a VERSION to the target output name you can set it using -# the VERSION named argument to add_jar. This will create a jar file with the -# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar -# pointing to the jar with the version information. -# -# -# -# :: -# -# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) -# -# -# -# :: -# -# If the target is a JNI library, utilize the following commands to -# create a JNI symbolic link: -# -# -# -# :: -# -# set(CMAKE_JNI_TARGET TRUE) -# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) -# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) -# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) -# -# -# -# :: -# -# If a single target needs to produce more than one jar from its -# java source code, to prevent the accumulation of duplicate class -# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior -# to calling the add_jar() function: -# -# -# -# :: -# -# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) -# add_jar(foo foo.java) -# -# -# -# :: -# -# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) -# add_jar(bar bar.java) -# -# -# -# :: -# -# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to -# include module JNI before any call to add_jar. The produced target for native -# headers can then be used to compile C/C++ sources with command -# target_link_libraries. -# -# -# :: -# -# find_package(JNI) -# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native) -# add_library(bar bar.cpp) -# target_link_libraries(bar PRIVATE foo-native) -# -# -# Target Properties: -# -# :: -# -# The add_jar() function sets some target properties. You can get these -# properties with the -# get_property(TARGET PROPERTY ) -# command. -# -# -# -# :: -# -# INSTALL_FILES The files which should be installed. This is used by -# install_jar(). -# JNI_SYMLINK The JNI symlink which should be installed. -# This is used by install_jni_symlink(). -# JAR_FILE The location of the jar file so that you can include -# it. -# CLASSDIR The directory where the class files can be found. For -# example to use them with javah. -# -# :: -# -# find_jar( -# name | NAMES name1 [name2 ...] -# [PATHS path1 [path2 ... ENV var]] -# [VERSIONS version1 [version2]] -# [DOC "cache documentation string"] -# ) -# -# This command is used to find a full path to the named jar. A cache -# entry named by is created to stor the result of this command. -# If the full path to a jar is found the result is stored in the -# variable and the search will not repeated unless the variable is -# cleared. If nothing is found, the result will be -NOTFOUND, and -# the search will be attempted again next time find_jar is invoked with -# the same variable. The name of the full path to a file that is -# searched for is specified by the names listed after NAMES argument. -# Additional search locations can be specified after the PATHS argument. -# If you require special a version of a jar file you can specify it with -# the VERSIONS argument. The argument after DOC will be used for the -# documentation string in the cache. -# -# :: -# -# install_jar(target_name destination) -# install_jar(target_name DESTINATION destination [COMPONENT component]) -# -# This command installs the TARGET_NAME files to the given DESTINATION. -# It should be called in the same scope as add_jar() or it will fail. -# -# Target Properties: -# -# :: -# -# The install_jar() function sets the INSTALL_DESTINATION target property -# on jars so installed. This property holds the DESTINATION as described -# above, and is used by install_jar_exports(). You can get this property -# with the -# get_property(TARGET PROPERTY INSTALL_DESTINATION) -# command. -# -# -# -# :: -# -# install_jni_symlink(target_name destination) -# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) -# -# This command installs the TARGET_NAME JNI symlinks to the given -# DESTINATION. It should be called in the same scope as add_jar() or it -# will fail. -# -# :: -# -# install_jar_exports(TARGETS jars... -# [NAMESPACE ] -# FILE -# DESTINATION [COMPONENT ]) -# -# This command installs a target export file ```` for the named jar -# targets to the given ``DESTINATION``. Its function is similar to that of -# :command:`install(EXPORTS ...)`. -# -# :: -# -# export_jars(TARGETS jars... -# [NAMESPACE ] -# FILE ) -# -# This command writes a target export file ```` for the named jar -# targets. Its function is similar to that of :command:`export(...)`. -# -# :: -# -# create_javadoc( -# PACKAGES pkg1 [pkg2 ...] -# [SOURCEPATH ] -# [CLASSPATH ] -# [INSTALLPATH ] -# [DOCTITLE "the documentation title"] -# [WINDOWTITLE "the title of the document"] -# [AUTHOR TRUE|FALSE] -# [USE TRUE|FALSE] -# [VERSION TRUE|FALSE] -# ) -# -# Create java documentation based on files or packages. For more -# details please read the javadoc manpage. -# -# There are two main signatures for create_javadoc. The first signature -# works with package names on a path with source files: -# -# :: -# -# Example: -# create_javadoc(my_example_doc -# PACKAGES com.example.foo com.example.bar -# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" -# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} -# WINDOWTITLE "My example" -# DOCTITLE "

My example

" -# AUTHOR TRUE -# USE TRUE -# VERSION TRUE -# ) -# -# -# -# The second signature for create_javadoc works on a given list of -# files. -# -# :: -# -# create_javadoc( -# FILES file1 [file2 ...] -# [CLASSPATH ] -# [INSTALLPATH ] -# [DOCTITLE "the documentation title"] -# [WINDOWTITLE "the title of the document"] -# [AUTHOR TRUE|FALSE] -# [USE TRUE|FALSE] -# [VERSION TRUE|FALSE] -# ) -# -# -# -# Example: -# -# :: -# -# create_javadoc(my_example_doc -# FILES ${example_SRCS} -# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} -# WINDOWTITLE "My example" -# DOCTITLE "

My example

" -# AUTHOR TRUE -# USE TRUE -# VERSION TRUE -# ) -# -# -# -# Both signatures share most of the options. These options are the same -# as what you can find in the javadoc manpage. Please look at the -# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION. -# -# The documentation will be by default installed to -# -# :: -# -# ${CMAKE_INSTALL_PREFIX}/share/javadoc/ -# -# -# -# if you don't set the INSTALLPATH. -# -# :: -# -# create_javah(TARGET -# GENERATED_FILES -# CLASSES ... -# [CLASSPATH ...] -# [DEPENDS ...] -# [OUTPUT_NAME |OUTPUT_DIR ] -# ) -# -# Create C header files from java classes. These files provide the connective glue -# that allow your Java and C code to interact. -# -# This command will no longer be supported starting with version 10 of the JDK due -# to the `suppression of javah tool `_. -# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead. -# -# There are two main signatures for create_javah. The first signature -# returns generated files through variable specified by GENERATED_FILES option: -# -# :: -# -# Example: -# Create_javah(GENERATED_FILES files_headers -# CLASSES org.cmake.HelloWorld -# CLASSPATH hello.jar -# ) -# -# -# -# The second signature for create_javah creates a target which encapsulates -# header files generation. -# -# :: -# -# Example: -# Create_javah(TARGET target_headers -# CLASSES org.cmake.HelloWorld -# CLASSPATH hello.jar -# ) -# -# -# -# Both signatures share same options. -# -# ``CLASSES ...`` -# Specifies Java classes used to generate headers. -# -# ``CLASSPATH ...`` -# Specifies various paths to look up classes. Here .class files, jar files or targets -# created by command add_jar can be used. -# -# ``DEPENDS ...`` -# Targets on which the javah target depends -# -# ``OUTPUT_NAME `` -# Concatenates the resulting header files for all the classes listed by option CLASSES -# into . Same behavior as option '-o' of javah tool. -# -# ``OUTPUT_DIR `` -# Sets the directory where the header files will be generated. Same behavior as option -# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. +#[=======================================================================[.rst: +UseJava +------- + +Use Module for Java + +This file provides functions for Java. It is assumed that +:module:`FindJava` has already been loaded. See :module:`FindJava` for +information on how to load Java into your CMake project. + +Creating And Installing JARs +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: cmake + + add_jar( + [SOURCES] [...] [...] + [INCLUDE_JARS [...]] + [ENTRY_POINT ] + [VERSION ] + [OUTPUT_NAME ] + [OUTPUT_DIR ] + [GENERATE_NATIVE_HEADERS [DESTINATION ]] + ) + +This command creates a ``.jar``. It compiles the given +```` files and adds the given ```` files to +the jar file. Source files can be java files or listing files +(prefixed by ``@``). If only resource files are given then just a jar file +is created. The list of ``INCLUDE_JARS`` are added to the classpath when +compiling the java sources and also to the dependencies of the target. +``INCLUDE_JARS`` also accepts other target names created by ``add_jar()``. +For backwards compatibility, jar files listed as sources are ignored (as +they have been since the first version of this module). + +The default ``OUTPUT_DIR`` can also be changed by setting the variable +``CMAKE_JAVA_TARGET_OUTPUT_DIR``. + +Optionally, using option ``GENERATE_NATIVE_HEADERS``, native header files can +be generated for methods declared as native. These files provide the +connective glue that allow your Java and C code to interact. An INTERFACE +target will be created for an easy usage of generated files. Sub-option +``DESTINATION`` can be used to specify the output directory for generated +header files. + +``GENERATE_NATIVE_HEADERS`` option requires, at least, version 1.8 of the JDK. + +The ``add_jar()`` function sets the following target properties on +````: + +``INSTALL_FILES`` + The files which should be installed. This is used by ``install_jar()``. +``JNI_SYMLINK`` + The JNI symlink which should be installed. This is used by + ``install_jni_symlink()``. +``JAR_FILE`` + The location of the jar file so that you can include it. +``CLASSDIR`` + The directory where the class files can be found. For example to use them + with ``javah``. + +.. code-block:: cmake + + install_jar( ) + install_jar( DESTINATION [COMPONENT ]) + +This command installs the ```` files to the given +````. It should be called in the same scope as ``add_jar()`` or +it will fail. + +The ``install_jar()`` function sets the ``INSTALL_DESTINATION`` target +property on jars so installed. This property holds the ```` as +described above, and is used by ``install_jar_exports()``. You can get this +information with :command:`get_property` and the ``INSTALL_DESTINATION`` +property key. + +.. code-block:: cmake + + install_jni_symlink( ) + install_jni_symlink( DESTINATION [COMPONENT ]) + +This command installs the ```` JNI symlinks to the given +````. It should be called in the same scope as ``add_jar()`` or +it will fail. + +.. code-block:: cmake + + install_jar_exports(TARGETS ... + [NAMESPACE ] + FILE + DESTINATION [COMPONENT ]) + +This command installs a target export file ```` for the named jar +targets to the given ```` directory. Its function is similar to +that of :command:`install(EXPORTS)`. + +.. code-block:: cmake + + export_jars(TARGETS ... + [NAMESPACE ] + FILE ) + +This command writes a target export file ```` for the named ```` +targets. Its function is similar to that of :command:`export`. + + +Examples +"""""""" + +To add compile flags to the target you can set these flags with the following +variable: + +.. code-block:: cmake + + set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) + + +To add a path or a jar file to the class path you can do this with the +``CMAKE_JAVA_INCLUDE_PATH`` variable. + +.. code-block:: cmake + + set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) + +To use a different output name for the target you can set it with: + +.. code-block:: cmake + + add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) + +To use a different output directory than ``CMAKE_CURRENT_BINARY_DIR`` you can +set it with: + +.. code-block:: cmake + + add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) + +To define an entry point in your jar you can set it with the ``ENTRY_POINT`` +named argument: + +.. code-block:: cmake + + add_jar(example ENTRY_POINT com/examples/MyProject/Main) + +To define a custom manifest for the jar, you can set it with the ``MANIFEST`` +named argument: + +.. code-block:: cmake + + add_jar(example MANIFEST /path/to/manifest) + +To add a version to the target output name you can set it using the ``VERSION`` +named argument to ``add_jar()``. The following example will create a jar file +with the name ``shibboleet-1.0.0.jar`` and will create a symlink +``shibboleet.jar`` pointing to the jar with the version information. + +.. code-block:: cmake + + add_jar(shibboleet shibbotleet.java VERSION 1.2.0) + +If the target is a JNI library, utilize the following commands to +create a JNI symbolic link: + +.. code-block:: cmake + + set(CMAKE_JNI_TARGET TRUE) + add_jar(shibboleet shibbotleet.java VERSION 1.2.0) + install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) + install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) + +If a single target needs to produce more than one jar from its +java source code, to prevent the accumulation of duplicate class +files in subsequent jars, set/reset ``CMAKE_JAR_CLASSES_PREFIX`` prior +to calling the ``add_jar()`` function: + +.. code-block:: cmake + + set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) + add_jar(foo foo.java) + + set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) + add_jar(bar bar.java) + +For an optimum usage of option ``GENERATE_NATIVE_HEADERS``, it is recommended to +include module JNI before any call to ``add_jar()``. The produced target for +native headers can then be used to compile C/C++ sources with the +:command:`target_link_libraries` command. + +.. code-block:: cmake + + find_package(JNI) + add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native) + add_library(bar bar.cpp) + target_link_libraries(bar PRIVATE foo-native) + + +Finding JARs +^^^^^^^^^^^^ + +.. code-block:: cmake + + find_jar( + | NAMES [...] + [PATHS [... ENV ]] + [VERSIONS []] + [DOC "cache documentation string"] + ) + +This command is used to find a full path to the named jar. A cache +entry named by ```` is created to store the result of this command. +If the full path to a jar is found the result is stored in the +variable and the search will not repeated unless the variable is +cleared. If nothing is found, the result will be ``-NOTFOUND``, and +the search will be attempted again next time ``find_jar()`` is invoked with +the same variable. The name of the full path to a file that is +searched for is specified by the names listed after ``NAMES`` argument. +Additional search locations can be specified after the ``PATHS`` argument. +If you require special a version of a jar file you can specify it with +the ``VERSIONS`` argument. The argument after ``DOC`` will be used for the +documentation string in the cache. + + +Javadoc +^^^^^^^ + +The ``create_javadoc()`` command can be used to create java documentation +based on files or packages. For more details please read the javadoc manpage. + +There are two main signatures for ``create_javadoc()``. The first signature +works with package names on a path with source files. + +.. code-block:: cmake + + create_javadoc( + PACKAGES [...] + [SOURCEPATH ] + [CLASSPATH ] + [INSTALLPATH ] + [DOCTITLE "the documentation title"] + [WINDOWTITLE "the title of the document"] + [AUTHOR TRUE|FALSE] + [USE TRUE|FALSE] + [VERSION TRUE|FALSE] + ) + +For example: + +.. code-block:: cmake + + create_javadoc(my_example_doc + PACKAGES com.example.foo com.example.bar + SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "My example" + DOCTITLE "

My example

" + AUTHOR TRUE + USE TRUE + VERSION TRUE + ) + +The second signature for ``create_javadoc()`` works on a given list of +files. + +.. code-block:: cmake + + create_javadoc( + FILES [...] + [CLASSPATH ] + [INSTALLPATH ] + [DOCTITLE "the documentation title"] + [WINDOWTITLE "the title of the document"] + [AUTHOR TRUE|FALSE] + [USE TRUE|FALSE] + [VERSION TRUE|FALSE] + ) + +For example: + +.. code-block:: cmake + + create_javadoc(my_example_doc + FILES ${example_SRCS} + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "My example" + DOCTITLE "

My example

" + AUTHOR TRUE + USE TRUE + VERSION TRUE + ) + +Both signatures share most of the options. These options are the same +as what you can find in the javadoc manpage. Please look at the +manpage for ``CLASSPATH``, ``DOCTITLE``, ``WINDOWTITLE``, ``AUTHOR``, ``USE`` +and ``VERSION``. + +If you don't set the ``INSTALLPATH``, then by default the documentation will +be installed to : + +:: + + ${CMAKE_INSTALL_PREFIX}/share/javadoc/ + + +Header Generation +^^^^^^^^^^^^^^^^^ + +.. code-block:: cmake + + create_javah(TARGET | GENERATED_FILES + CLASSES ... + [CLASSPATH ...] + [DEPENDS ...] + [OUTPUT_NAME |OUTPUT_DIR ] + ) + +Create C header files from java classes. These files provide the connective glue +that allow your Java and C code to interact. + +.. deprecated:: 3.11 + +.. note:: + + This command will no longer be supported starting with version 10 of the JDK + due to the `suppression of javah tool `_. + The ``add_jar(GENERATE_NATIVE_HEADERS)`` command should be used instead. + +There are two main signatures for ``create_javah()``. The first signature +returns generated files through variable specified by the ``GENERATED_FILES`` +option. For example: + +.. code-block:: cmake + + create_javah(GENERATED_FILES files_headers + CLASSES org.cmake.HelloWorld + CLASSPATH hello.jar + ) + +The second signature for ``create_javah()`` creates a target which encapsulates +header files generation. E.g. + +.. code-block:: cmake + + create_javah(TARGET target_headers + CLASSES org.cmake.HelloWorld + CLASSPATH hello.jar + ) + +Both signatures share same options. + +``CLASSES ...`` + Specifies Java classes used to generate headers. + +``CLASSPATH ...`` + Specifies various paths to look up classes. Here .class files, jar files or + targets created by command add_jar can be used. + +``DEPENDS ...`` + Targets on which the javah target depends. + +``OUTPUT_NAME `` + Concatenates the resulting header files for all the classes listed by option + ``CLASSES`` into ````. Same behavior as option ``-o`` of javah tool. + +``OUTPUT_DIR `` + Sets the directory where the header files will be generated. Same behavior + as option ``-d`` of javah tool. If not specified, + :variable:`CMAKE_CURRENT_BINARY_DIR` is used as the output directory. +#]=======================================================================] include(CMakeParseArguments) @@ -446,7 +382,7 @@ function (__java_copy_file src dest comment) endfunction () function(__java_lcat VAR) - foreach(_line ${ARGN}) + foreach(_line IN LISTS ARGN) string(APPEND ${VAR} "${_line}\n") endforeach() @@ -568,7 +504,7 @@ function(add_jar _TARGET_NAME) set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif() - foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + foreach (JAVA_INCLUDE_DIR IN LISTS CMAKE_JAVA_INCLUDE_PATH) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() @@ -592,7 +528,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) set(_JAVA_RESOURCE_FILES_RELATIVE) - foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + foreach(_JAVA_SOURCE_FILE IN LISTS _JAVA_SOURCE_FILES) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) @@ -607,7 +543,7 @@ function(add_jar _TARGET_NAME) file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) - if (${_BIN_LEN} LESS ${_SRC_LEN}) + if (_BIN_LEN LESS _SRC_LEN) set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) else () set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) @@ -637,14 +573,14 @@ function(add_jar _TARGET_NAME) endif () endforeach() - foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS}) + foreach(_JAVA_INCLUDE_JAR IN LISTS _add_jar_INCLUDE_JARS) if (TARGET ${_JAVA_INCLUDE_JAR}) get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) if (_JAVA_JAR_PATH) string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) - list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR}) + list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_JAR_PATH}) else () message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar") endif () @@ -705,7 +641,7 @@ function(add_jar _TARGET_NAME) # create the jar file set(_JAVA_JAR_OUTPUT_PATH - ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + "${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}") if (CMAKE_JNI_TARGET) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} @@ -800,7 +736,8 @@ function(add_jar _TARGET_NAME) # this INTERFACE library depends on jar generation add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME}) - set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") + set_property (DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES + "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}") endif() endfunction() @@ -903,15 +840,15 @@ function (find_jar VARIABLE) set(_state "name") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "name") - if (${arg} STREQUAL "VERSIONS") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "name") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${arg}) @@ -919,22 +856,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "versions") - if (${arg} STREQUAL "NAMES") + elseif (_state STREQUAL "versions") + if (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_versions ${_jar_versions} ${arg}) endif () - elseif (${_state} STREQUAL "names") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "names") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_names ${_jar_names} ${arg}) @@ -942,22 +879,22 @@ function (find_jar VARIABLE) set(_jar_doc "Finding ${arg} jar") endif () endif () - elseif (${_state} STREQUAL "paths") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "paths") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "DOC") + elseif (arg STREQUAL "DOC") set(_state "doc") else () set(_jar_paths ${_jar_paths} ${arg}) endif () - elseif (${_state} STREQUAL "doc") - if (${arg} STREQUAL "VERSIONS") + elseif (_state STREQUAL "doc") + if (arg STREQUAL "VERSIONS") set(_state "versions") - elseif (${arg} STREQUAL "NAMES") + elseif (arg STREQUAL "NAMES") set(_state "names") - elseif (${arg} STREQUAL "PATHS") + elseif (arg STREQUAL "PATHS") set(_state "paths") else () set(_jar_doc ${arg}) @@ -969,8 +906,8 @@ function (find_jar VARIABLE) message(FATAL_ERROR "find_jar: No name to search for given") endif () - foreach (jar_name ${_jar_names}) - foreach (version ${_jar_versions}) + foreach (jar_name IN LISTS _jar_names) + foreach (version IN LISTS _jar_versions) set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) endforeach () set(_jar_files ${_jar_files} ${jar_name}.jar) @@ -998,301 +935,301 @@ function(create_javadoc _target) set(_state "package") - foreach (arg ${ARGN}) - if (${_state} STREQUAL "package") - if (${arg} STREQUAL "PACKAGES") + foreach (arg IN LISTS ARGN) + if (_state STREQUAL "package") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_packages ${arg}) set(_state "packages") endif () - elseif (${_state} STREQUAL "packages") - if (${arg} STREQUAL "FILES") + elseif (_state STREQUAL "packages") + if (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_packages ${arg}) endif () - elseif (${_state} STREQUAL "files") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "files") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_files ${arg}) endif () - elseif (${_state} STREQUAL "sourcepath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "sourcepath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_sourcepath ${arg}) endif () - elseif (${_state} STREQUAL "classpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "classpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") - set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () list(APPEND _javadoc_classpath ${arg}) endif () - elseif (${_state} STREQUAL "installpath") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "installpath") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_installpath ${arg}) endif () - elseif (${_state} STREQUAL "doctitle") + elseif (_state STREQUAL "doctitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_doctitle ${arg}) endif () - elseif (${_state} STREQUAL "windowtitle") + elseif (_state STREQUAL "windowtitle") if (${arg} STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_windowtitle ${arg}) endif () - elseif (${_state} STREQUAL "author") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "author") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_author ${arg}) endif () - elseif (${_state} STREQUAL "use") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "use") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_use ${arg}) endif () - elseif (${_state} STREQUAL "version") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "version") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "OVERVIEW") + elseif (arg STREQUAL "OVERVIEW") set(_state "overview") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () set(_javadoc_version ${arg}) endif () - elseif (${_state} STREQUAL "overview") - if (${arg} STREQUAL "PACKAGES") + elseif (_state STREQUAL "overview") + if (arg STREQUAL "PACKAGES") set(_state "packages") - elseif (${arg} STREQUAL "FILES") + elseif (arg STREQUAL "FILES") set(_state "files") - elseif (${arg} STREQUAL "SOURCEPATH") + elseif (arg STREQUAL "SOURCEPATH") set(_state "sourcepath") - elseif (${arg} STREQUAL "CLASSPATH") + elseif (arg STREQUAL "CLASSPATH") set(_state "classpath") - elseif (${arg} STREQUAL "INSTALLPATH") + elseif (arg STREQUAL "INSTALLPATH") set(_state "installpath") - elseif (${arg} STREQUAL "DOCTITLE") + elseif (arg STREQUAL "DOCTITLE") set(_state "doctitle") - elseif (${arg} STREQUAL "WINDOWTITLE") + elseif (arg STREQUAL "WINDOWTITLE") set(_state "windowtitle") - elseif (${arg} STREQUAL "AUTHOR") + elseif (arg STREQUAL "AUTHOR") set(_state "author") - elseif (${arg} STREQUAL "USE") + elseif (arg STREQUAL "USE") set(_state "use") - elseif (${arg} STREQUAL "VERSION") + elseif (arg STREQUAL "VERSION") set(_state "version") else () - list(APPEND _javadoc_overview ${arg}) + set(_javadoc_overview ${arg}) endif () endif () endforeach () @@ -1302,7 +1239,7 @@ function(create_javadoc _target) if (_javadoc_sourcepath) set(_start TRUE) - foreach(_path ${_javadoc_sourcepath}) + foreach(_path IN LISTS _javadoc_sourcepath) if (_start) set(_sourcepath ${_path}) set(_start FALSE) @@ -1315,7 +1252,7 @@ function(create_javadoc _target) if (_javadoc_overview) set(_start TRUE) - foreach(_path ${_javadoc_overview}) + foreach(_path IN LISTS _javadoc_overview) if (_start) set(_overview ${_path}) set(_start FALSE) @@ -1328,7 +1265,7 @@ function(create_javadoc _target) if (_javadoc_classpath) set(_start TRUE) - foreach(_path ${_javadoc_classpath}) + foreach(_path IN LISTS _javadoc_classpath) if (_start) set(_classpath ${_path}) set(_start FALSE) @@ -1495,7 +1432,7 @@ function(export_jars) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_export_jars_TARGETS}") set(__targetdefs__ "") - foreach(_target ${_export_jars_TARGETS}) + foreach(_target IN LISTS _export_jars_TARGETS) get_target_property(_jarpath ${_target} JAR_FILE) get_filename_component(_jarpath ${_jarpath} PATH) __java_export_jar(__targetdefs__ ${_target} "${_jarpath}") @@ -1533,7 +1470,7 @@ function(install_jar_exports) endif() # Determine relative path from installed export file to install prefix - if(IS_ABSOLUTE ${_install_jar_exports_DESTINATION}) + if(IS_ABSOLUTE "${_install_jar_exports_DESTINATION}") file(RELATIVE_PATH _relpath ${_install_jar_exports_DESTINATION} ${CMAKE_INSTALL_PREFIX} @@ -1552,7 +1489,7 @@ function(install_jar_exports) # Set content of generated exports file string(REPLACE ";" " " __targets__ "${_install_jar_exports_TARGETS}") set(__targetdefs__ "set(_prefix \${CMAKE_CURRENT_LIST_DIR}/${_relpath})\n\n") - foreach(_target ${_install_jar_exports_TARGETS}) + foreach(_target IN LISTS _install_jar_exports_TARGETS) get_target_property(_dir ${_target} INSTALL_DESTINATION) __java_export_jar(__targetdefs__ ${_target} "\${_prefix}/${_dir}") endforeach() diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake index 4420550..b98276f 100644 --- a/config/cmake/UseJavaClassFilelist.cmake +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -1,16 +1,17 @@ # Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. -#.rst: -# UseJavaClassFilelist -# -------------------- -# -# -# -# -# -# This script create a list of compiled Java class files to be added to -# a jar file. This avoids including cmake files which get created in -# the binary directory. +#[=======================================================================[.rst: +UseJavaClassFilelist +-------------------- + + + + + +This script create a list of compiled Java class files to be added to +a jar file. This avoids including cmake files which get created in +the binary directory. +#]=======================================================================] if (CMAKE_JAVA_CLASS_OUTPUT_PATH) if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake index cd73348..a4db5c1 100644 --- a/config/cmake/UseJavaSymlinks.cmake +++ b/config/cmake/UseJavaSymlinks.cmake @@ -1,14 +1,15 @@ # Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. -#.rst: -# UseJavaSymlinks -# --------------- -# -# -# -# -# -# Helper script for UseJava.cmake +#[=======================================================================[.rst: +UseJavaSymlinks +--------------- + + + + + +Helper script for UseJava.cmake +#]=======================================================================] if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) if (_JAVA_TARGET_OUTPUT_NAME) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 699be85..97a2336 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -9,136 +9,108 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # +######################################################################### + +# - Derived from the FindTiff.cmake and FindJPEG.cmake that is included with cmake +# FindSZIP -# - Find SZIP library -# - Derived from the FindTiff.cmake that is included with cmake # Find the native SZIP includes and library -# This module defines -# SZIP_INCLUDE_DIRS, where to find tiff.h, etc. -# SZIP_LIBRARIES, libraries to link against to use SZIP. -# SZIP_FOUND, If false, do not try to use SZIP. -# also defined, but not for general use are -# SZIP_LIBRARY, where to find the SZIP library. -# SZIP_LIBRARY_DEBUG - Debug version of SZIP library -# SZIP_LIBRARY_RELEASE - Release Version of SZIP library -# message (STATUS "Finding SZIP library and headers..." ) +# Imported targets +################## -############################################ +# This module defines the following :prop_tgt:`IMPORTED` targets: # -# Check the existence of the libraries. +# SZIP::SZIP +# The SZIP library, if found. # -############################################ -# This macro was taken directly from the FindQt4.cmake file that is included -# with the CMake distribution. This is NOT my work. All work was done by the -# original authors of the FindQt4.cmake file. Only minor modifications were -# made to remove references to Qt and make this file more generally applicable -######################################################################### +# Result variables +################### -macro (SZIP_ADJUST_LIB_VARS basename) - if (${basename}_INCLUDE_DIR) +This module will set the following variables in your project: - # if only the release version was found, set the debug variable also to the release version - if (${basename}_LIBRARY_RELEASE AND NOT ${basename}_LIBRARY_DEBUG) - set (${basename}_LIBRARY_DEBUG ${${basename}_LIBRARY_RELEASE}) - set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE}) - set (${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE}) - endif () +# SZIP_FOUND, true if the SZIP headers and libraries were found. +# SZIP_INCLUDE_DIR, the directory containing the SZIP headers. +# SZIP_INCLUDE_DIRS, the directory containing the SZIP headers. +# SZIP_LIBRARIES, libraries to link against to use SZIP. - # if only the debug version was found, set the release variable also to the debug version - if (${basename}_LIBRARY_DEBUG AND NOT ${basename}_LIBRARY_RELEASE) - set (${basename}_LIBRARY_RELEASE ${${basename}_LIBRARY_DEBUG}) - set (${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG}) - set (${basename}_LIBRARIES ${${basename}_LIBRARY_DEBUG}) - endif () - if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set (${basename}_LIBRARY optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - else () - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - set (${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) - endif () - set (${basename}_LIBRARIES optimized ${${basename}_LIBRARY_RELEASE} debug ${${basename}_LIBRARY_DEBUG}) - endif () +# Cache variables +################# - set (${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH "The ${basename} library") +# The following variables may also be set: - if (${basename}_LIBRARY) - set (${basename}_FOUND 1) - endif () - endif () +# SZIP_LIBRARY, where to find the SZIP library. +# SZIP_LIBRARY_DEBUG - Debug version of SZIP library +# SZIP_LIBRARY_RELEASE - Release Version of SZIP library - # Make variables changeble to the advanced user - MARK_AS_ADVANCED (${basename}_LIBRARY ${basename}_LIBRARY_RELEASE ${basename}_LIBRARY_DEBUG ${basename}_INCLUDE_DIR ) -endmacro () - - -# Look for the header file. -set (SZIP_INCLUDE_SEARCH_DIRS - $ENV{SZIP_INSTALL}/include - $ENV{SZIP_INSTALL}/include/szip - /usr/include - /usr/include/szip -) - -set (SZIP_LIB_SEARCH_DIRS - $ENV{SZIP_INSTALL}/lib - /usr/lib -) - -set (SZIP_BIN_SEARCH_DIRS - $ENV{SZIP_INSTALL}/bin - /usr/bin -) - -FIND_PATH (SZIP_INCLUDE_DIR - NAMES szlib.h - PATHS ${SZIP_INCLUDE_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -if (WIN32) - set (SZIP_SEARCH_DEBUG_NAMES "sz_d;libsz_d") - set (SZIP_SEARCH_RELEASE_NAMES "sz;libsz;libszip") -else () - set (SZIP_SEARCH_DEBUG_NAMES "sz_d") - set (SZIP_SEARCH_RELEASE_NAMES "sz;szip") -endif () +# message (STATUS "Finding SZIP library and headers..." ) +######################################################################### -# Look for the library. -FIND_LIBRARY (SZIP_LIBRARY_DEBUG - NAMES ${SZIP_SEARCH_DEBUG_NAMES} - PATHS ${SZIP_LIB_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -FIND_LIBRARY (SZIP_LIBRARY_RELEASE - NAMES ${SZIP_SEARCH_RELEASE_NAMES} - PATHS ${SZIP_LIB_SEARCH_DIRS} - NO_DEFAULT_PATH -) - -SZIP_ADJUST_LIB_VARS (SZIP) - -if (SZIP_INCLUDE_DIR AND SZIP_LIBRARY) - set (SZIP_FOUND 1) - set (SZIP_LIBRARIES ${SZIP_LIBRARY}) - set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR}) - if (SZIP_LIBRARY_DEBUG) - get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_DEBUG} PATH) - set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - elseif () - get_filename_component (SZIP_LIBRARY_PATH ${SZIP_LIBRARY_RELEASE} PATH) - set (SZIP_LIB_DIR ${SZIP_LIBRARY_PATH}) - endif () -else () - set (SZIP_FOUND 0) - set (SZIP_LIBRARIES) - set (SZIP_INCLUDE_DIRS) -endif () + +find_path(SZIP_INCLUDE_DIR szlib.h) + +set(szip_names ${SZIP_NAMES} sz szip szip-static libsz libszip libszip-static) +foreach(name ${szip_names}) + list(APPEND szip_names_debug "${name}d") +endforeach() + +if(NOT SZIP_LIBRARY) + find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) + find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(SZIP) + mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) +endif() +unset(szip_names) +unset(szip_names_debug) + +if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") + file(STRINGS "${SZIP_INCLUDE_DIR}/SZconfig.h" szip_version_str + REGEX "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+.*") + + string(REGEX REPLACE "^#define[\t ]+SZIP_PACKAGE_VERSION[\t ]+([0-9]+).*" + "\\1" SZIP_VERSION "${szip_version_str}") + unset(szip_version_str) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(SZIP + REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR + VERSION_VAR SZIP_VERSION) + +if(SZIP_FOUND) + set(SZIP_LIBRARIES ${SZIP_LIBRARY}) + set(SZIP_INCLUDE_DIRS "${SZIP_INCLUDE_DIR}") + + if(NOT TARGET SZIP::SZIP) + add_library(SZIP::SZIP UNKNOWN IMPORTED) + if(SZIP_INCLUDE_DIRS) + set_target_properties(SZIP::SZIP PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIRS}") + endif() + if(EXISTS "${SZIP_LIBRARY}") + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SZIP_LIBRARY}") + endif() + if(EXISTS "${SZIP_LIBRARY_RELEASE}") + set_property(TARGET SZIP::SZIP APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${SZIP_LIBRARY_RELEASE}") + endif() + if(EXISTS "${SZIP_LIBRARY_DEBUG}") + set_property(TARGET SZIP::SZIP APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(SZIP::SZIP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${SZIP_LIBRARY_DEBUG}") + endif() + endif() +endif() + +mark_as_advanced(SZIP_LIBRARY SZIP_INCLUDE_DIR) # Report the results. if (NOT SZIP_FOUND) @@ -153,29 +125,3 @@ if (NOT SZIP_FOUND) endif () endif () endif () - -if (SZIP_FOUND) - include (CheckSymbolExists) - ############################################# - # Find out if SZIP was build using dll's - ############################################# - # Save required variable - set (CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set (CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) - # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}") - - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set (CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) - # - ############################################# -endif () - -if (FIND_SZIP_DEBUG) - message (STATUS "SZIP_INCLUDE_DIR: ${SZIP_INCLUDE_DIR}") - message (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}") - message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}") - message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}") - message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") -endif () diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index de66e33..bed1fc1 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -13,7 +13,7 @@ # This file provides functions for Fortran support. # #------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) +enable_language (Fortran) set (HDF_PREFIX "H5") #------------------------------------------------------------------------------- diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 313ca8b..460f12e 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -1620,7 +1620,7 @@ done: /* * Class: hdf_hdf5lib_H5 - * Method: H5Tarray_get_dims2 + * Method: H5Tget_array_dims2 * Signature: (J[J)I */ JNIEXPORT jint JNICALL diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 4095bd9..b4c8111 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -25,10 +25,25 @@ add_test (NAME MPI_TEST-clear-testphdf5-objects ) set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5) +set (SKIP_tests + cchunk1 + cchunk2 + cchunk3 + cchunk4 + ecdsetw + eidsetw2 + selnone + cngrpw-ingrpr + cschunkw + ccchunkw + tldsc + actualio + MC_coll_MD_read +) set (SKIP_testphdf5 "") -#if (HDF5_OPENMPI_VERSION_SKIP) -# set (SKIP_testphdf5 "${SKIP_testphdf5};-x;ecdsetw") -#endif () +foreach (skiptest ${SKIP_tests}) + set (SKIP_testphdf5 "${SKIP_testphdf5};-x;${skiptest}") +endforeach () add_test (NAME MPI_TEST_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} ${SKIP_testphdf5}) set_tests_properties (MPI_TEST_testphdf5 PROPERTIES @@ -41,6 +56,20 @@ if (last_test) endif () set (last_test "MPI_TEST_testphdf5") +#execute the skipped tests +foreach (skiptest ${SKIP_tests}) + add_test (NAME MPI_TEST_testphdf5_${skiptest} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS} -o ${skiptest}) + set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES + FIXTURES_REQUIRED par_clear_testphdf5 + ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} + ) + if (last_test) + set_tests_properties (MPI_TEST_testphdf5_${skiptest} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "MPI_TEST_testphdf5_${skiptest}") +endforeach () + #if (HDF5_OPENMPI_VERSION_SKIP) # list (REMOVE_ITEM H5P_TESTS t_shapesame) #endif () @@ -89,7 +118,7 @@ endforeach () # The t_pflush1 test is hard-coded to fail. set_tests_properties (MPI_TEST_t_pflush1 PROPERTIES WILL_FAIL "true") -#set_property (MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") +#set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED") set_tests_properties (MPI_TEST_t_pflush2 PROPERTIES DEPENDS MPI_TEST_t_pflush1) set_tests_properties (MPI_TEST_t_prestart PROPERTIES DEPENDS MPI_TEST_t_pshutdown) -- cgit v0.12 From 7ee92d580510a7d90db7f3be8d2061c9c8f09a1b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Jun 2019 06:55:05 -0500 Subject: HDFFV-10805 Merge SHARED ONLY option from develop --- CMakeLists.txt | 17 +- MANIFEST | 2 - c++/examples/CMakeLists.txt | 22 +- c++/src/CMakeLists.txt | 40 +- c++/test/CMakeLists.txt | 15 +- config/cmake/FindHDFJAVA.cmake.in | 79 ---- config/cmake/FindJNI.cmake | 347 ---------------- config/cmake/hdf5-config.cmake.in | 9 +- config/cmake/jrunTest.cmake | 2 +- config/cmake/libhdf5.settings.cmake.in | 10 +- config/cmake/scripts/HDF5options.cmake | 16 +- config/cmake/scripts/HPC/bsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/qsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/raybsub-HDF5options.cmake | 15 +- config/cmake/scripts/HPC/sbatch-HDF5options.cmake | 15 +- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/FindSZIP.cmake | 2 +- config/cmake_ext_mod/HDFMacros.cmake | 13 +- examples/CMakeLists.txt | 36 +- examples/CMakeTests.cmake | 173 ++------ fortran/examples/CMakeLists.txt | 145 +++---- fortran/examples/CMakeTests.cmake | 90 +---- fortran/src/CMakeLists.txt | 298 ++++++++------ fortran/test/CMakeLists.txt | 449 ++++++++------------- fortran/test/CMakeTests.cmake | 184 ++------- hl/c++/examples/CMakeLists.txt | 23 +- hl/c++/src/CMakeLists.txt | 34 +- hl/c++/test/CMakeLists.txt | 29 +- hl/examples/CMakeLists.txt | 11 +- hl/fortran/examples/CMakeLists.txt | 42 +- hl/fortran/src/CMakeLists.txt | 204 +++++----- hl/fortran/test/CMakeLists.txt | 47 +-- hl/fortran/test/CMakeTests.cmake | 60 +-- hl/src/CMakeLists.txt | 34 +- hl/test/CMakeLists.txt | 68 ++-- hl/tools/gif2h5/CMakeLists.txt | 65 ++- hl/tools/gif2h5/CMakeTests.cmake | 16 +- hl/tools/h5watch/CMakeLists.txt | 56 ++- hl/tools/h5watch/CMakeTests.cmake | 15 +- .../hdf5lib/exceptions/HDF5LibraryException.java | 2 +- java/src/jni/CMakeLists.txt | 2 +- release_docs/RELEASE.txt | 18 + src/CMakeLists.txt | 81 ++-- test/CMakeLists.txt | 214 +++++----- test/CMakeTests.cmake | 385 +++--------------- test/CMakeVFDTests.cmake | 200 +-------- testpar/CMakeLists.txt | 34 +- testpar/CMakeTests.cmake | 3 +- testpar/CMakeVFDTests.cmake | 4 +- tools/lib/CMakeLists.txt | 38 +- tools/src/h5copy/CMakeLists.txt | 18 +- tools/src/h5diff/CMakeLists.txt | 70 ++-- tools/src/h5dump/CMakeLists.txt | 26 +- tools/src/h5format_convert/CMakeLists.txt | 26 +- tools/src/h5import/CMakeLists.txt | 30 +- tools/src/h5jam/CMakeLists.txt | 59 ++- tools/src/h5ls/CMakeLists.txt | 18 +- tools/src/h5repack/CMakeLists.txt | 20 +- tools/src/h5stat/CMakeLists.txt | 18 +- tools/src/misc/CMakeLists.txt | 98 +++-- tools/test/h5copy/CMakeLists.txt | 26 +- tools/test/h5copy/CMakeTests.cmake | 32 +- tools/test/h5diff/CMakeLists.txt | 26 +- tools/test/h5diff/CMakeTests.cmake | 10 +- tools/test/h5dump/CMakeLists.txt | 28 +- tools/test/h5dump/CMakeTests.cmake | 92 +++-- tools/test/h5dump/CMakeTestsPBITS.cmake | 10 +- tools/test/h5dump/CMakeTestsVDS.cmake | 18 +- tools/test/h5dump/CMakeTestsXML.cmake | 10 +- tools/test/h5format_convert/CMakeLists.txt | 17 +- tools/test/h5format_convert/CMakeTests.cmake | 31 +- tools/test/h5import/CMakeLists.txt | 11 +- tools/test/h5import/CMakeTests.cmake | 29 +- tools/test/h5jam/CMakeLists.txt | 26 +- tools/test/h5jam/CMakeTests.cmake | 28 +- tools/test/h5ls/CMakeLists.txt | 22 +- tools/test/h5ls/CMakeTests.cmake | 14 +- tools/test/h5ls/CMakeTestsVDS.cmake | 14 +- tools/test/h5repack/CMakeLists.txt | 66 +-- tools/test/h5repack/CMakeTests.cmake | 70 ++-- tools/test/h5stat/CMakeLists.txt | 4 +- tools/test/h5stat/CMakeTests.cmake | 14 +- tools/test/misc/CMakeLists.txt | 46 ++- tools/test/misc/CMakeTestsClear.cmake | 26 +- tools/test/misc/CMakeTestsMkgrp.cmake | 12 +- tools/test/misc/CMakeTestsRepart.cmake | 14 +- tools/test/misc/vds/CMakeLists.txt | 11 +- tools/test/perform/CMakeLists.txt | 101 +++-- tools/test/perform/pio_engine.c | 6 + tools/test/perform/sio_engine.c | 6 + 90 files changed, 2072 insertions(+), 2827 deletions(-) delete mode 100644 config/cmake/FindHDFJAVA.cmake.in delete mode 100644 config/cmake/FindJNI.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a70ec4c..3461632 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,18 +416,23 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) # Mac OS X Options #----------------------------------------------------------------------------- if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) - set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) endif () #----------------------------------------------------------------------------- # Option to Build Shared and Static libs, default is both #----------------------------------------------------------------------------- +option (ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF) +set (H5_ENABLE_STATIC_LIB YES) +if (ONLY_SHARED_LIBS) + set (H5_ENABLE_STATIC_LIB NO) + set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") +endif () option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H5_ENABLE_SHARED_LIB NO) if (BUILD_SHARED_LIBS) set (H5_ENABLE_SHARED_LIB YES) endif () -set (H5_ENABLE_STATIC_LIB YES) set (CMAKE_POSITION_INDEPENDENT_CODE ON) #----------------------------------------------------------------------------- @@ -725,13 +730,17 @@ add_subdirectory (src) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - add_dependencies (${HDF5_LIB_TARGET} ZLIB) + if (NOT ONLY_SHARED_LIBS) + add_dependencies (${HDF5_LIB_TARGET} ZLIB) + endif () if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} ZLIB) endif () endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) - add_dependencies (${HDF5_LIB_TARGET} SZIP) + if (NOT ONLY_SHARED_LIBS) + add_dependencies (${HDF5_LIB_TARGET} SZIP) + endif () if (BUILD_SHARED_LIBS) add_dependencies (${HDF5_LIBSH_TARGET} SZIP) endif () diff --git a/MANIFEST b/MANIFEST index 5dd7659..7a59414 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3206,8 +3206,6 @@ ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake -./config/cmake/FindHDFJAVA.cmake.in -./config/cmake/FindJNI.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index d3a18f2..2088019 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,17 +34,27 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 945b352..8e7f8be 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -84,24 +84,26 @@ set (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h ) -add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) -target_include_directories(${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -target_compile_definitions(${HDF5_CPP_LIB_TARGET} - PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings -) -TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) -set (install_targets ${HDF5_CPP_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) + target_include_directories (${HDF5_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_CPP_LIB_TARGET} + PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings + ) + TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) + set (install_targets ${HDF5_CPP_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) - target_include_directories(${HDF5_CPP_LIBSH_TARGET} + target_include_directories (${HDF5_CPP_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -136,7 +138,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) endif () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + endif () install ( TARGETS @@ -163,7 +167,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_CPP_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_CPP_LIB_CORENAME}") endif () diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 8e2d685..95ca9b1 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -38,16 +38,17 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) -target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(cpp_testhdf5 PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) -TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) -target_link_libraries (cpp_testhdf5 PRIVATE - ${HDF5_CPP_LIB_TARGET} - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} -) +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) + target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (cpp_testhdf5 SHARED) + target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) include (CMakeTests.cmake) diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in deleted file mode 100644 index ed2b8c2..0000000 --- a/config/cmake/FindHDFJAVA.cmake.in +++ /dev/null @@ -1,79 +0,0 @@ -# -# 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. -# -# -# To be used by projects that make use of CMakeified hdf-java -# - -# -# Find the HDFJAVA includes and get all installed hdf-java library settings from -# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later -# for this feature to work. The following vars are set if hdf-java is found. -# -# HDFJAVA_FOUND - True if found, otherwise all other vars are undefined -# HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) -# HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) -# HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) -# -# Target names that are valid (depending on enabled options) -# will be the following -# -# -# To aid in finding HDFJAVA as part of a subproject set -# HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies - -INCLUDE (SelectLibraryConfigurations) -INCLUDE (FindPackageHandleStandardArgs) - -# The HINTS option should only be used for values computed from the system. -set (_HDFJAVA_HINTS - $ENV{HOME}/.local - $ENV{HDFJAVA_ROOT} - $ENV{HDFJAVA_ROOT_DIR_HINT} -) -# Hard-coded guesses should still go in PATHS. This ensures that the user -# environment can always override hard guesses. -set (_HDFJAVA_PATHS - $ENV{HOME}/.local - $ENV{HDFJAVA_ROOT} - $ENV{HDFJAVA_ROOT_DIR_HINT} - /usr/lib/@HDFJAVA_PACKAGE@ - /usr/share/@HDFJAVA_PACKAGE@ - /usr/local/@HDFJAVA_PACKAGE@ - /usr/local/@HDFJAVA_PACKAGE@/share -) - -FIND_PATH (HDFJAVA_ROOT_DIR "@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" - HINTS ${_HDFJAVA_HINTS} - PATHS ${_HDFJAVA_PATHS} - PATH_SUFFIXES - cmake/@HDFJAVA_PACKAGE@ - lib/cmake/@HDFJAVA_PACKAGE@ - share/cmake/@HDFJAVA_PACKAGE@ -) - -FIND_PATH (HDFJAVA_LIBRARY "jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar" - HINTS ${_HDFJAVA_HINTS} - PATHS ${_HDFJAVA_PATHS} - PATH_SUFFIXES - lib -) - -if (HDFJAVA_ROOT_DIR) - set (HDFJAVA_FOUND "YES") - INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) - set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") - set (HDFJAVA_INCLUDE_DIRS - ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar - ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar - ) - -endif () diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake deleted file mode 100644 index 1e6daf6..0000000 --- a/config/cmake/FindJNI.cmake +++ /dev/null @@ -1,347 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See https://cmake.org/licensing for details. - -#.rst: -# FindJNI -# ------- -# -# Find JNI java libraries. -# -# This module finds if Java is installed and determines where the -# include files and libraries are. It also determines what the name of -# the library is. The caller may set variable JAVA_HOME to specify a -# Java installation prefix explicitly. -# -# This module sets the following result variables: -# -# :: -# -# JNI_INCLUDE_DIRS = the include dirs to use -# JNI_LIBRARIES = the libraries to use -# JNI_FOUND = TRUE if JNI headers and libraries were found. -# JAVA_AWT_LIBRARY = the path to the jawt library -# JAVA_JVM_LIBRARY = the path to the jvm library -# JAVA_INCLUDE_PATH = the include path to jni.h -# JAVA_INCLUDE_PATH2 = the include path to jni_md.h -# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h - -# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} -macro(java_append_library_directories _var) - # Determine java arch-specific library subdir - # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk - # 1.6.0_18 + icedtea patches. However, it would be much better to base the - # guess on the first part of the GNU config.guess platform triplet. - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32") - set(_java_libarch "x32" "amd64" "i386") - else() - set(_java_libarch "amd64" "i386") - endif() - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") - set(_java_libarch "i386") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") - set(_java_libarch "alpha") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - # Subdir is "arm" for both big-endian (arm) and little-endian (armel). - set(_java_libarch "arm" "aarch32") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") - # mips* machines are bi-endian mostly so processor does not tell - # endianess of the underlying system. - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") - set(_java_libarch "ppc64" "ppc64le") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") - set(_java_libarch "ppc64" "ppc") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") - set(_java_libarch "ppc" "ppc64") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") - # Both flavours can run on the same processor - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") - set(_java_libarch "parisc" "parisc64") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") - # s390 binaries can run on s390x machines - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") - elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") - set(_java_libarch "sh") - else() - set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") - endif() - - # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or - # system is non-Linux (where the code above has not been well tested) - if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) - list(APPEND _java_libarch "i386" "amd64" "ppc") - endif() - - # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer - # current value to a hardcoded list. Remove possible duplicates. - list(REMOVE_DUPLICATES _java_libarch) - - foreach(_path ${ARGN}) - if(_path MATCHES "{libarch}") - foreach(_libarch ${_java_libarch}) - string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") - if(EXISTS ${_newpath}) - list(APPEND ${_var} "${_newpath}") - endif() - endforeach() - else() - if(EXISTS ${_path}) - list(APPEND ${_var} "${_path}") - endif() - endif() - endforeach() -endmacro() - -#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake) -INCLUDE (CMakeFindJavaCommon) - -# Save CMAKE_FIND_FRAMEWORK -if(DEFINED CMAKE_FIND_FRAMEWORK) - set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) -else() - unset(_JNI_CMAKE_FIND_FRAMEWORK) -endif() - -if(_JAVA_HOME_EXPLICIT) - set(CMAKE_FIND_FRAMEWORK NEVER) -endif() - -set(JAVA_AWT_LIBRARY_DIRECTORIES) -if(_JAVA_HOME) - JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - ${_JAVA_HOME}/jre/lib/{libarch} - ${_JAVA_HOME}/jre/lib - ${_JAVA_HOME}/lib/{libarch} - ${_JAVA_HOME}/lib - ${_JAVA_HOME} - ) -endif() -get_filename_component(java_install_version - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) - -list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" - ) -JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES - /usr/java/lib - /usr/java/jre/lib - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /usr/lib/jvm/java/lib - /usr/lib64/jvm/java/lib - /usr/lib/java/jre/lib/{libarch} - /usr/lib64/java/jre/lib/{libarch} - /usr/lib/jvm/jre/lib/{libarch} - /usr/local/lib/java/jre/lib/{libarch} - /usr/local/share/java/jre/lib/{libarch} - /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} - /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} - /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun/jre/lib/{libarch} - /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} - /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} - /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora - # Debian specific paths for default JVM - /usr/lib/jvm/default-java/jre/lib/{libarch} - /usr/lib/jvm/default-java/jre/lib - /usr/lib/jvm/default-java/lib - # Arch Linux specific paths for default JVM - /usr/lib/jvm/default/jre/lib/{libarch} - /usr/lib/jvm/default/lib/{libarch} - # Ubuntu specific paths for default JVM - /usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - /usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10 - # OpenBSD specific paths for default JVM - /usr/local/jdk-1.7.0/jre/lib/{libarch} - /usr/local/jre-1.7.0/lib/{libarch} - /usr/local/jdk-1.6.0/jre/lib/{libarch} - /usr/local/jre-1.6.0/lib/{libarch} - # SuSE specific paths for default JVM - /usr/lib64/jvm/java/jre/lib/{libarch} - /usr/lib64/jvm/jre/lib/{libarch} - ) - -set(JAVA_JVM_LIBRARY_DIRECTORIES) -foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) - list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES - "${dir}" - "${dir}/client" - "${dir}/server" - # IBM SDK, Java Technology Edition, specific paths - "${dir}/j9vm" - "${dir}/default" - ) -endforeach() - -set(JAVA_AWT_INCLUDE_DIRECTORIES) -if(_JAVA_HOME) - list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include) -endif() -list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" -) - -JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES - ${_JAVA_HOME}/include - /usr/include - /usr/java/include - /usr/local/include - /usr/lib/java/include - /usr/lib64/java/include - /usr/local/lib/java/include - /usr/lib/jvm/java/include - /usr/lib/jvm/java-6-sun/include - /usr/lib/jvm/java-1.5.0-sun/include - /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex - /usr/lib/jvm/java-6-openjdk/include - /usr/lib/jvm/java-7-openjdk/include - /usr/lib64/jvm/java-7-openjdk/include - /usr/lib64/jvm/java-7-openjdk-amd64/include - /usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10 - /usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10 - /usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10 - /usr/local/share/java/include - /usr/lib/j2sdk1.4-sun/include - /usr/lib/j2sdk1.5-sun/include - /opt/sun-jdk-1.5.0.04/include - # Debian specific path for default JVM - /usr/lib/jvm/default-java/include - # Arch specific path for default JVM - /usr/lib/jvm/default/include - # OpenBSD specific path for default JVM - /usr/local/jdk-1.7.0/include - /usr/local/jdk-1.6.0/include - # SuSE specific paths for default JVM - /usr/lib64/jvm/java/include - ) - -foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") - get_filename_component(jpath "${JAVA_PROG}" PATH) - foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include) - if(EXISTS ${jpath}/${JAVA_INC_PATH}) - list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}") - endif() - endforeach() - foreach(JAVA_LIB_PATH - ../lib ../jre/lib ../jre/lib/i386 - ../java/lib ../java/jre/lib ../java/jre/lib/i386 - ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) - if(EXISTS ${jpath}/${JAVA_LIB_PATH}) - list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}") - endif() - endforeach() -endforeach() - -if(APPLE) - if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY") - set(_JNI_SEARCHES FRAMEWORK) - elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER") - set(_JNI_SEARCHES NORMAL) - elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST") - set(_JNI_SEARCHES NORMAL FRAMEWORK) - else() - set(_JNI_SEARCHES FRAMEWORK NORMAL) - endif() - set(_JNI_FRAMEWORK_JVM NAMES JavaVM) - set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}") -else() - set(_JNI_SEARCHES NORMAL) -endif() - -set(_JNI_NORMAL_JVM - NAMES jvm - PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} - ) - -set(_JNI_NORMAL_JAWT - NAMES jawt - PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} - ) - -foreach(search ${_JNI_SEARCHES}) - find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM}) - find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT}) - if(JAVA_JVM_LIBRARY) - break() - endif() -endforeach() -unset(_JNI_SEARCHES) -unset(_JNI_FRAMEWORK_JVM) -unset(_JNI_FRAMEWORK_JAWT) -unset(_JNI_NORMAL_JVM) -unset(_JNI_NORMAL_JAWT) - -# Find headers matching the library. -if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);") - set(CMAKE_FIND_FRAMEWORK ONLY) -else() - set(CMAKE_FIND_FRAMEWORK NEVER) -endif() - -# add in the include path -find_path(JAVA_INCLUDE_PATH jni.h - ${JAVA_AWT_INCLUDE_DIRECTORIES} -) - -find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h - PATHS - ${JAVA_INCLUDE_PATH} - ${JAVA_INCLUDE_PATH}/darwin - ${JAVA_INCLUDE_PATH}/win32 - ${JAVA_INCLUDE_PATH}/linux - ${JAVA_INCLUDE_PATH}/freebsd - ${JAVA_INCLUDE_PATH}/openbsd - ${JAVA_INCLUDE_PATH}/solaris - ${JAVA_INCLUDE_PATH}/hp-ux - ${JAVA_INCLUDE_PATH}/alpha - ${JAVA_INCLUDE_PATH}/aix -) - -find_path(JAVA_AWT_INCLUDE_PATH jawt.h - ${JAVA_INCLUDE_PATH} -) - -# Restore CMAKE_FIND_FRAMEWORK -if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK) - set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK}) - unset(_JNI_CMAKE_FIND_FRAMEWORK) -else() - unset(CMAKE_FIND_FRAMEWORK) -endif() - -#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -INCLUDE (FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY - JAVA_JVM_LIBRARY - JAVA_INCLUDE_PATH - JAVA_INCLUDE_PATH2 - JAVA_AWT_INCLUDE_PATH) - -mark_as_advanced( - JAVA_AWT_LIBRARY - JAVA_JVM_LIBRARY - JAVA_AWT_INCLUDE_PATH - JAVA_INCLUDE_PATH - JAVA_INCLUDE_PATH2 -) - -set(JNI_LIBRARIES - ${JAVA_AWT_LIBRARY} - ${JAVA_JVM_LIBRARY} -) - -set(JNI_INCLUDE_DIRS - ${JAVA_INCLUDE_PATH} - ${JAVA_INCLUDE_PATH2} - ${JAVA_AWT_INCLUDE_PATH} -) - diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index d0f1d00..1803117 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -42,7 +42,8 @@ set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE @HDF5_ENABLE_THREADSAFE@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @H5_ENABLE_SHARED_LIB@) +set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS @H5_ENABLE_STATIC_LIB@) set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@) set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") @@ -119,9 +120,15 @@ endif () # Handle default component(static) : if (NOT ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) + if (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS) set (${HDF5_PACKAGE_NAME}_LIB_TYPE) set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL static) set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_static_C true) + else () + set (${HDF5_PACKAGE_NAME}_LIB_TYPE) + set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL shared) + set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_shared_C true) + endif () endif () # Handle requested components: diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index fc49275..44ac15b 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -9,7 +9,7 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# runTest.cmake executes a command and captures the output in a file. File is then compared +# jrunTest.cmake executes a command and captures the output in a file. File is then compared # against a reference file. Exit status of command can also be compared. cmake_policy(SET CMP0007 NEW) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 9a534df..9e91ac0 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -32,7 +32,7 @@ Linking Options: Languages: ---------- - C: yes + C: YES C Compiler: @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_VERSION@ CPPFLAGS: @CPPFLAGS@ H5_CPPFLAGS: @H5_CPPFLAGS@ @@ -41,7 +41,7 @@ Languages: H5_CFLAGS: @H5_CFLAGS@ AM_CFLAGS: @AM_CFLAGS@ Shared C Library: @H5_ENABLE_SHARED_LIB@ - Static C Library: YES + Static C Library: @H5_ENABLE_STATIC_LIB@ Fortran: @HDF5_BUILD_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ @@ -49,7 +49,7 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@ C++: @HDF5_BUILD_CPP_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ @@ -57,10 +57,10 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES +@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@ JAVA: @HDF5_BUILD_JAVA@ -@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ Features: --------- diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake index 24eaf78..94aafac 100755 --- a/config/cmake/scripts/HDF5options.cmake +++ b/config/cmake/scripts/HDF5options.cmake @@ -27,7 +27,9 @@ ############################################################################################# #### Only build static libraries #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") -#### Add PICC option on linux/mac #### +#### Only build shared libraries #### +#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DONLY_SHARED_LIBS:BOOL=OFF") +#### Add PIC option on linux/mac #### #set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") ############################################################################################# @@ -69,12 +71,12 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRIN ############################################################################################# ### enable parallel builds - -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") -#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") - +if (DEFINED MPI) + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") + set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") +endif() ############################################################################################# ### enable thread-safety builds diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake index 83c17aa..7473e8a 100644 --- a/config/cmake/scripts/HPC/bsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "bsub") diff --git a/config/cmake/scripts/HPC/qsub-HDF5options.cmake b/config/cmake/scripts/HPC/qsub-HDF5options.cmake index 51c3891..34eba1b 100644 --- a/config/cmake/scripts/HPC/qsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/qsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_NAME "ctest.qsub") diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake index 4aad887..fa1ec4a 100644 --- a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake +++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands set (LOCAL_BATCH_SCRIPT_COMMAND "raybsub") diff --git a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake index f70526e..3205a1c 100644 --- a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake +++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake @@ -13,19 +13,10 @@ #### Change default configuration of options in config/cmake/cacheinit.cmake file ### #### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ### ############################################################################################# - -### uncomment/comment and change the following lines for other configuration options - -############################################################################################# -### enable parallel builds if (DEFINED MPI) - # maximum parallel processor count for build and test #### - set (MAX_PROC_COUNT 8) - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") - set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF") -endif () + # maximum parallel processor count for build and test #### + set (MAX_PROC_COUNT 8) +endif() ############################################################################################# ### options to run test scripts in batch commands if (DEFINED KNL) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index bbd5170..63d9ee9 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -28,7 +28,7 @@ if (APPLE) list (LENGTH CMAKE_OSX_ARCHITECTURES ARCH_LENGTH) if (ARCH_LENGTH GREATER 1) set (CMAKE_OSX_ARCHITECTURES "" CACHE STRING "" FORCE) - message(FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" + message (FATAL_ERROR "Building Universal Binaries on OS X is NOT supported by the HDF5 project. This is" "due to technical reasons. The best approach would be build each architecture in separate directories" "and use the 'lipo' tool to combine them into a single executable or library. The 'CMAKE_OSX_ARCHITECTURES'" "variable has been set to a blank value which will build the default architecture for this system.") diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 97a2336..152f8ac 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -27,7 +27,7 @@ # Result variables ################### -This module will set the following variables in your project: +# This module will set the following variables in your project: # SZIP_FOUND, true if the SZIP headers and libraries were found. # SZIP_INCLUDE_DIR, the directory containing the SZIP headers. diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 2f4ce52..9da5006 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -28,7 +28,7 @@ macro (SET_HDF_BUILD_TYPE) endif() endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + message (STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" @@ -224,10 +224,9 @@ macro (TARGET_C_PROPERTIES wintarget libtype) $<$:${WIN_COMPILE_FLAGS}> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries(${wintarget} INTERFACE - $<$:${WIN_LINK_FLAGS}> - $<$:${WIN_LINK_FLAGS}> - ) + if(MSVC) + set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") + endif() endmacro () #----------------------------------------------------------------------------- @@ -294,7 +293,9 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") endif () - if (BUILD_SHARED_LIBS) + if (ONLY_SHARED_LIBS) + set (LIB_TYPE "Shared") + elseif (BUILD_SHARED_LIBS) set (LIB_TYPE "Static and Shared") else () set (LIB_TYPE "Static") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2239d64..6e1f79d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -41,32 +41,28 @@ set (examples foreach (example ${examples}) add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${example} STATIC) - target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) - set_target_properties (${example} PROPERTIES FOLDER examples) - if (BUILD_SHARED_LIBS) - add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(${example}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${example}-shared SHARED) - target_link_libraries (${example}-shared PRIVATE ${HDF5_LIBSH_TARGET}) - set_target_properties (${example}-shared PROPERTIES FOLDER examples) + target_include_directories (${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${example} STATIC) + target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${example} SHARED) + target_link_libraries (${example} PRIVATE ${HDF5_LIBSH_TARGET}) endif () + set_target_properties (${example} PROPERTIES FOLDER examples) endforeach () if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - target_include_directories(ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5example STATIC) - target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) - set_target_properties (ph5example PROPERTIES FOLDER examples) - if (BUILD_SHARED_LIBS) - add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - target_include_directories(ph5example-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5example-shared SHARED) - target_link_libraries (ph5example-shared PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) - set_target_properties (ph5example-shared PROPERTIES FOLDER examples) + target_include_directories (ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ph5example STATIC) + target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) + else () + TARGET_C_PROPERTIES (ph5example SHARED) + target_link_libraries (ph5example PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) endif () + set_target_properties (ph5example PROPERTIES FOLDER examples) endif () if (BUILD_TESTING) diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 1058566..6cab7dd 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -16,93 +16,8 @@ ############################################################################## ############################################################################## file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5EX-shared") - file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared/red ${PROJECT_BINARY_DIR}/H5EX-shared/blue ${PROJECT_BINARY_DIR}/H5EX-shared/u2w) - endif () - - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - Attributes.h5 - btrees_file.h5 - cmprss.h5 - default_file.h5 - dset.h5 - extend.h5 - extlink_prefix_source.h5 - extlink_source.h5 - extlink_target.h5 - group.h5 - groups.h5 - hard_link.h5 - mount1.h5 - mount2.h5 - one_index_file.h5 - only_dspaces_and_attrs_file.h5 - only_huge_mesgs_file.h5 - REF_REG.h5 - refere.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - separate_indexes_file.h5 - small_lists_file.h5 - soft_link.h5 - subset.h5 - unix2win.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - vds.h5 - vds-exc.h5 - vds-excalibur.h5 - vds-exclim.h5 - vds-percival.h5 - vds-percival-unlim.h5 - vds-percival-unlim-maxmin.h5 - a.h5 - b.h5 - c.h5 - d.h5 - vds-simpleIO.h5 - vds-eiger.h5 - ) - if (last_test) - set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND $) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") - endforeach () - if (BUILD_SHARED_LIBS) - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (test_CLEANFILES Attributes.h5 btrees_file.h5 cmprss.h5 @@ -131,6 +46,9 @@ soft_link.h5 subset.h5 unix2win.h5 + blue/prefix_target.h5 + red/prefix_target.h5 + u2w/u2w_target.h5 vds.h5 vds-exc.h5 vds-excalibur.h5 @@ -144,39 +62,39 @@ d.h5 vds-simpleIO.h5 vds-eiger.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - WORKING_DIRECTORY - ${PROJECT_BINARY_DIR}/H5EX-shared - ) - if (last_test) - set_tests_properties (EXAMPLES-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-shared-clear-objects") + ) - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-shared-${example} COMMAND $) - else () - add_test (NAME EXAMPLES-shared-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (EXAMPLES-shared-${example} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (last_test) - set_tests_properties (EXAMPLES-shared-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-shared-${example}") - endforeach () + # Remove any output file left over from previous test run + add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_CLEANFILES} + ) + if (last_test) + set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "EXAMPLES-clear-objects") + + foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND $) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + if (last_test) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "EXAMPLES-${example}") + endforeach () ### Windows pops up a modal permission dialog on this test if (H5_HAVE_PARALLEL AND NOT WIN32) @@ -198,25 +116,4 @@ set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) endif () set (last_test "MPI_TEST_EXAMPLES-ph5example") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - else () - add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=ph5example-shared.out" - -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" - -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - endif () - set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared) - if (last_test) - set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "MPI_TEST_EXAMPLES-shared-ph5example") - endif () endif () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 0c570c6..e8dddd3 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,56 +35,43 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) # set_property(TARGET f90_ex_${example} APPEND PROPERTY -# LINK_FLAGS $<$:> +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f90_ex_${example}-shared + if (NOT BUILD_SHARED_LIBS) + target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f90_ex_${example}-shared + target_link_libraries (f90_ex_${example} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (f90_ex_${example}-shared + else () + target_include_directories (f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_${example}-shared PROPERTIES + set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -94,18 +81,10 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - ) target_compile_options(f03_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f03_ex_${example} - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET f03_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -115,35 +94,30 @@ foreach (example ${F2003_examples}) if(MSVC) set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f03_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran03 - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (f03_ex_${example}-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(f03_ex_${example}-shared + target_link_libraries (f03_ex_${example} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_link_libraries (f03_ex_${example}-shared + set_target_properties (f03_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran03 + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f03_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f03_ex_${example}-shared PROPERTIES + set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared @@ -153,19 +127,10 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - ) target_compile_options(f90_ex_ph5example PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (f90_ex_ph5example - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - $<$:${MPI_Fortran_LIBRARIES}> - ) # set_property(TARGET f90_ex_ph5example APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -175,36 +140,32 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) if(MSVC) set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (f90_ex_ph5example PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - target_include_directories (f90_ex_ph5example-shared + if (NOT ONLY_SHARED_LIBS) + target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_compile_options(f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:${MPI_Fortran_LIBRARIES}> + ) + set_target_properties (f90_ex_ph5example PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (f90_ex_ph5example + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" ) - target_link_libraries (f90_ex_ph5example-shared + target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:${MPI_Fortran_LIBRARIES}> ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f90_ex_ph5example-shared PROPERTIES + set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index efbb209..1ad606c 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,36 +16,7 @@ ############################################################################## ############################################################################## - # Remove any output file left over from previous test run - add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 - ) - if (last_test) - set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-clear-objects") - if (BUILD_SHARED_LIBS) - add_test ( - NAME f90_ex-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + set (test_CLEANFILES compound.h5 copy1.h5 copy2.h5 @@ -61,12 +32,18 @@ subset.h5 SDScompound.h5 test.h5 - ) - if (last_test) - set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared-clear-objects") + ) + + # Remove any output file left over from previous test run + add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_CLEANFILES} + ) + if (last_test) + set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "f90_ex-clear-objects") foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -87,26 +64,6 @@ foreach (example ${examples}) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f90_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex-shared_${example} COMMAND $) - else () - add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f90_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f90_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-shared_${example}") - endif () endforeach () foreach (example ${F2003_examples}) @@ -128,31 +85,8 @@ foreach (example ${F2003_examples}) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "f03_ex_${example}") - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex-shared_${example} COMMAND $) - else () - add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=f03_ex_${example}-shared.txt" - #-D "TEST_REFERENCE=f03_ex_${example}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f03_ex-shared_${example}") - endif () endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - if (BUILD_SHARED_LIBS) - add_test (NAME MPI_TEST_f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f71e820..f80eaa9 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -40,7 +40,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) #----------------------------------------------------------------------------- add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) -target_include_directories(H5_buildiface +target_include_directories (H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" ) @@ -69,24 +69,28 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +if (NOT ONLY_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +endif () #----------------------------------------------------------------------------- add_executable (H5match_types ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c ) -target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS H5match_types -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS H5match_types + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h @@ -131,24 +135,26 @@ set (f90CStub_C_SHHDRS ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ) -add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) -target_include_directories(${HDF5_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE C -) -set (install_targets ${HDF5_F90_C_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) + target_include_directories (${HDF5_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE C + ) + set (install_targets ${HDF5_F90_C_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) - target_include_directories(${HDF5_F90_C_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -174,17 +180,19 @@ set (f90_F_GEN_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static - DEPENDS ${f90_F_GEN_SOURCES} - COMMENT "Generating the H5_gen.F90 file" -) -add_custom_target (H5gen ALL - DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 -) -set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static + DEPENDS ${f90_F_GEN_SOURCES} + COMMENT "Generating the H5_gen.F90 file" + ) + add_custom_target (H5gen ALL + DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + ) + set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( @@ -220,18 +228,20 @@ set (f90_F_BASE_SOURCES ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90 ) -set (f90_F_SOURCES - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 +if (NOT ONLY_SHARED_LIBS) + set (f90_F_SOURCES + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - ${f90_F_BASE_SOURCES} + ${f90_F_BASE_SOURCES} - # generated file - ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 + # generated file + ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - # normal distribution - ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 -) + # normal distribution + ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90 + ) +endif () if (BUILD_SHARED_LIBS) set (f90_F_SOURCES_SHARED # generated file @@ -250,43 +260,45 @@ endif () #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) -target_include_directories (${HDF5_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_F90_LIB_TARGET} - PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_LIB_TARGET} - PRIVATE - ${LINK_Fortran_LIBS} - $<$:${MPI_Fortran_LIBRARIES}> -) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES - FOLDER libraries/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") -set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) -add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) + target_include_directories (${HDF5_F90_LIB_TARGET} + PRIVATE + "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_F90_LIB_TARGET} + PRIVATE + $<$:HDF5F90_WINDOWS> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_LIB_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} + $<$:${MPI_Fortran_LIBRARIES}> + ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") + set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) + add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) @@ -351,35 +363,37 @@ install ( fortheaders ) -set (mod_files - ${MOD_BUILD_DIR}/h5fortran_types.mod - ${MOD_BUILD_DIR}/hdf5.mod - ${MOD_BUILD_DIR}/h5fortkit.mod - ${MOD_BUILD_DIR}/h5global.mod - ${MOD_BUILD_DIR}/h5a.mod - ${MOD_BUILD_DIR}/h5d.mod - ${MOD_BUILD_DIR}/h5e.mod - ${MOD_BUILD_DIR}/h5f.mod - ${MOD_BUILD_DIR}/h5g.mod - ${MOD_BUILD_DIR}/h5i.mod - ${MOD_BUILD_DIR}/h5l.mod - ${MOD_BUILD_DIR}/h5lib.mod - ${MOD_BUILD_DIR}/h5o.mod - ${MOD_BUILD_DIR}/h5p.mod - ${MOD_BUILD_DIR}/h5r.mod - ${MOD_BUILD_DIR}/h5s.mod - ${MOD_BUILD_DIR}/h5t.mod - ${MOD_BUILD_DIR}/h5z.mod - ${MOD_BUILD_DIR}/h5_gen.mod -) -install ( - FILES - ${mod_files} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/static - COMPONENT - fortheaders -) +if (NOT ONLY_SHARED_LIBS) + set (mod_files + ${MOD_BUILD_DIR}/h5fortran_types.mod + ${MOD_BUILD_DIR}/hdf5.mod + ${MOD_BUILD_DIR}/h5fortkit.mod + ${MOD_BUILD_DIR}/h5global.mod + ${MOD_BUILD_DIR}/h5a.mod + ${MOD_BUILD_DIR}/h5d.mod + ${MOD_BUILD_DIR}/h5e.mod + ${MOD_BUILD_DIR}/h5f.mod + ${MOD_BUILD_DIR}/h5g.mod + ${MOD_BUILD_DIR}/h5i.mod + ${MOD_BUILD_DIR}/h5l.mod + ${MOD_BUILD_DIR}/h5lib.mod + ${MOD_BUILD_DIR}/h5o.mod + ${MOD_BUILD_DIR}/h5p.mod + ${MOD_BUILD_DIR}/h5r.mod + ${MOD_BUILD_DIR}/h5s.mod + ${MOD_BUILD_DIR}/h5t.mod + ${MOD_BUILD_DIR}/h5z.mod + ${MOD_BUILD_DIR}/h5_gen.mod + ) + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/static + COMPONENT + fortheaders + ) +endif () if (BUILD_SHARED_LIBS) set (modsh_files @@ -421,8 +435,10 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () - INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + endif () install ( TARGETS @@ -436,3 +452,53 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_F90_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +set (_PKG_CONFIG_LIBS_PRIVATE) + +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_F90_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_REQUIRES_PRIVATE "${HDF5_LIB_CORENAME}") + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_F90_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT fortlibraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5fc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT fortlibraries + ) +endif () + + diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index b862fcd..f7f9038 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -7,7 +7,7 @@ project (HDF5_FORTRAN_TESTS C Fortran) #----------------------------------------------------------------------------- add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90) -target_include_directories(H5_test_buildiface +target_include_directories (H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR} ) @@ -31,35 +31,37 @@ set_target_properties (H5_test_buildiface PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} ) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +else () file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) #----------------------------------------------------------------------------- # Add Test Lib #----------------------------------------------------------------------------- -add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) -set_source_files_properties (t.c PROPERTIES LANGUAGE C) -target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} -) -H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE C -) -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) + set_source_files_properties (t.c PROPERTIES LANGUAGE C) + target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE + ${HDF5_F90_C_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE C + ) +else () add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) - target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} + target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -78,19 +80,19 @@ if (BUILD_SHARED_LIBS) ) endif () -add_custom_command ( - OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static - DEPENDS H5_test_buildiface - COMMENT "Generating the tf_gen.F90 file" -) -add_custom_target (H5testgen ALL - DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 -) -set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static + DEPENDS H5_test_buildiface + COMMENT "Generating the tf_gen.F90 file" + ) + add_custom_target (H5testgen ALL + DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 + ) + set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE) +else () add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 COMMAND $ @@ -104,15 +106,16 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE) endif () -set (HDF5_F90_TF_SOURCES - # generated files - ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 +if (NOT BUILD_SHARED_LIBS) + set (HDF5_F90_TF_SOURCES + # generated files + ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - # normal distribution - tf.F90 -) -set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) -if (BUILD_SHARED_LIBS) + # normal distribution + tf.F90 + ) + set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran) +else () set (HDF5_F90_TF_SOURCES_SHARED # generated file ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 @@ -123,40 +126,40 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif () -add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) -target_include_directories (${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} - PRIVATE - $<$:HDF5F90_WINDOWS> - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} - PUBLIC - ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} -) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) -add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) - -if (BUILD_SHARED_LIBS) +if (NOT BUILD_SHARED_LIBS) + add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) + target_include_directories (${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} + PRIVATE + $<$:HDF5F90_WINDOWS> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES + FOLDER libraries/test/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) + add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) +else () add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE @@ -218,18 +221,10 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -target_include_directories (testhdf5_fortran - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -239,58 +234,36 @@ target_link_libraries (testhdf5_fortran if(MSVC) set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran-shared - fortranlib_test.F90 - tH5A.F90 - tH5D.F90 - tH5E.F90 - tH5F.F90 - tH5G.F90 - tH5I.F90 - tH5P.F90 - tH5R.F90 - tH5S.F90 - tH5Sselect.F90 - tH5T.F90 - tH5VL.F90 - tH5Z.F90 - tHDF5.F90 - ) - target_include_directories (testhdf5_fortran-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran-shared + target_link_libraries (testhdf5_fortran PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (testhdf5_fortran-shared + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran-shared PROPERTIES + set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for testhdf5_fortran_1_8 @@ -302,18 +275,10 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -target_include_directories (testhdf5_fortran_1_8 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(testhdf5_fortran_1_8 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (testhdf5_fortran_1_8 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -323,49 +288,36 @@ target_link_libraries (testhdf5_fortran_1_8 if(MSVC) set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (testhdf5_fortran_1_8 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (testhdf5_fortran_1_8-shared - fortranlib_test_1_8.F90 - tH5O.F90 - tH5A_1_8.F90 - tH5G_1_8.F90 - tH5MISC_1_8.F90 - tHDF5_1_8.F90 - ) - target_include_directories (testhdf5_fortran_1_8-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (testhdf5_fortran_1_8 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (testhdf5_fortran_1_8 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (testhdf5_fortran_1_8 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (testhdf5_fortran_1_8-shared + target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES + set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fortranlib_test_F03 @@ -379,18 +331,10 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -target_include_directories (fortranlib_test_F03 - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" -) target_compile_options(fortranlib_test_F03 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fortranlib_test_F03 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fortranlib_test_F03 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -400,67 +344,44 @@ target_link_libraries (fortranlib_test_F03 if(MSVC) set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fortranlib_test_F03 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fortranlib_test_F03-shared - fortranlib_test_F03.F90 - tH5E_F03.F90 - tH5F_F03.F90 - tH5L_F03.F90 - tH5O_F03.F90 - tH5P_F03.F90 - tH5T_F03.F90 - tHDF5_F03.F90 - ) - target_include_directories (fortranlib_test_F03-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fortranlib_test_F03 PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_compile_options(fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fortranlib_test_F03 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fortranlib_test_F03 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_link_libraries (fortranlib_test_F03-shared + target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fortranlib_test_F03-shared PROPERTIES + set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -target_include_directories (fflush1 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options(fflush1 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush1 - PRIVATE - ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fflush1 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -470,58 +391,44 @@ target_link_libraries (fflush1 if(MSVC) set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush1 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush1-shared fflush1.F90) - target_include_directories (fflush1-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush1 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush1-shared + target_link_libraries (fflush1 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fflush1 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush1 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - target_link_libraries (fflush1-shared + target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush1-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush1-shared PROPERTIES + set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fflush1 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -target_include_directories (fflush2 - PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) target_compile_options (fflush2 PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) -target_link_libraries (fflush2 - PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> -) #set_property(TARGET fflush2 APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) @@ -531,42 +438,36 @@ target_link_libraries (fflush2 if(MSVC) set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() -set_target_properties (fflush2 PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) - -if (BUILD_SHARED_LIBS) - add_executable (fflush2-shared fflush2.F90) - target_include_directories (fflush2-shared +if (NOT BUILD_SHARED_LIBS) + target_include_directories (fflush2 PRIVATE - ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_compile_options(fflush2-shared + target_link_libraries (fflush2 PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + ) + set_target_properties (fflush2 PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) - target_link_libraries (fflush2-shared + add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) +else () + target_include_directories (fflush2 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET fflush2-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (fflush2-shared PROPERTIES + set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) + add_dependencies (fflush2 ${HDF5_F90_TEST_LIBSH_TARGET}) endif () include (CMakeTests.cmake) diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 5fa10f4..ac412c3 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -15,48 +15,49 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared") -endif () + +set (test_CLEANFILES + a.h5 + b.h5 + c.h5 + d.h5 + dsetf_F03.h5 + enum1.h5 + extern_1a.raw + extern_2a.raw + extern_3a.raw + extern_4a.raw + extren_raw.raw + get_info.h5 + nbit.h5 + t_array_F03.h5 + t_bit_F03.h5 + t_controlchar_F03.h5 + t_enum_F03.h5 + t_objref_F03.h5 + t_opaque_F03.h5 + t_regref_F03.h5 + t_string_F03.h5 + t_vlen_F03.h5 + t_vlstring_F03.h5 + t_vlstringrw_F03.h5 + tarray1.h5 + tarray2.h5 + tarray3.h5 + test_create.h5 + tget_file_image.h5 + th5o_ref.h5 + titerate.h5 + vds.h5 + visit.h5 +) # Remove any output file left over from previous test run add_test ( NAME FORTRAN_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 + ${test_CLEANFILES} ) if (last_test) set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -129,114 +130,3 @@ set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear- #-- Adding test for fflush2 add_test (NAME FORTRAN_fflush2 COMMAND $) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) - -if (BUILD_SHARED_LIBS) - add_test ( - NAME FORTRAN_testhdf5-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - a.h5 - b.h5 - c.h5 - d.h5 - dsetf_F03.h5 - enum1.h5 - extern_1a.raw - extern_2a.raw - extern_3a.raw - extern_4a.raw - extren_raw.raw - get_info.h5 - nbit.h5 - t_array_F03.h5 - t_bit_F03.h5 - t_controlchar_F03.h5 - t_enum_F03.h5 - t_objref_F03.h5 - t_opaque_F03.h5 - t_regref_F03.h5 - t_string_F03.h5 - t_vlen_F03.h5 - t_vlstring_F03.h5 - t_vlstringrw_F03.h5 - tarray1.h5 - tarray2.h5 - tarray3.h5 - test_create.h5 - tget_file_image.h5 - th5o_ref.h5 - titerate.h5 - vds.h5 - visit.h5 - WORKING_DIRECTORY - ${PROJECT_BINARY_DIR}/fshared - ) - set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $) - else () - add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran.txt" - #-D "TEST_REFERENCE=testhdf5_fortran.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects") - - #-- Adding test for testhdf5_fortran_1_8 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $) - else () - add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt" - #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) - - #-- Adding test for fortranlib_test_F03 - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $) - else () - add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_REGEX= 0 error.s." - -D "TEST_MATCH= 0 error(s)" - -D "TEST_OUTPUT=fortranlib_test_F03.txt" - #-D "TEST_REFERENCE=fortranlib_test_F03.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () -# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03) - - #-- Adding test for fflush1 - add_test (NAME FORTRAN_fflush1-shared COMMAND $) - set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2) - - #-- Adding test for fflush2 - add_test (NAME FORTRAN_fflush2-shared COMMAND $) - set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared) -endif () diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 8e64239..50e08e8 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -5,13 +5,22 @@ project (HDF5_HL_CPP_EXAMPLES CXX) # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) -target_include_directories(ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (ptExampleFL STATIC) -target_link_libraries (ptExampleFL PRIVATE - ${HDF5_HL_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ptExampleFL STATIC) + target_link_libraries (ptExampleFL PRIVATE + ${HDF5_HL_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (ptExampleFL SHARED) + target_link_libraries (ptExampleFL PRIVATE + ${HDF5_HL_CPP_LIBSH_TARGET} + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) +endif () set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp) if (BUILD_TESTING) diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 77419c6..eb83d8c 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -8,21 +8,23 @@ project (HDF5_HL_CPP_SRC CXX) set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) -add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) -target_include_directories(${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) -set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) + target_include_directories (${HDF5_HL_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) + set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) - target_include_directories(${HDF5_HL_CPP_LIBSH_TARGET} + target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -56,7 +58,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + endif () install ( TARGETS @@ -83,7 +87,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}") endif () diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 68c049c..cfb24a8 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -2,15 +2,26 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_HL_CPP_TEST CXX) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) -target_include_directories(hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (hl_ptableTest STATIC) -target_link_libraries (hl_ptableTest PRIVATE - ${HDF5_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_CPP_LIB_TARGET} - ${HDF5_HL_LIB_TARGET} - ${HDF5_HL_CPP_LIB_TARGET} -) +target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_ptableTest STATIC) + target_link_libraries (hl_ptableTest PRIVATE + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_CPP_LIB_TARGET} + ${HDF5_HL_LIB_TARGET} + ${HDF5_HL_CPP_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (hl_ptableTest SHARED) + target_link_libraries (hl_ptableTest PRIVATE + ${HDF5_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_CPP_LIBSH_TARGET} + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_HL_CPP_LIBSH_TARGET} + ) +endif () set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp) include (CMakeTests.cmake) diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 97c6de5..86c1770 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -28,9 +28,14 @@ set (examples foreach (example ${examples}) add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - target_include_directories(hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_ex_${example} STATIC) - target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_ex_${example} STATIC) + target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (hl_ex_${example} SHARED) + target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) endforeach () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 27971b2..e41b8fe 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -8,18 +8,10 @@ set (examples foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (hl_f90_ex_${example} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) target_compile_options(hl_f90_ex_${example} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_ex_${example} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -29,11 +21,35 @@ foreach (example ${examples}) if(MSVC) set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (hl_f90_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER examples/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) + if (NOT BUILD_SHARED_LIBS) + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + endif () endforeach () if (BUILD_TESTING) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 7ec3b63..a684088 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -16,7 +16,7 @@ endif () #----------------------------------------------------------------------------- add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 ) -target_include_directories(H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") +target_include_directories (H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") @@ -37,8 +37,10 @@ if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/shared") set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE}) endif () -file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static") -set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +if (NOT ONLY_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_HL_F90_BINARY_DIR}/static") + set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE}) +endif () #----------------------------------------------------------------------------- # hl_f90CStub lib @@ -54,24 +56,25 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) -add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) -target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES - FOLDER libraries/hl/fortran - LINKER_LANGUAGE C -) -set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) - +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) + target_include_directories (${HDF5_HL_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + LINKER_LANGUAGE C + ) + set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) - target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} + target_include_directories (${HDF5_HL_F90_C_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -99,21 +102,23 @@ set (HDF5_HL_F90_F_BASE_SOURCES ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.F90 ) -add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - COMMAND $ - WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static - DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} - COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" -) -add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 -) -set_source_files_properties ( - ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 - ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - PROPERTIES GENERATED TRUE -) +if (NOT ONLY_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + COMMAND $ + WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static + DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} + COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" + ) + add_custom_target (H5HLgen ALL + DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + ) + set_source_files_properties ( + ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + PROPERTIES GENERATED TRUE + ) +endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 @@ -132,15 +137,16 @@ if (BUILD_SHARED_LIBS) ) endif () -set (HDF5_HL_F90_F_SOURCES - ${HDF5_HL_F90_F_BASE_SOURCES} - - # generated files - ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 - ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 -) -set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) +if (NOT ONLY_SHARED_LIBS) + set (HDF5_HL_F90_F_SOURCES + ${HDF5_HL_F90_F_BASE_SOURCES} + # generated files + ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 + ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 + ) + set_source_files_properties (${HDF5_HL_F90_F_SOURCES} PROPERTIES LANGUAGE Fortran) +endif () if (BUILD_SHARED_LIBS) set (HDF5_HL_F90_F_SOURCES_SHARED ${HDF5_HL_F90_F_BASE_SOURCES} @@ -152,42 +158,43 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_HL_F90_F_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran) endif () -add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) -target_include_directories (${HDF5_HL_F90_LIB_TARGET} - PRIVATE - "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE - "$/include>" -) -target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} - PUBLIC - $<$:HDF5F90_WINDOWS> - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (${HDF5_HL_F90_LIB_TARGET} - PUBLIC - ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} -) -#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -#) -#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -#) -if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES - FOLDER libraries/hl/fortran - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static -) -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") -set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) -add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) - +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) + target_include_directories (${HDF5_HL_F90_LIB_TARGET} + PRIVATE + "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" + ) + target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} + PUBLIC + $<$:HDF5F90_WINDOWS> + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (${HDF5_HL_F90_LIB_TARGET} + PUBLIC + ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + ) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") + endif() + set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") + set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) + add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} @@ -240,24 +247,25 @@ endif () #----------------------------------------------------------------------------- -set (mod_files - ${MOD_BUILD_DIR}/h5ds.mod - ${MOD_BUILD_DIR}/h5tb.mod - ${MOD_BUILD_DIR}/h5tb_const.mod - ${MOD_BUILD_DIR}/h5lt.mod - ${MOD_BUILD_DIR}/h5lt_const.mod - ${MOD_BUILD_DIR}/h5im.mod -) - -install ( - FILES - ${mod_files} - DESTINATION - ${HDF5_INSTALL_INCLUDE_DIR}/static - COMPONENT - fortheaders -) +if (NOT ONLY_SHARED_LIBS) + set (mod_files + ${MOD_BUILD_DIR}/h5ds.mod + ${MOD_BUILD_DIR}/h5tb.mod + ${MOD_BUILD_DIR}/h5tb_const.mod + ${MOD_BUILD_DIR}/h5lt.mod + ${MOD_BUILD_DIR}/h5lt_const.mod + ${MOD_BUILD_DIR}/h5im.mod + ) + install ( + FILES + ${mod_files} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR}/static + COMPONENT + fortheaders + ) +endif () if (BUILD_SHARED_LIBS) set (modsh_files ${MODSH_BUILD_DIR}/h5ds.mod @@ -285,8 +293,10 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) - #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + endif () install ( TARGETS diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index fca2852..c152142 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -13,18 +13,10 @@ set (H5_TESTS macro (ADD_H5_FORTRAN_EXE file) add_executable (hl_f90_${file} ${file}.F90) - target_include_directories (hl_f90_${file} - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) target_compile_options(hl_f90_${file} PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_${file} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} - ) # set_property(TARGET hl_f90_${file} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> # ) @@ -34,35 +26,30 @@ macro (ADD_H5_FORTRAN_EXE file) if(MSVC) set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() - set_target_properties (hl_f90_${file} PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) - if (BUILD_SHARED_LIBS) - add_executable (hl_f90_${file}-shared ${file}.F90) - target_include_directories (hl_f90_${file}-shared + if (NOT BUILD_SHARED_LIBS) + target_include_directories (hl_f90_${file} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_compile_options(hl_f90_${file}-shared + target_link_libraries (hl_f90_${file} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} + ) + set_target_properties (hl_f90_${file} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (hl_f90_${file} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_link_libraries (hl_f90_${file}-shared + target_link_libraries (hl_f90_${file} PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ) -# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY -# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -# ) -# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY -# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -# ) - if(MSVC) - set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (hl_f90_${file}-shared PROPERTIES + set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 54cc6ef..2137d1a 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,6 +16,18 @@ ############################################################################## ############################################################################## +set (test_CLEANFILES + dsetf1.h5 + dsetf2.h5 + dsetf3.h5 + dsetf4.h5 + dsetf5.h5 + f1img.h5 + f1tab.h5 + f2tab.h5 + tstds.h5 +) + macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_FORTRAN_f90_${file} COMMAND $) @@ -32,61 +44,15 @@ macro (ADD_H5_FORTRAN_TEST file) ) endif () set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - if (BUILD_SHARED_LIBS) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_${file}-shared.txt" - #-D "TEST_REFERENCE=hl_f90_${file}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_${file}-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - endif () endmacro () # Remove any output file left over from previous test run add_test ( NAME HL_FORTRAN_test-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1img.h5 - f1tab.h5 - f2tab.h5 - tstds.h5 + -E remove ${test_CLEANFILES} ) -if (BUILD_SHARED_LIBS) - add_test ( - NAME HL_FORTRAN_test-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - dsetf1.h5 - dsetf2.h5 - dsetf3.h5 - dsetf4.h5 - dsetf5.h5 - f1img.h5 - f1tab.h5 - f2tab.h5 - tstds.h5 - ) - set_tests_properties (HL_FORTRAN_test-shared-clear-objects - PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds" - ) -endif () - foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_TEST(${h5_test}) endforeach () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index bf0f6ff..7125403 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -32,21 +32,23 @@ set (HL_PRIVATE_HEADERS ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ) -add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) -target_include_directories(${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") -set (install_targets ${HDF5_HL_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) + target_include_directories (${HDF5_HL_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") + set (install_targets ${HDF5_HL_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) - target_include_directories(${HDF5_HL_LIBSH_TARGET} + target_include_directories (${HDF5_HL_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -80,7 +82,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) endif () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + endif () install ( TARGETS @@ -107,7 +111,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") set (_PKG_CONFIG_LIBS_PRIVATE) -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_LIB_CORENAME}") endif () diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 238b5e1..2959c6c 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -17,29 +17,26 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_EXE hl_name) +macro (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} STATIC) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} - ) - set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () - -MACRO (HL_ADD_SHEXE hl_name) - add_executable (hl_${hl_name} ${hl_name}.c) - target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_${hl_name} SHARED) - target_link_libraries (hl_${hl_name} PRIVATE - ${HDF5_HL_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - ) + target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_${hl_name} STATIC) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) + else () + TARGET_C_PROPERTIES (hl_${hl_name} SHARED) + target_link_libraries (hl_${hl_name} PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) + endif () set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl) -ENDMACRO () +endmacro () HL_ADD_EXE (test_lite) HL_ADD_EXE (test_image) @@ -52,22 +49,31 @@ HL_ADD_EXE (test_h5do_compat) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) -target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (hl_test_packet STATIC) -target_link_libraries (hl_test_packet PRIVATE - ${HDF5_HL_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} -) +target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_test_packet STATIC) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} + ${HDF5_LIB_TARGET} + ) +else () + TARGET_C_PROPERTIES (hl_test_packet SHARED) + target_link_libraries (hl_test_packet PRIVATE + ${HDF5_HL_LIBSH_TARGET} + ${HDF5_TEST_LIBSH_TARGET} + ${HDF5_LIBSH_TARGET} + ) +endif () set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. # It should only be run during development when new test files are needed # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (hl_gen_test_ds gen_test_ds.c) - target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) target_link_libraries (hl_gen_test_ds PRIVATE ${HDF5_HL_LIB_TARGET} @@ -77,7 +83,7 @@ if (HDF5_BUILD_GENERATORS) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) add_executable (hl_gen_test_ld gen_test_ld.c) - target_include_directories(hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_gen_test_ld STATIC) target_link_libraries (hl_gen_test_ld PRIVATE ${HDF5_HL_LIB_TARGET} diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index a27ab18..14a5f5f 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -14,24 +14,58 @@ set (GIF2H5_SOURCES ) #-- Add gif2hdf5 program -add_executable (gif2h5 ${GIF2H5_SOURCES}) -target_include_directories(gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (gif2h5 STATIC) -target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5") +if (NOT ONLY_SHARED_LIBS) + add_executable (gif2h5 ${GIF2H5_SOURCES}) + target_include_directories (gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (gif2h5 STATIC) + target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5") + set (H5_DEP_EXECUTABLES + gif2h5 + ) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (gif2h5-shared ${GIF2H5_SOURCES}) + target_include_directories (gif2h5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (gif2h5-shared SHARED) + target_link_libraries (gif2h5-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) + set_target_properties (gif2h5-shared PROPERTIES FOLDER tools/hl) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5-shared") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + gif2h5-shared + ) +endif () #-- Add h52gif program set (hdf2gif_SOURCES ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdf2gif.c ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c ) -add_executable (h52gif ${hdf2gif_SOURCES}) -target_include_directories(h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h52gif STATIC) -target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h52gif PROPERTIES FOLDER tools/hl) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif") +if (NOT ONLY_SHARED_LIBS) + add_executable (h52gif ${hdf2gif_SOURCES}) + target_include_directories (h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h52gif STATIC) + target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + set_target_properties (h52gif PROPERTIES FOLDER tools/hl) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h52gif + ) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (h52gif-shared ${hdf2gif_SOURCES}) + target_include_directories (h52gif-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h52gif-shared SHARED) + target_link_libraries (h52gif-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} PRIVATE ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) + set_target_properties (h52gif-shared PROPERTIES FOLDER tools/hl) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif-shared") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h52gif-shared + ) +endif () if (BUILD_TESTING) # -------------------------------------------------------------------- @@ -39,9 +73,9 @@ if (BUILD_TESTING) # used in the CMake Build system as we rely on the test files that are # shipped with HDF5 source archives # -------------------------------------------------------------------- - if (HDF5_BUILD_GENERATORS) + if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c) - target_include_directories(hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (hl_h52gifgentest STATIC) target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) @@ -58,8 +92,7 @@ endif () if (HDF5_EXPORTED_TARGETS) install ( TARGETS - gif2h5 - h52gif + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 61c004e..1cc989c 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -27,6 +27,12 @@ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "$ HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files") add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list}) +if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") +else () + set (tgt_ext "-shared") +endif () + # Remove any output file left over from previous test run add_test ( NAME HL_TOOLS-clear-objects @@ -38,19 +44,19 @@ add_test ( image24.gif ) -add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index 1d1c341..b3d65f7 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -9,11 +9,22 @@ set (H5WATCH_SOURCES ) #-- Add h5watch program -add_executable (h5watch ${H5WATCH_SOURCES}) -target_include_directories(h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5watch STATIC) -target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5watch PROPERTIES FOLDER tools/hl) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5watch ${H5WATCH_SOURCES}) + target_include_directories (h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5watch STATIC) + target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + set_target_properties (h5watch PROPERTIES FOLDER tools/hl) + set (H5_DEP_EXECUTABLES h5watch) +endif () +if (BUILD_SHARED_LIBS) + add_executable (h5watch-shared ${H5WATCH_SOURCES}) + target_include_directories (h5watch-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5watch-shared SHARED) + target_link_libraries (h5watch-shared PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) + set_target_properties (h5watch-shared PROPERTIES FOLDER tools/hl) + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5watch-shared) +endif () if (BUILD_TESTING) #-- Add swmr_check_compat_vfd program @@ -21,9 +32,14 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c ) add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES}) - target_include_directories(hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC) - target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET}) + target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC) + target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd SHARED) + target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl) #-- Add extend_dset program @@ -31,15 +47,25 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c ) add_executable (extend_dset ${extend_dset_SOURCES}) - target_include_directories(extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (extend_dset STATIC) - target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (extend_dset STATIC) + target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (extend_dset SHARED) + target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TOOLS_LIBSH_TARGET}) + endif () set_target_properties (extend_dset PROPERTIES FOLDER tools/hl) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) - target_include_directories(h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5watchgentest STATIC) - target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5watchgentest STATIC) + target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5watchgentest SHARED) + target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) include (CMakeTests.cmake) @@ -51,7 +77,7 @@ endif () if (HDF5_EXPORTED_TARGETS) install ( TARGETS - h5watch + ${H5_DEP_EXECUTABLES} EXPORT ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index a4d3fa2..fba8484 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -68,12 +68,18 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -91,7 +97,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -110,14 +116,13 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 + -E remove ${resultfile}.h5 ) set_tests_properties (H5WATCH-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index 3a1361a..17a81e9 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -262,7 +262,7 @@ public class HDF5LibraryException extends HDF5Exception { return "unrecognized message"; } else if (err_code == HDF5Constants.H5E_CANTDELETE) { - return " Can't delete message"; + return "Can't delete message"; } else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) { return "Can't open object"; diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index ca48fa6..f3e6012 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -74,7 +74,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) ########### JNI libraries always must be built shared ############### add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) -target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} +target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a3f2232..fef4c63 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,24 @@ New Features Configuration: ------------- + - Add option to build only shared libs + + A request was made to prevent building static libraries and only build + shared. A new option was added to CMake, ONLY_SHARED_LIBS, which will + skip building static libraries. Certain utility functions will build with + static libs but are not published. Tests are adjusted to use the correct + libraries. + + (ADB - 2019/06/12, HDFFV-10805) + + - Change tools test that test the error stack + + There are some use cases which can cause the error stack of tools to be + different then the expected. These tests now use grepTest.cmake, this was + changed to allow the error file to be searched for an expected string. + + (ADB - 2019/04/15, HDFFV-10741) + - Rework CMake command files to fix MPI testing. Added setup fixture to remove any test generated files and added DEPENDS diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01434ba..aff732d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -930,7 +930,7 @@ endif () if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) - target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -1020,7 +1020,7 @@ else () endif () add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings @@ -1060,41 +1060,48 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- -set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) -add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) - -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) -target_include_directories(${HDF5_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -target_compile_definitions(${HDF5_LIB_TARGET} - PUBLIC - ${HDF_EXTRA_C_FLAGS} - ${HDF_EXTRA_FLAGS} - $,DEBUG,NDEBUG> - PRIVATE - $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> -) -TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_LIB_TARGET} - PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" - PUBLIC $<$>:${CMAKE_DL_LIBS}> -) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) -add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) - -set (install_targets ${HDF5_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) + add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) + + add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + target_include_directories (${HDF5_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_LIB_TARGET} + PUBLIC + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $,DEBUG,NDEBUG> + PRIVATE + $<$:H5_DEBUG_API> # Enable tracing of the API + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + ) + TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" + PUBLIC $<$>:${CMAKE_DL_LIBS}> + ) + if (NOT WIN32) + target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE $<$:Threads::Threads> + ) + endif () + set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) + add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) + + set (install_targets ${HDF5_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) - target_include_directories(${HDF5_LIBSH_TARGET} + target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -1111,8 +1118,8 @@ if (BUILD_SHARED_LIBS) ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} - PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" - PUBLIC $<$>:${CMAKE_DL_LIBS}> $<$:Threads::Threads> + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} "$<$:${MPI_C_LIBRARIES}>" $<$:Threads::Threads> + PUBLIC $<$>:${CMAKE_DL_LIBS}> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") @@ -1145,7 +1152,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) endif () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + endif () install ( TARGETS @@ -1174,7 +1183,9 @@ foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS}) set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") endforeach () -set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +if (NOT ONLY_SHARED_LIBS) + set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}") endif () diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 42fc3a6..5b34ec5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -23,29 +23,32 @@ set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/swmr_common.h ) -add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) -target_include_directories(${HDF5_TEST_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_TEST_LIB_TARGET} - PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} - PRIVATE $<$:ws2_32.lib> -) -if (MINGW) - target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) + target_include_directories (${HDF5_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TEST_LIB_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} + PRIVATE $<$:ws2_32.lib> + ) + if (MINGW) + target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") + endif () + H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test) endif () -H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0) if (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) - target_include_directories(${HDF5_TEST_LIBSH_TARGET} + target_include_directories (${HDF5_TEST_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$:H5_HAVE_THREADSAFE> + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} @@ -85,9 +88,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -110,9 +113,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) - target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -241,17 +244,15 @@ set (H5_TESTS macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories(${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${file} STATIC) - target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) - set_target_properties (${file} PROPERTIES FOLDER test) - if (BUILD_SHARED_LIBS) - add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c) - target_include_directories(${file}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${file}-shared SHARED) - target_link_libraries (${file}-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - set_target_properties (${file}-shared PROPERTIES FOLDER test) + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () + set_target_properties (${file} PROPERTIES FOLDER test) endmacro () set (H5_TESTS_MULTIPLE @@ -273,61 +274,58 @@ endforeach () ######### Also special handling of link libs ############# #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) -target_include_directories(direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (direct_chunk STATIC) -target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) -set_target_properties (direct_chunk PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (direct_chunk-shared ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) - target_include_directories(direct_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (direct_chunk-shared SHARED) - target_link_libraries (direct_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (direct_chunk-shared PROPERTIES FOLDER test) +target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (direct_chunk STATIC) + target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) +else () + TARGET_C_PROPERTIES (direct_chunk SHARED) + target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) endif () +set_target_properties (direct_chunk PROPERTIES FOLDER test) ######### Special handling for multiple sources ############# #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) -target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (testhdf5 STATIC) -target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET}) -set_target_properties (testhdf5 PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (testhdf5-shared ${testhdf5_SOURCES}) - target_include_directories(testhdf5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (testhdf5-shared SHARED) - target_link_libraries (testhdf5-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) - set_target_properties (testhdf5-shared PROPERTIES FOLDER test) +target_include_directories (testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (testhdf5 STATIC) + target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (testhdf5 SHARED) + target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (testhdf5 PROPERTIES FOLDER test) #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) -target_include_directories(cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (cache_image STATIC) -target_link_libraries (cache_image PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (cache_image PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (cache_image-shared ${cache_image_SOURCES}) - target_include_directories(cache_image-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cache_image-shared SHARED) - target_link_libraries (cache_image-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (cache_image-shared PROPERTIES FOLDER test) +target_include_directories (cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cache_image STATIC) + target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (cache_image SHARED) + target_link_libraries (cache_image PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (cache_image PROPERTIES FOLDER test) #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) -target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (ttsafe STATIC) -target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (ttsafe PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (ttsafe-shared ${ttsafe_SOURCES}) - target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ttsafe-shared SHARED) - target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (ttsafe-shared PROPERTIES FOLDER test) +target_include_directories (ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (ttsafe STATIC) + target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIB_TARGET}) + if (NOT WIN32) + target_link_libraries (ttsafe + PRIVATE $<$:Threads::Threads> + ) + endif () +else () + TARGET_C_PROPERTIES (ttsafe SHARED) + target_link_libraries (ttsafe PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$:Threads::Threads>) endif () +set_target_properties (ttsafe PROPERTIES FOLDER test) ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -397,31 +395,27 @@ endforeach () # This has to be copied to the test directory for execve() to find it # and it can't be renamed (i.e., no -shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) -target_include_directories(accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (accum_swmr_reader STATIC) -target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories (accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (accum_swmr_reader STATIC) + target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (accum_swmr_reader SHARED) + target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) #-- Set accum dependencies set_target_properties (accum PROPERTIES DEPENDS accum_swmr_reader) -if (BUILD_SHARED_LIBS) - set_target_properties (accum-shared PROPERTIES DEPENDS accum_swmr_reader) -endif () ############################################################################## ### P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (filter_plugin SHARED) - target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) - set_target_properties (filter_plugin PROPERTIES FOLDER test) -else () - add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (filter_plugin STATIC) - target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) + target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) endif () @@ -430,44 +424,38 @@ endif () ############################################################################## set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) -target_include_directories(use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_append_chunk STATIC) -target_link_libraries (use_append_chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_append_chunk PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES}) - target_include_directories(use_append_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_append_chunk-shared SHARED) - target_link_libraries (use_append_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test) +target_include_directories (use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_chunk STATIC) + target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_chunk SHARED) + target_link_libraries (use_append_chunk PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_append_chunk PROPERTIES FOLDER test) set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) -target_include_directories(use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_append_mchunks STATIC) -target_link_libraries (use_append_mchunks PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_append_mchunks PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES}) - target_include_directories(use_append_mchunks-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED) - target_link_libraries (use_append_mchunks-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test) +target_include_directories (use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_append_mchunks STATIC) + target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_append_mchunks SHARED) + target_link_libraries (use_append_mchunks PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_append_mchunks PROPERTIES FOLDER test) set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) -target_include_directories(use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) -target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) -if (BUILD_SHARED_LIBS) - add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES}) - target_include_directories(use_disable_mdc_flushes-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED) - target_link_libraries (use_disable_mdc_flushes-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test) +target_include_directories (use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) + target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (use_disable_mdc_flushes SHARED) + target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_TEST_LIBSH_TARGET}) endif () +set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) include (CMakeTests.cmake) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index eccf9d4..9a5791a 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -20,11 +20,6 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files") -if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files") -endif () # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory @@ -39,20 +34,9 @@ add_custom_command ( COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different "$" "${PROJECT_BINARY_DIR}/H5TEST/accum_swmr_reader" ) -if (BUILD_SHARED_LIBS) - add_custom_command ( - TARGET accum_swmr_reader - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "$" "${PROJECT_BINARY_DIR}/H5TEST-shared/accum_swmr_reader" - ) -endif () foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -68,9 +52,6 @@ set (HDF5_REFERENCE_FILES foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -130,10 +111,6 @@ set (HDF5_REFERENCE_PLIST_FILES foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIB_files") HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/${plistfile}" "HDF5_TEST_LIBSH_files") - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/testfiles/plist_files/def_${plistfile}" "HDF5_TEST_LIBSH_files") - endif () endforeach () # -------------------------------------------------------------------- @@ -194,38 +171,35 @@ set (HDF5_REFERENCE_TEST_FILES foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files") - endif () endforeach () add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) -if (BUILD_SHARED_LIBS) - add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list}) -endif () + +set (testhdf5_CLEANFILES + coord.h5 + dtypes10.h5 + sys_file1 + tattr.h5 + tfile1.h5 + tfile2.h5 + tfile3.h5 + tfile4.h5 + tfile5.h5 + tfile6.h5 + tfile7.h5 + tfilespace.h5 + th5o_file + th5s1.h5 + tselect.h5 + tsohm.h5 + tsohm_dst.h5 + tsohm_src.h5 +) # Remove any output file left over from previous test run add_test (NAME H5TEST-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} - -E remove - coord.h5 - dtypes10.h5 - sys_file1 - tattr.h5 - tfile1.h5 - tfile2.h5 - tfile3.h5 - tfile4.h5 - tfile5.h5 - tfile6.h5 - tfile7.h5 - tfilespace.h5 - th5o_file - th5s1.h5 - tselect.h5 - tsohm.h5 - tsohm_dst.h5 - tsohm_src.h5 + -E remove ${testhdf5_CLEANFILES} WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -255,59 +229,6 @@ set_tests_properties (H5TEST-testhdf5-select PROPERTIES ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -if (NOT HDF5_ENABLE_USING_MEMCHECKER) - if (BUILD_SHARED_LIBS) - add_test (NAME H5TEST-shared-clear-testhdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove - coord.h5 - dtypes10.h5 - sys_file1 - tattr.h5 - tfile1.h5 - tfile2.h5 - tfile3.h5 - tfile4.h5 - tfile5.h5 - tfile6.h5 - tfile7.h5 - tfilespace.h5 - th5o_file - th5s1.h5 - tselect.h5 - tsohm.h5 - tsohm_dst.h5 - tsohm_src.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5) - add_test (NAME H5TEST-shared-testhdf5-base COMMAND $ -x heap -x file -x select) - set_tests_properties (H5TEST-shared-testhdf5-base PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-heap COMMAND $ -o heap) - set_tests_properties (H5TEST-shared-testhdf5-heap PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-file COMMAND $ -o file) - set_tests_properties (H5TEST-shared-testhdf5-file PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - add_test (NAME H5TEST-shared-testhdf5-select COMMAND $ -o select) - set_tests_properties (H5TEST-shared-testhdf5-select PROPERTIES - FIXTURES_REQUIRED shared_clear_testhdf5 - ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () -endif () ############################################################################## ############################################################################## @@ -565,6 +486,7 @@ foreach (h5_test ${H5_TESTS}) -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=${h5_test}.txt" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" #-D "TEST_REFERENCE=${test}.out" -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" @@ -584,49 +506,6 @@ set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -if (BUILD_SHARED_LIBS) - # Remove any output file left over from previous test run - add_test (NAME H5TEST-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects) - - foreach (h5_test ${H5_TESTS}) - if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) - if ("${h5_test}" STREQUAL "big" AND CYGWIN) - add_test (NAME H5TEST-shared-${h5_test} - COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" - ) - else () - add_test (NAME H5TEST-shared-${h5_test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${h5_test}.txt" - #-D "TEST_REFERENCE=${test}.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5TEST-shared-${h5_test} PROPERTIES - FIXTURES_REQUIRED shared_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - endforeach () - - set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -endif () - #-- Adding test for cache if (NOT CYGWIN) add_test (NAME H5TEST-clear-cache-objects @@ -660,56 +539,22 @@ if (NOT CYGWIN) endif () if (TEST_CACHE_IMAGE) -#-- Adding test for cache_image -add_test ( - NAME H5TEST-clear-cache_image-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_image_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) -add_test (NAME H5TEST-cache_image COMMAND $) -set_tests_properties (H5TEST-cache_image PROPERTIES - FIXTURES_REQUIRED cache_image_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) -endif () - -if (BUILD_SHARED_LIBS) - #-- Adding test for cache - if (NOT CYGWIN AND NOT WIN32) - add_test (NAME H5TEST-shared-clear-cache-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP shared_cache_clear_objects) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-shared-cache COMMAND $) - else () - add_test (NAME H5TEST-shared-cache COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cache-shared.txt" - #-D "TEST_REFERENCE=cache-shared.out" - -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5TEST-shared-cache PROPERTIES - FIXTURES_REQUIRED shared_cache_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - endif () + #-- Adding test for cache_image + add_test ( + NAME H5TEST-clear-cache_image-objects + COMMAND ${CMAKE_COMMAND} + -E remove + cache_image_test.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) + add_test (NAME H5TEST-cache_image COMMAND $) + set_tests_properties (H5TEST-cache_image PROPERTIES + FIXTURES_REQUIRED cache_image_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) endif () #-- Adding test for flush1/2 @@ -777,7 +622,6 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES WILL_FAIL "true" ) - ############################################################################## ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -921,130 +765,38 @@ add_test (NAME H5TEST-clear-links_env-objects ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) -add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" - -D "TEST_ENV_VALUE:STRING=.:tmp" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=links_env.txt" - -D "TEST_REFERENCE=links_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" -) -set_tests_properties (H5TEST-links_env PROPERTIES - FIXTURES_REQUIRED links_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -#-- Adding test for libinfo -add_test (NAME H5TEST-testlibinfo - COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -if (BUILD_SHARED_LIBS) - #-- Adding test for err_compat - if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test (NAME H5TEST-shared-clear-err_compat-objects - COMMAND ${CMAKE_COMMAND} - -E remove - err_compat.txt - err_compat.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-err_compat-objects PROPERTIES FIXTURES_SETUP shared_err_compat_clear_objects) - add_test (NAME H5TEST-shared-err_compat COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "ERROR_APPEND=1" - -D "TEST_OUTPUT=err_compat.txt" - -D "TEST_REFERENCE=err_compat_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-err_compat PROPERTIES - FIXTURES_REQUIRED shared_err_compat_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - - #-- Adding test for error_test - add_test (NAME H5TEST-shared-clear-error_test-objects - COMMAND ${CMAKE_COMMAND} - -E remove - error_test.txt - error_test.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) - if (HDF5_USE_16_API_DEFAULT) - add_test ( - NAME H5TEST-shared-error_test - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" - ) - set_property(TEST H5TEST-shared-error_test PROPERTY DISABLED) - else () - add_test (NAME H5TEST-shared-error_test COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_MASK_ERROR=true" - -D "ERROR_APPEND=1" - -D "TEST_OUTPUT=error_test.txt" - -D "TEST_REFERENCE=error_test_1" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-error_test PROPERTIES - FIXTURES_REQUIRED shared_error_test_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - endif () - - #-- Adding test for links_env - add_test (NAME H5TEST-shared-clear-links_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - links_env.txt - links_env.txt.err - extlinks_env0.h5 - extlinks_env1.h5 - tmp/extlinks_env1.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-links_env-objects PROPERTIES FIXTURES_SETUP shared_links_env_clear_objects) - add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-links_env COMMAND $) +else () + add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" - -D "TEST_ENV_VALUE:STRING=.:tmp" + #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" + #-D "TEST_ENV_VALUE:STRING=.:tmp" -D "TEST_EXPECT=0" -D "TEST_OUTPUT=links_env.txt" -D "TEST_REFERENCE=links_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5TEST-shared-links_env PROPERTIES - FIXTURES_REQUIRED shared_links_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) +endif () +set_tests_properties (H5TEST-links_env PROPERTIES + FIXTURES_REQUIRED links_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) +if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo - add_test (NAME H5TEST-shared-testlibinfo + add_test (NAME H5TEST-testlibinfo + COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) +else () + #-- Adding test for libinfo + add_test (NAME H5TEST-testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () @@ -1094,9 +846,6 @@ if (ENABLE_EXTENDED_TESTS) #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/flushrefresh_test") - endif () find_package (Perl) if (PERL_FOUND) add_test (NAME H5TEST-clear-testflushrefresh-objects @@ -1127,10 +876,10 @@ if (ENABLE_EXTENDED_TESTS) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) - else () - message (STATUS "Cannot execute TEST flushrefresh - perl not found") endif () -endif() +else () + message (STATUS "Cannot execute TEST flushrefresh - perl not found") +endif () ############################################################################## ############################################################################## @@ -1148,10 +897,10 @@ endif () ############################################################################## ############################################################################## -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (${genfile} STATIC) target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 64ccacd..5f02c9f 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -34,37 +34,23 @@ foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files") - if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files") - endif () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (h5_tfile ${HDF5_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (ref_file ${HDF5_REFERENCE_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () foreach (vfdtest ${VFD_LIST}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () @@ -72,17 +58,10 @@ foreach (vfdtest ${VFD_LIST}) foreach (plistfile ${HDF5_REFERENCE_PLIST_FILES}) HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIB_files") HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIB_files") - if (BUILD_SHARED_LIBS) - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/${plistfile}" "HDF5_VFDTEST_LIBSH_files") - HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/plist_files/def_${plistfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/testfiles/plist_files/def_${plistfile}" "HDF5_VFDTEST_LIBSH_files") - endif () endforeach () endforeach () add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIB tests" DEPENDS ${HDF5_VFDTEST_LIB_files_list}) -if (BUILD_SHARED_LIBS) - add_custom_target(HDF5_VFDTEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_VFDTEST_LIBSH tests" DEPENDS ${HDF5_VFDTEST_LIBSH_files_list}) -endif () ############################################################################## ############################################################################## @@ -134,39 +113,10 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () else () add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}" ) - if (BUILD_SHARED_LIBS) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" - ) - endif () endif () else () add_test ( @@ -191,30 +141,6 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () else () add_test ( @@ -239,80 +165,32 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache") - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} - ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out - ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err - ) - add_test (NAME VFD-${vfdname}-${vfdtest}-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () + add_test ( + NAME VFD-${vfdname}-${vfdtest}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${vfdname}/${vfdname}-${vfdtest}.out + ${vfdname}/${vfdname}-${vfdtest}.out.err + ) + add_test (NAME VFD-${vfdname}-${vfdtest} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES + DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} + ) endmacro () macro (ADD_VFD_TEST vfdname resultcode) @@ -332,15 +210,6 @@ endif () if (NOT CYGWIN) set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () - if (BUILD_SHARED_LIBS) - set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared) - set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10) - set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - if (NOT CYGWIN AND NOT WIN32) - set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) - endif () - endif () if (HDF5_TEST_FHEAP_VFD) add_test ( NAME VFD-${vfdname}-fheap-clear-objects @@ -365,31 +234,6 @@ endif () ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) - if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-fheap-shared-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}-shared/${vfdname}-fheap-shared.out - ${vfdname}-shared/${vfdname}-fheap-shared.out.err - ) - add_test (NAME VFD-${vfdname}-fheap-shared - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=${vfdname}-fheap-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES - DEPENDS VFD-${vfdname}-fheap-shared-clear-objects - TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared - ) - endif () endif () endmacro () diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 96ce0c0..1aecef6 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -22,24 +22,38 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) -target_include_directories(testphdf5 +target_include_directories (testphdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (testphdf5 STATIC) -target_link_libraries (testphdf5 - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" -) +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (testphdf5 STATIC) + target_link_libraries (testphdf5 + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) +else () + TARGET_C_PROPERTIES (testphdf5 SHARED) + target_link_libraries (testphdf5 + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) +endif () set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - target_include_directories(${file} + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) - TARGET_C_PROPERTIES (${file} STATIC) - target_link_libraries (${file} - PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" - ) + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} + PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>" + ) + endif () set_target_properties (${file} PROPERTIES FOLDER test/par) ENDMACRO (ADD_H5P_EXE file) diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index b4c8111..0702d13 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -18,8 +18,7 @@ # Remove any output file left over from previous test run add_test (NAME MPI_TEST-clear-testphdf5-objects COMMAND ${CMAKE_COMMAND} - -E remove - ParaTest.h5 + -E remove ParaTest.h5 WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index c0b848b..7333c6d 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -44,8 +44,8 @@ endforeach () NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ${vfdname}-shared/${vfdname}-${h5_test}.out - ${vfdname}-shared/${vfdname}-${h5_test}.out.err + ${vfdname}/${vfdname}-${h5_test}.out + ${vfdname}/${vfdname}-${h5_test}.out.err ) add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 1596ea7..e9dfcaa 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -32,25 +32,27 @@ set (H5_TOOLS_LIB_HDRS ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h ) -add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) -target_include_directories(${HDF5_TOOLS_LIB_TARGET} - PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" - INTERFACE "$/include>" -) -#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>) -TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_TOOLS_LIB_TARGET} - PUBLIC ${HDF5_LIB_TARGET} - PRIVATE "$<$:${MPI_C_LIBRARIES}>" -) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) -set (install_targets ${HDF5_TOOLS_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) + target_include_directories (${HDF5_TOOLS_LIB_TARGET} + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>) + TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) + target_link_libraries (${HDF5_TOOLS_LIB_TARGET} + PUBLIC ${HDF5_LIB_TARGET} + PRIVATE "$<$:${MPI_C_LIBRARIES}>" + ) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0) + set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) + set (install_targets ${HDF5_TOOLS_LIB_TARGET}) +endif () if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) - target_include_directories(${HDF5_TOOLS_LIBSH_TARGET} + target_include_directories (${HDF5_TOOLS_LIBSH_TARGET} PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" INTERFACE "$/include>" ) @@ -82,7 +84,9 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) endif () - INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + if (NOT ONLY_SHARED_LIBS) + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + endif () install ( TARGETS diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 10b3f3d..85233ef 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5COPY C) # -------------------------------------------------------------------- # Add the h5copy and test executables # -------------------------------------------------------------------- -add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) -target_include_directories(h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5copy STATIC) -target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5copy PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) + target_include_directories (h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5copy STATIC) + target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5copy PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") -set (H5_DEP_EXECUTABLES h5copy) + set (H5_DEP_EXECUTABLES h5copy) +endif () if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - target_include_directories(h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5copy-shared SHARED) target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index 671e6b6..96ed6ad 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -4,24 +4,25 @@ project (HDF5_TOOLS_SRC_H5DIFF C) # -------------------------------------------------------------------- # Add the h5diff executables # -------------------------------------------------------------------- -add_executable (h5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c -) -target_include_directories(h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5diff STATIC) -target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5diff PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") - -set (H5_DEP_EXECUTABLES h5diff) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c + ) + target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5diff STATIC) + target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5diff PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") + set (H5_DEP_EXECUTABLES h5diff) +endif () if (BUILD_SHARED_LIBS) add_executable (h5diff-shared ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) - target_include_directories(h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diff-shared SHARED) target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) @@ -31,15 +32,30 @@ if (BUILD_SHARED_LIBS) endif () if (H5_HAVE_PARALLEL) - add_executable (ph5diff - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c - ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c - ) - target_include_directories(ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (ph5diff STATIC) - target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") - set_target_properties (ph5diff PROPERTIES FOLDER tools) - set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") + if (NOT ONLY_SHARED_LIBS) + add_executable (ph5diff + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + target_include_directories (ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (ph5diff STATIC) + target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>") + set_target_properties (ph5diff PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff) + endif () + if (BUILD_SHARED_LIBS) + add_executable (ph5diff-shared + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c + ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c + ) + target_include_directories (ph5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (ph5diff-shared SHARED) + target_link_libraries (ph5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>") + set_target_properties (ph5diff-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff-shared") + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} ph5diff-shared) + endif () endif () ############################################################################## @@ -63,16 +79,4 @@ if (HDF5_EXPORTED_TARGETS) ${HDF5_EXPORTED_TARGETS} RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications ) - - if (H5_HAVE_PARALLEL) - #INSTALL_PROGRAM_PDB (ph5diff ${HDF5_INSTALL_BIN_DIR} toolsapplications) - - install ( - TARGETS - ph5diff - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications - ) - endif () endif () diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 25166c7..383b04e 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5DUMP C) # -------------------------------------------------------------------- # Add the h5dump executables # -------------------------------------------------------------------- -add_executable (h5dump - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c - ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c -) -target_include_directories(h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5dump STATIC) -target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5dump PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5dump + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c + ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c + ) + target_include_directories (h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5dump STATIC) + target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5dump PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") -set (H5_DEP_EXECUTABLES h5dump) + set (H5_DEP_EXECUTABLES h5dump) +endif () if (BUILD_SHARED_LIBS) add_executable (h5dump-shared @@ -23,7 +25,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) - target_include_directories(h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5dump-shared SHARED) target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5dump-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index 79a1316..540be8c 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -4,14 +4,26 @@ project (HDF5_TOOLS_SRC_H5FC C) # -------------------------------------------------------------------- # Add the h5format_convert executables # -------------------------------------------------------------------- -add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) -target_include_directories(h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5format_convert STATIC) -target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5format_convert PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) + target_include_directories (h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5format_convert STATIC) + target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5format_convert PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") -set (H5_DEP_EXECUTABLES h5format_convert) + set (H5_DEP_EXECUTABLES h5format_convert) +endif () +if (BUILD_SHARED_LIBS) + add_executable (h5format_convert-shared ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) + target_include_directories (h5format_convert-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5format_convert-shared SHARED) + target_link_libraries (h5format_convert-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5format_convert-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5format_convert-shared) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index 7b38420..dd7921d 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -4,15 +4,29 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # -------------------------------------------------------------------- # Add the h5import executables # -------------------------------------------------------------------- -add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) -target_include_directories(h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5import STATIC) -target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -#set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) -set_target_properties (h5import PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + target_include_directories (h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5import STATIC) + target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) + set_target_properties (h5import PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") -set (H5_DEP_EXECUTABLES h5import) + set (H5_DEP_EXECUTABLES h5import) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (h5import-shared ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) + target_include_directories (h5import-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5import-shared SHARED) + target_link_libraries (h5import-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + #set_target_properties (h5import-shared PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) + set_target_properties (h5import-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5import-shared) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index c455b2f..f430417 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -4,24 +4,47 @@ project (HDF5_TOOLS_SRC_H5JAM C) # -------------------------------------------------------------------- # Add the h5jam executables # -------------------------------------------------------------------- -add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) -target_include_directories(h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5jam STATIC) -target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5jam PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") - -add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) -target_include_directories(h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5unjam STATIC) -target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5unjam PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") - -set (H5_DEP_EXECUTABLES - h5jam - h5unjam -) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) + target_include_directories (h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5jam STATIC) + target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5jam PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") + + add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) + target_include_directories (h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5unjam STATIC) + target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5unjam PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") + + set (H5_DEP_EXECUTABLES + h5jam + h5unjam + ) +endif () + +if (BUILD_SHARED_LIBS) + add_executable (h5jam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) + target_include_directories (h5jam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5jam-shared SHARED) + target_link_libraries (h5jam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5jam-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam-shared") + + add_executable (h5unjam-shared ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) + target_include_directories (h5unjam-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5unjam-shared SHARED) + target_link_libraries (h5unjam-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5unjam-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h5jam-shared + h5unjam-shared + ) +endif () ############################################################################## ############################################################################## diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index 5b31b84..f2470fb 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5LS C) #----------------------------------------------------------------------------- # Add the h5ls executable #----------------------------------------------------------------------------- -add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) -target_include_directories(h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5ls STATIC) -target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5ls PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) + target_include_directories (h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5ls STATIC) + target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5ls PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") -set (H5_DEP_EXECUTABLES h5ls) + set (H5_DEP_EXECUTABLES h5ls) +endif () if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - target_include_directories(h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5ls-shared SHARED) target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5ls-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index c0cd558..4a1430e 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -14,18 +14,20 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) -add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) -target_include_directories(h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repack STATIC) -target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5repack PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") - -set (H5_DEP_EXECUTABLES h5repack) +if (NOT ONLY_SHARED_LIBS) + add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) + target_include_directories (h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repack STATIC) + target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5repack PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") + + set (H5_DEP_EXECUTABLES h5repack) +endif () if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - target_include_directories(h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5repack-shared SHARED) target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 56c172c..55c675f 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -4,18 +4,20 @@ project (HDF5_TOOLS_SRC_H5STAT C) # -------------------------------------------------------------------- # Add the h5stat executables # -------------------------------------------------------------------- -add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) -target_include_directories(h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5stat STATIC) -target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5stat PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) + target_include_directories (h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5stat STATIC) + target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5stat PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") -set (H5_DEP_EXECUTABLES h5stat) + set (H5_DEP_EXECUTABLES h5stat) +endif () if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - target_include_directories(h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5stat-shared SHARED) target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 937799f..7c3d7f0 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -5,40 +5,78 @@ project (HDF5_TOOLS_SRC_MISC C) # Add the misc executables # -------------------------------------------------------------------- #-- Misc Executables -add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) -target_include_directories(h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5debug STATIC) -target_link_libraries (h5debug PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5debug PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") +if (NOT ONLY_SHARED_LIBS) + add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) + target_include_directories (h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5debug STATIC) + target_link_libraries (h5debug PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5debug PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") -add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) -target_include_directories(h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repart STATIC) -target_link_libraries (h5repart PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h5repart PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") + add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) + target_include_directories (h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repart STATIC) + target_link_libraries (h5repart PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5repart PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") -add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) -target_include_directories(h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5mkgrp STATIC) -target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5mkgrp PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") + add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) + target_include_directories (h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5mkgrp STATIC) + target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5mkgrp PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") -add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) -target_include_directories(h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5clear STATIC) -target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5clear PROPERTIES FOLDER tools) -set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") + add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) + target_include_directories (h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5clear STATIC) + target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (h5clear PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") -set (H5_DEP_EXECUTABLES - h5debug - h5repart - h5mkgrp - h5clear -) + set (H5_DEP_EXECUTABLES + h5debug + h5repart + h5mkgrp + h5clear + ) +endif () +if (BUILD_SHARED_LIBS) + add_executable (h5debug-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) + target_include_directories (h5debug-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5debug-shared SHARED) + target_link_libraries (h5debug-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5debug-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug-shared") + + add_executable (h5repart-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) + target_include_directories (h5repart-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5repart-shared SHARED) + target_link_libraries (h5repart-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5repart-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart-shared") + + add_executable (h5mkgrp-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) + target_include_directories (h5mkgrp-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5mkgrp-shared SHARED) + target_link_libraries (h5mkgrp-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5mkgrp-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp-shared") + + add_executable (h5clear-shared ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) + target_include_directories (h5clear-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5clear-shared SHARED) + target_link_libraries (h5clear-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5clear-shared PROPERTIES FOLDER tools) + set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear-shared") + + set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} + h5debug-shared + h5repart-shared + h5mkgrp-shared + h5clear-shared + ) +endif () #----------------------------------------------------------------------------- # Generate the h5cc file containing settings needed to compile programs diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index a71a12a..ecf371f 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5COPY C) # -------------------------------------------------------------------- # Add the h5copy test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - target_include_directories(h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5copygentest STATIC) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5COPY_TOOL_PLUGIN_LIB_CORENAME "dynlibcopy") + set (H5COPY_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5COPY_TOOL_PLUGIN_LIB_CORENAME}") + set (H5COPY_TOOL_PLUGIN_LIB_TARGET ${H5COPY_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) + target_include_directories (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5COPY_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5COPY_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5COPY_TOOL_PLUGIN_LIB_TARGET} ${H5COPY_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5COPY_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 85a8788..856aa72 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -45,6 +45,12 @@ endforeach () add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list}) + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -52,7 +58,7 @@ ############################################################################## # - # Perform h5copy according to passing parmeters + # Perform h5copy according to passing parameters # macro (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -67,7 +73,7 @@ add_test ( NAME H5COPY_F-${testname} - COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -81,7 +87,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if (${resultcode} EQUAL 1) @@ -103,7 +109,7 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -117,7 +123,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -149,7 +155,7 @@ add_test ( NAME H5COPY-${testname}-prefill - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -161,14 +167,14 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -190,7 +196,7 @@ add_test ( NAME H5COPY_SAME-${testname}-prefill - COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -202,14 +208,14 @@ add_test ( NAME H5COPY_SAME-${testname} - COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF - COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if (${resultcode} EQUAL 1) @@ -225,7 +231,7 @@ macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () @@ -245,7 +251,7 @@ add_test ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=./testfiles/${testname}.out.out" diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index c0aac36..0a874ec 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- # Add the h5diff and test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - target_include_directories(h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5diffgentest STATIC) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) @@ -18,15 +18,15 @@ endif () # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DIFF_TOOL_PLUGIN_LIB_CORENAME "dynlibdiff") + set (H5DIFF_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DIFF_TOOL_PLUGIN_LIB_TARGET ${H5DIFF_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) + target_include_directories (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DIFF_TOOL_PLUGIN_LIB_TARGET} ${H5DIFF_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -34,12 +34,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DIFF_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 6bce3f7..bbde8f4 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -343,6 +343,12 @@ endif () add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -352,7 +358,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -375,7 +381,7 @@ add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 51938ae..1672774 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5DUMP C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5DUMP_TOOL_PLUGIN_LIB_CORENAME "dynlibdump") + set (H5DUMP_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}") + set (H5DUMP_TOOL_PLUGIN_LIB_TARGET ${H5DUMP_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) + target_include_directories (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5DUMP_TOOL_PLUGIN_LIB_TARGET} ${H5DUMP_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,23 +21,23 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5DUMP_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () # -------------------------------------------------------------------- # Add the h5dump test executable # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - target_include_directories(h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5dumpgentest STATIC) - target_link_libraries (h5dumpgentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5dumpgentest COMMAND $) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index ed3449b..81179e3 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -399,10 +399,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -423,7 +429,7 @@ add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=h5dump-${testname}.out" @@ -452,7 +458,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -473,7 +479,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -488,7 +494,7 @@ macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") @@ -509,7 +515,7 @@ add_test ( NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}-N.out" @@ -524,7 +530,7 @@ macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -545,7 +551,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -567,7 +573,7 @@ macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -589,7 +595,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -625,7 +631,7 @@ set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-output-${resultfile} - COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} + COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) @@ -653,7 +659,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -666,7 +672,7 @@ endif () endmacro () - macro (ADD_H5ERR_MASK_TEST resultfile resultcode) + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -680,21 +686,20 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () - macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode envvar envval) + macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( @@ -708,17 +713,16 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ddl" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" + -D "TEST_ERRREF=${result_errcheck}" -D "TEST_ENV_VAR:STRING=${envvar}" -D "TEST_ENV_VALUE:STRING=${envval}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () @@ -739,7 +743,7 @@ add_test ( NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${conffile}.out" @@ -771,7 +775,7 @@ add_test ( NAME H5DUMP_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" -D "TEST_OUTPUT=${resultfile}.out" @@ -1197,12 +1201,12 @@ # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups - ADD_H5ERR_MASK_TEST (tgroup-2 1 --enable-error-stack --group=/g2 --group / -g /y tgroup.h5) + ADD_H5ERR_MASK_TEST (tgroup-2 1 "h5dump error: unable to open group \"/y\"" --enable-error-stack --group=/g2 --group / -g /y tgroup.h5) # test for displaying simple space datasets ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5) # test for displaying selected datasets - ADD_H5ERR_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) + ADD_H5ERR_MASK_TEST (tdset-2 1 "h5dump error: unable to get link info from \"dset3\"" --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) # test for displaying attributes ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5) @@ -1210,7 +1214,7 @@ ADD_H5_TEST (tattr-2 0 --enable-error-stack -a /\\\\/attr1 --attribute /attr4 --attribute=/attr5 tattr.h5) ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5) # test for header and error messages - ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) + ADD_H5ERR_MASK_TEST (tattr-3 1 "h5dump error: unable to open attribute \"attr\"" --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) # test for displaying at least 9 attributes on root from a be machine ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5) # test for displaying attributes in shared datatype (also in group and dataset) @@ -1224,7 +1228,7 @@ ADD_H5_TEST_N (tslink-2 0 --enable-error-stack -N slink2 tslink.h5) ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5) # test for displaying dangling soft links - ADD_H5ERR_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5) + ADD_H5ERR_MASK_TEST (tslink-D 0 "component not found" --enable-error-stack -d /slink1 tslink.h5) # tests for hard links ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5) @@ -1241,7 +1245,7 @@ ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5) # test for unamed type - ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") + ADD_H5ERR_MASK_TEST (tcomp-3 0 "object '#6632' doesn't exist" "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5) @@ -1257,7 +1261,7 @@ ADD_H5_TEST (tnestedcmpddt 0 --enable-error-stack tnestedcmpddt.h5) # test for options - ADD_H5ERR_MASK_TEST (tall-1 0 --enable-error-stack tall.h5) + ADD_H5ERR_MASK_TEST (tall-1 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack tall.h5) ADD_H5_TEST (tall-2 0 --enable-error-stack --header -g /g1/g1.1 -a attr2 tall.h5) ADD_H5_TEST (tall-3 0 --enable-error-stack -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5) ADD_H5_TEST_N (tall-3 0 --enable-error-stack -N /g2/dset2.1 -N /g1/g1.2/g1.2.1/slink tall.h5) @@ -1288,7 +1292,7 @@ # test for files with array data ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5) # # added for bug# 2092 - tarray1_big.h5 - ADD_H5ERR_MASK_TEST (tarray1_big 0 --enable-error-stack -R tarray1_big.h5) + ADD_H5ERR_MASK_TEST (tarray1_big 0 "Undefined reference pointer" --enable-error-stack -R tarray1_big.h5) ADD_H5_TEST (tarray2 0 --enable-error-stack tarray2.h5) ADD_H5_TEST (tarray3 0 --enable-error-stack tarray3.h5) ADD_H5_TEST (tarray4 0 --enable-error-stack tarray4.h5) @@ -1317,13 +1321,13 @@ ADD_H5_TEST (tlarge_objname 0 --enable-error-stack -w157 tlarge_objname.h5) # test '-A' to suppress data but print attr's - ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5) + ADD_H5ERR_MASK_TEST (tall-2A 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A tall.h5) # test '-A' to suppress attr's but print data - ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5) + ADD_H5ERR_MASK_TEST (tall-2A0 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A 0 tall.h5) # test '-r' to print attributes in ASCII instead of decimal - ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5) + ADD_H5ERR_MASK_TEST (tall-2B 0 "unable to open external file, external link file name = 'somefile'" --enable-error-stack -A -r tall.h5) # test Subsetting ADD_H5_TEST (tall-4s 0 --enable-error-stack --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5) @@ -1352,7 +1356,7 @@ ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5) # test -p with a non existing dataset - ADD_H5ERR_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5) + ADD_H5ERR_MASK_TEST (tperror 1 "h5dump error: unable to get link info from \"bogus\"" --enable-error-stack -p -d bogus tfcontents1.h5) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) @@ -1499,9 +1503,9 @@ # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) - ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) + ADD_H5ERR_MASK_TEST (tdataregR 0 "Undefined reference pointer" --enable-error-stack -R tdatareg.h5) ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5) - ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) + ADD_H5ERR_MASK_TEST (tattrregR 0 "Undefined reference pointer" -R --enable-error-stack tattrreg.h5) ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) # tests for group creation order @@ -1519,21 +1523,21 @@ ADD_H5_TEST (torderattr4 0 --enable-error-stack -H --sort_by=creation_order --sort_order=descending torderattr.h5) # tests for link references and order - ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) - ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) + ADD_H5ERR_MASK_TEST (torderlinks1 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) + ADD_H5ERR_MASK_TEST (torderlinks2 0 "unable to open external file, external link file name = 'fname'" --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) # tests for floating point user defined printf format ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) # tests for traversal of external links - ADD_H5ERR_MASK_TEST (textlinksrc 0 --enable-error-stack textlinksrc.h5) - ADD_H5ERR_MASK_TEST (textlinkfar 0 --enable-error-stack textlinkfar.h5) + ADD_H5ERR_MASK_TEST (textlinksrc 0 "Too many soft links in path" --enable-error-stack textlinksrc.h5) + ADD_H5ERR_MASK_TEST (textlinkfar 0 "Too many soft links in path" --enable-error-stack textlinkfar.h5) # test for dangling external links - ADD_H5ERR_MASK_TEST (textlink 0 --enable-error-stack textlink.h5) + ADD_H5ERR_MASK_TEST (textlink 0 "unable to open external file, external link file name = 'anotherfile'" --enable-error-stack textlink.h5) # test for error stack display (BZ2048) - ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5) + ADD_H5ERR_MASK_ENV_TEST (filter_fail 1 "filter plugins disabled" "HDF5_PLUGIN_PRELOAD" "::" --enable-error-stack filter_fail.h5) # test for -o -y for dataset with attributes ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index a8ccb7d..feb5c68 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -119,10 +119,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -143,7 +149,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index d7e3b88..c557ba4 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -115,10 +115,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -139,7 +145,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -154,7 +160,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -178,7 +184,7 @@ add_test ( NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" -D "TEST_OUTPUT=${resultfile}.out" @@ -195,7 +201,7 @@ macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -216,7 +222,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index e48cec1..a883b86 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -160,6 +160,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -176,7 +182,7 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) + add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") @@ -197,7 +203,7 @@ add_test ( NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 170ba4c..019252f 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -5,16 +5,21 @@ project (HDF5_TOOLS_TEST_H5FC C) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) -target_include_directories(h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) -target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) + target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5fc_chk_idx SHARED) + target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - target_include_directories(h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5fc_gentest STATIC) - target_link_libraries (h5fc_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5fc_gentest COMMAND $) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 5599c1b..e1abc48 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -97,6 +97,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -121,7 +127,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -136,7 +142,7 @@ add_test ( NAME H5FC-${testname}-NA COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -173,7 +179,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -186,7 +192,7 @@ endif () endmacro () - macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile) + macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode result_errcheck testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -209,15 +215,14 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") set (last_test "H5FC-${testname}-${testfile}") @@ -247,7 +252,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -294,7 +299,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -337,7 +342,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}.out" @@ -349,7 +354,7 @@ add_test ( NAME H5FC_CHECK_DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=testfiles/${testname}_chk.out" @@ -475,7 +480,7 @@ # # # h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset) - ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 h5fc_err_level.h5 -v) + ADD_H5_MASK_OUTPUT (h5fc_v_err h5fc_v_err.ddl 1 "h5format_convert error: unable to downgrade dataset \"/DSET_ERR\"" h5fc_err_level.h5 -v) # # # diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 500be58..9364683 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -5,9 +5,14 @@ project (HDF5_TOOLS_TEST_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) -target_include_directories(h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5importtest STATIC) -target_link_libraries (h5importtest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5importtest STATIC) + target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5importtest SHARED) + target_link_libraries (h5importtest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5importtest PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 1090640..9d36276 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -95,10 +95,17 @@ ### 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_H5_TEST testname importfile conffile testfile) # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) if (last_test) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () @@ -116,13 +123,13 @@ ) set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.new" @@ -135,7 +142,7 @@ add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.out" @@ -170,7 +177,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -182,7 +189,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dmp" @@ -196,7 +203,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.imp" @@ -209,7 +216,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d${testfile}.dff" @@ -243,7 +250,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testname}.dmp" @@ -256,7 +263,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testname}.imp" @@ -268,7 +275,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=d-${testname}.dmp" diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index cc70adc..585a8a1 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5JAM C) # -------------------------------------------------------------------- # Add the h5jam test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - target_include_directories(h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5jamgentest STATIC) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) @@ -15,15 +15,25 @@ if (HDF5_BUILD_GENERATORS) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -target_include_directories(getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (getub STATIC) -target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (getub STATIC) + target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (getub SHARED) + target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -target_include_directories(tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (tellub STATIC) -target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (tellub STATIC) + target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (tellub SHARED) + target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (tellub PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 677ba5c..84af48b 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -47,6 +47,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + # ============================================================ # TEST_H5JAM_OUTPUT # For the purpose to verify only output & exitcode from h5jam @@ -54,7 +60,7 @@ macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -69,7 +75,7 @@ add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -90,7 +96,7 @@ macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -105,7 +111,7 @@ add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" @@ -133,7 +139,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.new" @@ -146,7 +152,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${actual}.out" @@ -181,7 +187,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -189,7 +195,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${outfile}.ufile.txt" @@ -200,7 +206,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -261,7 +267,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) @@ -316,7 +322,7 @@ ) set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) - add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) set (compare_test ${chkfile}) diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index dc5804c..0da03c5 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -5,15 +5,15 @@ project (HDF5_TOOLS_TEST_H5LS C) # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) + set (H5LS_TOOL_PLUGIN_LIB_CORENAME "dynlibls") + set (H5LS_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5LS_TOOL_PLUGIN_LIB_CORENAME}") + set (H5LS_TOOL_PLUGIN_LIB_TARGET ${H5LS_TOOL_PLUGIN_LIB_CORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) + target_include_directories (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5LS_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5LS_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5LS_TOOL_PLUGIN_LIB_TARGET} ${H5LS_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -21,12 +21,12 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5LS_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 95af5ab..f4babb6 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -134,10 +134,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -157,7 +163,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -192,7 +198,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -218,7 +224,7 @@ add_test ( NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 562a892..04fb306 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -80,10 +80,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -103,7 +109,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" -D "TEST_OUTPUT=${resultfile}.out" @@ -118,7 +124,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -141,7 +147,7 @@ add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=vds/prefix/${resultfile}.out" diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 890d5d2..92b61fc 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -5,11 +5,16 @@ project (HDF5_TOOLS_TEST_H5REPACK C) # Add h5Repack test executables # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) -target_include_directories(testh5repack_detect_szip +target_include_directories (testh5repack_detect_szip PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) -target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) + target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (testh5repack_detect_szip SHARED) + target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) set (REPACK_COMMON_SOURCES @@ -22,35 +27,40 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) -target_include_directories(h5repacktest +target_include_directories (h5repacktest PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" ) -TARGET_C_PROPERTIES (h5repacktest STATIC) -target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repacktest STATIC) + target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5repacktest SHARED) + target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) +endif () set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- # If plugin library tests can be tested #----------------------------------------------------------------------------- if (BUILD_SHARED_LIBS) - set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") - set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) - set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") - set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}") - set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_CORENAME "dynlibadd") + set (H5REPACK_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_TARGET ${H5REPACK_TOOL_PLUGIN_LIB_CORENAME}) + set (H5REPACK_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers") + set (H5REPACK_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}") + set (H5REPACK_TOOL_PLUGIN_LIB_VTARGET ${H5REPACK_TOOL_PLUGIN_LIB_VCORENAME}) - add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_TARGET} ${H5REPACK_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") - add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) - target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") + add_library (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) + target_include_directories (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} SHARED) + target_link_libraries (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} ${H5REPACK_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") @@ -58,20 +68,20 @@ if (BUILD_SHARED_LIBS) # Copy plugin library to a plugins folder #----------------------------------------------------------------------------- add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) add_custom_command ( - TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} + TARGET ${H5REPACK_TOOL_PLUGIN_LIB_VTARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different - "$" - "${CMAKE_BINARY_DIR}/plugins/$" + "$" + "${CMAKE_BINARY_DIR}/plugins/$" ) endif () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 2ad12ad..3a90b2c 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -157,10 +157,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) @@ -180,7 +186,7 @@ add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=h5repack-${testname}.out" @@ -213,12 +219,12 @@ endif () add_test ( NAME H5REPACK_OLD-${testname} - COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) add_test ( NAME H5REPACK_OLD-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () @@ -245,12 +251,12 @@ endif () add_test ( NAME H5REPACK-${testname} - COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) add_test ( NAME H5REPACK-${testname}_DFF - COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) endif () @@ -270,7 +276,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -290,7 +296,7 @@ add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -304,7 +310,7 @@ endif () endmacro () - macro (ADD_H5_MASK_TEST testname testtype resultcode resultfile) + macro (ADD_H5_MASK_TEST testname testtype resultcode result_errcheck resultfile) if ("${testtype}" STREQUAL "SKIP") if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -318,7 +324,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) @@ -338,15 +344,15 @@ add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" - -D "TEST_MASK_ERROR=true" + -D "TEST_SKIP_COMPARE=true" -D "TEST_REFERENCE=${resultfile}.mty" - -D "TEST_ERRREF=${resultfile}-${testname}.tst" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -D "TEST_ERRREF=${result_errcheck}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) endif () @@ -376,14 +382,14 @@ endif () add_test ( NAME H5REPACK_DMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -419,14 +425,14 @@ endif () add_test ( NAME H5REPACK_STAT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} ) set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -463,19 +469,19 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -498,7 +504,7 @@ add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -538,14 +544,14 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -575,13 +581,13 @@ endif () add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testfile}-${testname}-v.out" @@ -606,7 +612,7 @@ endif () add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties ( ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES @@ -629,12 +635,12 @@ endif () add_test ( NAME H5REPACK_META-${testname}_N - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) add_test ( NAME H5REPACK_META-${testname}_M - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) @@ -662,7 +668,7 @@ add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_EXPECT=${resultcode}" @@ -677,7 +683,7 @@ add_test ( NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}-${testname}.out" @@ -1222,7 +1228,7 @@ ADD_H5_VERIFY_TEST (conti "TEST" 1 ${FILE4} null CONTIGUOUS -l CONTI) ADD_H5_VERIFY_TEST (dset2_compa "TEST" 0 ${FILE4} dset2 COMPACT -l dset2:COMPA) ADD_H5_VERIFY_TEST (compa "TEST" 1 ${FILE4} null COMPACT -l COMPA) - ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack) + ADD_H5_MASK_TEST (dset2_chunk_20x10-errstk "TEST" 0 "dimensionality of chunks doesn't match the dataspace" ${FILE4} --layout=dset2:CHUNK=20x10x5 --enable-error-stack) ################################################################ # layout conversions (file has no filters) diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index e65c76f..f3bd20b 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -4,9 +4,9 @@ project (HDF5_TOOLS_TEST_H5STAT C) # -------------------------------------------------------------------- # Add the h5stat test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - target_include_directories(h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_include_directories (h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5stat_gentest STATIC) target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 737f4b5..63886d0 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -93,10 +93,16 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -117,7 +123,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" @@ -132,7 +138,7 @@ macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -153,7 +159,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 556b5b2..f5e3ea3 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -4,18 +4,28 @@ project (HDF5_TOOLS_TEST_MISC C) # -------------------------------------------------------------------- # Add the misc test executables # -------------------------------------------------------------------- -if (HDF5_BUILD_GENERATORS) +if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - target_include_directories(h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5repart_gentest STATIC) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5repart_gentest SHARED) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - target_include_directories(h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5clear_gentest STATIC) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5clear_gentest SHARED) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $) @@ -24,15 +34,25 @@ if (HDF5_BUILD_GENERATORS) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) -target_include_directories(h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5repart_test STATIC) -target_link_libraries (h5repart_test PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_test STATIC) + target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5repart_test SHARED) + target_link_libraries (h5repart_test PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5repart_test PROPERTIES FOLDER tools) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) -target_include_directories(clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (clear_open_chk STATIC) -target_link_libraries (clear_open_chk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (clear_open_chk STATIC) + target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (clear_open_chk SHARED) + target_link_libraries (clear_open_chk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (clear_open_chk PROPERTIES FOLDER tools) include (CMakeTestsRepart.cmake) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 24774fd..c7b2fe9 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -83,6 +83,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + # Need special dependencies for tests that use the same reference file # This is an issue on Windows macro (ADD_H5_CMP testname resultfile resultcode) @@ -100,7 +106,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -128,7 +134,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -165,7 +171,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -201,7 +207,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}.out" @@ -219,7 +225,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_RET-${testname} - COMMAND $ ${ARGN} + COMMAND $ ${ARGN} ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") @@ -255,7 +261,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_before_size.out" @@ -267,12 +273,12 @@ if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment=${incr_size} ${testname}.h5 + COMMAND $ --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment ${testname}.h5 + COMMAND $ --increment ${testname}.h5 ) endif () set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") @@ -281,7 +287,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" @@ -317,7 +323,7 @@ endif () # After "h5clear" the file, the subsequent file open succeeds - add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) + add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode}) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND $ ${testfile}.h5) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index 87d3a20..db1f805 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -54,6 +54,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + macro (ADD_H5_TEST resultfile resultcode resultoption) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -69,7 +75,7 @@ add_test ( NAME H5MKGRP-${resultfile} - COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (HDF5_ENABLE_USING_MEMCHECKER) @@ -81,7 +87,7 @@ add_test ( NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" @@ -110,7 +116,7 @@ add_test ( NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${resultfile}.out" diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 8edd243..53949a2 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -58,6 +58,12 @@ ############################################################################## ############################################################################## + if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") + else () + set (tgt_ext "-shared") + endif () + # Remove any output file left over from previous test run add_test ( NAME H5REPART-clearall-objects @@ -74,25 +80,25 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) + add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes (old argument) - add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart ) diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 98bce4d..092cabc 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -3,9 +3,14 @@ project (HDF5_TOOLS_TEST_MISC_VDS C) MACRO (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (${genfile} STATIC) - target_link_libraries (${genfile} PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (${genfile} STATIC) + target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${genfile} SHARED) + target_link_libraries (${genfile} PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) ENDMACRO () diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index fa41608..77b154a 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -10,9 +10,14 @@ set (h5perf_serial_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -target_include_directories(h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5perf_serial STATIC) -target_link_libraries (h5perf_serial PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_serial STATIC) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5perf_serial SHARED) + target_link_libraries (h5perf_serial PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (h5perf_serial PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -20,11 +25,17 @@ if (HDF5_BUILD_PERFORM_STANDALONE) set (h5perf_serial_alone_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - target_include_directories(h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) - target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf_serial_alone SHARED) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE @@ -36,9 +47,14 @@ set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) add_executable(chunk ${chunk_SOURCES}) -target_include_directories(chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (chunk STATIC) -target_link_libraries(chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (chunk STATIC) + target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (chunk SHARED) + target_link_libraries (chunk PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (chunk PROPERTIES FOLDER perform) #-- Adding test for iopipe @@ -46,9 +62,14 @@ set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -target_include_directories(iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (iopipe STATIC) -target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (iopipe STATIC) + target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (iopipe SHARED) + target_link_libraries (iopipe PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (iopipe PROPERTIES FOLDER perform) #-- Adding test for overhead @@ -56,9 +77,14 @@ set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -target_include_directories(overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (overhead STATIC) -target_link_libraries (overhead PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories (overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (overhead STATIC) + target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (overhead SHARED) + target_link_libraries (overhead PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (overhead PROPERTIES FOLDER perform) #-- Adding test for perf_meta @@ -66,9 +92,14 @@ set (perf_meta_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) -target_include_directories(perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (perf_meta STATIC) -target_link_libraries (perf_meta PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories (perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf_meta STATIC) + target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (perf_meta SHARED) + target_link_libraries (perf_meta PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) +endif () set_target_properties (perf_meta PROPERTIES FOLDER perform) #-- Adding test for zip_perf @@ -76,9 +107,14 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -target_include_directories(zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (zip_perf STATIC) -target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories (zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (zip_perf STATIC) + target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_COMP_LIBS}) +else () + TARGET_C_PROPERTIES (zip_perf SHARED) + target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_COMP_LIBS}) +endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) if (H5_HAVE_PARALLEL AND BUILD_TESTING) @@ -88,9 +124,14 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - target_include_directories(h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf STATIC) - target_link_libraries (h5perf PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories (h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf STATIC) + target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf SHARED) + target_link_libraries (h5perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -98,11 +139,17 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) set (h5perf_alone_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - target_include_directories(h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5perf_alone STATIC) - target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (h5perf_alone STATIC) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5perf_alone SHARED) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (h5perf_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 1c0d621..43a0f64 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -82,6 +82,12 @@ /* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 4fead3f..11de229 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -54,6 +54,12 @@ } while(0) /* POSIX I/O macros */ +#ifdef H5_HAVE_WIN32_API +/* Can't link against the library, so this test will use the older, non-Unicode + * _open() call on Windows. + */ +#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT|O_TRUNC|O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) -- cgit v0.12 From 380200f0eda660edcc23a07a1bdf06266d9e75ce Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 20 Jun 2019 08:30:16 -0500 Subject: Add H5_DLL prefix to fix link --- hl/src/H5LDprivate.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hl/src/H5LDprivate.h b/hl/src/H5LDprivate.h index b52928b..203bcea 100644 --- a/hl/src/H5LDprivate.h +++ b/hl/src/H5LDprivate.h @@ -19,9 +19,9 @@ #include "H5LDpublic.h" /* Store information for a field in for a compound data type */ -/* +/* * Note: This data structure is used by both H5LD.c and hl/tools/h5watch - * This declaration is repeated in tools/lib/h5tools_str.c + * This declaration is repeated in tools/lib/h5tools_str.c */ typedef struct H5LD_memb_t { size_t tot_offset; @@ -30,7 +30,10 @@ typedef struct H5LD_memb_t { char **names; } H5LD_memb_t; -/* +#ifdef __cplusplus +extern "C" { +#endif +/* * Note that these two private routines are called by hl/tools/h5watch. * Have considered the following options: * 1) Repeat the coding in both H5LD.c and h5watch @@ -40,8 +43,12 @@ typedef struct H5LD_memb_t { * #2: these two routines are too specific to be made as public routines * Decide to do #3 at this point of time after some discussion. */ -void H5LD_clean_vector(H5LD_memb_t *listv[]); -int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid); +H5_HLDLL void H5LD_clean_vector(H5LD_memb_t *listv[]); +H5_HLDLL int H5LD_construct_vector(char *fields, H5LD_memb_t *listv[], hid_t par_tid); + +#ifdef __cplusplus +} +#endif #endif /* end _H5LDprivate_H */ -- cgit v0.12 From 8ab0727d54cd147930aea5fdb025f3aeeb4f82c1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 21 Jun 2019 09:51:32 -0500 Subject: Correct sentence structure. --- release_docs/RELEASE.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index fef4c63..663abc7 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -53,15 +53,15 @@ New Features shared. A new option was added to CMake, ONLY_SHARED_LIBS, which will skip building static libraries. Certain utility functions will build with static libs but are not published. Tests are adjusted to use the correct - libraries. + libraries depending on SHARED/STATIC settings. (ADB - 2019/06/12, HDFFV-10805) - Change tools test that test the error stack There are some use cases which can cause the error stack of tools to be - different then the expected. These tests now use grepTest.cmake, this was - changed to allow the error file to be searched for an expected string. + different then the expected output. These tests now use grepTest.cmake, + this was changed to allow the error file to be searched for an expected string. (ADB - 2019/04/15, HDFFV-10741) @@ -370,12 +370,12 @@ Bug Fixes since HDF5-1.10.4 release - Fixed memory leak in scale offset filter In a special case where the MinBits is the same as the number of bits in - the datatype's precision, the filter's data buffer was not freed, causing + the datatype's precision, the filter's data buffer was not freed, causing the memory usage to grow. In general the buffer was freed correctly. The - Minbits are the minimal number of bits to store the data values. Please + Minbits are the minimal number of bits to store the data values. Please see the reference manual for H5Pset_scaleoffset for the detail. - (RL - 2019/3/4, HDFFV-10705) + (RL - 2019/3/4, HDFFV-10705) - Fix hangs with collective metadata reads during chunked dataset I/O -- cgit v0.12 From 5a52a6fa1540eb59acbf812d85f8ca0d2215e9d6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 21 Jun 2019 10:32:58 -0500 Subject: remove duplicated function --- tools/test/perform/pio_standalone.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index bd5fb6f..d5f681e 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -170,6 +170,7 @@ print_version(const char *progname) MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ #endif +#if 0 int h5_set_info_object(void) { @@ -277,3 +278,6 @@ h5_dump_info_object(MPI_Info info) } } + +#endif + -- cgit v0.12 From 00491923f11bf7b44390d41bc4ff3b5455a66b16 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 21 Jun 2019 16:24:30 -0500 Subject: Add lib dir for testing plugins --- tools/test/h5copy/CMakeTests.cmake | 6 ++++++ tools/test/h5diff/CMakeTests.cmake | 2 ++ tools/test/h5dump/CMakeTests.cmake | 1 + tools/test/h5ls/CMakeTests.cmake | 1 + tools/test/h5repack/CMakeTests.cmake | 2 ++ 5 files changed, 12 insertions(+) diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 856aa72..df56f1a 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -291,6 +291,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -306,6 +307,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () @@ -322,6 +324,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD-${testname}) @@ -355,6 +358,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -371,6 +375,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () @@ -387,6 +392,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5COPY_UD_ERR-${testname}-DIFF PROPERTIES DEPENDS H5COPY_UD_ERR-${testname}) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index bbde8f4..604c8a5 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -463,6 +463,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) else () @@ -478,6 +479,7 @@ -D "TEST_APPEND=EXIT CODE:" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 81179e3..682ea4b 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -783,6 +783,7 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clear-objects) diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index f4babb6..cd62297 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -232,6 +232,7 @@ -D "TEST_REFERENCE=${resultfile}.ls" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clear-objects) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 3a90b2c..50be28a 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -677,6 +677,7 @@ -D "TEST_REFERENCE=${testname}.${resultfile}.tst" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects) @@ -691,6 +692,7 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.ddl" -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}") -- cgit v0.12 From 7003d4928776d10317688033e5bab236124f470f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 23 Jun 2019 13:54:17 -0500 Subject: Fix fortran test and test library linking --- fortran/test/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index f7f9038..f0c8ff8 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -50,9 +50,9 @@ if (NOT BUILD_SHARED_LIBS) INTERFACE "$/include>" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) - target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE - ${HDF5_F90_C_LIB_TARGET} - ${HDF5_TEST_LIB_TARGET} + target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE ${HDF5_F90_C_LIB_TARGET} + PUBLIC ${HDF5_TEST_LIB_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES @@ -69,9 +69,9 @@ else () PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" ) TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED) - target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE - ${HDF5_F90_C_LIBSH_TARGET} - ${HDF5_TEST_LIBSH_TARGET} + target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} + PRIVATE ${HDF5_F90_C_LIBSH_TARGET} + PUBLIC ${HDF5_TEST_LIBSH_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES -- cgit v0.12 From 5d954a0214fa92aec884cdbccab10632a925fc08 Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Tue, 25 Jun 2019 01:40:07 +0000 Subject: Squash commit of options to build tools and tests --- MANIFEST | 6 +- Makefile.am | 24 ++- bin/Makefile.am | 57 ++++++ bin/h5cc.in | 399 +++++++++++++++++++++++++++++++++++++++++ bin/h5redeploy.in | 216 ++++++++++++++++++++++ c++/Makefile.am | 8 +- configure.ac | 59 +++++- fortran/Makefile.am | 11 +- hl/Makefile.am | 12 +- hl/c++/Makefile.am | 8 +- hl/fortran/Makefile.am | 8 +- hl/tools/gif2h5/Makefile.am | 12 +- hl/tools/h5watch/Makefile.am | 27 +-- java/Makefile.am | 10 +- release_docs/RELEASE.txt | 12 ++ src/Makefile.am | 10 +- src/libhdf5.settings.in | 2 + tools/Makefile.am | 8 +- tools/src/h5repack/Makefile.am | 2 +- tools/src/misc/Makefile.am | 24 --- tools/src/misc/h5cc.in | 399 ----------------------------------------- tools/src/misc/h5redeploy.in | 216 ---------------------- 22 files changed, 849 insertions(+), 681 deletions(-) create mode 100644 bin/Makefile.am create mode 100644 bin/h5cc.in create mode 100644 bin/h5redeploy.in delete mode 100644 tools/src/misc/h5cc.in delete mode 100644 tools/src/misc/h5redeploy.in diff --git a/MANIFEST b/MANIFEST index 2b04ef2..307bc22 100644 --- a/MANIFEST +++ b/MANIFEST @@ -71,12 +71,15 @@ ./bin/errors _DO_NOT_DISTRIBUTE_ ./bin/genparser ./bin/gcov_script _DO_NOT_DISTRIBUTE_ +./bin/h5cc.in +./bin/h5redeploy.in ./bin/h5vers ./bin/iostats ./bin/locate_sw ./bin/make_err ./bin/make_overflow ./bin/make_vers +./bin/Makefile.am ./bin/makehelp ./bin/mkdirs ./bin/newer @@ -1511,11 +1514,9 @@ ./tools/lib/io_timer.h ./tools/src/misc/Makefile.am -./tools/src/misc/h5cc.in ./tools/src/misc/h5clear.c ./tools/src/misc/h5debug.c ./tools/src/misc/h5mkgrp.c -./tools/src/misc/h5redeploy.in ./tools/src/misc/h5repart.c ./tools/test/misc/Makefile.am ./tools/test/misc/h5repart_gentest.c @@ -3383,6 +3384,7 @@ ./c++/examples/Makefile.in ./c++/Makefile.in ./configure +./bin/Makefile.in ./c++/src/Makefile.in ./c++/test/Makefile.in ./examples/Makefile.in diff --git a/Makefile.am b/Makefile.am index e3e5e3d..af3d634 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,11 +49,6 @@ include $(top_srcdir)/config/commence.am # Conditionals. These conditionals are defined during configure # Define each variable to empty if it is not used to placate pmake -if BUILD_PARALLEL_CONDITIONAL - TESTPARALLEL_DIR =testpar -else - TESTPARALLEL_DIR= -endif if BUILD_CXX_CONDITIONAL CXX_DIR =c++ else @@ -74,9 +69,24 @@ if BUILD_HDF5_HL_CONDITIONAL else HDF5_HL_DIR= endif +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif +if BUILD_TESTS_PARALLEL_CONDITIONAL + TESTPARALLEL_DIR =testpar +else + TESTPARALLEL_DIR= +endif +if BUILD_TOOLS_CONDITIONAL + TOOLS_DIR =tools +else + TOOLS_DIR= +endif -SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \ - $(JAVA_DIR) $(HDF5_HL_DIR) +SUBDIRS = src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) bin $(TOOLS_DIR) . \ + $(CXX_DIR) $(FORTRAN_DIR) $(JAVA_DIR) $(HDF5_HL_DIR) DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples java # Some files generated during configure that should be cleaned diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100644 index 0000000..a39b695 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,57 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am + +# Include src directory +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib + +# These are our main targets +bin_SCRIPTS=h5redeploy + +# Tell automake to clean h5redeploy script +CLEANFILES=h5redeploy + +# These were generated by configure. Remove them only when distclean. +DISTCLEANFILES=h5cc + +# All programs rely on hdf5 library and h5tools library +LDADD=$(LIBH5TOOLS) $(LIBHDF5) + +# How to build h5redeploy script +h5redeploy: h5redeploy.in + @cp $(srcdir)/$@.in $@ + +# h5cc needs custom install and uninstall rules, since it may be +# named h5pcc if hdf5 is being built in parallel mode. +if BUILD_PARALLEL_CONDITIONAL + H5CC_NAME=h5pcc +else + H5CC_NAME=h5cc +endif + +$(DESTDIR)$(bindir): + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; + +install-exec-local: $(DESTDIR)$(bindir) + @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) +uninstall-local: + @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) + +include $(top_srcdir)/config/conclude.am diff --git a/bin/h5cc.in b/bin/h5cc.in new file mode 100644 index 0000000..9c4e3ca --- /dev/null +++ b/bin/h5cc.in @@ -0,0 +1,399 @@ +#! /bin/sh +## +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +## + +# This tool is adapted from the mpicc command of the MPICH Software. + +############################################################################ +## ## +## Things You May Have to Modify: ## +## ## +## If the following paths don't point to the place were HDF5 is installed ## +## on your system (i.e., you received a binary distribution or moved the ## +## files from the originally installed directory to another directory) ## +## then modify them accordingly to represent the new paths. ## +## ## +############################################################################ +prefix="@prefix@" +exec_prefix="@exec_prefix@" +libdir="@libdir@" +includedir="@includedir@" +HL="@HL@" + +############################################################################ +## ## +## Things You Can Modify to Override HDF5 Library Build Components: ## +## ## +## (Advanced usage - know what you're doing - you're on your own here.) ## +## The four variables below can be used to insert paths and flags in ## +## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## +## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## +## $LIBS $clibpath $link_objs $link_args $shared_link ## +## ## +## These settings can be overriden by setting HDF5_CFLAGS, ## +## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## +## ## +############################################################################ +CFLAGSBASE="" +CPPFLAGSBASE="" +LDFLAGSBASE="" +LIBSBASE="" + +############################################################################ +## ## +## You shouldn't have to modify anything below this line. ## +## ## +############################################################################ + +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +host_os="@host_os@" + +prog_name="`basename $0`" + +allargs="" +compile_args="" +libraries="" +link_args="" +link_objs="" +clibpath="" + +do_link="yes" +do_compile="no" +dash_o="no" +dash_c="no" +get_output_file="no" + +SHOW="eval" +CCBASE="@CC@" +CLINKERBASE="@CC@" + +# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. +# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. + +# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's +# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and +# before the hdf5 libraries in $link_args, followed by any external library +# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in +# from the hdf5 build. The order of the flags is intended to give precedence +# to the user's flags. +H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" +H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" +H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" +H5BLD_LIBS="@LIBS@" + +CC="${HDF5_CC:-$CCBASE}" +CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" +CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" +CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" +LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" +LIBS="${HDF5_LIBS:-$LIBSBASE}" + +# If a static library is available, the default will be to use it. If the only +# available library is shared, it will be used by default. The user can +# override either default, although choosing an unavailable library will result +# in link errors. +STATIC_AVAILABLE="@enable_static@" +if test "${STATIC_AVAILABLE}" = "yes"; then + USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" +else + USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" +fi + + +usage() { + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -echo Show all the shell commands executed" + echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" + echo " subdirectories [default: $prefix]" + echo " -show Show the commands without executing them" + echo " -showconfig Show the HDF5 library configuration summary" + echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" + echo " without static libraries]" + echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" + echo " with static libraries]" + echo " " + echo " - the normal compile line options for your compiler." + echo " $prog_name uses the same compiler you used to compile" + echo " HDF5. Check with your compiler's man pages for more" + echo " information on which options are needed." + echo " " + echo " You can override the compiler, linker, and whether or not to use static" + echo " or shared libraries to compile your program by setting the following" + echo " environment variables accordingly:" + echo " " + echo " HDF5_CC - use a different C compiler" + echo " HDF5_CLINKER - use a different linker" + echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" + echo " [default: no except when built with only" + echo " shared libraries]" + echo " " + echo " You can also add or change paths and flags to the compile line using" + echo " the following environment varibles or by assigning them to their counterparts" + echo " in the 'Things You Can Modify to Override...'" section of $prog_name + echo " " + echo " Variable Current value to be replaced" + echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" + echo " HDF5_CFLAGS \"$CFLAGSBASE\"" + echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" + echo " HDF5_LIBS \"$LIBSBASE\"" + echo " " + echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" + echo " is located may link your program with that other hdf5 library version." + echo " " + exit $EXIT_FAILURE +} + +# Show the configuration summary of the library recorded in the +# libhdf5.settings file reside in the lib directory. +showconfigure() +{ + cat ${libdir}/libhdf5.settings + status=$? +} + +# Main +status=$EXIT_SUCCESS + +if test "$#" = "0"; then + # No parameters specified, issue usage statement and exit. + usage +fi + +case "$CC" in + gcc) + kind="gcc" + ;; + mpicc|mpcc|mpicc_r) + # Is this gcc masquarading as an MPI compiler? + if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then + kind="gcc" + else + # Nope + kind="$host_os" + fi + ;; + *) + kind="$host_os" + ;; +esac + +for arg in $@ ; do + if test "x$get_output_file" = "xyes"; then + link_args="$link_args $arg" + output_file="$arg" + get_output_file="no" + continue + fi + + case "$arg" in + -c) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + + if test "x$do_link" = "xyes" -a -n "$output_file"; then + compile_args="$compile_args -o $output_file" + fi + + do_link="no" + dash_c="yes" + ;; + -o) + allargs="$allargs $arg" + dash_o="yes" + + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + link_args="$link_args $arg" + do_link="yes" + get_output_file="yes" + fi + ;; + -E|-M|-MT) + allargs="$allargs $arg" + compile_args="$compile_args $arg" + dash_c="yes" + do_link="no" + ;; + -l*) + libraries=" $libraries $arg " + allargs="$allargs $arg" + ;; + -prefix=*) + prefix="`expr "$arg" : '-prefix=\(.*\)'`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -showconfig) + showconfigure + exit $status + ;; + -shlib) + USE_SHARED_LIB="yes" + ;; + -noshlib) + USE_SHARED_LIB="no" + ;; + -help) + usage + ;; + *\"*) + qarg="'"$arg"'" + allargs="$allargs $qarg" + ;; + *\'*) + qarg='\"'"$arg"'\"' + allargs="$allargs $qarg" + ;; + *) + allargs="$allargs $qarg" + + if test -s "$arg"; then + ext=`expr "$arg" : '.*\(\..*\)'` + + if test "x$ext" = "x.c"; then + do_compile="yes" + compile_args="$compile_args $arg" + fname=`basename $arg .c` + link_objs="$link_objs $fname.o" + elif test "x$ext" = "x.o"; then + if test "x$dash_c" = "xyes"; then + compile_args="$compile_args $arg" + else + do_link="yes" + link_objs="$link_objs $arg" + fi + elif test "x$ext" = "x.a"; then + # This is an archive that we're linking in + libraries=" $libraries $arg " + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + else + compile_args="$compile_args $arg" + link_args="$link_args $arg" + fi + ;; + esac +done + +if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then + # -c was specified. Force do_compile on. + do_compile=yes +fi + +if test "x$do_compile" = "xyes"; then + if test "x$dash_c" != "xyes"; then + compile_args="-c $compile_args" + fi + + $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args + status=$? + + if test "$status" != "0"; then + exit $status + fi +fi + +if test "x$do_link" = "xyes"; then + shared_link="" +# conditionnaly link with the hl library + if test "X$HL" = "Xhl"; then + libraries=" $libraries -lhdf5_hl -lhdf5 " + else + libraries=" $libraries -lhdf5 " + fi + link_args="$link_args -L${libdir}" + + case "$kind" in + gcc|linux*) + # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. + # It appears to want none of them specified. + case "$host_os" in + darwin*) flag="" ;; + *) flag="-Wl,-rpath -Wl," ;; + esac + ;; + hpux*) flag="-Wl,+b -Wl," ;; + freebsd*|solaris*) flag="-R" ;; + rs6000*|aix*) flag="-L" ;; + sgi) flag="-rpath " ;; + *) flag="" ;; + esac + + if test -n "$flag"; then + shared_link="${flag}${libdir}" + fi + + if test "x$USE_SHARED_LIB" != "xyes"; then + # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static + # compile though, so change it to the static version (.a) of the library. + new_libraries="" + for lib in $libraries; do + case "$lib" in + -lhdf5) + new_libraries="$new_libraries ${libdir}/libhdf5.a" + ;; + -lhdf5_hl) + new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" + ;; + *) + new_libraries="$new_libraries $lib" + ;; + esac + done + libraries="$new_libraries" + fi + + for lib in $libraries; do + if echo $link_args | grep " $lib " > /dev/null || + echo $link_args | grep " $lib$" > /dev/null; then + : + else + link_args="$link_args $lib " + fi + done + + # The LIBS are just a bunch of -l* libraries necessary for the HDF5 + # module. It's okay if they're included twice in the compile line. + link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" + + # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's + # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and + # before the hdf5 libraries in $link_args, followed by any external library + # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in + # from the hdf5 build. The order of the flags is intended to give precedence + # to the user's flags. + $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link + status=$? +fi + +exit $status diff --git a/bin/h5redeploy.in b/bin/h5redeploy.in new file mode 100644 index 0000000..242459a --- /dev/null +++ b/bin/h5redeploy.in @@ -0,0 +1,216 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +# + +## Update HDF5 compiler tools after the HDF5 software has been installed ## +## in a new location. ## +## For help page, use "h5redeploy -help" ## +## ## + +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Function definitions + +# show help page +usage() { + # A wonderfully informative "usage" message. + echo "usage: $prog_name [OPTIONS]" + echo " OPTIONS:" + echo " -help|help This help message" + echo " -echo Show all the shell commands executed" + echo " -force No prompt, just do it" + echo " -prefix=DIR New directory to find HDF5 lib/ and include/" + echo " subdirectories [default: current directory]" + echo " -exec-prefix=DIR New directory to find HDF5 lib/" + echo " subdirectory [default: ]" + echo " -libdir=DIR New directory for the HDF5 lib directory" + echo " [default: /lib]" + echo " -includedir=DIR New directory for the HDF5 header files" + echo " [default: /include]" + echo " -tool=TOOL Tool to update. TOOL must be in the current" + echo " directory and writable. [default: $h5tools]" + echo " -show Show the commands without executing them" + echo " " + exit $EXIT_FAILURE +} + +# display variable values +dump_vars(){ + echo "====Showing all variable values=====" + echo prefix=$prefix + echo h5tools=$h5tools + echo "====End Showing=====" +} + +# show actions to be taken +show_action() +{ + echo "Update the following tools because they are now installed at a new directory" + for t in $foundtools; do + echo "${t}:" + echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`" + echo " new setting="\""$prefix"\" + done +} + + +# Report Error message +ERROR() +{ + echo "***ERROR***" + echo "$1" +} + +# Main +# +############################################################################ +## Installation directories: ## +## prefix architecture-independent files. ## +## exec_prefix architecture-dependent files, default is . ## +## libdir libraries, default is /lib. ## +## includedir header files, default is . ## +## Not used here: ## +## bindir executables, . ## +############################################################################ +# Initialization +h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools +foundtools= # tools found and will be modified +fmode= # force mode, default is off +prefix= +exec_prefix= +libdir= +includedir= + +# Parse options +for arg in $@ ; do + case "$arg" in + -prefix=*) + prefix="`echo $arg | cut -f2 -d=`" + ;; + -exec-prefix=*) + exec_prefix="`echo $arg | cut -f2 -d=`" + ;; + -libdir=*) + libdir="`echo $arg | cut -f2 -d=`" + ;; + -includedir=*) + includedir="`echo $arg | cut -f2 -d=`" + ;; + -echo) + set -x + ;; + -show) + SHOW="echo" + ;; + -tool=*) + h5tools="`echo $arg | cut -f2 -d=`" + ;; + -help|help) + usage + ;; + -force) + fmode=yes + ;; + *) + ERROR "Unknown Option($arg)" + usage + exit $EXIT_FAILURE + ;; + esac +done + +# Set to default value, one above where i am, if not given by user +if [ -z "$prefix" ]; then + prefix=`(cd ..;pwd)` +fi +if [ -z "$exec_prefix" ]; then + exec_prefix='${prefix}' # use single quotes to prevent expansion of $ +fi +if [ -z "$libdir" ]; then + libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $ +fi +if [ -z "$includedir" ]; then + includedir='${prefix}'/include # use single quotes to prevent expansion of $ +fi + +for x in $h5tools; do + if [ -f $x ]; then + foundtools="$foundtools $x" + if [ ! -w $x ]; then + ERROR "h5tool($x) is not writable" + exit $EXIT_FAILURE + fi + fi +done + +if [ -z "$foundtools" ]; then + ERROR "found no tools to modify" + exit $EXIT_FAILURE +fi + +# Show actions to be taken and get consent +show_action +# Ask confirmation unless fmode is on +if [ x-$fmode = x- ]; then + echo "Continue? (yes/no)" + read ansx + ans=`echo $ansx | tr "[A-Z]" "[a-z]"` + if [ x-$ans != x-yes ]; then + echo ABORT. No tools changed. + exit $EXIT_FAILURE + fi +fi + + +# Create the update commands +CMDFILE=/tmp/h5redeploy.$$ +touch $CMDFILE +chmod 0600 $CMDFILE +echo "/^prefix=/c" >> $CMDFILE +echo prefix=\""$prefix"\" >> $CMDFILE +echo . >> $CMDFILE +echo "/^exec_prefix=/c" >> $CMDFILE +echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE +echo . >> $CMDFILE +echo "/^libdir=/c" >> $CMDFILE +echo libdir=\""$libdir"\" >> $CMDFILE +echo . >> $CMDFILE +echo "/^includedir=/c" >> $CMDFILE +echo includedir=\""$includedir"\" >> $CMDFILE +echo . >> $CMDFILE +(echo w; echo q) >> $CMDFILE + + +# Update them +if [ "$SHOW" = "echo" ]; then + echo "===Update commands are:====" + cat $CMDFILE + echo "===End Update commands=====" +fi + +for t in $foundtools; do + echo Update $t ... + COMMAND="ed - $t" + if [ "$SHOW" = "echo" ]; then + echo $COMMAND + else + $COMMAND < $CMDFILE + fi +done + + +# Cleanup +rm -f $CMDFILE +exit $EXIT_SUCCESS diff --git a/c++/Makefile.am b/c++/Makefile.am index 94fbefc..92d9f50 100644 --- a/c++/Makefile.am +++ b/c++/Makefile.am @@ -18,9 +18,15 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TEST_DIR = test +else + TEST_DIR= +endif + ## Only recurse into subdirectories if C++ interface is enabled. if BUILD_CXX_CONDITIONAL - SUBDIRS=src test + SUBDIRS=src $(TEST_DIR) endif DIST_SUBDIRS = src test examples diff --git a/configure.ac b/configure.ac index 19c3ed1..6f6a91d 100644 --- a/configure.ac +++ b/configure.ac @@ -944,6 +944,48 @@ fi AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"]) ## ---------------------------------------------------------------------- +## Check if they would like to disable building tests +## + +## This needs to be exposed for the library info file. +AC_SUBST([HDF5_TESTS]) + +## Default is to build tests +HDF5_TESTS=yes + +AC_MSG_CHECKING([if building tests is disabled]) + +AC_ARG_ENABLE([tests], + [AS_HELP_STRING([--enable-tests], + [Compile the HDF5 tests [default=yes]])], + [HDF5_TESTS=$enableval]) + +if test "X$HDF5_TESTS" = "Xno"; then + echo "Building HDF5 tests is disabled" +fi + +## ---------------------------------------------------------------------- +## Check if they would like to disable building tools +## + +## This needs to be exposed for the library info file. +AC_SUBST([HDF5_TOOLS]) + +## Default is to build tests and tools +HDF5_TOOLS=yes + +AC_MSG_CHECKING([if building tools is disabled]) + +AC_ARG_ENABLE([tools], + [AS_HELP_STRING([--enable-tools], + [Compile the HDF5 tools [default=yes]])], + [HDF5_TOOLS=$enableval]) + +if test "X$HDF5_TOOLS" = "Xno"; then + echo "Building HDF5 tools is disabled" +fi + +## ---------------------------------------------------------------------- ## Create libtool. If shared/static libraries are going to be enabled ## or disabled, it should happen before these macros. LT_PREREQ([2.2]) @@ -2512,8 +2554,10 @@ AC_SUBST([PARALLEL_FILTERED_WRITES]) AC_SUBST([LARGE_PARALLEL_IO]) if test -n "$PARALLEL"; then - ## The 'testpar' directory should participate in the build - TESTPARALLEL=testpar + if test "X$HDF5_TESTS" = "Xyes"; then + ## The 'testpar' directory should participate in the build + TESTPARALLEL=testpar + fi ## We are building a parallel library AC_DEFINE([HAVE_PARALLEL], [1], [Define if we have parallel support]) @@ -3357,11 +3401,13 @@ LDFLAGS="$saved_user_LDFLAGS" ## need to be compiled AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"]) -AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) +AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test "X$PARALLEL" = "Xyes"]) AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"]) AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"]) AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) - +AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"]) +AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) +AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"]) ## ---------------------------------------------------------------------- ## Build the Makefiles. @@ -3493,7 +3539,6 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/src/h5ls/Makefile tools/src/h5copy/Makefile tools/src/misc/Makefile - tools/src/misc/h5cc tools/src/h5stat/Makefile tools/test/Makefile tools/test/h5dump/Makefile @@ -3533,6 +3578,8 @@ AC_CONFIG_FILES([src/libhdf5.settings examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh + bin/h5cc + bin/Makefile c++/Makefile c++/src/Makefile c++/src/h5c++ @@ -3595,7 +3642,7 @@ AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; AC_OUTPUT -chmod 755 tools/src/misc/h5cc +chmod 755 bin/h5cc if test "X$HDF_CXX" = "Xyes"; then chmod 755 c++/src/h5c++ fi diff --git a/fortran/Makefile.am b/fortran/Makefile.am index 38084b9..99880dd 100644 --- a/fortran/Makefile.am +++ b/fortran/Makefile.am @@ -22,14 +22,21 @@ include $(top_srcdir)/config/commence.am -if BUILD_PARALLEL_CONDITIONAL +if BUILD_TESTS_PARALLEL_CONDITIONAL TESTPARALLEL_DIR=testpar +else + TESTPARALLEL_DIR= +endif +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR=test +else + TESTSERIAL_DIR= endif # Subdirectories in build order, not including examples directory ## Only recurse into subdirectories if HDF5 is configured to use Fortran. if BUILD_FORTRAN_CONDITIONAL - SUBDIRS=src test $(TESTPARALLEL_DIR) + SUBDIRS=src $(TESTSERIAL_DIR) $(TESTPARALLEL_DIR) endif # All directories that have Makefiles diff --git a/hl/Makefile.am b/hl/Makefile.am index aee1f86..769340c 100644 --- a/hl/Makefile.am +++ b/hl/Makefile.am @@ -31,11 +31,21 @@ endif if BUILD_CXX_CONDITIONAL CXX_DIR = c++ endif +if BUILD_TESTS_CONDITIONAL + TEST_DIR = test +else + TEST_DIR = +endif +if BUILD_TOOLS_CONDITIONAL + TOOLS_DIR = tools +else + TOOLS_DIR = +endif ## Don't recurse into any subdirectories if HDF5 is not configured to ## use the HL library if BUILD_HDF5_HL_CONDITIONAL - SUBDIRS=src test tools $(CXX_DIR) $(FORTRAN_DIR) + SUBDIRS=src $(TEST_DIR) $(TOOLS_DIR) $(CXX_DIR) $(FORTRAN_DIR) endif DIST_SUBDIRS=src test tools c++ fortran examples diff --git a/hl/c++/Makefile.am b/hl/c++/Makefile.am index 1968bf5..f9ea328 100644 --- a/hl/c++/Makefile.am +++ b/hl/c++/Makefile.am @@ -18,7 +18,13 @@ include $(top_srcdir)/config/commence.am -SUBDIRS=src test +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + +SUBDIRS=src $(TESTSERIAL_DIR) DIST_SUBDIRS=src test examples # Install examples diff --git a/hl/fortran/Makefile.am b/hl/fortran/Makefile.am index ad18a21..7d24770 100644 --- a/hl/fortran/Makefile.am +++ b/hl/fortran/Makefile.am @@ -23,7 +23,13 @@ include $(top_srcdir)/config/commence.am -SUBDIRS=src test +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + +SUBDIRS=src $(TESTSERIAL_DIR) DIST_SUBDIRS=src test examples # Install examples diff --git a/hl/tools/gif2h5/Makefile.am b/hl/tools/gif2h5/Makefile.am index d30d66a..9ffde58 100644 --- a/hl/tools/gif2h5/Makefile.am +++ b/hl/tools/gif2h5/Makefile.am @@ -23,11 +23,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/sr # These are our main targets, the tools -TEST_SCRIPT=h52giftest.sh -check_SCRIPTS=$(TEST_SCRIPT) - bin_PROGRAMS=gif2h5 h52gif -noinst_PROGRAMS=h52gifgentst # Add h52gif and gif2h5 specific linker flags here h52gif_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -37,12 +33,18 @@ gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c h52gif_SOURCES=hdf2gif.c hdfgifwr.c -h52gifgentst_SOURCES=h52gifgentst.c # Programs all depend on the hdf5 library, the tools library, and the HL # library. LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) +if BUILD_TESTS_CONDITIONAL + TEST_SCRIPT=h52giftest.sh + check_SCRIPTS=$(TEST_SCRIPT) + noinst_PROGRAMS=h52gifgentst + h52gifgentst_SOURCES=h52gifgentst.c +endif + CHECK_CLEANFILES+=*.h5 CHECK_CLEANFILES+=*.gif diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am index c60fceb..0bf265e 100644 --- a/hl/tools/h5watch/Makefile.am +++ b/hl/tools/h5watch/Makefile.am @@ -19,15 +19,12 @@ include $(top_srcdir)/config/commence.am # Include src and tools/lib directories -AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src -I$(top_srcdir)/hl/test +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src # These are our main targets, the tools -TEST_SCRIPT=testh5watch.sh -check_SCRIPTS=$(TEST_SCRIPT) -SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT) bin_PROGRAMS=h5watch -noinst_PROGRAMS=swmr_check_compat_vfd h5watchgentest extend_dset +noinst_PROGRAMS=swmr_check_compat_vfd # Add h5watch specific linker flags here h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -36,13 +33,19 @@ h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) # library. LDADD=$(LIBH5_HL) $(LIBH5TOOLS) $(LIBHDF5) -# Add extend_dset specific preprocessor flags here -# (add the main test subdirectory to the include file path) -extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test -# Add extend_dset specific library flags here -# (add the main test library to the list of libraries) -extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5) - +if BUILD_TESTS_CONDITIONAL + AM_CPPFLAGS+=-I$(top_srcdir)/hl/test + TEST_SCRIPT=testh5watch.sh + check_SCRIPTS=$(TEST_SCRIPT) + SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT) + noinst_PROGRAMS+=h5watchgentest extend_dset + # Add extend_dset specific preprocessor flags here + # (add the main test subdirectory to the include file path) + extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test + # Add extend_dset specific library flags here + # (add the main test library to the list of libraries) + extend_dset_LDADD=$(LDADD) $(LIBH5TEST) $(LIBHDF5) +endif # CHECK_CLEANFILES+=*.h5 DISTCLEANFILES=testh5watch.sh diff --git a/java/Makefile.am b/java/Makefile.am index 7d0e2f0..68a6e47 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -23,13 +23,21 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test + TESTEXAMPLES_DIR =examples +else + TESTSERIAL_DIR= + TESTEXAMPLES_DIR= +endif + ## Only recurse into subdirectories if the Java (JNI) interface is enabled. if BUILD_JAVA_CONDITIONAL # Mark this directory as part of the JNI API JAVA_API=yes -SUBDIRS=src test examples +SUBDIRS=src $(TESTSERIAL_DIR) $(TESTEXAMPLES_DIR) endif diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 663abc7..700c8c3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -57,6 +57,18 @@ New Features (ADB - 2019/06/12, HDFFV-10805) + - Add options to enable or disable building tools and tests + + Configure options --enable-tests and --enable-tools were added for + autotools configure. These options are enabled by default, and can be + disabled with either --disable-tests (or tools) or --enable-tests=no + (or --enable-tools=no). Build time is reduced ~20% when tools are + disabled, 35% when tests are disabled, 45% when both are disabled. + Reenabling them after the initial build requires running configure + again with the option(s) enabled. + + (LRK - 2019/06/12, HDFFV-9976) + - Change tools test that test the error stack There are some use cases which can cause the error stack of tools to be diff --git a/src/Makefile.am b/src/Makefile.am index 10ef8c6..babbeee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,7 @@ libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_ # H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c # H5pubconf.h is generated by configure, and should be cleaned. -DISTCLEANFILES=H5pubconf.h +DISTCLEANFILES=H5pubconf.h $(H5CC_NAME) # library sources libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ @@ -145,6 +145,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers settingsdir=$(libdir) settings_DATA=libhdf5.settings +bin_SCRIPTS=$(H5CC_NAME) + # Number format detection # The LD_LIBRARY_PATH setting is a kludge. # Things should have been all set during H5detect making. @@ -203,4 +205,10 @@ trace: $(libhdf5_la_SOURCES) fi; \ done +#install-exec-local: +# @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) +#uninstall-local: +# @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) + include $(top_srcdir)/config/conclude.am + diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 9d0e29f..8c46650 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -71,6 +71,8 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_HL@ + Build HDF5 Tests: @HDF5_TESTS@ + Build HDF5 Tools: @HDF5_Tools@ Threadsafety: @THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @DEPRECATED_SYMBOLS@ diff --git a/tools/Makefile.am b/tools/Makefile.am index b0c33ed..4a59121 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -19,9 +19,15 @@ include $(top_srcdir)/config/commence.am +if BUILD_TESTS_CONDITIONAL + TESTSERIAL_DIR =test +else + TESTSERIAL_DIR= +endif + CONFIG=ordered # All subdirectories -SUBDIRS=lib src test +SUBDIRS=lib src $(TESTSERIAL_DIR) include $(top_srcdir)/config/conclude.am diff --git a/tools/src/h5repack/Makefile.am b/tools/src/h5repack/Makefile.am index c71e65b..925b8a7 100644 --- a/tools/src/h5repack/Makefile.am +++ b/tools/src/h5repack/Makefile.am @@ -28,7 +28,7 @@ libh5repack_la_SOURCES=h5repack.c h5repack_copy.c h5repack_filters.c \ h5repack_opttable.c h5repack_parse.c h5repack_refs.c \ h5repack_verify.c libh5repack_la_LDFLAGS = $(AM_LDFLAGS) -libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBH5TEST) $(LIBHDF5) +libh5repack_la_LIBADD=$(LIBH5TOOLS) $(LIBHDF5) # Our main target, h5repack tool diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am index 64c5ee5..f1d2aaf 100644 --- a/tools/src/misc/Makefile.am +++ b/tools/src/misc/Makefile.am @@ -23,7 +23,6 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib # These are our main targets, the tools bin_PROGRAMS=h5debug h5repart h5mkgrp h5clear -bin_SCRIPTS=h5redeploy # Add h5debug, h5repart, and h5mkgrp specific linker flags here h5debug_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -31,30 +30,7 @@ h5repart_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) h5mkgrp_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) h5clear_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) -# Tell automake to clean h5redeploy script -CLEANFILES=h5redeploy - -# These were generated by configure. Remove them only when distclean. -DISTCLEANFILES=h5cc - # All programs rely on hdf5 library and h5tools library LDADD=$(LIBH5TOOLS) $(LIBHDF5) -# h5cc needs custom install and uninstall rules, since it may be -# named h5pcc if hdf5 is being built in parallel mode. -if BUILD_PARALLEL_CONDITIONAL - H5CC_NAME=h5pcc -else - H5CC_NAME=h5cc -endif - -install-exec-local: - @$(INSTALL) h5cc $(DESTDIR)$(bindir)/$(H5CC_NAME) -uninstall-local: - @$(RM) $(DESTDIR)$(bindir)/$(H5CC_NAME) - -# How to build h5redeploy script -h5redeploy: h5redeploy.in - @cp $(srcdir)/$@.in $@ - include $(top_srcdir)/config/conclude.am diff --git a/tools/src/misc/h5cc.in b/tools/src/misc/h5cc.in deleted file mode 100644 index 9c4e3ca..0000000 --- a/tools/src/misc/h5cc.in +++ /dev/null @@ -1,399 +0,0 @@ -#! /bin/sh -## -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# 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. -## - -# This tool is adapted from the mpicc command of the MPICH Software. - -############################################################################ -## ## -## Things You May Have to Modify: ## -## ## -## If the following paths don't point to the place were HDF5 is installed ## -## on your system (i.e., you received a binary distribution or moved the ## -## files from the originally installed directory to another directory) ## -## then modify them accordingly to represent the new paths. ## -## ## -############################################################################ -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@" -HL="@HL@" - -############################################################################ -## ## -## Things You Can Modify to Override HDF5 Library Build Components: ## -## ## -## (Advanced usage - know what you're doing - you're on your own here.) ## -## The four variables below can be used to insert paths and flags in ## -## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## -## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## -## $LIBS $clibpath $link_objs $link_args $shared_link ## -## ## -## These settings can be overriden by setting HDF5_CFLAGS, ## -## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## -## ## -############################################################################ -CFLAGSBASE="" -CPPFLAGSBASE="" -LDFLAGSBASE="" -LIBSBASE="" - -############################################################################ -## ## -## You shouldn't have to modify anything below this line. ## -## ## -############################################################################ - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -host_os="@host_os@" - -prog_name="`basename $0`" - -allargs="" -compile_args="" -libraries="" -link_args="" -link_objs="" -clibpath="" - -do_link="yes" -do_compile="no" -dash_o="no" -dash_c="no" -get_output_file="no" - -SHOW="eval" -CCBASE="@CC@" -CLINKERBASE="@CC@" - -# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. -# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. - -# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's -# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and -# before the hdf5 libraries in $link_args, followed by any external library -# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in -# from the hdf5 build. The order of the flags is intended to give precedence -# to the user's flags. -H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" -H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" -H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" -H5BLD_LIBS="@LIBS@" - -CC="${HDF5_CC:-$CCBASE}" -CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" -CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" -CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" -LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" -LIBS="${HDF5_LIBS:-$LIBSBASE}" - -# If a static library is available, the default will be to use it. If the only -# available library is shared, it will be used by default. The user can -# override either default, although choosing an unavailable library will result -# in link errors. -STATIC_AVAILABLE="@enable_static@" -if test "${STATIC_AVAILABLE}" = "yes"; then - USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" -else - USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" -fi - - -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] " - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] " - echo " OPTIONS:" - echo " -help This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - echo " -show Show the commands without executing them" - echo " -showconfig Show the HDF5 library configuration summary" - echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" - echo " without static libraries]" - echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" - echo " with static libraries]" - echo " " - echo " - the normal compile line options for your compiler." - echo " $prog_name uses the same compiler you used to compile" - echo " HDF5. Check with your compiler's man pages for more" - echo " information on which options are needed." - echo " " - echo " You can override the compiler, linker, and whether or not to use static" - echo " or shared libraries to compile your program by setting the following" - echo " environment variables accordingly:" - echo " " - echo " HDF5_CC - use a different C compiler" - echo " HDF5_CLINKER - use a different linker" - echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" - echo " [default: no except when built with only" - echo " shared libraries]" - echo " " - echo " You can also add or change paths and flags to the compile line using" - echo " the following environment varibles or by assigning them to their counterparts" - echo " in the 'Things You Can Modify to Override...'" section of $prog_name - echo " " - echo " Variable Current value to be replaced" - echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" - echo " HDF5_CFLAGS \"$CFLAGSBASE\"" - echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" - echo " HDF5_LIBS \"$LIBSBASE\"" - echo " " - echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" - echo " is located may link your program with that other hdf5 library version." - echo " " - exit $EXIT_FAILURE -} - -# Show the configuration summary of the library recorded in the -# libhdf5.settings file reside in the lib directory. -showconfigure() -{ - cat ${libdir}/libhdf5.settings - status=$? -} - -# Main -status=$EXIT_SUCCESS - -if test "$#" = "0"; then - # No parameters specified, issue usage statement and exit. - usage -fi - -case "$CC" in - gcc) - kind="gcc" - ;; - mpicc|mpcc|mpicc_r) - # Is this gcc masquarading as an MPI compiler? - if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then - kind="gcc" - else - # Nope - kind="$host_os" - fi - ;; - *) - kind="$host_os" - ;; -esac - -for arg in $@ ; do - if test "x$get_output_file" = "xyes"; then - link_args="$link_args $arg" - output_file="$arg" - get_output_file="no" - continue - fi - - case "$arg" in - -c) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - - if test "x$do_link" = "xyes" -a -n "$output_file"; then - compile_args="$compile_args -o $output_file" - fi - - do_link="no" - dash_c="yes" - ;; - -o) - allargs="$allargs $arg" - dash_o="yes" - - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - link_args="$link_args $arg" - do_link="yes" - get_output_file="yes" - fi - ;; - -E|-M|-MT) - allargs="$allargs $arg" - compile_args="$compile_args $arg" - dash_c="yes" - do_link="no" - ;; - -l*) - libraries=" $libraries $arg " - allargs="$allargs $arg" - ;; - -prefix=*) - prefix="`expr "$arg" : '-prefix=\(.*\)'`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -showconfig) - showconfigure - exit $status - ;; - -shlib) - USE_SHARED_LIB="yes" - ;; - -noshlib) - USE_SHARED_LIB="no" - ;; - -help) - usage - ;; - *\"*) - qarg="'"$arg"'" - allargs="$allargs $qarg" - ;; - *\'*) - qarg='\"'"$arg"'\"' - allargs="$allargs $qarg" - ;; - *) - allargs="$allargs $qarg" - - if test -s "$arg"; then - ext=`expr "$arg" : '.*\(\..*\)'` - - if test "x$ext" = "x.c"; then - do_compile="yes" - compile_args="$compile_args $arg" - fname=`basename $arg .c` - link_objs="$link_objs $fname.o" - elif test "x$ext" = "x.o"; then - if test "x$dash_c" = "xyes"; then - compile_args="$compile_args $arg" - else - do_link="yes" - link_objs="$link_objs $arg" - fi - elif test "x$ext" = "x.a"; then - # This is an archive that we're linking in - libraries=" $libraries $arg " - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - ;; - esac -done - -if test "$dash_c" = "yes" -a "$do_compile" = no -a "$do_link" = no ; then - # -c was specified. Force do_compile on. - do_compile=yes -fi - -if test "x$do_compile" = "xyes"; then - if test "x$dash_c" != "xyes"; then - compile_args="-c $compile_args" - fi - - $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args - status=$? - - if test "$status" != "0"; then - exit $status - fi -fi - -if test "x$do_link" = "xyes"; then - shared_link="" -# conditionnaly link with the hl library - if test "X$HL" = "Xhl"; then - libraries=" $libraries -lhdf5_hl -lhdf5 " - else - libraries=" $libraries -lhdf5 " - fi - link_args="$link_args -L${libdir}" - - case "$kind" in - gcc|linux*) - # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. - # It appears to want none of them specified. - case "$host_os" in - darwin*) flag="" ;; - *) flag="-Wl,-rpath -Wl," ;; - esac - ;; - hpux*) flag="-Wl,+b -Wl," ;; - freebsd*|solaris*) flag="-R" ;; - rs6000*|aix*) flag="-L" ;; - sgi) flag="-rpath " ;; - *) flag="" ;; - esac - - if test -n "$flag"; then - shared_link="${flag}${libdir}" - fi - - if test "x$USE_SHARED_LIB" != "xyes"; then - # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static - # compile though, so change it to the static version (.a) of the library. - new_libraries="" - for lib in $libraries; do - case "$lib" in - -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" - ;; - -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" - ;; - *) - new_libraries="$new_libraries $lib" - ;; - esac - done - libraries="$new_libraries" - fi - - for lib in $libraries; do - if echo $link_args | grep " $lib " > /dev/null || - echo $link_args | grep " $lib$" > /dev/null; then - : - else - link_args="$link_args $lib " - fi - done - - # The LIBS are just a bunch of -l* libraries necessary for the HDF5 - # module. It's okay if they're included twice in the compile line. - link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - - # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's - # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and - # before the hdf5 libraries in $link_args, followed by any external library - # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in - # from the hdf5 build. The order of the flags is intended to give precedence - # to the user's flags. - $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link - status=$? -fi - -exit $status diff --git a/tools/src/misc/h5redeploy.in b/tools/src/misc/h5redeploy.in deleted file mode 100644 index 242459a..0000000 --- a/tools/src/misc/h5redeploy.in +++ /dev/null @@ -1,216 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# Copyright by the Board of Trustees of the University of Illinois. -# 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. -# - -## Update HDF5 compiler tools after the HDF5 software has been installed ## -## in a new location. ## -## For help page, use "h5redeploy -help" ## -## ## - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -# Function definitions - -# show help page -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS]" - echo " OPTIONS:" - echo " -help|help This help message" - echo " -echo Show all the shell commands executed" - echo " -force No prompt, just do it" - echo " -prefix=DIR New directory to find HDF5 lib/ and include/" - echo " subdirectories [default: current directory]" - echo " -exec-prefix=DIR New directory to find HDF5 lib/" - echo " subdirectory [default: ]" - echo " -libdir=DIR New directory for the HDF5 lib directory" - echo " [default: /lib]" - echo " -includedir=DIR New directory for the HDF5 header files" - echo " [default: /include]" - echo " -tool=TOOL Tool to update. TOOL must be in the current" - echo " directory and writable. [default: $h5tools]" - echo " -show Show the commands without executing them" - echo " " - exit $EXIT_FAILURE -} - -# display variable values -dump_vars(){ - echo "====Showing all variable values=====" - echo prefix=$prefix - echo h5tools=$h5tools - echo "====End Showing=====" -} - -# show actions to be taken -show_action() -{ - echo "Update the following tools because they are now installed at a new directory" - for t in $foundtools; do - echo "${t}:" - echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`" - echo " new setting="\""$prefix"\" - done -} - - -# Report Error message -ERROR() -{ - echo "***ERROR***" - echo "$1" -} - -# Main -# -############################################################################ -## Installation directories: ## -## prefix architecture-independent files. ## -## exec_prefix architecture-dependent files, default is . ## -## libdir libraries, default is /lib. ## -## includedir header files, default is . ## -## Not used here: ## -## bindir executables, . ## -############################################################################ -# Initialization -h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools -foundtools= # tools found and will be modified -fmode= # force mode, default is off -prefix= -exec_prefix= -libdir= -includedir= - -# Parse options -for arg in $@ ; do - case "$arg" in - -prefix=*) - prefix="`echo $arg | cut -f2 -d=`" - ;; - -exec-prefix=*) - exec_prefix="`echo $arg | cut -f2 -d=`" - ;; - -libdir=*) - libdir="`echo $arg | cut -f2 -d=`" - ;; - -includedir=*) - includedir="`echo $arg | cut -f2 -d=`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -tool=*) - h5tools="`echo $arg | cut -f2 -d=`" - ;; - -help|help) - usage - ;; - -force) - fmode=yes - ;; - *) - ERROR "Unknown Option($arg)" - usage - exit $EXIT_FAILURE - ;; - esac -done - -# Set to default value, one above where i am, if not given by user -if [ -z "$prefix" ]; then - prefix=`(cd ..;pwd)` -fi -if [ -z "$exec_prefix" ]; then - exec_prefix='${prefix}' # use single quotes to prevent expansion of $ -fi -if [ -z "$libdir" ]; then - libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $ -fi -if [ -z "$includedir" ]; then - includedir='${prefix}'/include # use single quotes to prevent expansion of $ -fi - -for x in $h5tools; do - if [ -f $x ]; then - foundtools="$foundtools $x" - if [ ! -w $x ]; then - ERROR "h5tool($x) is not writable" - exit $EXIT_FAILURE - fi - fi -done - -if [ -z "$foundtools" ]; then - ERROR "found no tools to modify" - exit $EXIT_FAILURE -fi - -# Show actions to be taken and get consent -show_action -# Ask confirmation unless fmode is on -if [ x-$fmode = x- ]; then - echo "Continue? (yes/no)" - read ansx - ans=`echo $ansx | tr "[A-Z]" "[a-z]"` - if [ x-$ans != x-yes ]; then - echo ABORT. No tools changed. - exit $EXIT_FAILURE - fi -fi - - -# Create the update commands -CMDFILE=/tmp/h5redeploy.$$ -touch $CMDFILE -chmod 0600 $CMDFILE -echo "/^prefix=/c" >> $CMDFILE -echo prefix=\""$prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^exec_prefix=/c" >> $CMDFILE -echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^libdir=/c" >> $CMDFILE -echo libdir=\""$libdir"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^includedir=/c" >> $CMDFILE -echo includedir=\""$includedir"\" >> $CMDFILE -echo . >> $CMDFILE -(echo w; echo q) >> $CMDFILE - - -# Update them -if [ "$SHOW" = "echo" ]; then - echo "===Update commands are:====" - cat $CMDFILE - echo "===End Update commands=====" -fi - -for t in $foundtools; do - echo Update $t ... - COMMAND="ed - $t" - if [ "$SHOW" = "echo" ]; then - echo $COMMAND - else - $COMMAND < $CMDFILE - fi -done - - -# Cleanup -rm -f $CMDFILE -exit $EXIT_SUCCESS -- cgit v0.12 From a4618f964934df3ad74dcee67d2ccb0ee7d06cf9 Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Tue, 25 Jun 2019 02:12:27 +0000 Subject: Minor fix in libhdf5.settings.in --- src/libhdf5.settings.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 8c46650..f856ebc 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -72,7 +72,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_HL@ Build HDF5 Tests: @HDF5_TESTS@ - Build HDF5 Tools: @HDF5_Tools@ + Build HDF5 Tools: @HDF5_TOOLS@ Threadsafety: @THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @DEPRECATED_SYMBOLS@ -- cgit v0.12 From 194c3faf954b32e9747fd5e64144438d9287786e Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Tue, 25 Jun 2019 05:41:13 +0000 Subject: Added Tests/Tools to libhdf5.settings in cmake equivalent --- config/cmake/libhdf5.settings.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 9e91ac0..092dd66 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -68,6 +68,8 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_BUILD_HL_LIB@ + Build HDF5 Tests: @HDF5_TESTS@ + Build HDF5 Tools: @HDF5_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ -- cgit v0.12 From ef683f76664dba8173cf83d6049425c15971b836 Mon Sep 17 00:00:00 2001 From: Dhvanil Popat Date: Tue, 25 Jun 2019 07:17:32 +0000 Subject: Fixed options for CMake to correct names --- config/cmake/libhdf5.settings.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 092dd66..97929e6 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -68,8 +68,8 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_BUILD_HL_LIB@ - Build HDF5 Tests: @HDF5_TESTS@ - Build HDF5 Tools: @HDF5_TOOLS@ + Build HDF5 Tests: @BUILD_TESTS@ + Build HDF5 Tools: @HDF5_BUILD_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ -- cgit v0.12 From 6d1c05b8d248a3e9ae8797e20744fdf5b2319af5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 25 Jun 2019 10:22:47 -0500 Subject: HDFFV-9407 Merge test addition from develop --- MANIFEST | 1 + config/cmake/CTestCustom.cmake | 1 + tools/test/h5dump/CMakeTests.cmake | 30 ++++++++++++++++++++++++++++++ tools/test/h5dump/testh5dump.sh.in | 37 ++++++++++++++++++++++++++++++++++++- tools/testfiles/t128bit_float.h5 | Bin 0 -> 2160 bytes 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tools/testfiles/t128bit_float.h5 diff --git a/MANIFEST b/MANIFEST index 7a59414..2b04ef2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1663,6 +1663,7 @@ ./tools/testfiles/h5dump-help.txt ./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl +./tools/testfiles/t128bit_float.h5 ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 2333f67..a3a1652 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -94,6 +94,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects H5DUMP_VDS-clearall-objects + H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects ######### tools/h5import ######### diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 682ea4b..7f52796 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -318,6 +318,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5 ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 + ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 ) set (HDF5_ERROR_REFERENCE_TEST_FILES @@ -672,6 +673,32 @@ endif () endmacro () + macro (ADD_H5_GREP_TEST resultfile resultcode result_check) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${result_check}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + endif () + endmacro () + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -1546,6 +1573,9 @@ # test for non-existing file ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) + # test to verify HDFFV-9407: long double full precision + ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) + ############################################################################## ### P L U G I N T E S T S ############################################################################## diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 9b1543c..507556f 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -34,6 +34,7 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' CMP='cmp' DIFF='diff -c' +GREP='grep' CP='cp' DIRNAME='dirname' LS='ls' @@ -81,6 +82,7 @@ $SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 +$SRC_H5DUMP_TESTFILES/t128bit_float.h5 $SRC_H5DUMP_TESTFILES/taindices.h5 $SRC_H5DUMP_TESTFILES/tall.h5 $SRC_H5DUMP_TESTFILES/tarray1.h5 @@ -752,7 +754,7 @@ TOOLTEST4() { TESTING $DUMPER $@ ( cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -899,6 +901,36 @@ TOOLTEST_HELP() { } +# Call the h5dump tool and grep for a value +# +GREPTEST() +{ + expectdata=$1 + actual=$TESTDIR/$2 + actual_err="$TESTDIR/`basename $2 .ddl`.oerr" + shift + shift + + # Run test. + TESTING $DUMPER -p $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + ) >$actual 2>$actual_err + $GREP $expectdata $actual > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi +} + # Print a "SKIP" message SKIP() { TESTING $DUMPER $@ @@ -1356,6 +1388,9 @@ TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 # test for non-existing file TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 +# test to verify HDFFV-9407: long double full precision +GREPTEST "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/testfiles/t128bit_float.h5 b/tools/testfiles/t128bit_float.h5 new file mode 100644 index 0000000..134d510 Binary files /dev/null and b/tools/testfiles/t128bit_float.h5 differ -- cgit v0.12 From f8a4c39577b85ac839b29afdee74fe0c9e241ce2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 27 Jun 2019 12:43:23 -0500 Subject: Merge parallel static fix from develop --- tools/test/perform/pio_standalone.c | 118 ----------------------------------- tools/test/perform/sio_standalone.c | 119 ------------------------------------ 2 files changed, 237 deletions(-) diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index d5f681e..dd6a61a 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -163,121 +163,3 @@ print_version(const char *progname) } - -/** From h5test.c **/ - -#ifdef H5_HAVE_PARALLEL -MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ -#endif - -#if 0 -int -h5_set_info_object(void) -{ - char *envp; /* environment pointer */ - int ret_value=0; - - /* handle any MPI INFO hints via $HDF5_MPI_INFO */ - if ((envp = getenv("HDF5_MPI_INFO")) != NULL){ - char *next, *valp; - - - valp = envp = next = HDstrdup(envp); - - /* create an INFO object if not created yet */ - if (h5_io_info_g == MPI_INFO_NULL) - MPI_Info_create(&h5_io_info_g); - - do { - size_t len; - char *key_val, *endp, *namep; - - if (*valp == ';') - valp++; - - /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; - key_val = calloc(1, len + 1); - - /* increment the next pointer past the terminating semicolon */ - if (*next == ';') - ++next; - - namep = HDstrncpy(key_val, valp, len); - - /* pass up any beginning whitespaces */ - while (*namep && (*namep == ' ' || *namep == '\t')) - namep++; - - /* eat up any ending white spaces */ - endp = &namep[strlen(namep) - 1]; - - while (endp && (*endp == ' ' || *endp == '\t')) - *endp-- = '\0'; - - /* find the '=' */ - - valp = HDstrchr(namep, '='); - - if (valp != NULL) { /* it's a valid key/value pairing */ - char *tmp_val = valp + 1; - - /* change '=' to \0, move valp down one */ - *valp-- = '\0'; - - /* eat up ending whitespace on the "key" part */ - while (*valp == ' ' || *valp == '\t') - *valp-- = '\0'; - - valp = tmp_val; - - /* eat up beginning whitespace on the "value" part */ - while (*valp == ' ' || *valp == '\t') - *valp++ = '\0'; - - /* actually set the darned thing */ - if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) { - printf("MPI_Info_set failed\n"); - ret_value = -1; - } - } - - valp = next; - HDfree(key_val); - } while (next && *next); - - HDfree(envp); - } - - return ret_value; -} - - -void -h5_dump_info_object(MPI_Info info) -{ - char key[MPI_MAX_INFO_KEY+1]; - char value[MPI_MAX_INFO_VAL+1]; - int flag; - int i, nkeys; - - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, - MPI_MAX_INFO_VAL); - if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); - } - else { - MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); - for (i=0; i Date: Wed, 3 Jul 2019 14:23:22 -0500 Subject: Fixed name for 'Build HDF Tests' in CMake's libhdf5 settings --- config/cmake/libhdf5.settings.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 97929e6..2117f3b 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -68,7 +68,7 @@ Features: Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ Large Parallel I/O: @LARGE_PARALLEL_IO@ High-level library: @HDF5_BUILD_HL_LIB@ - Build HDF5 Tests: @BUILD_TESTS@ + Build HDF5 Tests: @BUILD_TESTING@ Build HDF5 Tools: @HDF5_BUILD_TOOLS@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ Default API mapping: @DEFAULT_API_VERSION@ -- cgit v0.12 From c43323a06d678604a363dc264c4c0ce4816ab049 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 9 Jul 2019 16:31:17 -0500 Subject: HDFFV-10581 Correct PDB files and debug naming. --- c++/src/CMakeLists.txt | 2 +- config/cmake_ext_mod/HDFMacros.cmake | 34 ++++++++++++++++------------------ fortran/src/CMakeLists.txt | 4 ++-- hl/c++/src/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 ++-- hl/src/CMakeLists.txt | 2 +- java/examples/datasets/CMakeLists.txt | 3 ++- java/examples/datatypes/CMakeLists.txt | 3 ++- java/examples/groups/CMakeLists.txt | 3 ++- java/examples/intro/CMakeLists.txt | 3 ++- java/test/CMakeLists.txt | 3 ++- release_docs/RELEASE.txt | 9 +++++++++ src/CMakeLists.txt | 2 +- tools/lib/CMakeLists.txt | 2 +- 14 files changed, 44 insertions(+), 32 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 8e7f8be..b141a5e 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -139,7 +139,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) + INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries) endif () install ( diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 9da5006..52b96fc 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -78,7 +78,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) if (${libtype} MATCHES "SHARED") set (targetfilename $) else () - get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + get_property (target_name TARGET ${libtarget} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) set (targetfilename $/${target_name}.pdb) endif () install ( @@ -86,9 +86,10 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) ${targetfilename} DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS $ COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () @@ -100,9 +101,10 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) $ DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS $ COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () @@ -126,19 +128,6 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) endif () endif () - set_target_properties (${libtarget} - PROPERTIES - OUTPUT_NAME - ${LIB_RELEASE_NAME} - OUTPUT_NAME_DEBUG - ${LIB_DEBUG_NAME} - OUTPUT_NAME_RELEASE - ${LIB_RELEASE_NAME} - OUTPUT_NAME_MINSIZEREL - ${LIB_RELEASE_NAME} - OUTPUT_NAME_RELWITHDEBINFO - ${LIB_RELEASE_NAME} - ) if (${libtype} MATCHES "STATIC") if (WIN32) set_target_properties (${libtarget} @@ -378,6 +367,15 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) endif () + #set the default debug suffix for all library targets + if(NOT CMAKE_DEBUG_POSTFIX) + if (WIN32) + set (CMAKE_DEBUG_POSTFIX "_D") + else () + set (CMAKE_DEBUG_POSTFIX "_debug") + endif () + endif () + SET_HDF_BUILD_TYPE() #----------------------------------------------------------------------------- diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f80eaa9..bfee43a 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -436,8 +436,8 @@ if (HDF5_EXPORTED_TARGETS) #INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) - #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries) + INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} fortlibraries) + #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} fortlibraries) endif () install ( diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index eb83d8c..1911d62 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -59,7 +59,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) + INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlcpplibraries) endif () install ( diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a684088..b63b5c6 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -294,8 +294,8 @@ if (HDF5_EXPORTED_TARGETS) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) - #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlfortlibraries) + INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) + #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) endif () install ( diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 7125403..3cce7e4 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -83,7 +83,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) + INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hllibraries) endif () install ( diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index c327c86..9e5c45c 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -72,7 +72,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 0fef370..c939985 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -57,7 +57,8 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index b31a186..489dab3 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -56,7 +56,8 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) macro (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 8c94a09..1801749 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -58,7 +58,8 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b76f572..8464d25 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -87,7 +87,8 @@ else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif () -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$:_DEBUG>>;") +get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 700c8c3..c1ebba9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,15 @@ New Features Configuration: ------------- + - Windows PDB files are installed incorrectly + + For static builds, the PDB files for windows should be installed next + to the static libraries in the lib folder. Also the debug versions of + libraries and PDB files are now correctly built using the default + CMAKE_DEBUG_POSTFIX setting. + + (ADB - 2019/07/09, HDFFV-10581) + - Add option to build only shared libs A request was made to prevent building static libraries and only build diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aff732d..851ac0a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1153,7 +1153,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) + INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} libraries) endif () install ( diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index e9dfcaa..75ed627 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -85,7 +85,7 @@ if (HDF5_EXPORTED_TARGETS) INSTALL_TARGET_PDB (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) endif () if (NOT ONLY_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} toolslibraries) + INSTALL_TARGET_PDB (${HDF5_TOOLS_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} toolslibraries) endif () install ( -- cgit v0.12 From 4c8e3573a7387db8cb8292c9207d528b9497a4c7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 10 Jul 2019 10:33:40 -0500 Subject: Fix CMake module include and note text --- config/cmake_ext_mod/FindSZIP.cmake | 2 +- release_docs/RELEASE.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index 152f8ac..b84d768 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -57,7 +57,7 @@ endforeach() if(NOT SZIP_LIBRARY) find_library(SZIP_LIBRARY_RELEASE NAMES ${szip_names}) find_library(SZIP_LIBRARY_DEBUG NAMES ${szip_names_debug}) - include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + include(SelectLibraryConfigurations) select_library_configurations(SZIP) mark_as_advanced(SZIP_LIBRARY_RELEASE SZIP_LIBRARY_DEBUG) endif() diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c1ebba9..7070b31 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -67,11 +67,11 @@ New Features (ADB - 2019/06/12, HDFFV-10805) - Add options to enable or disable building tools and tests - - Configure options --enable-tests and --enable-tools were added for + + Configure options --enable-tests and --enable-tools were added for autotools configure. These options are enabled by default, and can be - disabled with either --disable-tests (or tools) or --enable-tests=no - (or --enable-tools=no). Build time is reduced ~20% when tools are + disabled with either --disable-tests (or tools) or --enable-tests=no + (or --enable-tools=no). Build time is reduced ~20% when tools are disabled, 35% when tests are disabled, 45% when both are disabled. Reenabling them after the initial build requires running configure again with the option(s) enabled. -- cgit v0.12 From c04ed97d4c587d6e7feeef6412e31cf38701b6d4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 10:56:45 -0500 Subject: Merge from develop, mostly HDFFV-10845 --- MANIFEST | 6 +- config/toolchain/mingw64.cmake | 10 + fortran/src/CMakeLists.txt | 9 +- release_docs/RELEASE.txt | 9 + src/CMakeLists.txt | 4 +- testpar/t_mpi.c | 1543 +++++++++++++++++------------------ tools/test/perform/pio_engine.c | 1 - tools/test/perform/pio_standalone.c | 4 + tools/test/perform/sio_engine.c | 37 +- 9 files changed, 815 insertions(+), 808 deletions(-) create mode 100644 config/toolchain/mingw64.cmake diff --git a/MANIFEST b/MANIFEST index 307bc22..db9a3bf 100644 --- a/MANIFEST +++ b/MANIFEST @@ -268,7 +268,6 @@ ./fortran/src/h5fc.in ./fortran/src/hdf5_fortrandll.def.in - ./fortran/test/Makefile.am ./fortran/test/fflush1.F90 ./fortran/test/fflush2.F90 @@ -465,9 +464,9 @@ ./release_docs/INSTALL_parallel ./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt -./release_docs/RELEASE.txt ./release_docs/README_HDF5_CMake ./release_docs/README_HPC +./release_docs/RELEASE.txt ./release_docs/USING_HDF5_CMake.txt ./release_docs/USING_HDF5_VS.txt @@ -546,8 +545,8 @@ ./src/H5CS.c ./src/H5CSprivate.h ./src/H5CX.c -./src/H5CXprivate.h ./src/H5CXmodule.h +./src/H5CXprivate.h ./src/H5D.c ./src/H5Dbtree.c ./src/H5Dbtree2.c @@ -3200,6 +3199,7 @@ ./config/toolchain/crayle.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake +./config/toolchain/mingw64.cmake ./config/toolchain/PGI.cmake ./config/cmake/cacheinit.cmake diff --git a/config/toolchain/mingw64.cmake b/config/toolchain/mingw64.cmake new file mode 100644 index 0000000..ad0fb85 --- /dev/null +++ b/config/toolchain/mingw64.cmake @@ -0,0 +1,10 @@ +set (CMAKE_SYSTEM_NAME Windows) +set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) +set (CMAKE_FIND_ROOT_PATH ) +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_CROSSCOMPILING_EMULATOR wine64) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index bfee43a..82a1eb6 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -355,8 +355,13 @@ install ( ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h - ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + if (NOT ONLY_SHARED_LIBS) + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + else () + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + endif () DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7070b31..5ef9d9f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,15 @@ New Features Configuration: ------------- + - Add mingw support with toolchain file + + There has been a number of mingw issues that has been linked under + HDFFV-10845. It has been decided to implement the CMake cross-compiling + technique of toolchain files. We will use a linux platform with the mingw + compiler stack for testing. + + (ADB - 2019/07/12, HDFFV-10845, HDFFV-10595) + - Windows PDB files are installed incorrectly For static builds, the PDB files for windows should be installed next diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 851ac0a..990d626 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -975,7 +975,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND $ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 @@ -1031,7 +1031,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c ${HDF5_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND $ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 3d501c9..41acf7a 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -28,149 +28,143 @@ #include "testpar.h" /* FILENAME and filenames must have the same number of names */ -const char *FILENAME[2]={ - "MPItest", - NULL}; -char filenames[2][200]; -int nerrors = 0; -hid_t fapl; /* file access property list */ +const char *FILENAME[2] = { "MPItest", NULL }; +char filenames[2][200]; +int nerrors = 0; +hid_t fapl; /* file access property list */ /* protocols */ static int errors_sum(int nerrs); #define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */ -static int -test_mpio_overlap_writes(char *filename) -{ +static int test_mpio_overlap_writes(char *filename) { int mpi_size, mpi_rank; MPI_Comm comm; MPI_Info info = MPI_INFO_NULL; int color, mrc; - MPI_File fh; + MPI_File fh; int i; int vrfyerrs, nerrs; - unsigned char buf[4093]; /* use some prime number for size */ + unsigned char buf[4093]; /* use some prime number for size */ int bufsize = sizeof(buf); - MPI_Offset stride; - MPI_Offset mpi_off; - MPI_Status mpi_stat; - + MPI_Offset stride; + MPI_Offset mpi_off; + MPI_Status mpi_stat; if (VERBOSE_MED) - printf("MPIO independent overlapping writes test on file %s\n", - filename); + printf("MPIO independent overlapping writes test on file %s\n", + filename); nerrs = 0; /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* Need at least 2 processes */ if (mpi_size < 2) { - if (MAINPROCESS) - printf("Need at least 2 processes to run MPIO test.\n"); - printf(" -SKIP- \n"); - return 0; + if (MAINPROCESS) + printf("Need at least 2 processes to run MPIO test.\n"); + printf(" -SKIP- \n"); + return 0; } /* splits processes 0 to n-2 into one comm. and the last one into another */ color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1); - mrc = MPI_Comm_split (MPI_COMM_WORLD, color, mpi_rank, &comm); - VRFY((mrc==MPI_SUCCESS), "Comm_split succeeded"); - - if (color==0){ - /* First n-1 processes (color==0) open a file and write it */ - mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = 1; - mpi_off = mpi_rank*stride; - while (mpi_off < MPIO_TEST_WRITE_SIZE){ - /* make sure the write does not exceed the TEST_WRITE_SIZE */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - - /* set data to some trivial pattern for easy verification */ - for (i=0; i bufsize) - stride = bufsize; - mpi_off += mpi_rank*stride; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - - /* sync with the other waiting processes */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - }else{ - /* last process waits till writes are done, - * then opens file to verify data. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync after writes"); - - mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, - info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - stride = bufsize; - for (mpi_off=0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize){ - /* make sure it does not read beyond end of data */ - if (mpi_off+stride > MPIO_TEST_WRITE_SIZE) - stride = MPIO_TEST_WRITE_SIZE - mpi_off; - mrc = MPI_File_read_at(fh, mpi_off, buf, (int)stride, MPI_BYTE, - &mpi_stat); - VRFY((mrc==MPI_SUCCESS), ""); - vrfyerrs=0; - for (i=0; i MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm); + VRFY((mrc == MPI_SUCCESS), "Comm_split succeeded"); + + if (color == 0) { + /* First n-1 processes (color==0) open a file and write it */ + mrc = MPI_File_open(comm, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, + info, &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + stride = 1; + mpi_off = mpi_rank * stride; + while (mpi_off < MPIO_TEST_WRITE_SIZE) { + /* make sure the write does not exceed the TEST_WRITE_SIZE */ + if (mpi_off + stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + + /* set data to some trivial pattern for easy verification */ + for (i = 0; i < stride; i++) + buf[i] = (unsigned char) (mpi_off + i); + mrc = MPI_File_write_at(fh, mpi_off, buf, (int) stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc == MPI_SUCCESS), ""); + + /* move the offset pointer to last byte written by all processes */ + mpi_off += (mpi_size - 1 - mpi_rank) * stride; + + /* Increase chunk size without exceeding buffer size. */ + /* Then move the starting offset for next write. */ + stride *= 2; + if (stride > bufsize) + stride = bufsize; + mpi_off += mpi_rank * stride; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + + /* sync with the other waiting processes */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + } else { + /* last process waits till writes are done, + * then opens file to verify data. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + + mrc = MPI_File_open(comm, filename, MPI_MODE_RDONLY, info, &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + stride = bufsize; + for (mpi_off = 0; mpi_off < MPIO_TEST_WRITE_SIZE; mpi_off += bufsize) { + /* make sure it does not read beyond end of data */ + if (mpi_off + stride > MPIO_TEST_WRITE_SIZE) + stride = MPIO_TEST_WRITE_SIZE - mpi_off; + mrc = MPI_File_read_at(fh, mpi_off, buf, (int) stride, MPI_BYTE, + &mpi_stat); + VRFY((mrc == MPI_SUCCESS), ""); + vrfyerrs = 0; + for (i = 0; i < stride; i++) { + unsigned char expected; + expected = (unsigned char) (mpi_off + i); + if ((expected != buf[i]) + && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { + printf( + "proc %d: found data error at [%ld], expect %u, got %u\n", + mpi_rank, (long) (mpi_off + i), expected, buf[i]); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + mrc = MPI_Comm_free(&comm); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); } /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ + * one more sync to ensure all processes have done reading + * before ending this test. + */ mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); return (nerrs); } - #define MB 1048576 /* 1024*1024 == 2**20 */ #define GB 1073741824 /* 1024**3 == 2**30 */ #define TWO_GB_LESS1 2147483647 /* 2**31 - 1 */ @@ -186,30 +180,28 @@ test_mpio_overlap_writes(char *filename) * Then reads the file back in by reverse order, that is process 0 * reads the data of process n-1 and vice versa. */ -static int -test_mpio_gb_file(char *filename) -{ +static int test_mpio_gb_file(char *filename) { int mpi_size, mpi_rank; MPI_Info info = MPI_INFO_NULL; int mrc; - MPI_File fh; + MPI_File fh; int i, j, n; int vrfyerrs; - int writerrs; /* write errors */ + int writerrs; /* write errors */ int nerrs; - int ntimes; /* how many times */ - char *buf = NULL; - char expected; - MPI_Offset size; - MPI_Offset mpi_off; - MPI_Offset mpi_off_old; - MPI_Status mpi_stat; + int ntimes; /* how many times */ + char *buf = NULL; + char expected; + MPI_Offset size; + MPI_Offset mpi_off; + MPI_Offset mpi_off_old; + MPI_Status mpi_stat; int is_signed, sizeof_mpi_offset; nerrs = 0; /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (VERBOSE_MED) printf("MPI_Offset range test\n"); @@ -217,196 +209,207 @@ test_mpio_gb_file(char *filename) /* figure out the signness and sizeof MPI_Offset */ mpi_off = 0; is_signed = ((MPI_Offset)(mpi_off - 1)) < 0; - sizeof_mpi_offset = (int)(sizeof(MPI_Offset)); + sizeof_mpi_offset = (int) (sizeof(MPI_Offset)); /* - * Verify the sizeof MPI_Offset and correctness of handling multiple GB - * sizes. - */ - if (MAINPROCESS){ /* only process 0 needs to check it*/ - printf("MPI_Offset is %s %d bytes integeral type\n", - is_signed ? "signed" : "unsigned", (int)sizeof(MPI_Offset)); - if (sizeof_mpi_offset <= 4 && is_signed){ - printf("Skipped 2GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 2GB sizes */ - mpi_off = 2 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "2GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 2 GB to above 2GB */ - mpi_off = TWO_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "2GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "2GB OFFSET increment succeed"); - } - } - - if (sizeof_mpi_offset <= 4){ - printf("Skipped 4GB range test " - "because MPI_Offset cannot support it\n"); - }else { - /* verify correctness of assigning 4GB sizes */ - mpi_off = 4 * 1024 * (MPI_Offset)MB; - INFO((mpi_off>0), "4GB OFFSET assignment no overflow"); - INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); - - /* verify correctness of increasing from below 4 GB to above 4 GB */ - mpi_off = FOUR_GB_LESS1; - for (i=0; i < 3; i++){ - mpi_off_old = mpi_off; - mpi_off = mpi_off + 1; - /* no overflow */ - INFO((mpi_off>0), "4GB OFFSET increment no overflow"); - /* correct inc. */ - INFO((mpi_off-1)==mpi_off_old, "4GB OFFSET increment succeed"); - } - } + * Verify the sizeof MPI_Offset and correctness of handling multiple GB + * sizes. + */ + if (MAINPROCESS) { /* only process 0 needs to check it*/ + printf("MPI_Offset is %s %d bytes integeral type\n", + is_signed ? "signed" : "unsigned", (int) sizeof(MPI_Offset)); + if (sizeof_mpi_offset <= 4 && is_signed) { + printf("Skipped 2GB range test " + "because MPI_Offset cannot support it\n"); + } else { + /* verify correctness of assigning 2GB sizes */ + mpi_off = 2 * 1024 * (MPI_Offset) MB; + INFO((mpi_off > 0), "2GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==TWO_GB_LESS1, "2GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 2 GB to above 2GB */ + mpi_off = TWO_GB_LESS1; + for (i = 0; i < 3; i++) { + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off > 0), "2GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off - 1) == mpi_off_old, + "2GB OFFSET increment succeed"); + } + } + + if (sizeof_mpi_offset <= 4) { + printf("Skipped 4GB range test " + "because MPI_Offset cannot support it\n"); + } else { + /* verify correctness of assigning 4GB sizes */ + mpi_off = 4 * 1024 * (MPI_Offset) MB; + INFO((mpi_off > 0), "4GB OFFSET assignment no overflow"); + INFO((mpi_off-1)==FOUR_GB_LESS1, "4GB OFFSET assignment succeed"); + + /* verify correctness of increasing from below 4 GB to above 4 GB */ + mpi_off = FOUR_GB_LESS1; + for (i = 0; i < 3; i++) { + mpi_off_old = mpi_off; + mpi_off = mpi_off + 1; + /* no overflow */ + INFO((mpi_off > 0), "4GB OFFSET increment no overflow"); + /* correct inc. */ + INFO((mpi_off - 1) == mpi_off_old, + "4GB OFFSET increment succeed"); + } + } } /* - * Verify if we can write to a file of multiple GB sizes. - */ + * Verify if we can write to a file of multiple GB sizes. + */ if (VERBOSE_MED) - printf("MPIO GB file test %s\n", filename); - - if (sizeof_mpi_offset <= 4){ - printf("Skipped GB file range test " - "because MPI_Offset cannot support it\n"); - }else{ - buf = (char *)HDmalloc(MB); - VRFY((buf!=NULL), "malloc succeed"); - - /* open a new file. Remove it first in case it exists. */ - /* Must delete because MPI_File_open does not have a Truncate mode. */ - /* Don't care if it has error. */ - MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ - - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE|MPI_MODE_RDWR, - info, &fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_OPEN"); - - printf("MPIO GB file write test %s\n", filename); - - /* instead of writing every bytes of the file, we will just write - * some data around the 2 and 4 GB boundaries. That should cover - * potential integer overflow and filesystem size limits. - */ - writerrs = 0; - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - /* set data to some trivial pattern for easy verification */ - for (j=0; j0){ - printf("proc %d: Skip read test due to previous write errors\n", - mpi_rank); - goto finish; - } - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); - - /* Only read back parts of the file that have been written. */ - for (n=2; n <= 4; n+=2){ - ntimes = GB/MB*n/mpi_size + 1; - for (i=ntimes-2; i <= ntimes; i++){ - mpi_off = (i*mpi_size + (mpi_size - mpi_rank - 1))*(MPI_Offset)MB; - if (VERBOSE_MED) - HDfprintf(stdout,"proc %d: read from mpi_off=%016llx, %lld\n", - mpi_rank, mpi_off, mpi_off); - mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, &mpi_stat); - INFO((mrc==MPI_SUCCESS), "GB size file read"); - expected = i*mpi_size + (mpi_size - mpi_rank - 1); - vrfyerrs=0; - for (j=0; j MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); - - nerrs += vrfyerrs; - } - } - - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); - - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + printf("MPIO GB file test %s\n", filename); + + if (sizeof_mpi_offset <= 4) { + printf("Skipped GB file range test " + "because MPI_Offset cannot support it\n"); + } else { + buf = (char *) HDmalloc(MB); + VRFY((buf != NULL), "malloc succeed"); + + /* open a new file. Remove it first in case it exists. */ + /* Must delete because MPI_File_open does not have a Truncate mode. */ + /* Don't care if it has error. */ + MPI_File_delete(filename, MPI_INFO_NULL); + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + + mrc = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_OPEN"); + + printf("MPIO GB file write test %s\n", filename); + + /* instead of writing every bytes of the file, we will just write + * some data around the 2 and 4 GB boundaries. That should cover + * potential integer overflow and filesystem size limits. + */ + writerrs = 0; + for (n = 2; n <= 4; n += 2) { + ntimes = GB / MB * n / mpi_size + 1; + for (i = ntimes - 2; i <= ntimes; i++) { + mpi_off = (i * mpi_size + mpi_rank) * (MPI_Offset) MB; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: write to mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + /* set data to some trivial pattern for easy verification */ + for (j = 0; j < MB; j++) + *(buf + j) = i * mpi_size + mpi_rank; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: writing %d bytes at offset %lld\n", + mpi_rank, MB, mpi_off); + mrc = MPI_File_write_at(fh, mpi_off, buf, MB, MPI_BYTE, + &mpi_stat); + INFO((mrc == MPI_SUCCESS), "GB size file write"); + if (mrc != MPI_SUCCESS) + writerrs++; + } + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync after writes"); + + /* + * Verify if we can read the multiple GB file just created. + */ + /* open it again to verify the data written */ + /* but only if there was no write errors */ + printf("MPIO GB file read test %s\n", filename); + if (errors_sum(writerrs) > 0) { + printf("proc %d: Skip read test due to previous write errors\n", + mpi_rank); + goto finish; + } + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, + &fh); + VRFY((mrc == MPI_SUCCESS), ""); + + /* Only read back parts of the file that have been written. */ + for (n = 2; n <= 4; n += 2) { + ntimes = GB / MB * n / mpi_size + 1; + for (i = ntimes - 2; i <= ntimes; i++) { + mpi_off = (i * mpi_size + (mpi_size - mpi_rank - 1)) + * (MPI_Offset) MB; + if (VERBOSE_MED) + HDfprintf(stdout, + "proc %d: read from mpi_off=%016llx, %lld\n", + mpi_rank, mpi_off, mpi_off); + mrc = MPI_File_read_at(fh, mpi_off, buf, MB, MPI_BYTE, + &mpi_stat); + INFO((mrc == MPI_SUCCESS), "GB size file read"); + expected = i * mpi_size + (mpi_size - mpi_rank - 1); + vrfyerrs = 0; + for (j = 0; j < MB; j++) { + if ((*(buf + j) != expected) + && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { + printf( + "proc %d: found data error at [%ld+%d], expect %d, got %d\n", + mpi_rank, (long) mpi_off, j, expected, + *(buf + j)); + } + } + if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) + printf("proc %d: [more errors ...]\n", mpi_rank); + + nerrs += vrfyerrs; + } + } + + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); + + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); printf("Test if MPI_File_get_size works correctly with %s\n", filename); - mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); - VRFY((mrc==MPI_SUCCESS), ""); + mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, + &fh); + VRFY((mrc == MPI_SUCCESS), ""); - if (MAINPROCESS){ /* only process 0 needs to check it*/ + if (MAINPROCESS) { /* only process 0 needs to check it*/ mrc = MPI_File_get_size(fh, &size); - VRFY((mrc==MPI_SUCCESS), ""); - VRFY((size == mpi_off+MB), "MPI_File_get_size doesn't return correct file size."); + VRFY((mrc == MPI_SUCCESS), ""); + VRFY((size == mpi_off+MB), + "MPI_File_get_size doesn't return correct file size."); } - /* close file and free the communicator */ - mrc = MPI_File_close(&fh); - VRFY((mrc==MPI_SUCCESS), "MPI_FILE_CLOSE"); + /* close file and free the communicator */ + mrc = MPI_File_close(&fh); + VRFY((mrc == MPI_SUCCESS), "MPI_FILE_CLOSE"); - /* - * one more sync to ensure all processes have done reading - * before ending this test. - */ - mrc = MPI_Barrier(MPI_COMM_WORLD); - VRFY((mrc==MPI_SUCCESS), "Sync before leaving test"); + /* + * one more sync to ensure all processes have done reading + * before ending this test. + */ + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); } -finish: - if (buf) - HDfree(buf); + finish: if (buf) + HDfree(buf); return (nerrs); } - /* * MPI-IO Test: One writes, Many reads. * Verify if only one process writes some data and then all other @@ -424,191 +427,190 @@ finish: * Each process writes something, then reads all data back. */ -#define DIMSIZE 32 /* Dimension size. */ +#define DIMSIZE 32 /* Dimension size. */ #define PRINTID printf("Proc %d: ", mpi_rank) #define USENONE 0 -#define USEATOM 1 /* request atomic I/O */ -#define USEFSYNC 2 /* request file_sync */ +#define USEATOM 1 /* request atomic I/O */ +#define USEFSYNC 2 /* request file_sync */ - -static int -test_mpio_1wMr(char *filename, int special_request) -{ +static int test_mpio_1wMr(char *filename, int special_request) { char hostname[128]; - int mpi_size, mpi_rank; + int mpi_size, mpi_rank; MPI_File fh; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; + int mpi_err_strlen; + int mpi_err; unsigned char writedata[DIMSIZE], readdata[DIMSIZE]; unsigned char expect_val; - int i, irank; - int nerrs = 0; /* number of errors */ - int atomicity; - MPI_Offset mpi_off; - MPI_Status mpi_stat; + int i, irank; + int nerrs = 0; /* number of errors */ + int atomicity; + MPI_Offset mpi_off; + MPI_Status mpi_stat; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - if (MAINPROCESS && VERBOSE_MED){ + if (MAINPROCESS && VERBOSE_MED) { printf("Testing one process writes, all processes read.\n"); - printf("Using %d processes accessing file %s\n", mpi_size, filename); + printf("Using %d processes accessing file %s\n", mpi_size, filename); printf(" (Filename can be specified via program argument)\n"); } /* show the hostname so that we can tell where the processes are running */ - if (VERBOSE_DEF){ - if (gethostname(hostname, 128) < 0){ - PRINTID; - printf("gethostname failed\n"); - return 1; - } - PRINTID; - printf("hostname=%s\n", hostname); + if (VERBOSE_DEF) { +#ifdef H5_HAVE_GETHOSTNAME + if(HDgethostname(hostname, sizeof(hostname)) < 0) { + printf("gethostname failed\n"); + hostname[0] = '\0'; + } + #else + printf("gethostname unavailable\n"); + hostname[0] = '\0'; +#endif + PRINTID; + printf("hostname=%s\n", hostname); } /* Delete any old file in order to start anew. */ /* Must delete because MPI_File_open does not have a Truncate mode. */ /* Don't care if it has error. */ MPI_File_delete(filename, MPI_INFO_NULL); - MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ + MPI_Barrier(MPI_COMM_WORLD); /* prevent racing condition */ if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE , - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } -if (special_request & USEATOM){ - /* ================================================== - * Set atomcity to true (1). A POSIX compliant filesystem - * should not need this. - * ==================================================*/ - if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); - } - if (VERBOSE_HI) - printf("Initial atomicity = %d\n", atomicity); - if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); - } - if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + if (special_request & USEATOM) { + /* ================================================== + * Set atomcity to true (1). A POSIX compliant filesystem + * should not need this. + * ==================================================*/ + if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + } + if (VERBOSE_HI) + printf("Initial atomicity = %d\n", atomicity); + if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); + } + if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + } + if (VERBOSE_HI) + printf("After set_atomicity atomicity = %d\n", atomicity); } - if (VERBOSE_HI) - printf("After set_atomicity atomicity = %d\n", atomicity); -} /* This barrier is not necessary but do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("between MPI_Barrier and MPI_File_write_at\n"); + if (VERBOSE_HI) { + PRINTID; + printf("between MPI_Barrier and MPI_File_write_at\n"); } /* ================================================== - * Each process calculates what to write but - * only process irank(0) writes. - * ==================================================*/ - irank=0; - for (i=0; i < DIMSIZE; i++) - writedata[i] = irank*DIMSIZE + i; - mpi_off = irank*DIMSIZE; + * Each process calculates what to write but + * only process irank(0) writes. + * ==================================================*/ + irank = 0; + for (i = 0; i < DIMSIZE; i++) + writedata[i] = irank * DIMSIZE + i; + mpi_off = irank * DIMSIZE; /* Only one process writes */ - if (mpi_rank==irank){ - if (VERBOSE_HI){ - PRINTID; printf("wrote %d bytes at %ld\n", DIMSIZE, (long)mpi_off); - } - if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, - MPI_BYTE, &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; - }; + if (mpi_rank == irank) { + if (VERBOSE_HI) { + PRINTID; + printf("wrote %d bytes at %ld\n", DIMSIZE, (long) mpi_off); + } + if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, + MPI_BYTE, &mpi_stat)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; + }; }; /* Bcast the return code and */ /* make sure all writing are done before reading. */ MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("MPI_Bcast: mpi_err = %d\n", mpi_err); + if (VERBOSE_HI) { + PRINTID; + printf("MPI_Bcast: mpi_err = %d\n", mpi_err); } -if (special_request & USEFSYNC){ - /* ================================================== - * Do a file sync. A POSIX compliant filesystem - * should not need this. - * ==================================================*/ - if (VERBOSE_HI) - printf("Apply MPI_File_sync\n"); - /* call file_sync to force the write out */ - if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); - } - MPI_Barrier(MPI_COMM_WORLD); - /* call file_sync to force the write out */ - if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + if (special_request & USEFSYNC) { + /* ================================================== + * Do a file sync. A POSIX compliant filesystem + * should not need this. + * ==================================================*/ + if (VERBOSE_HI) + printf("Apply MPI_File_sync\n"); + /* call file_sync to force the write out */ + if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); + } + MPI_Barrier(MPI_COMM_WORLD); + /* call file_sync to force the write out */ + if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_sync failed (%s)\n", mpi_err_str); + } } -} /* This barrier is not necessary because the Bcase or File_sync above */ /* should take care of it. Do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); - if (VERBOSE_HI){ - PRINTID; - printf("after MPI_Barrier\n"); + if (VERBOSE_HI) { + PRINTID; + printf("after MPI_Barrier\n"); } /* ================================================== - * Each process reads what process 0 wrote and verify. - * ==================================================*/ - irank=0; - mpi_off = irank*DIMSIZE; + * Each process reads what process 0 wrote and verify. + * ==================================================*/ + irank = 0; + mpi_off = irank * DIMSIZE; if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, - &mpi_stat)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - PRINTID; - printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, DIMSIZE, mpi_err_str); - return 1; + &mpi_stat)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, DIMSIZE, mpi_err_str); + return 1; }; - for (i=0; i < DIMSIZE; i++){ - expect_val = irank*DIMSIZE + i; - if (readdata[i] != expect_val){ - PRINTID; - printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, - readdata[i], expect_val); - nerrs++; - } + for (i = 0; i < DIMSIZE; i++) { + expect_val = irank * DIMSIZE + i; + if (readdata[i] != expect_val) { + PRINTID; + printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, + readdata[i], expect_val); + nerrs++; + } } MPI_File_close(&fh); - if (VERBOSE_HI){ - PRINTID; - printf("%d data errors detected\n", nerrs); + if (VERBOSE_HI) { + PRINTID; + printf("%d data errors detected\n", nerrs); } mpi_err = MPI_Barrier(MPI_COMM_WORLD); @@ -617,272 +619,268 @@ if (special_request & USEFSYNC){ /* -Function: test_mpio_derived_dtype - -Test Whether the Displacement of MPI derived datatype -(+ File_set_view + MPI_write)works or not on this MPI-IO package -and this platform. - -1. Details for the test: -1) Create two derived datatypes with MPI_Type_create_hindexed: - datatype1: - count = 1, blocklens = 1, offsets = 0, - base type = MPI_BYTE(essentially a char) - datatype2: - count = 1, blocklens = 1, offsets = 1(byte), - base type = MPI_BYTE - -2) Using these two derived datatypes, - Build another derived datatype with MPI_Type_create_struct: - advtype: derived from datatype1 and datatype2 - advtype: - count = 2, blocklens[0] = 1, blocklens[1]=1, - offsets[0] = 0, offsets[1] = 1(byte), - bas_type[0]=datatype1, - bas_type[1] = datatype2; - -3) Setting MPI file view with advtype -4) Writing 2 bytes 1 to 2 using MPI_File_write to a file -5) File content: -Suppose the fill value of the file is 0(most machines indeed do so) -and Fill value is embraced with "() in the following output: -Expected output should be: -1,0,2 - - - -However, at some platforms, for example, IBM AIX(at March 23rd, 2005): -the following values were obtained: -1,2,0 - -The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived datatype(advtype) + Function: test_mpio_derived_dtype + + Test Whether the Displacement of MPI derived datatype + (+ File_set_view + MPI_write)works or not on this MPI-IO package + and this platform. + + 1. Details for the test: + 1) Create two derived datatypes with MPI_Type_create_hindexed: + datatype1: + count = 1, blocklens = 1, offsets = 0, + base type = MPI_BYTE(essentially a char) + datatype2: + count = 1, blocklens = 1, offsets = 1(byte), + base type = MPI_BYTE + + 2) Using these two derived datatypes, + Build another derived datatype with MPI_Type_create_struct: + advtype: derived from datatype1 and datatype2 + advtype: + count = 2, blocklens[0] = 1, blocklens[1]=1, + offsets[0] = 0, offsets[1] = 1(byte), + bas_type[0]=datatype1, + bas_type[1] = datatype2; + + 3) Setting MPI file view with advtype + 4) Writing 2 bytes 1 to 2 using MPI_File_write to a file + 5) File content: + Suppose the fill value of the file is 0(most machines indeed do so) + and Fill value is embraced with "() in the following output: + Expected output should be: + 1,0,2 + + + + However, at some platforms, for example, IBM AIX(at March 23rd, 2005): + the following values were obtained: + 1,2,0 + + The problem is that the displacement of the second derived datatype(datatype2) which formed the final derived datatype(advtype) has been put after the basic datatype(MPI_BYTE) of datatype2. This is a bug. -2. This test will verify whether the complicated derived datatype is working on -the current platform. + 2. This test will verify whether the complicated derived datatype is working on + the current platform. -If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change -the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections. + If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections. -If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that -we can turn off collective IO support for irregular selections. -*/ + If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that + we can turn off collective IO support for irregular selections. + */ static int test_mpio_derived_dtype(char *filename) { MPI_File fh; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; - int i; - MPI_Datatype etype,filetype; - MPI_Datatype adv_filetype,bas_filetype[2]; - MPI_Datatype filetypenew; - MPI_Offset disp; - MPI_Status Status; - MPI_Aint adv_disp[2]; - MPI_Aint offsets[1]; - int blocklens[1],adv_blocklens[2]; - int count,outcount; - int retcode; - - int mpi_rank,mpi_size; - - char buf[3],outbuf[3] = {0}; + int mpi_err_strlen; + int mpi_err; + int i; + MPI_Datatype etype, filetype; + MPI_Datatype adv_filetype, bas_filetype[2]; + MPI_Datatype filetypenew; + MPI_Offset disp; + MPI_Status Status; + MPI_Aint adv_disp[2]; + MPI_Aint offsets[1]; + int blocklens[1], adv_blocklens[2]; + int count, outcount; + int retcode; + + int mpi_rank, mpi_size; + + char buf[3], outbuf[3] = { 0 }; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); retcode = 0; - for(i=0;i<3;i++) - buf[i] = i+1; - + for (i = 0; i < 3; i++) + buf[i] = i + 1; if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, - MPI_MODE_RDWR | MPI_MODE_CREATE, - MPI_INFO_NULL, &fh)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } - disp = 0; + disp = 0; etype = MPI_BYTE; count = 1; blocklens[0] = 1; - offsets[0] = 0; + offsets[0] = 0; - if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetype)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, + &filetype)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&filetype))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } count = 1; - blocklens[0]=1; + blocklens[0] = 1; offsets[0] = 1; - if((mpi_err= MPI_Type_create_hindexed(count,blocklens,offsets,MPI_BYTE,&filetypenew)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, + &filetypenew)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&filetypenew))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&filetypenew)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } - outcount = 2; + outcount = 2; adv_blocklens[0] = 1; adv_blocklens[1] = 1; - adv_disp[0] = 0; - adv_disp[1] = 1; - bas_filetype[0] = filetype; - bas_filetype[1] = filetypenew; - - if((mpi_err= MPI_Type_create_struct(outcount,adv_blocklens,adv_disp,bas_filetype,&adv_filetype)) - != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); - return 1; + adv_disp[0] = 0; + adv_disp[1] = 1; + bas_filetype[0] = filetype; + bas_filetype[1] = filetypenew; + + if ((mpi_err = MPI_Type_create_struct(outcount, adv_blocklens, adv_disp, + bas_filetype, &adv_filetype)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err=MPI_Type_commit(&adv_filetype))!=MPI_SUCCESS){ + if ((mpi_err = MPI_Type_commit(&adv_filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_set_view(fh,disp,etype,adv_filetype,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_set_view(fh, disp, etype, adv_filetype, "native", + MPI_INFO_NULL)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_write(fh,buf,3,MPI_BYTE,&Status))!= MPI_SUCCESS){ + if ((mpi_err = MPI_File_write(fh, buf, 3, MPI_BYTE, &Status)) + != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write failed (%s)\n", mpi_err_str); - return 1; - ; + printf("MPI_File_write failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; } - - if((mpi_err = MPI_File_open(MPI_COMM_WORLD,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, + MPI_INFO_NULL, &fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_set_view(fh,0,MPI_BYTE,MPI_BYTE,"native",MPI_INFO_NULL))!= MPI_SUCCESS){ + if ((mpi_err = MPI_File_set_view(fh, 0, MPI_BYTE, MPI_BYTE, "native", + MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); - return 1; + printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + return 1; } - if((mpi_err = MPI_File_read(fh,outbuf,3,MPI_BYTE,&Status))!=MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_read failed (%s)\n", mpi_err_str); - return 1; + if ((mpi_err = MPI_File_read(fh, outbuf, 3, MPI_BYTE, &Status)) + != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_read failed (%s)\n", mpi_err_str); + return 1; } - if(outbuf[2]==2) { - retcode = 0; - } - else { -/* if(mpi_rank == 0) { - printf("complicated derived datatype is NOT working at this platform\n"); - printf("go back to hdf5/config and find the corresponding\n"); - printf("configure-specific file and change ?????\n"); - } -*/ - retcode = -1; - } - - if((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS){ - MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); - return 1; + if (outbuf[2] == 2) { + retcode = 0; + } else { + /* if(mpi_rank == 0) { + printf("complicated derived datatype is NOT working at this platform\n"); + printf("go back to hdf5/config and find the corresponding\n"); + printf("configure-specific file and change ?????\n"); + } + */ + retcode = -1; } + if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + printf("MPI_File_close failed (%s)\n", mpi_err_str); + return 1; + } mpi_err = MPI_Barrier(MPI_COMM_WORLD); - if(retcode == -1) { - if(mpi_rank == 0) { - printf("Complicated derived datatype is NOT working at this platform\n"); - printf(" Please report to help@hdfgroup.org about this problem.\n"); - } - retcode = 1; + if (retcode == -1) { + if (mpi_rank == 0) { + printf( + "Complicated derived datatype is NOT working at this platform\n"); + printf(" Please report to help@hdfgroup.org about this problem.\n"); + } + retcode = 1; } return retcode; } /* -Function: test_mpio_special_collective + Function: test_mpio_special_collective -Test Whether collective IO is still working when more than one process -has no contribution to IO. To properly test this case, at least FOUR -processes are needed. + Test Whether collective IO is still working when more than one process + has no contribution to IO. To properly test this case, at least FOUR + processes are needed. -1. Details for the test: -1) Create one derived datatype with MPI_Type_create_hindexed: + 1. Details for the test: + 1) Create one derived datatype with MPI_Type_create_hindexed: -2) Choosing at least two processes to contribute none for IO with - the buf size inside MPI_Write_at_all to 0. -3) Choosing at least two processes to have real contributions for IO. -4) Do collective IO. + 2) Choosing at least two processes to contribute none for IO with + the buf size inside MPI_Write_at_all to 0. + 3) Choosing at least two processes to have real contributions for IO. + 4) Do collective IO. -2. This test will fail with the MPI-IO package that doesn't support this. For example, -mpich 1.2.6. + 2. This test will fail with the MPI-IO package that doesn't support this. For example, + mpich 1.2.6. -If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change -the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO. + If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO. -If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that -we can turn off the support for special collective IO; currently only special collective IO. -*/ + If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that + we can turn off the support for special collective IO; currently only special collective IO. + */ -static int -test_mpio_special_collective(char *filename) -{ - int mpi_size, mpi_rank; +static int test_mpio_special_collective(char *filename) { + int mpi_size, mpi_rank; MPI_File fh; - MPI_Datatype etype,buftype,filetype; + MPI_Datatype etype, buftype, filetype; char mpi_err_str[MPI_MAX_ERROR_STRING]; - int mpi_err_strlen; - int mpi_err; - char writedata[2*DIMSIZE]; + int mpi_err_strlen; + int mpi_err; + char writedata[2 * DIMSIZE]; char filerep[7] = "native"; - int i; - int count,bufcount; + int i; + int count, bufcount; int blocklens[2]; MPI_Aint offsets[2]; - MPI_Offset mpi_off = 0; - MPI_Status mpi_stat; - int retcode = 0; + MPI_Offset mpi_off = 0; + MPI_Status mpi_stat; + int retcode = 0; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* create MPI data type */ etype = MPI_BYTE; - if(mpi_rank == 0 || mpi_rank == 1) { + if (mpi_rank == 0 || mpi_rank == 1) { count = DIMSIZE; bufcount = 1; } /* end if */ @@ -892,38 +890,32 @@ test_mpio_special_collective(char *filename) } /* end else */ blocklens[0] = count; - offsets[0] = mpi_rank*count; + offsets[0] = mpi_rank * count; blocklens[1] = count; - offsets[1] = (mpi_size+mpi_rank)*count; - - if(count !=0) { - if((mpi_err = MPI_Type_create_hindexed(2, - blocklens, - offsets, - etype, - &filetype)) != MPI_SUCCESS) { + offsets[1] = (mpi_size + mpi_rank) * count; + + if (count != 0) { + if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, + &filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_create_hindexed(2, - blocklens, - offsets, - etype, - &buftype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, + &buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ - if((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) { + if ((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; @@ -931,46 +923,36 @@ test_mpio_special_collective(char *filename) } /* end if */ else { filetype = MPI_BYTE; - buftype = MPI_BYTE; + buftype = MPI_BYTE; } /* end else */ /* Open a file */ - if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, - filename, - MPI_MODE_RDWR | MPI_MODE_CREATE, - MPI_INFO_NULL, - &fh)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) + != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } /* end if */ /* each process writes some data */ - for (i=0; i < 2*DIMSIZE; i++) - writedata[i] = (char)(mpi_rank*DIMSIZE + i); + for (i = 0; i < 2 * DIMSIZE; i++) + writedata[i] = (char) (mpi_rank * DIMSIZE + i); /* Set the file view */ - if((mpi_err = MPI_File_set_view(fh, - mpi_off, - MPI_BYTE, - filetype, - filerep, - MPI_INFO_NULL)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_set_view(fh, mpi_off, MPI_BYTE, filetype, filerep, + MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_set_view failed (%s)\n", mpi_err_str); return 1; } /* end if */ /* Collectively write into the file */ - if ((mpi_err = MPI_File_write_at_all(fh, - mpi_off, - writedata, - bufcount, - buftype, - &mpi_stat)) != MPI_SUCCESS) { + if ((mpi_err = MPI_File_write_at_all(fh, mpi_off, writedata, bufcount, + buftype, &mpi_stat)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", - (long) mpi_off, bufcount, mpi_err_str); + (long) mpi_off, bufcount, mpi_err_str); return 1; } /* end if */ @@ -983,8 +965,8 @@ test_mpio_special_collective(char *filename) /* Perform a barrier */ mpi_err = MPI_Barrier(MPI_COMM_WORLD); - if(retcode != 0) { - if(mpi_rank == 0) { + if (retcode != 0) { + if (mpi_rank == 0) { printf("special collective IO is NOT working at this platform\n"); printf(" Please report to help@hdfgroup.org about this problem.\n"); } /* end if */ @@ -998,71 +980,69 @@ test_mpio_special_collective(char *filename) /* * parse the command line options */ -static int -parse_options(int argc, char **argv) -{ - while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'v': if (*((*argv+1)+1)) - ParseTestVerbosity((*argv+1)+1); - else - SetTestVerbosity(VERBO_MED); - break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: nerrors++; - return(1); - } - } +static int parse_options(int argc, char **argv) { + while (--argc) { + if (**(++argv) != '-') { + break; + } else { + switch (*(*argv + 1)) { + case 'v': + if (*((*argv + 1) + 1)) + ParseTestVerbosity((*argv + 1) + 1); + else + SetTestVerbosity(VERBO_MED); + break; + case 'f': + if (--argc < 1) { + nerrors++; + return (1); + } + if (**(++argv) == '-') { + nerrors++; + return (1); + } + paraprefix = *argv; + break; + case 'h': /* print help message--return with nerrors set */ + return (1); + default: + nerrors++; + return (1); + } + } } /*while*/ /* compose the test filenames */ { - int i, n; - hid_t plist; - - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],plist,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - H5Pclose(plist); - if (VERBOSE_MED){ - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); - } + int i, n; + hid_t plist; + + plist = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i = 0; i < n; i++) + if (h5_fixname(FILENAME[i], plist, filenames[i], + sizeof(filenames[i])) == NULL) { + printf("h5_fixname failed\n"); + nerrors++; + return (1); + } + H5Pclose(plist); + if (VERBOSE_MED) { + printf("Test filenames are:\n"); + for (i = 0; i < n; i++) + printf(" %s\n", filenames[i]); + } } - return(0); + return (0); } - /* * Show command usage */ -static void -usage(void) -{ +static void usage(void) { printf("Usage: t_mpi [-v] [-f ]\n"); printf("\t-v\tset verbose level (0-9,l,m,h)\n"); printf("\t-f \tfilename prefix\n"); @@ -1072,19 +1052,14 @@ usage(void) /* * return the sum of all errors. */ -static int -errors_sum(int nerrs) -{ +static int errors_sum(int nerrs) { int temp; MPI_Allreduce(&nerrs, &temp, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); - return(temp); + return (temp); } - -int -main(int argc, char **argv) -{ - int mpi_size, mpi_rank; /* mpi variables */ +int main(int argc, char **argv) { + int mpi_size, mpi_rank; /* mpi variables */ int ret_code; MPI_Init(&argc, &argv); @@ -1092,78 +1067,76 @@ main(int argc, char **argv) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* Attempt to turn off atexit post processing so that in case errors - * happen during the test and the process is aborted, it will not get - * hang in the atexit post processing in which it may try to make MPI - * calls. By then, MPI calls may not work. - */ - if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n"); + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ + if (H5dont_atexit() < 0) { + printf("Failed to turn off atexit processing. Continue.\n"); }; H5open(); - if (parse_options(argc, argv) != 0){ - if (MAINPROCESS) - usage(); - goto finish; + if (parse_options(argc, argv) != 0) { + if (MAINPROCESS) + usage(); + goto finish; } - if (MAINPROCESS){ - printf("===================================\n"); - printf("MPI functionality tests\n"); - printf("===================================\n"); + if (MAINPROCESS) { + printf("===================================\n"); + printf("MPI functionality tests\n"); + printf("===================================\n"); } if (VERBOSE_MED) - h5_show_hostname(); + h5_show_hostname(); - fapl = H5Pcreate (H5P_FILE_ACCESS); + fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); /* set alarm. */ ALARM_ON; - /*======================================= - * MPIO 1 write Many read test - *=======================================*/ + * MPIO 1 write Many read test + *=======================================*/ MPI_BANNER("MPIO 1 write Many read test..."); ret_code = test_mpio_1wMr(filenames[0], USENONE); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /* test atomicity and file sync in high verbose mode only */ /* since they often hang when broken and PHDF5 does not use them. */ - if (VERBOSE_HI){ - MPI_BANNER("MPIO 1 write Many read test with atomicity..."); - ret_code = test_mpio_1wMr(filenames[0], USEATOM); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - - MPI_BANNER("MPIO 1 write Many read test with file sync..."); - ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; - } - } + if (VERBOSE_HI) { + MPI_BANNER("MPIO 1 write Many read test with atomicity..."); + ret_code = test_mpio_1wMr(filenames[0], USEATOM); + ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + MPI_BANNER("MPIO 1 write Many read test with file sync..."); + ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); + ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; + } + } /*======================================= - * MPIO MPIO File size range test - *=======================================*/ + * MPIO MPIO File size range test + *=======================================*/ MPI_BANNER("MPIO File size range test..."); #ifndef H5_HAVE_WIN32_API ret_code = test_mpio_gb_file(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } #else if (mpi_rank==0) @@ -1171,30 +1144,30 @@ main(int argc, char **argv) #endif /*======================================= - * MPIO independent overlapping writes - *=======================================*/ + * MPIO independent overlapping writes + *=======================================*/ MPI_BANNER("MPIO independent overlapping writes..."); ret_code = test_mpio_overlap_writes(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= - * MPIO complicated derived datatype test - *=======================================*/ + * MPIO complicated derived datatype test + *=======================================*/ MPI_BANNER("MPIO complicated derived datatype test..."); ret_code = test_mpio_derived_dtype(filenames[0]); ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } /*======================================= - * MPIO special collective IO test - *=======================================*/ + * MPIO special collective IO test + *=======================================*/ if (mpi_size < 4) { MPI_BANNER("MPIO special collective io test SKIPPED."); if (mpi_rank == 0) @@ -1206,28 +1179,26 @@ main(int argc, char **argv) MPI_BANNER("MPIO special collective io test..."); ret_code = test_mpio_special_collective(filenames[0]); -sc_finish: - ret_code = errors_sum(ret_code); - if (mpi_rank==0 && ret_code > 0){ - printf("***FAILED with %d total errors\n", ret_code); - nerrors += ret_code; + sc_finish: ret_code = errors_sum(ret_code); + if (mpi_rank == 0 && ret_code > 0) { + printf("***FAILED with %d total errors\n", ret_code); + nerrors += ret_code; } - -finish: + finish: /* make sure all processes are finished before final report, cleanup - * and exit. - */ + * and exit. + */ MPI_Barrier(MPI_COMM_WORLD); - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors){ - printf("***MPI tests detected %d errors***\n", nerrors); - } - else{ - printf("MPI tests finished with no errors\n"); - } - printf("===================================\n"); + if (MAINPROCESS) { /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) { + printf("***MPI tests detected %d errors***\n", nerrors); + } + else { + printf("MPI tests finished with no errors\n"); + } + printf("===================================\n"); } /* turn off alarm */ @@ -1240,6 +1211,6 @@ finish: MPI_Finalize(); /* cannot just return (nerrors) because exit code is limited to 1byte */ - return(nerrors!=0); + return (nerrors != 0); } diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 43a0f64..d47cd43 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -318,7 +318,6 @@ do_pio(parameters param) set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - hrc == SUCCESS; set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c index dd6a61a..022e390 100644 --- a/tools/test/perform/pio_standalone.c +++ b/tools/test/perform/pio_standalone.c @@ -162,4 +162,8 @@ print_version(const char *progname) H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE); } +#ifdef H5_HAVE_PARALLEL +MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ +#endif + diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 11de229..ed15fa5 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -1262,7 +1262,15 @@ done: * Programmer: Albert Cheng 2001/12/12 * Modifications: Support for file drivers. Christian Chilan, April, 2008 */ - static void +/* 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" +static void do_cleanupfile(iotype iot, char *filename) { char temp[2048]; @@ -1275,12 +1283,12 @@ do_cleanupfile(iotype iot, char *filename) if (clean_file_g){ switch (iot) { - case POSIXIO: - HDremove(filename); - break; + case POSIXIO: + HDremove(filename); + break; - case HDF5: - driver = H5Pget_driver(fapl); + case HDF5: + driver = H5Pget_driver(fapl); if (driver == H5FD_FAMILY) { for (j = 0; /*void*/; j++) { @@ -1313,14 +1321,15 @@ do_cleanupfile(iotype iot, char *filename) HDremove(filename); } H5Pclose(fapl); - break; - - default: - /* unknown request */ - HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); - HDassert(0 && "Unknown IO type"); - break; - } + break; + + default: + /* unknown request */ + HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); + HDassert(0 && "Unknown IO type"); + break; + } } } +#pragma GCC diagnostic pop -- cgit v0.12 From 4af15717e234560a1167dfc92c15986f9cb4f123 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 17 Jul 2019 14:21:33 -0500 Subject: Bring pull request #1729 from develop to 1.10: Fix for HDFFV-10800 H5Ocopy failure: The value for the H5F_LIBVER_V18 index in H5O_fill_ver_bounds[], the format version bounds array for fill value message, should be version 3 not 2. --- MANIFEST | 1 + release_docs/RELEASE.txt | 13 ++++++++ src/H5Ofill.c | 2 +- test/CMakeTests.cmake | 1 + test/fill18.h5 | Bin 0 -> 3479 bytes test/objcopy.c | 10 +++--- test/tfile.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 test/fill18.h5 diff --git a/MANIFEST b/MANIFEST index 307bc22..3040e1c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -992,6 +992,7 @@ ./test/file_image.c ./test/file_image_core_test.h5 ./test/fill_old.h5 +./test/fill18.h5 ./test/fillval.c ./test/filter_fail.c ./test/filter_plugin.c diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7070b31..f5d85cd 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -376,6 +376,19 @@ Bug Fixes since HDF5-1.10.4 release Library ------- + - Fixed an issue where copying a version 1.8 dataset between files using + H5Ocopy fails due to an incompatible fill version + + When using the HDF5 1.10.x H5Ocopy() API call to copy a version 1.8 + dataset to a file created with both high and low library bounds set to + H5F_LIBVER_V18, the H5Ocopy() call will fail with the error stack indicating + that the fill value version is out of bounds. + + This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 + (from H5O_FILL_VERSION_2) for H5F_LIBVER_V18. + + (VC - 2019/6/14, HDFFV-10800) + - Fixed a bug that would cause an error or cause fill values to be incorrectly read from a chunked dataset using the "single chunk" index if the data was held in cache and there was no data on disk. diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8a6004d..dd3f531 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -156,7 +156,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ /* Format version bounds for fill value */ const unsigned H5O_fill_ver_bounds[] = { H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */ - H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_FILL_VERSION_3, /* H5F_LIBVER_V18 */ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 9a5791a..fe6c695 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -135,6 +135,7 @@ set (HDF5_REFERENCE_TEST_FILES filespace_1_6.h5 filespace_1_8.h5 fill_old.h5 + fill18.h5 filter_error.h5 fsm_aggr_nopersist.h5 fsm_aggr_persist.h5 diff --git a/test/fill18.h5 b/test/fill18.h5 new file mode 100644 index 0000000..c092f59 Binary files /dev/null and b/test/fill18.h5 differ diff --git a/test/objcopy.c b/test/objcopy.c index 18de027..09dd459 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2136,9 +2136,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) char src_fname[NAME_BUF_SIZE]; /* Name of source file */ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */ H5F_libver_t low, high; /* File format bounds */ - H5F_libver_t low_src, high_src; /* Source file format bounds */ - unsigned srcdset_fillversion; /* Fill version of source dataset */ - hbool_t valid_high = FALSE; /* TRUE if high bound is valid */ + unsigned srcdset_layoutversion; /* Layout version of source dataset */ int i, j; /* Local index variables */ H5D_t *dsetp = NULL; /* Pointer to internal dset structure */ herr_t ret; /* Generic return value */ @@ -2181,7 +2179,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) /* Get the internal dset ptr to get the fill version for verifying later */ if ((dsetp = (H5D_t *)H5I_object(did_src)) == NULL) TEST_ERROR - srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version; + srcdset_layoutversion = dsetp->shared->layout.version; /* Close dataspace */ if(H5Sclose(sid) < 0) TEST_ERROR @@ -2226,9 +2224,9 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src) /* If copy failed, check if the failure is expected */ if (ret < 0) { - /* Failure is valid if fill version of source dataset is + /* Failure is valid if layout version of source dataset is greater than destination */ - if (srcdset_fillversion <= H5O_fill_ver_bounds[high]) + if (srcdset_layoutversion <= H5O_layout_ver_bounds[high]) TEST_ERROR /* Close the DST file before continue */ diff --git a/test/tfile.c b/test/tfile.c index a0a165f..340b03f 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -169,6 +169,15 @@ const char *FILESPACE_NAME[] = { NULL }; + +/* Declarations for test_libver_bounds_copy(): */ +/* SRC_FILE: source file created under 1.8 branch with latest format */ +/* DST_FILE: destination file for copying the dataset in SRC_FILE */ +/* DSET_DS1: the dataset created in SRC_FILE to be copied to DST_FILE */ +#define SRC_FILE "fill18.h5" +#define DST_FILE "fill18_copy.h5" +#define DSET_DS1 "DS1" + /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); @@ -5081,6 +5090,79 @@ test_libver_bounds_open(void) } /* end test_libver_bounds_open() */ +/*------------------------------------------------------------------------- + * Function: test_libver_bounds_copy + * + * Purpose: Test to verify HDFFV-10800 is fixed: + * This test is copied from the user test program: copy10.c. + * (See attached programs in the jira issue.) + * + * The source file used in the test is generated by the user test + * program "fill18.c" with the 1.8 library. The file is created + * with the latest format and the dataset created in the file + * has version 3 fill value message (latest). + * + * The test creates the destination file with (v18, v18) version bounds. + * H5Ocopy() should succeed in copying the dataset in the source file + * to the destination file. + * + * Return: Success: 0 + * Failure: number of errors + * + *------------------------------------------------------------------------- + */ +static void +test_libver_bounds_copy(void) +{ + hid_t src_fid = -1; /* File ID */ + hid_t dst_fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list ID */ + const char *src_fname; /* Source file name */ + herr_t ret; /* Generic return value */ + + /* Output message about the test being performed */ + MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n")); + + /* Get the test file name */ + src_fname = H5_get_srcdir_filename(SRC_FILE); + + /* Open the source test file */ + src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(src_fid, FAIL, "H5Fopen"); + + /* Create file access property list */ + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + + /* Set library version bounds to (v18, v18) */ + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create the destination file with the fapl */ + dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(dst_fid, FAIL, "H5Pcreate"); + + /* Close the fapl */ + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + + /* Copy the dataset in the source file to the destination file */ + ret = H5Ocopy(src_fid, DSET_DS1, dst_fid, DSET_DS1, H5P_DEFAULT, H5P_DEFAULT); + VERIFY(ret, SUCCEED, "H5Ocopy"); + + /* Close the source file */ + ret = H5Fclose(src_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Close the destination file */ + ret = H5Fclose(dst_fid); + CHECK(ret, FAIL, "H5Fclose"); + + /* Remove the destination file */ + HDremove(DST_FILE); + +} /* end test_libver_bounds_copy() */ + /**************************************************************** ** ** test_libver_bounds(): @@ -5099,6 +5181,7 @@ test_libver_bounds(void) test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); test_libver_bounds_open(); + test_libver_bounds_copy(); } /* end test_libver_bounds() */ /************************************************************************************** @@ -7491,5 +7574,6 @@ cleanup_file(void) HDremove(FILE5); HDremove(FILE6); HDremove(FILE7); + HDremove(DST_FILE); } -- cgit v0.12 From 378ed8bebfe709156b24aacbf8013de1a776c04e Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 18 Jul 2019 10:20:56 -0500 Subject: Change "bad" hid_t_value to H5I_INVALID_HID in test_libver_bounds_copy() test. --- test/tfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tfile.c b/test/tfile.c index 340b03f..a73d3e4 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5128,11 +5128,11 @@ test_libver_bounds_copy(void) /* Open the source test file */ src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(src_fid, FAIL, "H5Fopen"); + CHECK(src_fid, H5I_INVALID_HID, "H5Fopen"); /* Create file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(fapl, FAIL, "H5Pcreate"); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set library version bounds to (v18, v18) */ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18); @@ -5140,7 +5140,7 @@ test_libver_bounds_copy(void) /* Create the destination file with the fapl */ dst_fid = H5Fcreate(DST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(dst_fid, FAIL, "H5Pcreate"); + CHECK(dst_fid, H5I_INVALID_HID, "H5Pcreate"); /* Close the fapl */ ret = H5Pclose(fapl); -- cgit v0.12 From 00a546ec57edd319d95baea088ab0f9fb7b722b5 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 26 Jun 2019 10:47:31 -0500 Subject: Bring pull request #1772 from develop to 1.10. Fails file creation when non-default free-space info is set in fcpl and the library version high bound is less than v110 because free-space info message is introduced in library release v110. Merge pull request #1772 in HDFFV/hdf5 from ~VCHOI/my_third_fork:bugfix/HDFFV-10808-h5pset_file_space_strategy-succeeds to develop * commit '3768566139df18928aa29ece0eff3010b224633b': Add release notes. Correct hid_t error value to H5I_INVALID_HID in tests related to libver_bounds. Fix for HDFFV-10808 H5Pset_file_space_strategy succeeds when using H5Pset_libver_bounds v18,v18. Fails file creation when non-default free-space info is set in fcpl and the library version high bound is less than v110 because free-space info message is introduced in library release v110. Conflicts: test/tfile.c --- release_docs/RELEASE.txt | 16 ++ src/H5Fpkg.h | 3 + src/H5Fsuper.c | 63 ++++++ src/H5MF.c | 3 + src/H5Ofsinfo.c | 10 +- src/H5Oprivate.h | 12 ++ test/tfile.c | 485 +++++++++++++++++++++++++---------------------- 7 files changed, 364 insertions(+), 228 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f5d85cd..b3514c4 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -376,6 +376,22 @@ Bug Fixes since HDF5-1.10.4 release Library ------- + - Fixed an issue where creating a file with non-default file space info + together with library high bound setting to H5F_LIBVER_V18. + + When setting non-default file space info in fcpl via + H5Pset_file_space_strategy() and then creating a file with + both high and low library bounds set to + H5F_LIBVER_V18 in fapl, the library succeeds in creating the file. + File creation should fail because the feature of setting non-default + file space info does not exist in library release 1.8 or earlier. + + This was fixed by setting and checking the proper version in the + file space info message based on the library low and high bounds + when creating and opening the HDF5 file. + + (VC - 2019/6/25, HDFFV-10808) + - Fixed an issue where copying a version 1.8 dataset between files using H5Ocopy fails due to an incompatible fill version diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 663f84e..7bd9a47 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -311,6 +311,9 @@ struct H5F_file_t { H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ hbool_t fs_persist; /* Free-space persist or not */ + unsigned fs_version; /* Free-space version: */ + /* It is used to update fsinfo message in the superblock + extension when closing down the free-space managers */ hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */ haddr_t tmp_addr; /* Next address to use for temp. space in the file */ hbool_t point_of_no_return; /* Flag to indicate that we can't go back and delete a freespace header when it's used up */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 9339b3d..8d165ec 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -79,6 +79,15 @@ static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; +/* Format version bounds for fsinfo message */ +/* This message exists starting library release v1.10 */ +static const unsigned H5O_fsinfo_ver_bounds[] = { + H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ + H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ + H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ + H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; + /*------------------------------------------------------------------------- * Function: H5F__super_ext_create @@ -784,6 +793,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message") /* Update changed values */ + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + if(f->shared->fs_version != fsinfo.version) + f->shared->fs_version = fsinfo.version; + if(f->shared->fs_strategy != fsinfo.strategy) { f->shared->fs_strategy = fsinfo.strategy; @@ -1376,6 +1393,11 @@ H5F__super_init(H5F_t *f) fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.mapped = FALSE; + /* Set the version for the fsinfo message */ + if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") + f->shared->fs_version = fsinfo.version; + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; @@ -1800,3 +1822,44 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5O__fsinfo_set_version + * + * Purpose: Set the version to encode the fsinfo message with. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) +{ + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(f); + HDassert(fsinfo); + + version = H5O_FSINFO_VERSION_1; + + /* Upgrade to the version indicated by the file's low bound if higher */ + if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) + version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + + /* Set the message version */ + fsinfo->version = version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__fsinfo_set_version() */ diff --git a/src/H5MF.c b/src/H5MF.c index 65b27db..065a5c6 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1835,6 +1835,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; + fsinfo.version = f->shared->fs_version; /* Write the free space manager message -- message must already exist */ if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) @@ -1973,6 +1974,8 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; + fsinfo.version = f->shared->fs_version; + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index bb15f62..ec2328c 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -65,10 +65,6 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ H5O__fsinfo_debug /* debug the message */ }}; -/* Current version of free-space manager info information */ -#define H5O_FSINFO_VERSION_0 0 -#define H5O_FSINFO_VERSION_1 1 - /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); @@ -157,11 +153,13 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy") } /* end switch */ + fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; } else { - HDassert(vers == H5O_FSINFO_VERSION_1); + HDassert(vers >= H5O_FSINFO_VERSION_1); + fsinfo->version = vers; fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */ fsinfo->persist = *p++; /* Free-space persist or not */ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */ @@ -214,7 +212,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = H5O_FSINFO_VERSION_1; /* message version */ + *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 34683fe..955155b 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -803,6 +803,17 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1 */ typedef unsigned H5O_unknown_t; /* Original message type ID */ +/* To indicate an invalid version for a message that does not exist yet for the release */ +/* Message version is 1 byte so the value can be 0 to 255 */ +#define H5O_INVALID_VERSION 256 + +/* The initial version of the fsinfo message: deprecated */ +/* This version is mapped to version 1 from release 1.10.1 onwards */ +#define H5O_FSINFO_VERSION_0 0 + +/* The latest version for fsinfo message */ +#define H5O_FSINFO_VERSION_1 1 +#define H5O_FSINFO_VERSION_LATEST H5O_FSINFO_VERSION_1 /* * File space info Message. * Contains file space management info and @@ -810,6 +821,7 @@ typedef unsigned H5O_unknown_t; /* Original message type ID */ * (Data structure in memory) */ typedef struct H5O_fsinfo_t { + unsigned version; /* Version number */ H5F_fspace_strategy_t strategy; /* File space strategy */ hbool_t persist; /* Persisting free-space or not */ hsize_t threshold; /* Free-space section threshold */ diff --git a/test/tfile.c b/test/tfile.c index a73d3e4..fc5aee3 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -181,8 +181,8 @@ const char *FILESPACE_NAME[] = { /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); -static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr); -static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr); +static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); +static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); static void test_libver_bounds_dataset(hid_t fapl); static void test_libver_bounds_dataspace(hid_t fapl); @@ -4526,7 +4526,7 @@ test_filespace_1_10_0_compatible(void) for(j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) { /* Make a copy of the test file */ status = h5_make_local_copy(OLD_1_10_0_FILENAME[j], FILE5); - CHECK(status, FAIL, "h5_make_local_copy"); + CHECK(status, FAIL, "h5_make_local_copy"); /* Open the temporary test file */ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT); @@ -5208,16 +5208,16 @@ test_libver_bounds(void) static void test_libver_bounds_low_high(void) { - hid_t fapl = -1; /* File access property list */ - H5F_libver_t low, high; /* Low and high bounds */ - herr_t ret; /* The return value */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_libver_t low, high; /* Low and high bounds */ + herr_t ret; /* The return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing setting (low, high) format version bounds\n")); /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(fapl, FAIL, "H5Pcreate"); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high version bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) @@ -5280,23 +5280,23 @@ test_libver_bounds_low_high(void) static void test_libver_bounds_super(hid_t fapl) { - hid_t fcpl = -1; /* File creation property list */ - herr_t ret; /* The return value */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + herr_t ret; /* The return value */ /* Create a default fcpl: #A */ /* This will result in superblock version 0 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5305,19 +5305,19 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with v1-btree K value enabled: #B */ /* This will result in superblock version 1 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_istore_k(fcpl, 64); CHECK(ret, FAIL, "H5Pset_istore_k"); /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5326,7 +5326,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with shared messages enabled: #C */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl, 1); CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes"); ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_ATTR_FLAG, 2); @@ -5334,13 +5334,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5349,19 +5349,19 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with persistent free-space manager enabled: #D */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); CHECK(ret, FAIL, "H5Pset_file_space"); /* Verify superblock version when creating a file with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5373,8 +5373,8 @@ test_libver_bounds_super(hid_t fapl) /************************************************************************************************** ** ** test_libver_bounds_super_create(): -** Verify the following when the file is created with the input fapl, fcpl, and -** with/without SWMR access: +** Verify the following when the file is created with the input fapl, fcpl, +** and with/without SWMR access: ** (a) the superblock version # ** (b) the file's low bound setting ** (c) fail or succeed in creating the file @@ -5386,7 +5386,10 @@ test_libver_bounds_super(hid_t fapl) ** in the input fapl. The next three rows list the expected results for #a to #c. ** "-->" indicates "upgrade to" ** -** Creating a file with write access +** The last table lists the expected results in creating the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** Creating a file with write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5397,7 +5400,7 @@ test_libver_bounds_super(hid_t fapl) ** File creation | succeed | ** |______________________________________________________________________________| ** -** Creating a file with SWMR-write access +** Creating a file with SWMR-write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5405,18 +5408,25 @@ test_libver_bounds_super(hid_t fapl) ** |------------------------------------------------------------------------------| ** File's low bound | -- | ->v110 | -- | ->v110 | no change | ** |------------------------------------------------------------------------------| -** File creation | fail | succeed | fail | succeed | succed | +** File creation | fail | succeed | fail | succeed | succeed | +** |______________________________________________________________________________| +** +** Creating a file with write/SWMR-write access + non-default fsinfo +** -------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | +** |______________________________________________________________________________| +** File creation | fail | succeed | fail | succeed | succeed | ** |______________________________________________________________________________| ** ******************************************************************************************************/ static void -test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - H5F_libver_t low, high; /* Low and high bounds */ - hbool_t ok; /* The result is ok or not */ - herr_t ret; /* The return value */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + H5F_libver_t low, high; /* Low and high bounds */ + hbool_t ok; /* The result is ok or not */ + herr_t ret; /* The return value */ /* Try to create the file */ H5E_BEGIN_TRY { @@ -5433,8 +5443,10 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ret = H5Pget_libver_bounds(fapl, &low, &high); CHECK(ret, FAIL, "H5Pget_libver_bounds"); - if(is_swmr) { /* SWMR is enabled */ + if(non_def_fsm && high < H5F_LIBVER_LATEST) + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); + else if(is_swmr) { /* SWMR is enabled */ if(high == H5F_LIBVER_LATEST) { /* Should succeed */ VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds"); @@ -5456,9 +5468,9 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) break; case H5F_LIBVER_V18: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_V110: ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); @@ -5468,10 +5480,11 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) case H5F_LIBVER_ERROR: case H5F_LIBVER_NBOUNDS: default: - ERROR("H5Pget_libver_bounds"); + ERROR("H5Pget_libver_bounds"); } /* end switch */ - } + + } /* end else */ if(fid >= 0) { /* Close the file */ ret = H5Fclose(fid); @@ -5498,11 +5511,14 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** For file open, the file's superblock version, the low/high bounds setting in fapl, ** and with/without SWMR file access will determine the results for #a and #b. ** -** The first row for the following tables is the 5 pairs of low/high bounds setting +** The first row for the following tables (#A - #B) is the 5 pairs of low/high bounds setting ** in the input fapl. The next two rows list the expected results for #a and #b. ** "-->" indicates "upgrade to" ** -** Opening a file with write access +** The last table (#C) lists the expected results in opening the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** (A) Opening a file with write access ** ** Superblock version 0, 1 ** -------------------------------------------------------------------------------- @@ -5534,7 +5550,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** ** ** -** Opening a file with SWMR-write access +** (B) Opening a file with SWMR-write access ** ** Superblock version 0, 1, 2 ** ------------------------------------------------------------------------------- @@ -5556,108 +5572,133 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** |_____________________________________________________________________________| ** ** +** (C) Opening a file with write/SWMR-write access + non-default fsinfo +** ------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v10) | (v18, v18) | (v18, v110) | (v110, v110) | +** |_____________________________________________________________________________| +** File open | fail | succeed | fail | succeed | succeed | +** |_____________________________________________________________________________| +** +** ******************************************************************************************************/ static void -test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ - fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + H5E_BEGIN_TRY { + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; - /* Get the internal file pointer */ - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); + /* Retrieve the low/high bounds */ + ret = H5Pget_libver_bounds(fapl, &low, &high); + CHECK(ret, FAIL, "H5Pget_libver_bounds"); - /* The file's superblock version */ - super_vers = f->shared->sblock->super_vers; + if(non_def_fsm && high < H5F_LIBVER_LATEST) { + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + } else { + VERIFY(fid >= 0, TRUE, "H5Fcreate"); - /* Create a default file access property list */ - new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + /* Get the internal file pointer */ + f = (H5F_t *)H5I_object(fid); + CHECK(f, NULL, "H5I_object"); - /* Loop through all the combinations of low/high bounds in new_fapl */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { - H5E_BEGIN_TRY { - ret = H5Pset_libver_bounds(new_fapl, low, high); - } H5E_END_TRY; + /* The file's superblock version */ + super_vers = f->shared->sblock->super_vers; - /* Invalid combinations */ - if (ret < 0) - continue; + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Open the file with or without SWMR access */ - H5E_BEGIN_TRY { - fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); - } H5E_END_TRY; + /* Create a default file access property list */ + new_fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(new_fapl, FAIL, "H5Pcreate"); - /* Get the internal file pointer if the open succeeds */ - if(fid >= 0) { - f = (H5F_t *)H5I_object(fid); - CHECK(f, NULL, "H5I_object"); - } + /* Loop through all the combinations of low/high bounds in new_fapl */ + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + H5E_BEGIN_TRY { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; - /* Verify the file open succeeds or fails */ - switch(super_vers) { - case 3: - if(high == H5F_LIBVER_LATEST) { - /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } else /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - break; - - case 2: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; - - case 1: - case 0: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); - - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; + /* Invalid combinations */ + if (ret < 0) + continue; + + /* Open the file with or without SWMR access */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); + } H5E_END_TRY; + + if(non_def_fsm && high < H5F_LIBVER_LATEST) { + VERIFY(fid, H5I_INVALID_HID, "H5Fopen"); + continue; + } + + /* Get the internal file pointer if the open succeeds */ + if(fid >= 0) { + f = (H5F_t *)H5I_object(fid); + CHECK(f, NULL, "H5I_object"); + } + + /* Verify the file open succeeds or fails */ + switch(super_vers) { + case 3: + if(high == H5F_LIBVER_LATEST) { + /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } else /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + break; - default: - break; - } /* end switch */ + case 2: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + case 1: + case 0: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + default: + break; + } /* end switch */ + } /* end for */ } /* end for */ - } /* end for */ - /* Close the file access property list */ - ret = H5Pclose(new_fapl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close the file access property list */ + ret = H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end else */ } /* end test_libver_bounds_super_open() */ @@ -5690,10 +5731,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) static void test_libver_bounds_obj(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ H5O_info_t oinfo; /* Object info */ @@ -5706,7 +5747,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a default file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared message in the fcpl */ /* This will result in a version 2 object header */ @@ -5717,7 +5758,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create the file with the fcpl and the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -5736,7 +5777,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a file with the default fcpl and input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -5752,7 +5793,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a new default file access property list which is used to open the file in the "for" loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file with the fapl; create a group and verify the @@ -5850,11 +5891,11 @@ test_libver_bounds_obj(hid_t fapl) static void test_libver_bounds_dataset(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ H5D_t *dset = NULL; /* Internal dataset pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -5871,15 +5912,15 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create the dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a contiguous dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataset pointer */ dset = (H5D_t *)H5I_object(did); @@ -5911,9 +5952,9 @@ test_libver_bounds_dataset(hid_t fapl) with "no filter edge chunks" enabled. This will result in a version 4 layout message */ sid = H5Screate_simple(2, fix_dims2, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, fix_chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); @@ -5954,14 +5995,14 @@ test_libver_bounds_dataset(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset with 2 unlimited dimensions in the 'for' loop */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -5990,7 +6031,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal file pointer */ dset = (H5D_t *)H5I_object(did); @@ -6074,14 +6115,14 @@ test_libver_bounds_dataset(hid_t fapl) static void test_libver_bounds_dataspace(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1, did_null = -1; /* Dataset IDs */ - hid_t did_compact = -1, did_contig = -1; /* Dataset IDs */ - hid_t sid = -1, sid_null = -1; /* Dataspace IDs */ - hid_t sid_compact = -1, sid_contig = -1; /* Dataspace IDs */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dcpl_compact = -1, dcpl_contig = -1; /* Dataset creation property lists */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID, did_null = H5I_INVALID_HID; /* Dataset IDs */ + hid_t did_compact = H5I_INVALID_HID, did_contig = H5I_INVALID_HID; /* Dataset IDs */ + hid_t sid = H5I_INVALID_HID, sid_null = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid_compact = H5I_INVALID_HID, sid_contig = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dcpl_compact = H5I_INVALID_HID, dcpl_contig = H5I_INVALID_HID; /* Dataset creation property lists */ H5S_t *space = NULL, *space_null = NULL; /* Internal dataspace pointers */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6097,19 +6138,19 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create scalar dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the scalar dataspace */ did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid = H5Dget_space(did); - CHECK(sid, FAIL, "H5Dget_space"); + CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); space = (H5S_t *)H5I_object(sid); CHECK(space, NULL, "H5I_object"); @@ -6118,15 +6159,15 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create null dataspace */ sid_null = H5Screate(H5S_NULL); - CHECK(sid_null, FAIL, "H5Screate"); + CHECK(sid_null, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the null dataspace */ did_null = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_INT, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did_null, FAIL, "H5Dcreate"); + CHECK(did_null, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid_null = H5Dget_space(did_null); - CHECK(sid_null, FAIL, "H5Dget_space"); + CHECK(sid_null, H5I_INVALID_HID, "H5Dget_space"); space_null = (H5S_t *)H5I_object(sid_null); CHECK(space_null, NULL, "H5I_object"); @@ -6152,29 +6193,29 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(1, dims, max_dims); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 1, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); /* Set up dataspace and dcpl for creating a compact dataset */ sid_compact = H5Screate_simple(1, dims, NULL); - CHECK(sid_compact, FAIL, "H5Screate_simple"); + CHECK(sid_compact, H5I_INVALID_HID, "H5Screate_simple"); dcpl_compact = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_compact, FAIL, "H5Pcreate"); + CHECK(dcpl_compact, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_compact, H5D_COMPACT); CHECK(ret, FAIL, "H5Pset_layout"); /* Set up dataspace and dcpl for creating a contiguous dataset */ sid_contig = H5Screate_simple(2, dims2, NULL); - CHECK(sid_contig, FAIL, "H5Screate_simple"); + CHECK(sid_contig, H5I_INVALID_HID, "H5Screate_simple"); dcpl_contig = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_contig, FAIL, "H5Pcreate"); + CHECK(dcpl_contig, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS); CHECK(ret, FAIL, "H5Pset_layout"); @@ -6206,31 +6247,31 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the chunked dataset */ tmp_sid = H5Dget_space(did); - CHECK(tmp_sid, FAIL, "H5Dget_space"); + CHECK(tmp_sid, H5I_INVALID_HID, "H5Dget_space"); tmp_space = (H5S_t *)H5I_object(tmp_sid); CHECK(tmp_space, NULL, "H5I_object"); /* Create the compact dataset */ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT); - CHECK(did_compact, FAIL, "H5Dcreate2"); + CHECK(did_compact, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the compact dataset */ tmp_sid_compact = H5Dget_space(did_compact); - CHECK(tmp_sid_compact, FAIL, "H5Dget_space"); + CHECK(tmp_sid_compact, H5I_INVALID_HID, "H5Dget_space"); tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact); CHECK(tmp_space_compact, NULL, "H5I_object"); /* Create the contiguous dataset */ did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT); - CHECK(did_contig, FAIL, "H5Dcreate2"); + CHECK(did_contig, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the contiguous dataset */ tmp_sid_contig = H5Dget_space(did_contig); - CHECK(tmp_sid_contig, FAIL, "H5Dget_space"); + CHECK(tmp_sid_contig, H5I_INVALID_HID, "H5Dget_space"); tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig); CHECK(tmp_space_contig, NULL, "H5I_object"); @@ -6312,8 +6353,8 @@ test_libver_bounds_dataspace(hid_t fapl) static void test_libver_bounds_datatype(hid_t fapl) { - hid_t tid = -1, tid_enum = -1, tid_array = -1; /* Datatype IDs */ - hid_t tid_compound = -1, tid_vlen = -1; /* Datatype IDs */ + hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */ + hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */ int enum_value; /* Value for enum datatype */ typedef struct s1 { /* Data structure for compound datatype */ char c; @@ -6404,13 +6445,13 @@ test_libver_bounds_datatype(hid_t fapl) static void test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File acess property list */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dtid = -1; /* Datatype ID for the dataset */ - hid_t str_tid = -1; /* String datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File acess property list */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dtid = H5I_INVALID_HID; /* Datatype ID for the dataset */ + hid_t str_tid = H5I_INVALID_HID; /* String datatype ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ hsize_t dims[1] = {1}; /* Dimension sizes */ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ @@ -6427,12 +6468,12 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create a committed datatype of string which will be used later inside the 'for' loop */ str_tid = H5Tcopy(H5T_C_S1); - CHECK(str_tid, FAIL, "H5Tcopy"); + CHECK(str_tid, H5I_INVALID_HID, "H5Tcopy"); ret = H5Tset_size(str_tid, (size_t)10); CHECK(ret, FAIL, "H5Tset_size"); ret = H5Tcommit2(fid, "datatype", str_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6442,15 +6483,15 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create dataspace */ sid = H5Screate_simple(1, dims, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); /* Create a dataset with the input tid */ did = H5Dcreate2(fid, DSET1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6492,13 +6533,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create a default file access property list */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -6542,11 +6583,11 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6639,14 +6680,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) static void test_libver_bounds_attributes(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ - hid_t tid = -1; /* Datatype ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t attr_cpl = -1; /* Attribute creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t tid = H5I_INVALID_HID; /* Datatype ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t attr_cpl = H5I_INVALID_HID; /* Attribute creation property list */ H5A_t *attr = NULL; /* Internal attribute pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6658,11 +6699,11 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Integer datatpye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create a committed datatype */ ret = H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6670,15 +6711,15 @@ test_libver_bounds_attributes(hid_t fapl) /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with the committed datatype */ aid = H5Acreate2(gid, "attr1", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); @@ -6712,13 +6753,13 @@ test_libver_bounds_attributes(hid_t fapl) /* Enable character encoding in attribute creation property list */ attr_cpl = H5Pcreate(H5P_ATTRIBUTE_CREATE); - CHECK(attr_cpl, FAIL, "H5Pcreate"); + CHECK(attr_cpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_char_encoding(attr_cpl, H5T_CSET_UTF8); CHECK(ret, FAIL, "H5Pset_char_encoding"); /* Attach an attribute to the group with character encoding set */ aid = H5Acreate2(gid, "attr3", H5T_NATIVE_INT, sid, attr_cpl, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); @@ -6757,7 +6798,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a copy of the file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared datatype message */ ret = H5Pset_shared_mesg_nindexes(fcpl, 1); @@ -6767,23 +6808,23 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file with shared datatype message enabled */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create an integer datatye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with shared integer datatype */ aid = H5Acreate2(gid, ATTR_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5I_object(aid); @@ -6822,7 +6863,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a scalar dataspace to be used later for the attribute */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Loop through all the combinations of low/high bounds */ /* Open the file and group and attach an attribute to the group */ -- cgit v0.12 From 34adba4a0c131afe49a75e8e7d92f1e986c1b540 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 24 Jul 2019 11:08:47 -0500 Subject: HDFFV-10845, 10529 and CMake changes from develop --- CMakeInstallation.cmake | 18 +- CMakeLists.txt | 8 +- MANIFEST | 4 - bin/batch/cori_knl_ctestS.sl.in.cmake | 16 - bin/batch/ctestP.lsf.in.cmake | 2 +- bin/batch/ctestP.sl.in.cmake | 6 +- bin/batch/ctestS.lsf.in.cmake | 2 +- bin/batch/knl_ctestP.sl.in.cmake | 6 +- bin/batch/ray_ctestP.lsf.in.cmake | 2 +- c++/examples/CMakeLists.txt | 10 + c++/examples/CMakeTests.cmake | 132 +- c++/src/CMakeLists.txt | 11 +- c++/test/CMakeLists.txt | 5 + c++/test/CMakeTests.cmake | 3 +- c++/test/CMakeVFDTests.cmake | 4 +- config/cmake/CTestCustom.cmake | 181 +- config/cmake/CTestScript.cmake | 7 +- config/cmake/ConfigureChecks.cmake | 2 +- config/cmake/HDF5UseFortran.cmake | 3 +- config/cmake/jrunTest.cmake | 18 +- config/cmake/scripts/CTestScript.cmake | 2 +- config/cmake/scripts/HDF5config.cmake | 6 +- config/cmake/userblockTest.cmake | 8 +- config/cmake/vfdTest.cmake | 4 +- config/cmake_ext_mod/ConfigureChecks.cmake | 55 +- config/cmake_ext_mod/FindSZIP.cmake | 2 +- config/cmake_ext_mod/HDFMacros.cmake | 44 +- config/cmake_ext_mod/HDFUseFortran.cmake | 2 +- config/cmake_ext_mod/grepTest.cmake | 14 +- config/cmake_ext_mod/runTest.cmake | 24 +- config/toolchain/mingw64.cmake | 2 +- examples/CMakeTests.cmake | 188 +- fortran/examples/CMakeTests.cmake | 58 +- fortran/src/CMakeLists.txt | 38 +- fortran/test/CMakeLists.txt | 4 +- fortran/test/CMakeTests.cmake | 56 +- hl/c++/examples/CMakeTests.cmake | 4 +- hl/c++/src/CMakeLists.txt | 2 +- hl/c++/test/CMakeTests.cmake | 9 +- hl/examples/CMakeTests.cmake | 63 +- hl/fortran/examples/CMakeTests.cmake | 13 +- hl/fortran/src/CMakeLists.txt | 4 +- hl/fortran/test/CMakeTests.cmake | 24 +- hl/src/CMakeLists.txt | 2 +- hl/test/CMakeTests.cmake | 88 +- hl/tools/gif2h5/CMakeLists.txt | 2 +- hl/tools/gif2h5/CMakeTests.cmake | 36 +- hl/tools/h5watch/CMakeTests.cmake | 32 +- java/examples/datasets/CMakeLists.txt | 59 +- java/examples/datatypes/CMakeLists.txt | 56 +- java/examples/groups/CMakeLists.txt | 64 +- java/examples/intro/CMakeLists.txt | 56 +- java/src/jni/h5lImp.c | 4 +- java/test/CMakeLists.txt | 11 +- java/test/TestH5F.java | 58 +- java/test/TestH5Fparams.java | 2 +- java/test/TestH5Z.java | 33 +- release_docs/RELEASE.txt | 25 +- src/CMakeLists.txt | 8 +- src/H5private.h | 14 +- src/H5system.c | 208 +- src/H5win32defs.h | 24 +- test/CMakeLists.txt | 4 +- test/CMakeTests.cmake | 188 +- test/CMakeVFDTests.cmake | 45 +- test/flushrefreshTest.cmake | 6 +- test/links.c | 16756 ++++++++++++------------ test/testhdf5.c | 4 +- testpar/CMakeTests.cmake | 19 +- testpar/CMakeVFDTests.cmake | 9 +- testpar/t_mpi.c | 10 +- testpar/testphdf5.c | 420 +- testpar/testphdf5.h | 1 + tools/src/h5format_convert/h5format_convert.c | 10 +- tools/src/misc/CMakeLists.txt | 7 - tools/test/h5copy/CMakeLists.txt | 2 +- tools/test/h5copy/CMakeTests.cmake | 72 +- tools/test/h5diff/CMakeLists.txt | 2 +- tools/test/h5diff/CMakeTests.cmake | 54 +- tools/test/h5dump/CMakeLists.txt | 2 +- tools/test/h5dump/CMakeTests.cmake | 556 +- tools/test/h5dump/CMakeTestsPBITS.cmake | 133 +- tools/test/h5dump/CMakeTestsVDS.cmake | 87 +- tools/test/h5dump/CMakeTestsXML.cmake | 161 +- tools/test/h5format_convert/CMakeLists.txt | 2 +- tools/test/h5format_convert/CMakeTests.cmake | 125 +- tools/test/h5import/CMakeTests.cmake | 235 +- tools/test/h5jam/CMakeLists.txt | 2 +- tools/test/h5jam/CMakeTests.cmake | 58 +- tools/test/h5ls/CMakeTests.cmake | 161 +- tools/test/h5ls/CMakeTestsVDS.cmake | 68 +- tools/test/h5repack/CMakeTests.cmake | 409 +- tools/test/h5repack/CMakeVFDTests.cmake | 5 +- tools/test/h5repack/h5repacktst.c | 12 +- tools/test/h5stat/CMakeLists.txt | 2 +- tools/test/h5stat/CMakeTests.cmake | 41 +- tools/test/misc/CMakeLists.txt | 4 +- tools/test/misc/CMakeTestsClear.cmake | 307 +- tools/test/misc/CMakeTestsMkgrp.cmake | 114 +- tools/test/misc/CMakeTestsRepart.cmake | 25 +- tools/test/perform/CMakeLists.txt | 17 + tools/test/perform/CMakeTests.cmake | 57 +- tools/test/perform/perf.c | 21 +- 103 files changed, 10356 insertions(+), 11705 deletions(-) delete mode 100644 bin/batch/cori_knl_ctestS.sl.in.cmake diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 3ae5b8b..dc229d2 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -104,6 +104,12 @@ endif () # Configure the hdf5-config-version .cmake file for the install directory #----------------------------------------------------------------------------- if (NOT HDF5_EXTERNALLY_CONFIGURED) + # 3.11 or greater + #write_basic_package_version_file ( + # ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake + # VERSION ${HDF5_PACKAGE_VERSION} + # COMPATIBILITY SameMinorVersion + #) configure_file ( ${HDF_RESOURCES_DIR}/hdf5-config-version.cmake.in ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY @@ -186,7 +192,7 @@ HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN) #----------------------------------------------------------------------------- # Configure the COPYING.txt file for the windows binary package #----------------------------------------------------------------------------- -if (WIN32) +if (WIN32 OR MINGW) configure_file (${HDF5_SOURCE_DIR}/COPYING ${HDF5_BINARY_DIR}/COPYING.txt @ONLY) endif () @@ -206,7 +212,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${HDF5_SOURCE_DIR}/release_docs/COPYING ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt ) - if (WIN32) + if (WIN32 OR MINGW) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_VS.txt @@ -220,7 +226,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL ) - if (WIN32) + if (WIN32 OR MINGW) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt @@ -288,7 +294,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_GENERATOR "ZIP") if (NSIS_EXECUTABLE) @@ -453,7 +459,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut if (HDF5_PACKAGE_EXTLIBS) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/") else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/") @@ -462,7 +468,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut endif () endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/") else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/") diff --git a/CMakeLists.txt b/CMakeLists.txt index 3461632..d8a629e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,12 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) ) endif () +# CMake version 3.14 added option --ignore-eol to compare files +# cmake -E compare_files --ignore-eol file1 file2 +#if(CMAKE_VERSION VERSION_LESS "3.14.0" AND WIN32) +# MESSAGE(FATAL_ERROR "Windows builds requires a minimum of CMake 3.14") +#endif() + #----------------------------------------------------------------------------- # Instructions for use : Sub-Project Build # @@ -512,7 +518,7 @@ endif () # and we need to call the executable from inside the CMake configuration #----------------------------------------------------------------------------- set (EXE_EXT "") -if (WIN32) +if (WIN32 OR MINGW) set (EXE_EXT ".exe") add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) add_definitions (-D_CRT_SECURE_NO_WARNINGS) diff --git a/MANIFEST b/MANIFEST index 848610c..1725aa5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -95,10 +95,6 @@ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure -./bin/batch/cori_ctestP.sl.in.cmake -./bin/batch/cori_ctestS.sl.in.cmake -./bin/batch/cori_knl_ctestP.sl.in.cmake -./bin/batch/cori_knl_ctestS.sl.in.cmake ./bin/batch/ctestP.lsf.in.cmake ./bin/batch/ctestP.sl.in.cmake ./bin/batch/ctestS.lsf.in.cmake diff --git a/bin/batch/cori_knl_ctestS.sl.in.cmake b/bin/batch/cori_knl_ctestS.sl.in.cmake deleted file mode 100644 index c6d9e83..0000000 --- a/bin/batch/cori_knl_ctestS.sl.in.cmake +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -#SBATCH -C knl,quad,cache -#SBATCH --nodes=1 -#SBATCH -t 00:30:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS - -cd @HDF5_BINARY_DIR@ -CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test" - -echo "Run $CMD. Test output will be in build/ctestS.out" -$CMD >& ctestS.out -echo "Done running $CMD" diff --git a/bin/batch/ctestP.lsf.in.cmake b/bin/batch/ctestP.lsf.in.cmake index 2777f39..3fdd5ce 100644 --- a/bin/batch/ctestP.lsf.in.cmake +++ b/bin/batch/ctestP.lsf.in.cmake @@ -14,6 +14,6 @@ cd @HDF5_BINARY_DIR@ echo "Run parallel test command. Test output will be in build/ctestP.out" -ctest . -R 'TEST_PAR|PH5DIFF|PERFORM' -E t_cache_image -C Release -T test >& ctestP.out +ctest . -R MPI_TEST_ -C Release -T test >& ctestP.out echo "Done running ctest parallel command." diff --git a/bin/batch/ctestP.sl.in.cmake b/bin/batch/ctestP.sl.in.cmake index 8d216d6..6399de7 100644 --- a/bin/batch/ctestP.sl.in.cmake +++ b/bin/batch/ctestP.sl.in.cmake @@ -8,9 +8,7 @@ #SBATCH --job-name=h5_ctestP cd @HDF5_BINARY_DIR@ -CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test" +ctest . -R MPI_TEST_ -C Release -T test >& ctestP.out -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out -echo "Done running $CMD" +echo "Done running ctestP.sl" diff --git a/bin/batch/ctestS.lsf.in.cmake b/bin/batch/ctestS.lsf.in.cmake index 7ef5af5..a01d39b 100644 --- a/bin/batch/ctestS.lsf.in.cmake +++ b/bin/batch/ctestS.lsf.in.cmake @@ -11,7 +11,7 @@ cd @HDF5_BINARY_DIR@ echo "Run command. Test output will be in build/ctestS.out" -ctest . -E 'TEST_PAR|PH5DIFF|PERFORM' -C Release -j 32 -T test >& ctestS.out +ctest . -E MPI_TEST_ -C Release -j 32 -T test >& ctestS.out ##$CMD >& ctestS.out echo "Done running command." diff --git a/bin/batch/knl_ctestP.sl.in.cmake b/bin/batch/knl_ctestP.sl.in.cmake index 79dfb89..f985fbb 100644 --- a/bin/batch/knl_ctestP.sl.in.cmake +++ b/bin/batch/knl_ctestP.sl.in.cmake @@ -6,13 +6,11 @@ #SBATCH --mail-type=BEGIN,END,FAIL ##SBATCH --mail-user=@sandia.gov #SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS +#SBATCH --job-name=h5_ctestP cd @HDF5_BINARY_DIR@ #run parallel tests except t_cache_image test -CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test" +ctest . -R MPI_TEST_ -C Release -T test >& ctestP.out -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out echo "Done running $CMD" diff --git a/bin/batch/ray_ctestP.lsf.in.cmake b/bin/batch/ray_ctestP.lsf.in.cmake index 082276a..7067a65 100644 --- a/bin/batch/ray_ctestP.lsf.in.cmake +++ b/bin/batch/ray_ctestP.lsf.in.cmake @@ -15,6 +15,6 @@ cd @HDF5_BINARY_DIR@ echo "Run parallel test command. Test output will be in build/ctestP.out" -ctest . -R 'MPI_TEST_' -E t_cache_image -C Release -T test >& ctestP.out +ctest . -R 'MPI_TEST_' -C Release -T test >& ctestP.out echo "Done running ctest parallel command." diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index 2088019..58d85c1 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -41,6 +41,11 @@ foreach (example ${examples}) else () TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () @@ -54,6 +59,11 @@ foreach (example ${tutr_examples}) else () TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 58bdb68..bbe3433 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -16,81 +16,79 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run - add_test ( - NAME CPP_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - Group.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - ) +add_test ( + NAME CPP_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + Group.h5 + SDS.h5 + SDScompound.h5 + SDSextendible.h5 + Select.h5 +) +set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex) + +foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex) if (last_test) - set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "CPP_ex-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND $) - else () - add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cpp_ex_${example}.txt" - #-D "TEST_REFERENCE=cpp_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "CPP_ex_${example}") - endforeach () + set (last_test "CPP_ex_${example}") +endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create) # SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds) - add_test ( - NAME CPP_ex_tutr-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5tutr_cmprss.h5 - h5tutr_dset.h5 - h5tutr_extend.h5 - h5tutr_group.h5 - h5tutr_groups.h5 - h5tutr_subset.h5 - ) +add_test ( + NAME CPP_ex_tutr-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5tutr_cmprss.h5 + h5tutr_dset.h5 + h5tutr_extend.h5 + h5tutr_group.h5 + h5tutr_groups.h5 + h5tutr_subset.h5 +) +set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex_tutr) + +foreach (example ${tutr_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex_tutr) if (last_test) - set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "CPP_ex_tutr-clear-objects") - - foreach (example ${tutr_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND $) - else () - add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cpp_ex_${example}.txt" - #-D "TEST_REFERENCE=cpp_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "CPP_ex_${example}") - endforeach () + set (last_test "CPP_ex_${example}") +endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtatt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_rdwt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index b141a5e..2a92ed2 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -112,7 +112,14 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) - target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_CPP_LIBSH_TARGET} + PUBLIC ${HDF5_LIBSH_TARGET} + ) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX") set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp) @@ -188,7 +195,7 @@ install ( COMPONENT cpplibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 95ca9b1..75efc3b 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -48,6 +48,11 @@ if (NOT BUILD_SHARED_LIBS) else () TARGET_C_PROPERTIES (cpp_testhdf5 SHARED) target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 02bff3e..a25dc6b 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -32,9 +32,10 @@ add_test ( ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_testhdf5 COMMAND $) + add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 6a8ce2c..b26165a 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -42,15 +42,17 @@ 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}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=cpp_testhdf5" + -D "TEST_OUTPUT=${vfdname}-cpp_testhdf5.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index a3a1652..a05f906 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -39,29 +39,34 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5TEST-flush2 #designed to need flush1 H5TEST-error_test #uses runTest.cmake H5TEST-err_compat #uses runTest.cmake - H5TEST-links_env #uses runTest.cmake H5TEST-testlibinfo #uses grepTest.cmake ######### H5TEST-clear-objects - H5TEST-clear-cache-objects - H5TEST-clear-cache_api-objects - H5TEST-clear-cache_image-objects - H5TEST-clear-cache_tagging-objects - H5TEST-clear-del_many_dense_attrs-objects - H5TEST-clear-err_compat-objects - H5TEST-clear-error_test-objects - H5TEST-clear-filenotclosed-objects - H5TEST-clear-flush-objects - H5TEST-clear-links_env-objects - H5TEST-clear-testflushrefresh-objects - H5TEST-clear-testhdf5-objects - H5TEST-clear-ttsafe-objects + H5TEST-cache-clear-objects + H5TEST-cache_image-clear-objects + H5TEST-del_many_dense_attrs-clear-objects + H5TEST-external_env-clear-objects + H5TEST-filenotclosed-clear-objects + H5TEST-flush-clear-objects + H5TEST-links_env-clear-objects + H5TEST-testflushrefresh-clear-objects + H5TEST-testhdf5-clear-objects + H5TEST-vds_env-clear-objects PERFORM_h5perform-clear-objects - HL_TOOLS-clear-objects HL_test-clear-objects HL_FORTRAN_test-clear-objects FORTRAN_testhdf5-clear-objects + FORTRAN_flush1-clear-objects CPP_testhdf5-clear-objects + ######### examples ######### + EXAMPLES-clear-objects + CPP_ex-clear-objects + CPP_ex_tutr-clear-objects + HL_ex-clear-objects + f90_ex-clear-objects + HL_CPP_ptableTest-clear-objects + HL_CPP_ex_ptExampleFL-clear-objects + HL_FORTRAN_f90_ex-clear-objects ######### tools/h5clear ######### H5CLEAR-clearall-objects H5CLEAR-copy_h5clear_fsm_persist_equal.h5 @@ -90,10 +95,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE ######### tools/h5diff ######### H5DIFF-clearall-objects ######### tools/h5dump ######### - H5DUMP-clearall-objects - H5DUMP_PACKED_BITS-clearall-objects - H5DUMP-XML-clearall-objects - H5DUMP_VDS-clearall-objects H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects @@ -101,136 +102,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5IMPORT-h5importtest-clear-objects H5IMPORT-clear-objects ######### tools/h5jam ######### - H5JAM-SETUP-N_twithub_u10_c-clear-objects - H5JAM-SETUP-N_twithub_u10_c - H5JAM-N_twithub_u10_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u10_c - H5JAM-CHECKFILE-N_twithub_u10_c-clear-objects - H5JAM-SETUP-N_twithub_u511_c-clear-objects - H5JAM-SETUP-N_twithub_u511_c - H5JAM-N_twithub_u511_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u511_c - H5JAM-CHECKFILE-N_twithub_u511_c-clear-objects - H5JAM-SETUP-N_twithub_u512_c-clear-objects - H5JAM-SETUP-N_twithub_u512_c - H5JAM-N_twithub_u512_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u512_c - H5JAM-CHECKFILE-N_twithub_u512_c-clear-objects - H5JAM-SETUP-N_twithub_u513_c-clear-objects - H5JAM-SETUP-N_twithub_u513_c - H5JAM-N_twithub_u513_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u513_c - H5JAM-CHECKFILE-N_twithub_u513_c-clear-objects - H5JAM-SETUP-N_twithub513_u10_c-clear-objects - H5JAM-SETUP-N_twithub513_u10_c - H5JAM-N_twithub513_u10_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u10_c - H5JAM-CHECKFILE-N_twithub513_u10_c-clear-objects - H5JAM-SETUP-N_twithub513_u511_c-clear-objects - H5JAM-SETUP-N_twithub513_u511_c - H5JAM-N_twithub513_u511_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u511_c - H5JAM-CHECKFILE-N_twithub513_u511_c-clear-objects - H5JAM-SETUP-N_twithub513_u512_c-clear-objects - H5JAM-SETUP-N_twithub513_u512_c - H5JAM-N_twithub513_u512_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u512_c - H5JAM-CHECKFILE-N_twithub513_u512_c-clear-objects - H5JAM-SETUP-N_twithub513_u513_c-clear-objects - H5JAM-SETUP-N_twithub513_u513_c - H5JAM-N_twithub513_u513_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u513_c - H5JAM-CHECKFILE-N_twithub513_u513_c-clear-objects - H5JAM-CHECKFILE-twithub_u10_c-clear-objects - H5JAM-twithub_u511_c-clear-objects - H5JAM-CHECKFILE-twithub_u511_c-clear-objects - H5JAM-twithub_u512_c-clear-objects - H5JAM-CHECKFILE-twithub_u512_c-clear-objects - H5JAM-twithub_u513_c-clear-objects - H5JAM-CHECKFILE-twithub_u513_c-clear-objects - H5JAM-twithub513_u10_c-clear-objects - H5JAM-CHECKFILE-twithub513_u10_c-clear-objects - H5JAM-twithub513_u511_c-clear-objects - H5JAM-CHECKFILE-twithub513_u511_c-clear-objects - H5JAM-twithub513_u512_c-clear-objects - H5JAM-CHECKFILE-twithub513_u512_c-clear-objects - H5JAM-twithub513_u513_c-clear-objects - H5JAM-CHECKFILE-twithub513_u513_c-clear-objects - H5JAM-SETUP-twithub_tall-clear-objects - H5JAM-SETUP-twithub_tall - H5JAM-UNJAM-twithub_tall-clear-objects - H5JAM-UNJAM_D-twithub_tall-clear-objects - H5JAM-CHECKFILE-twithub_tall-clear-objects - H5JAM-SETUP-twithub513_tall-clear-objects - H5JAM-SETUP-twithub513_tall - H5JAM-UNJAM-twithub513_tall-clear-objects - H5JAM-UNJAM_D-twithub513_tall-clear-objects - H5JAM-CHECKFILE-twithub513_tall-clear-objects - H5JAM-SETUP-N_twithub_tall-clear-objects - H5JAM-SETUP-N_twithub_tall - H5JAM-UNJAM-N_twithub_tall-clear-objects - H5JAM-UNJAM_D-N_twithub_tall-clear-objects - H5JAM-CHECKFILE-N_twithub_tall-clear-objects - H5JAM-SETUP-N_twithub513_tall-clear-objects - H5JAM-SETUP-N_twithub513_tall - H5JAM-UNJAM-N_twithub513_tall-clear-objects - H5JAM-UNJAM_D-N_twithub513_tall-clear-objects - H5JAM-CHECKFILE-N_twithub513_tall-clear-objects - H5JAM-SETUP-D_twithub_tall-clear-objects - H5JAM-SETUP-D_twithub_tall - H5JAM-UNJAM-D_twithub_tall-clear-objects - H5JAM-UNJAM_D-D_twithub_tall-clear-objects - H5JAM-CHECKFILE-D_twithub_tall-clear-objects - H5JAM-SETUP-D_twithub513_tall-clear-objects - H5JAM-SETUP-D_twithub513_tall - H5JAM-UNJAM-D_twithub513_tall-clear-objects - H5JAM-UNJAM_D-D_twithub513_tall-clear-objects - H5JAM-CHECKFILE-D_twithub513_tall-clear-objects - H5JAM-CHECKFILE-ta_u513-clear-objects - H5JAM-twithub_u10-clear-objects - H5JAM-CHECKFILE-twithub_u10-clear-objects - H5JAM-twithub_u511-clear-objects - H5JAM-CHECKFILE-twithub_u511-clear-objects - H5JAM-twithub_u512-clear-objects - H5JAM-CHECKFILE-twithub_u512-clear-objects - H5JAM-twithub_u513-clear-objects - H5JAM-CHECKFILE-twithub_u513-clear-objects - H5JAM-twithub513_u10-clear-objects - H5JAM-CHECKFILE-twithub513_u10-clear-objects - H5JAM-twithub513_u511-clear-objects - H5JAM-CHECKFILE-twithub513_u511-clear-objects - H5JAM-twithub513_u512-clear-objects - H5JAM-CHECKFILE-twithub513_u512-clear-objects - H5JAM-twithub513_u513-clear-objects - H5JAM-CHECKFILE-twithub513_u513-clear-objects - H5JAM-twithub_u10_c-clear-objects - H5JAM-tall_u10-clear-objects - H5JAM-CHECKFILE-tall_u10-clear-objects - H5JAM-tall_u511-clear-objects - H5JAM-CHECKFILE-tall_u511-clear-objects - H5JAM-tall_u512-clear-objects - H5JAM-CHECKFILE-tall_u512-clear-objects - H5JAM-tall_u513-clear-objects - H5JAM-CHECKFILE-tall_u513-clear-objects - H5JAM-SETUP-ta_u10-clear-objects - H5JAM-SETUP-ta_u10 - H5JAM-ta_u10-clear-objects - H5JAM-NONE_COPY-ta_u10 - H5JAM-CHECKFILE-ta_u10-clear-objects - H5JAM-SETUP-ta_u511-clear-objects - H5JAM-SETUP-ta_u511 - H5JAM-ta_u511-clear-objects - H5JAM-NONE_COPY-ta_u511 - H5JAM-CHECKFILE-ta_u511-clear-objects - H5JAM-SETUP-ta_u512-clear-objects - H5JAM-SETUP-ta_u512 - H5JAM-ta_u512-clear-objects - H5JAM-NONE_COPY-ta_u512 - H5JAM-CHECKFILE-ta_u512-clear-objects - H5JAM-SETUP-ta_u513-clear-objects - H5JAM-SETUP-ta_u513 - H5JAM-ta_u513-clear-objects - H5JAM-NONE_COPY-ta_u513 ######### tools/h5ls ######### H5LS-clearall-objects H5LS_VDS-clearall-objects @@ -287,7 +158,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK-HDFFV-7840-clear-objects H5REPACK_META-meta_long_N-clear-objects H5REPACK_META-meta_short_N-clear-objects - H5REPACK_OLD-old_style_layout_short_switches-clear-objects H5REPACK_STAT-GS_AGGR-clear-objects H5REPACK_STAT-S_AGGR-clear-objects H5REPACK_STAT-SP_NONE-clear-objects @@ -332,14 +202,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5MKGRP-clearall-objects ######### tools/perform ######### PERFORM_h5perform-clearall-objects - ######### hl/tools/h5watch ######### + ######### hl/tools ######### + HL_TOOLS-clear-objects H5WATCH-clearall-objects - ######### examples ######### - EXAMPLES-clear-objects - CPP_ex-clear-objects - CPP_ex_tutr-clear-objects - HL_ex-clear-objects - f90_ex-clear-objects - HL_CPP_ex_ptExampleFL-clear-objects - HL_FORTRAN_f90_ex-clear-objects ) diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake index 0269ba8..e819e58 100755 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/CTestScript.cmake @@ -72,7 +72,7 @@ set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar or zip file provided ## -------------------------- - if (WIN32) + if (WIN32 AND NOT MINGW) message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) else () @@ -101,6 +101,11 @@ endif () include (ProcessorCount) ProcessorCount (N) if (NOT N EQUAL 0) + if (MAX_PROC_COUNT) + if (N GREATER MAX_PROC_COUNT) + set (N ${MAX_PROC_COUNT}) + endif () + endif () if (NOT WIN32) set (CTEST_BUILD_FLAGS -j${N}) endif () diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index c1abeed..3bd0553 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -102,7 +102,7 @@ endif () CHECK_FUNCTION_EXISTS (difftime ${HDF_PREFIX}_HAVE_DIFFTIME) # Find the library containing clock_gettime() -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (clock_gettime CLOCK_GETTIME_IN_LIBC) CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 279e077..2d3d371 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -14,7 +14,8 @@ # This file provides functions for HDF5 specific Fortran support. # #------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) +enable_language (Fortran) + set (HDF_PREFIX "H5") include (CheckFortranFunctionExists) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 44ac15b..fa687f5 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -49,7 +49,7 @@ endif () message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") -if (WIN32 AND NOT MINGW) +if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -124,9 +124,11 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) @@ -186,9 +188,11 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () # now compare the error output with the error reference diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index e1fe85a..dc3939e 100755 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -69,7 +69,7 @@ set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar file provided ## -------------------------- - if (WIN32) + if (WIN32 AND NOT MINGW) message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) else () diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 2a80277..d327aa0 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -90,7 +90,7 @@ endif () set (CTEST_BINARY_NAME "build") set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") -if (WIN32) +if (WIN32 AND NOT MINGW) set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else () @@ -104,7 +104,7 @@ if (NOT DEFINED HPC) if (NOT DEFINED BUILD_GENERATOR) message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") endif () - if (WIN32) + if (WIN32 AND NOT MINGW) set (SITE_OS_NAME "Windows") set (SITE_OS_VERSION "WIN7") if (BUILD_GENERATOR STREQUAL "VS201764") @@ -212,7 +212,7 @@ set (REPOSITORY_BRANCH "hdf5_1_10_6") ################################################################### -if (WIN32) +if (WIN32 AND NOT MINGW) set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 0e9d01b..c9fc36f 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -55,7 +55,7 @@ if (TEST_CHECKUB STREQUAL "YES") # of the user block #s2=`$JAM_BIN/tellub $origfile` EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_OFILE} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_OFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}.len.txt @@ -73,7 +73,7 @@ if (TEST_CHECKUB STREQUAL "YES") if (TEST_O_STRING_LEN) #$JAM_BIN/getub -c $s2 $origfile > $cmpfile EXECUTE_PROCESS ( - COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} + COMMAND ${TEST_EMULATOR} ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}-ub.cmp @@ -91,7 +91,7 @@ if (TEST_CHECKUB STREQUAL "YES") #$JAM_BIN/getub -c $size $hfile > $tfile EXECUTE_PROCESS ( - COMMAND ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE} + COMMAND ${TEST_EMULATOR} ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}.cmp @@ -115,7 +115,7 @@ else () # call 'ubsize' to get the size of the user block #ubsize=`$JAM_BIN/tellub $hfile` EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_HFILE} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_HFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_H_STRING_LEN OUTPUT_VARIABLE TEST_OUT diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 8e186e9..3556d07 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -36,13 +36,13 @@ endif () # set (ERROR_APPEND 1) #endif () -message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") set (ENV{HDF5_DRIVER} "${TEST_VFD}") # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT}_${TEST_VFD}.out diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 63d9ee9..abc88ed 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -61,17 +61,17 @@ endmacro () # ---------------------------------------------------------------------- # WINDOWS Hard code Values # ---------------------------------------------------------------------- - set (WINDOWS) -if (WIN32) - if (MINGW) - set (${HDF_PREFIX}_HAVE_MINGW 1) - set (WINDOWS 1) # MinGW tries to imitate Windows - set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - endif () - set (${HDF_PREFIX}_HAVE_WIN32_API 1) - set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") - if (NOT UNIX AND NOT MINGW) + +if (MINGW) + set (${HDF_PREFIX}_HAVE_MINGW 1) + set (WINDOWS 1) # MinGW tries to imitate Windows + set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") + set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) +endif () + +if (WIN32 AND NOT MINGW) + if (NOT UNIX) set (WINDOWS 1) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) @@ -81,6 +81,8 @@ if (WIN32) endif () if (WINDOWS) + set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) set (${HDF_PREFIX}_HAVE_SYS_STAT_H 1) set (${HDF_PREFIX}_HAVE_SYS_TYPES_H 1) @@ -90,19 +92,16 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) + set (${HDF_PREFIX}_HAVE_FUNCTION 1) endif () - if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) + if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) + set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) + set (${HDF_PREFIX}_HAVE_TIMEZONE 1) + set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) + set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) + set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () - set (${HDF_PREFIX}_HAVE_FUNCTION 1) - set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) - set (${HDF_PREFIX}_HAVE_TIMEZONE 1) - set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) - if (MINGW) - set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) - endif () - set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) - set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () # ---------------------------------------------------------------------- @@ -188,7 +187,7 @@ endif () #----------------------------------------------------------------------------- # Check for the math library "m" #----------------------------------------------------------------------------- -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil ${HDF_PREFIX}_HAVE_LIBM) CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) @@ -264,7 +263,7 @@ set (LINUX_LFS 0) set (HDF_EXTRA_C_FLAGS) set (HDF_EXTRA_FLAGS) -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) # Might want to check explicitly for Linux and possibly Cygwin # instead of checking for not Solaris or Darwin. if (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) @@ -324,7 +323,7 @@ endif () #----------------------------------------------------------------------------- # Check for HAVE_OFF64_T functionality #----------------------------------------------------------------------------- -if (NOT WINDOWS OR MINGW) +if (MINGW OR NOT WINDOWS) HDF_FUNCTION_TEST (HAVE_OFF64_T) if (${HDF_PREFIX}_HAVE_OFF64_T) CHECK_FUNCTION_EXISTS (lseek64 ${HDF_PREFIX}_HAVE_LSEEK64) @@ -403,7 +402,7 @@ if (NOT APPLE) if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) endif () - if (NOT WINDOWS) + if (MINGW OR NOT WINDOWS) HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) endif () endif () @@ -427,7 +426,7 @@ else () HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) endif () -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) #----------------------------------------------------------------------------- # Check if the dev_t type is a scalar type #----------------------------------------------------------------------------- @@ -474,7 +473,7 @@ if (NOT WINDOWS) CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG) CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO) CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) - if (NOT CYGWIN AND NOT MINGW) + if (NOT CYGWIN) CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) endif () CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) @@ -535,7 +534,7 @@ CHECK_FUNCTION_EXISTS (vasprintf ${HDF_PREFIX}_HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) if (${HDF_PREFIX}_HAVE_VSNPRINTF) HDF_FUNCTION_TEST (VSNPRINTF_WORKS) endif () @@ -556,7 +555,7 @@ endif () #----------------------------------------------------------------------------- # Check a bunch of other functions #----------------------------------------------------------------------------- -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) foreach (other_test HAVE_ATTRIBUTE HAVE_C99_FUNC diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index b84d768..2303d6d 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -73,7 +73,7 @@ if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") unset(szip_version_str) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SZIP REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR VERSION_VAR SZIP_VERSION) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 52b96fc..e320c07 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -73,7 +73,7 @@ endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) + if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) get_target_property (target_type ${libtarget} TYPE) if (${libtype} MATCHES "SHARED") set (targetfilename $) @@ -86,7 +86,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) ${targetfilename} DESTINATION ${targetdestination} - CONFIGURATIONS $ + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} OPTIONAL ) @@ -101,7 +101,7 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) $ DESTINATION ${targetdestination} - CONFIGURATIONS $ + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} OPTIONAL ) @@ -110,24 +110,37 @@ endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) - if (WIN32) - set (LIB_DEBUG_SUFFIX "_D") - else () - set (LIB_DEBUG_SUFFIX "_debug") - endif () if (${libtype} MATCHES "SHARED") set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") else () - if (WIN32) + if (WIN32 AND NOT MINGW) set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "lib${libname}${CMAKE_DEBUG_POSTFIX}") else () set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") endif () endif () + set_target_properties (${libtarget} + PROPERTIES + OUTPUT_NAME + ${LIB_RELEASE_NAME} +# OUTPUT_NAME_DEBUG +# ${LIB_DEBUG_NAME} + OUTPUT_NAME_RELEASE + ${LIB_RELEASE_NAME} + OUTPUT_NAME_MINSIZEREL + ${LIB_RELEASE_NAME} + OUTPUT_NAME_RELWITHDEBINFO + ${LIB_RELEASE_NAME} + ) + #get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME) + #get_property (target_name_debug TARGET ${libtarget} PROPERTY OUTPUT_NAME_DEBUG) + #get_property (target_name_rwdi TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + #message (STATUS "${target_name} : ${target_name_debug} : ${target_name_rwdi}") + if (${libtype} MATCHES "STATIC") if (WIN32) set_target_properties (${libtarget} @@ -179,7 +192,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) endif () else () - if (CYGWIN) + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + elseif (CYGWIN) set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index bed1fc1..bfb45fa 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -191,7 +191,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding # Add debug information (intel Fortran : JB) #----------------------------------------------------------------------------- if (CMAKE_Fortran_COMPILER MATCHES ifort) - if (WIN32) + if (WIN32 AND NOT MINGW) set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 4b58639..ab00e70 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -43,10 +43,10 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -60,7 +60,7 @@ endif () # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} @@ -98,9 +98,11 @@ if (TEST_ERRREF) #always compare output file to reference unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) # now compare the output with the reference diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index c9508f3..a904855 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -35,10 +35,10 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -53,7 +53,7 @@ endif () if (NOT TEST_INPUT) # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} @@ -64,7 +64,7 @@ if (NOT TEST_INPUT) else () # run the test program with stdin, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT INPUT_FILE ${TEST_INPUT} @@ -186,9 +186,11 @@ endif () # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) @@ -248,9 +250,11 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) - if (WIN32 AND NOT MINGW) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () # now compare the error output with the error reference diff --git a/config/toolchain/mingw64.cmake b/config/toolchain/mingw64.cmake index ad0fb85..721c39a 100644 --- a/config/toolchain/mingw64.cmake +++ b/config/toolchain/mingw64.cmake @@ -3,7 +3,7 @@ set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) -set (CMAKE_FIND_ROOT_PATH ) +set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 6cab7dd..ea3b2c5 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -15,105 +15,103 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) +file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) - set (test_CLEANFILES - Attributes.h5 - btrees_file.h5 - cmprss.h5 - default_file.h5 - dset.h5 - extend.h5 - extlink_prefix_source.h5 - extlink_source.h5 - extlink_target.h5 - group.h5 - groups.h5 - hard_link.h5 - mount1.h5 - mount2.h5 - one_index_file.h5 - only_dspaces_and_attrs_file.h5 - only_huge_mesgs_file.h5 - REF_REG.h5 - refere.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - separate_indexes_file.h5 - small_lists_file.h5 - soft_link.h5 - subset.h5 - unix2win.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - vds.h5 - vds-exc.h5 - vds-excalibur.h5 - vds-exclim.h5 - vds-percival.h5 - vds-percival-unlim.h5 - vds-percival-unlim-maxmin.h5 - a.h5 - b.h5 - c.h5 - d.h5 - vds-simpleIO.h5 - vds-eiger.h5 - ) +set (test_ex_CLEANFILES + Attributes.h5 + btrees_file.h5 + cmprss.h5 + default_file.h5 + dset.h5 + extend.h5 + extlink_prefix_source.h5 + extlink_source.h5 + extlink_target.h5 + group.h5 + groups.h5 + hard_link.h5 + mount1.h5 + mount2.h5 + one_index_file.h5 + only_dspaces_and_attrs_file.h5 + only_huge_mesgs_file.h5 + REF_REG.h5 + refere.h5 + SDS.h5 + SDScompound.h5 + SDSextendible.h5 + Select.h5 + separate_indexes_file.h5 + small_lists_file.h5 + soft_link.h5 + subset.h5 + unix2win.h5 + blue/prefix_target.h5 + red/prefix_target.h5 + u2w/u2w_target.h5 + vds.h5 + vds-exc.h5 + vds-excalibur.h5 + vds-exclim.h5 + vds-percival.h5 + vds-percival-unlim.h5 + vds-percival-unlim-maxmin.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-simpleIO.h5 + vds-eiger.h5 +) - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} - ) +# Remove any output file left over from previous test run +add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} +) +set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) + +foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) if (last_test) - set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "EXAMPLES-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND $) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") - endforeach () + set (last_test "EXAMPLES-${example}") +endforeach () ### Windows pops up a modal permission dialog on this test - if (H5_HAVE_PARALLEL AND NOT WIN32) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - else () - add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=ph5example.out" - -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" - -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "MPI_TEST_EXAMPLES-ph5example") +if (H5_HAVE_PARALLEL AND NOT WIN32) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + else () + add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=ph5example.out" + -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" + -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + endif () + if (last_test) + set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "MPI_TEST_EXAMPLES-ph5example") +endif () diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 1ad606c..5e7dfa8 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,40 +16,37 @@ ############################################################################## ############################################################################## - set (test_CLEANFILES - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 - ) +set (test_ex_fortran_CLEANFILES + compound.h5 + copy1.h5 + copy2.h5 + dsetf.h5 + extend.h5 + FORTRAN.h5 + groupf.h5 + groupsf.h5 + h5_cmprss.h5 + mount1.h5 + mount2.h5 + sdsf.h5 + subset.h5 + SDScompound.h5 + test.h5 +) - # Remove any output file left over from previous test run - add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} - ) - if (last_test) - set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-clear-objects") +# Remove any output file left over from previous test run +add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} +) +set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex_${example} COMMAND $) + add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -60,6 +57,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () + set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) if (last_test) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () @@ -68,9 +66,10 @@ endforeach () foreach (example ${F2003_examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND $) + add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -81,6 +80,7 @@ foreach (example ${F2003_examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () + set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) if (last_test) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 82a1eb6..dda9c5a 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -84,7 +84,7 @@ if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS H5match_types ) @@ -95,7 +95,7 @@ if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS H5match_types ) @@ -183,7 +183,7 @@ set (f90_F_GEN_SOURCES if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" @@ -197,7 +197,7 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 shared file" @@ -355,18 +355,32 @@ install ( ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h - if (NOT ONLY_SHARED_LIBS) - ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - else () - ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - endif () DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT fortheaders ) +if (NOT ONLY_SHARED_LIBS) + install ( + FILES + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) +else () + install ( + FILES + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) +endif () if (NOT ONLY_SHARED_LIBS) set (mod_files @@ -491,7 +505,7 @@ install ( COMPONENT fortlibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index f0c8ff8..7f0e792 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -83,7 +83,7 @@ endif () if (NOT BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 file" @@ -95,7 +95,7 @@ if (NOT BUILD_SHARED_LIBS) else () add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index ac412c3..e14abec 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -16,7 +16,7 @@ ############################################################################## ############################################################################## -set (test_CLEANFILES +set (testhdf5_fortran_CLEANFILES a.h5 b.h5 c.h5 @@ -55,19 +55,15 @@ set (test_CLEANFILES # Remove any output file left over from previous test run add_test ( NAME FORTRAN_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_fortran_CLEANFILES} ) -if (last_test) - set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) -endif () -set (last_test "FORTRAN_testhdf5-clear-objects") +set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5_fortran) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran COMMAND $) + add_test (NAME FORTRAN_testhdf5_fortran COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -81,13 +77,16 @@ else () ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) +set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for testhdf5_fortran_1_8 if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND $) + add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -101,13 +100,17 @@ else () ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) +set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES + DEPENDS FORTRAN_testhdf5_fortran + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -121,12 +124,29 @@ else () ) endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) +set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES + DEPENDS FORTRAN_testhdf5_fortran_1_8 + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for fflush1 -add_test (NAME FORTRAN_fflush1 COMMAND $) -set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) +add_test ( + NAME FORTRAN_flush1-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flush.h5 +) +add_test ( + NAME FORTRAN_fflush1 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ +) +set_tests_properties (FORTRAN_fflush1 PROPERTIES + DEPENDS FORTRAN_flush1-clear-objects +) #-- Adding test for fflush2 -add_test (NAME FORTRAN_fflush2 COMMAND $) -set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) +add_test ( + NAME FORTRAN_fflush2 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ +) +set_tests_properties (FORTRAN_fflush2 PROPERTIES + DEPENDS FORTRAN_fflush1 +) diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index 103ec2b..7bc614b 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -21,12 +21,14 @@ add_test ( COMMAND ${CMAKE_COMMAND} -E remove PTcppexampleFL.h5 + ptExampleFL.txt ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_CPP_ex_ptExampleFL COMMAND $) + add_test (NAME HL_CPP_ex_ptExampleFL COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ex_ptExampleFL COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 1911d62..9964160 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -108,7 +108,7 @@ install ( COMPONENT hlcpplibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index 785abca..3d0f93a 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -16,10 +16,16 @@ ############################################################################## ############################################################################## +add_test ( + NAME HL_CPP_ptableTest-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${example}.txt +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_CPP_ptableTest COMMAND $) + add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ptableTest COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -30,3 +36,4 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () +set_tests_properties (HL_CPP_ptableTest PROPERTIES DEPENDS HL_CPP_ptableTest-clear-objects) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index c1fd6c2..d0f9018 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -26,41 +26,39 @@ foreach (h5_file ${HDF5_TEST_FILES}) endforeach () add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list}) - # Remove any output file left over from previous test run - add_test ( - NAME HL_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ex_lite1.h5 - ex_lite2.h5 - ex_lite3.h5 - packet_table_FLexample.h5 - ex_image1.h5 - ex_image2.h5 - ex_table_01.h5 - ex_table_02.h5 - ex_table_03.h5 - ex_table_04.h5 - ex_table_05.h5 - ex_table_06.h5 - ex_table_07.h5 - ex_table_08.h5 - ex_table_09.h5 - ex_table_10.h5 - ex_table_11.h5 - ex_table_12.h5 - ex_ds1.h5 - ) - if (last_test) - set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "HL_ex-clear-objects") +# Remove any output file left over from previous test run +add_test ( + NAME HL_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ex_lite1.h5 + ex_lite2.h5 + ex_lite3.h5 + packet_table_FLexample.h5 + ex_image1.h5 + ex_image2.h5 + ex_table_01.h5 + ex_table_02.h5 + ex_table_03.h5 + ex_table_04.h5 + ex_table_05.h5 + ex_table_06.h5 + ex_table_07.h5 + ex_table_08.h5 + ex_table_09.h5 + ex_table_10.h5 + ex_table_11.h5 + ex_table_12.h5 + ex_ds1.h5 +) +set_tests_properties (HL_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_ex_${example} COMMAND $) + add_test (NAME HL_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -72,7 +70,10 @@ foreach (example ${examples}) ) endif () if (last_test) - set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (HL_ex_${example} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED clear_HL_ex + ) endif () set (last_test "HL_ex_${example}") endforeach () diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 91cb56b..b8f40d0 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -21,16 +21,17 @@ add_test ( NAME HL_FORTRAN_f90_ex-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ex_ds1.h5 - exlite.h5 + ex_ds1.h5 + exlite.h5 ) - +set_tests_properties (HL_FORTRAN_f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_f90_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND $) + add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -41,5 +42,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES DEPENDS HL_FORTRAN_f90_ex-clear-objects) + set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES + FIXTURES_REQUIRED clear_HL_FORTRAN_f90_ex + ) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index b63b5c6..e532fff 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -105,7 +105,7 @@ set (HDF5_HL_F90_F_BASE_SOURCES if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" @@ -122,7 +122,7 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 2137d1a..0760b92 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,7 +16,7 @@ ############################################################################## ############################################################################## -set (test_CLEANFILES +set (test_hl_fortran_CLEANFILES dsetf1.h5 dsetf2.h5 dsetf3.h5 @@ -28,11 +28,20 @@ set (test_CLEANFILES tstds.h5 ) +# Remove any output file left over from previous test run +add_test ( + NAME HL_FORTRAN_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_hl_fortran_CLEANFILES} +) +set_tests_properties (HL_FORTRAN_test-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_test) + macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_${file} COMMAND $) + add_test (NAME HL_FORTRAN_f90_${file} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -43,16 +52,11 @@ macro (ADD_H5_FORTRAN_TEST file) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) + set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES + FIXTURES_REQUIRED clear_HL_FORTRAN_test + ) endmacro () -# Remove any output file left over from previous test run -add_test ( - NAME HL_FORTRAN_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} -) - foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_TEST(${h5_test}) endforeach () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 3cce7e4..9bce694 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -132,7 +132,7 @@ install ( COMPONENT hllibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 477a165..716a3d7 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -43,14 +43,53 @@ foreach (h5_file ${HL_REFERENCE_TEST_FILES}) endforeach () add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) +# Remove any output file left over from previous test run +set (test_hl_CLEANFILES + combine_tables1.h5 + combine_tables2.h5 + file_img1.h5 + file_img2.h5 + test_append.h5 + h5do_compat.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_ds10.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_lite3.h5 + test_lite4.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_packet_table_vlen.h5 + testfl_packet_table_vlen.h5 + test_table.h5 +) +add_test ( + NAME HL_test-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES} +) +set_tests_properties (HL_test-clear-objects PROPERTIES FIXTURES_SETUP clear_test_hl) + # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- macro (HL_ADD_TEST hl_name) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_${hl_name} COMMAND $) + add_test (NAME HL_${hl_name} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -61,54 +100,13 @@ macro (HL_ADD_TEST hl_name) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (last_test) - set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} + set_tests_properties (HL_${hl_name} PROPERTIES + FIXTURES_REQUIRED clear_test_hl ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} - ) - endif () + ) endmacro () -# Remove any output file left over from previous test run -add_test ( - NAME HL_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - combine_tables1.h5 - combine_tables2.h5 - file_img1.h5 - file_img2.h5 - test_append.h5 - h5do_compat.h5 - test_detach.h5 - test_ds1.h5 - test_ds2.h5 - test_ds3.h5 - test_ds4.h5 - test_ds5.h5 - test_ds6.h5 - test_ds7.h5 - test_ds8.h5 - test_ds9.h5 - test_ds10.h5 - test_image1.h5 - test_image2.h5 - test_image3.h5 - test_lite1.h5 - test_lite2.h5 - test_lite3.h5 - test_lite4.h5 - test_packet_compress.h5 - test_packet_table.h5 - test_packet_table_vlen.h5 - testfl_packet_table_vlen.h5 - test_table.h5 -) -if (last_test) - set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test}) -endif () -set (last_test "HL_test-clear-objects") - HL_add_test (test_lite ) HL_add_test (test_image) HL_add_test (test_file_image) diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 14a5f5f..3cd913f 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -80,7 +80,7 @@ if (BUILD_TESTING) target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) -# add_test (NAME hl_h52gifgentest COMMAND $) +# add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 1cc989c..8537d7c 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -43,20 +43,32 @@ add_test ( image.gif image24.gif ) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES FIXTURES_SETUP clear_tools_hl) -add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) -set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) +add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/image1.gif image1.h5) +set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES + FIXTURES_REQUIRED clear_tools_hl +) -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) -set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) +add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image1.gif -i image) +set_tests_properties (HL_TOOLS_h52gif PROPERTIES + FIXTURES_REQUIRED clear_tools_hl +) -add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) -set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") -set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) +add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES + WILL_FAIL "true" + FIXTURES_REQUIRED clear_tools_hl +) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) -#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") +#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i palette) +#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES +# WILL_FAIL "true" +# FIXTURES_REQUIRED clear_tools_hl +#) -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) -set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") -set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES + WILL_FAIL "true" + FIXTURES_REQUIRED clear_tools_hl +) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index fba8484..0424140 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -79,6 +79,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -87,7 +88,10 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED gen_test_watch + ) set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") endif () endmacro () @@ -97,6 +101,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -106,7 +111,10 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED gen_test_watch + ) set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") endif () endmacro () @@ -122,6 +130,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -130,7 +139,11 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_REFERENCE=${resultfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH-${resultfile} PROPERTIES DEPENDS H5WATCH-${resultfile}-clear-objects) + set_tests_properties (H5WATCH-${resultfile} PROPERTIES + DEPENDS H5WATCH-${resultfile}-clear-objects + FIXTURES_REQUIRED gen_test_watch + ) + set (last_test "H5WATCH-${resultfile}") endif () endmacro () @@ -148,9 +161,7 @@ if (NOT SWMR_INCOMPAT) # Remove any output file left over from previous test run add_test ( NAME H5WATCH-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - WATCH.h5 + COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5 ) if (last_test) set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) @@ -177,9 +188,12 @@ if (NOT SWMR_INCOMPAT) # # ################################################################################################# # create the output files to be used. - add_test (NAME H5WATCH-h5watchgentest COMMAND $) - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES DEPENDS "H5WATCH-clearall-objects") + add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + set_tests_properties (H5WATCH-h5watchgentest PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS "H5WATCH-clearall-objects" + ) + set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch) set (last_test "H5WATCH-h5watchgentest") # Test on --help options diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 9e5c45c..c64e02e 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -39,7 +39,7 @@ set (HDF_JAVA_SZIP_EXAMPLES set (${HDF_JAVA_EXAMPLES} ${HDF_JAVA_EXAMPLES} ${HDF_JAVA_SZIP_EXAMPLES}) endif (H5_HAVE_FILTER_SZIP) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") @@ -71,60 +71,47 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -macro (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") - add_test ( - NAME JAVA_datasets-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_PROGRAM=examples.datasets.${resultfile}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=datasets/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=datasets/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_datasets-${resultfile}") -endmacro () - if (BUILD_TESTING) + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") + foreach (example ${HDF_JAVA_EXAMPLES}) if (example STREQUAL "H5Ex_D_External") add_test ( NAME JAVA_datasets-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data ) else () add_test ( NAME JAVA_datasets-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (last_test) - set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_datasets-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt ${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects) - set (last_test "JAVA_datasets-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + add_test ( + NAME JAVA_datasets-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_PROGRAM=examples.datasets.${example}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datasets/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=datasets/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_datasets-${example} PROPERTIES DEPENDS JAVA_datasets-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index c939985..70648e4 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -24,7 +24,7 @@ set (HDF_JAVA_EXAMPLES H5Ex_T_VLString ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") @@ -56,49 +56,37 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -MACRO (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") - add_test ( - NAME JAVA_datatypes-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.datatypes.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=datatypes/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=datatypes/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_datatypes-${resultfile}") -ENDMACRO () - if (BUILD_TESTING) + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") + foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( NAME JAVA_datatypes-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (last_test) - set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_datatypes-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt ${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clear-objects) - set (last_test "JAVA_datatypes-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + add_test ( + NAME JAVA_datatypes-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.datatypes.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datatypes/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=datatypes/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_datatypes-${example} PROPERTIES DEPENDS JAVA_datatypes-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 489dab3..e1ad108 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -13,7 +13,7 @@ set (HDF_JAVA_EXAMPLES H5Ex_G_Visit ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") @@ -55,64 +55,48 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES}) endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) -macro (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") - add_test ( - NAME JAVA_groups-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.groups.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=groups/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=groups/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${resultfile}") -endmacro () - if (BUILD_TESTING) + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") + foreach (example ${HDF_JAVA_EXAMPLES}) if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") if (example STREQUAL "H5Ex_G_Compact") add_test ( NAME JAVA_groups-${example}-clear-h5s - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 ) else () add_test ( NAME JAVA_groups-${example}-clear-h5s - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (last_test) - set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${example}-clear-h5s") endif () + add_test ( NAME JAVA_groups-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt ) - if (last_test) - set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-h5s) + add_test ( + NAME JAVA_groups-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.groups.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=groups/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=groups/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_groups-${example} PROPERTIES DEPENDS JAVA_groups-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 1801749..e60af88 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -13,7 +13,7 @@ set (HDF_JAVA_EXAMPLES H5_ReadWrite ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") @@ -57,51 +57,39 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) endforeach () -MACRO (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") - add_test ( - NAME JAVA_intro-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.intro.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=intro/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=intro/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_intro-${resultfile}") -ENDMACRO () - if (BUILD_TESTING) + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( NAME JAVA_intro-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (last_test) - set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_intro-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt ${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clear-objects) - set (last_test "JAVA_intro-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + + add_test ( + NAME JAVA_intro-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.intro.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=intro/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=intro/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_intro-${example} PROPERTIES DEPENDS JAVA_intro-${example}-copy-objects) endforeach () endif () diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c index 7413023..7eee3d4 100644 --- a/java/src/jni/h5lImp.c +++ b/java/src/jni/h5lImp.c @@ -508,11 +508,11 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx UNUSED(clss); + infobuf.type = H5L_TYPE_ERROR; + if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: group name is NULL"); - infobuf.type = H5L_TYPE_ERROR; - PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned"); /* Get the length of the link value */ diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 8464d25..b119dd2 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -81,17 +81,16 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list}) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif () -get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") +get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) - set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") @@ -100,8 +99,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) add_test ( NAME JUnit-${test_file}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove JUnit-${test_file}.out JUnit-${test_file}.out.err ) @@ -123,7 +121,6 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -D "TEST_REFERENCE=JUnit-${test_file}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JUnit-${test_file} PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" DEPENDS "JUnit-${test_file}-clearall-objects" diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java index e4f9a30..dddfd26 100644 --- a/java/test/TestH5F.java +++ b/java/test/TestH5F.java @@ -94,28 +94,12 @@ public class TestH5F { @Test(expected = HDF5LibraryException.class) public void testH5Fget_create_plist_closed() throws Throwable { - long fid = -1; - if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; - } - - try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - fail("H5.H5Fopen: " + err); - } - try { - H5.H5Fclose(fid); - } - catch (Exception ex) { } // it should fail because the file was closed. - H5.H5Fget_create_plist(fid); + H5.H5Fget_create_plist(H5fid); } @Test @@ -134,34 +118,17 @@ public class TestH5F { @Test(expected = HDF5LibraryException.class) public void testH5Fget_access_plist_closed() throws Throwable { - long fid = -1; - if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = -1; - } - - try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - fail("H5.H5Fopen: " + err); - } - try { - H5.H5Fclose(fid); - } - catch (Exception ex) { } // it should fail because the file was closed. - H5.H5Fget_access_plist(fid); + H5.H5Fget_access_plist(H5fid); } @Test public void testH5Fget_intent_rdwr() { int intent = 0; - long fid = -1; if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} @@ -169,31 +136,24 @@ public class TestH5F { } try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); } try { - intent = H5.H5Fget_intent(fid); + intent = H5.H5Fget_intent(H5fid); } catch (Throwable err) { fail("H5.H5Fget_intent: " + err); } assertEquals(HDF5Constants.H5F_ACC_RDWR, intent); - - try { - H5.H5Fclose(fid); - } - catch (Exception ex) { - } } @Test public void testH5Fget_intent_rdonly() { int intent = 0; - long fid = -1; if (H5fid > 0) { try {H5.H5Fclose(H5fid);} catch (Exception ex) {} @@ -201,25 +161,19 @@ public class TestH5F { } try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); } try { - intent = H5.H5Fget_intent(fid); + intent = H5.H5Fget_intent(H5fid); } catch (Throwable err) { fail("H5.H5Fget_intent: " + err); } assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent); - - try { - H5.H5Fclose(fid); - } - catch (Exception ex) { - } } @Test diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 54a4579..c9dbc0c 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -192,7 +192,7 @@ public class TestH5Fparams { HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - fail("H5.H5Fopen: " + err); + fail("H5.H5Fcreate: " + err); } try { diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index 31adf22..27bda6f 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -41,8 +41,8 @@ public class TestH5Z { @Test public void testH5Zfilter_avail() { try { - int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + int filter_found; + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); @@ -51,8 +51,12 @@ public class TestH5Z { assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); -// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + + // Just make sure H5Zfilter_avail() doesn't fail with szip/zlib + // since there is no way for us to determine if they should be present + // or not. + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); } catch (Throwable err) { err.printStackTrace(); @@ -63,9 +67,8 @@ public class TestH5Z { @Test public void testH5Zget_filter_info() { try { - int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + int filter_flag; + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); @@ -78,9 +81,19 @@ public class TestH5Z { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); -// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); -// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); -// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + + if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + // Decode should always be available, but we have no way of determining + // if encode is so don't assert on that. + assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + } } catch (Throwable err) { err.printStackTrace(); diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4f4efe7..4e18ccb 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,12 +47,33 @@ New Features Configuration: ------------- - - Add mingw support with toolchain file + - Update CMake tests to use FIXTURES + + CMake test fixtures allow setup/cleanup tests and other dependency + requirements as properties for tests. This is more flexible for + modern CMake code. + + (ADB - 2019/07/23, HDFFV-10529) + + - Windows PDB files are always installed + + There are build configuration or flag settings for Windows that may not + generate PDB files. If those files are not generated then the install + utility will fail because those PDB files are not found. An optional + variable, DISABLE_PDB_FILES, was added to not install PDB files. + + (ADB - 2019/07/17, HDFFV-10424) + + - Add mingw CMake support with a toolchain file There has been a number of mingw issues that has been linked under HDFFV-10845. It has been decided to implement the CMake cross-compiling technique of toolchain files. We will use a linux platform with the mingw - compiler stack for testing. + compiler stack for testing. Only the C language is fully supported, and + the error tests are skipped. The C++ language works for static but shared + builds has a shared library issue with the mingw Standard Exception Handling + library, which is not available on Windows. Fortran has a common cross-compile + problem with the fortran configure tests. (ADB - 2019/07/12, HDFFV-10845, HDFFV-10595) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 990d626..fa5828a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -934,7 +934,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> PRIVATE $<$:"-O0"> ) @@ -975,7 +975,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 @@ -1024,14 +1024,14 @@ target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_B target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> PRIVATE $<$:"-O0"> ) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c ${HDF5_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 diff --git a/src/H5private.h b/src/H5private.h index 4f5323a..06fd06f 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1332,8 +1332,9 @@ typedef off_t h5_stat_size_t; #define HDsrandom(S) srand(S) #endif /* HDsrandom */ #endif /* H5_HAVE_RAND_R */ -/* sscanf() variable arguments */ - +#ifndef HDsscanf + #define HDsscanf(S,FMT,...) sscanf(S,FMT,__VA_ARGS__) +#endif /* HDsscanf */ #ifndef HDstrcat #define HDstrcat(X,Y) strcat(X,Y) #endif /* HDstrcat */ @@ -1391,6 +1392,9 @@ typedef off_t h5_stat_size_t; #ifndef HDstrtok #define HDstrtok(X,Y) strtok(X,Y) #endif /* HDstrtok */ +#ifndef HDstrtok_r + #define HDstrtok_r(X,Y,Z) strtok_r(X,Y,Z) +#endif /* HDstrtok */ #ifndef HDstrtol #define HDstrtol(S,R,N) strtol(S,R,N) #endif /* HDstrtol */ @@ -1493,6 +1497,9 @@ typedef off_t h5_stat_size_t; #ifndef HDva_arg #define HDva_arg(A,T) va_arg(A,T) #endif /* HDva_arg */ +#ifndef HDva_copy +#define HDva_copy(D,S) va_copy(D,S) +#endif /* HDva_copy */ #ifndef HDva_end #define HDva_end(A) va_end(A) #endif /* HDva_end */ @@ -1998,7 +2005,6 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ H5_DLL herr_t H5CX_push(void); H5_DLL herr_t H5CX_pop(void); - #ifndef NDEBUG #define FUNC_ENTER_CHECK_NAME(asrt) \ { \ @@ -2037,7 +2043,7 @@ H5_DLL herr_t H5CX_pop(void); /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ MPE_LOG_VARS \ - H5TRACE_DECL \ + H5TRACE_DECL #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..1d47d13 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -95,12 +95,16 @@ static hbool_t H5_ntzset = FALSE; * Programmer: Robb Matzke * Thursday, April 9, 1998 * - * Modifications: - * Robb Matzke, 1999-07-27 - * The `%a' format refers to an argument of `haddr_t' type - * instead of `haddr_t*' and the return value is correct. *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the fprintf() calls with + * format_templ 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" int HDfprintf(FILE *stream, const char *fmt, ...) { @@ -121,7 +125,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) HDassert(stream); HDassert(fmt); - va_start (ap, fmt); + HDva_start (ap, fmt); while (*fmt) { fwidth = prec = 0; zerofill = 0; @@ -170,7 +174,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) s = rest; } /* end if */ else if ('*'==*s) { - fwidth = va_arg(ap, int); + fwidth = HDva_arg(ap, int); if(fwidth < 0) { leftjust = 1; fwidth = -fwidth; @@ -185,7 +189,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) prec = (int)HDstrtol(s, &rest, 10); s = rest; } else if('*'==*s) { - prec = va_arg(ap, int); + prec = HDva_arg(ap, int); s++; } if(prec < 1) @@ -272,16 +276,16 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'd': case 'i': if(!HDstrcmp(modifier, "h")) { - short x = (short)va_arg(ap, int); + short x = (short)HDva_arg(ap, int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - int x = va_arg(ap, int); + int x = HDva_arg(ap, int); n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - long x = va_arg(ap, long); + long x = HDva_arg(ap, long); n = fprintf(stream, format_templ, x); } else { - int64_t x = va_arg(ap, int64_t); + int64_t x = HDva_arg(ap, int64_t); n = fprintf(stream, format_templ, x); } break; @@ -291,16 +295,16 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'x': case 'X': if(!HDstrcmp(modifier, "h")) { - unsigned short x = (unsigned short)va_arg(ap, unsigned int); + unsigned short x = (unsigned short)HDva_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!*modifier) { - unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occurring */ + unsigned int x = HDva_arg(ap, unsigned int); n = fprintf(stream, format_templ, x); } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occurring */ + unsigned long x = HDva_arg(ap, unsigned long); n = fprintf(stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occurring */ + uint64_t x = HDva_arg(ap, uint64_t); n = fprintf(stream, format_templ, x); } break; @@ -311,10 +315,10 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'g': case 'G': if(!HDstrcmp(modifier, "h")) { - float x = (float)va_arg(ap, double); + float x = (float)HDva_arg(ap, double); n = fprintf(stream, format_templ, (double)x); } else if(!*modifier || !HDstrcmp(modifier, "l")) { - double x = va_arg(ap, double); + double x = HDva_arg(ap, double); n = fprintf(stream, format_templ, x); } else { /* @@ -322,10 +326,10 @@ HDfprintf(FILE *stream, const char *fmt, ...) * `double' are the same thing. */ #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE - long double x = va_arg(ap, long double); + long double x = HDva_arg(ap, long double); n = fprintf(stream, format_templ, x); #else - double x = va_arg(ap, double); + double x = HDva_arg(ap, double); n = fprintf(stream, format_templ, x); #endif } @@ -333,7 +337,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occurring */ + haddr_t x = HDva_arg(ap, haddr_t); if(H5F_addr_defined(x)) { len = 0; @@ -379,7 +383,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'c': { - char x = (char)va_arg(ap, int); + char x = (char)HDva_arg(ap, int); n = fprintf(stream, format_templ, x); } break; @@ -387,7 +391,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg(ap, char*); /*lint !e64 Type mismatch not really occurring */ + char *x = HDva_arg(ap, char*); n = fprintf(stream, format_templ, x); } break; @@ -399,7 +403,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 't': { - htri_t tri_var = va_arg(ap, htri_t); + htri_t tri_var = HDva_arg(ap, htri_t); if(tri_var > 0) fprintf(stream, "TRUE"); @@ -423,9 +427,10 @@ HDfprintf(FILE *stream, const char *fmt, ...) nout++; } } - va_end(ap); + HDva_end(ap); return nout; } /* end HDfprintf() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- @@ -492,7 +497,8 @@ HDstrtoll(const char *s, const char **rest, int base) /* Optional minus or plus sign */ if ('+'==*s) { s++; - } else if ('-'==*s) { + } + else if ('-'==*s) { sign = -1; s++; } @@ -501,10 +507,12 @@ HDstrtoll(const char *s, const char **rest, int base) if (0==base && '0'==*s && ('x'==s[1] || 'X'==s[1])) { base = 16; s += 2; - } else if (0==base && '0'==*s) { + } + else if (0==base && '0'==*s) { base = 8; s++; - } else if (0==base) { + } + else if (0==base) { base = 10; } @@ -525,7 +533,8 @@ HDstrtoll(const char *s, const char **rest, int base) if (acc*base+digit < acc) { overflow = TRUE; - } else { + } + else { acc = acc*base + digit; } } @@ -536,7 +545,8 @@ HDstrtoll(const char *s, const char **rest, int base) if (overflow) { if (sign>0) { acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; - } else { + } + else { acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); } errno = ERANGE; @@ -843,9 +853,9 @@ int c99_snprintf(char* str, size_t size, const char* format, ...) int count; va_list ap; - va_start(ap, format); + HDva_start(ap, format); count = c99_vsnprintf(str, size, format, ap); - va_end(ap); + HDva_end(ap); return count; } @@ -980,6 +990,132 @@ Wroundf(float arg) return (float)(arg < 0.0F ? HDceil(arg - 0.5F) : HDfloor(arg + 0.5F)); } +/*------------------------------------------------------------------------- +* Function: H5_get_utf16_str +* +* Purpose: Gets a UTF-16 string from an UTF-8 (or ASCII) string. +* +* Return: Success: A pointer to a UTF-16 string +* This must be freed by the caller using H5MM_xfree() +* Failure: NULL +* +* Programmer: Dana Robinson +* Spring 2019 +* +*------------------------------------------------------------------------- +*/ +const wchar_t * +H5_get_utf16_str(const char *s) +{ + int nwchars = -1; /* Length of the UTF-16 buffer */ + wchar_t *ret_s = NULL; /* UTF-16 version of the string */ + + /* Get the number of UTF-16 characters needed */ + if(0 == (nwchars = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0))) + goto error; + + /* Allocate a buffer for the UTF-16 string */ + if(NULL == (ret_s = (wchar_t *)H5MM_calloc(sizeof(wchar_t) * (size_t)nwchars))) + goto error; + + /* Convert the input UTF-8 string to UTF-16 */ + if(0 == MultiByteToWideChar(CP_UTF8, 0, s, -1, ret_s, nwchars)) + goto error; + + return ret_s; + +error: + if(ret_s) + H5MM_xfree((void *)ret_s); + return NULL; +} /* end H5_get_utf16_str() */ + +/*------------------------------------------------------------------------- + * Function: Wopen_utf8 + * + * Purpose: UTF-8 equivalent of open(2) for use on Windows. + * Converts a UTF-8 input path to UTF-16 and then opens the + * file via _wopen() under the hood + * + * Return: Success: A POSIX file descriptor + * Failure: -1 + * + * Programmer: Dana Robinson + * Spring 2019 + * + *------------------------------------------------------------------------- + */ +int +Wopen_utf8(const char *path, int oflag, ...) +{ + int fd = -1; /* POSIX file descriptor to be returned */ + wchar_t *wpath = NULL; /* UTF-16 version of the path */ + int pmode = 0; /* mode (optionally set via variable args) */ + + /* Convert the input UTF-8 path to UTF-16 */ + if(NULL == (wpath = H5_get_utf16_str(path))) + goto done; + + /* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL + * transformations when performing I/O. Note that this will + * produce Unix-style text files, though. + */ + oflag |= _O_BINARY; + + /* Get the mode, if O_CREAT was specified */ + if(oflag & O_CREAT) { + va_list vl; + + HDva_start(vl, oflag); + pmode = HDva_arg(vl, int); + HDva_end(vl); + } + + /* Open the file */ + fd = _wopen(wpath, oflag, pmode); + +done: + if(wpath) + H5MM_xfree((void *)wpath); + + return fd; +} /* end Wopen_utf8() */ + +/*------------------------------------------------------------------------- + * Function: Wremove_utf8 + * + * Purpose: UTF-8 equivalent of remove(3) for use on Windows. + * Converts a UTF-8 input path to UTF-16 and then opens the + * file via _wremove() under the hood + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * Spring 2019 + * + *------------------------------------------------------------------------- + */ +int +Wremove_utf8(const char *path) +{ + wchar_t *wpath = NULL; /* UTF-16 version of the path */ + int ret; + + /* Convert the input UTF-8 path to UTF-16 */ + if(NULL == (wpath = H5_get_utf16_str(path))) + goto done; + + /* Open the file */ + ret = _wremove(wpath); + +done: + if(wpath) + H5MM_xfree((void *)wpath); + + return ret; +} /* end Wremove_utf8() */ + #endif /* H5_HAVE_WIN32_API */ @@ -1125,13 +1261,13 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) FUNC_ENTER_NOAPI_NOINIT - HDassert(path1); HDassert(path2); - path1_len = HDstrlen(path1); + if(path1) + path1_len = HDstrlen(path1); path2_len = HDstrlen(path2); - if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { + if(path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { /* If path1 is empty or path2 is absolute, simply use path2 */ if(NULL == (*full_name = (char *)H5MM_strdup(path2))) @@ -1165,11 +1301,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) * Allocate a buffer to hold path1 + path2 + possibly the delimiter * + terminating null byte */ - if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, + HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); } /* end else */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 4522228..29533dd 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -34,6 +34,7 @@ typedef __int64 h5_stat_size_t; #define HDaccess(F,M) _access(F,M) #define HDchdir(S) _chdir(S) #define HDclose(F) _close(F) +#define HDcreat(S,M) Wopen_utf8(S,O_CREAT|O_TRUNC|O_RDWR,M) #define HDdup(F) _dup(F) #define HDfdopen(N,S) _fdopen(N,S) #define HDfileno(F) _fileno(F) @@ -47,21 +48,24 @@ typedef __int64 h5_stat_size_t; #define HDmkdir(S,M) _mkdir(S) #define HDnanosleep(N, O) Wnanosleep(N, O) #define HDoff_t __int64 -/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL - * transformations when performing I/O. Note that this will - * produce Unix-style text files, though. - * - * Also note that the variadic macro is using a VC++ extension + +/* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. */ -#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#ifndef H5_HAVE_MINGW +#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__) +#else +#define HDopen(S,F,...) Wopen_utf8(S,F,##__VA_ARGS__) +#endif #define HDread(F,M,Z) _read(F,M,Z) +#define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) #define HDsleep(S) Sleep(S*1000) #define HDstat(S,B) _stati64(S,B) #define HDstrcasecmp(A,B) _stricmp(A,B) #define HDstrdup(S) _strdup(S) +#define HDstrtok_r(X,Y,Z) strtok_s(X,Y,Z) #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) #define HDwrite(F,M,Z) _write(F,M,Z) @@ -75,6 +79,11 @@ typedef __int64 h5_stat_size_t; #ifndef H5_HAVE_STRTOULL #define HDstrtoull(S,R,N) _strtoui64(S,R,N) #endif /* H5_HAVE_STRTOULL */ + /* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are + * just pointers into the stack in those CRTs, the usual work-around + * is to just define the operation as a pointer copy. + */ + #define HDva_copy(D,S) ((D) = (S)) #endif /* MSC_VER < 1800 */ /* @@ -120,6 +129,9 @@ extern "C" { H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); + H5_DLL const wchar_t *H5_get_utf16_str(const char *s); + H5_DLL int Wopen_utf8(const char *path, int oflag, ...); + H5_DLL int Wremove_utf8(const char *path); /* Round functions only needed for VS2012 and earlier. * They are always built to ensure they don't go stale and diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5b34ec5..4023693 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,7 +32,7 @@ if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$,$>:ws2_32.lib> ) if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") @@ -53,7 +53,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$,$>:ws2_32.lib> ) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index fe6c695..aeb7ae7 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -198,33 +198,32 @@ set (testhdf5_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME H5TEST-clear-testhdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${testhdf5_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST +add_test ( + NAME H5TEST-testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) +set_tests_properties (H5TEST-testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) -add_test (NAME H5TEST-testhdf5-base COMMAND $ -x heap -x file -x select) +add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -x heap -x file -x select) set_tests_properties (H5TEST-testhdf5-base PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-heap COMMAND $ -o heap) +add_test (NAME H5TEST-testhdf5-heap COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o heap) set_tests_properties (H5TEST-testhdf5-heap PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-file COMMAND $ -o file) +add_test (NAME H5TEST-testhdf5-file COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o file) set_tests_properties (H5TEST-testhdf5-file PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-select COMMAND $ -o select) +add_test (NAME H5TEST-testhdf5-select COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o select) set_tests_properties (H5TEST-testhdf5-select PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -450,14 +449,12 @@ set (test_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME H5TEST-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST +add_test ( + NAME H5TEST-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_objects) +set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_H5TEST) set (H5TEST_SEPARATE_TESTS testhdf5 @@ -469,7 +466,7 @@ set (H5TEST_SEPARATE_TESTS foreach (h5_test ${H5_TESTS}) if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-${h5_test} COMMAND $) + add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -482,6 +479,7 @@ foreach (h5_test ${H5_TESTS}) ) else () add_test (NAME H5TEST-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -494,7 +492,7 @@ foreach (h5_test ${H5_TESTS}) ) endif () set_tests_properties (H5TEST-${h5_test} PROPERTIES - FIXTURES_REQUIRED clear_objects + FIXTURES_REQUIRED clear_H5TEST ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -509,18 +507,17 @@ set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOU #-- Adding test for cache if (NOT CYGWIN) - add_test (NAME H5TEST-clear-cache-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + add_test ( + NAME H5TEST-cache-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-clear-cache-objects PROPERTIES FIXTURES_SETUP cache_clear_objects) + set_tests_properties (H5TEST-cache-clear-objects PROPERTIES FIXTURES_SETUP clear_cache) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-cache COMMAND $) + add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-cache COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -532,7 +529,7 @@ if (NOT CYGWIN) ) endif () set_tests_properties (H5TEST-cache PROPERTIES - FIXTURES_REQUIRED cache_clear_objects + FIXTURES_REQUIRED clear_cache ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -542,26 +539,22 @@ endif () if (TEST_CACHE_IMAGE) #-- Adding test for cache_image add_test ( - NAME H5TEST-clear-cache_image-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_image_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-cache_image-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove cache_image_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) - add_test (NAME H5TEST-cache_image COMMAND $) + set_tests_properties (H5TEST-cache_image-clear-objects PROPERTIES FIXTURES_SETUP clear_cache_image) + add_test (NAME H5TEST_cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-cache_image PROPERTIES - FIXTURES_REQUIRED cache_image_clear_objects + FIXTURES_REQUIRED clear_cache_image ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () #-- Adding test for flush1/2 -add_test (NAME H5TEST-clear-flush-objects - COMMAND ${CMAKE_COMMAND} - -E remove +add_test (NAME H5TEST-flush-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flush.h5 flush-swmr.h5 noflush.h5 @@ -573,10 +566,12 @@ add_test (NAME H5TEST-clear-flush-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-flush-clear-objects PROPERTIES FIXTURES_SETUP clear_flush) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-flush1 COMMAND $) + add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -587,14 +582,15 @@ else () ) endif () set_tests_properties (H5TEST-flush1 PROPERTIES - DEPENDS H5TEST-clear-flush-objects + FIXTURES_REQUIRED clear_flush ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-flush2 COMMAND $) + add_test (NAME H5TEST-flush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -604,20 +600,23 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) +set_tests_properties (H5TEST-flush2 PROPERTIES + FIXTURES_REQUIRED clear_flush + DEPENDS H5TEST-flush1 +) #-- Adding test for tcheck_version -add_test (NAME H5TEST-tcheck_version-major COMMAND $ "-tM") +add_test (NAME H5TEST-tcheck_version-major COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tM") set_tests_properties (H5TEST-tcheck_version-major PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" ) -add_test (NAME H5TEST-tcheck_version-minor COMMAND $ "-tm") +add_test (NAME H5TEST-tcheck_version-minor COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tm") set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" ) -add_test (NAME H5TEST-tcheck_version-release COMMAND $ "-tr") +add_test (NAME H5TEST-tcheck_version-release COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tr") set_tests_properties (H5TEST-tcheck_version-release PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" @@ -657,50 +656,36 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES #-- Adding test for filenotclosed add_test ( - NAME H5TEST-clear-filenotclosed-objects - COMMAND ${CMAKE_COMMAND} - -E remove - filenotclosed.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-filenotclosed-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove filenotclosed.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-filenotclosed-objects PROPERTIES FIXTURES_SETUP filenotclosed_clear_objects) -add_test (NAME H5TEST-filenotclosed COMMAND $) +set_tests_properties (H5TEST-filenotclosed-clear-objects PROPERTIES FIXTURES_SETUP clear_filenotclosed) +add_test (NAME H5TEST-filenotclosed COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-filenotclosed PROPERTIES - FIXTURES_REQUIRED filenotclosed_clear_objects + FIXTURES_REQUIRED clear_filenotclosed ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for del_many_dense_attrs add_test ( - NAME H5TEST-clear-del_many_dense_attrs-objects - COMMAND ${CMAKE_COMMAND} - -E remove - del_many_dense_attrs.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-del_many_dense_attrs-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove del_many_dense_attrs.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects) -add_test (NAME H5TEST-del_many_dense_attrs COMMAND $) +set_tests_properties (H5TEST-del_many_dense_attrs-clear-objects PROPERTIES FIXTURES_SETUP clear_del_many_dense_attrs) +add_test (NAME H5TEST-del_many_dense_attrs COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES - FIXTURES_REQUIRED del_many_dense_attrs_clear_objects + FIXTURES_REQUIRED clear_del_many_dense_attrs ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for err_compat -if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test (NAME H5TEST-clear-err_compat-objects - COMMAND ${CMAKE_COMMAND} - -E remove - err_compat.txt - err_compat.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST - ) - set_tests_properties (H5TEST-clear-err_compat-objects PROPERTIES FIXTURES_SETUP err_compat_clear_objects) +if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW) add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -712,23 +697,13 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES - FIXTURES_REQUIRED err_compat_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () #-- Adding test for error_test -add_test (NAME H5TEST-clear-error_test-objects - COMMAND ${CMAKE_COMMAND} - -E remove - error_test.txt - error_test.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) -if (HDF5_USE_16_API_DEFAULT) +if (HDF5_USE_16_API_DEFAULT OR MINGW) add_test ( NAME H5TEST-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" @@ -736,6 +711,7 @@ if (HDF5_USE_16_API_DEFAULT) set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -747,29 +723,26 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES - FIXTURES_REQUIRED error_test_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () #-- Adding test for links_env -add_test (NAME H5TEST-clear-links_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - links_env.txt - links_env.txt.err +add_test (NAME H5TEST-links_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove extlinks_env0.h5 extlinks_env1.h5 tmp/extlinks_env1.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) +set_tests_properties (H5TEST-links_env-clear-objects PROPERTIES FIXTURES_SETUP clear_links_env) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-links_env COMMAND $) + add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" @@ -782,7 +755,7 @@ else () ) endif () set_tests_properties (H5TEST-links_env PROPERTIES - FIXTURES_REQUIRED links_env_clear_objects + FIXTURES_REQUIRED clear_links_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -805,7 +778,7 @@ endif () ### F I L T E R P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) - if (WIN32) + if (WIN32 OR MINGW) set (CMAKE_SEP "\;") set (BIN_REL_PATH "../../") else () @@ -813,7 +786,7 @@ if (BUILD_SHARED_LIBS) set (BIN_REL_PATH "../") endif () - add_test (NAME H5PLUGIN-filter_plugin COMMAND $) + add_test (NAME H5PLUGIN-filter_plugin COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} @@ -822,7 +795,7 @@ if (BUILD_SHARED_LIBS) ############################################################################## # HDFFV-9655 relative plugin test disabled # -# add_test (NAME H5PLUGIN-pluginRelative COMMAND $) +# add_test (NAME H5PLUGIN-pluginRelative COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) # set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES # ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} @@ -843,23 +816,20 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $) +# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") find_package (Perl) if (PERL_FOUND) - add_test (NAME H5TEST-clear-testflushrefresh-objects - COMMAND ${CMAKE_COMMAND} - -E remove - flushrefresh.txt - flushrefresh.txt.err - flushrefresh.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test + add_test ( + NAME H5TEST-testflushrefresh-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flushrefresh.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) - set_tests_properties (H5TEST-clear-testflushrefresh-objects PROPERTIES FIXTURES_SETUP testflushrefresh_clear_objects) + set_tests_properties (H5TEST-testflushrefresh-clear-objects PROPERTIES FIXTURES_SETUP clear_testflushrefresh) add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS1:STRING=flushrefresh_VERIFICATION_START" -D "TEST_ARGS2:STRING=flushrefresh_VERIFICATION_DONE" @@ -873,7 +843,7 @@ if (ENABLE_EXTENDED_TESTS) -P "${HDF5_TEST_SOURCE_DIR}/flushrefreshTest.cmake" ) set_tests_properties (H5TEST-testflushrefresh PROPERTIES - FIXTURES_REQUIRED testflushrefresh_clear_objects + FIXTURES_REQUIRED clear_testflushrefresh ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 5f02c9f..b94fc88 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -91,15 +91,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT HDF_CFG_NAME MATCHES "Debug") - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -109,7 +103,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -119,15 +112,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) endif () else () - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -137,21 +124,14 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) endif () else () - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -161,7 +141,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -169,15 +148,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -187,7 +160,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -211,15 +183,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (HDF5_TEST_FHEAP_VFD) - add_test ( - NAME VFD-${vfdname}-fheap-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-fheap.out - ${vfdname}/${vfdname}-fheap.out.err - ) add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -229,7 +195,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES - DEPENDS VFD-${vfdname}-fheap-clear-objects TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index 73210ef..01faad5 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -41,7 +41,7 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -90,7 +90,7 @@ while (verification_done LESS "1") else () message (STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") execute_process ( - COMMAND ${TEST_PROGRAM} ${param1} ${param2} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${TEST_PROGRAM} ${param1} ${param2} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err @@ -133,7 +133,7 @@ while (verification_done LESS "2") else () message (STATUS "execute: ${TEST_PROGRAM} ${param1}") execute_process ( - COMMAND ${TEST_PROGRAM} ${param1} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${TEST_PROGRAM} ${param1} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err diff --git a/test/links.c b/test/links.c index 63b125f..f7465ef 100644 --- a/test/links.c +++ b/test/links.c @@ -15,28 +15,28 @@ * Programmer: Robb Matzke * Friday, April 10, 1998 * - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ /* * This file needs to access private information from the H5FD package. * This file also needs to access the file driver testing code. */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING /* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" #include "H5srcdir.h" #include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ @@ -50,67 +50,67 @@ #define SYMLINK2 TMPDIR2 "sym2.h5" const char *FILENAME[] = { - "links0", - "links1", - "links2", - "links3", - "links4a", /* 4 */ - "links4b", /* 5 */ - "links4c", /* 6 */ - "links4d", /* 7 */ - "links5", /* 8 */ - "links6", /* 9 */ - "links7", /* 10 */ - "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10",/* 30: */ - TMPDIR "extlinks11",/* 31: */ - TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13",/* 34: */ - TMPDIR "extlinks14",/* 35: */ - TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B",/* 46: */ - TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D",/* 49: */ - TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ - NULL + "links0", + "links1", + "links2", + "links3", + "links4a", /* 4 */ + "links4b", /* 5 */ + "links4c", /* 6 */ + "links4d", /* 7 */ + "links5", /* 8 */ + "links6", /* 9 */ + "links7", /* 10 */ + "links8", /* 11 */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10",/* 30: */ + TMPDIR "extlinks11",/* 31: */ + TMPDIR "extlinks12",/* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13",/* 34: */ + TMPDIR "extlinks14",/* 35: */ + TMPDIR "extlinks15",/* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B",/* 46: */ + TMPDIR2 "extlinks21C",/* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D",/* 49: */ + TMPDIR "extlinks21E",/* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -172,64 +172,64 @@ typedef struct { H5L_type_t type; /* Type of link */ } link_visit_t; static const link_visit_t lvisit0[] = { - {"Dataset_zero", H5L_TYPE_HARD}, - {"Group1", H5L_TYPE_HARD}, - {"Group1/Dataset_one", H5L_TYPE_HARD}, - {"Group1/Group2", H5L_TYPE_HARD}, - {"Group1/Group2/Dataset_two", H5L_TYPE_HARD}, - {"Group1/Group2/Type_two", H5L_TYPE_HARD}, - {"Group1/Group2/hard_zero", H5L_TYPE_HARD}, - {"Group1/Type_one", H5L_TYPE_HARD}, - {"Group1/hard_one", H5L_TYPE_HARD}, - {"Type_zero", H5L_TYPE_HARD}, - {"ext_dangle", H5L_TYPE_EXTERNAL}, - {"ext_one", H5L_TYPE_EXTERNAL}, - {"hard_one", H5L_TYPE_HARD}, - {"hard_two", H5L_TYPE_HARD}, - {"hard_zero", H5L_TYPE_HARD}, - {"soft_dangle", H5L_TYPE_SOFT}, - {"soft_one", H5L_TYPE_SOFT}, - {"soft_two", H5L_TYPE_SOFT} + {"Dataset_zero", H5L_TYPE_HARD}, + {"Group1", H5L_TYPE_HARD}, + {"Group1/Dataset_one", H5L_TYPE_HARD}, + {"Group1/Group2", H5L_TYPE_HARD}, + {"Group1/Group2/Dataset_two", H5L_TYPE_HARD}, + {"Group1/Group2/Type_two", H5L_TYPE_HARD}, + {"Group1/Group2/hard_zero", H5L_TYPE_HARD}, + {"Group1/Type_one", H5L_TYPE_HARD}, + {"Group1/hard_one", H5L_TYPE_HARD}, + {"Type_zero", H5L_TYPE_HARD}, + {"ext_dangle", H5L_TYPE_EXTERNAL}, + {"ext_one", H5L_TYPE_EXTERNAL}, + {"hard_one", H5L_TYPE_HARD}, + {"hard_two", H5L_TYPE_HARD}, + {"hard_zero", H5L_TYPE_HARD}, + {"soft_dangle", H5L_TYPE_SOFT}, + {"soft_one", H5L_TYPE_SOFT}, + {"soft_two", H5L_TYPE_SOFT} }; static const link_visit_t lvisit1[] = { - {"Dataset_one", H5L_TYPE_HARD}, - {"Group2", H5L_TYPE_HARD}, - {"Group2/Dataset_two", H5L_TYPE_HARD}, - {"Group2/Type_two", H5L_TYPE_HARD}, - {"Group2/hard_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/Group1", H5L_TYPE_HARD}, - {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, - {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL}, - {"Group2/hard_zero/hard_one", H5L_TYPE_HARD}, - {"Group2/hard_zero/hard_two", H5L_TYPE_HARD}, - {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT}, - {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT}, - {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT}, - {"Type_one", H5L_TYPE_HARD}, - {"hard_one", H5L_TYPE_HARD} + {"Dataset_one", H5L_TYPE_HARD}, + {"Group2", H5L_TYPE_HARD}, + {"Group2/Dataset_two", H5L_TYPE_HARD}, + {"Group2/Type_two", H5L_TYPE_HARD}, + {"Group2/hard_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/Group1", H5L_TYPE_HARD}, + {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, + {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL}, + {"Group2/hard_zero/hard_one", H5L_TYPE_HARD}, + {"Group2/hard_zero/hard_two", H5L_TYPE_HARD}, + {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT}, + {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT}, + {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT}, + {"Type_one", H5L_TYPE_HARD}, + {"hard_one", H5L_TYPE_HARD} }; static const link_visit_t lvisit2[] = { - {"Dataset_two", H5L_TYPE_HARD}, - {"Type_two", H5L_TYPE_HARD}, - {"hard_zero", H5L_TYPE_HARD}, - {"hard_zero/Dataset_zero", H5L_TYPE_HARD}, - {"hard_zero/Group1", H5L_TYPE_HARD}, - {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD}, - {"hard_zero/Group1/Group2", H5L_TYPE_HARD}, - {"hard_zero/Group1/Type_one", H5L_TYPE_HARD}, - {"hard_zero/Group1/hard_one", H5L_TYPE_HARD}, - {"hard_zero/Type_zero", H5L_TYPE_HARD}, - {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, - {"hard_zero/ext_one", H5L_TYPE_EXTERNAL}, - {"hard_zero/hard_one", H5L_TYPE_HARD}, - {"hard_zero/hard_two", H5L_TYPE_HARD}, - {"hard_zero/hard_zero", H5L_TYPE_HARD}, - {"hard_zero/soft_dangle", H5L_TYPE_SOFT}, - {"hard_zero/soft_one", H5L_TYPE_SOFT}, - {"hard_zero/soft_two", H5L_TYPE_SOFT} + {"Dataset_two", H5L_TYPE_HARD}, + {"Type_two", H5L_TYPE_HARD}, + {"hard_zero", H5L_TYPE_HARD}, + {"hard_zero/Dataset_zero", H5L_TYPE_HARD}, + {"hard_zero/Group1", H5L_TYPE_HARD}, + {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD}, + {"hard_zero/Group1/Group2", H5L_TYPE_HARD}, + {"hard_zero/Group1/Type_one", H5L_TYPE_HARD}, + {"hard_zero/Group1/hard_one", H5L_TYPE_HARD}, + {"hard_zero/Type_zero", H5L_TYPE_HARD}, + {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, + {"hard_zero/ext_one", H5L_TYPE_EXTERNAL}, + {"hard_zero/hard_one", H5L_TYPE_HARD}, + {"hard_zero/hard_two", H5L_TYPE_HARD}, + {"hard_zero/hard_zero", H5L_TYPE_HARD}, + {"hard_zero/soft_dangle", H5L_TYPE_SOFT}, + {"hard_zero/soft_one", H5L_TYPE_SOFT}, + {"hard_zero/soft_two", H5L_TYPE_SOFT} }; typedef struct { @@ -244,70 +244,70 @@ typedef struct { H5O_type_t type; /* Type of object */ } obj_visit_t; static const obj_visit_t ovisit0_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_zero", H5O_TYPE_DATASET}, - {"Group1", H5O_TYPE_GROUP}, - {"Group1/Dataset_one", H5O_TYPE_DATASET}, - {"Group1/Group2", H5O_TYPE_GROUP}, - {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_zero", H5O_TYPE_DATASET}, + {"Group1", H5O_TYPE_GROUP}, + {"Group1/Dataset_one", H5O_TYPE_DATASET}, + {"Group1/Group2", H5O_TYPE_GROUP}, + {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit0_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_zero", H5O_TYPE_DATASET}, - {"Group1", H5O_TYPE_GROUP}, - {"Group1/Dataset_one", H5O_TYPE_DATASET}, - {"Group1/Group2", H5O_TYPE_GROUP}, - {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_zero", H5O_TYPE_DATASET}, + {"Group1", H5O_TYPE_GROUP}, + {"Group1/Dataset_one", H5O_TYPE_DATASET}, + {"Group1/Group2", H5O_TYPE_GROUP}, + {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit1_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_one", H5O_TYPE_DATASET}, - {"Group2", H5O_TYPE_GROUP}, - {"Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group2/hard_zero", H5O_TYPE_GROUP}, - {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, - {"Type_one", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_one", H5O_TYPE_DATASET}, + {"Group2", H5O_TYPE_GROUP}, + {"Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group2/hard_zero", H5O_TYPE_GROUP}, + {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, + {"Type_one", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit1_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_one", H5O_TYPE_DATASET}, - {"Group2", H5O_TYPE_GROUP}, - {"Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group2/hard_zero", H5O_TYPE_GROUP}, - {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, - {"Type_one", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_one", H5O_TYPE_DATASET}, + {"Group2", H5O_TYPE_GROUP}, + {"Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group2/hard_zero", H5O_TYPE_GROUP}, + {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, + {"Type_one", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit2_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_two", H5O_TYPE_DATASET}, - {"Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero", H5O_TYPE_GROUP}, - {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"hard_zero/Group1", H5O_TYPE_GROUP}, - {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, - {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_two", H5O_TYPE_DATASET}, + {"Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero", H5O_TYPE_GROUP}, + {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"hard_zero/Group1", H5O_TYPE_GROUP}, + {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, + {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit2_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_two", H5O_TYPE_DATASET}, - {"Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero", H5O_TYPE_GROUP}, - {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"hard_zero/Group1", H5O_TYPE_GROUP}, - {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, - {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_two", H5O_TYPE_DATASET}, + {"Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero", H5O_TYPE_GROUP}, + {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"hard_zero/Group1", H5O_TYPE_GROUP}, + {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, + {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} }; typedef struct { @@ -318,7 +318,7 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ - + /*------------------------------------------------------------------------- * Function: fix_ext_filename * @@ -340,17 +340,17 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) HDstrcat(path_name, file_name); } - + /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * - * Purpose: Build a file with assorted links. + * Purpose: Build a file with assorted links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -360,52 +360,52 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) static int mklinks(hid_t fapl, hbool_t new_format) { - hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hid_t file, scalar, grp, d1; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") - else - TESTING("link creation") + else + TESTING("link creation") - /* Create a file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create a file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR + if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR - /* Create a group */ - if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR + /* Create a group */ + if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(grp) < 0) TEST_ERROR - /* Create a dataset */ - if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(d1) < 0) TEST_ERROR + /* Create a dataset */ + if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(d1) < 0) TEST_ERROR - /* Create a hard link */ - if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a hard link */ + if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a symbolic link */ - if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a symbolic link */ + if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a symbolic link to something that doesn't exist */ - if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a symbolic link to something that doesn't exist */ + if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a recursive symbolic link */ - if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a recursive symbolic link */ + if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close */ - if(H5Sclose(scalar) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + /* Close */ + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Fclose(file) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: return -1; } - + /*------------------------------------------------------------------------- * Function: new_links * @@ -425,98 +425,98 @@ mklinks(hid_t fapl, hbool_t new_format) static int new_links(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); - hid_t scalar=(-1); - hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; + hid_t file_a, file_b=(-1); + hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); + hid_t scalar=(-1); + hid_t dset1=(-1), dset2=(-1); + char filename[NAME_BUF_SIZE]; hsize_t size[1] = {1}; if(new_format) TESTING("H5Lcreate functions (w/new group format)") - else - TESTING("H5Lcreate functions") + else + TESTING("H5Lcreate functions") - /* Create two files */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create two files */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR + if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR - /* Create two groups in each file */ - if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create two groups in each file */ + if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create datasets */ - if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create datasets */ + if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create links within a file. Both of source and destination use - * H5L_SAME_LOC. Both hard and soft links should fail. */ - H5E_BEGIN_TRY { - if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; - H5E_BEGIN_TRY { - if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create links within a file. Both of source and destination use + * H5L_SAME_LOC. Both hard and soft links should fail. */ + H5E_BEGIN_TRY { + if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; + H5E_BEGIN_TRY { + if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Create links across files with hard link. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create links across files with hard link. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Create hard link to test H5L_SAME_LOC */ - if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create hard link to test H5L_SAME_LOC */ + if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create links to test hard links across different locations */ - if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create links to test hard links across different locations */ + if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close dataspace and files */ - if(H5Sclose(scalar) < 0) TEST_ERROR - if(H5Dclose(dset1) < 0) TEST_ERROR - if(H5Dclose(dset2) < 0) TEST_ERROR - if(H5Gclose(grp1_a) < 0) TEST_ERROR - if(H5Gclose(grp2_a) < 0) TEST_ERROR - if(H5Gclose(grp1_b) < 0) TEST_ERROR - if(H5Gclose(grp2_b) < 0) TEST_ERROR - if(H5Fclose(file_a) < 0) TEST_ERROR - if(H5Fclose(file_b) < 0) TEST_ERROR + /* Close dataspace and files */ + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Dclose(dset1) < 0) TEST_ERROR + if(H5Dclose(dset2) < 0) TEST_ERROR + if(H5Gclose(grp1_a) < 0) TEST_ERROR + if(H5Gclose(grp2_a) < 0) TEST_ERROR + if(H5Gclose(grp1_b) < 0) TEST_ERROR + if(H5Gclose(grp2_b) < 0) TEST_ERROR + if(H5Fclose(file_a) < 0) TEST_ERROR + if(H5Fclose(file_b) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Sclose(scalar); - H5Dclose(dset1); - H5Dclose(dset2); - H5Gclose(grp1_a); - H5Gclose(grp2_a); - H5Gclose(grp1_b); - H5Gclose(grp2_b); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return -1; } - + /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * - * Purpose: Open the file created in the first step and check that the - * links look correct. + * Purpose: Open the file created in the first step and check that the + * links look correct. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -526,146 +526,146 @@ new_links(hid_t fapl, hbool_t new_format) static int cklinks(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + hid_t file; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") - else - TESTING("link queries") + else + TESTING("link queries") - /* Open the file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } /* end if */ + /* Hard link */ + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - H5E_BEGIN_TRY { - status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR - } /* end if */ - H5E_BEGIN_TRY { - status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR - } /* end if */ + if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ - /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ - if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + /* Symbolic link */ + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(linkval, "/d1")) { + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - /* Dangling link */ - H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR - } /* end if */ - if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR - } /* end if */ - if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ - if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + /* Dangling link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "foobar")) { + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - /* Recursive link */ - H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR - } /* end if */ - if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - printf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR - } /* end if */ - if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ + /* Recursive link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "/grp1/recursive")) { + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ - /* Non-existent link */ - if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR + /* Non-existent link */ + if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Fclose(file) < 0) FAIL_STACK_ERROR + /* Cleanup */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - return -1; + error: + return -1; } - + /*------------------------------------------------------------------------- * Function: ck_new_links * @@ -684,51 +684,51 @@ error: static int ck_new_links(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + hid_t file; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") - else - TESTING("new link queries") + else + TESTING("new link queries") - /* Open the file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Check hard links */ - if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } + /* Get hard link info */ + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Check hard links */ + if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: return -1; } - + /*------------------------------------------------------------------------- * Function: long_links * @@ -748,63 +748,63 @@ error: static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ char *objname = NULL; /* Name of object [Long] */ size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") - else - TESTING("long names for objects & links") + else + TESTING("long names for objects & links") - /* Create files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for hard links) */ - if((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with short name in file (used as target for hard links) */ + if((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Construct very long file name */ - if((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR - for(u = 0; u < MAX_NAME_LEN; u++) - objname[u] = 'a'; + /* Construct very long file name */ + if((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR + for(u = 0; u < MAX_NAME_LEN; u++) + objname[u] = 'a'; objname[MAX_NAME_LEN] = '\0'; /* Create hard link to existing object */ if(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create soft link to existing object */ - objname[0] = 'b'; + /* Create soft link to existing object */ + objname[0] = 'b'; if(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create group with long name in existing group */ - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with long name in existing group */ + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close objects */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close objects */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Release memory */ - HDfree(objname); + /* Release memory */ + HDfree(objname); PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; HDfree(objname); return -1; } - + /*------------------------------------------------------------------------- * Function: toomany * @@ -824,134 +824,134 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") - else - TESTING("too many links") + else + TESTING("too many links") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for hard links) */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create chain of hard links to existing object (no limit on #) */ - if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Create chain of soft links to existing object (limited) */ - if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Open object through last hard link */ - if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/hard21")) TEST_ERROR - - /* Create object in hard-linked group */ - if((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Close group in hard-linked group */ - if(H5Gclose(gid2) < 0) TEST_ERROR - - /* Close hard-linked object */ - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Open object through too deep soft link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); - } H5E_END_TRY; - if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR - } /* end if */ + /* Create group with short name in file (used as target for hard links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of hard links to existing object (no limit on #) */ + if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open object through last hard link */ + if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/hard21")) TEST_ERROR + + /* Create object in hard-linked group */ + if((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close group in hard-linked group */ + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close hard-linked object */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Open object through too deep soft link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); + } H5E_END_TRY; + if(gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR + } /* end if */ - /* Open object through lesser soft link */ - if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through lesser soft link */ + if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft16")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft16")) TEST_ERROR - /* Create object using soft links */ - if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object using soft links */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end toomany() */ - + /*------------------------------------------------------------------------- * Function: test_lcpl * @@ -982,124 +982,124 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link creation property lists (w/new group format)") - else - TESTING("link creation property lists") + else + TESTING("link creation property lists") - /* Actually, intermediate group creation is tested elsewhere (tmisc). - * Here we only need to test the character encoding property */ + /* Actually, intermediate group creation is tested elsewhere (tmisc). + * Here we only need to test the character encoding property */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create and link a group with the default LCPL */ - if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create and link a group with the default LCPL */ + if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create and commit a datatype with the default LCPL */ - if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(type_id) < 0) TEST_ERROR + /* Create and commit a datatype with the default LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create a dataspace */ - dims[0] = H5L_DIM1; + /* Create a dataspace */ + dims[0] = H5L_DIM1; dims[1] = H5L_DIM2; if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR - /* Create a dataset using the default LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id) < 0) TEST_ERROR + /* Create a dataset using the default LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create a link creation property list with the UTF-8 character encoding */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - /* Create and link a group with the new LCPL */ - if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create and link a group with the new LCPL */ + if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create and commit a datatype with the new LCPL */ - if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(type_id) < 0) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create a dataset using the new LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id) < 0) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create a new link to the dataset with a different character encoding. */ - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR - - if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - - /* Check that its character encoding is ASCII */ - if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* Check that the first link's encoding hasn't changed */ - if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Make sure that LCPLs work properly for other API calls: */ - /* H5Lcreate_soft */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* H5Lmove */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR - if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* H5Lcopy */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* H5Lcreate_external */ - if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Close open IDs */ - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if(H5Sclose(space_id) < 0) TEST_ERROR - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create and commit a datatype with the new LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a dataset using the new LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a new link to the dataset with a different character encoding. */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + + if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that its character encoding is ASCII */ + if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Check that the first link's encoding hasn't changed */ + if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Make sure that LCPLs work properly for other API calls: */ + /* H5Lcreate_soft */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lmove */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* H5Lcopy */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lcreate_external */ + if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Dclose(dset_id); @@ -1111,7 +1111,7 @@ error: return 1; } /* end test_lcpl() */ - + /*------------------------------------------------------------------------- * Function: test_move * @@ -1131,147 +1131,147 @@ error: static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") - else - TESTING("H5Lmove") + else + TESTING("H5Lmove") - /* Create two new files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create two new files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create groups in first file */ - if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Move a group within the file. Both of source and destination use - * H5L_SAME_LOC. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; - - /* Move a group across files. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; - - /* Move a soft link across files. Should succeed. */ - if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR - - /* Move an external link across files. Should succeed. */ - if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR - - /* Move a group across groups in the same file while renaming it. */ - if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is no longer in the original location */ - H5E_BEGIN_TRY { - moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); - } H5E_END_TRY; - if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR - } /* end if */ - - /* Use H5Lmove to rename a group without moving it. */ - if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lmove to move a group without renaming it. */ - if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Move the group while giving long paths. */ - if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create groups in first file */ + if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is in no previous locations */ - H5E_BEGIN_TRY { - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - } H5E_END_TRY; + /* Create hard, soft and external links. */ + if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Move a group within the file. Both of source and destination use + * H5L_SAME_LOC. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Fclose(file_a); - H5Fclose(file_b); + /* Move a group across files. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - PASSED(); - return 0; + /* Move a soft link across files. Should succeed. */ + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR - error: - H5_FAILED(); - H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return 1; + /* Move an external link across files. Should succeed. */ + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Move a group across groups in the same file while renaming it. */ + if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if( H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is no longer in the original location */ + H5E_BEGIN_TRY { + moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); + } H5E_END_TRY; + if(moved_grp >= 0) { + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR + } /* end if */ + + /* Use H5Lmove to rename a group without moving it. */ + if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group. */ + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lmove to move a group without renaming it. */ + if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group . */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Move the group while giving long paths. */ + if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is in no previous locations */ + H5E_BEGIN_TRY { + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + } H5E_END_TRY; + + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Fclose(file_a); + H5Fclose(file_b); + + PASSED(); + return 0; + + error: + H5_FAILED(); + H5E_BEGIN_TRY { + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Gclose(moved_grp); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return 1; } - + /*------------------------------------------------------------------------- * Function: test_copy * @@ -1291,158 +1291,158 @@ test_move(hid_t fapl, hbool_t new_format) static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lcopy (w/new group format)") - else - TESTING("H5Lcopy") + else + TESTING("H5Lcopy") - /* Create two new files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create two new files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create groups in first file */ - if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Copy a group within the file. Both of source and destination use - * H5L_SAME_LOC. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create groups in first file */ + if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Copy a group across files. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create hard, soft and external links. */ + if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Copy a group within the file. Both of source and destination use + * H5L_SAME_LOC. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Copy a soft link across files. Should succeed. */ - if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + /* Copy a group across files. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Copy an external link across files. Should succeed. */ - if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + /* Copy a soft link across files. Should succeed. */ + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR - /* Move a group across groups in the same file while renaming it. */ - if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Copy an external link across files. Should succeed. */ + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Move a group across groups in the same file while renaming it. */ + if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is also in the original location */ + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lcopy to create a group in the same location with a different name. */ + if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group. */ + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + /* Verify that the group is also in the original location */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lcopy to copy to a different location with the same name. */ + if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group . */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + /* Verify that the group is still in the previous location */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Copy the group while giving long paths. */ + if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is still in all previous original locations */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Fclose(file_a); + H5Fclose(file_b); - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + PASSED(); + return 0; - /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lcopy to create a group in the same location with a different name. */ - if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lcopy to copy to a different location with the same name. */ - if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Copy the group while giving long paths. */ - if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Fclose(file_a); - H5Fclose(file_b); - - PASSED(); - return 0; - - error: - H5_FAILED(); - H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return 1; + error: + H5_FAILED(); + H5E_BEGIN_TRY { + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Gclose(moved_grp); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return 1; } - + /*------------------------------------------------------------------------- * Function: test_move_preserves * @@ -1478,41 +1478,41 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(new_format) TESTING("moving and copying links preserves their properties (w/new group format)") - else - TESTING("moving and copying links preserves their properties") - - /* Create a file creation property list with creation order stored for links - * in the root group - */ - if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR - if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR - if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR + else + TESTING("moving and copying links preserves their properties") + + /* Create a file creation property list with creation order stored for links + * in the root group + */ + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR - /* Create file */ - /* (with creation order tracking for the root group) */ - h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + /* Create file */ + /* (with creation order tracking for the root group) */ + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR - /* Create a link creation property list with the UTF-8 character encoding */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - /* Create a group with that lcpl */ - if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create a group with that lcpl */ + if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Get the group's link's information */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - old_cset = linfo.cset; + /* Get the group's link's information */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - old_corder = linfo.corder; + if(linfo.corder_valid != TRUE) TEST_ERROR + old_corder = linfo.corder; if(old_corder != 0) TEST_ERROR - old_modification_time = oinfo.mtime; + old_modification_time = oinfo.mtime; /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */ curr_time = HDtime(NULL); @@ -1521,103 +1521,103 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Close the file and reopen it */ if(H5Fclose(file_id) < 0) TEST_ERROR - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR - - /* Get the link's character set & modification time . They should be unchanged */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(old_cset != linfo.cset) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(old_corder != linfo.corder) TEST_ERROR - - /* Create a new link to the group. It should have a different creation order value but the same modification time */ - if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(old_corder == linfo.corder) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 1) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* Copy the first link to a UTF-8 name. - * Its creation order value should be different, but modification time - * should not change. - */ - if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 2) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the link with the default property list. */ - if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 3) TEST_ERROR - - /* Check that its character encoding is not UTF-8 */ - if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR - - /* Check that the original link is unchanged */ - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(old_corder != linfo.corder) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the first link to a UTF-8 name. - * Its creation order value will change, but modification time should not - * change. */ - if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 4) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the link again using the default property list. */ - if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 5) TEST_ERROR - - /* Check that its character encoding is not UTF-8 */ - if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR - - /* Close open IDs */ - if(H5Pclose(fcpl_id) < 0) TEST_ERROR - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if(H5Fclose(file_id) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR + + /* Get the link's character set & modification time . They should be unchanged */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(old_cset != linfo.cset) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + + /* Create a new link to the group. It should have a different creation order value but the same modification time */ + if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(old_corder == linfo.corder) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 1) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Copy the first link to a UTF-8 name. + * Its creation order value should be different, but modification time + * should not change. + */ + if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 2) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link with the default property list. */ + if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 3) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Check that the original link is unchanged */ + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the first link to a UTF-8 name. + * Its creation order value will change, but modification time should not + * change. */ + if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 4) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link again using the default property list. */ + if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 5) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(fcpl_id) < 0) TEST_ERROR + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_move_preserves() */ - + /*------------------------------------------------------------------------- * Function: test_deprec * @@ -1640,7 +1640,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1648,127 +1648,127 @@ test_deprec(hid_t fapl, hbool_t new_format) if(new_format) TESTING("backwards compatibility (w/new group format)") - else - TESTING("backwards compatibility") + else + TESTING("backwards compatibility") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create two groups in the file */ - if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Test H5Gset and get comment */ - if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR - if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp(tmpstr, "comment")) TEST_ERROR - - /* Create links using H5Glink and H5Glink2 */ - if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR - - /* Test getting the names for objects */ - if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR - if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR - } H5E_END_TRY; - - /* Test getting the type for objects */ - if((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0) FAIL_STACK_ERROR - if(obj_type != H5G_GROUP) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0) TEST_ERROR - } H5E_END_TRY; - - /* Test getting the number of objects in a group */ - if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR - if(num_objs != 2) TEST_ERROR - if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR - if(num_objs != 1) TEST_ERROR - - /* Test that H5Glink created hard links properly */ - if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - - if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - - /* Test for the other hard link created */ - if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + /* Create two groups in the file */ + if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - - /* Test the soft link */ - if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR - if(sb_soft1.type != H5G_LINK) TEST_ERROR - if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR - - if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR - - - /* Test the dangling soft link */ - if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR - if(sb_soft2.type != H5G_LINK) TEST_ERROR - if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR - - if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp("dangle", tmpstr)) TEST_ERROR - - - /* Test H5Gmove and H5Gmove2 */ - if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR - if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR - - /* Ensure that both groups can be opened */ - if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR - if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR - - if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Close open IDs */ - if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR - if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR - - /* Test H5Gunlink */ - if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR + /* Test H5Gset and get comment */ + if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR + if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "comment")) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY; + /* Create links using H5Glink and H5Glink2 */ + if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - - PASSED(); - return 0; + /* Test getting the names for objects */ + if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR + } H5E_END_TRY; -error: - H5E_BEGIN_TRY { - H5Gclose(group2_id); - H5Gclose(group1_id); - H5Fclose(file_id); - } H5E_END_TRY; - return 1; + /* Test getting the type for objects */ + if((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0) FAIL_STACK_ERROR + if(obj_type != H5G_GROUP) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0) TEST_ERROR + } H5E_END_TRY; + + /* Test getting the number of objects in a group */ + if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 2) TEST_ERROR + if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 1) TEST_ERROR + + /* Test that H5Glink created hard links properly */ + if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + + /* Test for the other hard link created */ + if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + + /* Test the soft link */ + if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR + if(sb_soft1.type != H5G_LINK) TEST_ERROR + if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR + + if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR + + + /* Test the dangling soft link */ + if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR + if(sb_soft2.type != H5G_LINK) TEST_ERROR + if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR + + if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("dangle", tmpstr)) TEST_ERROR + + + /* Test H5Gmove and H5Gmove2 */ + if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR + if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR + + /* Ensure that both groups can be opened */ + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR + + if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Close open IDs */ + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR + + /* Test H5Gunlink */ + if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR + + H5E_BEGIN_TRY { + if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY; + + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(group2_id); + H5Gclose(group1_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: external_link_root * @@ -1788,147 +1788,147 @@ error: static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - const char *file; /* File from external link */ - const char *path; /* Path from external link */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ if(new_format) TESTING("external link to root (w/new group format)") - else - TESTING("external link to root") + else + TESTING("external link to root") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create file to point to */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that external links are registered with the library */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + /* Check that external links are registered with the library */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - /* Create file with link to first file */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to first file */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + /* Check information for external link */ + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ /* (add a few extra '/'s to make certain library normalizes external link object names) */ if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + /* Check information for external link */ + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR - if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a new object using H5Gcreate2 through the external link - * directly - */ - if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create a new object using H5Gcreate2 through the external link + * directly + */ + if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close file and group */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file and group */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - H5F_sfile_assert_num(0); + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Open first file again with read-only access and check on objects created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open objects created through external link */ - if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open objects created through external link */ + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check names */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/new_group")) TEST_ERROR - if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/newer_group")) TEST_ERROR + /* Check names */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/new_group")) TEST_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/newer_group")) TEST_ERROR - /* Close opened objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close opened objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - H5F_sfile_assert_num(0); + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Verify that new objects can't be created through a read-only external - * link. - */ + * link. + */ if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY if(gid >= 0) TEST_ERROR @@ -1943,16 +1943,16 @@ external_link_root(hid_t fapl, hbool_t new_format) PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_root() */ - + /*------------------------------------------------------------------------- * Function: external_link_path * @@ -1973,94 +1973,94 @@ external_link_root(hid_t fapl, hbool_t new_format) static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") - else - TESTING("external link to object on path") + else + TESTING("external link to object on path") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create file to point to */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object down a path */ - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object down a path */ + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file with link to first file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to first file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close second file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close second file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_path() */ - + /*------------------------------------------------------------------------- * Function: external_link_mult * @@ -2081,21 +2081,21 @@ external_link_path(hid_t fapl, hbool_t new_format) static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1), fid2 = (-1); /* File IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") - else - TESTING("external links across multiple files") + else + TESTING("external links across multiple files") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); @@ -2103,128 +2103,128 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Create first file to point to */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object down a path */ - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object down a path */ + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link down a path */ - if((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create external link down a path */ + if((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create third file to point to */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create third file to point to */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link down a path */ - if((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create external link down a path */ + if((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to object in second file */ - if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in second file */ + if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file with link to third file */ - if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to third file */ + if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close second file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close second file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open an object through external links */ - if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open an object through external links */ + if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* The intermediate files should not stay open. Replace one of them with a new file. */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR + /* The intermediate files should not stay open. Replace one of them with a new file. */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR - /* Open the other with write access and delete the external link in it */ - if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR + /* Open the other with write access and delete the external link in it */ + if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_mult() */ - + /*------------------------------------------------------------------------- * Function: external_link_self * @@ -2244,136 +2244,136 @@ external_link_mult(hid_t fapl, hbool_t new_format) static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t lcpl_id = (-1); /* Link Creation Property List ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") - else - TESTING("external link to self") + else + TESTING("external link to self") - /* Set up filename */ - h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); + /* Set up filename */ + h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); /* Create file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create an lcpl with intermediate group creation set */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + /* Create an lcpl with intermediate group creation set */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - /* Create a series of groups within the file: /A/B and /X/Y/Z */ - if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a series of groups within the file: /A/B and /X/Y/Z */ + if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Pclose (lcpl_id) < 0) TEST_ERROR + if(H5Pclose (lcpl_id) < 0) TEST_ERROR - /* Create external link to own root group*/ - if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to own root group*/ + if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X")) TEST_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close created group */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close created group */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close object opened through external link */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close object opened through external link */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Check on object created */ - if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Check on object created */ + if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + /* Complicate things. Use this file as an intermediate file in a chain + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ - /* Create file2 with an external link to file1 */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file2 with an external link to file1 */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file2 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file3 as a target */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Create file3 as a target */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file1 and create an extlink pointing to file3 */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open file1 and create an extlink pointing to file3 */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file1 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file1 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ - if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ + if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open up file3 and make sure the object was created successfully */ - if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open up file3 and make sure the object was created successfully */ + if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(lcpl_id); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ - + /*------------------------------------------------------------------------- * Function: external_link_pingpong * @@ -2401,101 +2401,101 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") - else - TESTING("external links back and forth") + else + TESTING("external links back and forth") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ - + /*------------------------------------------------------------------------- * Function: external_link_toomany * @@ -2536,22 +2536,22 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") - else - TESTING("too many external links") + else + TESTING("too many external links") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Set up filenames */ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); @@ -2560,86 +2560,86 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "link1", H5P_DEFAULT); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; + } + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "link1", H5P_DEFAULT); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; - } + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + PASSED(); + return 0; - /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + error: + H5E_BEGIN_TRY { + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; +} /* end external_link_toomany() */ - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; -} /* end external_link_toomany() */ - - /*------------------------------------------------------------------------- * Function: external_link_dangling * @@ -2660,53 +2660,53 @@ external_link_toomany(hid_t fapl, hbool_t new_format) static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t rid = (-1); /* Root Group ID */ hid_t status = (-1); /* Status */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("dangling external links (w/new group format)") - else - TESTING("dangling external links") + else + TESTING("dangling external links") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create dangling external links */ - if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling external links */ + if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file (for dangling object test) */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file (for dangling object test) */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Get root group ID */ - if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + /* Get root group ID */ + if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; /* Open object through dangling file external link */ H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); + gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2714,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2731,31 +2731,31 @@ external_link_dangling(hid_t fapl, hbool_t new_format) /* Close root group */ if(H5Gclose(rid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_dangling() */ - + /*------------------------------------------------------------------------- * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 @@ -2771,84 +2771,84 @@ external_link_dangling(hid_t fapl, hbool_t new_format) static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + hid_t gapl_id = (-1); + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") - else - TESTING("external links via H5Pset_elink_prefix()") + else + TESTING("external links via H5Pset_elink_prefix()") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for external linked target file: "extlinks2" */ h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2); /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR - /* set up name for target file: "tmp/extlinks2" */ - h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); + /* set up name for target file: "tmp/extlinks2" */ + h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file (without the absolute path) */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file (without the absolute path) */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* set up prefix for external link */ - if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR + /* set up prefix for external link */ + if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", gapl_id); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", gapl_id); + } H5E_END_TRY; - /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_prefix() */ - + /*------------------------------------------------------------------------- * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 @@ -2863,21 +2863,21 @@ external_link_prefix(hid_t fapl, hbool_t new_format) static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's absolute path (w/new group format)") - else - TESTING("external links via main file's absolute path") + else + TESTING("external links via main file's absolute path") - /* set up name for external linked target file: "extlinks3" */ - h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks3" */ + h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks3" */ h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3); @@ -2885,64 +2885,64 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Window: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Window: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from absolute path set for main file */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file from absolute path set for main file */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abs_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_rel_mainpath: test 4 * - * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * Purpose: 1. target link: "extlinks4" + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 @@ -2957,77 +2957,77 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + relative path(w/new group format)") - else - TESTING("external links via main file's CWD + relative path") + else + TESTING("external links via main file's CWD + relative path") - /* set up name for external linked target file: "extlinks4" */ - h5_fixname(FILENAME[20], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks4" */ + h5_fixname(FILENAME[20], fapl, filename2, sizeof filename2); if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for main file: "tmp/extlinks0" */ - h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); + /* set up name for main file: "tmp/extlinks0" */ + h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); /* set up name for target file: "tmp/extlinks4" */ h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from the main file's relative pathname */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; - } + /* should be able to find the target file from the main file's relative pathname */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_rel_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * * Return: Success: 0 @@ -3043,85 +3043,85 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via current working directory(w/new group format)") - else - TESTING("external links via current working directory") + else + TESTING("external links via current working directory") - /* set up name for external linked target file: "extlinks5" */ - /* set up name for target file: "extlinks5" */ - h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks5" */ + /* set up name for target file: "extlinks5" */ + h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2); if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* Create the target file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from the current working directory */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; - } + /* should be able to find the target file from the current working directory */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_cwd() */ - + /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 @@ -3136,32 +3136,32 @@ external_link_cwd(hid_t fapl, hbool_t new_format) static int external_link_abstar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's absolute path (w/new group format)") - else - TESTING("external links via target's absolute path") + else + TESTING("external links via target's absolute path") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[23]); + /* + * set up name for external linked target file: + * Linux: "/CWD/tmp/extlinks6" + * Windows: ":/CWD/tmp/extlinks6" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks6" */ @@ -3169,53 +3169,53 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file with abolute path */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file with abolute path */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abstar() */ /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 @@ -3230,21 +3230,21 @@ external_link_abstar(hid_t fapl, hbool_t new_format) static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD (w/new group format)") - else - TESTING("external links via main file's CWD") + else + TESTING("external links via main file's CWD") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target file name: "extlinks7" */ h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3); @@ -3253,64 +3253,64 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[25]); + /* + * set up name for external linked target file: + * Linux: "/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from main file's current working directory */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; - } + /* should be able to find the target file from main file's current working directory */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abstar_cur() */ - + /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 @@ -3325,74 +3325,74 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + target's relative path(w/new group format)") - else - TESTING("external links via main file's CWD + target's relative path") + else + TESTING("external links via main file's CWD + target's relative path") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name: "tmp/extlinks8" */ - /* set up name for external linked target file: "tmp/extlinks8" */ - h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); + /* set up name for target file name: "tmp/extlinks8" */ + /* set up name for external linked target file: "tmp/extlinks8" */ + h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); /* Create the target file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } /* end if */ + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } /* end if */ /* closing for main file */ if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_reltar() */ - + /*------------------------------------------------------------------------- * Function: external_link_chdir: test 9 * * Purpose: - * 1. target link: "extlinks9" - * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" - * Should be able to access the target file in current working directory + * 1. target link: "extlinks9" + * 2. main file: "extlinks0" + * 3. target file" "tmp/extlinks9" + * 3. chdir "tmp" + * Should be able to access the target file in current working directory * * Return: Success: 0 * Failure: -1 @@ -3407,19 +3407,19 @@ external_link_reltar(hid_t fapl, hbool_t new_format) static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via chdir and found in current working directory (w/new group format)") - else - TESTING("external links via chdir and found in current working directory") + else + TESTING("external links via chdir and found in current working directory") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for external linked target file ("extlinks9") */ h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); @@ -3427,75 +3427,75 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name ("tmp/extlinks9") */ - h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); + /* set up name for target file name ("tmp/extlinks9") */ + h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if (HDchdir(TMPDIR) < 0) TEST_ERROR + if (HDchdir(TMPDIR) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - if (HDchdir("..") < 0) TEST_ERROR + if (HDchdir("..") < 0) TEST_ERROR - /* - * Should be able to find the target file from: - * main file's current working directory + pathname of external linked targetfile - */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* + * Should be able to find the target file from: + * main file's current working directory + pathname of external linked targetfile + */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_chdir() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. - * - * 1. target link: "extlinks16" - * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file A to be a "family" file: extlinks16A - * 4. Create target file B to be a "multi" file: extlinks16B - * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A - * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B - * 6. Should succeed in opening the target object: ext_extA - * 6. Should succeed in opening the target object: ext_extB + * different from the parent can be successfully opened. + * + * 1. target link: "extlinks16" + * 2. target file: "extlinks16" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file A to be a "family" file: extlinks16A + * 4. Create target file B to be a "multi" file: extlinks16B + * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A + * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B + * 6. Should succeed in opening the target object: ext_extA + * 6. Should succeed in opening the target object: ext_extB * * Return: Success: 0 * Failure: -1 @@ -3510,37 +3510,37 @@ external_link_chdir(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl1(hid_t fapl, hbool_t new_format) { - hid_t fid=(-1); - hid_t fidA=(-1), fidB=(-1); - hid_t gidA=(-1), gidB=(-1); - hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; - hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + hid_t fid=(-1); + hid_t fidA=(-1), fidB=(-1); + hid_t gidA=(-1), gidB=(-1); + hid_t oidA=(-1), oidB=(-1); + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hid_t fam_fapl=-1, multi_fapl=-1; + hid_t lapl_idA=-1, lapl_idB=-1; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") - else - TESTING("H5Pset/get_elink_fapl() with different physical layouts") + else + TESTING("H5Pset/get_elink_fapl() with different physical layouts") - if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) + TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* create "family" fapl */ @@ -3560,8 +3560,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); + HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); + HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -3604,102 +3604,102 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* Create target file A to be a "family" file */ if((fidA=H5Fcreate(filename2A, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR - if((gidA=H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gidA=H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create target file B to be a "multi" file */ - if((fidB=H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0) TEST_ERROR - if((gidB=H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create target file B to be a "multi" file */ + if((fidB=H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0) TEST_ERROR + if((gidB=H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target files */ - if(H5Gclose(gidA) < 0) TEST_ERROR - if(H5Gclose(gidB) < 0) TEST_ERROR - if(H5Fclose(fidA) < 0) TEST_ERROR - if(H5Fclose(fidB) < 0) TEST_ERROR + /* closing for target files */ + if(H5Gclose(gidA) < 0) TEST_ERROR + if(H5Gclose(gidB) < 0) TEST_ERROR + if(H5Fclose(fidA) < 0) TEST_ERROR + if(H5Fclose(fidB) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file A:/A */ - if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - /* Create external link to target file B:/B */ - if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create external link to target file A:/A */ + if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + /* Create external link to target file B:/B */ + if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Set file access property list for link access to use the family driver */ - if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the family driver */ + if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0) TEST_ERROR - /* open target object A */ - oidA = H5Oopen(fid, "ext_linkA", lapl_idA); + /* open target object A */ + oidA = H5Oopen(fid, "ext_linkA", lapl_idA); /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ if((lapl_idB = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0) TEST_ERROR - /* open target object B */ - oidB = H5Oopen(fid, "ext_linkB", lapl_idB); + /* open target object B */ + oidB = H5Oopen(fid, "ext_linkB", lapl_idB); /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ if(H5Pclose(lapl_idA) < 0) TEST_ERROR - if(H5Pclose(lapl_idB) < 0) TEST_ERROR - if(H5Pclose(fam_fapl) < 0) TEST_ERROR - if(H5Pclose(multi_fapl) < 0) TEST_ERROR - if(H5Oclose(oidA) < 0) TEST_ERROR - if(H5Oclose(oidB) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(lapl_idB) < 0) TEST_ERROR + if(H5Pclose(fam_fapl) < 0) TEST_ERROR + if(H5Pclose(multi_fapl) < 0) TEST_ERROR + if(H5Oclose(oidA) < 0) TEST_ERROR + if(H5Oclose(oidB) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl1() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. - * - * 1. target link: "extlinks17" - * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. + * + * 1. target link: "extlinks17" + * 2. target file: "extlinks17" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 6. Should succeed in opening the target dataset: ext_link + * 7. Write data to the target dataset + * 8. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 @@ -3714,32 +3714,32 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hsize_t dims[2]; - int points[NUM40][NUM40]; - h5_stat_size_t filesize, new_filesize; - int i, j, n; + int points[NUM40][NUM40]; + h5_stat_size_t filesize, new_filesize; + int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") - else - TESTING("H5Pset/get_elink_fapl() with same physical layout") + else + TESTING("H5Pset/get_elink_fapl() with same physical layout") - if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) + TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* create fapl for the target file to be a "core" file */ @@ -3747,53 +3747,57 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR - /* set up name for external linked target file: "extlinks17" */ - /* set up name for target file: "extlinks17" */ - h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks17" */ + /* set up name for target file: "extlinks17" */ + h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); /* Create the target file to be a "core" file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - dims[0] = NUM40; + dims[0] = NUM40; dims[1] = NUM40; if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - /* Create dataset creation property list */ - if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) TEST_ERROR; + /* Create dataset creation property list */ + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR - /* closing for target file */ - if(H5Pclose(dcpl) < 0) TEST_ERROR - if(H5Sclose(space) < 0) TEST_ERROR - if(H5Dclose(dset) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Pclose(dcpl) < 0) TEST_ERROR + if(H5Sclose(space) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* get size of target file */ - filesize = h5_get_file_size(filename2, core_fapl); + /* get size of target file */ + filesize = h5_get_file_size(filename2, core_fapl); /* Create the main file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ - if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ + if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* create fapl to be a "core" file without backing store */ - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR + /* create fapl to be a "core" file without backing store */ + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) + TEST_ERROR - /* Set file access property list for link access to use the "core" driver */ - if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(dapl_id, core_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "core" driver */ + if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(dapl_id, core_fapl) < 0) TEST_ERROR - /* try to open the external linked target dataset */ - did = H5Dopen2(fid, "ext_link", dapl_id); + /* try to open the external linked target dataset */ + did = H5Dopen2(fid, "ext_link", dapl_id); if(did < 0) { H5_FAILED(); HDputs(" Should succeed in opening the target dataset"); @@ -3809,55 +3813,55 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR - if(H5Pclose(dapl_id) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(dapl_id) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - new_filesize = h5_get_file_size(filename2, core_fapl); + new_filesize = h5_get_file_size(filename2, core_fapl); /* the file size should remain the same since there is no backing store */ if(new_filesize != filesize) TEST_ERROR - if(H5Pclose(core_fapl) < 0) TEST_ERROR + if(H5Pclose(core_fapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl2() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl - * 10. Verify that the copied link access's fapl is the core driver - * 11. Get the fapl property value of the copied link access - * 12. H5Premove() the fapl property from the copied link access - * 13. H5Pclose() fapl set in the copied link access should fail since the - * removal in #12 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * 10. Verify that the copied link access's fapl is the core driver + * 11. Get the fapl property value of the copied link access + * 12. H5Premove() the fapl property from the copied link access + * 13. H5Pclose() fapl set in the copied link access should fail since the + * removal in #12 should also close its fapl * * Return: Success: 0 * Failure: -1 @@ -3873,64 +3877,64 @@ static int external_set_elink_fapl3(hbool_t new_format) { hid_t core_fapl = -1, stdio_fapl = -1; - hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; + hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) TESTING("H5Pset/get_fapl() (w/new group format)") - else - TESTING("H5Pset/get_fapl()") + else + TESTING("H5Pset/get_fapl()") - /* create fapl for the target file to be a "core" file */ - core_fapl = h5_fileaccess(); + /* create fapl for the target file to be a "core" file */ + core_fapl = h5_fileaccess(); if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR - stdio_fapl = h5_fileaccess(); + stdio_fapl = h5_fileaccess(); if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR - /* Set file access property list for link access to use the "stdio" driver */ - if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "stdio" driver */ + if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0) TEST_ERROR - /* Verify that the driver for the link's fapl is the "stdio" driver */ - if((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0) TEST_ERROR - if(H5Pget_driver(l_fapl) != H5FD_STDIO) TEST_ERROR - if(H5Pclose(l_fapl) < 0) TEST_ERROR + /* Verify that the driver for the link's fapl is the "stdio" driver */ + if((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0) TEST_ERROR + if(H5Pget_driver(l_fapl) != H5FD_STDIO) TEST_ERROR + if(H5Pclose(l_fapl) < 0) TEST_ERROR - /* Set file access property list for link access to use the "core" driver */ - if(H5Pset_elink_fapl(lapl_id, core_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "core" driver */ + if(H5Pset_elink_fapl(lapl_id, core_fapl) < 0) TEST_ERROR - /* Make a copy of the link access property */ - if((new_lapl_id = H5Pcopy(lapl_id)) < 0) TEST_ERROR + /* Make a copy of the link access property */ + if((new_lapl_id = H5Pcopy(lapl_id)) < 0) TEST_ERROR - /* get the fapl set in lapl_id */ - if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR - if(H5Pclose(lapl_id) < 0) TEST_ERROR + /* get the fapl set in lapl_id */ + if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR + if(H5Pclose(lapl_id) < 0) TEST_ERROR - /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ - if(H5Pclose(out_fapl) < 0) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR - /* Verify that the driver for the copied link's fapl is the "core" driver */ - if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR - if(H5Pget_driver(l_fapl) != H5FD_CORE) TEST_ERROR + /* Verify that the driver for the copied link's fapl is the "core" driver */ + if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR + if(H5Pget_driver(l_fapl) != H5FD_CORE) TEST_ERROR - /* get the fapl set in new_lapl_id */ - if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR - if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR + /* get the fapl set in new_lapl_id */ + if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR + if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR - /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ - if(H5Pclose(out_fapl) < 0) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR - if(H5Pclose(l_fapl) < 0) TEST_ERROR - if(H5Pclose(new_lapl_id) < 0) TEST_ERROR - if(H5Pclose(core_fapl) < 0) TEST_ERROR - if(H5Pclose(stdio_fapl) < 0) TEST_ERROR + if(H5Pclose(l_fapl) < 0) TEST_ERROR + if(H5Pclose(new_lapl_id) < 0) TEST_ERROR + if(H5Pclose(core_fapl) < 0) TEST_ERROR + if(H5Pclose(stdio_fapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Pclose(l_fapl); H5Pclose(lapl_id); @@ -3941,7 +3945,7 @@ external_set_elink_fapl3(hbool_t new_format) return -1; } /* end external_set_elink_fapl3() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_acc_flags * @@ -3962,207 +3966,207 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo { hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE]; herr_t ret; unsigned flags; if(new_format) TESTING("H5Pset/get_elink_acc_flags() (w/new group format)") - else - TESTING("H5Pset/get_elink_acc_flags()") + else + TESTING("H5Pset/get_elink_acc_flags()") - /* Create parent and target files, and external link */ - h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); + /* Create parent and target files, and external link */ + h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[41], fapl, filename2, sizeof filename2); if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close file2, leave file1 open (should be read-write) */ - if(H5Fclose(file2) < 0) TEST_ERROR - - /* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR - - /* Verify "get" routine functionality */ - if(H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR - if(flags != H5F_ACC_RDONLY) TEST_ERROR - - /* Attempt to create a group through the external link using gapl (should fail) */ - H5E_BEGIN_TRY { - group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); - } H5E_END_TRY; - if(group != FAIL) TEST_ERROR - - /* Close file1 and reopen with read only access */ - if(H5Fclose(file1) < 0) TEST_ERROR - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR - - /* Create a group through the external link using gapl (should succeed) */ - if((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR - - /* Close group */ - if(H5Gclose(group) < 0) TEST_ERROR - - /* Unset elink access flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR - - /* Attempt to create a group through the external link using gapl (should fail) */ - H5E_BEGIN_TRY { - subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl); - } H5E_END_TRY; - if(subgroup != FAIL) TEST_ERROR - - /* Attempt to set SWMR flags on gapl. - * This is just a smoke check of the flags. The actual external link - * functionality is tested in the SWMR tests. - */ - /* Set SWMR reader flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0) TEST_ERROR - /* Set SWMR writer flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0) TEST_ERROR - - /* Attempt to set invalid flags on gapl */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - /* SWMR reader with write access */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - /* SWMR writer with read-only access */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - - /* Only run this part with VFDs that support SWMR */ - if(H5FD_supports_swmr_test(env_h5_drvr)) { - - /* Reopen file1, with read-write and SWMR-write access */ - /* Only supported under the latest file format */ - if(new_format) { - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using default gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDWR) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - } - - /* Reopen file1, with read-only and SWMR-read access */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using default gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDONLY) TEST_ERROR + if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - } /* end if */ - - - /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ - H5E_BEGIN_TRY { - file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR + /* Close file2, leave file1 open (should be read-write) */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Close gapl */ - if(H5Pclose(gapl) < 0) TEST_ERROR + /* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR - PASSED(); - return 0; + /* Verify "get" routine functionality */ + if(H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR + if(flags != H5F_ACC_RDONLY) TEST_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose(group); - H5Gclose(subgroup); - H5Fclose(file1); - H5Fclose(file2); - H5Pclose(gapl); - } H5E_END_TRY; - return -1; + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if(group != FAIL) TEST_ERROR + + /* Close file1 and reopen with read only access */ + if(H5Fclose(file1) < 0) TEST_ERROR + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR + + /* Create a group through the external link using gapl (should succeed) */ + if((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(group) < 0) TEST_ERROR + + /* Unset elink access flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR + + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if(subgroup != FAIL) TEST_ERROR + + /* Attempt to set SWMR flags on gapl. + * This is just a smoke check of the flags. The actual external link + * functionality is tested in the SWMR tests. + */ + /* Set SWMR reader flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0) TEST_ERROR + /* Set SWMR writer flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0) TEST_ERROR + + /* Attempt to set invalid flags on gapl */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + /* SWMR reader with write access */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + /* SWMR writer with read-only access */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + + /* Only run this part with VFDs that support SWMR */ + if(H5FD_supports_swmr_test(env_h5_drvr)) { + + /* Reopen file1, with read-write and SWMR-write access */ + /* Only supported under the latest file format */ + if(new_format) { + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using default gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != H5F_ACC_RDWR) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + } + + /* Reopen file1, with read-only and SWMR-read access */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using default gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != H5F_ACC_RDONLY) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + } /* end if */ + + + /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + + /* Close gapl */ + if(H5Pclose(gapl) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(group); + H5Gclose(subgroup); + H5Fclose(file1); + H5Fclose(file2); + H5Pclose(gapl); + } H5E_END_TRY; + return -1; } /* end external_set_elink_acc_flags() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -4178,7 +4182,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo * *------------------------------------------------------------------------- */ - /* User data structure for callback function */ +/* User data structure for callback function */ typedef struct { const char *parent_file; /* Expected parent file name */ const char *target_file; /* Expected target file name */ @@ -4190,8 +4194,8 @@ typedef struct { /* Callback function */ static herr_t external_set_elink_cb_cb(const char *parent_file, const char *parent_group, - const char *target_file, const char *target_obj, unsigned *flags, - hid_t fapl, void *_op_data) + const char *target_file, const char *target_obj, unsigned *flags, + hid_t fapl, void *_op_data) { set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data; @@ -4222,23 +4226,23 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver; set_elink_cb_t op_data, - *op_data_p; + *op_data_p; H5L_elink_traverse_t cb; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE]; unsigned flags; if(new_format) TESTING("H5Pset/get_elink_cb() (w/new group format)") - else - TESTING("H5Pset/get_elink_cb()") + else + TESTING("H5Pset/get_elink_cb()") - /* Build user data for callback */ - op_data.parent_file = filename1; + /* Build user data for callback */ + op_data.parent_file = filename1; op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI @@ -4248,61 +4252,61 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) /* Create family fapl */ if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR + if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR - /* Create parent and target files, group, and external link */ - h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1); + /* Create parent and target files, group, and external link */ + h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[43], fam_fapl, filename2, sizeof filename2); if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR - if((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close files and group */ - if(H5Fclose(file1) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR - if(H5Gclose(group) < 0) TEST_ERROR - - /* Create new gapl, and set elink callback */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR - - /* Verify "get" routine functionality */ - if(H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR - if(cb != external_set_elink_cb_cb) TEST_ERROR - if(op_data_p != &op_data) TEST_ERROR - - /* Open file1 with read only access */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - - /* Create a group through the external link using gapl */ - if((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR - - /* Verify that the correct parameters have been set on file2 (somewhat - * redundant as the library would be unable to create the group otherwise) - */ - if((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR - if(H5Fget_intent(file2, &flags) < 0) TEST_ERROR - if(!(flags & H5F_ACC_RDWR)) TEST_ERROR - if((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR - if(H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR - - if(H5Gclose(group) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR - if(H5Pclose(ret_fapl) < 0) TEST_ERROR - if(H5Pclose(fam_fapl) < 0) TEST_ERROR - - /* Modify the user data structure to cause the callback to fail next time */ - op_data.code = 1; + if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR + if((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close files and group */ + if(H5Fclose(file1) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR + if(H5Gclose(group) < 0) TEST_ERROR + + /* Create new gapl, and set elink callback */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR + + /* Verify "get" routine functionality */ + if(H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR + if(cb != external_set_elink_cb_cb) TEST_ERROR + if(op_data_p != &op_data) TEST_ERROR + + /* Open file1 with read only access */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Create a group through the external link using gapl */ + if((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Verify that the correct parameters have been set on file2 (somewhat + * redundant as the library would be unable to create the group otherwise) + */ + if((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR + if(H5Fget_intent(file2, &flags) < 0) TEST_ERROR + if(!(flags & H5F_ACC_RDWR)) TEST_ERROR + if((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR + if(H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR + + if(H5Gclose(group) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR + if(H5Pclose(ret_fapl) < 0) TEST_ERROR + if(H5Pclose(fam_fapl) < 0) TEST_ERROR + + /* Modify the user data structure to cause the callback to fail next time */ + op_data.code = 1; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { - group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); } H5E_END_TRY; if(group != FAIL) TEST_ERROR - /* Modify the user data structure to cause the callback to return invalid flags */ - op_data.code = 2; + /* Modify the user data structure to cause the callback to return invalid flags */ + op_data.code = 2; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { @@ -4310,14 +4314,14 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(group != FAIL) TEST_ERROR - /* Close */ - if(H5Fclose(file1) < 0) TEST_ERROR - if(H5Pclose(gapl) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(file1) < 0) TEST_ERROR + if(H5Pclose(gapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Gclose(group); H5Fclose(file1); @@ -4329,7 +4333,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) return -1; } /* end external_set_elink_cb() */ - + /*------------------------------------------------------------------------- * Function: external_reset_register * @@ -4357,50 +4361,50 @@ external_reset_register(void) /* Create and close file */ h5_fixname(FILENAME[44], H5P_DEFAULT, filename, sizeof filename); if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Fclose(file) < 0) TEST_ERROR + if (H5Fclose(file) < 0) TEST_ERROR - /* Reset the library */ - H5close(); + /* Reset the library */ + H5close(); /* Re open file */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create an external link */ - if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link */ + if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if (H5Fclose(file) < 0) TEST_ERROR + /* Close file */ + if (H5Fclose(file) < 0) TEST_ERROR - /* Try again to make sure the previous H5Lcreate_external call does not - * affect the ability to reset */ - H5close(); + /* Try again to make sure the previous H5Lcreate_external call does not + * affect the ability to reset */ + H5close(); if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if (H5Fclose(file) < 0) TEST_ERROR + if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if (H5Fclose(file) < 0) TEST_ERROR - if(HDremove(filename) != 0) TEST_ERROR + if(HDremove(filename) != 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; return -1; } /* end external_reset_register() */ - + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" - * 2. main file: "extlinks0" - * 3. target file: "extlinks10" - * Should be able to find the target file via main file's current drive/rel path + * 1. target link: "/CWD/tmp/extlinks10" + * 2. main file: "extlinks0" + * 3. target file: "extlinks10" + * Should be able to find the target file via main file's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4415,27 +4419,27 @@ external_reset_register(void) static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's current drive/rel path(windows)") + else + TESTING("external links via main file's current drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks10" */ - HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ + /* set up name for target link: "/CWD/tmp/extlinks10" */ + HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4445,55 +4449,55 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's CWD*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* should be able to find the target file via main file's CWD*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win1() */ - + /*------------------------------------------------------------------------- * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 1. target link: "/CWD/tmp/extlinks11" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -4508,28 +4512,28 @@ external_link_win1(hid_t fapl, hbool_t new_format) static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") - else - TESTING("external links via target's rel drive/abs path directly(windows)") + else + TESTING("external links via target's rel drive/abs path directly(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks11" */ - HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ + /* set up name for target link: "/CWD/tmp/extlinks11" */ + HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[31]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4539,55 +4543,55 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win2() */ - + /*------------------------------------------------------------------------- * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 1. target link: ":tmp/extlinks12" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 @@ -4602,29 +4606,29 @@ external_link_win2(hid_t fapl, hbool_t new_format) static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") - else - TESTING("external links via target's abs drive/rel path directly (windows)") + else + TESTING("external links via target's abs drive/rel path directly (windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target link: ":tmp/extlinks12" */ - drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[32]); + /* set up name for target link: ":tmp/extlinks12" */ + drive = HDgetdrive(); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks12" */ @@ -4632,54 +4636,54 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win3() */ - + /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * 1. target link: ":extlinks13" + * 2. main file: ":tmp/extlinks0" + * 3. target file: tmp/extlinks13 + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4694,26 +4698,26 @@ external_link_win3(hid_t fapl, hbool_t new_format) static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") - else - TESTING("external links via main file's abs drive/rel path (windows)") + else + TESTING("external links via main file's abs drive/rel path (windows)") - /* set up name for main file: ":tmp/extlinks0" */ - drive = HDgetdrive(); - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[13]); + /* set up name for main file: ":tmp/extlinks0" */ + drive = HDgetdrive(); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":extlinks13" */ - sprintf(tmpname, "%c:%s", (drive+'A'-1), FILENAME[33]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks13" */ @@ -4721,55 +4725,55 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's absolute drive/relative path */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* should be able to find the target file via main file's absolute drive/relative path */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win4() */ - + /*------------------------------------------------------------------------- * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 1. target link: ":tmp/extlinks14" + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 @@ -4784,23 +4788,27 @@ external_link_win4(hid_t fapl, hbool_t new_format) static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)") - else - TESTING("external links via main file's rel drive/abs path (windows)") + else + TESTING("external links via main file's rel drive/abs path (windows)") - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR - drive = HDgetdrive(); + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR + drive = HDgetdrive(); + if (drive >= 26) + drive -= 1; /* account for drive Z */ + else + drive += 1; /* set up name for main file: "/CWD/extlinks0" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ @@ -4809,7 +4817,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks14" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks14" */ @@ -4817,55 +4825,55 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's rel drive/abs path */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* should be able to find the target file via main file's rel drive/abs path */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win5() */ - + /*------------------------------------------------------------------------- * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 1. target link: ":tmp/extlinks15" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4880,29 +4888,33 @@ external_link_win5(hid_t fapl, hbool_t new_format) static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") - else - TESTING("external links via target's current drive/rel path (windows)") + else + TESTING("external links via target's current drive/rel path (windows)") - /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - drive = HDgetdrive(); + /* create tmp directory */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + drive = HDgetdrive(); + if (drive >= 26) + drive -= 1; /* account for drive Z */ + else + drive += 1; /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks15" */ - sprintf(tmpname, "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks15" */ @@ -4910,47 +4922,47 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via target file's rel path in current drive */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file via target file's rel path in current drive */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win6() */ - + /*------------------------------------------------------------------------- * Function: external_link_win7 * @@ -4970,24 +4982,24 @@ external_link_win7(hid_t fapl, hbool_t new_format) hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's UNC local host/main drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's UNC local host/main drive/rel path(windows)") + else + TESTING("external links via main file's UNC local host/main drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ - HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ + /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ + HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4997,47 +5009,47 @@ external_link_win7(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's local host/main drive*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in local host/main drive."); - goto error; - } + /* should be able to find the target file via main file's local host/main drive*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in local host/main drive."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win7() */ - + /*------------------------------------------------------------------------- * Function: external_link_win8 * @@ -5059,29 +5071,29 @@ external_link_win8(hid_t fapl, hbool_t new_format) hid_t gid = (-1); /* Group IDs */ int drive=0; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's Long UNC abs drive/abs path directly (windows)(w/new group format)") - else - TESTING("external links via target's Long UNC abs drive/abs path directly (windows)") + else + TESTING("external links via target's Long UNC abs drive/abs path directly (windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* create tmp directory */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + /* create tmp directory */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR - /* set up name for target link: ":\CWD\extlinks10" */ - drive = HDgetdrive(); - sprintf(tmpname, "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); + /* set up name for target link: ":\CWD\extlinks10" */ + drive = HDgetdrive(); + HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "extlinks10" */ @@ -5089,47 +5101,47 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win8() */ - + /*------------------------------------------------------------------------- * Function: external_link_win9 * @@ -5149,24 +5161,24 @@ external_link_win9(hid_t fapl, hbool_t new_format) hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)") + else + TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ - HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ + /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ + HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -5176,49 +5188,49 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's local host/main drive*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in local host/main drive."); - goto error; - } + /* should be able to find the target file via main file's local host/main drive*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in local host/main drive."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win9() */ #endif /* H5_HAVE_WINDOW_PATH */ - + /*------------------------------------------------------------------------- * Function: external_link_recursive * @@ -5237,57 +5249,57 @@ external_link_win9(hid_t fapl, hbool_t new_format) static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") - else - TESTING("recursive external links") + else + TESTING("recursive external links") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create recursive external links */ - if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create recursive external links */ + if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object through dangling file external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; - } + /* Open object through dangling file external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; + } - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_recursive() */ - + /*------------------------------------------------------------------------- * Function: external_link_query * @@ -5307,117 +5319,117 @@ external_link_recursive(hid_t fapl, hbool_t new_format) static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") - else - TESTING("query aspects of external link") + else + TESTING("query aspects of external link") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - /* (add a few extra '/'s to make certain library normalizes external link object names) */ - if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR - if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; - } + /* Create external link */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if (H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR - if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; - } + /* Get size of buffer for external link */ + if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if(H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } /* Get information for external link. It should be two strings right after each other */ if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - /* Extract the file and object names from the buffer */ - if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR + /* Extract the file and object names from the buffer */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR - /* Compare the file and object names */ - if(HDstrcmp(file_name, filename2)) TEST_ERROR - if(HDstrcmp(object_name, "/dst")) TEST_ERROR + /* Compare the file and object names */ + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR - /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; - } + /* Query information about object that external link points to */ + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; + } /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ - if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR + /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR - /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY + /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end external_link_query() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_compact * @@ -5434,76 +5446,76 @@ error: static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("unlinking external link in compact group (w/new group format)") - else - TESTING("unlinking external link in compact group") + else + TESTING("unlinking external link in compact group") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link */ + if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR -/* Unlink external link */ + /* Unlink external link */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Unlink external link */ - if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink external link */ + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group for external link */ - if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group for external link */ + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_compact() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_dense * @@ -5520,136 +5532,136 @@ error: static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ if(new_format) TESTING("unlinking external link in dense group (w/new group format)") - else - TESTING("unlinking external link in dense group") + else + TESTING("unlinking external link in dense group") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR - /* Query the group creation properties */ - if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR - if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR + if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR - /* Create external link */ - /* (This also covers the case of having an external link in a compact group that's converted to a dense group) */ - if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link */ + /* (This also covers the case of having an external link in a compact group that's converted to a dense group) */ + if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != 1) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR - - /* Create enough objects in the root group to change it into a "dense" group */ - for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - } /* end for */ + /* Check on root group's status */ + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != 1) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + + /* Create enough objects in the root group to change it into a "dense" group */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - /* Close group creation property list */ - if(H5Pclose(gcpl) < 0) TEST_ERROR + /* Close group creation property list */ + if(H5Pclose(gcpl) < 0) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR -/* Unlink external link */ + /* Unlink external link */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Unlink external link */ - if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink external link */ + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Remove enough objects in the root group to change it into a "compact" group */ - for(u = 0; u < ((max_compact - min_dense) + 1); u++) { - sprintf(objname, "filler %u", u); - if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Remove enough objects in the root group to change it into a "compact" group */ + for(u = 0; u < ((max_compact - min_dense) + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != (min_dense - 1)) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group for external link (should be unaffected) */ - if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group for external link (should be unaffected) */ + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_dense() */ - + /*------------------------------------------------------------------------- * Function: external_link_move * @@ -5666,181 +5678,181 @@ error: static int external_link_move(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") - else - TESTING("move external link") + else + TESTING("move external link") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link */ + if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR -/* Move external link to different name within same group */ + /* Move external link to different name within same group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Move external link within same group */ - if(H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link within same group */ + if(H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR -/* Move external link to different group */ + /* Move external link to different group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Create another group, to move the external link into */ - if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create another group, to move the external link into */ + if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Move external link to different group */ - if(H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link to different group */ + if(H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close new group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close new group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR -/* Move external link back to original group */ + /* Move external link back to original group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Move external link back to original location */ - if(H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link back to original location */ + if(H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_move() */ - + /*------------------------------------------------------------------------- * Function: external_link_ride * @@ -5858,175 +5870,175 @@ error: static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ if(new_format) TESTING("external link along for the ride (w/new group format)") - else - TESTING("external link along for the ride") + else + TESTING("external link along for the ride") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Check on root group's status */ - if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Query the group creation properties */ - if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR - if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR - /* Create enough objects in the root group to change it into a "dense" group */ - for(u = 0; u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - } /* end for */ + /* Query the group creation properties */ + if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR + if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create enough objects in the root group to change it into a "dense" group */ + for(u = 0; u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(new_format) { - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - } /* end if */ - else { - if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR - } /* end else */ + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(new_format) { + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + } /* end if */ + else { + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR + } /* end else */ /* Create external link */ /* (This also covers the case of adding an external link to a dense group) */ if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - /* Close group creation property list */ - if(H5Pclose(gcpl) < 0) TEST_ERROR + /* Close group creation property list */ + if(H5Pclose(gcpl) < 0) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR -/* Remove enough objects to convert group containing external link back into compact form */ + /* Remove enough objects to convert group containing external link back into compact form */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Remove enough objects in the root group to change it into a "compact" group */ - for(u = 0; u < ((max_compact - min_dense) + 3); u++) { - sprintf(objname, "filler %u", u); - if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Remove enough objects in the root group to change it into a "compact" group */ + for(u = 0; u < ((max_compact - min_dense) + 3); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_ride() */ - + /*------------------------------------------------------------------------- * Function: external_link_closing * @@ -6048,218 +6060,218 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; if(new_format) TESTING("that external files are closed during traversal (w/new group format)") - else - TESTING("that external files are closed during traversal") - - /* In this test, external links will go from file1 to file2 and from - * file2 to file3. - * Test that all functions that can traverse external files close - * the files they open. - * Test that providing unusual paths containing external links can't - * make HDF5 forget to close a file it opened. - */ - - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + else + TESTING("that external files are closed during traversal") + + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); /* Create four files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ - dims[0] = 2; + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; dims[1] = 2; if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - - /* Create external links from each file to the next */ - if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close all files but the first */ - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Test creating each kind of object */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - - /* Test move */ - if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, - "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Open file 4 so we can do some fancy things */ - if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, - "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid4, "dataset1", fid1, - "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Close file 4 again */ - if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR - - /* Test copy (as of this test, it uses the same code as move) */ - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Test H5Gset and get comment */ - if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(buf, "comment")) TEST_ERROR - - /* Test H5*open */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5*open2 */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5Oopen */ - if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test H5Fmount */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR - } H5E_END_TRY - - /* Test H5Rcreate */ - if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR - - /* Test unlink */ - if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR - - /* We've tested that the various functions above don't leave files open. - * Now test that we can't confuse HDF5 by giving unusual paths with external links - */ - /* Create an external link that points to another external link */ - if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", - H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Do an external link traversal that recursively calls another external link. */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Create two more groups so that the last three elements in the path are - * all within the same external file - */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - - /* Add a few regular groups and a soft link in file2 using intermediate group creation */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", - lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - - /* Try to traverse this path. There are three soft traversals in a row; - * slink points to (file2)/elink2, which points to (file3)/elink, which - * points to file 4. - */ - if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - - /* Some simpler tests */ - if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - - - /* Close file1, the only file that should still be open */ - if(H5Fclose(fid1) < 0) TEST_ERROR - - /* Re-create each file. If they are hanging open, these creates will fail */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Cleanup */ - if(H5Sclose(sid) < 0) TEST_ERROR - if(H5Tclose(tid2) < 0) TEST_ERROR - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - if(H5Fclose(fid1) < 0) TEST_ERROR - - PASSED(); - - return 0; - -error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Tclose(tid); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid2); - H5Fclose(fid4); - H5Fclose(fid3); - H5Fclose(fid2); - H5Fclose(fid1); - } H5E_END_TRY; - return -1; + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + + + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + PASSED(); + + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Tclose(tid); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid2); + H5Fclose(fid4); + H5Fclose(fid3); + H5Fclose(fid2); + H5Fclose(fid1); + } H5E_END_TRY; + return -1; } /* external_link_closing() */ - + /*------------------------------------------------------------------------- * Function: ext_link_endian * @@ -6278,63 +6290,63 @@ error: static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; if(new_format) TESTING("endianness of external links (w/new group format)") - else - TESTING("endianness of external links") + else + TESTING("endianness of external links") - /* Create a link access property list with the path to the srcdir */ - if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR + /* Create a link access property list with the path to the srcdir */ + if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR - namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ + namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ /* Test LE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ + namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ /* Test BE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- * Function: external_link_strong * @@ -6356,58 +6368,58 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("that external files work with strong file close degree (w/new group format)") - else - TESTING("that external files work with strong file close degree") + else + TESTING("that external files work with strong file close degree") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Copy file access property list */ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Set strong file close degree */ - if(H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0) TEST_ERROR - - /* Create a group at /A/B/C in first file */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid1) < 0) TEST_ERROR - - /* Create an external link /W/X/DLINK in second file to :/A/B/C */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Access external link from file #1 */ - if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Close fapl */ - if(H5Pclose(my_fapl) < 0) TEST_ERROR + /* Set strong file close degree */ + if(H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0) TEST_ERROR + + /* Create a group at /A/B/C in first file */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Create an external link /W/X/DLINK in second file to :/A/B/C */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Access external link from file #1 */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Close fapl */ + if(H5Pclose(my_fapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(my_fapl); H5Gclose(fapl); @@ -6419,7 +6431,7 @@ error: return -1; } /* end external_link_strong() */ - + /*------------------------------------------------------------------------- * Function: external_symlink * @@ -6440,202 +6452,202 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ - if(new_format) - TESTING("external links w/symlink files (w/new group format)") +if(new_format) + TESTING("external links w/symlink files (w/new group format)") else TESTING("external links w/symlink files") #ifdef H5_HAVE_SYMLINK - /* Skip test when using VFDs that can't provide a POSIX compatible file - * descriptor. - */ - have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") - || !HDstrcmp(env_h5_drvr, "core") - || !HDstrcmp(env_h5_drvr, "nomatch")); - if(have_posix_compat_vfd) { - /* set up name for main file: "extlinks21A" */ - h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); - - /* create tmp directory and get current working directory path */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + /* Skip test when using VFDs that can't provide a POSIX compatible file + * descriptor. + */ + have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") + || !HDstrcmp(env_h5_drvr, "core") + || !HDstrcmp(env_h5_drvr, "nomatch")); +if(have_posix_compat_vfd) { + /* set up name for main file: "extlinks21A" */ + h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); + + /* create tmp directory and get current working directory path */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR - /* Set up names for files in the subdirectories */ + /* Set up names for files in the subdirectories */ - /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ - h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[46]); - h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); + /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ + h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); + fix_ext_filename(tmpname, cwdpath, FILENAME[46]); + h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); - /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp/sym1.h5 -> /tmp2/extlinks21B.h5) */ - if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ + /* (i.e. tmp/sym1.h5 -> /tmp2/extlinks21B.h5) */ + if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ - h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); - h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); + /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ + h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); + h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); - /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ - h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[49]); - h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); + /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ + h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); + fix_ext_filename(tmpname, cwdpath, FILENAME[49]); + h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); - /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2/sym2.h5 -> /tmp/extlinks21D.h5) */ - if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ + /* (i.e. tmp2/sym2.h5 -> /tmp/extlinks21D.h5) */ + if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ - h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); - h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); + /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ + h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); + h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); - /* Create file #1 in current directory */ - if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #1 in current directory */ + if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #2, using symlink #1 name */ - if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #2, using symlink #1 name */ + if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ - if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR + /* Create file #2 in tmp directory #2 */ + if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR - /* Re-open file #2 in tmp directory through symlink */ - if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file #2 in tmp directory through symlink */ + if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Create group in file #2 in temporary directory */ - if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #2 in temporary directory */ + if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file #3 & object in temporary directory #2 */ - if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file #3 & object in temporary directory #2 */ + if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #2 */ - if(H5Gclose(group2) < 0) TEST_ERROR + /* Close group in file #2 */ + if(H5Gclose(group2) < 0) TEST_ERROR - /* Close file #2 */ - if(H5Fclose(file2) < 0) TEST_ERROR + /* Close file #2 */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ - if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #3 in temp. directory #2 */ + if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #3 */ - if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #3 */ + if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #1, using symlink #2 name */ - if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #1, using symlink #2 name */ + if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #3 */ - if(H5Gclose(group3) < 0) TEST_ERROR + /* Close group in file #3 */ + if(H5Gclose(group3) < 0) TEST_ERROR - /* Close file #3 */ - if(H5Fclose(file3) < 0) TEST_ERROR + /* Close file #3 */ + if(H5Fclose(file3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ - if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #4 in temporary directory #1 */ + if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #4 in 'temporary' directory */ - if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #4 in 'temporary' directory */ + if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file #5 & object in temporary directory #1 */ - if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file #5 & object in temporary directory #1 */ + if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #4 */ - if(H5Gclose(group4) < 0) TEST_ERROR + /* Close group in file #4 */ + if(H5Gclose(group4) < 0) TEST_ERROR - /* Close file #4 */ - if(H5Fclose(file4) < 0) TEST_ERROR + /* Close file #4 */ + if(H5Fclose(file4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ - if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #5 in temporary directory #1 */ + if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #5 in 'temporary' directory #1 */ - if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Create group in file #5 in 'temporary' directory #1 */ + if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Close file #5 */ - if(H5Fclose(file5) < 0) TEST_ERROR + /* Close file #5 */ + if(H5Fclose(file5) < 0) TEST_ERROR - /* Actual tests... */ + /* Actual tests... */ - /* Reopen file #1 */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Reopen file #1 */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group in file #2, through external link w/symlink */ - if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group2) < 0) TEST_ERROR + /* Open group in file #2, through external link w/symlink */ + if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) TEST_ERROR - /* Open group in file #3, through external link w/symlink to external link */ - if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group3) < 0) TEST_ERROR + /* Open group in file #3, through external link w/symlink to external link */ + if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3) < 0) TEST_ERROR - /* Open group in file #4, through external link w/symlink to external link w/symlink */ - if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group4) < 0) TEST_ERROR + /* Open group in file #4, through external link w/symlink to external link w/symlink */ + if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4) < 0) TEST_ERROR - /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ - if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ + if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - PASSED(); - } /* end if */ - else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); - } /* end else */ + PASSED(); +} /* end if */ +else { + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); +} /* end else */ - return 0; +return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(group5); - H5Gclose(group4); - H5Gclose(group3); - H5Gclose(group2); - H5Fclose(file5); - H5Fclose(file4); - H5Fclose(file3); - H5Fclose(file2); - H5Fclose(file1); - } H5E_END_TRY; - return -1; +error: +H5E_BEGIN_TRY { + H5Gclose(group5); + H5Gclose(group4); + H5Gclose(group3); + H5Gclose(group2); + H5Fclose(file5); + H5Fclose(file4); + H5Fclose(file3); + H5Fclose(file2); + H5Fclose(file1); +} H5E_END_TRY; +return -1; #else /* H5_HAVE_SYMLINK */ - SKIPPED(); - HDputs(" Current file system or operating system doesn't support symbolic links"); +SKIPPED(); +HDputs(" Current file system or operating system doesn't support symbolic links"); - return 0; +return 0; #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ - + /*------------------------------------------------------------------------- * Function: external_copy_invalid_object * @@ -6662,43 +6674,43 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) if(new_format) TESTING("copying invalid external links to the source file (w/new group format)") - else - TESTING("copying invalid external links to the source file") + else + TESTING("copying invalid external links to the source file") - /* Set up filename */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create object copy plist, set expand external flag */ if((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR - if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR + if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR - /* Create file and group */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create file and group */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create an external link in the group to the source file with an invalid - * object name */ - if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link in the group to the source file with an invalid + * object name */ + if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Copy the group containing the external link */ - if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR + /* Copy the group containing the external link */ + if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Attempt to truncate the file again. If there is a lingering id for this - * file this will fail */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Attempt to truncate the file again. If there is a lingering id for this + * file this will fail */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close */ - if(H5Fclose(fid) < 0) TEST_ERROR - if(H5Pclose(ocpyplid) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(ocpyplid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -6708,7 +6720,7 @@ error: return -1; } /* end external_copy_invalid_object */ - + /*------------------------------------------------------------------------- * Function: external_dont_fail_to_source * @@ -6734,45 +6746,45 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) if(new_format) TESTING("that invalid external links don't open the source file (w/new group format)") - else - TESTING("that invalid external links don't open the source file") + else + TESTING("that invalid external links don't open the source file") - /* Set up filename */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create file and group */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create an external link with an invalid file name, but the same object - * name as the group. This way, if the external link is interpreted to - * refer to the source file, it will link to the group */ - if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link with an invalid file name, but the same object + * name as the group. This way, if the external link is interpreted to + * refer to the source file, it will link to the group */ + if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Attempt to open the object the link points to. This should fail */ - H5E_BEGIN_TRY { - oid = H5Oopen(fid, "link", H5P_DEFAULT); - } H5E_END_TRY - if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") + /* Attempt to open the object the link points to. This should fail */ + H5E_BEGIN_TRY { + oid = H5Oopen(fid, "link", H5P_DEFAULT); + } H5E_END_TRY + if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") - /* Close */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Oclose(oid); - H5Fclose(fid); - } H5E_END_TRY + error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Oclose(oid); + H5Fclose(fid); + } H5E_END_TRY - return -1; + return -1; } /* end external_dont_fail_to_source */ - + /*------------------------------------------------------------------------- * Function: external_file_cache * @@ -6805,11 +6817,11 @@ external_file_cache(hid_t fapl, hbool_t new_format) if(new_format) TESTING("external file cache with external links (w/new group format)") - else - TESTING("external file cache with external links") + else + TESTING("external file cache with external links") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4); @@ -6817,334 +6829,334 @@ external_file_cache(hid_t fapl, hbool_t new_format) /* Verify that the default EFC size is 0 */ if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR - if(efc_size != 0) - FAIL_PUTS_ERROR("default external file cache size is not 0") + if(efc_size != 0) + FAIL_PUTS_ERROR("default external file cache size is not 0") - /* Copy FAPL and enable external file caching */ - if((my_fapl = H5Pcopy(fapl)) < 0) - TEST_ERROR - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + /* Copy FAPL and enable external file caching */ + if((my_fapl = H5Pcopy(fapl)) < 0) + TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR - /* Verify that the external file cache size has been set */ - if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) - TEST_ERROR - if(efc_size != 8) - FAIL_PUTS_ERROR("external file cache size different from expected") + /* Verify that the external file cache size has been set */ + if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) + TEST_ERROR + if(efc_size != 8) + FAIL_PUTS_ERROR("external file cache size different from expected") - /* - * Test 1: One file caches another - */ - /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + /* + * Test 1: One file caches another + */ + /* Create files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that both files are now open */ - H5F_sfile_assert_num(2); + /* Verify that both files are now open */ + H5F_sfile_assert_num(2); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 2: One file caches another, release parent's EFC - */ + * Test 2: One file caches another, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that both files are now open */ - H5F_sfile_assert_num(2); + /* Verify that both files are now open */ + H5F_sfile_assert_num(2); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only the parent file is now open */ - H5F_sfile_assert_num(1); + /* Verify that only the parent file is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 3: "Y" shaped tree - */ + * Test 3: "Y" shaped tree + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close files 2-4 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR + if(H5Fclose(fid4) < 0) + TEST_ERROR + + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that files 2 and 3 are now open */ - H5F_sfile_assert_num(3); + /* Verify that files 2 and 3 are now open */ + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(4); + /* Verify that all files are now open */ + H5F_sfile_assert_num(4); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 4: "Y" shaped tree, release parent's EFC - */ + * Test 4: "Y" shaped tree, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close files 2-4 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR + if(H5Fclose(fid4) < 0) + TEST_ERROR + + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that files 2 and 3 are now open */ - H5F_sfile_assert_num(3); + /* Verify that files 2 and 3 are now open */ + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(4); + /* Verify that all files are now open */ + H5F_sfile_assert_num(4); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only file 1 is now open */ - H5F_sfile_assert_num(1); + /* Verify that only file 1 is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 5: 3 file cycle - */ + * Test 5: 3 file cycle + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + /* Close files 2-3 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(3); + /* Verify that all files are now open */ + H5F_sfile_assert_num(3); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 6: 3 file cycle, release parent's EFC - */ + * Test 6: 3 file cycle, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + /* Close files 2-3 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(3); + /* Verify that all files are now open */ + H5F_sfile_assert_num(3); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only file 1 is now open */ - H5F_sfile_assert_num(1); + /* Verify that only file 1 is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* Close fapl */ H5Pclose(my_fapl); @@ -7152,7 +7164,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Oclose(oid); H5Fclose(fid1); @@ -7165,7 +7177,7 @@ error: return -1; } /* end external_file_cache */ - + /*------------------------------------------------------------------------- * Function: external_open_twice * @@ -7194,201 +7206,201 @@ external_open_twice(hid_t fapl, hbool_t new_format) if(new_format) TESTING("opening object twice through elink (w/new group format)") - else - TESTING("opening object twice through elink") + else + TESTING("opening object twice through elink") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* - * Test 1: Open root group twice - */ + * Test 1: Open root group twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 2: Open group twice - */ + * Test 2: Open group twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target group */ - if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - TEST_ERROR - if(H5Gclose(oid1) < 0) - TEST_ERROR + /* Create target group */ + if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) + < 0) + TEST_ERROR + if(H5Gclose(oid1) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 3: Open dataset twice - */ + * Test 3: Open dataset twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target dataset */ - if((space = H5Screate(H5S_SCALAR)) < 0) - TEST_ERROR - if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(oid1) < 0) - TEST_ERROR - if(H5Sclose(space) < 0) - TEST_ERROR + /* Create target dataset */ + if((space = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR + if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, + dcpl_g, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dclose(oid1) < 0) + TEST_ERROR + if(H5Sclose(space) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 4: Open datatype twice - */ + * Test 4: Open datatype twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target datatype */ - if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) - TEST_ERROR - if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) - < 0) - TEST_ERROR - if(H5Tclose(type) < 0) - TEST_ERROR + /* Create target datatype */ + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR + if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) + < 0) + TEST_ERROR + if(H5Tclose(type) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Oclose(oid1); H5Oclose(oid2); @@ -7401,7 +7413,7 @@ error: return -1; } /* end external_open_twice() */ - + /*------------------------------------------------------------------------- * Function: external_link_with_committed_datatype * @@ -7424,32 +7436,32 @@ error: static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { - hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ - char filename1[NAME_BUF_SIZE]; /* File name for main file */ - char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ + char filename1[NAME_BUF_SIZE]; /* File name for main file */ + char filename2[NAME_BUF_SIZE]; /* File name for target file */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") - else - TESTING("attach committed datatype to external group's attribute/dataset") + else + TESTING("attach committed datatype to external group's attribute/dataset") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); @@ -7457,203 +7469,206 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Create external link from main file to target file */ - if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - - - /* Create target file */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - /* Create group in target file */ - if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid2) < 0) - FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(fid2) < 0) - FAIL_STACK_ERROR - - /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Create a copy of integer datatype */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - FAIL_STACK_ERROR - - /* Commit the datatype to the main file root group */ - if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - - /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR - - /* Attach an attribute with the committed datatype to the group */ - if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Write data to the attribute */ - if(H5Awrite(aid, tid, &wdata) < 0) - FAIL_STACK_ERROR - - /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR - - /* Verify the datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR - - /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR - - /* Create a chunked dataset */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) - FAIL_STACK_ERROR + /* Create external link from main file to target file */ + if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR - if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) - FAIL_STACK_ERROR - if(H5Pset_chunk(dcpl, 2, chunks) < 0) - FAIL_STACK_ERROR - /* Initialize data buffers */ - for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; - } + /* Create target file */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + /* Create group in target file */ + if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close the group */ + if(H5Gclose(gid2) < 0) + FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(fid2) < 0) + FAIL_STACK_ERROR + + /* Open the group which is externally linked to target file */ + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create a copy of integer datatype */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + FAIL_STACK_ERROR + + /* Commit the datatype to the main file root group */ + if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Create dataspace */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + FAIL_STACK_ERROR + + /* Attach an attribute with the committed datatype to the group */ + if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Write data to the attribute */ + if(H5Awrite(aid, tid, &wdata) < 0) + FAIL_STACK_ERROR + + /* Get the attribute's datatype */ + if((atid = H5Aget_type(aid)) < 0) + FAIL_STACK_ERROR + + /* Verify the datatype is not committed */ + if(H5Tcommitted(atid) == TRUE) + FAIL_STACK_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + + /* Create a chunked dataset */ + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) + FAIL_STACK_ERROR + + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunks) < 0) + FAIL_STACK_ERROR + + /* Initialize data buffers */ + for(i = 0; i < 60; i++) { + wbuf[i] = i; + rbuf[i] = 0; + } /* Create a dataset with the committed datatype in the group */ if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Write to the dataset */ - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - FAIL_STACK_ERROR - - /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR - - /* Verify the datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR - - /* Close the dataset creation property list */ - if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR - - /* Close the dataspaces */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - if(H5Sclose(sid2) < 0) - FAIL_STACK_ERROR - - /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR - - /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - - - /* Open the mainfile */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR - - /* Open the committed datatype in the mainfile */ - if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Verify the datatype is committed */ - if(H5Tcommitted(tid) == FALSE) - FAIL_STACK_ERROR - - /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Open the attribute attached to the group */ - if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR - - /* Verify the attribute's datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR - - /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR - - /* Delete the attribute */ - if(H5Adelete(gid1, "myAttribute") < 0) - FAIL_STACK_ERROR - - /* Open the dataset in the group */ - if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR - - /* Verify the dataset's datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR - - /* Read the dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR - - /* Compare the data read should be the same as wbuf */ - if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR - - /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + /* Write to the dataset */ + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR + /* Get the dataset's datatype */ + if((dtid = H5Dget_type(did)) < 0) + FAIL_STACK_ERROR - PASSED(); + /* Verify the datatype is not committed */ + if(H5Tcommitted(dtid) == TRUE) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + /* Close the dataset creation property list */ + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR + + /* Close the dataspaces */ + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + if(H5Sclose(sid2) < 0) + FAIL_STACK_ERROR + + /* Close the datatypes */ + if(H5Tclose(tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) + FAIL_STACK_ERROR + + /* Close the group */ + if(H5Gclose(gid1) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + + + /* Open the mainfile */ + if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the committed datatype in the mainfile */ + if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Verify the datatype is committed */ + if(H5Tcommitted(tid) == FALSE) + FAIL_STACK_ERROR + + /* Open the group which is externally linked to target file */ + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Open the attribute attached to the group */ + if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Get the attribute's datatype */ + if((atid = H5Aget_type(aid)) < 0) + FAIL_STACK_ERROR + + /* Verify the attribute's datatype is not committed */ + if(H5Tcommitted(atid) == TRUE) + FAIL_STACK_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + + /* Delete the attribute */ + if(H5Adelete(gid1, "myAttribute") < 0) + FAIL_STACK_ERROR + + /* Open the dataset in the group */ + if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Get the dataset's datatype */ + if((dtid = H5Dget_type(did)) < 0) + FAIL_STACK_ERROR + + /* Verify the dataset's datatype is not committed */ + if(H5Tcommitted(dtid) == TRUE) + FAIL_STACK_ERROR + + /* Read the dataset */ + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + FAIL_STACK_ERROR + + /* Compare the data read should be the same as wbuf */ + if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + /* Close the group */ + if(H5Gclose(gid1) < 0) + FAIL_STACK_ERROR + + /* Close the datatypes */ + if(H5Tclose(tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Fclose(fid2); H5Fclose(fid1); @@ -7670,13 +7685,13 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY return -1; } /* end external_link_with_committed_datatype() */ - + /*------------------------------------------------------------------------- * Function: ud_hard_links * @@ -7695,7 +7710,7 @@ error: /* UD_hard_create increments the object's reference count */ static herr_t UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, - size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) + size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { haddr_t addr; hid_t target_obj = -1; @@ -7721,40 +7736,40 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi goto done; } /* end if */ -done: + done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: - if(H5Gclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATASET: - if(H5Dclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATATYPE: - if(H5Tclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - return -1; + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + return -1; } /* end switch */ } /* end if */ @@ -7764,8 +7779,8 @@ done: /* Traverse a hard link by opening the object */ static hid_t UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { haddr_t addr; hid_t ret_value = -1; @@ -7783,7 +7798,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* UD_hard_delete decrements the object's reference count */ static herr_t UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, - size_t udata_size) + size_t udata_size) { haddr_t addr; hid_t target_obj = -1; @@ -7809,40 +7824,40 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud goto done; } /* end if */ -done: + done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: - if(H5Gclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATASET: - if(H5Dclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATATYPE: - if(H5Tclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - return -1; + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + return -1; } /* end switch */ } /* end if */ @@ -7850,26 +7865,26 @@ done: } /* end UD_hard_delete() */ const H5L_class_t UD_hard_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_hard_link", /* Link class name for debugging */ - UD_hard_create, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_hard_traverse, /* The actual traversal function */ - UD_hard_delete, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link", /* Link class name for debugging */ + UD_hard_create, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse, /* The actual traversal function */ + UD_hard_delete, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7878,110 +7893,110 @@ ud_hard_links(hid_t fapl) if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Get the size of the empty file for reference */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that external links are registered and UD hard links are not */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that external links are registered and UD hard links are not */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Register "user-defined hard links" with the library */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Check that UD hard links are now registered */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are now registered */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Create a group for the UD hard link to point to */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create a group for the UD hard link to point to */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get address for the group to give to the hard link */ - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + /* Get address for the group to give to the hard link */ + if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined "hard link" to the group using the address we got - * from H5Lget_info */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a user-defined "hard link" to the group using the address we got + * from H5Lget_info */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close and re-open file to ensure that data is written to disk */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group through UD link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group through UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group")) TEST_ERROR - /* Create object in group */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups*/ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* UD hard links have no query function, thus return a "link length" of 0 */ - if(li.u.val_size != 0) TEST_ERROR - if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; - } /* end if */ + /* Check that H5Lget_objinfo works on the hard link */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* UD hard links have no query function, thus return a "link length" of 0 */ + if(li.u.val_size != 0) TEST_ERROR + if(UD_HARD_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be - * deleted because of the UD link. */ + * deleted because of the UD link. */ if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Ensure we can open the group through the UD link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Ensure we can open the group through the UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Unlink the group contained within it. */ - if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Unlink the group contained within it. */ + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Now delete the UD link. This should cause the group to be - * deleted, too. */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Now delete the UD link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* The file should be empty again. */ - if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_hard_links() */ - + /*------------------------------------------------------------------------- * Function: UD_rereg_traverse * @@ -7996,46 +8011,46 @@ ud_hard_links(hid_t fapl) * *------------------------------------------------------------------------- */ - /* A traversal function that ignores any udata and simply opens an object +/* A traversal function that ignores any udata and simply opens an object * in the current group named REREG_TARGET_NAME */ static hid_t UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { hid_t ret_value; if((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0) TEST_ERROR - return ret_value; + return ret_value; -error: + error: return -1; } /* end UD_rereg_traverse() */ /* This link class has the same ID number as the UD hard links but * has a very different traversal function */ const H5L_class_t UD_rereg_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_reregistered_type", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_rereg_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_reregistered_type", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_rereg_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") @@ -8045,129 +8060,129 @@ ud_link_reregister(hid_t fapl) if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Get the size of the empty file for reference */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that UD hard links are not registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that UD hard links are not registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Register "user-defined hard links" with the library */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Check that UD hard links are registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Point a UD defined hard link to a group in the same way as the previous test */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Point a UD defined hard link to a group in the same way as the previous test */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR - /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ - if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ + if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Now unregister UD hard links */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + /* Now unregister UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR - /* Check that UD hard links are no longer registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that UD hard links are no longer registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Verify that we can't traverse the ud link anymore */ - H5E_BEGIN_TRY { - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR - } H5E_END_TRY + /* Verify that we can't traverse the ud link anymore */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + } H5E_END_TRY - /* Verify that we can't create any new links of this type */ - H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - } H5E_END_TRY + /* Verify that we can't create any new links of this type */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY - /* Register a new kind of link with the same ID number */ - if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + /* Register a new kind of link with the same ID number */ + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR - /* Check that UD hard links are registered again */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are registered again */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Open a group through the ud link (now a different class of link). - * It should be a different group - * than the UD hard link pointed to */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group through the ud link (now a different class of link). + * It should be a different group + * than the UD hard link pointed to */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR - /* Create object in group */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups*/ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Unlink the group pointed to by the UD hard link. It shouldn't be - * deleted because the UD link incremented its reference count. */ - if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink the group pointed to by the UD hard link. It shouldn't be + * deleted because the UD link incremented its reference count. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* What a mess! Re-register user-defined links to clean up the - * reference counts. We shouldn't actually need to unregister the - * other link type */ - if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR + /* What a mess! Re-register user-defined links to clean up the + * reference counts. We shouldn't actually need to unregister the + * other link type */ + if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR - /* Ensure we can open the group through the UD link (now that UD hard - * links have been registered) */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Ensure we can open the group through the UD link (now that UD hard + * links have been registered) */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Delete the UD hard link. This should cause the group to be - * deleted, too. */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Delete the UD hard link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Unlink the other two groups so that we can make sure the file is empty */ - if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink the other two groups so that we can make sure the file is empty */ + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* The file should be empty again. */ - if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end ud_link_reregister() */ - + /*------------------------------------------------------------------------- * Function: ud_callbacks * @@ -8186,245 +8201,245 @@ ud_link_reregister(hid_t fapl) /* Creation callback. Called during move as well. */ static herr_t UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, - size_t udata_size, hid_t lcpl_id) + size_t udata_size, hid_t lcpl_id) { if(!link_name) TEST_ERROR - if(loc_group < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR - if(lcpl_id < 0) TEST_ERROR + if(loc_group < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR + if(lcpl_id < 0) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; -error: + error: return -1; } /* end UD_cb_create() */ static hid_t UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, - size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) + size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { const char *target = (const char *)udata; hid_t ret_value; if(!link_name) TEST_ERROR - if(cur_group < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(cur_group < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) + TEST_ERROR - return ret_value; + return ret_value; -error: + error: return -1; } /* end UD_cb_traverse() */ /* Callback for when the link is moved or renamed */ static herr_t UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, - size_t udata_size) + size_t udata_size) { if(!new_name) TEST_ERROR - if(new_loc < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(new_loc < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; -error: + error: return -1; } /* end UD_cb_move() */ /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cb_delete(const char *link_name, hid_t file, const void *udata, - size_t udata_size) + size_t udata_size) { if(!link_name) TEST_ERROR - if(file < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(file < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; -error: + error: return -1; } /* end UD_cb_delete() */ /* Callback for when the link is queried */ static ssize_t UD_cb_query(const char * link_name, const void *udata, size_t udata_size, - void *buf, size_t buf_size) + void *buf, size_t buf_size) { if(!link_name) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - if(buf) { - if(buf_size < 16) TEST_ERROR - HDstrcpy((char *)buf, "query succeeded"); - } /* end if */ + if(buf) { + if(buf_size < 16) TEST_ERROR + HDstrcpy((char *)buf, "query succeeded"); + } /* end if */ /* There are 15 characters and a NULL in "query succeeded" */ return 16; -error: + error: return -1; } /* end UD_cb_query() */ const H5L_class_t UD_cb_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CB_TYPE, /* Link type id number */ - NULL, /* NULL name (to make sure this doesn't break anything */ - UD_cb_create, /* Creation callback */ - UD_cb_move, /* Move/rename callback */ - UD_cb_move, /* Copy callback */ - UD_cb_traverse, /* The actual traversal function */ - UD_cb_delete, /* Deletion callback */ - UD_cb_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CB_TYPE, /* Link type id number */ + NULL, /* NULL name (to make sure this doesn't break anything */ + UD_cb_create, /* Creation callback */ + UD_cb_move, /* Move/rename callback */ + UD_cb_move, /* Copy callback */ + UD_cb_traverse, /* The actual traversal function */ + UD_cb_delete, /* Deletion callback */ + UD_cb_query /* Query callback */ }}; static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t lcpl = (-1); /* Link Creation PL */ H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) TESTING("user-defined link callbacks (w/new group format)") - else - TESTING("user-defined link callbacks") + else + TESTING("user-defined link callbacks") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that registered link classes are, and unregistered ones aren't */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR - - /* Hit two birds with one stone: register UD hard links from previous - * test to check that having two UD links registered at once presents - * no problems. */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - - /* Register user-defined link class. This is the one we'll actually - * be using. */ - if(H5Lregister(UD_cb_class) < 0) TEST_ERROR - - /* Check that registered link classes are, and unregistered ones aren't */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR - - /* Create a group for the UD link to point to */ - if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create a user-defined link to the group. These UD links behave like soft links. */ - if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Try opening group through UD link */ - if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Query the link to test its query callback */ - if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != 16) TEST_ERROR - if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; - } + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR + + /* Hit two birds with one stone: register UD hard links from previous + * test to check that having two UD links registered at once presents + * no problems. */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + + /* Register user-defined link class. This is the one we'll actually + * be using. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD link to point to */ + if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create a user-defined link to the group. These UD links behave like soft links. */ + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try opening group through UD link */ + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Query the link to test its query callback */ + if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != 16) TEST_ERROR + if (UD_CB_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* Fill the query buffer */ if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR + if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR - /* Move the link */ - if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move the link */ + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Re-open group to ensure that move worked */ - if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Re-open group to ensure that move worked */ + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Remove UD link */ - if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Remove UD link */ + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Test that the callbacks don't work if the link class is not registered */ + /* Test that the callbacks don't work if the link class is not registered */ - /* Create a new link. Just for fun, give it a non-default character - * encoding (to test that LAPLs work) */ - if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR - if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR + /* Create a new link. Just for fun, give it a non-default character + * encoding (to test that LAPLs work) */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR - /* Check its character encoding */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.cset != H5T_CSET_UTF8) TEST_ERROR + /* Check its character encoding */ + if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.cset != H5T_CSET_UTF8) TEST_ERROR - /* Unregister the link class so the library forgets what its callbacks do */ - if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR + /* Unregister the link class so the library forgets what its callbacks do */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR - /* Now test that each of the callbacks fails */ - H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - } H5E_END_TRY + /* Now test that each of the callbacks fails */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + } H5E_END_TRY - /* The query callback should NOT fail, but should be unable to give a linklen */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 0) TEST_ERROR - if(li.type != UD_CB_TYPE) TEST_ERROR + /* The query callback should NOT fail, but should be unable to give a linklen */ + if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + if(li.type != UD_CB_TYPE) TEST_ERROR - /* Unregister the UD hard links */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + /* Unregister the UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Pclose (lcpl); - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -8441,130 +8456,130 @@ error: */ static hid_t UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, - const void H5_ATTR_UNUSED *udata, size_t udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void H5_ATTR_UNUSED *udata, size_t udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { char target[NAME_BUF_SIZE]; hid_t ret_value; if(udata_size != 0) TEST_ERROR - /* Get the name of the target from the property list. */ - if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR + /* Get the name of the target from the property list. */ + if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) + TEST_ERROR - return ret_value; + return ret_value; -error: + error: return -1; } /* end UD_plist_traverse() */ const H5L_class_t UD_plist_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ - "UD_plist_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_plist_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ + "UD_plist_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_plist_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") - else - TESTING("user data passed through lapl") + else + TESTING("user data passed through lapl") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Register UD link types from previous tests to check that having - * multiple types registered at once presents no problems. */ - if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + /* Register UD link types from previous tests to check that having + * multiple types registered at once presents no problems. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR - /* Register the link class. We'll actually be using for this test. */ - if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + /* Register the link class. We'll actually be using for this test. */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR - /* Another link class from a previous test */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Another link class from a previous test */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Unregister the first link type registered to make sure this doesn't - * break anything. */ - if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) TEST_ERROR + /* Unregister the first link type registered to make sure this doesn't + * break anything. */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) TEST_ERROR - /* Create two groups for the UD link to point to */ - if((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create two groups for the UD link to point to */ + if((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined link to the group. These UD links have no udata. */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a user-defined link to the group. These UD links have no udata. */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a non-default lapl with a new property pointing to group a*/ - if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - HDstrcpy(group_a_name, "group_a"); + /* Create a non-default lapl with a new property pointing to group a*/ + if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + HDstrcpy(group_a_name, "group_a"); if(H5Pinsert2(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR - /* Try opening group through UD link */ - if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Try opening group through UD link */ + if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Verify that we can open the new group without using the ud link */ + if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Now use the same ud link to access group_b */ - strcpy(group_b_name, "group_b"); + /* Now use the same ud link to access group_b */ + strcpy(group_b_name, "group_b"); if(H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR - /* Create a subgroup */ - if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a subgroup */ + if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Verify that we can open the new group without using the ud link */ + if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close property list */ - if(H5Pclose(plist_id) < 0) TEST_ERROR + /* Close property list */ + if(H5Pclose(plist_id) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose (plist_id); - H5Gclose (gid); - H5Gclose (gid2); - H5Fclose (fid); + H5Pclose (plist_id); + H5Gclose (gid); + H5Gclose (gid2); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end lapl_udata() */ - + /*------------------------------------------------------------------------- * Function: ud_link_errors * @@ -8581,19 +8596,19 @@ lapl_udata(hid_t fapl, hbool_t new_format) */ static herr_t UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc_group, - const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { /* Check to make sure that this "soft link" has a target */ if(udata_size < 1 || !udata) - return -1; + return -1; return 0; } /* end UD_cbsucc_create() */ static hid_t UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, - const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { const char *target = (const char *)udata; hid_t ret_value; @@ -8604,14 +8619,14 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, return ret_value; -error: + error: return -1; } /* end UD_cbsucc_traverse() */ /* Failure callback for when the link is moved or renamed */ static herr_t UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ return -1; @@ -8620,7 +8635,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc /* SuccessCallback for when the link is moved or renamed */ static herr_t UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always succeed. */ return 0; @@ -8629,7 +8644,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This callback will always succeed */ return 0; @@ -8638,7 +8653,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ /* Note: un-deletable links are in general a very bad idea! */ @@ -8648,7 +8663,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file /* Callback for when the link is queried */ static ssize_t UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) + size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will always fail. */ return -1; @@ -8657,12 +8672,12 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED /* Callback for when the link is queried */ static ssize_t UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size) + size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will return a buffer size, - * but will fail when a buffer is passed in ("writing to the buffer" - * fails - */ + * but will fail when a buffer is passed in ("writing to the buffer" + * fails + */ if(buf != NULL) return -1; @@ -8673,12 +8688,12 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT /* Callback for when the link is queried */ static ssize_t UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size) + size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size) { /* This traversal function will return a buffer size, - * but will fail when a buffer is passed in ("writing to the buffer" - * fails - */ + * but will fail when a buffer is passed in ("writing to the buffer" + * fails + */ if(buf != NULL && buf_size >= 8) HDstrcpy((char *)buf, "succeed"); @@ -8688,120 +8703,120 @@ UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED /* This class is full of failing callbacks */ const H5L_class_t UD_cbfail_class1[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link1", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbfail_move, /* Move/rename callback */ - UD_cbfail_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbfail_delete, /* Deletion callback */ - UD_cbfail_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link1", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbfail_move, /* Move/rename callback */ + UD_cbfail_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbfail_delete, /* Deletion callback */ + UD_cbfail_query /* Query callback */ }}; /* This class is has two failing callbacks, move and query */ const H5L_class_t UD_cbfail_class2[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link2", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbfail_move, /* Move/rename callback */ - UD_cbsucc_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbsucc_delete, /* Deletion callback */ - UD_cbfail_on_write_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link2", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbfail_move, /* Move/rename callback */ + UD_cbsucc_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbsucc_delete, /* Deletion callback */ + UD_cbfail_on_write_query /* Query callback */ }}; /* All of these callbacks will succeed */ const H5L_class_t UD_cbfail_class3[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link3", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbsucc_move, /* Move/rename callback */ - UD_cbsucc_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbsucc_delete, /* Deletion callback */ - UD_cbsucc_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link3", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbsucc_move, /* Move/rename callback */ + UD_cbsucc_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbsucc_delete, /* Deletion callback */ + UD_cbsucc_query /* Query callback */ }}; /* Link classes that are invalid for various reasons */ const H5L_class_t UD_error1_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - NULL, /* This class has no traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + NULL, /* This class has no traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error2_class[1] = {{ - UD_BAD_VERS, /* Invalid H5L_class_t version */ - (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + UD_BAD_VERS, /* Invalid H5L_class_t version */ + (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error3_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_BAD_TYPE1, /* Invalid Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_BAD_TYPE1, /* Invalid Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error4_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_BAD_TYPE2, /* Invalid Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_BAD_TYPE2, /* Invalid Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; H5L_info_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") - else - TESTING("user-defined link error conditions") + else + TESTING("user-defined link error conditions") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Try to register some invalid link classes */ - H5E_BEGIN_TRY { - if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR + /* Try to register some invalid link classes */ + H5E_BEGIN_TRY { + if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR } H5E_END_TRY /* Register the UD plist class. */ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR /* Now register the first class we'll be using. - * It has the same ID as the plist class, and should replace it. */ + * It has the same ID as the plist class, and should replace it. */ if(H5Lregister(UD_cbfail_class1) < 0) FAIL_STACK_ERROR /* Create a group for the UD link to point to */ @@ -8812,86 +8827,86 @@ ud_link_errors(hid_t fapl, hbool_t new_format) H5E_BEGIN_TRY { if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR } H5E_END_TRY /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Open the group through the ud link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - - /* Now test that each of the callbacks will cause a failure if it returns -1 */ - H5E_BEGIN_TRY { - /* The create callback will fail if we pass in no udata */ - if(H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + /* Open the group through the ud link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* The move and copy callbacks will fail */ - if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + /* Now test that each of the callbacks will cause a failure if it returns -1 */ + H5E_BEGIN_TRY { + /* The create callback will fail if we pass in no udata */ + if(H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - /* The traversal callback will fail if we remove its target */ - if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR - if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + /* The move and copy callbacks will fail */ + if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - /* The deletion callback will always fail */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR + /* The traversal callback will fail if we remove its target */ + if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR - /* The query callback will fail */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY + /* The deletion callback will always fail */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR - /* Now use a class with different callback functions */ - if(H5Lregister(UD_cbfail_class2) < 0) FAIL_STACK_ERROR + /* The query callback will fail */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY - /* Moving should still fail, but copying will succeed */ - H5E_BEGIN_TRY { - if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - } H5E_END_TRY - if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Now use a class with different callback functions */ + if(H5Lregister(UD_cbfail_class2) < 0) FAIL_STACK_ERROR - /* The query callback will succeed when we only want to get the size of the buffer... */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 0) TEST_ERROR - /* ...but fail when we try to write data to the buffer itself*/ - H5E_BEGIN_TRY { - if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY + /* Moving should still fail, but copying will succeed */ + H5E_BEGIN_TRY { + if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + } H5E_END_TRY + if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* The query callback will succeed when we only want to get the size of the buffer... */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + /* ...but fail when we try to write data to the buffer itself*/ + H5E_BEGIN_TRY { + if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY - /* Register a new class */ - if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR + /* Register a new class */ + if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR - /* Now querying should succeed */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 8) TEST_ERROR - if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR + /* Now querying should succeed */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 8) TEST_ERROR + if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR - /* Moving and copying should both succeed */ - if(H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Moving and copying should both succeed */ + if(H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Delete link (this callback should work now) */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Delete link (this callback should work now) */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end ud_link_errors() */ - + /*------------------------------------------------------------------------- * Function: lapl_nlinks * @@ -8912,223 +8927,223 @@ error: static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t plist = (-1); /* lapl ID */ hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") - else - TESTING("adjusting nlinks with LAPL") + else + TESTING("adjusting nlinks with LAPL") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for links) */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create chain of soft links to existing object (limited) */ - if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Create LAPL with higher-than-usual nlinks value */ - /* Create a non-default lapl with udata set to point to the first group */ - if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - nlinks = 20; + /* Create group with short name in file (used as target for links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create LAPL with higher-than-usual nlinks value */ + /* Create a non-default lapl with udata set to point to the first group */ + if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + nlinks = 20; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - /* Ensure that nlinks was set successfully */ - nlinks = 0; + /* Ensure that nlinks was set successfully */ + nlinks = 0; if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR - if(nlinks != 20) TEST_ERROR + if(nlinks != 20) TEST_ERROR - /* Open object through what is normally too many soft links using - * new property list */ - if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR + /* Open object through what is normally too many soft links using + * new property list */ + if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft17")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft17")) TEST_ERROR - /* Create group using soft link */ - if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group using soft link */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Set nlinks to a smaller number */ - nlinks = 4; + /* Set nlinks to a smaller number */ + nlinks = 4; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - /* Ensure that nlinks was set successfully */ - nlinks = 0; + /* Ensure that nlinks was set successfully */ + nlinks = 0; if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR - if(nlinks != 4) TEST_ERROR - - /* Try opening through what is now too many soft links */ - H5E_BEGIN_TRY { - gid = H5Oopen(fid, "soft5", plist); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; - } - - /* Open object through lesser soft link */ - if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR - - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft4")) TEST_ERROR + if(nlinks != 4) TEST_ERROR + /* Try opening through what is now too many soft links */ + H5E_BEGIN_TRY { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; + } - /* Test other functions that should use a LAPL */ - nlinks = 20; - if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - - /* Try copying and moving when both src and dst contain many soft links - * using a non-default LAPL - */ - if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Olink */ - if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Lcreate_hard and H5Lcreate_soft */ - if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Ldelete */ - if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR - - /* H5Lget_val and H5Lget_info */ - if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR - if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR - - /* H5Lcreate_external and H5Lcreate_ud */ - if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* Close plist */ - if(H5Pclose(plist) < 0) TEST_ERROR - - - /* Create a datatype and dataset as targets inside the group */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - - dims[0] = 2; - dims[1] = 2; - if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Try to open the objects using too many symlinks with default *APLs */ - H5E_BEGIN_TRY { - if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - } H5E_END_TRY - - /* Create property lists with nlinks set */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR - - nlinks = 20; - if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR - if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR - if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR - - /* We should now be able to use these property lists to open each kind - * of object. - */ - if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR - if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Close plists */ - if(H5Pclose(gapl) < 0) TEST_ERROR - if(H5Pclose(tapl) < 0) TEST_ERROR - if(H5Pclose(dapl) < 0) TEST_ERROR - - /* Unregister UD hard link class */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Pclose(gapl); - H5Pclose(dapl); - H5Pclose(tapl); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(plist); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + /* Open object through lesser soft link */ + if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft4")) TEST_ERROR + + + /* Test other functions that should use a LAPL */ + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Try copying and moving when both src and dst contain many soft links + * using a non-default LAPL + */ + if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Olink */ + if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Lcreate_hard and H5Lcreate_soft */ + if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Ldelete */ + if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR + + /* H5Lget_val and H5Lget_info */ + if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR + if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR + + /* H5Lcreate_external and H5Lcreate_ud */ + if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* Close plist */ + if(H5Pclose(plist) < 0) TEST_ERROR + + + /* Create a datatype and dataset as targets inside the group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try to open the objects using too many symlinks with default *APLs */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + } H5E_END_TRY + + /* Create property lists with nlinks set */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + + nlinks = 20; + if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR + + /* We should now be able to use these property lists to open each kind + * of object. + */ + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR + if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close plists */ + if(H5Pclose(gapl) < 0) TEST_ERROR + if(H5Pclose(tapl) < 0) TEST_ERROR + if(H5Pclose(dapl) < 0) TEST_ERROR + + /* Unregister UD hard link class */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end lapl_nlinks() */ - + /*------------------------------------------------------------------------- * Function: linkinfo * @@ -9145,77 +9160,77 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t tid = (-1); /* Type ID */ hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") - else - TESTING("link type field in H5Lget_info") + else + TESTING("link type field in H5Lget_info") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Register a couple of user-defined link classes with the library */ - if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + /* Register a couple of user-defined link classes with the library */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR - /* Create an object of each type */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create an object of each type */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close all objects */ - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Make sure that link type is correct when objects are queried */ - if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR - - if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR - if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_SOFT) TEST_ERROR - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != UD_PLIST_TYPE) TEST_ERROR - - /* Ensure that passing a NULL pointer doesn't cause an error */ - if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + /* Close all objects */ + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Make sure that link type is correct when objects are queried */ + if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR - PASSED(); + if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR + if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != UD_PLIST_TYPE) TEST_ERROR + + /* Ensure that passing a NULL pointer doesn't cause an error */ + if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Tclose (tid); - H5Dclose (did); - H5Gclose (gid); - H5Fclose (fid); + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end linkinfo() */ - + /*------------------------------------------------------------------------- * Function: check_all_closed * @@ -9243,26 +9258,26 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) if(new_format) TESTING("that all files were closed correctly (w/new group format)") - else - TESTING("that all files were closed correctly") - - /* Some of the external or UD link tests may have failed to close - * an external file properly. - * To check this, try to create every file used in this test. If - * a file is already open, creating it will fail. - */ - for(x=0; FILENAME[x] != NULL && x < stopat; x++) - { - h5_fixname(FILENAME[x], fapl, filename, sizeof filename); - - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - } + else + TESTING("that all files were closed correctly") + + /* Some of the external or UD link tests may have failed to close + * an external file properly. + * To check this, try to create every file used in this test. If + * a file is already open, creating it will fail. + */ + for(x=0; FILENAME[x] != NULL && x < stopat; x++) + { + h5_fixname(FILENAME[x], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + } PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; @@ -9270,7 +9285,7 @@ error: } /* end check_all_closed() */ - + /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9300,77 +9315,77 @@ build_visit_file(hid_t fapl) /* Create file for visiting */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group */ - if((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group */ + if((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create nested group */ - if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create nested group */ + if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create soft links to groups created */ - if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft links to groups created */ + if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dangling soft link */ - if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling soft link */ + if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create hard links to all groups */ - if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create hard links to all groups */ + if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create loops w/hard links */ - if(H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create loops w/hard links */ + if(H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create external link to existing file */ - if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to existing file */ + if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dangling external link to non-existent file */ - if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling external link to non-existent file */ + if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dataset in each group */ - if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + /* Create dataset in each group */ + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Sclose(sid) < 0) TEST_ERROR - /* Create named datatype in each group */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + /* Create named datatype in each group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - return(fid); + return(fid); -error: + error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; return -1; } /* end build_visit_file() */ - + /*------------------------------------------------------------------------- * Function: visit_link_cb * @@ -9386,7 +9401,7 @@ error: */ static int visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, - void *_op_data) + void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -9400,7 +9415,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t return(H5_ITER_CONT); } /* end visit_link_cb() */ - + /*------------------------------------------------------------------------- * Function: link_visit * @@ -9423,46 +9438,46 @@ link_visit(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link visiting (w/new group format)") - else - TESTING("link visiting") + else + TESTING("link visiting") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the links reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the links reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from each internal group */ + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9470,7 +9485,7 @@ error: return -1; } /* end link_visit() */ - + /*------------------------------------------------------------------------- * Function: link_visit_by_name * @@ -9493,54 +9508,54 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link visiting by name (w/new group format)") - else - TESTING("link visiting by name") + else + TESTING("link visiting by name") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the links reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the links reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ - udata.idx = 0; + /* Visit all the links reachable from each internal group */ + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9548,7 +9563,7 @@ error: return -1; } /* end link_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_cb * @@ -9564,7 +9579,7 @@ error: */ static int visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, - void *_op_data) + void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9578,7 +9593,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit * @@ -9601,46 +9616,46 @@ obj_visit(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object visiting (w/new group format)") - else - TESTING("object visiting") + else + TESTING("object visiting") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the objects reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the objects reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from each internal group */ + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9648,7 +9663,7 @@ error: return -1; } /* end obj_visit() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_by_name * @@ -9671,55 +9686,55 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object visiting by name (w/new group format)") - else - TESTING("object visiting by name") + else + TESTING("object visiting by name") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the objects reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the objects reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ - udata.idx = 0; + /* Visit all the objects reachable from each internal group */ + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9727,7 +9742,7 @@ error: return -1; } /* end obj_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_stop_cb * @@ -9742,7 +9757,7 @@ error: */ static int visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, - void *_op_data) + void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9752,7 +9767,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name return(H5_ITER_STOP); } /* end visit_obj_stop_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_stop * @@ -9776,42 +9791,42 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) if(new_format) TESTING("stopping object iteration (w/new group format)") - else - TESTING("stopping object iteration") + else + TESTING("stopping object iteration") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Start iteration. The callback should only be called once because it - * returns H5_ITER_STOP - */ - nvisited = 0; + /* Start iteration. The callback should only be called once because it + * returns H5_ITER_STOP + */ + nvisited = 0; if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR - if(ret != H5_ITER_STOP) TEST_ERROR - if(nvisited != 1) TEST_ERROR + if(ret != H5_ITER_STOP) TEST_ERROR + if(nvisited != 1) TEST_ERROR - /* Same test with H5Ovisit_by_name */ - nvisited = 0; + /* Same test with H5Ovisit_by_name */ + nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(ret != H5_ITER_STOP) TEST_ERROR - if(nvisited != 1) TEST_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(ret != H5_ITER_STOP) TEST_ERROR + if(nvisited != 1) TEST_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; return -1; } /* end obj_visit_stop() */ - + /*------------------------------------------------------------------------- * Function: link_filters * @@ -9867,8 +9882,8 @@ static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id } /* end link_filter_set_local */ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, - const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, - void H5_ATTR_UNUSED **buf) + const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, + void H5_ATTR_UNUSED **buf) { if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0; @@ -9903,20 +9918,20 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; /* This test actually always uses the new group format for the main group. - * The new format flag affects the version of object header messages, - * etc., which are important for this test. */ + * The new format flag affects the version of object header messages, + * etc., which are important for this test. */ if(new_format) TESTING("group link filters (w/new group format)") - else - TESTING("group link filters") + else + TESTING("group link filters") - /* Initialize link filter state global */ - link_filter_state = LFS_INIT; + /* Initialize link filter state global */ + link_filter_state = LFS_INIT; /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -9924,21 +9939,21 @@ link_filters(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create gcpl, force use of dense storage */ - if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR - - /* Add deflate and checksum filters, if available */ - if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR - if(tri_ret) { - if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR - nfilters++; - } /* end if */ + /* Create gcpl, force use of dense storage */ + if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR + + /* Add deflate and checksum filters, if available */ + if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR + if(tri_ret) { + if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR + nfilters++; + } /* end if */ if((tri_ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32)) < 0) TEST_ERROR - if(tri_ret) { - if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR - nfilters++; - } /* end if */ + if(tri_ret) { + if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR + nfilters++; + } /* end if */ /* Register and add custom filter */ filter_class.version = H5Z_CLASS_T_VERS; @@ -9950,248 +9965,248 @@ link_filters(hid_t fapl, hbool_t new_format) filter_class.set_local = link_filter_set_local; filter_class.filter = link_filter_filter; if(H5Zregister(&filter_class) < 0) TEST_ERROR - if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR - nfilters++; + if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) + TEST_ERROR + nfilters++; /* Test various other filter functions for use on gcpl's */ if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR + if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR - /* Create a group using this filter, add some soft links to it */ - if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file and group */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Verify the filter has been applied */ - if(link_filter_state != LFS_ENCODED) TEST_ERROR - - /* Reopen file and group */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - - /* Retrieve gcpl, verify number of filters */ - if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Now try copying gcpl1, and verify number of filters */ - if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Add another soft link */ - if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Copy the group */ - if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR - - /* Verify that all links have been copied */ - if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR - - /* Retrieve gcpl, verify number of filters */ - if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - - /* Delete 3 links to force the group back into compact mode */ - if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR - - /* Close file and groups */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Reset link filter state */ - link_filter_state = LFS_INIT; + /* Create a group using this filter, add some soft links to it */ + if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close file and group */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Verify the filter has been applied */ + if(link_filter_state != LFS_ENCODED) TEST_ERROR + + /* Reopen file and group */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve gcpl, verify number of filters */ + if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Now try copying gcpl1, and verify number of filters */ + if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Add another soft link */ + if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Copy the group */ + if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR + + /* Verify that all links have been copied */ + if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR + + /* Retrieve gcpl, verify number of filters */ + if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + + /* Delete 3 links to force the group back into compact mode */ + if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR + + /* Close file and groups */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Reset link filter state */ + link_filter_state = LFS_INIT; /* Reopen file and group, add 2 links */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file and group */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Verify that the filter was reapplied */ - if(link_filter_state != LFS_ENCODED) TEST_ERROR + /* Close file and group */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ - if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR - if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, - &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + /* Verify that the filter was reapplied */ + if(link_filter_state != LFS_ENCODED) TEST_ERROR - /* Test H5Pmodify_filter */ - cd_value++; + /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ + if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR + if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, + &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR + + /* Test H5Pmodify_filter */ + cd_value++; if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR - if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR - - /* Test H5Premove_filter */ - if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR - H5E_BEGIN_TRY { - status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, - &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, - &filter_config_out); - } H5E_END_TRY - if(status >= 0) TEST_ERROR - - /* Close remaining ids */ - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Now create an object in the compressed group, creating intermediate - * groups, to verify that the filter pipeline is inherited for the groups - * that are created along the way */ - /* Reopen file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Create lcpl, setting the "create intermediate groups" flag */ - if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR - - /* Create new group, with missing intermediate groups, in compressed group */ - if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Close LCPL ID */ - if(H5Pclose(lcpl) < 0) TEST_ERROR - - /* Verify that new group doesn't have filters */ - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR - - /* Close group & GCPL IDs */ - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - - /* Open intermediate groups that were created and verify that they have filters */ - if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - - /* Now create the same file with and without deflate, and verify that the - * file size is smaller with deflate */ - /* But only if the deflate filter is available */ - if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR - if(tri_ret) { - h5_stat_size_t filesize_filtered; - h5_stat_size_t filesize_unfiltered; - - /* Create gcpl, force use of dense storage */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR - - /* Create file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR - - /* Create links in file */ - if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file, get file size */ - if(H5Fclose(fid) < 0) TEST_ERROR - filesize_unfiltered = h5_get_file_size(filename, fapl); - - /* Set deflate fitler */ - if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR - - /* Recreate the same file with the deflate filter */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file, get file size */ - if(H5Fclose(fid) < 0) TEST_ERROR - filesize_filtered = h5_get_file_size(filename, fapl); - - /* Check that the file size is smaller with the filter */ - if((double)filesize_filtered - > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR - /* Close */ - if(H5Pclose(fcpl) < 0) TEST_ERROR - } /* end if */ + /* Test H5Premove_filter */ + if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR + H5E_BEGIN_TRY { + status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, + &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, + &filter_config_out); + } H5E_END_TRY + if(status >= 0) TEST_ERROR + + /* Close remaining ids */ + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Now create an object in the compressed group, creating intermediate + * groups, to verify that the filter pipeline is inherited for the groups + * that are created along the way */ + /* Reopen file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create lcpl, setting the "create intermediate groups" flag */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR + + /* Create new group, with missing intermediate groups, in compressed group */ + if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Close LCPL ID */ + if(H5Pclose(lcpl) < 0) TEST_ERROR + + /* Verify that new group doesn't have filters */ + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR + + /* Close group & GCPL IDs */ + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + + /* Open intermediate groups that were created and verify that they have filters */ + if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + + /* Now create the same file with and without deflate, and verify that the + * file size is smaller with deflate */ + /* But only if the deflate filter is available */ + if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR + if(tri_ret) { + h5_stat_size_t filesize_filtered; + h5_stat_size_t filesize_unfiltered; + + /* Create gcpl, force use of dense storage */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR + + /* Create file */ + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + TEST_ERROR + + /* Create links in file */ + if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close file, get file size */ + if(H5Fclose(fid) < 0) TEST_ERROR + filesize_unfiltered = h5_get_file_size(filename, fapl); + + /* Set deflate fitler */ + if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR + + /* Recreate the same file with the deflate filter */ + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close file, get file size */ + if(H5Fclose(fid) < 0) TEST_ERROR + filesize_filtered = h5_get_file_size(filename, fapl); + + /* Check that the file size is smaller with the filter */ + if((double)filesize_filtered + > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + TEST_ERROR + + /* Close */ + if(H5Pclose(fcpl) < 0) TEST_ERROR + } /* end if */ - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Gclose(gid1); - H5Gclose(gid2); - H5Fclose(fid); - H5Pclose(lcpl); - H5Pclose(gcpl1); - H5Pclose(gcpl2); - H5Pclose(fcpl); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid1); + H5Gclose(gid2); + H5Fclose(fid); + H5Pclose(lcpl); + H5Pclose(gcpl1); + H5Pclose(gcpl2); + H5Pclose(fcpl); + } H5E_END_TRY; + return -1; } /* end link_filters() */ - + /*------------------------------------------------------------------------- * Function: obj_exists * @@ -10215,18 +10230,18 @@ obj_exists(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object exists (w/new group format)") - else - TESTING("object exists") + else + TESTING("object exists") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR -/* Hard links */ - /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ - H5E_BEGIN_TRY { + /* Hard links */ + /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ + H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); } H5E_END_TRY if(status >= 0) TEST_ERROR @@ -10234,252 +10249,252 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Create a group, as a destination for testing */ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() succeeds for hard linked object */ - if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() succeeds for hard linked object */ + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) + TEST_ERROR - /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ - H5E_BEGIN_TRY { - status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); - } H5E_END_TRY - if(status >= 0) TEST_ERROR + /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ + H5E_BEGIN_TRY { + status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); + } H5E_END_TRY + if(status >= 0) TEST_ERROR -/* Soft links */ - /* Create dangling soft-link in root group */ - if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Soft links */ + /* Create dangling soft-link in root group */ + if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ - if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to object */ - if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to object */ + if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling soft-link in non-root group */ - if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create dangling soft-link in non-root group */ + if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to object */ - if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to object */ + if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) + TEST_ERROR -/* External links */ - /* Create dangling (file doesn't exist) external link in root group */ - if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* External links */ + /* Create dangling (file doesn't exist) external link in root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (object doesn't exist) external link in root group */ - if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (object doesn't exist) external link in root group */ + if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to object */ - if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to object */ - if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) + TEST_ERROR -/* Soft->External links */ - /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ - if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Soft->External links */ + /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ - if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to external link that points to object */ - if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to external link that points to object */ + if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to external link in non-root group that points to object */ - if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ - if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ - if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to external link that points to object */ - if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to external link that points to object */ + if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to external link in non-root group that points to object */ - if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) + TEST_ERROR -/* External->Soft links */ - /* Create external link in root group that points to dangling soft link in root group */ - if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* External->Soft links */ + /* Create external link in root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to dangling soft link in non-root group */ - if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to dangling soft link in root group */ - if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to dangling soft link in non-root group */ - if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to soft link in non-root group that points to object */ - if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to soft link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) + TEST_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end obj_exists() */ - + /*------------------------------------------------------------------------- * Function: corder_create_empty * @@ -10496,10 +10511,10 @@ error: static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10509,84 +10524,84 @@ corder_create_empty(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order indexing on group */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR + /* Set creation order indexing on group */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR - /* Setting invalid combination of a group order creation order indexing on should fail */ - H5E_BEGIN_TRY { - ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); - } H5E_END_TRY; - if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR - } /* end if */ + /* Setting invalid combination of a group order creation order indexing on should fail */ + H5E_BEGIN_TRY { + ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); + } H5E_END_TRY; + if(ret > 0) { + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR + } /* end if */ - /* Set creation order tracking & indexing on group */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + /* Check on group's status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check on group's status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + /* Check on group's status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - /* Retrieve group creation property list for group */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + /* Retrieve group creation property list for group */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; -error: - H5E_BEGIN_TRY { - H5Pclose(gcpl_id); - H5Gclose(group_id); - H5Fclose(file_id); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return -1; } /* end corder_create_empty() */ - + /*------------------------------------------------------------------------- * Function: corder_create_compact * @@ -10604,12 +10619,12 @@ error: static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10620,82 +10635,82 @@ corder_create_compact(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's initial status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Create several links, but keep group in compact form */ - for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Create several links, but keep group in compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (u + 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != max_compact) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Loop through links, checking their creation order values */ - /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < max_compact; u++) { - H5L_info_t linfo; /* Link information */ - - /* Retrieve information for link */ - sprintf(objname, "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify creation order of link */ - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != u) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != max_compact) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < max_compact; u++) { + H5L_info_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -10704,7 +10719,7 @@ error: return -1; } /* end corder_create_compact() */ - + /*------------------------------------------------------------------------- * Function: corder_create_dense * @@ -10722,12 +10737,12 @@ error: static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10740,95 +10755,95 @@ corder_create_dense(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's initial status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (u + 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Loop through links, checking their creation order values */ - /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < (max_compact + 1); u++) { - H5L_info_t linfo; /* Link information */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < (max_compact + 1); u++) { + H5L_info_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ - /* Retrieve information for link */ - sprintf(objname, "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Verify creation order of link */ - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != u) TEST_ERROR - } /* end for */ - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -10837,7 +10852,7 @@ error: return -1; } /* end corder_create_dense() */ - + /*------------------------------------------------------------------------- * Function: corder_transition * @@ -10855,12 +10870,12 @@ error: static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ h5_stat_size_t empty_size; /* Size of empty file */ @@ -10875,189 +10890,189 @@ corder_transition(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR - /* Increase estimated link info, so the group's object header is large - * enough to hold all the link messages in one chunk - */ - if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR + /* Increase estimated link info, so the group's object header is large + * enough to hold all the link messages in one chunk + */ + if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Get the size of the file with an empty group */ - if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Get the size of the file with an empty group */ + if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Create another link, to push group into dense form */ - sprintf(objname, "filler %u", max_compact); + HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - - /* Delete several links from group, until it resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Delete several links from group, until it resumes compact form */ + for(u = max_compact; u >= min_dense; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - } /* end for */ + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Re-add links to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Re-add links to get back into dense form */ + for(u = (min_dense - 1); u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Delete several links from group, until it resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { - sprintf(objname, "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Delete several links from group, until it resumes compact form */ + for(u = max_compact; u >= min_dense; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - } /* end for */ + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + } /* end for */ /* Delete another link, to push group into compact form */ - sprintf(objname, "filler %u", (min_dense - 1)); + HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Re-add links to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Re-add links to get back into dense form */ + for(u = (min_dense - 1); u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Delete all the links */ - for(u = max_compact; u > 0; u--) { - sprintf(objname, "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ - sprintf(objname, "filler %u", (unsigned)0); + /* Delete all the links */ + for(u = max_compact; u > 0; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ + HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Get the size of the file now */ - if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - if(file_size != empty_size) TEST_ERROR + /* Get the size of the file now */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + if(file_size != empty_size) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11066,7 +11081,7 @@ error: return -1; } /* end corder_transition() */ - + /*------------------------------------------------------------------------- * Function: corder_delete * @@ -11085,9 +11100,9 @@ error: static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ @@ -11102,91 +11117,91 @@ corder_delete(hid_t fapl) TESTING("deleting group with creation order indexing in dense form") /* Loop to leave file open when deleting group, or to close & re-open file - * before deleting group */ + * before deleting group */ for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) { /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Creating file with latest format will enable paged aggregation with persistent fs */ + /* Creating file with latest format will enable paged aggregation with persistent fs */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Get the size of an empty file */ - if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Get the size of an empty file */ + if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR - /* Increase estimated link info, so the group's object header is large - * enough to hold all the link messages in one chunk - */ - if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR + /* Increase estimated link info, so the group's object header is large + * enough to hold all the link messages in one chunk + */ + if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR - /* Create links until the group is in dense form */ - for(u = 0; u < max_compact * 2; u++) { - sprintf(objname, "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Create links until the group is in dense form */ + for(u = 0; u < max_compact * 2; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - /* Check for deleting group without re-opening file */ - if(!reopen_file) - /* Delete the group with the creation order index */ - if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Check for deleting group without re-opening file */ + if(!reopen_file) + /* Delete the group with the creation order index */ + if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Check for deleting group after re-opening file */ - if(reopen_file) { - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Check for deleting group after re-opening file */ + if(reopen_file) { + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Delete the group with the creation order index */ - if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Delete the group with the creation order index */ + if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - } /* end if */ + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + } /* end if */ /* Get the size of the file now */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - if(file_size != empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR } /* end for */ PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11195,14 +11210,14 @@ error: return -1; } /* end corder_delete() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_check * * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 @@ -11215,7 +11230,7 @@ error: */ static int link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, - hbool_t hard_link, hbool_t use_index) + hbool_t hard_link, hbool_t use_index) { char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char valname[NAME_BUF_SIZE]; /* Link value name */ @@ -11223,138 +11238,138 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, H5L_info_t linfo; /* Link info struct */ /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", (unsigned)n); + HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n); /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in increasing creation order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in increasing creation order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in increasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in increasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR - - /* Don't test "native" order if there is no creation order index, since - * there's not a good way to easily predict the link's order in the name - * index. - */ - if(use_index) { - /* Verify the link information for first link, in native creation order (which is increasing) */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR - - /* Verify the link information for new link, in native creation order (which is increasing) */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR - - /* Verify value for new soft link, in native creation order (which is increasing) */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order if there is no creation order index, since + * there's not a good way to easily predict the link's order in the name + * index. + */ + if(use_index) { + /* Verify the link information for first link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in native creation order (which is increasing) */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ - /* Verify the name for new link, in native creation order (which is increasing) */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR - } /* end if */ + /* Verify the name for new link, in native creation order (which is increasing) */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + } /* end if */ /* Verify the link information for first link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in decreasing creation order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in decreasing creation order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in decreasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in decreasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Verify the link information for first link, in increasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for first link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in increasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in increasing link name order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in increasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in increasing link name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Don't test "native" order queries on link name order, since there's not - * a good way to easily predict the order of the links in the name index. - */ + /* Don't test "native" order queries on link name order, since there's not + * a good way to easily predict the order of the links in the name index. + */ - /* Verify the link information for first link, in decreasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for first link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in decreasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in decreasing link name order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in decreasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in decreasing link name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); -error: + error: /* Failure */ return(-1); } /* end link_info_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx * @@ -11372,9 +11387,9 @@ error: static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11395,142 +11410,142 @@ link_info_by_idx(hid_t fapl) if(hard_link) { if(use_index) TESTING("querying info by index w/creation order index, using hard links") - else - TESTING("querying info by index w/o creation order index, using hard links") + else + TESTING("querying info by index w/o creation order index, using hard links") } /* end if */ else { if(use_index) TESTING("querying info by index w/creation order index, using soft links") - else - TESTING("querying info by index w/o creation order index, using soft links") + else + TESTING("querying info by index w/o creation order index, using soft links") } /* end else */ /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - - /* Check for query on empty group */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - /* Make name for link */ - sprintf(objname, "filler %02u", u); - - /* Check for creating hard or soft link */ - if(hard_link) { - hid_t group_id2; /* Group ID */ - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - sprintf(valname, "value %02u", u); - - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - - /* Check for out of bound offset queries */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - /* Make name for link */ - sprintf(objname, "filler %02u", u); - - /* Check for creating hard or soft link */ - if(hard_link) { - hid_t group_id2; /* Group ID */ - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - sprintf(valname, "value %02u", u); - - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - - /* Verify state of group */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Check for out of bound offset queries */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - - PASSED(); + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Check for query on empty group */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify state of group */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); } /* end for */ } /* end for */ return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11539,7 +11554,7 @@ error: return -1; } /* end link_info_by_idx() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_old * @@ -11557,8 +11572,8 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11575,455 +11590,455 @@ link_info_by_idx_old(hid_t fapl) for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { if(hard_link) TESTING("querying info by index in old-style group, using hard links") - else - TESTING("querying info by index in old-style group, using soft links") + else + TESTING("querying info by index in old-style group, using soft links") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group to operate on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Check for creating hard or soft link */ - if(hard_link) { - H5O_info_t oi; /* Buffer for querying object's info */ + /* Check for creating hard or soft link */ + if(hard_link) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - sprintf(valname, "value %02u", u); + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - } /* end for */ + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + } /* end for */ /* Verify link information for created links */ for(u = 0; u < CORDER_NLINKS; u++) { unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */ /* Make link name for increasing/native order queries */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Make link value for increasing/native order queries */ - sprintf(valname, "value %02u", u); + HDsnprintf(valname, sizeof(valname), "value %02u", u); /* Verify link information (in increasing order) */ if(hard_link) { if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR } /* end else */ /* Verify link name (in increasing order) */ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR - /* Verify link information (in native order - native is increasing) */ - if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR - } /* end if */ - else { - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end else */ + /* Verify link information (in native order - native is increasing) */ + if(hard_link) { + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ /* Verify link name (in native order - native is increasing) */ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR - /* Make link name for decreasing order queries */ - sprintf(objname, "filler %02u", dec_u); + /* Make link name for decreasing order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); /* Make link value for decreasing order queries */ - sprintf(valname, "value %02u", dec_u); + HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); /* Verify link information (in decreasing order) */ if(hard_link) { if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end else */ - - /* Verify link name (in decreasing order) */ - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Check for creation order index queries */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - - PASSED(); - } /* end for */ - - return 0; - -error: - H5E_BEGIN_TRY { - H5Gclose(group_id); - H5Fclose(file_id); - } H5E_END_TRY; - return -1; -} /* end link_info_by_idx_old() */ - - -/*------------------------------------------------------------------------- - * Function: delete_by_idx - * - * Purpose: Create a group with creation order indices and test deleting - * links by index. - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * - *------------------------------------------------------------------------- - */ -static int -delete_by_idx(hid_t fapl) -{ - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE];/* File name */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ - - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("deleting links by creation order index in increasing order w/creation order index") - else - TESTING("deleting links by creation order index in increasing order w/o creation order index") - } /* end if */ - else { - if(use_index) - TESTING("deleting links by creation order index in decreasing order w/creation order index") - else - TESTING("deleting links by creation order index in decreasing order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("deleting links by name index in increasing order w/creation order index") - else - TESTING("deleting links by name index in increasing order w/o creation order index") - } /* end if */ - else { - if(use_index) - TESTING("deleting links by name index in decreasing order w/creation order index") - else - TESTING("deleting links by name index in decreasing order w/o creation order index") - } /* end else */ - } /* end else */ - - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - - - /* Delete links from one end */ - - - /* Check for deletion on empty group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Check for deletion on non-existing group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ - - /* Make name for link */ - sprintf(objname, "filler %02u", u); - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - - /* Check for out of bound deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Delete links from compact group */ - for(u = 0; u < (max_compact - 1); u++) { - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != (u + 1)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR - } /* end else */ - - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); - else - sprintf(objname, "filler %02u", (max_compact - (u + 2))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - - /* Create more links, to push group into dense form */ - for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ - - /* Make name for link */ - sprintf(objname, "filler %02u", u); - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify state of group (dense) */ - if(u >= max_compact) - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Check for out of bound deletion again */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Delete links from dense group, in appropriate order */ - for(u = 0; u < ((max_compact * 2) - 1); u++) { - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != (u + 1)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR - } /* end else */ + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); - else - sprintf(objname, "filler %02u", ((max_compact * 2) - (u + 2))); + /* Verify link name (in decreasing order) */ + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ - /* Check for deletion on empty group again */ + /* Check for creation order index queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR - /* Delete links in middle */ + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Make name for link */ - sprintf(objname, "filler %02u", u); + PASSED(); + } /* end for */ - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + return 0; - /* Verify state of group (dense) */ - if(u >= max_compact) - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return -1; +} /* end link_info_by_idx_old() */ - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - /* Delete every other link from dense group, in appropriate order */ - for(u = 0; u < max_compact; u++) { - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR +/*------------------------------------------------------------------------- + * Function: delete_by_idx + * + * Purpose: Create a group with creation order indices and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, November 14, 2006 + * + *------------------------------------------------------------------------- + */ +static int +delete_by_idx(hid_t fapl) +{ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ - /* Verify the link information for current link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { if(order == H5_ITER_INC) { - if(linfo.corder != ((u * 2) + 1)) TEST_ERROR + if(use_index) + TESTING("deleting links by creation order index in increasing order w/creation order index") + else + TESTING("deleting links by creation order index in increasing order w/o creation order index") } /* end if */ else { - if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR + if(use_index) + TESTING("deleting links by creation order index in decreasing order w/creation order index") + else + TESTING("deleting links by creation order index in decreasing order w/o creation order index") } /* end else */ - - /* Verify the name for current link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); - else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete remaining links from dense group, in appropriate order */ - for(u = 0; u < (max_compact - 1); u++) { - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { if(order == H5_ITER_INC) { - if(linfo.corder != ((u * 2) + 3)) TEST_ERROR + if(use_index) + TESTING("deleting links by name index in increasing order w/creation order index") + else + TESTING("deleting links by name index in increasing order w/o creation order index") } /* end if */ else { - if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR + if(use_index) + TESTING("deleting links by name index in decreasing order w/creation order index") + else + TESTING("deleting links by name index in decreasing order w/o creation order index") } /* end else */ + } /* end else */ - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); - else - sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + /* Delete links from one end */ + + + /* Check for deletion on empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from compact group */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound deletion again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from dense group, in appropriate order */ + for(u = 0; u < ((max_compact * 2) - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Check for deletion on empty group again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + + /* Delete links in middle */ + + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Delete every other link from dense group, in appropriate order */ + for(u = 0; u < max_compact; u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from dense group, in appropriate order */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != ((u * 2) + 3)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); } /* end for */ } /* end for */ } /* end for */ return 0; -error: + error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -12032,7 +12047,7 @@ error: return -1; } /* end delete_by_idx() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx_old * @@ -12050,8 +12065,8 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12066,189 +12081,189 @@ delete_by_idx_old(hid_t fapl) /* Print test banner */ if(order == H5_ITER_INC) TESTING("deleting links by index in increasing order in old-style group") - else - TESTING("deleting links by index in decreasing order in old-style group") + else + TESTING("deleting links by index in decreasing order in old-style group") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group to operate on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - - /* Delete links from one end */ - - - /* Check for deletion in empty group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Make name for link */ - sprintf(objname, "filler %02u", u); - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Delete links from one end */ - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Check for deletion in empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for bad index type deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Check for out of bounds deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Delete links, in appropriate order */ - for(u = 0; u < (CORDER_NLINKS - 1); u++) { - unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", (u + 1)); - else - sprintf(objname, "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Check for bad index type deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Check for out of bounds deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for deletion in empty group (again) */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Delete links, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS - 1); u++) { + unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ + + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Check for deletion in empty group (again) */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Delete links in middle */ + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + /* Delete links in middle */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete every other link from group, in appropriate order */ - for(u = 0; u < (CORDER_NLINKS / 2); u++) { - unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ - /* Verify the link information for current link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ + /* Delete every other link from group, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS / 2); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ - /* Verify the name for current link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 1)); - else - sprintf(objname, "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ - /* Delete remaining links from group, in appropriate order */ - for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { - unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Delete remaining links from group, in appropriate order */ + for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - sprintf(objname, "filler %02u", ((u * 2) + 3)); - else - sprintf(objname, "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ return 0; -error: + error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Fclose(file_id); @@ -12257,7 +12272,7 @@ error: return -1; } /* end delete_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_cb * @@ -12273,7 +12288,7 @@ error: */ static int link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) + void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12308,7 +12323,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (unsigned)my_info.corder); + HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -12334,7 +12349,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_cb * @@ -12356,7 +12371,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_fail_cb * @@ -12373,12 +12388,12 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, - const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { return(H5_ITER_ERROR); } /* end link_iterate_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_check * @@ -12394,7 +12409,7 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l */ static int link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) + unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12412,15 +12427,15 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12428,15 +12443,15 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ - iter_info->nskipped = (unsigned)(skip = max_links / 2); + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12444,26 +12459,26 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12476,26 +12491,26 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12507,39 +12522,39 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ - skip = 0; + /* Check for iteration routine indicating failure */ + skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); -error: + error: return(-1); } /* end link_iterate_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate * @@ -12557,9 +12572,9 @@ error: static int link_iterate(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -12576,13 +12591,13 @@ link_iterate(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate the "visited link" array */ - iter_info.max_visit = max_compact * 2; + /* Allocate the "visited link" array */ + iter_info.max_visit = max_compact * 2; if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR - iter_info.visited = visited; + iter_info.visited = visited; /* Loop over operating on different indices on link fields */ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { @@ -12595,42 +12610,42 @@ link_iterate(hid_t fapl) if(order == H5_ITER_INC) { if(use_index) TESTING("iterating over links by creation order index in increasing order w/creation order index") - else - TESTING("iterating over links by creation order index in increasing order w/o creation order index") + else + TESTING("iterating over links by creation order index in increasing order w/o creation order index") } /* end if */ else if(order == H5_ITER_DEC) { if(use_index) TESTING("iterating over links by creation order index in decreasing order w/creation order index") - else - TESTING("iterating over links by creation order index in decreasing order w/o creation order index") + else + TESTING("iterating over links by creation order index in decreasing order w/o creation order index") } /* end else */ else { HDassert(order == H5_ITER_NATIVE); if(use_index) TESTING("iterating over links by creation order index in native order w/creation order index") - else - TESTING("iterating over links by creation order index in native order w/o creation order index") + else + TESTING("iterating over links by creation order index in native order w/o creation order index") } /* end else */ } /* end if */ else { if(order == H5_ITER_INC) { if(use_index) TESTING("iterating over links by name index in increasing order w/creation order index") - else - TESTING("iterating over links by name index in increasing order w/o creation order index") + else + TESTING("iterating over links by name index in increasing order w/o creation order index") } /* end if */ else if(order == H5_ITER_DEC) { if(use_index) TESTING("iterating over links by name index in decreasing order w/creation order index") - else - TESTING("iterating over links by name index in decreasing order w/o creation order index") + else + TESTING("iterating over links by name index in decreasing order w/o creation order index") } /* end else */ else { HDassert(order == H5_ITER_NATIVE); if(use_index) TESTING("iterating over links by name index in native order w/creation order index") - else - TESTING("iterating over links by name index in native order w/o creation order index") + else + TESTING("iterating over links by name index in native order w/o creation order index") } /* end else */ } /* end else */ @@ -12638,76 +12653,76 @@ link_iterate(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ - /* (should be OK) */ - if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (compact) */ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound iteration on compact group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on compact group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in compact group */ - if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in compact group */ + if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (dense) */ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound iteration on dense group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on dense group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in dense group */ - if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in dense group */ + if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ } /* end for */ } /* end for */ @@ -12715,13 +12730,13 @@ link_iterate(hid_t fapl) /* Close the group creation property list */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Free resources */ - if(visited) - HDfree(visited); + /* Free resources */ + if(visited) + HDfree(visited); return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -12735,7 +12750,7 @@ error: return -1; } /* end link_iterate() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_cb * @@ -12751,7 +12766,7 @@ error: */ static int link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) + void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12780,7 +12795,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end if */ /* Verify name of link */ - sprintf(objname, "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); + HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) return(H5_ITER_ERROR); @@ -12806,7 +12821,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_old_cb * @@ -12828,7 +12843,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_check * @@ -12844,7 +12859,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_old_check(hid_t group_id, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) + unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12862,15 +12877,15 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12878,15 +12893,15 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ - iter_info->nskipped = (unsigned)(skip = max_links / 2); + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12894,26 +12909,26 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12926,26 +12941,26 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12957,53 +12972,53 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ - skip = 0; + /* Check for iteration routine indicating failure */ + skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Check for iteration w/bad location ID */ - skip = 0; + /* Check for iteration w/bad location ID */ + skip = 0; H5E_BEGIN_TRY { ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Success */ - return(0); + /* Success */ + return(0); -error: + error: return(-1); } /* end link_iterate_old_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old * @@ -13020,8 +13035,8 @@ error: static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13034,7 +13049,7 @@ link_iterate_old(hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = CORDER_NLINKS; if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR - iter_info.visited = visited; + iter_info.visited = visited; /* Loop over operating in different orders */ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { @@ -13054,55 +13069,55 @@ link_iterate_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ - /* (should be OK) */ - if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (symbol table) */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound iteration on old-style group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on old-style group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Check for iteration on creation order */ - /* (should fail) */ - skip = (hsize_t)0; + /* Check for iteration on creation order */ + /* (should fail) */ + skip = (hsize_t)0; H5E_BEGIN_TRY { ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in group */ - if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in group */ + if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ /* Free resources */ @@ -13111,7 +13126,7 @@ link_iterate_old(hid_t fapl) return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -13124,7 +13139,7 @@ error: return -1; } /* end link_iterate_old() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_check * @@ -13140,8 +13155,8 @@ error: */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, - haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, + haddr_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id = (-1); /* ID of group to test */ @@ -13164,21 +13179,21 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Open the object */ if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + /* Get the object's information */ + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(order == H5_ITER_INC) { - if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR - } /* end if */ - else { - /* XXX: What to do about native order? */ - } /* end else */ + if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -13187,43 +13202,43 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* - * Verify opening correct object by index when file mounting is present - */ + * Verify opening correct object by index when file mounting is present + */ /* Get the address of the root group in the file to mount */ if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - mnt_root_addr = oi.addr; + mnt_root_addr = oi.addr; /* Mount a file over a group in main group */ mnt_idx = 2; - sprintf(mntname, "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); + HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Open the object that the file is mounted on */ - if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR + /* Open the object that the file is mounted on */ + if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + /* Get the object's information */ + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR + /* Check that the object is the root of the mounted file and not in the previous file */ + if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR + if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR - /* Close object */ - if(H5Oclose(obj_id) < 0) TEST_ERROR + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR - /* Unmount the file */ - if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR + /* Unmount the file */ + if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); -error: + error: return(-1); } /* end open_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx * @@ -13241,11 +13256,11 @@ error: static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -13254,7 +13269,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13262,182 +13277,182 @@ open_by_idx(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object address array */ + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR - /* Create file to mount */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create file to mount */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("open object by creation order index in increasing order w/creation order index") - else - TESTING("open object by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("open object by creation order index in decreasing order w/creation order index") - else - TESTING("open object by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("open object by creation order index in native order w/creation order index") - else - TESTING("open object by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("open object by name index in increasing order w/creation order index") - else - TESTING("open object by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("open object by name index in decreasing order w/creation order index") - else - TESTING("open object by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("open object by name index in native order w/creation order index") - else - TESTING("open object by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("open object by creation order index in increasing order w/creation order index") + else + TESTING("open object by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("open object by creation order index in decreasing order w/creation order index") + else + TESTING("open object by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("open object by creation order index in native order w/creation order index") + else + TESTING("open object by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("open object by name index in increasing order w/creation order index") + else + TESTING("open object by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("open object by name index in decreasing order w/creation order index") + else + TESTING("open object by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("open object by name index in native order w/creation order index") + else + TESTING("open object by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Try to open on object in an empty group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound open by index on compact group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index on compact group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound open by index on compact group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index on compact group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); + } /* end for */ + } /* end for */ } /* end for */ - } /* end for */ - } /* end for */ /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Free resources */ - if(objno) - HDfree(objno); + /* Free resources */ + if(objno) + HDfree(objno); return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -13453,7 +13468,7 @@ error: return -1; } /* end open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_old * @@ -13471,15 +13486,15 @@ error: static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13488,95 +13503,95 @@ open_by_idx_old(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Print appropriate test message */ - if(order == H5_ITER_INC) { - TESTING("open object by name index in increasing order in old-style group") - } /* end if */ - else if(order == H5_ITER_DEC) { - TESTING("open object by name index in decreasing order in old-style group") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - TESTING("open object by name index in native order in old-style group") - } /* end else */ + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("open object by name index in increasing order in old-style group") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("open object by name index in decreasing order in old-style group") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("open object by name index in native order in old-style group") + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Try to open on object in an empty group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (symbol table) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound open by index */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for creation order index open */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for creation order index open */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ + PASSED(); + } /* end for */ /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - return 0; + return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -13588,7 +13603,7 @@ error: return -1; } /* end open_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: object_info_check * @@ -13604,7 +13619,7 @@ error: */ static int object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, - H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ hid_t group_id = (-1); /* ID of group to test */ @@ -13622,32 +13637,32 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Open each object in group by name and check that it's the correct one */ for(u = 0; u < max_links; u++) { /* Make name for link */ - sprintf(objname, "filler %02u", u); + HDsnprintf(objname, sizeof(objname), "filler %02u", u); /* Query the object's information, by name */ if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + /* Check that the object is the correct one */ + if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR - /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + /* Query the object's information, by index */ + if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(order == H5_ITER_INC) { - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR - } /* end if */ - else { - /* XXX: What to do about native order? */ - } /* end else */ + if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ } /* end for */ } /* end for */ @@ -13655,11 +13670,11 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Success */ return(0); -error: + error: return(-1); } /* end object_info_check() */ - + /*------------------------------------------------------------------------- * Function: object_info * @@ -13677,10 +13692,10 @@ error: static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ @@ -13690,7 +13705,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13699,202 +13714,202 @@ object_info(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR - - /* Create dataspace for attributes */ - if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query object info by creation order index in increasing order w/creation order index") - else - TESTING("query object info by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query object info by creation order index in decreasing order w/creation order index") - else - TESTING("query object info by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query object info by creation order index in native order w/creation order index") - else - TESTING("query object info by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query object info by name index in increasing order w/creation order index") - else - TESTING("query object info by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query object info by name index in decreasing order w/creation order index") - else - TESTING("query object info by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query object info by name index in native order w/creation order index") - else - TESTING("query object info by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Allocate object address array */ + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + + /* Create dataspace for attributes */ + if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query object info by creation order index in increasing order w/creation order index") + else + TESTING("query object info by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query object info by creation order index in decreasing order w/creation order index") + else + TESTING("query object info by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query object info by creation order index in native order w/creation order index") + else + TESTING("query object info by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query object info by name index in increasing order w/creation order index") + else + TESTING("query object info by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query object info by name index in decreasing order w/creation order index") + else + TESTING("query object info by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query object info by name index in native order w/creation order index") + else + TESTING("query object info by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); + } /* end for */ + } /* end for */ } /* end for */ - } /* end for */ - } /* end for */ /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Sclose(space_id) < 0) TEST_ERROR - if(objno) - HDfree(objno); + if(H5Sclose(space_id) < 0) TEST_ERROR + if(objno) + HDfree(objno); return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Sclose(space_id); @@ -13910,7 +13925,7 @@ error: return -1; } /* end object_info() */ - + /*------------------------------------------------------------------------- * Function: object_info_old * @@ -13927,15 +13942,15 @@ error: static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13944,107 +13959,107 @@ object_info_old(hid_t fapl) /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Print appropriate test message */ - if(order == H5_ITER_INC) { - TESTING("query object info by name index in increasing order in old-style group") - } /* end if */ - else if(order == H5_ITER_DEC) { - TESTING("query object info by name index in decreasing order in old-style group") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - TESTING("query object info by name index in native order in old-style group") - } /* end else */ + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("query object info by name index in increasing order in old-style group") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("query object info by name index in decreasing order in old-style group") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("query object info by name index in native order in old-style group") + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - sprintf(attrname, "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (symbol table) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for creation order index query */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for creation order index query */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ + PASSED(); + } /* end for */ /* Free resources */ if(H5Sclose(space_id) < 0) TEST_ERROR - return 0; + return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Sclose(space_id); @@ -14056,7 +14071,7 @@ error: return -1; } /* end object_info_old() */ - + /*------------------------------------------------------------------------- * Function: group_info * @@ -14074,10 +14089,10 @@ error: static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -14087,386 +14102,386 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query group info by creation order index in increasing order w/creation order index") - else - TESTING("query group info by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query group info by creation order index in decreasing order w/creation order index") - else - TESTING("query group info by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query group info by creation order index in native order w/creation order index") - else - TESTING("query group info by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query group info by name index in increasing order w/creation order index") - else - TESTING("query group info by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query group info by name index in decreasing order w/creation order index") - else - TESTING("query group info by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query group info by name index in native order w/creation order index") - else - TESTING("query group info by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query group info by creation order index in increasing order w/creation order index") + else + TESTING("query group info by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query group info by creation order index in decreasing order w/creation order index") + else + TESTING("query group info by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query group info by creation order index in native order w/creation order index") + else + TESTING("query group info by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query group info by name index in increasing order w/creation order index") + else + TESTING("query group info by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query group info by name index in decreasing order w/creation order index") + else + TESTING("query group info by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query group info by name index in native order w/creation order index") + else + TESTING("query group info by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - sprintf(objname2, "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - sprintf(objname2, "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); + } /* end for */ + } /* end for */ } /* end for */ - } /* end for */ - } /* end for */ /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - return 0; + return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -14478,7 +14493,7 @@ error: return -1; } /* end group_info() */ - + /*------------------------------------------------------------------------- * Function: group_info_old * @@ -14496,15 +14511,15 @@ error: static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14525,179 +14540,179 @@ group_info_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - sprintf(objname, "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - sprintf(objname2, "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (old-style) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (old-style) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for bad index query by index group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for bad index query by index group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -14708,7 +14723,7 @@ error: return -1; } /* end group_info_old() */ - + /*------------------------------------------------------------------------- * Function: timestamps * @@ -14726,11 +14741,11 @@ error: static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t group_id2 = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t gcpl_id2 = (-1); /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14761,106 +14776,106 @@ timestamps(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with non-default object timestamp setting */ - if((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - - /* Create group with default object timestamp setting */ - if((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Retrieve the new groups' creation properties */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR - - /* Query & verify the object timestamp settings */ - if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR - if(track_times != FALSE) TEST_ERROR - if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR - if(track_times != TRUE) TEST_ERROR - - /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - - /* Sanity check object information for each group */ - if(oinfo.atime != 0) TEST_ERROR - if(oinfo.mtime != 0) TEST_ERROR - if(oinfo.ctime != 0) TEST_ERROR - if(oinfo.btime != 0) TEST_ERROR - if(oinfo.atime == oinfo2.atime) TEST_ERROR - if(oinfo.mtime == oinfo2.mtime) TEST_ERROR - if(oinfo.ctime == oinfo2.ctime) TEST_ERROR - if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR - - /* Close the property lists */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Pclose(gcpl_id2) < 0) TEST_ERROR - - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Create group with non-default object timestamp setting */ + if((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Create group with default object timestamp setting */ + if((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve the new groups' creation properties */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR + + /* Query & verify the object timestamp settings */ + if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR + if(track_times != FALSE) TEST_ERROR + if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR + if(track_times != TRUE) TEST_ERROR + + /* Query the object information for each group */ + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + + /* Sanity check object information for each group */ + if(oinfo.atime != 0) TEST_ERROR + if(oinfo.mtime != 0) TEST_ERROR + if(oinfo.ctime != 0) TEST_ERROR + if(oinfo.btime != 0) TEST_ERROR + if(oinfo.atime == oinfo2.atime) TEST_ERROR + if(oinfo.mtime == oinfo2.mtime) TEST_ERROR + if(oinfo.ctime == oinfo2.ctime) TEST_ERROR + if(oinfo.btime == oinfo2.btime) TEST_ERROR + if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR + if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + + /* Close the property lists */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + if(H5Pclose(gcpl_id2) < 0) TEST_ERROR - /* Open groups */ - if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve the groups' creation properties */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Query & verify the object timestamp settings */ - if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR - if(track_times != FALSE) TEST_ERROR - if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR - if(track_times != TRUE) TEST_ERROR - /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - - /* Sanity check object information for each group */ - if(oinfo.atime != 0) TEST_ERROR - if(oinfo.mtime != 0) TEST_ERROR - if(oinfo.ctime != 0) TEST_ERROR - if(oinfo.btime != 0) TEST_ERROR - if(oinfo.atime == oinfo2.atime) TEST_ERROR - if(oinfo.mtime == oinfo2.mtime) TEST_ERROR - if(oinfo.ctime == oinfo2.ctime) TEST_ERROR - if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR - - /* Close the property lists */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Pclose(gcpl_id2) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open groups */ + if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Retrieve the groups' creation properties */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR + + /* Query & verify the object timestamp settings */ + if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR + if(track_times != FALSE) TEST_ERROR + if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR + if(track_times != TRUE) TEST_ERROR + + /* Query the object information for each group */ + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + + /* Sanity check object information for each group */ + if(oinfo.atime != 0) TEST_ERROR + if(oinfo.mtime != 0) TEST_ERROR + if(oinfo.ctime != 0) TEST_ERROR + if(oinfo.btime != 0) TEST_ERROR + if(oinfo.atime == oinfo2.atime) TEST_ERROR + if(oinfo.mtime == oinfo2.mtime) TEST_ERROR + if(oinfo.ctime == oinfo2.ctime) TEST_ERROR + if(oinfo.btime == oinfo2.btime) TEST_ERROR + if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR + if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + + /* Close the property lists */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + if(H5Pclose(gcpl_id2) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; -error: + error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -14871,17 +14886,17 @@ error: return -1; } /* end timestamps() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test links + * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * *------------------------------------------------------------------------- @@ -14889,8 +14904,8 @@ error: int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ unsigned minimize_dset_oh; /* Whether to minimize dataset object headers */ unsigned efc; /* Whether to use the external file cache */ @@ -14905,183 +14920,186 @@ main(void) /* fapl2 uses "latest version bounds" */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - - for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { - if (minimize_dset_oh) { - HDprintf("\n-Testing with minimzed dataset object headers-\n"); - dcpl_g = H5Pcreate(H5P_DATASET_CREATE); - if (0 > dcpl_g) TEST_ERROR - } else { - HDprintf("\n-Testing with unminimzed dataset object headers-\n"); - dcpl_g = H5P_DEFAULT; - } - - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; - - /* Check for FAPL to use */ - if(new_format) { - my_fapl = fapl2; - HDprintf("\n--Testing with 'new format'--\n"); - } else { - my_fapl = fapl; - HDprintf("\n--Testing with 'old format'--\n"); - } - - /* always enter tests without external cache */ - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + + for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { + if (minimize_dset_oh) { + HDprintf("\n-Testing with minimzed dataset object headers-\n"); + dcpl_g = H5Pcreate(H5P_DATASET_CREATE); + if (0 > dcpl_g) TEST_ERROR + } else { + HDprintf("\n-Testing with unminimzed dataset object headers-\n"); + dcpl_g = H5P_DEFAULT; + } + + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; + + /* Check for FAPL to use */ + if(new_format) { + my_fapl = fapl2; + HDprintf("\n--Testing with 'new format'--\n"); + } else { + my_fapl = fapl; + HDprintf("\n--Testing with 'old format'--\n"); + } + + /* always enter tests without external cache */ + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR - /* General tests... (on both old & new format groups */ - nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; - - /* Test new H5L link creation routine */ - nerrors += test_lcpl(my_fapl, new_format); - nerrors += test_move(my_fapl, new_format); - nerrors += test_copy(my_fapl, new_format); - nerrors += test_move_preserves(my_fapl, new_format); + /* General tests... (on both old & new format groups */ + nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; + + /* Test new H5L link creation routine */ + nerrors += test_lcpl(my_fapl, new_format); + nerrors += test_move(my_fapl, new_format); + nerrors += test_copy(my_fapl, new_format); + nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_deprec(my_fapl, new_format); + nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - - /* Try external link tests both with and without the external file cache - */ - for(efc = FALSE; efc <= TRUE; efc++) { - if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - HDprintf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - HDprintf("\n---Testing without external file cache---\n"); - } /* end else */ + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on + * the fapl */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache + */ + for(efc = FALSE; efc <= TRUE; efc++) { + if(efc) { + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* for with/without external file cache (efc) */ - - /* These tests assume that external links are a form of UD links, - * so assume that everything that passed for external links - * above has already been tested for UD links. - */ - if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - } /* end if */ - nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; - - /* Misc. extra tests, useful for both new & old format files */ - nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; - - /* Keep this test last, it's testing files that are used above */ - /* do not do this for files used by external link tests */ - nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* for new/old format */ - - /* New group revision feature tests */ - nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; -/* XXX: when creation order indexing is fully working, go back and add checks -* to these tests to make certain that the creation order values are -* correct. -*/ - nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; - nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; - nerrors += corder_transition(fapl2) < 0 ? 1 : 0; - nerrors += corder_delete(fapl2) < 0 ? 1 : 0; - nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += link_iterate(fapl2) < 0 ? 1 : 0; - nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += object_info(fapl2) < 0 ? 1 : 0; - nerrors += group_info(fapl2) < 0 ? 1 : 0; - nerrors += timestamps(fapl2) < 0 ? 1 : 0; - - /* Test new API calls on old-style groups */ - nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; - nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += object_info_old(fapl) < 0 ? 1 : 0; - nerrors += group_info_old(fapl) < 0 ? 1 : 0; - - if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) TEST_ERROR; - dcpl_g = -1; - } - } /* for [un]minimized dataset object headers */ +nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; +nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ + + /* These tests assume that external links are a form of UD links, + * so assume that everything that passed for external links + * above has already been tested for UD links. + */ + if(new_format == TRUE) { + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + } /* end if */ + nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; + + /* Misc. extra tests, useful for both new & old format files */ + nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; + + /* Keep this test last, it's testing files that are used above */ + /* do not do this for files used by external link tests */ + nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; + } /* new/old format */ + + /* New group revision feature tests */ + nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; + + /* XXX: when creation order indexing is fully working, go back and add checks + * to these tests to make certain that the creation order values are + * correct. + */ + nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; + nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; + nerrors += corder_transition(fapl2) < 0 ? 1 : 0; + nerrors += corder_delete(fapl2) < 0 ? 1 : 0; + nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += link_iterate(fapl2) < 0 ? 1 : 0; + nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += object_info(fapl2) < 0 ? 1 : 0; + nerrors += group_info(fapl2) < 0 ? 1 : 0; + nerrors += timestamps(fapl2) < 0 ? 1 : 0; + + /* Test new API calls on old-style groups */ + nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; + nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += object_info_old(fapl) < 0 ? 1 : 0; + nerrors += group_info_old(fapl) < 0 ? 1 : 0; + + if (minimize_dset_oh) { + if (H5Pclose(dcpl_g) < 0) + TEST_ERROR; + dcpl_g = -1; + } + } /* [un]minimized dataset object headers */ + /* Close 2nd FAPL */ H5Pclose(fapl2); @@ -15091,8 +15109,8 @@ main(void) h5_cleanup(FILENAME, fapl); /* Test that external links can be used after a library reset. MUST be - * called last so the reset doesn't interfere with the property lists. This - * routine will delete its own file. */ + * called last so the reset doesn't interfere with the property lists. This + * routine will delete its own file. */ nerrors += external_reset_register() < 0 ? 1 : 0; /* Results */ @@ -15113,7 +15131,7 @@ main(void) return 0; -error: + error: HDputs("*** TESTS FAILED ***"); return 1; } diff --git a/test/testhdf5.c b/test/testhdf5.c index 713cccf..e136086 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -90,8 +90,8 @@ main(int argc, char *argv[]) /* Exit failure if errors encountered; else exit success. */ /* No need to print anything since PerformTests() already does. */ if (GetTestNumErrs() > 0) - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); else - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); } /* end main() */ diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 0702d13..ad244b5 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -16,11 +16,10 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run -add_test (NAME MPI_TEST-clear-testphdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove ParaTest.h5 - WORKING_DIRECTORY - ${HDF5_TEST_PAR_BINARY_DIR} +add_test ( + NAME MPI_TEST-clear-testphdf5-objects + COMMAND ${CMAKE_COMMAND} -E remove ParaTest.h5 + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5) @@ -93,12 +92,10 @@ set (test_par_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME MPI_TEST-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_par_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_PAR_BINARY_DIR} +add_test ( + NAME MPI_TEST-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_par_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 7333c6d..7db99de 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -41,15 +41,9 @@ endforeach () if (NOT HDF5_ENABLE_USING_MEMCHECKER) foreach (h5_test ${H5P_VFD_TESTS}) add_test ( - NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${h5_test}.out - ${vfdname}/${vfdname}-${h5_test}.out.err - ) - add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -59,7 +53,6 @@ endforeach () -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES - DEPENDS MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} ) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 41acf7a..94ecbfa 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -460,11 +460,11 @@ static int test_mpio_1wMr(char *filename, int special_request) { /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF) { #ifdef H5_HAVE_GETHOSTNAME - if(HDgethostname(hostname, sizeof(hostname)) < 0) { - printf("gethostname failed\n"); - hostname[0] = '\0'; - } - #else + if(HDgethostname(hostname, sizeof(hostname)) < 0) { + printf("gethostname failed\n"); + hostname[0] = '\0'; + } +#else printf("gethostname unavailable\n"); hostname[0] = '\0'; #endif diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 999e17a..e1ccbed 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -26,15 +26,15 @@ int dim0; int dim1; int chunkdim0; int chunkdim1; -int nerrors = 0; /* errors count */ -int ndatasets = 300; /* number of datasets to create*/ +int nerrors = 0; /* errors count */ +int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root * group. */ -int facc_type = FACC_MPIO; /*Test file access type */ +int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; -H5E_auto2_t old_func; /* previous error handler */ -void *old_client_data; /* previous error handler arg.*/ +H5E_auto2_t old_func; /* previous error handler */ +void *old_client_data; /* previous error handler arg.*/ /* other option flags */ @@ -46,10 +46,10 @@ void *old_client_data; /* previous error handler arg.*/ #define NFILENAME 2 #define PARATESTFILE filenames[0] const char *FILENAME[NFILENAME]={ - "ParaTest", - NULL}; -char filenames[NFILENAME][PATH_MAX]; -hid_t fapl; /* file access property list */ + "ParaTest", + NULL}; +char filenames[NFILENAME][PATH_MAX]; +hid_t fapl; /* file access property list */ #ifdef USE_PAUSE /* pause the process for a moment to allow debugger to attach if desired. */ @@ -62,7 +62,7 @@ void pause_proc(void) { int pid; - h5_stat_t statbuf; + h5_stat_t statbuf; char greenlight[] = "go"; int maxloop = 10; int loops = 0; @@ -80,14 +80,14 @@ void pause_proc(void) if (MAINPROCESS) while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ - if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", - mpi_rank, mpi_namelen, mpi_name, pid, pid); - } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); - fflush(stdout); + if (!loops++){ + printf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + fflush(stdout); HDsleep(time_int); - } + } MPI_Barrier(MPI_COMM_WORLD); } @@ -99,7 +99,7 @@ int MPI_Init(int *argc, char ***argv) pause_proc(); return (ret_code); } -#endif /* USE_PAUSE */ +#endif /* USE_PAUSE */ /* @@ -109,15 +109,15 @@ static void usage(void) { printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); + "[-o] [-f ] [-d ]\n"); printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); + "\tset number of datasets for the multiple dataset test\n"); printf("\t-n" "\tset number of groups for the multiple group test\n"); printf("\t-f \tfilename prefix\n"); printf("\t-2\t\tuse Split-file together with MPIO\n"); printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", - ROW_FACTOR, COL_FACTOR); + ROW_FACTOR, COL_FACTOR); printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); printf("\n"); } @@ -129,7 +129,7 @@ usage(void) static int parse_options(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -140,107 +140,107 @@ parse_options(int argc, char **argv) chunkdim1 = (dim1+9)/10; while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'm': ndatasets = atoi((*argv+1)+1); - if (ndatasets < 0){ - nerrors++; - return(1); - } - break; - case 'n': ngroups = atoi((*argv+1)+1); - if (ngroups < 0){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } + break; + case 'n': ngroups = atoi((*argv+1)+1); + if (ngroups < 0){ nerrors++; return(1); - } + } break; - case 'f': if (--argc < 1) { - nerrors++; - return(1); - } - if (**(++argv) == '-') { - nerrors++; - return(1); - } - paraprefix = *argv; - break; - case 'i': /* Collective MPI-IO access with independent IO */ - dxfer_coll_type = DXFER_INDEPENDENT_IO; - break; - case '2': /* Use the split-file driver with MPIO access */ - /* Can use $HDF5_METAPREFIX to define the */ - /* meta-file-prefix. */ - facc_type = FACC_MPIO | FACC_SPLIT; - break; - case 'd': /* dimensizes */ - if (--argc < 2){ - nerrors++; - return(1); - } - dim0 = atoi(*(++argv))*mpi_size; - argc--; - dim1 = atoi(*(++argv))*mpi_size; - /* set default chunkdim sizes too */ - chunkdim0 = (dim0+9)/10; - chunkdim1 = (dim1+9)/10; - break; - case 'c': /* chunk dimensions */ - if (--argc < 2){ - nerrors++; - return(1); - } - chunkdim0 = atoi(*(++argv)); - argc--; - chunkdim1 = atoi(*(++argv)); - break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: printf("Illegal option(%s)\n", *argv); - nerrors++; - return(1); - } - } + case 'f': if (--argc < 1) { + nerrors++; + return(1); + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'i': /* Collective MPI-IO access with independent IO */ + dxfer_coll_type = DXFER_INDEPENDENT_IO; + break; + case '2': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; + case 'd': /* dimensizes */ + if (--argc < 2){ + nerrors++; + return(1); + } + dim0 = atoi(*(++argv))*mpi_size; + argc--; + dim1 = atoi(*(++argv))*mpi_size; + /* set default chunkdim sizes too */ + chunkdim0 = (dim0+9)/10; + chunkdim1 = (dim1+9)/10; + break; + case 'c': /* chunk dimensions */ + if (--argc < 2){ + nerrors++; + return(1); + } + chunkdim0 = atoi(*(++argv)); + argc--; + chunkdim1 = atoi(*(++argv)); + break; + case 'h': /* print help message--return with nerrors set */ + return(1); + default: printf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } + } } /*while*/ /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); - nerrors++; - return(1); + printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); - nerrors++; - return(1); + printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); } /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ - if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", - dim0, dim1, mpi_size); - nerrors++; - return(1); + if (MAINPROCESS) + printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); } /* compose the test filenames */ { - int i, n; - - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + int i, n; + + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + printf("h5_fixname failed\n"); + nerrors++; + return(1); + } + printf("Test filenames are:\n"); + for (i=0; i < n; i++) + printf(" %s\n", filenames[i]); } return(0); @@ -255,7 +255,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -264,36 +264,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); - VRFY((ret >= 0), ""); + VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); - VRFY((ret >= 0), ""); - return(ret_pl); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } /* unknown file access types */ @@ -303,7 +303,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) int main(int argc, char **argv) { - int mpi_size, mpi_rank; /* mpi variables */ + int mpi_size, mpi_rank; /* mpi variables */ H5Ptest_param_t ndsets_params, ngroups_params; H5Ptest_param_t collngroups_params; H5Ptest_param_t io_mode_confusion_params; @@ -323,9 +323,9 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("PHDF5 TESTS START\n"); - printf("===================================\n"); + printf("===================================\n"); + printf("PHDF5 TESTS START\n"); + printf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors @@ -334,7 +334,7 @@ int main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n"); + printf("Failed to turn off atexit processing. Continue.\n"); }; H5open(); h5_show_hostname(); @@ -344,10 +344,10 @@ int main(int argc, char **argv) /* Tests are generally arranged from least to most complexity... */ AddTest("mpiodup", test_fapl_mpio_dup, NULL, - "fapl_mpio duplicate", NULL); + "fapl_mpio duplicate", NULL); AddTest("split", test_split_comm_access, NULL, - "dataset using split communicators", PARATESTFILE); + "dataset using split communicators", PARATESTFILE); #ifdef PB_OUT /* temporary: disable page buffering when parallel */ AddTest("page_buffer", test_page_buffer_access, NULL, @@ -355,64 +355,64 @@ int main(int argc, char **argv) #endif AddTest("props", test_file_properties, NULL, - "Coll Metadata file property settings", PARATESTFILE); + "Coll Metadata file property settings", PARATESTFILE); AddTest("idsetw", dataset_writeInd, NULL, - "dataset independent write", PARATESTFILE); + "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, - "dataset independent read", PARATESTFILE); + "dataset independent read", PARATESTFILE); AddTest("cdsetw", dataset_writeAll, NULL, - "dataset collective write", PARATESTFILE); + "dataset collective write", PARATESTFILE); AddTest("cdsetr", dataset_readAll, NULL, - "dataset collective read", PARATESTFILE); + "dataset collective read", PARATESTFILE); AddTest("eidsetw", extend_writeInd, NULL, - "extendible dataset independent write", PARATESTFILE); + "extendible dataset independent write", PARATESTFILE); AddTest("eidsetr", extend_readInd, NULL, - "extendible dataset independent read", PARATESTFILE); + "extendible dataset independent read", PARATESTFILE); AddTest("ecdsetw", extend_writeAll, NULL, - "extendible dataset collective write", PARATESTFILE); + "extendible dataset collective write", PARATESTFILE); AddTest("ecdsetr", extend_readAll, NULL, - "extendible dataset collective read", PARATESTFILE); + "extendible dataset collective read", PARATESTFILE); AddTest("eidsetw2", extend_writeInd2, NULL, - "extendible dataset independent write #2", PARATESTFILE); + "extendible dataset independent write #2", PARATESTFILE); AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file", PARATESTFILE); AddTest("fltread", test_filter_read, NULL, - "parallel read of dataset written serially with filters", PARATESTFILE); + "parallel read of dataset written serially with filters", PARATESTFILE); #ifdef H5_HAVE_FILTER_DEFLATE AddTest("cmpdsetr", compress_readAll, NULL, - "compressed dataset collective read", PARATESTFILE); + "compressed dataset collective read", PARATESTFILE); #endif /* H5_HAVE_FILTER_DEFLATE */ AddTest("zerodsetr", zero_dim_dset, NULL, - "zero dim dset", PARATESTFILE); + "zero dim dset", PARATESTFILE); ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, - "multiple datasets write", &ndsets_params); + "multiple datasets write", &ndsets_params); ngroups_params.name = PARATESTFILE; ngroups_params.count = ngroups; AddTest("ngrpw", multiple_group_write, NULL, - "multiple groups write", &ngroups_params); + "multiple groups write", &ngroups_params); AddTest("ngrpr", multiple_group_read, NULL, - "multiple groups read", &ngroups_params); + "multiple groups read", &ngroups_params); AddTest("compact", compact_dataset, NULL, - "compact dataset test", PARATESTFILE); + "compact dataset test", PARATESTFILE); collngroups_params.name = PARATESTFILE; collngroups_params.count = ngroups; - AddTest("cngrpw", collective_group_write, NULL, - "collective group and dataset write", &collngroups_params); - AddTest("ingrpr", independent_group_read, NULL, - "independent group and dataset read", &collngroups_params); + /* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ + AddTest("cngrpw-ingrpr", collective_group_write_independent_group_read, NULL, + "collective grp/dset write - independent grp/dset read", + &collngroups_params); #ifndef H5_HAVE_WIN32_API AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); @@ -420,71 +420,71 @@ int main(int argc, char **argv) printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif AddTest("fill", dataset_fillvalue, NULL, - "dataset fill value", PARATESTFILE); + "dataset fill value", PARATESTFILE); AddTest("cchunk1", - coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); + coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); AddTest("cchunk2", - coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); + coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); AddTest("cchunk3", - coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); + coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); AddTest("cchunk4", coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); if((mpi_size < 3)&& MAINPROCESS ) { - printf("Collective chunk IO optimization APIs "); - printf("needs at least 3 processes to participate\n"); - printf("Collective chunk IO API tests will be skipped \n"); + printf("Collective chunk IO optimization APIs "); + printf("needs at least 3 processes to participate\n"); + printf("Collective chunk IO API tests will be skipped \n"); } AddTest((mpi_size <3)? "-cchunk5":"cchunk5" , coll_chunk5,NULL, - "linked chunk collective IO without optimization",PARATESTFILE); + "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", - coll_chunk6,NULL, - "multi-chunk collective IO with direct request",PARATESTFILE); + coll_chunk6,NULL, + "multi-chunk collective IO with direct request",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", - coll_chunk7,NULL, - "linked chunk collective IO with optimization",PARATESTFILE); + coll_chunk7,NULL, + "linked chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8", - coll_chunk8,NULL, - "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); + coll_chunk8,NULL, + "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9", - coll_chunk9,NULL, - "multiple chunk collective IO with optimization",PARATESTFILE); + coll_chunk9,NULL, + "multiple chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10", - coll_chunk10,NULL, - "multiple chunk collective IO transferring to independent IO",PARATESTFILE); + coll_chunk10,NULL, + "multiple chunk collective IO transferring to independent IO",PARATESTFILE); /* irregular collective IO tests*/ AddTest("ccontw", - coll_irregular_cont_write,NULL, - "collective irregular contiguous write",PARATESTFILE); + coll_irregular_cont_write,NULL, + "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr", - coll_irregular_cont_read,NULL, - "collective irregular contiguous read",PARATESTFILE); + coll_irregular_cont_read,NULL, + "collective irregular contiguous read",PARATESTFILE); AddTest("cschunkw", - coll_irregular_simple_chunk_write,NULL, - "collective irregular simple chunk write",PARATESTFILE); + coll_irregular_simple_chunk_write,NULL, + "collective irregular simple chunk write",PARATESTFILE); AddTest("cschunkr", - coll_irregular_simple_chunk_read,NULL, - "collective irregular simple chunk read",PARATESTFILE); + coll_irregular_simple_chunk_read,NULL, + "collective irregular simple chunk read",PARATESTFILE); AddTest("ccchunkw", - coll_irregular_complex_chunk_write,NULL, - "collective irregular complex chunk write",PARATESTFILE); + coll_irregular_complex_chunk_write,NULL, + "collective irregular complex chunk write",PARATESTFILE); AddTest("ccchunkr", - coll_irregular_complex_chunk_read,NULL, - "collective irregular complex chunk read",PARATESTFILE); + coll_irregular_complex_chunk_read,NULL, + "collective irregular complex chunk read",PARATESTFILE); AddTest("null", null_dataset, NULL, - "null dataset test", PARATESTFILE); + "null dataset test", PARATESTFILE); io_mode_confusion_params.name = PARATESTFILE; io_mode_confusion_params.count = 0; /* value not used */ AddTest("I/Omodeconf", io_mode_confusion, NULL, - "I/O mode confusion test -- hangs quickly on failure", + "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); if((mpi_size < 3) && MAINPROCESS) { @@ -506,12 +506,12 @@ int main(int argc, char **argv) AddTest("tldsc", lower_dim_size_comp_test, NULL, - "test lower dim size comp in span tree to mpi derived type", + "test lower dim size comp in span tree to mpi derived type", PARATESTFILE); AddTest("lccio", link_chunk_collective_io_test, NULL, - "test mpi derived type management", + "test mpi derived type management", PARATESTFILE); AddTest("actualio", actual_io_mode_tests, NULL, @@ -523,7 +523,7 @@ int main(int argc, char **argv) PARATESTFILE); AddTest("edpl", test_plist_ed, NULL, - "encode/decode Property Lists", NULL); + "encode/decode Property Lists", NULL); if((mpi_size < 2) && MAINPROCESS) { printf("File Image Ops daisy chain test needs at least 2 processes.\n"); @@ -533,11 +533,11 @@ int main(int argc, char **argv) "file image ops daisy chain", NULL); if((mpi_size < 2)&& MAINPROCESS ) { - printf("Atomicity tests need at least 2 processes to participate\n"); - printf("8 is more recommended.. Atomicity tests will be skipped \n"); + printf("Atomicity tests need at least 2 processes to participate\n"); + printf("8 is more recommended.. Atomicity tests will be skipped \n"); } else if (facc_type != FACC_MPIO && MAINPROCESS) { - printf("Atomicity tests will not work with a non MPIO VFD\n"); + printf("Atomicity tests will not work with a non MPIO VFD\n"); } else if(mpi_size >= 2 && facc_type == FACC_MPIO){ AddTest("atomicity", dataset_atomicity, NULL, @@ -545,13 +545,13 @@ int main(int argc, char **argv) } AddTest("denseattr", test_dense_attr, NULL, - "Store Dense Attributes", PARATESTFILE); + "Store Dense Attributes", PARATESTFILE); AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, "Collective Metadata read with some ranks having no selection", PARATESTFILE); - AddTest("MC coll MD read", test_multi_chunk_io_addrmap_issue, NULL, + AddTest("MC_coll_MD_read", test_multi_chunk_io_addrmap_issue, NULL, "Collective MD read with multi chunk I/O (H5D__chunk_addrmap)", PARATESTFILE); - AddTest("LC coll MD read", test_link_chunk_io_sort_chunk_issue, NULL, + AddTest("LC_coll_MD_read", test_link_chunk_io_sort_chunk_issue, NULL, "Collective MD read with link chunk I/O (H5D__sort_chunk)", PARATESTFILE); /* Display testing information */ @@ -565,9 +565,9 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" - " Using Independent I/O with file set view to replace collective I/O \n" - "===================================\n"); + printf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); } @@ -592,16 +592,16 @@ int main(int argc, char **argv) { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - nerrors=temp; + nerrors=temp; } - if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors) - printf("***PHDF5 tests detected %d errors***\n", nerrors); - else - printf("PHDF5 tests finished with no errors\n"); - printf("===================================\n"); + if (MAINPROCESS){ /* only process 0 reports */ + printf("===================================\n"); + if (nerrors) + printf("***PHDF5 tests detected %d errors***\n", nerrors); + else + printf("PHDF5 tests finished with no errors\n"); + printf("===================================\n"); } /* close HDF5 library */ diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 4409221..9fece12 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -240,6 +240,7 @@ void test_file_properties(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); +void collective_group_write_independent_group_read(void); void collective_group_write(void); void independent_group_read(void); void test_fapl_mpio_dup(void); diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index b9ed9ce..257a047 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -259,7 +259,7 @@ convert(hid_t fid, const char *dname) error_msg("unable to get the chunk indexing type for \"%s\"\n", dname); h5tools_setstatus(EXIT_FAILURE); goto error; - } + } else if(verbose_g) HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); @@ -268,11 +268,11 @@ convert(hid_t fid, const char *dname) HDfprintf(stdout, "Dataset's chunk indexing type is already version 1 B-tree: no further action\n"); h5tools_setstatus(EXIT_SUCCESS); goto done; - } + } else if (verbose_g) HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); - break; + break; case H5D_CONTIGUOUS: if(verbose_g) @@ -302,8 +302,8 @@ convert(hid_t fid, const char *dname) if(noop_g) { if(verbose_g) HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 7c3d7f0..6b41d7f 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -78,13 +78,6 @@ if (BUILD_SHARED_LIBS) ) endif () -#----------------------------------------------------------------------------- -# Generate the h5cc file containing settings needed to compile programs -#----------------------------------------------------------------------------- -#if (NOT WIN32) -# configure_file (${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) -#endif () - ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index ecf371f..1130ea7 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5copygentest COMMAND $) + #add_test (NAME h5copygentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () #----------------------------------------------------------------------------- diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index df56f1a..b0d1615 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -65,15 +65,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_F-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () add_test ( NAME H5COPY_F-${testname} - COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -87,7 +85,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if (${resultcode} EQUAL 1) @@ -101,15 +99,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -123,7 +119,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -147,15 +143,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () add_test ( NAME H5COPY-${testname}-prefill - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -167,14 +161,14 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -188,15 +182,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_SAME-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () add_test ( NAME H5COPY_SAME-${testname}-prefill - COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -208,14 +200,14 @@ add_test ( NAME H5COPY_SAME-${testname} - COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF - COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if (${resultcode} EQUAL 1) @@ -231,7 +223,7 @@ macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () @@ -242,15 +234,12 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 - ./testfiles/${testname}.out.out - ./testfiles/${testname}.out.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) add_test ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -270,18 +259,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out.h5 - testfiles/${infile}.out - testfiles/${infile}.out.err - testfiles/${testname}.out.h5.out - testfiles/${testname}.out.h5.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.out.h5 ) if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -298,6 +282,7 @@ add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -315,6 +300,7 @@ add_test ( NAME H5COPY_UD-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -336,18 +322,13 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD_ERR-${testname}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}_ERR.out.h5 - testfiles/${infile}_ERR.out - testfiles/${infile}_ERR.out.err - testfiles/${testname}_ERR.out.h5.out - testfiles/${testname}_ERR.out.h5.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5 ) if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -365,6 +346,7 @@ add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -383,6 +365,7 @@ add_test ( NAME H5COPY_UD_ERR-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}_ERR.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -417,8 +400,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove simple.out.h5 chunk.out.h5 compact.out.h5 @@ -451,8 +433,6 @@ samefile1.out.h5 samefile2.out.h5 h5copy_misc1.out.h5 - h5copy_misc1.out.out - h5copy_misc1.out.out.err ) set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 0a874ec..cb4397f 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5diffgentest COMMAND $) + #add_test (NAME h5diffgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () #----------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 604c8a5..93dfd72 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -324,7 +324,14 @@ # # Overwrite system dependent files (Windows) and not VS2015 # + set (COPY_WINDOWS_FILES false) + if (MINGW) + set (COPY_WINDOWS_FILES true) + endif () if (WIN32 AND MSVC_VERSION LESS 1900) + set (COPY_WINDOWS_FILES true) + endif () + if (COPY_WINDOWS_FILES) foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") @@ -358,7 +365,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -367,20 +374,10 @@ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -390,7 +387,9 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS H5DIFF-${resultfile}-clear-objects) + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () endif () if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) @@ -409,17 +408,6 @@ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME MPI_TEST_H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - PAR/testfiles/${resultfile}.out - PAR/testfiles/${resultfile}.out.err - ) - if (last_test) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME MPI_TEST_H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -435,25 +423,20 @@ -D "TEST_SORT_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS MPI_TEST_H5DIFF-${resultfile}-clear-objects) + if (last_test) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () set (last_test "PH5DIFF-${resultfile}") endif () endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) if (${resultcode} EQUAL 2) add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -470,6 +453,7 @@ add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -483,7 +467,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS H5DIFF_UD-${testname}-clear-objects) + if (last_test) + set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS ${last_test}) + endif () endif () endmacro () diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 1672774..38f4118 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -40,7 +40,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5dumpgentest COMMAND $) + #add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 7f52796..111c120 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -360,12 +360,7 @@ endforeach () foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) - if (WIN32) - file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM) - file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") - else () - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") - endif () + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") endforeach () foreach (tst_other_file ${HDF5_REFERENCE_FILES}) @@ -386,9 +381,10 @@ # -------------------------------------------------------------------- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files") - if (WIN32) - file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) - file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") + if (WIN32 OR MINGW) + configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF) + #file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) + #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") endif () @@ -409,27 +405,17 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DUMP-${testname}") else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/std/h5dump-${testname}.out - testfiles/std/h5dump-${testname}.out.err - ) - if (last_test) - set_tests_properties (H5DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -438,7 +424,9 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS H5DUMP-${testname}-clear-objects) + if (last_test) + set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) + endif () endif () endmacro () @@ -459,7 +447,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -470,16 +458,13 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.bin - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.bin ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -495,7 +480,7 @@ macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") @@ -506,16 +491,13 @@ else () add_test ( NAME H5DUMP-N-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}-N.bin - ${resultfile}-N.out - ${resultfile}-N.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}-N.bin ) set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -531,7 +513,7 @@ macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -542,16 +524,13 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.txt - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -561,20 +540,21 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - add_test ( - NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-${resultfile}-output-cmp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) + endif () endif () endmacro () macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -585,17 +565,15 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${ddlfile}.txt ${resultfile}.txt - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -605,20 +583,20 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - add_test ( - NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) - add_test ( - NAME H5DUMP-${resultfile}-output-cmp-ddl - COMMAND ${CMAKE_COMMAND} - -E compare_files ${ddlfile}.txt ${ddlfile}.exp - ) - set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-${resultfile}-output-cmp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + set_tests_properties (H5DUMP-${resultfile}-output-cmp PROPERTIES DEPENDS H5DUMP-${resultfile}) + add_test ( + NAME H5DUMP-${resultfile}-output-cmp-ddl + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${ddlfile}.txt ${ddlfile}.exp + ) + set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + set_tests_properties (H5DUMP-${resultfile}-output-cmp-ddl PROPERTIES DEPENDS H5DUMP-${resultfile}-output-cmp) + endif () endif () endmacro () @@ -626,40 +604,32 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.txt + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-output-${resultfile} - COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile} ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) - add_test ( - NAME H5DUMP-output-cmp-${resultfile} - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-output-cmp-${resultfile} + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + set_tests_properties (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) + endif () endif () endmacro () macro (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -669,24 +639,15 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5_GREP_TEST resultfile resultcode result_check) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -695,24 +656,15 @@ -D "TEST_REFERENCE=${result_check}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -722,24 +674,15 @@ -D "TEST_ERRREF=${result_errcheck}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -751,7 +694,6 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () @@ -760,16 +702,15 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-IMPORT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.bin ${resultfile}.h5 - ${conffile}.out ) set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -779,10 +720,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $ ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) endif () @@ -790,18 +731,10 @@ macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_UD-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -813,7 +746,6 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clear-objects) endif () endmacro () @@ -823,368 +755,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5dump-help.out - charsets.out - charsets.out.err - file_space.out - file_space.out.err - filter_fail.out - filter_fail.out.err - non_existing.out - non_existing.out.err - packedbits.out - packedbits.out.err - tall-1.out - tall-1.out.err - tall-2.out - tall-2.out.err - tall-2A.out - tall-2A.out.err - tall-2A0.out - tall-2A0.out.err - tall-2B.out - tall-2B.out.err - tall-3.out - tall-3.out.err - tall-4s.out - tall-4s.out.err - tall-5s.out - tall-5s.out.err - tall-6.txt - tall-6.out - tall-6.out.err - tall-7.out - tall-7.out.err - tall-7N.out - tall-7N.out.err - tallfilters.out - tallfilters.out.err - tarray1.out - tarray1.out.err - tarray1_big.out - tarray1_big.out.err - tarray2.out - tarray2.out.err - tarray3.out - tarray3.out.err - tarray4.out - tarray4.out.err - tarray5.out - tarray5.out.err - tarray6.out - tarray6.out.err - tarray7.out - tarray7.out.err - tarray8.out - tarray8.out.err - tattr-1.out - tattr-1.out.err - tattr-2.out - tattr-2.out.err - tattr-3.out - tattr-3.out.err - tattr-4_be.out - tattr-4_be.out.err - tattrcontents1.out - tattrcontents1.out.err - tattrcontents2.out - tattrcontents2.out.err - tattrintsize.out - tattrintsize.out.err - tattrreg.out - tattrreg.out.err - tattrregR.out - tattrregR.out.err - tbin1LE.bin - tbinregR.txt - tbinregR.out - tbinregR.out.err - tbigdims.out - tbigdims.out.err - tbitnopaque_be.out - tbitnopaque_be.out.err - tbitnopaque_le.out - tbitnopaque_le.out.err - tboot1.out - tboot1.out.err - tboot2.out - tboot2.out.err - tboot2A.out - tboot2A.out.err - tboot2B.out - tboot2B.out.err - tchar1.out - tchar1.out.err - tchunked.out - tchunked.out.err - tcmpdattrintsize.out - tcmpdattrintsize.out.err - tcmpdintarray.out - tcmpdintarray.out.err - tcmpdints.out - tcmpdints.out.err - tcmpdintsize.out - tcmpdintsize.out.err - tcomp-1.out - tcomp-1.out.err - tcomp-2.out - tcomp-2.out.err - tcomp-3.out - tcomp-3.out.err - tcomp-4.out - tcomp-4.out.err - tcompact.out - tcompact.out.err - tcompound_complex.out - tcompound_complex.out.err - tcontents.out - tcontents.out.err - tcontiguos.out - tcontiguos.out.err - tdatareg.out - tdatareg.out.err - tdataregR.out - tdataregR.out.err - tdeflate.out - tdeflate.out.err - tdset-1.out - tdset-1.out.err - tdset-2.out - tdset-2.out.err - tdset-3s.out - tdset-3s.out.err - tempty.out - tempty.out.err - texternal.out - texternal.out.err - textlinksrc.out - textlinksrc.out.err - textlinkfar.out - textlinkfar.out.err - textlink.out - textlink.out.err - tfamily.out - tfamily.out.err - tfill.out - tfill.out.err - tfletcher32.out - tfletcher32.out.err - tfpformat.out - tfpformat.out.err - tgroup-1.out - tgroup-1.out.err - tgroup-2.out - tgroup-2.out.err - tgrp_comments.out - tgrp_comments.out.err - tgrpnullspace.out - tgrpnullspace.out.err - thlink-1.out - thlink-1.out.err - thlink-2.out - thlink-2.out.err - thlink-3.out - thlink-3.out.err - thlink-4.out - thlink-4.out.err - thlink-5.out - thlink-5.out.err - thyperslab.out - thyperslab.out.err - tindicesno.out - tindicesno.out.err - tindicessub1.out - tindicessub1.out.err - tindicessub2.out - tindicessub2.out.err - tindicessub3.out - tindicessub3.out.err - tindicessub4.out - tindicessub4.out.err - texceedsubstart.out - texceedsubstart.out.err - texceedsubcount.out - texceedsubcount.out.err - texceedsubstride.out - texceedsubstride.out.err - texceedsubblock.out - texceedsubblock.out.err - tindicesyes.out - tindicesyes.out.err - tints4dims.out - tints4dims.out.err - tints4dimsBlock2.out - tints4dimsBlock2.out.err - tints4dimsBlockEq.out - tints4dimsBlockEq.out.err - tints4dimsCount2.out - tints4dimsCount2.out.err - tints4dimsCountEq.out - tints4dimsCountEq.out.err - tints4dimsStride2.out - tints4dimsStride2.out.err - tintsattrs.out - tintsattrs.out.err - tintsnodata.out - tintsnodata.out.err - tlarge_objname.out - tlarge_objname.out.err - tldouble.out - tldouble.out.err - tlonglinks.out - tlonglinks.out.err - tloop-1.out - tloop-1.out.err - tmulti.out - tmulti.out.err - tmultifile.out - tmultifile.out.err -# tqmarkfile.out -# tqmarkfile.out.err -# tstarfile.out -# tstarfile.out.err - tnamed_dtype_attr.out - tnamed_dtype_attr.out.err - tnbit.out - tnbit.out.err - tnestcomp-1.out - tnestcomp-1.out.err - tnestedcmpddt.out - tnestedcmpddt.out.err - tnoattrdata.out - tnoattrdata.out.err - tnoattrddl.out - tnoattrddl.out.err - tnodata.out - tnodata.out.err - tnoddl.out - tnoddl.out.err - tnoddlfile.out - tnoddlfile.out.err - tno-subset.out - tno-subset.out.err - tnullspace.out - tnullspace.out.err - tordergr1.out - tordergr1.out.err - tordergr2.out - tordergr2.out.err - tordergr3.out - tordergr3.out.err - tordergr4.out - tordergr4.out.err - tordergr5.out - tordergr5.out.err - torderattr1.out - torderattr1.out.err - torderattr2.out - torderattr2.out.err - torderattr3.out - torderattr3.out.err - torderattr4.out - torderattr4.out.err - tordercontents1.out - tordercontents1.out.err - tordercontents2.out - tordercontents2.out.err - torderlinks1.out - torderlinks1.out.err - torderlinks2.out - torderlinks2.out.err - tperror.out - tperror.out.err - trawdatafile.out - trawdatafile.out.err - trawdatafile.txt - trawssetfile.out - trawssetfile.out.err - trawssetfile.txt - treadfilter.out - treadfilter.out.err - treadintfilter.out - treadintfilter.out.err - treference.out - treference.out.err - tsaf.out - tsaf.out.err - tscalarattrintsize.out - tscalarattrintsize.out.err - tscalarintattrsize.out - tscalarintattrsize.out.err - tscalarintsize.out - tscalarintsize.out.err - tscalarstring.out - tscalarstring.out.err - tscaleoffset.out - tscaleoffset.out.err - tshuffle.out - tshuffle.out.err - tslink-1.out - tslink-1.out.err - tslink-2.out - tslink-2.out.err - tslink-D.out - tslink-D.out.err - tsplit_file.out - tsplit_file.out.err - tstr-1.out - tstr-1.out.err - tstr-2.out - tstr-2.out.err - tstr2bin2.txt - tstr2bin6.txt - tstring.out - tstring.out.err - tstring2.out - tstring2.out.err - tstringe.out - tstringe.out.err - tszip.out - tszip.out.err - tudlink-1.out - tudlink-1.out.err - tudlink-2.out - tudlink-2.out.err - tuserfilter.out - tuserfilter.out.err - tvldtypes1.out - tvldtypes1.out.err - tvldtypes2.out - tvldtypes2.out.err - tvldtypes3.out - tvldtypes3.out.err - tvldtypes4.out - tvldtypes4.out.err - tvldtypes5.out - tvldtypes5.out.err - tvlenstr_array.out - tvlenstr_array.out.err - tvlstr.out - tvlstr.out.err - tvms.out - tvms.out.err - twidedisplay.out - twidedisplay.out.err - twithddl.txt - twithddlfile.out - twithddlfile.out.err - twithddlfile.txt - zerodim.out - zerodim.out.err - ) - set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (last_test) - set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5DUMP-clearall-objects") - endif () - ADD_HELP_TEST(help 0 -h) # test data output redirection diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index feb5c68..a6be9ae 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -128,7 +128,7 @@ macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -137,18 +137,10 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" @@ -157,7 +149,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS H5DUMP-${resultfile}-clear-objects) endif () endmacro () @@ -167,126 +158,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_PACKED_BITS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tnofilename-with-packed-bits.out - tnofilename-with-packed-bits.out.err - tpbitsArray.out - tpbitsArray.out.err - tpbitsCompound.out - tpbitsCompound.out.err - tpbitsIncomplete.out - tpbitsIncomplete.out.err - tpbitsLengthExceeded.out - tpbitsLengthExceeded.out.err - tpbitsCharLengthExceeded.out - tpbitsCharLengthExceeded.out.err - tpbitsIntLengthExceeded.out - tpbitsIntLengthExceeded.out.err - tpbitsLongLengthExceeded.out - tpbitsLongLengthExceeded.out.err - tpbitsLengthPositive.out - tpbitsLengthPositive.out.err - tpbitsMax.out - tpbitsMax.out.err - tpbitsMaxExceeded.out - tpbitsMaxExceeded.out.err - tpbitsOffsetExceeded.out - tpbitsOffsetExceeded.out.err - tpbitsCharOffsetExceeded.out - tpbitsCharOffsetExceeded.out.err - tpbitsIntOffsetExceeded.out - tpbitsIntOffsetExceeded.out.err - tpbitsLongOffsetExceeded.out - tpbitsLongOffsetExceeded.out.err - tpbitsOffsetNegative.out - tpbitsOffsetNegative.out.err - tpbitsOverlapped.out - tpbitsOverlapped.out.err - tpbitsSigned.out - tpbitsSigned.out.err - tpbitsUnsigned.out - tpbitsUnsigned.out.err - tpbitsSignedInt.out - tpbitsSignedInt.out.err - tpbitsUnsignedInt.out - tpbitsUnsignedInt.out.err - tpbitsSignedLong.out - tpbitsSignedLong.out.err - tpbitsUnsignedLong.out - tpbitsUnsignedLong.out.err - tpbitsSignedLongLong.out - tpbitsSignedLongLong.out.err - tpbitsUnsignedLongLong.out - tpbitsUnsignedLongLong.out.err - tpbitsSignedWhole.out - tpbitsSignedWhole.out.err - tpbitsUnsignedWhole.out - tpbitsUnsignedWhole.out.err - tpbitsSignedIntWhole.out - tpbitsSignedIntWhole.out.err - tpbitsUnsignedIntWhole.out - tpbitsUnsignedIntWhole.out.err - tpbitsSignedLongWhole.out - tpbitsSignedLongWhole.out.err - tpbitsUnsignedLongWhole.out - tpbitsUnsignedLongWhole.out.err - tpbitsSignedLongLongWhole.out - tpbitsSignedLongLongWhole.out.err - tpbitsUnsignedLongLongWhole.out - tpbitsUnsignedLongLongWhole.out.err - tpbitsSignedLongLongWhole1.out - tpbitsSignedLongLongWhole1.out.err - tpbitsUnsignedLongLongWhole1.out - tpbitsUnsignedLongLongWhole1.out.err - tpbitsSignedLongLongWhole63.out - tpbitsSignedLongLongWhole63.out.err - tpbitsUnsignedLongLongWhole63.out - tpbitsUnsignedLongLongWhole63.out.err - tpbitsSigned4.out - tpbitsSigned4.out.err - tpbitsUnsigned4.out - tpbitsUnsigned4.out.err - tpbitsSignedInt8.out - tpbitsSignedInt8.out.err - tpbitsUnsignedInt8.out - tpbitsUnsignedInt8.out.err - tpbitsSignedLong16.out - tpbitsSignedLong16.out.err - tpbitsUnsignedLong16.out - tpbitsUnsignedLong16.out.err - tpbitsSignedLongLong32.out - tpbitsSignedLongLong32.out.err - tpbitsUnsignedLongLong32.out - tpbitsUnsignedLongLong32.out.err - tpbitsSigned2.out - tpbitsSigned2.out.err - tpbitsUnsigned2.out - tpbitsUnsigned2.out.err - tpbitsSignedInt4.out - tpbitsSignedInt4.out.err - tpbitsUnsignedInt4.out - tpbitsUnsignedInt4.out.err - tpbitsSignedLong8.out - tpbitsSignedLong8.out.err - tpbitsUnsignedLong8.out - tpbitsUnsignedLong8.out.err - tpbitsSignedLongLong16.out - tpbitsSignedLongLong16.out.err - tpbitsUnsignedLongLong16.out - tpbitsUnsignedLongLong16.out.err - ) - set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (last_pbits_test) - set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) - endif () - set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") - endif () - # test failure handling # Missing file name ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 --enable-error-stack) diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index c557ba4..036609c 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -124,7 +124,7 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -133,18 +133,10 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" @@ -153,14 +145,13 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS H5DUMP-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -172,18 +163,10 @@ set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") add_test ( NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -194,14 +177,13 @@ -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -210,18 +192,10 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" @@ -230,7 +204,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () @@ -240,54 +213,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_VDS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tvds-1.out - tvds-1.out.err - tvds-2.out - tvds-2.out.err - tvds-3_1.out - tvds-3_1.out.err - tvds-3_2.out - tvds-3_2.out.err - tvds-4.out - tvds-4.out.err - tvds-5.out - tvds-5.out.err - vds-first.out - vds-first.out.err - vds-gap1.out - vds-gap1.out.err - vds-gap2.out - vds-gap2.out.err - tvds_layout-1.out - tvds_layout-1.out.err - tvds_layout-2.out - tvds_layout-2.out.err - tvds_layout-3_1.out - tvds_layout-3_1.out.err - tvds_layout-3_2.out - tvds_layout-3_2.out.err - tvds_layout-4.out - tvds_layout-4.out.err - tvds_layout-5.out - tvds_layout-5.out.err - vds_layout-eiger.out - vds_layout-eiger.out.err - vds_layout-maxmin.out - vds_layout-maxmin.out.err - ) - set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (last_vds_test) - set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test}) - endif () - set (last_VDS_test "H5DUMP_VDS-clearall-objects") - endif () - # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which # filters are defined. diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index a883b86..6d73cb1 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -182,7 +182,7 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) + add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") @@ -191,18 +191,10 @@ set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_XML-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_XML-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") add_test ( NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" @@ -211,7 +203,6 @@ -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS H5DUMP_XML-${resultfile}-clear-objects) endif () endmacro () @@ -221,154 +212,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-XML-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tall.h5.out - tall.h5.out.err - tall-2A.h5.out - tall-2A.h5.out.err - tarray1.h5.out - tarray1.h5.out.err - tarray2.h5.out - tarray2.h5.out.err - tarray3.h5.out - tarray3.h5.out.err - tarray6.h5.out - tarray6.h5.out.err - tarray7.h5.out - tarray7.h5.out.err - tattr.h5.out - tattr.h5.out.err - tbitfields_be.h5.out - tbitfields_be.h5.out.err - tbitfields_le.h5.out - tbitfields_le.h5.out.err - tcompound.h5.out - tcompound.h5.out.err - tcompound2.h5.out - tcompound2.h5.out.err - tcompound_complex.h5.out - tcompound_complex.h5.out.err - tdatareg.h5.out - tdatareg.h5.out.err - tdset.h5.out - tdset.h5.out.err - tdset2.h5.out - tdset2.h5.out.err - tempty-dtd-2.h5.out - tempty-dtd-2.h5.out.err - tempty-dtd-uri.h5.out - tempty-dtd-uri.h5.out.err - tempty-dtd.h5.out - tempty-dtd.h5.out.err - tempty-nons-2.h5.out - tempty-nons-2.h5.out.err - tempty-nons-uri.h5.out - tempty-nons-uri.h5.out.err - tempty-nons.h5.out - tempty-nons.h5.out.err - tempty-ns-2.h5.out - tempty-ns-2.h5.out.err - tempty-ns.h5.out - tempty-ns.h5.out.err - tempty.h5.out - tempty.h5.out.err - tenum.h5.out - tenum.h5.out.err - test35.nc.out - test35.nc.out.err - textlink.h5.out - textlink.h5.out.err - tfpformat.h5.out - tfpformat.h5.out.err - tgroup.h5.out - tgroup.h5.out.err - thlink.h5.out - thlink.h5.out.err - tloop.h5.out - tloop.h5.out.err - tloop2.h5.out - tloop2.h5.out.err - tmany.h5.out - tmany.h5.out.err - tname-amp.h5.out - tname-amp.h5.out.err - tname-apos.h5.out - tname-apos.h5.out.err - tname-gt.h5.out - tname-gt.h5.out.err - tname-lt.h5.out - tname-lt.h5.out.err - tname-quot.h5.out - tname-quot.h5.out.err - tname-sp.h5.out - tname-sp.h5.out.err - tnamed_dtype_attr.h5.out - tnamed_dtype_attr.h5.out.err - tnestedcomp.h5.out - tnestedcomp.h5.out.err - tnodata.h5.out - tnodata.h5.out.err - tnoname.h5.out - tnoname.h5.out.err - tnullspace.h5.out - tnullspace.h5.out.err - tobjref.h5.out - tobjref.h5.out.err - topaque.h5.out - topaque.h5.out.err - torderattr1.h5.out - torderattr1.h5.out.err - torderattr2.h5.out - torderattr2.h5.out.err - torderattr3.h5.out - torderattr3.h5.out.err - torderattr4.h5.out - torderattr4.h5.out.err - tref-escapes-at.h5.out - tref-escapes-at.h5.out.err - tref-escapes.h5.out - tref-escapes.h5.out.err - tref.h5.out - tref.h5.out.err - tsaf.h5.out - tsaf.h5.out.err - tslink.h5.out - tslink.h5.out.err - tstr.h5.out - tstr.h5.out.err - tstr2.h5.out - tstr2.h5.out.err - tstring.h5.out - tstring.h5.out.err - tstring-at.h5.out - tstring-at.h5.out.err - tudlink.h5.out - tudlink.h5.out.err - tvldtypes1.h5.out - tvldtypes1.h5.out.err - tvldtypes2.h5.out - tvldtypes2.h5.out.err - tvldtypes3.h5.out - tvldtypes3.h5.out.err - tvldtypes4.h5.out - tvldtypes4.h5.out.err - tvldtypes5.h5.out - tvldtypes5.h5.out.err - tvlstr.h5.out - tvlstr.h5.out.err - ) - set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (last_xml_test) - set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) - endif () - set (last_test "H5DUMP-XML-clearall-objects") - endif () - ########## test XML ADD_XML_H5_TEST (tall.h5 0 tall.h5) ADD_XML_H5_TEST (tattr.h5 0 tattr.h5) diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 019252f..55d5623 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -22,7 +22,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5fc_gentest COMMAND $) + #add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index e1abc48..398866c 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -108,11 +108,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -120,13 +116,13 @@ if (${testfile}) add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -142,6 +138,7 @@ add_test ( NAME H5FC-${testname}-NA COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -161,24 +158,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -197,24 +190,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -234,24 +223,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/tmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/tmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -270,7 +255,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC_CHECK_IDX-${testname} - COMMAND "$" "./testfiles/tmp.h5" "${ARGN}" + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ./testfiles/tmp.h5 ${ARGN} ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}") endif () @@ -281,24 +266,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/chktmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/chktmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -310,7 +291,7 @@ set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") add_test ( NAME H5FC_CHECK_IDX-${testname} - COMMAND "$" "./testfiles/chktmp.h5" "${ARGN}" + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ./testfiles/chktmp.h5 ${ARGN} ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}") set (last_test "H5FC_CHECK_IDX-${testname}") @@ -318,30 +299,24 @@ endmacro () macro (ADD_H5_H5DUMP_CHECK testname) - # If using memchecker add tests without using scripts + # If using memchecker skip tests if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/dmptmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err - ./testfiles/${testname}_chk.out - ./testfiles/${testname}_chk.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/dmptmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -354,6 +329,7 @@ add_test ( NAME H5FC_CHECK_DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -377,60 +353,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5FC-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5fc_help.out - h5fc_help.out.err - h5fc_nooption.out - h5fc_nooption.out.err - h5fc_nonexistfile.out - h5fc_nonexistfile.out.err - h5fc_d_file.out - h5fc_d_file.out.err - h5fc_d_file-d.out - h5fc_d_file-d.out.err - h5fc_dname.out - h5fc_dname.out.err - h5fc_nonexistdset_file.out - h5fc_nonexistdset_file.out.err - h5fc_v_non_chunked.out - h5fc_v_non_chunked.out.err - h5fc_v_bt1.out - h5fc_v_bt1.out.err - h5fc_v_ndata_bt1.out - h5fc_v_ndata_bt1.out.err - h5fc_v_all.out - h5fc_v_all.out.err - h5fc_v_n_1d.out - h5fc_v_n_1d.out.err - h5fc_v_n_all.out - h5fc_v_n_all.out.err - h5fc_ext1_i.out - h5fc_ext1_i.out.err - h5fc_ext1_s.out - h5fc_ext1_s.out.err - h5fc_ext1_f.out - h5fc_ext1_f.out.err - h5fc_ext2_if.out - h5fc_ext2_if.out.err - h5fc_ext2_is.out - h5fc_ext2_is.out.err - h5fc_ext2_sf.out - h5fc_ext2_sf.out.err - h5fc_ext3_isf.out - h5fc_ext3_isf.out.err - old_h5fc_ext1_i.out - old_h5fc_ext1_i.out.err - old_h5fc_ext1_s.out - old_h5fc_ext1_s.out.err - old_h5fc_ext1_f.out - old_h5fc_ext1_f.out.err - old_h5fc_ext2_if.out - old_h5fc_ext2_is.out.err - old_h5fc_ext2_is.out - old_h5fc_ext2_sf.out.err - old_h5fc_ext3_isf.out - old_h5fc_ext3_isf.out.err + COMMAND ${CMAKE_COMMAND} -E remove outtmp.h5 tmp.h5 chktmp.h5 diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 9d36276..22ab848 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -105,30 +105,28 @@ macro (ADD_H5_TEST testname importfile conffile testfile) # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - if (last_test) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) - endif () + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) + set_tests_properties (H5IMPORT-${testname} PROPERTIES + FIXTURES_REQUIRED set_h5importtest + ) else () add_test ( NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile} - ${testfile}.new - ${testfile}.new.err - ${testfile}.out - ${testfile}.out.err - ${testfile} + COMMAND ${CMAKE_COMMAND} -E remove ${testfile} + ) + set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED set_h5importtest ) - set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) + set_tests_properties (H5IMPORT-${testname} PROPERTIES + DEPENDS H5IMPORT-${testname}-clear-objects + ) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -138,10 +136,13 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname}) + set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES + DEPENDS H5IMPORT-${testname} + ) add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -151,7 +152,9 @@ -D "TEST_REFERENCE=${testfile}.new" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP) + set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES + DEPENDS H5IMPORT-${testname}-H5DMP + ) endif () endmacro () @@ -160,23 +163,19 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove d${testfile} d${testfile}.bin - d${testfile}.dmp - d${testfile}.dmp.err - d${testfile}.imp - d${testfile}.imp.err - d${testfile}.dff - d${testfile}.dff.err ) - set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) + set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES + DEPENDS H5IMPORT-${testname}-H5DMP_CMP + ) if ("${ARGN}" STREQUAL "BINARY") add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -189,6 +188,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -198,11 +198,14 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") + set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects" + ) add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -211,11 +214,14 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP") + set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP" + ) add_test ( NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -225,7 +231,9 @@ -D "TEST_REFERENCE=testfiles/d${testfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") + set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}" + ) endif () endmacro () @@ -234,22 +242,18 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - d-${testname}.dmp - d-${testname}.dmp.err + COMMAND ${CMAKE_COMMAND} -E remove d-${testname}.h5 - ${testname}.dmp - ${testname}.dmp.err - ${testname}.imp - ${testname}.imp.err ${testname}.bin ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED set_h5importtest + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -258,11 +262,14 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects" + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -271,10 +278,13 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP" + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -283,7 +293,9 @@ -D "TEST_REFERENCE=testfiles/${testname}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP" + ) endif () endmacro () @@ -314,8 +326,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5IMPORT-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove binfp64.bin binin8.bin binin8w.bin @@ -324,164 +335,40 @@ binuin16.bin binuin32.bin txtin32.h5 - txtin32.h5.new - txtin32.h5.new.err - txtin32.h5.out - txtin32.h5.out.err txtin16.h5 - txtin16.h5.new - txtin16.h5.new.err - txtin16.h5.out - txtin16.h5.out.err txtin8.h5 - txtin8.h5.new - txtin8.h5.new.err - txtin8.h5.out - txtin8.h5.out.err txtuin16.h5 - txtuin16.h5.new - txtuin16.h5.new.err - txtuin16.h5.out - txtuin16.h5.out.err txtuin32.h5 - txtuin32.h5.new - txtuin32.h5.new.err - txtuin32.h5.out - txtuin32.h5.out.err txtfp32.h5 - txtfp32.h5.new - txtfp32.h5.new.err - txtfp32.h5.out - txtfp32.h5.out.err txtfp64.h5 - txtfp64.h5.new - txtfp64.h5.new.err - txtfp64.h5.out - txtfp64.h5.out.err binfp64.h5 - binfp64.h5.new - binfp64.h5.new.err - binfp64.h5.out - binfp64.h5.out.err binin8.h5 - binin8.h5.new - binin8.h5.new.err - binin8.h5.out - binin8.h5.out.err binin8w.h5 - binin8w.h5.new - binin8w.h5.new.err - binin8w.h5.out - binin8w.h5.out.err binin16.h5 - binin16.h5.new - binin16.h5.new.err - binin16.h5.out - binin16.h5.out.err binin32.h5 - binin32.h5.new - binin32.h5.new.err - binin32.h5.out - binin32.h5.out.err binuin16.h5 - binuin16.h5.new - binuin16.h5.new.err - binuin16.h5.out - binuin16.h5.out.err binuin32.h5 - binuin32.h5.new - binuin32.h5.new.err - binuin32.h5.out - binuin32.h5.out.err txtstr.h5 - txtstr.h5.new - txtstr.h5.new.err - txtstr.h5.out - txtstr.h5.out.err textpfe.h5 - textpfe.h5.new - textpfe.h5.new.err - textpfe.h5.out - textpfe.h5.out.err dbinfp64.h5 dbinfp64.h5.bin - dbinfp64.h5.imp - dbinfp64.h5.imp.err - dbinfp64.h5.dmp - dbinfp64.h5.dmp.err - dbinfp64.h5.dff - dbinfp64.h5.dff.err dbinin8.h5 dbinin8.h5.bin - dbinin8.h5.imp - dbinin8.h5.imp.err - dbinin8.h5.dmp - dbinin8.h5.dmp.err - dbinin8.h5.dff - dbinin8.h5.dff.err dbinin8w.h5 dbinin8w.h5.bin - dbinin8w.h5.imp - dbinin8w.h5.imp.err - dbinin8w.h5.dmp - dbinin8w.h5.dmp.err - dbinin8w.h5.dff - dbinin8w.h5.dff.err dbinin16.h5 dbinin16.h5.bin - dbinin16.h5.imp - dbinin16.h5.imp.err - dbinin16.h5.dmp - dbinin16.h5.dmp.err - dbinin16.h5.dff - dbinin16.h5.dff.err dbinin32.h5 dbinin32.h5.bin - dbinin32.h5.imp - dbinin32.h5.imp.err - dbinin32.h5.dmp - dbinin32.h5.dmp.err - dbinin32.h5.dff - dbinin32.h5.dff.err dbinuin16.h5 dbinuin16.h5.bin - dbinuin16.h5.imp - dbinuin16.h5.imp.err - dbinuin16.h5.dmp - dbinuin16.h5.dmp.err - dbinuin16.h5.dff - dbinuin16.h5.dff.err dbinuin32.h5 dbinuin32.h5.bin - dbinuin32.h5.imp - dbinuin32.h5.imp.err - dbinuin32.h5.dmp - dbinuin32.h5.dmp.err - dbinuin32.h5.dff - dbinuin32.h5.dff.err dtxtstr.h5 dtxtstr.h5.bin - dtxtstr.h5.imp - dtxtstr.h5.imp.err - dtxtstr.h5.dmp - dtxtstr.h5.dmp.err - dtxtstr.h5.dff - dtxtstr.h5.dff.err - tall_fp32.dmp - tall_fp32.dmp.err tall_fp32.bin - tall_fp32.imp - tall_fp32.imp.err - d-tall_fp32.dmp - d-tall_fp32.dmp.err d-tall_fp32.h5 - tall_i32.dmp - tall_i32.dmp.err tall_i32.bin - tall_i32.imp - tall_i32.imp.err - d-tall_i32.dmp - d-tall_i32.dmp.err d-tall_i32.h5 ) set (last_test "H5IMPORT-clear-objects") @@ -489,8 +376,7 @@ add_test ( NAME H5IMPORT-h5importtest-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove binfp64.bin binfp64.conf binin8.bin @@ -506,13 +392,12 @@ binuin32.bin binuin32.conf ) - if (last_test) - set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5IMPORT-clear-objects") - add_test (NAME H5IMPORT-h5importtest COMMAND $) - set_tests_properties (H5IMPORT-h5importtest PROPERTIES DEPENDS H5IMPORT-h5importtest-clear-objects) + add_test (NAME H5IMPORT-h5importtest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + set_tests_properties (H5IMPORT-h5importtest PROPERTIES + FIXTURES_SETUP set_h5importtest + DEPENDS H5IMPORT-h5importtest-clear-objects + ) # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 585a8a1..6fdf7b0 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5jamgentest COMMAND $) + #add_test (NAME h5jamgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 84af48b..f108afc 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -60,21 +60,15 @@ macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () add_test ( - NAME H5JAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -85,7 +79,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${expectfile} PROPERTIES DEPENDS "H5JAM-${expectfile}-clear-objects") endif () endmacro () @@ -96,21 +89,15 @@ macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () add_test ( - NAME H5JAM-UNJAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -119,7 +106,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS "H5JAM-UNJAM-${expectfile}-clear-objects") endif () endmacro () @@ -127,18 +113,9 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5JAM-${testname}-CHECKFILE-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${actual}.new - ${actual}.new.err - ${actual}.out - ${actual}.out.err - ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends}) - add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -148,10 +125,11 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects) + set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends}) add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -187,7 +165,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -195,6 +173,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -206,7 +185,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -214,8 +193,7 @@ if (${compare_test}) add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${infile}.len.txt ${infile}.cmp ${infile}-ub.cmp @@ -224,6 +202,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" @@ -240,6 +219,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_NOUB COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=NO" @@ -267,7 +247,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) @@ -278,8 +258,7 @@ add_test ( NAME H5JAM-${testname}-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${compare_test}.len.txt ${compare_test}.cmp ${compare_test}-ub.cmp @@ -288,6 +267,7 @@ add_test ( NAME H5JAM-${testname}-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" @@ -322,7 +302,7 @@ ) set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) - add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) set (compare_test ${chkfile}) @@ -333,8 +313,7 @@ add_test ( NAME H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${compare_test}.len.txt ${compare_test}.cmp ${compare_test}-ub.cmp @@ -343,6 +322,7 @@ add_test ( NAME H5JAM-${testname}_NONE-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index cd62297..2f3f3ab 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -143,26 +143,17 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () # Remove any output file left over from previous test run add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) - add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -171,33 +162,22 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -207,23 +187,15 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5LS_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) add_test ( NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -235,7 +207,6 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clear-objects) endif () endmacro () @@ -245,128 +216,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5LS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - help-1.out - help-1.out.err - help-2.out - help-2.out.err - help-3.out - help-3.out.err - nosuchfile.out - nosuchfile.out.err - tall-1.out - tall-1.out.err - tall-2.out - tall-2.out.err - tarray1.out - tarray1.out.err - tattr2.out - tattr2.out.err - tcomp-1.out - tcomp-1.out.err - tdataregbe.out - tdataregbe.out.err - tdataregle.out - tdataregle.out.err - tdset-1.out - tdset-1.out.err - tempty.out - tempty.out.err - textlink-1.out - textlink-1.out.err - textlinksrc-1.out - textlinksrc-1.out.err - textlinksrc-2.out - textlinksrc-2.out.err - textlinksrc-3.out - textlinksrc-3.out.err - textlinksrc-4.out - textlinksrc-4.out.err - textlinksrc-5.out - textlinksrc-5.out.err - textlinksrc-6.out - textlinksrc-6.out.err - textlinksrc-7.out - textlinksrc-7.out.err - textlinksrc-1-old.out - textlinksrc-1-old.out.err - textlinksrc-2-old.out - textlinksrc-2-old.out.err - textlinksrc-3-old.out - textlinksrc-3-old.out.err - textlinksrc-6-old.out - textlinksrc-6-old.out.err - textlinksrc-7-old.out - textlinksrc-7-old.out.err - tgrp_comments.out - tgrp_comments.out.err - tgrpnullspace.out - tgrpnullspace.out.err - tsoftlinks-1.out - tsoftlinks-1.out.err - tsoftlinks-2.out - tsoftlinks-2.out.err - tsoftlinks-3.out - tsoftlinks-3.out.err - tsoftlinks-4.out - tsoftlinks-4.out.err - tsoftlinks-5.out - tsoftlinks-5.out.err - textlinksrc-nodangle-1.out - textlinksrc-nodangle-1.out.err - textlinksrc-nodangle-2.out - textlinksrc-nodangle-2.out.err - tsoftlinks-nodangle-1.out - tsoftlinks-nodangle-1.out.err - thlinks-nodangle-1.out - thlinks-nodangle-1.out.err - tgroup.out - tgroup.out.err - tgroup-1.out - tgroup-1.out.err - tgroup-2.out - tgroup-2.out.err - tgroup-3.out - tgroup-3.out.err - thlink-1.out - thlink-1.out.err - tloop-1.out - tloop-1.out.err - tnestcomp-1.out - tnestcomp-1.out.err - tnestcomp-2.out - tnestcomp-2.out.err - tnestcomp-3.out - tnestcomp-3.out.err - tnestcomp-4.out - tnestcomp-4.out.err - tsaf.out - tsaf.out.err - tslink-1.out - tslink-1.out.err - tstr-1.out - tstr-1.out.err - tudlink-1.out - tudlink-1.out.err - tvldtypes1.out - tvldtypes1.out.err - tvldtypes2le.out - tvldtypes2le.out.err - tvldtypes2be.out - tvldtypes2be.out.err - ) - set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5LS-clearall-objects") - endif () - # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which # filters are defined. diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 04fb306..cf5b6d7 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -89,26 +89,16 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5LS-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" @@ -117,14 +107,13 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -132,21 +121,11 @@ if (${resultcode} EQUAL 1) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( - NAME H5LS_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -157,7 +136,6 @@ -D "TEST_ENV_VALUE=\${ORIGIN}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) endif () endmacro () @@ -167,44 +145,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5LS_VDS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tvds-1.out - tvds-1.out.err - tvds-2.out - tvds-2.out.err - tvds-3_1.out - tvds-3_1.out.err - tvds-3_2.out - tvds-3_2.out.err - tvds-4.out - tvds-4.out.err - tvds-5.out - tvds-5.out.err - tvds_layout-1.out - tvds_layout-1.out.err - tvds_layout-2.out - tvds_layout-2.out.err - tvds_layout-3_1.out - tvds_layout-3_1.out.err - tvds_layout-3_2.out - tvds_layout-3_2.out.err - tvds_layout-4.out - tvds_layout-4.out.err - tvds_layout-5.out - tvds_layout-5.out.err - ) - set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (last_test) - set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5LS_VDS-clearall-objects") - endif () - ADD_H5_VDS_TEST (tvds-1 0 -w80 -v -S 1_vds.h5) ADD_H5_VDS_TEST (tvds-2 0 -w80 -v -S 2_vds.h5) ADD_H5_VDS_TEST (tvds-3_1 0 -w80 -v -S 3_1_vds.h5) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 50be28a..cd20f77 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -166,26 +166,15 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-h5repack-${testname}") - else () - add_test ( - NAME H5REPACK-h5repack-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/h5repack-${testname}.out - testfiles/h5repack-${testname}.out.err + add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - if (last_test) - set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + else () add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -194,39 +183,43 @@ -D "TEST_REFERENCE=h5repack-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS H5REPACK-h5repack-${testname}-clear-objects) endif () + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) endmacro () macro (ADD_H5_TEST_OLD testname testtype testfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if ("${testtype}" STREQUAL "SKIP") add_test ( NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) set_property(TEST H5REPACK_OLD-${testname} PROPERTY DISABLED) + else () + add_test ( + NAME H5REPACK_OLD-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) + add_test ( + NAME H5REPACK_OLD-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES + DEPENDS H5REPACK_OLD-${testname}-clear-objects + ) + add_test ( + NAME H5REPACK_OLD-${testname}_DFF + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES + DEPENDS H5REPACK_OLD-${testname} + ) endif () - else () - add_test ( - NAME H5REPACK_OLD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - ) - if (last_test) - set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_OLD-${testname} - COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) - add_test ( - NAME H5REPACK_OLD-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () endmacro () @@ -242,23 +235,25 @@ else () add_test ( NAME H5REPACK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK-${testname} - COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname} PROPERTIES + DEPENDS H5REPACK-${testname}-clear-objects ) - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) add_test ( NAME H5REPACK-${testname}_DFF - COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES + DEPENDS H5REPACK-${testname} ) - set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) endif () endmacro () @@ -276,26 +271,20 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (last_test) - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( NAME H5REPACK_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -305,7 +294,9 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS H5REPACK_CMP-${testname}-clear-objects) + set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES + DEPENDS H5REPACK_CMP-${testname}-clear-objects + ) endif () endif () endmacro () @@ -324,26 +315,23 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) - endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test} + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -371,24 +359,23 @@ else () add_test ( NAME H5REPACK_DMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_DMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES + DEPENDS H5REPACK_DMP-${testname}-clear-objects ) - set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -397,7 +384,9 @@ -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") + set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES + DEPENDS "H5REPACK_DMP-${testname}" + ) endif () endif () endmacro () @@ -414,24 +403,23 @@ else () add_test ( NAME H5REPACK_STAT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${statarg}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_STAT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES + DEPENDS H5REPACK_STAT-${testname}-clear-objects ) - set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -440,7 +428,9 @@ -D "TEST_REFERENCE=${statarg}.${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES DEPENDS "H5REPACK_STAT-${testname}") + set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES + DEPENDS "H5REPACK_STAT-${testname}" + ) endif () endif () endmacro () @@ -458,29 +448,30 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -490,7 +481,9 @@ -D "TEST_REFERENCE=${testfilter}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF + ) else () if ("${testfilter}" STREQUAL "CHUNKED") set (nottestfilter "(CONTIGUOUS|COMPACT)") @@ -504,6 +497,7 @@ add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -513,7 +507,9 @@ -D "TEST_REFERENCE=${testfilter}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF + ) endif () endif () endif () @@ -533,24 +529,23 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -559,8 +554,10 @@ -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname} + ) endif () endif () endmacro () @@ -570,23 +567,22 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES + DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects ) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -596,28 +592,27 @@ -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname} + ) endif () endmacro () macro (ADD_H5_VERIFY_INVALIDBOUNDS testname resultcode lowbound highbound) add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties ( - ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES - DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects - WILL_FAIL "true" + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES + DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects + WILL_FAIL "true" ) endmacro () @@ -625,28 +620,33 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_META-${testname}_N-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}_N.${testname}.h5 testfiles/out-${testname}_M.${testname}.h5 ) - if (last_test) - set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) add_test ( NAME H5REPACK_META-${testname}_N - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + ) + set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES + DEPENDS H5REPACK_META-${testname}_N-clear-objects ) - set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) add_test ( NAME H5REPACK_META-${testname}_M - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + ) + set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES + DEPENDS H5REPACK_META-${testname}_N ) - set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5) - set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true") - set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) + set_tests_properties (H5REPACK_META-${testname} PROPERTIES + WILL_FAIL "true" + DEPENDS H5REPACK_META-${testname}_M + ) endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) @@ -654,20 +654,15 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${testname}.${resultfile}.out - testfiles/${testname}.${resultfile}.out.err - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -680,10 +675,13 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects) + set_tests_properties (H5REPACK_UD-${testname} PROPERTIES + DEPENDS H5REPACK_UD-${testname}-clear-objects + ) add_test ( NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -695,7 +693,9 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}") + set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES + DEPENDS "H5REPACK_UD-${testname}" + ) endif () endmacro () @@ -739,67 +739,6 @@ if (HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run set (LIST_TO_CLEAR - h5dump-help.out - h5repack_layout.h5-chunk_18x13-v.out - h5repack_layout.h5-chunk_18x13-v.out.err - h5repack_layout.h5-chunk_20x10-v.out - h5repack_layout.h5-chunk_20x10-v.out.err - h5repack_layout.h5-chunk_compa-v.out - h5repack_layout.h5-chunk_compa-v.out.err - h5repack_layout.h5-chunk_conti-v.out - h5repack_layout.h5-chunk_conti-v.out.err - h5repack_layout.h5-compa-v.out - h5repack_layout.h5-compa-v.out.err - h5repack_layout.h5-conti-v.out - h5repack_layout.h5-conti-v.out.err - h5repack_layout.h5-deflate_limit.out - h5repack_layout.h5-deflate_limit.out.err - h5repack_layout.h5-dset2_chunk_20x10-v.out - h5repack_layout.h5-dset2_chunk_20x10-v.out.err - h5repack_layout.h5-dset2_chunk_20x10-errstk.out - h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err - h5repack_layout.h5-dset2_compa-v.out - h5repack_layout.h5-dset2_compa-v.out.err - h5repack_layout.h5-dset2_conti-v.out - h5repack_layout.h5-dset2_conti-v.out.err - h5repack_layout.h5-dset_compa_chunk-v.out - h5repack_layout.h5-dset_compa_chunk-v.out.err - h5repack_layout.h5-dset_compa_compa-v.out - h5repack_layout.h5-dset_compa_compa-v.out.err - h5repack_layout.h5-dset_compa_conti-v.out - h5repack_layout.h5-dset_compa_conti-v.out.err - h5repack_layout.h5-dset_conti_chunk-v.out - h5repack_layout.h5-dset_conti_chunk-v.out.err - h5repack_layout.h5-dset_conti_compa-v.out - h5repack_layout.h5-dset_conti_compa-v.out.err - h5repack_layout.h5-dset_conti_conti-v.out - h5repack_layout.h5-dset_conti_conti-v.out.err - h5repack_layout.h5-layout_long_switches-v.out - h5repack_layout.h5-layout_long_switches-v.out.err - h5repack_layout.h5-layout_short_switches-v.out - h5repack_layout.h5-layout_short_switches-v.out.err - h5repack_layout.h5-plugin_test.out - h5repack_layout.h5-plugin_test.out.err - h5repack_layout2.h5-contig_small_compa-v.out - h5repack_layout2.h5-contig_small_compa-v.out.err - h5repack_layout2.h5-contig_small_fixed_compa-v.out - h5repack_layout2.h5-contig_small_fixed_compa-v.out.err - h5repack_layout3.h5-ckdim_biger-v.out - h5repack_layout3.h5-ckdim_biger-v.out.err - h5repack_layout3.h5-ckdim_smaller-v.out - h5repack_layout3.h5-ckdim_smaller-v.out.err - h5repack_layout3.h5-chunk2chunk-v.out - h5repack_layout3.h5-chunk2chunk-v.out.err - h5repack_layout3.h5-chunk2compa-v.out - h5repack_layout3.h5-chunk2compa-v.out.err - h5repack_layout3.h5-chunk2conti-v.out - h5repack_layout3.h5-chunk2conti-v.out.err - h5repack_layout3.h5-error1-v.out - h5repack_layout3.h5-error1-v.out.err - h5repack_layout3.h5-error2-v.out - h5repack_layout3.h5-error2-v.out.err - h5repack_layout3.h5-error3-v.out - h5repack_layout3.h5-error3-v.out.err out-family.tfamily%05d.h5 out-HDFFV-7840.h5diff_attr1.h5 out-attr.h5repack_attr.h5 @@ -908,15 +847,15 @@ NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} ) - set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK-clearall-objects PROPERTIES + FIXTURES_SETUP clear_h5repack + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endif () ADD_HELP_TEST(help 0 -h) - add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND $) + add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) if (HDF5_ENABLE_SZIP_SUPPORT) if (HDF5_ENABLE_SZIP_ENCODING) set (passRegex "yes") @@ -931,7 +870,7 @@ endif () set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) - add_test (NAME H5REPACK-h5repacktest COMMAND $) + add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) set (last_test "H5REPACK-h5repacktest") diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index e100e3c..f88f147 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -39,6 +39,7 @@ add_test ( NAME H5REPACK-VFD-${vfdname}-h5repacktest COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -47,10 +48,6 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - if (last_test) - set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") endmacro () ############################################################################## diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 0ae570b..a89bf10 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -2907,10 +2907,10 @@ out: static int make_all_filters(hid_t loc_id) { - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ + hid_t dtid = H5I_INVALID_HID; + hid_t dsid = H5I_INVALID_HID; #if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; @@ -3083,7 +3083,7 @@ int make_early(void) hid_t tid=-1; hid_t dcpl=-1; int i; - char name[10]; + char name[16]; int iter=100; if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3178,7 +3178,7 @@ int make_layout(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - char name[6]; + char name[16]; for (i=n=0; i) + #add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 63886d0..9674a77 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -102,27 +102,15 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5STAT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -131,34 +119,21 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) endif () endmacro () macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5STAT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -168,7 +143,6 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) endif () endmacro () @@ -185,13 +159,8 @@ endforeach () add_test ( NAME H5STAT-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${CLEAR_LIST} + COMMAND ${CMAKE_COMMAND} -E remove ${CLEAR_LIST} ) - if (last_test) - set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5STAT-clearall-objects") endif () # Test for help flag diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index f5e3ea3..a250222 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -15,7 +15,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5repart_gentest COMMAND $) + #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -27,7 +27,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) - #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $) + #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_subdirectory (vds) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index c7b2fe9..a2c494d 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -94,18 +94,9 @@ macro (ADD_H5_CMP testname resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -114,26 +105,15 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) - set (last_test "H5CLEAR_CMP-${testname}") endif () endmacro () macro (ADD_H5_ERR_CMP testname resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -143,8 +123,6 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) - set (last_test "H5CLEAR_CMP-${testname}") endif () endmacro () @@ -152,25 +130,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - testfiles/${testfile} - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} + ) add_test ( NAME H5CLEAR_CMP-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" ) - set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -179,8 +152,9 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) - set (last_test "H5CLEAR_CMP-${testname}") + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-copy_${testname} + ) endif () endmacro () @@ -188,25 +162,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - testfiles/${testfile} - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} + ) add_test ( NAME H5CLEAR_CMP-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" ) - set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -216,8 +185,9 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) - set (last_test "H5CLEAR_CMP-${testname}") + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-copy_${testname} + ) endif () endmacro () @@ -225,14 +195,12 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_RET-${testname} - COMMAND $ ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} + ) + set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + WILL_FAIL "${resultcode}" ) - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") - if (last_test) - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR_RET-${testname}") endif () endmacro () @@ -240,27 +208,20 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_FILESIZE_TEST-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}_before_size.out - testfiles/${testname}_before_size.out.err - testfiles/${testname}_after_size.out - testfiles/${testname}_after_size.out.err - testfiles/${testname}.h5 - ) - if (last_test) - set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 + ) add_test ( NAME H5CLEAR_FILESIZE_TEST-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5" ) - set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects) + set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -269,34 +230,102 @@ -D "TEST_REFERENCE=${resultfile}_before_size.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname}) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname} + ) if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment=${incr_size} ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment ${testname}.h5 ) endif () - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WILL_FAIL "${resultcode}") - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size) + set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + WILL_FAIL "${resultcode}" + DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size + ) add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=${resultfile}_after_size.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_INCR-${testname} + ) + endif () + endmacro () + + macro (ADD_H5_FILESIZE_FAIL_TEST testname resultcode resultfile incr_size) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_TEST-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5" + ) + set_tests_properties (H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_TEST-${testname}-clear-objects + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_before_size.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} + ) + if (NOT ${incr_size} MATCHES "NONE") + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment=${incr_size} ${testname}.h5 + ) + else () + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment ${testname}.h5 + ) + endif () + set_tests_properties (H5CLEAR_FILESIZE_FAIL_INCR-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_after_size.out" + -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}_after_size.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_INCR-${testname}) - set (last_test "H5CLEAR_FILESIZE_CMP-${testname}_after_size") + set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_INCR-${testname} + ) endif () endmacro () @@ -304,32 +333,39 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR-clr_open_chk-copy_${testname}.h5 - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testfile}.h5" ) - if (last_test) - set_tests_properties (H5CLEAR-clr_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-clr_open_chk-copy_${testname}.h5") # Initial file open fails OR # File open succeeds because the library does not check status_flags for file with < v3 superblock - add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND $ ${testfile}.h5) - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}") - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( + NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES + WILL_FAIL "${resultcode}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5CLEAR-clr_open_chk-copy_${testname}.h5 + ) # After "h5clear" the file, the subsequent file open succeeds - add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) - set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode}) - set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND $ ${testfile}.h5) - set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES DEPENDS H5CLEAR-h5clr-${testname}) - set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set (last_test "H5CLEAR-clr_open_chk-${testname}") + add_test ( + NAME H5CLEAR-h5clr-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES + DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + add_test ( + NAME H5CLEAR-clr_open_chk-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES + DEPENDS H5CLEAR-h5clr-${testname} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endif () endmacro () @@ -341,73 +377,6 @@ # # # -# The following are tests to verify the status_flags field is cleared properly: -if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5CLEAR-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5clear_log_v3.h5 - h5clear_mdc_image.h5 - h5clear_sec2_v0.h5 - h5clear_sec2_v2.h5 - h5clear_sec2_v3.h5 - orig_h5clear_sec2_v0.h5 - orig_h5clear_sec2_v2.h5 - orig_h5clear_sec2_v3.h5 - latest_h5clear_log_v3.h5 - latest_h5clear_sec2_v3.h5 - mod_h5clear_mdc_image.h5 - mod_h5clear_mdc_image2.h5 - ${HDF5_TEST_FILES} - ) - if (last_test) - set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-clearall-objects") - - foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES}) - add_test ( - NAME H5CLEAR-copy_${h5_file} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_${h5_file}") - endforeach () - # make second copy of h5clear_sec2.h5 - foreach (h5_file ${HDF5_SEC2_TEST_FILES}) - add_test ( - NAME H5CLEAR-copy_orig_${h5_file} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_orig_${h5_file}") - endforeach () - # make second copy of mod_h5clear_mdc_image.h5 - add_test ( - NAME H5CLEAR-copy_mod_h5clr_mdc_image2.h5 - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_mod_h5clr_mdc_image2.h5 PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_mod_h5clr_mdc_image2.h5") -endif() - -# -# -# # The following are tests to verify the expected output from h5clear # "h5clear -h" # "h5clear" (no options, no file) @@ -481,9 +450,7 @@ endif() # "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action) - ADD_H5_ERR_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") - ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5) - ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5) + ADD_H5_FILESIZE_FAIL_TEST (h5clear_status_noclose 1 h5clear_status_noclose 0) # # (2) h5clear_fsm_persist_noclose.h5 # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index db1f805..11fa3f2 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -61,32 +61,26 @@ endif () macro (ADD_H5_TEST resultfile resultcode resultoption) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5MKGRP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - endif () - + add_test ( + NAME H5MKGRP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 + ) + set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) add_test ( NAME H5MKGRP-${resultfile} - COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} ) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) + set_tests_properties (H5MKGRP-${resultfile} PROPERTIES + DEPENDS H5MKGRP-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -102,20 +96,19 @@ macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 + ) + set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -124,7 +117,9 @@ -D "TEST_REFERENCE=${resultfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) + set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES + DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects + ) endif () endmacro () @@ -136,54 +131,23 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5mkgrp_help.out - h5mkgrp_help.out.err - h5mkgrp_version.out - h5mkgrp_version.out.err - h5mkgrp_single.h5 - h5mkgrp_single.out - h5mkgrp_single.out.err - h5mkgrp_single_v.h5 - h5mkgrp_single_v.out - h5mkgrp_single_v.out.err - h5mkgrp_single_p.h5 - h5mkgrp_single_p.out - h5mkgrp_single_p.out.err - h5mkgrp_single_l.h5 - h5mkgrp_single_l.out - h5mkgrp_single_l.out.err - h5mkgrp_several.h5 - h5mkgrp_several.out - h5mkgrp_several.out.err - h5mkgrp_several_v.h5 - h5mkgrp_several_v.out - h5mkgrp_several_v.out.err - h5mkgrp_several_p.h5 - h5mkgrp_several_p.out - h5mkgrp_several_p.out.err - h5mkgrp_several_l.h5 - h5mkgrp_several_l.out - h5mkgrp_several_l.out.err - h5mkgrp_nested_p.h5 - h5mkgrp_nested_p.out - h5mkgrp_nested_p.out.err - h5mkgrp_nested_lp.h5 - h5mkgrp_nested_lp.out - h5mkgrp_nested_lp.out.err - h5mkgrp_nested_mult_p.h5 - h5mkgrp_nested_mult_p.out - h5mkgrp_nested_mult_p.out.err - h5mkgrp_nested_mult_lp.h5 - h5mkgrp_nested_mult_lp.out - h5mkgrp_nested_mult_lp.out.err + COMMAND ${CMAKE_COMMAND} -E remove + h5mkgrp_single.h5 + h5mkgrp_single_v.h5 + h5mkgrp_single_p.h5 + h5mkgrp_single_l.h5 + h5mkgrp_several.h5 + h5mkgrp_several_v.h5 + h5mkgrp_several_p.h5 + h5mkgrp_several_l.h5 + h5mkgrp_nested_p.h5 + h5mkgrp_nested_lp.h5 + h5mkgrp_nested_mult_p.h5 + h5mkgrp_nested_mult_lp.h5 + ) + set_tests_properties (H5MKGRP-clearall-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5MKGRP-clearall-objects") endif () # Check that help & version is displayed properly diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 53949a2..fa49c53 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -80,31 +80,46 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + add_test ( + NAME H5REPART-h5repart_20K + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5 + ) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) + add_test ( + NAME H5REPART-h5repart_5K + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5 + ) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + add_test ( + NAME H5REPART-h5repart_single + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 + ) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes (old argument) - add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + add_test ( + NAME H5REPART-h5repart_sec2 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 + ) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # test the output files repartitioned above. - add_test (NAME H5REPART-h5repart_test COMMAND $) + add_test ( + NAME H5REPART-h5repart_test + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ) set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" ) diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index 77b154a..d6a25d5 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -118,6 +118,23 @@ endif () set_target_properties (zip_perf PROPERTIES FOLDER perform) if (H5_HAVE_PARALLEL AND BUILD_TESTING) + if (UNIX) + #-- Adding test for perf - only on unix systems + set (perf_SOURCES + ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf.c + ) + add_executable (perf ${perf_SOURCES}) + target_include_directories (perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (perf STATIC) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (perf SHARED) + target_link_libraries (perf PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () + set_target_properties (perf PROPERTIES FOLDER perform) + endif () + #-- Adding test for h5perf set (h5perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 36172d1..f0ae416 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -53,9 +53,10 @@ add_test ( ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_h5perf_serial COMMAND $) + add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -66,17 +67,20 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_h5perf_serial PROPERTIES + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME PERFORM_h5perf_serial_alone COMMAND $) + add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_chunk COMMAND $) + add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -87,12 +91,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_chunk PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_chunk PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_iopipe COMMAND $) + add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -103,12 +110,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_iopipe PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_iopipe PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_overhead COMMAND $) + add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -119,12 +129,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_overhead PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_overhead PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_perf_meta COMMAND $) + add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -135,12 +148,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_perf_meta PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_perf_meta PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf_help COMMAND $ "-h") + add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-h") else () add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -151,12 +167,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_zip_perf_help PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_zip_perf_help PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf COMMAND $ tfilters.h5) + add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ tfilters.h5) else () add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -167,9 +186,15 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_zip_perf PROPERTIES + DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects" +) if (H5_HAVE_PARALLEL) + if (UNIX) + add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + endif () + add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) if (HDF5_BUILD_PERFORM_STANDALONE) diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index c6e62d5..1d52471 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -22,6 +22,7 @@ #include "hdf5.h" #include "H5private.h" +#include "h5test.h" #ifdef H5_HAVE_PARALLEL @@ -77,7 +78,7 @@ hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t block[RANK], stride[RANK], count[RANK]; -hssize_t start[RANK]; +hsize_t start[RANK]; hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ hid_t sid; /* Dataspace ID */ @@ -240,7 +241,7 @@ int main(int argc, char **argv) */ for(j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); stride[0] = block[0] = opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -293,7 +294,7 @@ int main(int argc, char **argv) /* we are going to repeat the read the same pattern the write used */ for (j=0; j < opt_iter; j++) { /* setup a file dataspace selection */ - start[0] = (j*iter_jump)+(mynod*opt_block); + start[0] = (hsize_t)((j * iter_jump) + (mynod * opt_block)); stride[0] = block[0] = opt_block; count[0]= 1; ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); @@ -320,13 +321,13 @@ int main(int argc, char **argv) VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - if (ret < 0) fprintf(stderr, "node %d, read error, loc = %Ld: %s\n", + if (ret < 0) HDfprintf(stderr, "node %d, read error, loc = %Ld: %s\n", mynod, mynod*opt_block, strerror(myerrno)); /* if the user wanted to check correctness, compare the write * buffer to the read buffer */ if (opt_correct && memcmp(buf, buf2, opt_block)) { - fprintf(stderr, "node %d, correctness test failed\n", mynod); + HDfprintf(stderr, "node %d, correctness test failed\n", mynod); my_correct = 0; MPI_Allreduce(&my_correct, &correct, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD); @@ -435,10 +436,12 @@ parse_args(int argc, char **argv) * e.g., -a4096/512 allocate at 4096 bytes * boundary if request size >= 512. */ - {char *p; - opt_alignment = atoi(optarg); - if (p=(char*)strchr(optarg, '/')) - opt_threshold = atoi(p+1); + { + char *p; + + opt_alignment = HDatoi(optarg); + if(NULL != (p = (char*)HDstrchr(optarg, '/'))) + opt_threshold = HDatoi(p + 1); } HDfprintf(stdout, "alignment/threshold=%Hu/%Hu\n", -- cgit v0.12 From ba953e018ca81b6bad898b7b51a37531cb027748 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 25 Jul 2019 11:31:42 -0500 Subject: Minor comment fix --- config/cmake/scripts/HDF5config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index d327aa0..db73e38 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -45,7 +45,7 @@ set (CTEST_SOURCE_VERSEXT "-snap1") #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 #MODEL - CDash group name #HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub, qsub -#MPI - enable MPI; +#MPI - enable MPI if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 -- cgit v0.12 From e004576a014ba09c43ab503e9e1a4dd211b13a8e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Jul 2019 11:41:04 -0500 Subject: Revert unintended whitespace --- test/links.c | 16696 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 8345 insertions(+), 8351 deletions(-) diff --git a/test/links.c b/test/links.c index f7465ef..8d49069 100644 --- a/test/links.c +++ b/test/links.c @@ -15,28 +15,28 @@ * Programmer: Robb Matzke * Friday, April 10, 1998 * - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ /* * This file needs to access private information from the H5FD package. * This file also needs to access the file driver testing code. */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING /* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" #include "H5srcdir.h" #include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ @@ -50,67 +50,67 @@ #define SYMLINK2 TMPDIR2 "sym2.h5" const char *FILENAME[] = { - "links0", - "links1", - "links2", - "links3", - "links4a", /* 4 */ - "links4b", /* 5 */ - "links4c", /* 6 */ - "links4d", /* 7 */ - "links5", /* 8 */ - "links6", /* 9 */ - "links7", /* 10 */ - "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10",/* 30: */ - TMPDIR "extlinks11",/* 31: */ - TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13",/* 34: */ - TMPDIR "extlinks14",/* 35: */ - TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B",/* 46: */ - TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D",/* 49: */ - TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ - NULL + "links0", + "links1", + "links2", + "links3", + "links4a", /* 4 */ + "links4b", /* 5 */ + "links4c", /* 6 */ + "links4d", /* 7 */ + "links5", /* 8 */ + "links6", /* 9 */ + "links7", /* 10 */ + "links8", /* 11 */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10",/* 30: */ + TMPDIR "extlinks11",/* 31: */ + TMPDIR "extlinks12",/* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13",/* 34: */ + TMPDIR "extlinks14",/* 35: */ + TMPDIR "extlinks15",/* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B",/* 46: */ + TMPDIR2 "extlinks21C",/* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D",/* 49: */ + TMPDIR "extlinks21E",/* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -172,64 +172,64 @@ typedef struct { H5L_type_t type; /* Type of link */ } link_visit_t; static const link_visit_t lvisit0[] = { - {"Dataset_zero", H5L_TYPE_HARD}, - {"Group1", H5L_TYPE_HARD}, - {"Group1/Dataset_one", H5L_TYPE_HARD}, - {"Group1/Group2", H5L_TYPE_HARD}, - {"Group1/Group2/Dataset_two", H5L_TYPE_HARD}, - {"Group1/Group2/Type_two", H5L_TYPE_HARD}, - {"Group1/Group2/hard_zero", H5L_TYPE_HARD}, - {"Group1/Type_one", H5L_TYPE_HARD}, - {"Group1/hard_one", H5L_TYPE_HARD}, - {"Type_zero", H5L_TYPE_HARD}, - {"ext_dangle", H5L_TYPE_EXTERNAL}, - {"ext_one", H5L_TYPE_EXTERNAL}, - {"hard_one", H5L_TYPE_HARD}, - {"hard_two", H5L_TYPE_HARD}, - {"hard_zero", H5L_TYPE_HARD}, - {"soft_dangle", H5L_TYPE_SOFT}, - {"soft_one", H5L_TYPE_SOFT}, - {"soft_two", H5L_TYPE_SOFT} + {"Dataset_zero", H5L_TYPE_HARD}, + {"Group1", H5L_TYPE_HARD}, + {"Group1/Dataset_one", H5L_TYPE_HARD}, + {"Group1/Group2", H5L_TYPE_HARD}, + {"Group1/Group2/Dataset_two", H5L_TYPE_HARD}, + {"Group1/Group2/Type_two", H5L_TYPE_HARD}, + {"Group1/Group2/hard_zero", H5L_TYPE_HARD}, + {"Group1/Type_one", H5L_TYPE_HARD}, + {"Group1/hard_one", H5L_TYPE_HARD}, + {"Type_zero", H5L_TYPE_HARD}, + {"ext_dangle", H5L_TYPE_EXTERNAL}, + {"ext_one", H5L_TYPE_EXTERNAL}, + {"hard_one", H5L_TYPE_HARD}, + {"hard_two", H5L_TYPE_HARD}, + {"hard_zero", H5L_TYPE_HARD}, + {"soft_dangle", H5L_TYPE_SOFT}, + {"soft_one", H5L_TYPE_SOFT}, + {"soft_two", H5L_TYPE_SOFT} }; static const link_visit_t lvisit1[] = { - {"Dataset_one", H5L_TYPE_HARD}, - {"Group2", H5L_TYPE_HARD}, - {"Group2/Dataset_two", H5L_TYPE_HARD}, - {"Group2/Type_two", H5L_TYPE_HARD}, - {"Group2/hard_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/Group1", H5L_TYPE_HARD}, - {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, - {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL}, - {"Group2/hard_zero/hard_one", H5L_TYPE_HARD}, - {"Group2/hard_zero/hard_two", H5L_TYPE_HARD}, - {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD}, - {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT}, - {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT}, - {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT}, - {"Type_one", H5L_TYPE_HARD}, - {"hard_one", H5L_TYPE_HARD} + {"Dataset_one", H5L_TYPE_HARD}, + {"Group2", H5L_TYPE_HARD}, + {"Group2/Dataset_two", H5L_TYPE_HARD}, + {"Group2/Type_two", H5L_TYPE_HARD}, + {"Group2/hard_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/Group1", H5L_TYPE_HARD}, + {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, + {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL}, + {"Group2/hard_zero/hard_one", H5L_TYPE_HARD}, + {"Group2/hard_zero/hard_two", H5L_TYPE_HARD}, + {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD}, + {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT}, + {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT}, + {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT}, + {"Type_one", H5L_TYPE_HARD}, + {"hard_one", H5L_TYPE_HARD} }; static const link_visit_t lvisit2[] = { - {"Dataset_two", H5L_TYPE_HARD}, - {"Type_two", H5L_TYPE_HARD}, - {"hard_zero", H5L_TYPE_HARD}, - {"hard_zero/Dataset_zero", H5L_TYPE_HARD}, - {"hard_zero/Group1", H5L_TYPE_HARD}, - {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD}, - {"hard_zero/Group1/Group2", H5L_TYPE_HARD}, - {"hard_zero/Group1/Type_one", H5L_TYPE_HARD}, - {"hard_zero/Group1/hard_one", H5L_TYPE_HARD}, - {"hard_zero/Type_zero", H5L_TYPE_HARD}, - {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, - {"hard_zero/ext_one", H5L_TYPE_EXTERNAL}, - {"hard_zero/hard_one", H5L_TYPE_HARD}, - {"hard_zero/hard_two", H5L_TYPE_HARD}, - {"hard_zero/hard_zero", H5L_TYPE_HARD}, - {"hard_zero/soft_dangle", H5L_TYPE_SOFT}, - {"hard_zero/soft_one", H5L_TYPE_SOFT}, - {"hard_zero/soft_two", H5L_TYPE_SOFT} + {"Dataset_two", H5L_TYPE_HARD}, + {"Type_two", H5L_TYPE_HARD}, + {"hard_zero", H5L_TYPE_HARD}, + {"hard_zero/Dataset_zero", H5L_TYPE_HARD}, + {"hard_zero/Group1", H5L_TYPE_HARD}, + {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD}, + {"hard_zero/Group1/Group2", H5L_TYPE_HARD}, + {"hard_zero/Group1/Type_one", H5L_TYPE_HARD}, + {"hard_zero/Group1/hard_one", H5L_TYPE_HARD}, + {"hard_zero/Type_zero", H5L_TYPE_HARD}, + {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL}, + {"hard_zero/ext_one", H5L_TYPE_EXTERNAL}, + {"hard_zero/hard_one", H5L_TYPE_HARD}, + {"hard_zero/hard_two", H5L_TYPE_HARD}, + {"hard_zero/hard_zero", H5L_TYPE_HARD}, + {"hard_zero/soft_dangle", H5L_TYPE_SOFT}, + {"hard_zero/soft_one", H5L_TYPE_SOFT}, + {"hard_zero/soft_two", H5L_TYPE_SOFT} }; typedef struct { @@ -244,70 +244,70 @@ typedef struct { H5O_type_t type; /* Type of object */ } obj_visit_t; static const obj_visit_t ovisit0_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_zero", H5O_TYPE_DATASET}, - {"Group1", H5O_TYPE_GROUP}, - {"Group1/Dataset_one", H5O_TYPE_DATASET}, - {"Group1/Group2", H5O_TYPE_GROUP}, - {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_zero", H5O_TYPE_DATASET}, + {"Group1", H5O_TYPE_GROUP}, + {"Group1/Dataset_one", H5O_TYPE_DATASET}, + {"Group1/Group2", H5O_TYPE_GROUP}, + {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit0_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_zero", H5O_TYPE_DATASET}, - {"Group1", H5O_TYPE_GROUP}, - {"Group1/Dataset_one", H5O_TYPE_DATASET}, - {"Group1/Group2", H5O_TYPE_GROUP}, - {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_zero", H5O_TYPE_DATASET}, + {"Group1", H5O_TYPE_GROUP}, + {"Group1/Dataset_one", H5O_TYPE_DATASET}, + {"Group1/Group2", H5O_TYPE_GROUP}, + {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit1_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_one", H5O_TYPE_DATASET}, - {"Group2", H5O_TYPE_GROUP}, - {"Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group2/hard_zero", H5O_TYPE_GROUP}, - {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, - {"Type_one", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_one", H5O_TYPE_DATASET}, + {"Group2", H5O_TYPE_GROUP}, + {"Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group2/hard_zero", H5O_TYPE_GROUP}, + {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, + {"Type_one", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit1_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_one", H5O_TYPE_DATASET}, - {"Group2", H5O_TYPE_GROUP}, - {"Group2/Dataset_two", H5O_TYPE_DATASET}, - {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"Group2/hard_zero", H5O_TYPE_GROUP}, - {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, - {"Type_one", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_one", H5O_TYPE_DATASET}, + {"Group2", H5O_TYPE_GROUP}, + {"Group2/Dataset_two", H5O_TYPE_DATASET}, + {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"Group2/hard_zero", H5O_TYPE_GROUP}, + {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}, + {"Type_one", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit2_old[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_two", H5O_TYPE_DATASET}, - {"Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero", H5O_TYPE_GROUP}, - {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"hard_zero/Group1", H5O_TYPE_GROUP}, - {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, - {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_two", H5O_TYPE_DATASET}, + {"Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero", H5O_TYPE_GROUP}, + {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"hard_zero/Group1", H5O_TYPE_GROUP}, + {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, + {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} }; static const obj_visit_t ovisit2_new[] = { - {".", H5O_TYPE_GROUP}, - {"Dataset_two", H5O_TYPE_DATASET}, - {"Type_two", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero", H5O_TYPE_GROUP}, - {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, - {"hard_zero/Group1", H5O_TYPE_GROUP}, - {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, - {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, - {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} + {".", H5O_TYPE_GROUP}, + {"Dataset_two", H5O_TYPE_DATASET}, + {"Type_two", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero", H5O_TYPE_GROUP}, + {"hard_zero/Dataset_zero", H5O_TYPE_DATASET}, + {"hard_zero/Group1", H5O_TYPE_GROUP}, + {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET}, + {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE}, + {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE} }; typedef struct { @@ -318,7 +318,7 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ - + /*------------------------------------------------------------------------- * Function: fix_ext_filename * @@ -340,17 +340,17 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) HDstrcat(path_name, file_name); } - + /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * - * Purpose: Build a file with assorted links. + * Purpose: Build a file with assorted links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -360,52 +360,52 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) static int mklinks(hid_t fapl, hbool_t new_format) { - hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hid_t file, scalar, grp, d1; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") - else - TESTING("link creation") + else + TESTING("link creation") - /* Create a file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create a file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR + if((scalar = H5Screate_simple(1, size, size)) < 0) TEST_ERROR - /* Create a group */ - if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR + /* Create a group */ + if((grp = H5Gcreate2(file, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(grp) < 0) TEST_ERROR - /* Create a dataset */ - if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(d1) < 0) TEST_ERROR + /* Create a dataset */ + if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(d1) < 0) TEST_ERROR - /* Create a hard link */ - if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a hard link */ + if(H5Lcreate_hard(file, "d1", H5L_SAME_LOC, "grp1/hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a symbolic link */ - if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a symbolic link */ + if(H5Lcreate_soft("/d1", file, "grp1/soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a symbolic link to something that doesn't exist */ - if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a symbolic link to something that doesn't exist */ + if(H5Lcreate_soft("foobar", file, "grp1/dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a recursive symbolic link */ - if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a recursive symbolic link */ + if(H5Lcreate_soft("/grp1/recursive", file, "/grp1/recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close */ - if(H5Sclose(scalar) < 0) TEST_ERROR - if(H5Fclose(file) < 0) TEST_ERROR + /* Close */ + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Fclose(file) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: return -1; } - + /*------------------------------------------------------------------------- * Function: new_links * @@ -425,98 +425,98 @@ mklinks(hid_t fapl, hbool_t new_format) static int new_links(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); - hid_t scalar=(-1); - hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; + hid_t file_a, file_b=(-1); + hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); + hid_t scalar=(-1); + hid_t dset1=(-1), dset2=(-1); + char filename[NAME_BUF_SIZE]; hsize_t size[1] = {1}; if(new_format) TESTING("H5Lcreate functions (w/new group format)") - else - TESTING("H5Lcreate functions") + else + TESTING("H5Lcreate functions") - /* Create two files */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create two files */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file_a = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if((file_b = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR + if((scalar = H5Screate_simple (1, size, size)) < 0) TEST_ERROR - /* Create two groups in each file */ - if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create two groups in each file */ + if((grp1_a = H5Gcreate2(file_a, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp2_a = H5Gcreate2(file_a, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp1_b = H5Gcreate2(file_b, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create datasets */ - if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create datasets */ + if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create links within a file. Both of source and destination use - * H5L_SAME_LOC. Both hard and soft links should fail. */ - H5E_BEGIN_TRY { - if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; - H5E_BEGIN_TRY { - if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create links within a file. Both of source and destination use + * H5L_SAME_LOC. Both hard and soft links should fail. */ + H5E_BEGIN_TRY { + if(H5Lcreate_hard(H5L_SAME_LOC, "dataset1", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; + H5E_BEGIN_TRY { + if(H5Lcreate_soft("dataset1", H5L_SAME_LOC, "soft", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Create links across files with hard link. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Create links across files with hard link. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcreate_hard(file_a, "dataset1", file_b, "hard", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Create hard link to test H5L_SAME_LOC */ - if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create hard link to test H5L_SAME_LOC */ + if(H5Lcreate_hard(grp1_a, "dataset2", H5L_SAME_LOC, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create links to test hard links across different locations */ - if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create links to test hard links across different locations */ + if(H5Lcreate_hard(grp1_a, "dataset2", grp2_a, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close dataspace and files */ - if(H5Sclose(scalar) < 0) TEST_ERROR - if(H5Dclose(dset1) < 0) TEST_ERROR - if(H5Dclose(dset2) < 0) TEST_ERROR - if(H5Gclose(grp1_a) < 0) TEST_ERROR - if(H5Gclose(grp2_a) < 0) TEST_ERROR - if(H5Gclose(grp1_b) < 0) TEST_ERROR - if(H5Gclose(grp2_b) < 0) TEST_ERROR - if(H5Fclose(file_a) < 0) TEST_ERROR - if(H5Fclose(file_b) < 0) TEST_ERROR + /* Close dataspace and files */ + if(H5Sclose(scalar) < 0) TEST_ERROR + if(H5Dclose(dset1) < 0) TEST_ERROR + if(H5Dclose(dset2) < 0) TEST_ERROR + if(H5Gclose(grp1_a) < 0) TEST_ERROR + if(H5Gclose(grp2_a) < 0) TEST_ERROR + if(H5Gclose(grp1_b) < 0) TEST_ERROR + if(H5Gclose(grp2_b) < 0) TEST_ERROR + if(H5Fclose(file_a) < 0) TEST_ERROR + if(H5Fclose(file_b) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Sclose(scalar); - H5Dclose(dset1); - H5Dclose(dset2); - H5Gclose(grp1_a); - H5Gclose(grp2_a); - H5Gclose(grp1_b); - H5Gclose(grp2_b); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return -1; } - + /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * - * Purpose: Open the file created in the first step and check that the - * links look correct. + * Purpose: Open the file created in the first step and check that the + * links look correct. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -526,146 +526,146 @@ new_links(hid_t fapl, hbool_t new_format) static int cklinks(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + hid_t file; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") - else - TESTING("link queries") + else + TESTING("link queries") - /* Open the file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } /* end if */ + /* Hard link */ + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - H5E_BEGIN_TRY { - status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR - } /* end if */ - H5E_BEGIN_TRY { - status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR - } /* end if */ + if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ - /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ - if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + /* Symbolic link */ + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_DATASET != oinfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(linkval, "/d1")) { + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - /* Dangling link */ - H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR - } /* end if */ - if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR - } /* end if */ - if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ - if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + /* Dangling link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "foobar")) { + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ + if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR - /* Recursive link */ - H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR - } /* end if */ - if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR - } /* end if */ - if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR - } /* end if */ - if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR - } /* end if */ + /* Recursive link */ + H5E_BEGIN_TRY { + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR + } /* end if */ + if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5L_TYPE_SOFT != linfo2.type) { + H5_FAILED(); + printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR + } /* end if */ + if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR + } /* end if */ + if(HDstrcmp(linkval, "/grp1/recursive")) { + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR + } /* end if */ - /* Non-existent link */ - if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR + /* Non-existent link */ + if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Fclose(file) < 0) FAIL_STACK_ERROR + /* Cleanup */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - return -1; +error: + return -1; } - + /*------------------------------------------------------------------------- * Function: ck_new_links * @@ -684,51 +684,51 @@ cklinks(hid_t fapl, hbool_t new_format) static int ck_new_links(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + hid_t file; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") - else - TESTING("new link queries") + else + TESTING("new link queries") - /* Open the file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Open the file */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Check hard links */ - if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR - } + /* Get hard link info */ + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Check hard links */ + if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { + H5_FAILED(); + printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR + } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: return -1; } - + /*------------------------------------------------------------------------- * Function: long_links * @@ -748,63 +748,63 @@ ck_new_links(hid_t fapl, hbool_t new_format) static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ char *objname = NULL; /* Name of object [Long] */ size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") - else - TESTING("long names for objects & links") + else + TESTING("long names for objects & links") - /* Create files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for hard links) */ - if((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with short name in file (used as target for hard links) */ + if((gid = H5Gcreate2(fid, "grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Construct very long file name */ - if((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR - for(u = 0; u < MAX_NAME_LEN; u++) - objname[u] = 'a'; + /* Construct very long file name */ + if((objname = (char *)HDmalloc((size_t)(MAX_NAME_LEN + 1))) == NULL) TEST_ERROR + for(u = 0; u < MAX_NAME_LEN; u++) + objname[u] = 'a'; objname[MAX_NAME_LEN] = '\0'; /* Create hard link to existing object */ if(H5Lcreate_hard(fid, "grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create soft link to existing object */ - objname[0] = 'b'; + /* Create soft link to existing object */ + objname[0] = 'b'; if(H5Lcreate_soft("grp1", fid, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create group with long name in existing group */ - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with long name in existing group */ + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close objects */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close objects */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Release memory */ - HDfree(objname); + /* Release memory */ + HDfree(objname); PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; HDfree(objname); return -1; } - + /*------------------------------------------------------------------------- * Function: toomany * @@ -824,134 +824,134 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") - else - TESTING("too many links") + else + TESTING("too many links") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for hard links) */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create chain of hard links to existing object (no limit on #) */ - if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Create chain of soft links to existing object (limited) */ - if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Open object through last hard link */ - if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/hard21")) TEST_ERROR - - /* Create object in hard-linked group */ - if((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Close group in hard-linked group */ - if(H5Gclose(gid2) < 0) TEST_ERROR - - /* Close hard-linked object */ - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Open object through too deep soft link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); - } H5E_END_TRY; - if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR - } /* end if */ + /* Create group with short name in file (used as target for hard links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of hard links to existing object (no limit on #) */ + if(H5Lcreate_hard(fid, "final", fid, "hard1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard1", fid, "hard2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard2", fid, "hard3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard3", fid, "hard4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard4", fid, "hard5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard5", fid, "hard6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard6", fid, "hard7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard7", fid, "hard8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard8", fid, "hard9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard9", fid, "hard10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard10", fid, "hard11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard11", fid, "hard12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard12", fid, "hard13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard13", fid, "hard14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard14", fid, "hard15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard15", fid, "hard16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard16", fid, "hard17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard17", fid, "hard18", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard18", fid, "hard19", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard19", fid, "hard20", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "hard20", fid, "hard21", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open object through lesser soft link */ - if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open file */ + if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft16")) TEST_ERROR + /* Open object through last hard link */ + if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create object using soft links */ - if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/hard21")) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object in hard-linked group */ + if((gid2 = H5Gcreate2(gid, "new_hard", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close group in hard-linked group */ + if(H5Gclose(gid2) < 0) TEST_ERROR - PASSED(); - return 0; + /* Close hard-linked object */ + if(H5Gclose(gid) < 0) TEST_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; -} /* end toomany() */ + /* Open object through too deep soft link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); + } H5E_END_TRY; + if(gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR + } /* end if */ + + /* Open object through lesser soft link */ + if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft16")) TEST_ERROR + + /* Create object using soft links */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end toomany() */ + /*------------------------------------------------------------------------- * Function: test_lcpl * @@ -982,124 +982,124 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link creation property lists (w/new group format)") - else - TESTING("link creation property lists") + else + TESTING("link creation property lists") - /* Actually, intermediate group creation is tested elsewhere (tmisc). - * Here we only need to test the character encoding property */ + /* Actually, intermediate group creation is tested elsewhere (tmisc). + * Here we only need to test the character encoding property */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create and link a group with the default LCPL */ - if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create and link a group with the default LCPL */ + if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create and commit a datatype with the default LCPL */ - if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(type_id) < 0) TEST_ERROR + /* Create and commit a datatype with the default LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create a dataspace */ - dims[0] = H5L_DIM1; + /* Create a dataspace */ + dims[0] = H5L_DIM1; dims[1] = H5L_DIM2; if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR - /* Create a dataset using the default LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id) < 0) TEST_ERROR + /* Create a dataset using the default LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR - /* Check that its character encoding is the default */ - if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR + /* Check that its character encoding is the default */ + if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR - /* Create a link creation property list with the UTF-8 character encoding */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - /* Create and link a group with the new LCPL */ - if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create and link a group with the new LCPL */ + if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create and commit a datatype with the new LCPL */ - if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(type_id) < 0) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create a dataset using the new LCPL */ - if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(dset_id) < 0) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Create a new link to the dataset with a different character encoding. */ - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR - - if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - - /* Check that its character encoding is ASCII */ - if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* Check that the first link's encoding hasn't changed */ - if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Make sure that LCPLs work properly for other API calls: */ - /* H5Lcreate_soft */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* H5Lmove */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR - if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* H5Lcopy */ - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* H5Lcreate_external */ - if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Close open IDs */ - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if(H5Sclose(space_id) < 0) TEST_ERROR - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create and commit a datatype with the new LCPL */ + if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a dataset using the new LCPL */ + if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Create a new link to the dataset with a different character encoding. */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + + if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Check that its character encoding is ASCII */ + if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Check that the first link's encoding hasn't changed */ + if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Make sure that LCPLs work properly for other API calls: */ + /* H5Lcreate_soft */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lmove */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR + if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* H5Lcopy */ + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* H5Lcreate_external */ + if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Dclose(dset_id); @@ -1111,7 +1111,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) return 1; } /* end test_lcpl() */ - + /*------------------------------------------------------------------------- * Function: test_move * @@ -1131,147 +1131,147 @@ test_lcpl(hid_t fapl, hbool_t new_format) static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") - else - TESTING("H5Lmove") + else + TESTING("H5Lmove") - /* Create two new files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create two new files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create groups in first file */ - if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create groups in first file */ + if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create hard, soft and external links. */ + if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Move a group within the file. Both of source and destination use - * H5L_SAME_LOC. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Move a group within the file. Both of source and destination use + * H5L_SAME_LOC. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Move a group across files. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Move a group across files. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Move a soft link across files. Should succeed. */ - if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + /* Move a soft link across files. Should succeed. */ + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR - /* Move an external link across files. Should succeed. */ - if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR - - /* Move a group across groups in the same file while renaming it. */ - if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is no longer in the original location */ - H5E_BEGIN_TRY { - moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); - } H5E_END_TRY; - if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR - } /* end if */ - - /* Use H5Lmove to rename a group without moving it. */ - if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lmove to move a group without renaming it. */ - if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Move the group while giving long paths. */ - if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is in no previous locations */ - H5E_BEGIN_TRY { - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - } H5E_END_TRY; - - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Fclose(file_a); - H5Fclose(file_b); - - PASSED(); - return 0; - - error: - H5_FAILED(); - H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return 1; -} + /* Move an external link across files. Should succeed. */ + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR + + /* Move a group across groups in the same file while renaming it. */ + if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if( H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is no longer in the original location */ + H5E_BEGIN_TRY { + moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); + } H5E_END_TRY; + if(moved_grp >= 0) { + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR + } /* end if */ + + /* Use H5Lmove to rename a group without moving it. */ + if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group. */ + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lmove to move a group without renaming it. */ + if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group . */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Move the group while giving long paths. */ + if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is in no previous locations */ + H5E_BEGIN_TRY { + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + } H5E_END_TRY; + + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Fclose(file_a); + H5Fclose(file_b); + + PASSED(); + return 0; + error: + H5_FAILED(); + H5E_BEGIN_TRY { + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Gclose(moved_grp); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return 1; +} + /*------------------------------------------------------------------------- * Function: test_copy * @@ -1291,158 +1291,158 @@ test_move(hid_t fapl, hbool_t new_format) static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lcopy (w/new group format)") - else - TESTING("H5Lcopy") + else + TESTING("H5Lcopy") - /* Create two new files */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create two new files */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create groups in first file */ - if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create groups in first file */ + if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_2 = H5Gcreate2(file_a, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create hard, soft and external links. */ + if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Copy a group within the file. Both of source and destination use - * H5L_SAME_LOC. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Copy a group within the file. Both of source and destination use + * H5L_SAME_LOC. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Copy a group across files. Should fail. */ - H5E_BEGIN_TRY { - if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR - } H5E_END_TRY; + /* Copy a group across files. Should fail. */ + H5E_BEGIN_TRY { + if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) + !=FAIL) TEST_ERROR + } H5E_END_TRY; - /* Copy a soft link across files. Should succeed. */ - if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + /* Copy a soft link across files. Should succeed. */ + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR - /* Copy an external link across files. Should succeed. */ - if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR - - /* Move a group across groups in the same file while renaming it. */ - if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lcopy to create a group in the same location with a different name. */ - if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Use H5Lcopy to copy to a different location with the same name. */ - if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Copy the group while giving long paths. */ - if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Fclose(file_a); - H5Fclose(file_b); + /* Copy an external link across files. Should succeed. */ + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) + TEST_ERROR - PASSED(); - return 0; + /* Move a group across groups in the same file while renaming it. */ + if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - error: - H5_FAILED(); - H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); - H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); - } H5E_END_TRY; - return 1; -} + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is also in the original location */ + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lcopy to create a group in the same location with a different name. */ + if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group. */ + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + /* Verify that the group is also in the original location */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Use H5Lcopy to copy to a different location with the same name. */ + if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group . */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + /* Verify that the group is still in the previous location */ + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Copy the group while giving long paths. */ + if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Open the group just moved to the new location. */ + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + /* Verify that the group is still in all previous original locations */ + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) + TEST_ERROR + + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Fclose(file_a); + H5Fclose(file_b); + + PASSED(); + return 0; + error: + H5_FAILED(); + H5E_BEGIN_TRY { + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); + H5Gclose(moved_grp); + H5Fclose(file_a); + H5Fclose(file_b); + } H5E_END_TRY; + return 1; +} + /*------------------------------------------------------------------------- * Function: test_move_preserves * @@ -1478,41 +1478,41 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(new_format) TESTING("moving and copying links preserves their properties (w/new group format)") - else - TESTING("moving and copying links preserves their properties") - - /* Create a file creation property list with creation order stored for links - * in the root group - */ - if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR - if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR - if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR + else + TESTING("moving and copying links preserves their properties") + + /* Create a file creation property list with creation order stored for links + * in the root group + */ + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR + if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR - /* Create file */ - /* (with creation order tracking for the root group) */ - h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); + /* Create file */ + /* (with creation order tracking for the root group) */ + h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR - /* Create a link creation property list with the UTF-8 character encoding */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR + /* Create a link creation property list with the UTF-8 character encoding */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR - /* Create a group with that lcpl */ - if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Create a group with that lcpl */ + if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Get the group's link's information */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - old_cset = linfo.cset; + /* Get the group's link's information */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - old_corder = linfo.corder; + if(linfo.corder_valid != TRUE) TEST_ERROR + old_corder = linfo.corder; if(old_corder != 0) TEST_ERROR - old_modification_time = oinfo.mtime; + old_modification_time = oinfo.mtime; /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */ curr_time = HDtime(NULL); @@ -1521,103 +1521,103 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Close the file and reopen it */ if(H5Fclose(file_id) < 0) TEST_ERROR - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR - - /* Get the link's character set & modification time . They should be unchanged */ - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(old_cset != linfo.cset) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(old_corder != linfo.corder) TEST_ERROR - - /* Create a new link to the group. It should have a different creation order value but the same modification time */ - if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(old_corder == linfo.corder) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 1) TEST_ERROR - if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR - - /* Copy the first link to a UTF-8 name. - * Its creation order value should be different, but modification time - * should not change. - */ - if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 2) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the link with the default property list. */ - if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 3) TEST_ERROR - - /* Check that its character encoding is not UTF-8 */ - if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR - - /* Check that the original link is unchanged */ - if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(old_corder != linfo.corder) TEST_ERROR - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the first link to a UTF-8 name. - * Its creation order value will change, but modification time should not - * change. */ - if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 4) TEST_ERROR - - /* Check that its character encoding is UTF-8 */ - if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR - - /* Move the link again using the default property list. */ - if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR - if(old_modification_time != oinfo.mtime) TEST_ERROR - if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != 5) TEST_ERROR - - /* Check that its character encoding is not UTF-8 */ - if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR - - /* Close open IDs */ - if(H5Pclose(fcpl_id) < 0) TEST_ERROR - if(H5Pclose(lcpl_id) < 0) TEST_ERROR - if(H5Fclose(file_id) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR + + /* Get the link's character set & modification time . They should be unchanged */ + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(old_cset != linfo.cset) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + + /* Create a new link to the group. It should have a different creation order value but the same modification time */ + if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(old_corder == linfo.corder) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 1) TEST_ERROR + if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR + + /* Copy the first link to a UTF-8 name. + * Its creation order value should be different, but modification time + * should not change. + */ + if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 2) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link with the default property list. */ + if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 3) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Check that the original link is unchanged */ + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(old_corder != linfo.corder) TEST_ERROR + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the first link to a UTF-8 name. + * Its creation order value will change, but modification time should not + * change. */ + if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 4) TEST_ERROR + + /* Check that its character encoding is UTF-8 */ + if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR + + /* Move the link again using the default property list. */ + if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR + if(old_modification_time != oinfo.mtime) TEST_ERROR + if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != 5) TEST_ERROR + + /* Check that its character encoding is not UTF-8 */ + if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR + + /* Close open IDs */ + if(H5Pclose(fcpl_id) < 0) TEST_ERROR + if(H5Pclose(lcpl_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_move_preserves() */ - + /*------------------------------------------------------------------------- * Function: test_deprec * @@ -1640,7 +1640,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1648,127 +1648,127 @@ test_deprec(hid_t fapl, hbool_t new_format) if(new_format) TESTING("backwards compatibility (w/new group format)") - else - TESTING("backwards compatibility") + else + TESTING("backwards compatibility") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create two groups in the file */ - if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create two groups in the file */ + if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Test H5Gset and get comment */ - if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR - if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp(tmpstr, "comment")) TEST_ERROR + /* Test H5Gset and get comment */ + if(H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR + if(H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "comment")) TEST_ERROR - /* Create links using H5Glink and H5Glink2 */ - if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR - if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR + /* Create links using H5Glink and H5Glink2 */ + if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR - /* Test getting the names for objects */ - if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR - if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR - } H5E_END_TRY; + /* Test getting the names for objects */ + if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR + if(HDstrcmp(tmpstr, "link_to_group2")) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Gget_objname_by_idx(group1_id, (hsize_t)1, tmpstr, sizeof(tmpstr)) >= 0) TEST_ERROR + } H5E_END_TRY; + + /* Test getting the type for objects */ + if((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0) FAIL_STACK_ERROR + if(obj_type != H5G_GROUP) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0) TEST_ERROR + } H5E_END_TRY; + + /* Test getting the number of objects in a group */ + if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 2) TEST_ERROR + if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR + if(num_objs != 1) TEST_ERROR + + /* Test that H5Glink created hard links properly */ + if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + + /* Test for the other hard link created */ + if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR + + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR + } /* end if */ + + /* Test the soft link */ + if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR + if(sb_soft1.type != H5G_LINK) TEST_ERROR + if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR + + if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR + + + /* Test the dangling soft link */ + if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR + if(sb_soft2.type != H5G_LINK) TEST_ERROR + if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR + + if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("dangle", tmpstr)) TEST_ERROR + + + /* Test H5Gmove and H5Gmove2 */ + if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR + if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR + + /* Ensure that both groups can be opened */ + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR + + if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Close open IDs */ + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR + + /* Test H5Gunlink */ + if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR - /* Test getting the type for objects */ - if((obj_type = H5Gget_objtype_by_idx(group1_id, (hsize_t)0)) < 0) FAIL_STACK_ERROR - if(obj_type != H5G_GROUP) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Gget_objtype_by_idx(group1_id, (hsize_t)1) >= 0) TEST_ERROR - } H5E_END_TRY; - - /* Test getting the number of objects in a group */ - if(H5Gget_num_objs(file_id, &num_objs) < 0) FAIL_STACK_ERROR - if(num_objs != 2) TEST_ERROR - if(H5Gget_num_objs(group1_id, &num_objs) < 0) FAIL_STACK_ERROR - if(num_objs != 1) TEST_ERROR - - /* Test that H5Glink created hard links properly */ - if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - - if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - - /* Test for the other hard link created */ - if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR - if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - - if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR - } /* end if */ - - /* Test the soft link */ - if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR - if(sb_soft1.type != H5G_LINK) TEST_ERROR - if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR - - if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR - - - /* Test the dangling soft link */ - if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR - if(sb_soft2.type != H5G_LINK) TEST_ERROR - if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR - - if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR - if(HDstrcmp("dangle", tmpstr)) TEST_ERROR - - - /* Test H5Gmove and H5Gmove2 */ - if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR - if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR - - /* Ensure that both groups can be opened */ - if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR - if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR - - if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Close open IDs */ - if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR - if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR - - /* Test H5Gunlink */ - if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR - - H5E_BEGIN_TRY { - if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY; - - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose(group2_id); - H5Gclose(group1_id); - H5Fclose(file_id); - } H5E_END_TRY; - return 1; + H5E_BEGIN_TRY { + if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY; + + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(group2_id); + H5Gclose(group1_id); + H5Fclose(file_id); + } H5E_END_TRY; + return 1; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: external_link_root * @@ -1788,147 +1788,147 @@ test_deprec(hid_t fapl, hbool_t new_format) static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - const char *file; /* File from external link */ - const char *path; /* Path from external link */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ if(new_format) TESTING("external link to root (w/new group format)") - else - TESTING("external link to root") + else + TESTING("external link to root") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create file to point to */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that external links are registered with the library */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + /* Check that external links are registered with the library */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - /* Create file with link to first file */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to first file */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + /* Check information for external link */ + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ /* (add a few extra '/'s to make certain library normalizes external link object names) */ if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check information for external link */ - if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; + /* Check information for external link */ + if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR - if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR + if(HDstrcmp(file, filename1)) { + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR - if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a new object using H5Gcreate2 through the external link - * directly - */ - if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create a new object using H5Gcreate2 through the external link + * directly + */ + if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close file and group */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file and group */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - H5F_sfile_assert_num(0); + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Open first file again with read-only access and check on objects created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open objects created through external link */ - if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open objects created through external link */ + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check names */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/new_group")) TEST_ERROR - if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/newer_group")) TEST_ERROR + /* Check names */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/new_group")) TEST_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/newer_group")) TEST_ERROR - /* Close opened objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close opened objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR - H5F_sfile_assert_num(0); + /* Check that all file IDs have been closed */ + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + H5F_sfile_assert_num(0); /* Verify that new objects can't be created through a read-only external - * link. - */ + * link. + */ if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY if(gid >= 0) TEST_ERROR @@ -1943,16 +1943,16 @@ external_link_root(hid_t fapl, hbool_t new_format) PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_root() */ - + /*------------------------------------------------------------------------- * Function: external_link_path * @@ -1973,94 +1973,94 @@ external_link_root(hid_t fapl, hbool_t new_format) static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") - else - TESTING("external link to object on path") + else + TESTING("external link to object on path") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create file to point to */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object down a path */ - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object down a path */ + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file with link to first file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to first file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close second file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close second file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_path() */ - + /*------------------------------------------------------------------------- * Function: external_link_mult * @@ -2081,21 +2081,21 @@ external_link_path(hid_t fapl, hbool_t new_format) static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1), fid2 = (-1); /* File IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") - else - TESTING("external links across multiple files") + else + TESTING("external links across multiple files") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); @@ -2103,128 +2103,128 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Create first file to point to */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object down a path */ - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object down a path */ + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link down a path */ - if((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create external link down a path */ + if((gid = H5Gcreate2(fid, "D", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "D/E", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename1, "/A/B/C", gid, "F", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create third file to point to */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create third file to point to */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link down a path */ - if((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create external link down a path */ + if((gid = H5Gcreate2(fid, "G", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "G/H", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to object in second file */ - if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in second file */ + if(H5Lcreate_external(filename2, "/D/E/F", gid, "I", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file with link to third file */ - if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file with link to third file */ + if((fid=H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to object in first file */ - if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to object in first file */ + if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close second file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close second file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open an object through external links */ - if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open an object through external links */ + if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* The intermediate files should not stay open. Replace one of them with a new file. */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR + /* The intermediate files should not stay open. Replace one of them with a new file. */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR - /* Open the other with write access and delete the external link in it */ - if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR + /* Open the other with write access and delete the external link in it */ + if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_mult() */ - + /*------------------------------------------------------------------------- * Function: external_link_self * @@ -2244,136 +2244,136 @@ external_link_mult(hid_t fapl, hbool_t new_format) static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t lcpl_id = (-1); /* Link Creation Property List ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") - else - TESTING("external link to self") + else + TESTING("external link to self") - /* Set up filename */ - h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); + /* Set up filename */ + h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[2], fapl, filename2, sizeof filename1); h5_fixname(FILENAME[3], fapl, filename3, sizeof filename1); /* Create file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create an lcpl with intermediate group creation set */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + /* Create an lcpl with intermediate group creation set */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - /* Create a series of groups within the file: /A/B and /X/Y/Z */ - if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a series of groups within the file: /A/B and /X/Y/Z */ + if((gid = H5Gcreate2(fid, "A/B", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "X/Y", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Pclose (lcpl_id) < 0) TEST_ERROR + if(H5Pclose (lcpl_id) < 0) TEST_ERROR - /* Create external link to own root group*/ - if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to own root group*/ + if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X")) TEST_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close created group */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close created group */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close object opened through external link */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close object opened through external link */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Check on object created */ - if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Check on object created */ + if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/X/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + /* Complicate things. Use this file as an intermediate file in a chain + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ - /* Create file2 with an external link to file1 */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file2 with an external link to file1 */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file2 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create file3 as a target */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Create file3 as a target */ + if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "end", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file1 and create an extlink pointing to file3 */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open file1 and create an extlink pointing to file3 */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid, "/X/Y/Z", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file1 */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file1 */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ - if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ + if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create object through external link */ - if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object through external link */ + if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Cleanup */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open up file3 and make sure the object was created successfully */ - if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open up file3 and make sure the object was created successfully */ + if((fid = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Cleanup */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Cleanup */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(lcpl_id); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ - + /*------------------------------------------------------------------------- * Function: external_link_pingpong * @@ -2401,101 +2401,101 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") - else - TESTING("external links back and forth") + else + TESTING("external links back and forth") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/final", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object (lets first file close) */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object (lets first file close) */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file again and check on object created */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object created through external link */ - if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object created through external link */ + if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ - + /*------------------------------------------------------------------------- * Function: external_link_toomany * @@ -2536,22 +2536,22 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") - else - TESTING("too many external links") + else + TESTING("too many external links") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Set up filenames */ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); @@ -2560,92 +2560,92 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external links for chain */ - if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create external links for chain */ - if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Create final object */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "link1", H5P_DEFAULT); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; - } + /* Create external links for chain */ + if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link4", fid, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link6", fid, "link5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link8", fid, "link7", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link10", fid, "link9", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link12", fid, "link11", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link14", fid, "link13", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/link16", fid, "link15", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/final", fid, "link17", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Create second file */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external links for chain */ + if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link5", fid, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link7", fid, "link6", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link9", fid, "link8", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link11", fid, "link10", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link13", fid, "link12", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link15", fid, "link14", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/link17", fid, "link16", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Create final object */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "link1", H5P_DEFAULT); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; + } - PASSED(); - return 0; + /* Open object through external link */ + if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; -} /* end external_link_toomany() */ + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/final")) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR -/*------------------------------------------------------------------------- - * Function: external_link_dangling - * - * Purpose: Build a file with "dangling" external links: with both - * missing files and missing objects. - * + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR + + /* Close external object */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; +} /* end external_link_toomany() */ + + +/*------------------------------------------------------------------------- + * Function: external_link_dangling + * + * Purpose: Build a file with "dangling" external links: with both + * missing files and missing objects. + * * Return: Success: 0 * * Failure: -1 @@ -2660,53 +2660,53 @@ external_link_toomany(hid_t fapl, hbool_t new_format) static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t rid = (-1); /* Root Group ID */ hid_t status = (-1); /* Status */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("dangling external links (w/new group format)") - else - TESTING("dangling external links") + else + TESTING("dangling external links") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create dangling external links */ - if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling external links */ + if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/missing", fid, "no_object", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file (for dangling object test) */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file (for dangling object test) */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Get root group ID */ - if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + /* Get root group ID */ + if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; /* Open object through dangling file external link */ H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); + gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2714,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2731,31 +2731,31 @@ external_link_dangling(hid_t fapl, hbool_t new_format) /* Close root group */ if(H5Gclose(rid) < 0) TEST_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_dangling() */ - + /*------------------------------------------------------------------------- * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 @@ -2771,84 +2771,84 @@ external_link_dangling(hid_t fapl, hbool_t new_format) static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + hid_t gapl_id = (-1); + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") - else - TESTING("external links via H5Pset_elink_prefix()") + else + TESTING("external links via H5Pset_elink_prefix()") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for external linked target file: "extlinks2" */ h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2); /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR - /* set up name for target file: "tmp/extlinks2" */ - h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); + /* set up name for target file: "tmp/extlinks2" */ + h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file (without the absolute path) */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file (without the absolute path) */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* set up prefix for external link */ - if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR + /* set up prefix for external link */ + if((gapl_id = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_prefix(gapl_id, TMPDIR) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", gapl_id); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", gapl_id); + } H5E_END_TRY; - /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_prefix() */ - + /*------------------------------------------------------------------------- * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 @@ -2863,21 +2863,21 @@ external_link_prefix(hid_t fapl, hbool_t new_format) static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's absolute path (w/new group format)") - else - TESTING("external links via main file's absolute path") + else + TESTING("external links via main file's absolute path") - /* set up name for external linked target file: "extlinks3" */ - h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks3" */ + h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks3" */ h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3); @@ -2885,64 +2885,64 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Window: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Window: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from absolute path set for main file */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file from absolute path set for main file */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abs_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_rel_mainpath: test 4 * - * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * Purpose: 1. target link: "extlinks4" + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 @@ -2957,77 +2957,77 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + relative path(w/new group format)") - else - TESTING("external links via main file's CWD + relative path") + else + TESTING("external links via main file's CWD + relative path") - /* set up name for external linked target file: "extlinks4" */ - h5_fixname(FILENAME[20], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks4" */ + h5_fixname(FILENAME[20], fapl, filename2, sizeof filename2); if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for main file: "tmp/extlinks0" */ - h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); + /* set up name for main file: "tmp/extlinks0" */ + h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); /* set up name for target file: "tmp/extlinks4" */ h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from the main file's relative pathname */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; - } + /* should be able to find the target file from the main file's relative pathname */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_rel_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * * Return: Success: 0 @@ -3043,85 +3043,85 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via current working directory(w/new group format)") - else - TESTING("external links via current working directory") + else + TESTING("external links via current working directory") - /* set up name for external linked target file: "extlinks5" */ - /* set up name for target file: "extlinks5" */ - h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks5" */ + /* set up name for target file: "extlinks5" */ + h5_fixname(FILENAME[22], fapl, filename2, sizeof filename2); if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* Create the target file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from the current working directory */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; - } + /* should be able to find the target file from the current working directory */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_cwd() */ - + /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 @@ -3136,32 +3136,32 @@ external_link_cwd(hid_t fapl, hbool_t new_format) static int external_link_abstar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's absolute path (w/new group format)") - else - TESTING("external links via target's absolute path") + else + TESTING("external links via target's absolute path") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[23]); + /* + * set up name for external linked target file: + * Linux: "/CWD/tmp/extlinks6" + * Windows: ":/CWD/tmp/extlinks6" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks6" */ @@ -3169,53 +3169,53 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file with abolute path */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* should be able to find the target file with abolute path */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abstar() */ /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 @@ -3230,21 +3230,21 @@ external_link_abstar(hid_t fapl, hbool_t new_format) static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD (w/new group format)") - else - TESTING("external links via main file's CWD") + else + TESTING("external links via main file's CWD") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target file name: "extlinks7" */ h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3); @@ -3253,64 +3253,64 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* - * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[25]); + /* + * set up name for external linked target file: + * Linux: "/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file from main file's current working directory */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; - } + /* should be able to find the target file from main file's current working directory */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_abstar_cur() */ - + /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 @@ -3325,74 +3325,74 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + target's relative path(w/new group format)") - else - TESTING("external links via main file's CWD + target's relative path") + else + TESTING("external links via main file's CWD + target's relative path") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name: "tmp/extlinks8" */ - /* set up name for external linked target file: "tmp/extlinks8" */ - h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); + /* set up name for target file name: "tmp/extlinks8" */ + /* set up name for external linked target file: "tmp/extlinks8" */ + h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); /* Create the target file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "///A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } /* end if */ + /* Open object through external link */ + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } /* end if */ /* closing for main file */ if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_reltar() */ - + /*------------------------------------------------------------------------- * Function: external_link_chdir: test 9 * * Purpose: - * 1. target link: "extlinks9" - * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" - * Should be able to access the target file in current working directory + * 1. target link: "extlinks9" + * 2. main file: "extlinks0" + * 3. target file" "tmp/extlinks9" + * 3. chdir "tmp" + * Should be able to access the target file in current working directory * * Return: Success: 0 * Failure: -1 @@ -3407,19 +3407,19 @@ external_link_reltar(hid_t fapl, hbool_t new_format) static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via chdir and found in current working directory (w/new group format)") - else - TESTING("external links via chdir and found in current working directory") + else + TESTING("external links via chdir and found in current working directory") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for external linked target file ("extlinks9") */ h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); @@ -3427,75 +3427,75 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name ("tmp/extlinks9") */ - h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); + /* set up name for target file name ("tmp/extlinks9") */ + h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if (HDchdir(TMPDIR) < 0) TEST_ERROR + if (HDchdir(TMPDIR) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - if (HDchdir("..") < 0) TEST_ERROR + if (HDchdir("..") < 0) TEST_ERROR - /* - * Should be able to find the target file from: - * main file's current working directory + pathname of external linked targetfile - */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; - } + /* + * Should be able to find the target file from: + * main file's current working directory + pathname of external linked targetfile + */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_chdir() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. - * - * 1. target link: "extlinks16" - * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file A to be a "family" file: extlinks16A - * 4. Create target file B to be a "multi" file: extlinks16B - * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A - * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B - * 6. Should succeed in opening the target object: ext_extA - * 6. Should succeed in opening the target object: ext_extB + * different from the parent can be successfully opened. + * + * 1. target link: "extlinks16" + * 2. target file: "extlinks16" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file A to be a "family" file: extlinks16A + * 4. Create target file B to be a "multi" file: extlinks16B + * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A + * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B + * 6. Should succeed in opening the target object: ext_extA + * 6. Should succeed in opening the target object: ext_extB * * Return: Success: 0 * Failure: -1 @@ -3510,37 +3510,37 @@ external_link_chdir(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl1(hid_t fapl, hbool_t new_format) { - hid_t fid=(-1); - hid_t fidA=(-1), fidB=(-1); - hid_t gidA=(-1), gidB=(-1); - hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; - hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + hid_t fid=(-1); + hid_t fidA=(-1), fidB=(-1); + hid_t gidA=(-1), gidB=(-1); + hid_t oidA=(-1), oidB=(-1); + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hid_t fam_fapl=-1, multi_fapl=-1; + hid_t lapl_idA=-1, lapl_idB=-1; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") - else - TESTING("H5Pset/get_elink_fapl() with different physical layouts") + else + TESTING("H5Pset/get_elink_fapl() with different physical layouts") - if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) + TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* create "family" fapl */ @@ -3560,8 +3560,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's'); + sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); + sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); + sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); + sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); + sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); + sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -3604,102 +3604,102 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* Create target file A to be a "family" file */ if((fidA=H5Fcreate(filename2A, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR - if((gidA=H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create target file B to be a "multi" file */ - if((fidB=H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0) TEST_ERROR - if((gidB=H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gidA=H5Gcreate2(fidA, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target files */ - if(H5Gclose(gidA) < 0) TEST_ERROR - if(H5Gclose(gidB) < 0) TEST_ERROR - if(H5Fclose(fidA) < 0) TEST_ERROR - if(H5Fclose(fidB) < 0) TEST_ERROR + /* Create target file B to be a "multi" file */ + if((fidB=H5Fcreate(filename2B, H5F_ACC_TRUNC, H5P_DEFAULT, multi_fapl)) < 0) TEST_ERROR + if((gidB=H5Gcreate2(fidB, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* closing for target files */ + if(H5Gclose(gidA) < 0) TEST_ERROR + if(H5Gclose(gidB) < 0) TEST_ERROR + if(H5Fclose(fidA) < 0) TEST_ERROR + if(H5Fclose(fidB) < 0) TEST_ERROR - /* Create external link to target file A:/A */ - if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - /* Create external link to target file B:/B */ - if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create external link to target file A:/A */ + if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + /* Create external link to target file B:/B */ + if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Set file access property list for link access to use the family driver */ - if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the family driver */ + if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_idA, fam_fapl) < 0) TEST_ERROR - /* open target object A */ - oidA = H5Oopen(fid, "ext_linkA", lapl_idA); + /* open target object A */ + oidA = H5Oopen(fid, "ext_linkA", lapl_idA); /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ if((lapl_idB = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_idB, multi_fapl) < 0) TEST_ERROR - /* open target object B */ - oidB = H5Oopen(fid, "ext_linkB", lapl_idB); + /* open target object B */ + oidB = H5Oopen(fid, "ext_linkB", lapl_idB); /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ if(H5Pclose(lapl_idA) < 0) TEST_ERROR - if(H5Pclose(lapl_idB) < 0) TEST_ERROR - if(H5Pclose(fam_fapl) < 0) TEST_ERROR - if(H5Pclose(multi_fapl) < 0) TEST_ERROR - if(H5Oclose(oidA) < 0) TEST_ERROR - if(H5Oclose(oidB) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(lapl_idB) < 0) TEST_ERROR + if(H5Pclose(fam_fapl) < 0) TEST_ERROR + if(H5Pclose(multi_fapl) < 0) TEST_ERROR + if(H5Oclose(oidA) < 0) TEST_ERROR + if(H5Oclose(oidB) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl1() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. - * - * 1. target link: "extlinks17" - * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. + * + * 1. target link: "extlinks17" + * 2. target file: "extlinks17" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 6. Should succeed in opening the target dataset: ext_link + * 7. Write data to the target dataset + * 8. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 @@ -3714,32 +3714,32 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hsize_t dims[2]; - int points[NUM40][NUM40]; - h5_stat_size_t filesize, new_filesize; - int i, j, n; + int points[NUM40][NUM40]; + h5_stat_size_t filesize, new_filesize; + int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") - else - TESTING("H5Pset/get_elink_fapl() with same physical layout") + else + TESTING("H5Pset/get_elink_fapl() with same physical layout") - if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) + TEST_ERROR - /* - * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" - */ - fix_ext_filename(tmpname, cwdpath, FILENAME[13]); + /* + * set up name for main file: + * Linux: "/CWD/tmp/extlinks0" + * Windows: ":/CWD/tmp/extlinks0" + */ + fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* create fapl for the target file to be a "core" file */ @@ -3747,57 +3747,53 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR - /* set up name for external linked target file: "extlinks17" */ - /* set up name for target file: "extlinks17" */ - h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); + /* set up name for external linked target file: "extlinks17" */ + /* set up name for target file: "extlinks17" */ + h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2); /* Create the target file to be a "core" file */ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - dims[0] = NUM40; + dims[0] = NUM40; dims[1] = NUM40; if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - /* Create dataset creation property list */ - if (dcpl_g == H5P_DEFAULT) - dcpl = H5Pcreate(H5P_DATASET_CREATE); - else - dcpl = H5Pcopy(dcpl_g); - if (0 > dcpl) TEST_ERROR; + /* Create dataset creation property list */ + if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR - /* closing for target file */ - if(H5Pclose(dcpl) < 0) TEST_ERROR - if(H5Sclose(space) < 0) TEST_ERROR - if(H5Dclose(dset) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Pclose(dcpl) < 0) TEST_ERROR + if(H5Sclose(space) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* get size of target file */ - filesize = h5_get_file_size(filename2, core_fapl); + /* get size of target file */ + filesize = h5_get_file_size(filename2, core_fapl); /* Create the main file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ - if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ + if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* create fapl to be a "core" file without backing store */ - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR + /* create fapl to be a "core" file without backing store */ + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) + TEST_ERROR - /* Set file access property list for link access to use the "core" driver */ - if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(dapl_id, core_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "core" driver */ + if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(dapl_id, core_fapl) < 0) TEST_ERROR - /* try to open the external linked target dataset */ - did = H5Dopen2(fid, "ext_link", dapl_id); + /* try to open the external linked target dataset */ + did = H5Dopen2(fid, "ext_link", dapl_id); if(did < 0) { H5_FAILED(); HDputs(" Should succeed in opening the target dataset"); @@ -3813,55 +3809,55 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR - if(H5Pclose(dapl_id) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(dapl_id) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - new_filesize = h5_get_file_size(filename2, core_fapl); + new_filesize = h5_get_file_size(filename2, core_fapl); /* the file size should remain the same since there is no backing store */ if(new_filesize != filesize) TEST_ERROR - if(H5Pclose(core_fapl) < 0) TEST_ERROR + if(H5Pclose(core_fapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl2() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl - * 10. Verify that the copied link access's fapl is the core driver - * 11. Get the fapl property value of the copied link access - * 12. H5Premove() the fapl property from the copied link access - * 13. H5Pclose() fapl set in the copied link access should fail since the - * removal in #12 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * 10. Verify that the copied link access's fapl is the core driver + * 11. Get the fapl property value of the copied link access + * 12. H5Premove() the fapl property from the copied link access + * 13. H5Pclose() fapl set in the copied link access should fail since the + * removal in #12 should also close its fapl * * Return: Success: 0 * Failure: -1 @@ -3877,64 +3873,64 @@ static int external_set_elink_fapl3(hbool_t new_format) { hid_t core_fapl = -1, stdio_fapl = -1; - hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; + hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) TESTING("H5Pset/get_fapl() (w/new group format)") - else - TESTING("H5Pset/get_fapl()") + else + TESTING("H5Pset/get_fapl()") - /* create fapl for the target file to be a "core" file */ - core_fapl = h5_fileaccess(); + /* create fapl for the target file to be a "core" file */ + core_fapl = h5_fileaccess(); if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR - stdio_fapl = h5_fileaccess(); + stdio_fapl = h5_fileaccess(); if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR - /* Set file access property list for link access to use the "stdio" driver */ - if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "stdio" driver */ + if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_fapl(lapl_id, stdio_fapl) < 0) TEST_ERROR - /* Verify that the driver for the link's fapl is the "stdio" driver */ - if((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0) TEST_ERROR - if(H5Pget_driver(l_fapl) != H5FD_STDIO) TEST_ERROR - if(H5Pclose(l_fapl) < 0) TEST_ERROR + /* Verify that the driver for the link's fapl is the "stdio" driver */ + if((l_fapl = H5Pget_elink_fapl(lapl_id)) < 0) TEST_ERROR + if(H5Pget_driver(l_fapl) != H5FD_STDIO) TEST_ERROR + if(H5Pclose(l_fapl) < 0) TEST_ERROR - /* Set file access property list for link access to use the "core" driver */ - if(H5Pset_elink_fapl(lapl_id, core_fapl) < 0) TEST_ERROR + /* Set file access property list for link access to use the "core" driver */ + if(H5Pset_elink_fapl(lapl_id, core_fapl) < 0) TEST_ERROR - /* Make a copy of the link access property */ - if((new_lapl_id = H5Pcopy(lapl_id)) < 0) TEST_ERROR + /* Make a copy of the link access property */ + if((new_lapl_id = H5Pcopy(lapl_id)) < 0) TEST_ERROR - /* get the fapl set in lapl_id */ - if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR - if(H5Pclose(lapl_id) < 0) TEST_ERROR + /* get the fapl set in lapl_id */ + if(H5Pget(lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR + if(H5Pclose(lapl_id) < 0) TEST_ERROR - /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ - if(H5Pclose(out_fapl) < 0) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR - /* Verify that the driver for the copied link's fapl is the "core" driver */ - if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR - if(H5Pget_driver(l_fapl) != H5FD_CORE) TEST_ERROR + /* Verify that the driver for the copied link's fapl is the "core" driver */ + if((l_fapl = H5Pget_elink_fapl(new_lapl_id)) < 0) TEST_ERROR + if(H5Pget_driver(l_fapl) != H5FD_CORE) TEST_ERROR - /* get the fapl set in new_lapl_id */ - if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR - if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR + /* get the fapl set in new_lapl_id */ + if(H5Pget(new_lapl_id, "external link fapl", &out_fapl) < 0) TEST_ERROR + if(H5Premove(new_lapl_id, "external link fapl") < 0) TEST_ERROR - /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ - if(H5Pclose(out_fapl) < 0) TEST_ERROR + /* Try closing out_fapl, should succeed since H5Pget() should clone its fapl */ + if(H5Pclose(out_fapl) < 0) TEST_ERROR - if(H5Pclose(l_fapl) < 0) TEST_ERROR - if(H5Pclose(new_lapl_id) < 0) TEST_ERROR - if(H5Pclose(core_fapl) < 0) TEST_ERROR - if(H5Pclose(stdio_fapl) < 0) TEST_ERROR + if(H5Pclose(l_fapl) < 0) TEST_ERROR + if(H5Pclose(new_lapl_id) < 0) TEST_ERROR + if(H5Pclose(core_fapl) < 0) TEST_ERROR + if(H5Pclose(stdio_fapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Pclose(l_fapl); H5Pclose(lapl_id); @@ -3945,7 +3941,7 @@ external_set_elink_fapl3(hbool_t new_format) return -1; } /* end external_set_elink_fapl3() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_acc_flags * @@ -3966,207 +3962,207 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo { hid_t file1 = -1, file2 = -1, group = -1, subgroup = -1, gapl = -1; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE]; herr_t ret; unsigned flags; if(new_format) TESTING("H5Pset/get_elink_acc_flags() (w/new group format)") - else - TESTING("H5Pset/get_elink_acc_flags()") + else + TESTING("H5Pset/get_elink_acc_flags()") - /* Create parent and target files, and external link */ - h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); + /* Create parent and target files, and external link */ + h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[41], fapl, filename2, sizeof filename2); if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/", file1, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file2, leave file1 open (should be read-write) */ - if(H5Fclose(file2) < 0) TEST_ERROR + /* Close file2, leave file1 open (should be read-write) */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR + /* Create new gapl, and set elink access flags to be H5F_ACC_RDONLY */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) TEST_ERROR - /* Verify "get" routine functionality */ - if(H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR - if(flags != H5F_ACC_RDONLY) TEST_ERROR + /* Verify "get" routine functionality */ + if(H5Pget_elink_acc_flags(gapl, &flags) < 0) TEST_ERROR + if(flags != H5F_ACC_RDONLY) TEST_ERROR - /* Attempt to create a group through the external link using gapl (should fail) */ - H5E_BEGIN_TRY { - group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); - } H5E_END_TRY; - if(group != FAIL) TEST_ERROR - - /* Close file1 and reopen with read only access */ - if(H5Fclose(file1) < 0) TEST_ERROR - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR - - /* Create a group through the external link using gapl (should succeed) */ - if((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR - - /* Close group */ - if(H5Gclose(group) < 0) TEST_ERROR - - /* Unset elink access flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR - - /* Attempt to create a group through the external link using gapl (should fail) */ - H5E_BEGIN_TRY { - subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl); - } H5E_END_TRY; - if(subgroup != FAIL) TEST_ERROR - - /* Attempt to set SWMR flags on gapl. - * This is just a smoke check of the flags. The actual external link - * functionality is tested in the SWMR tests. - */ - /* Set SWMR reader flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0) TEST_ERROR - /* Set SWMR writer flags on gapl */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0) TEST_ERROR - - /* Attempt to set invalid flags on gapl */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - /* SWMR reader with write access */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - /* SWMR writer with read-only access */ - H5E_BEGIN_TRY { - ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); - } H5E_END_TRY; - if(ret != FAIL) TEST_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - - /* Only run this part with VFDs that support SWMR */ - if(H5FD_supports_swmr_test(env_h5_drvr)) { - - /* Reopen file1, with read-write and SWMR-write access */ - /* Only supported under the latest file format */ - if(new_format) { - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using default gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDWR) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - } - - /* Reopen file1, with read-only and SWMR-read access */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using default gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ - if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR - - /* Open a group through the external link using gapl */ - if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR - - /* Verify that the correct parameters have been set on file2 */ - if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR - if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR - if(flags != H5F_ACC_RDONLY) TEST_ERROR - - /* Close file2 and group */ - if(H5Gclose(group) < 0) FAIL_STACK_ERROR - if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - - /* Close file1 */ - if(H5Fclose(file1) < 0) TEST_ERROR - } /* end if */ - - - /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ - H5E_BEGIN_TRY { - file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - H5E_BEGIN_TRY { - file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); - } H5E_END_TRY; - if(file1 != FAIL) TEST_ERROR - - /* Close gapl */ - if(H5Pclose(gapl) < 0) TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose(group); - H5Gclose(subgroup); - H5Fclose(file1); - H5Fclose(file2); - H5Pclose(gapl); - } H5E_END_TRY; - return -1; -} /* end external_set_elink_acc_flags() */ + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if(group != FAIL) TEST_ERROR + + /* Close file1 and reopen with read only access */ + if(H5Fclose(file1) < 0) TEST_ERROR + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) TEST_ERROR + + /* Create a group through the external link using gapl (should succeed) */ + if((group = H5Gcreate2(file1, "/ext_link/group", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(group) < 0) TEST_ERROR + + /* Unset elink access flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_DEFAULT) < 0) TEST_ERROR + + /* Attempt to create a group through the external link using gapl (should fail) */ + H5E_BEGIN_TRY { + subgroup = H5Gcreate2(file1, "/ext_link/group/subgroup", H5P_DEFAULT, H5P_DEFAULT, gapl); + } H5E_END_TRY; + if(subgroup != FAIL) TEST_ERROR + + /* Attempt to set SWMR flags on gapl. + * This is just a smoke check of the flags. The actual external link + * functionality is tested in the SWMR tests. + */ + /* Set SWMR reader flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ) < 0) TEST_ERROR + /* Set SWMR writer flags on gapl */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE) < 0) TEST_ERROR + + /* Attempt to set invalid flags on gapl */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_TRUNC); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_EXCL); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_CREAT); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + /* SWMR reader with write access */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR | H5F_ACC_SWMR_READ); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + /* SWMR writer with read-only access */ + H5E_BEGIN_TRY { + ret = H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE); + } H5E_END_TRY; + if(ret != FAIL) TEST_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + + /* Only run this part with VFDs that support SWMR */ + if(H5FD_supports_swmr_test(env_h5_drvr)) { + + /* Reopen file1, with read-write and SWMR-write access */ + /* Only supported under the latest file format */ + if(new_format) { + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using default gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDWR) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != H5F_ACC_RDWR) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + } + + /* Reopen file1, with read-only and SWMR-read access */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using default gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Set elink access flags on gapl to be H5F_ACC_RDWR (dropping SWMR_WRITE) */ + if(H5Pset_elink_acc_flags(gapl, H5F_ACC_RDONLY) < 0) FAIL_STACK_ERROR + + /* Open a group through the external link using gapl */ + if((group = H5Gopen2(file1, "/ext_link/group", gapl)) < 0) FAIL_STACK_ERROR + + /* Verify that the correct parameters have been set on file2 */ + if((file2 = H5Iget_file_id(group)) < 0) FAIL_STACK_ERROR + if(H5Fget_intent(file2, &flags) < 0) FAIL_STACK_ERROR + if(flags != H5F_ACC_RDONLY) TEST_ERROR + + /* Close file2 and group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + + /* Close file1 */ + if(H5Fclose(file1) < 0) TEST_ERROR + } /* end if */ + + + /* Verify that H5Fcreate and H5Fopen reject H5F_ACC_DEFAULT */ + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fcreate(filename1, H5F_ACC_TRUNC | H5F_ACC_DEFAULT, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + H5E_BEGIN_TRY { + file1 = H5Fopen(filename1, H5F_ACC_RDWR | H5F_ACC_DEFAULT, fapl); + } H5E_END_TRY; + if(file1 != FAIL) TEST_ERROR + + /* Close gapl */ + if(H5Pclose(gapl) < 0) TEST_ERROR + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Gclose(group); + H5Gclose(subgroup); + H5Fclose(file1); + H5Fclose(file2); + H5Pclose(gapl); + } H5E_END_TRY; + return -1; +} /* end external_set_elink_acc_flags() */ + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -4182,7 +4178,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo * *------------------------------------------------------------------------- */ -/* User data structure for callback function */ + /* User data structure for callback function */ typedef struct { const char *parent_file; /* Expected parent file name */ const char *target_file; /* Expected target file name */ @@ -4194,8 +4190,8 @@ typedef struct { /* Callback function */ static herr_t external_set_elink_cb_cb(const char *parent_file, const char *parent_group, - const char *target_file, const char *target_obj, unsigned *flags, - hid_t fapl, void *_op_data) + const char *target_file, const char *target_obj, unsigned *flags, + hid_t fapl, void *_op_data) { set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data; @@ -4226,23 +4222,23 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver; set_elink_cb_t op_data, - *op_data_p; + *op_data_p; H5L_elink_traverse_t cb; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE]; unsigned flags; if(new_format) TESTING("H5Pset/get_elink_cb() (w/new group format)") - else - TESTING("H5Pset/get_elink_cb()") + else + TESTING("H5Pset/get_elink_cb()") - /* Build user data for callback */ - op_data.parent_file = filename1; + /* Build user data for callback */ + op_data.parent_file = filename1; op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI @@ -4252,61 +4248,61 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) /* Create family fapl */ if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR + if (H5Pset_fapl_family(fam_fapl, op_data.fam_size, op_data.base_fapl) < 0) TEST_ERROR - /* Create parent and target files, group, and external link */ - h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1); + /* Create parent and target files, group, and external link */ + h5_fixname(FILENAME[42], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[43], fam_fapl, filename2, sizeof filename2); if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR - if((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close files and group */ - if(H5Fclose(file1) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR - if(H5Gclose(group) < 0) TEST_ERROR - - /* Create new gapl, and set elink callback */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR - - /* Verify "get" routine functionality */ - if(H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR - if(cb != external_set_elink_cb_cb) TEST_ERROR - if(op_data_p != &op_data) TEST_ERROR - - /* Open file1 with read only access */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - - /* Create a group through the external link using gapl */ - if((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR - - /* Verify that the correct parameters have been set on file2 (somewhat - * redundant as the library would be unable to create the group otherwise) - */ - if((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR - if(H5Fget_intent(file2, &flags) < 0) TEST_ERROR - if(!(flags & H5F_ACC_RDWR)) TEST_ERROR - if((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR - if(H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR - - if(H5Gclose(group) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR - if(H5Pclose(ret_fapl) < 0) TEST_ERROR - if(H5Pclose(fam_fapl) < 0) TEST_ERROR - - /* Modify the user data structure to cause the callback to fail next time */ - op_data.code = 1; + if((file2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fam_fapl)) < 0) TEST_ERROR + if((group = H5Gcreate2(file1, "group1",H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_external(filename2, "/", group, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close files and group */ + if(H5Fclose(file1) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR + if(H5Gclose(group) < 0) TEST_ERROR + + /* Create new gapl, and set elink callback */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_cb(gapl, external_set_elink_cb_cb, &op_data) < 0) TEST_ERROR + + /* Verify "get" routine functionality */ + if(H5Pget_elink_cb(gapl, &cb, (void **) &op_data_p) < 0) TEST_ERROR + if(cb != external_set_elink_cb_cb) TEST_ERROR + if(op_data_p != &op_data) TEST_ERROR + + /* Open file1 with read only access */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Create a group through the external link using gapl */ + if((group = H5Gcreate2(file1, "/group1/ext_link/group2", H5P_DEFAULT, H5P_DEFAULT, gapl)) < 0) TEST_ERROR + + /* Verify that the correct parameters have been set on file2 (somewhat + * redundant as the library would be unable to create the group otherwise) + */ + if((file2 = H5Iget_file_id(group)) < 0) TEST_ERROR + if(H5Fget_intent(file2, &flags) < 0) TEST_ERROR + if(!(flags & H5F_ACC_RDWR)) TEST_ERROR + if((ret_fapl = H5Fget_access_plist(file2)) < 0) TEST_ERROR + if(H5FD_FAMILY != H5Pget_driver(ret_fapl)) TEST_ERROR + + if(H5Gclose(group) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR + if(H5Pclose(ret_fapl) < 0) TEST_ERROR + if(H5Pclose(fam_fapl) < 0) TEST_ERROR + + /* Modify the user data structure to cause the callback to fail next time */ + op_data.code = 1; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { - group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); + group = H5Gopen2(file1, "/group1/ext_link/group2", gapl); } H5E_END_TRY; if(group != FAIL) TEST_ERROR - /* Modify the user data structure to cause the callback to return invalid flags */ - op_data.code = 2; + /* Modify the user data structure to cause the callback to return invalid flags */ + op_data.code = 2; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { @@ -4314,14 +4310,14 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) } H5E_END_TRY; if(group != FAIL) TEST_ERROR - /* Close */ - if(H5Fclose(file1) < 0) TEST_ERROR - if(H5Pclose(gapl) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(file1) < 0) TEST_ERROR + if(H5Pclose(gapl) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Gclose(group); H5Fclose(file1); @@ -4333,7 +4329,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) return -1; } /* end external_set_elink_cb() */ - + /*------------------------------------------------------------------------- * Function: external_reset_register * @@ -4361,47 +4357,47 @@ external_reset_register(void) /* Create and close file */ h5_fixname(FILENAME[44], H5P_DEFAULT, filename, sizeof filename); if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Fclose(file) < 0) TEST_ERROR + if (H5Fclose(file) < 0) TEST_ERROR - /* Reset the library */ - H5close(); + /* Reset the library */ + H5close(); /* Re open file */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create an external link */ - if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link */ + if (H5Lcreate_external("some_file", "some_obj", file, "ext_link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if (H5Fclose(file) < 0) TEST_ERROR + /* Close file */ + if (H5Fclose(file) < 0) TEST_ERROR - /* Try again to make sure the previous H5Lcreate_external call does not - * affect the ability to reset */ - H5close(); + /* Try again to make sure the previous H5Lcreate_external call does not + * affect the ability to reset */ + H5close(); if ((file = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if (H5Fclose(file) < 0) TEST_ERROR + if (H5Lcreate_external("another_file", "another_obj", file, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if (H5Fclose(file) < 0) TEST_ERROR - if(HDremove(filename) != 0) TEST_ERROR + if(HDremove(filename) != 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; return -1; } /* end external_reset_register() */ - + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" + * 1. target link: "/CWD/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" * Should be able to find the target file via main file's current drive/rel path @@ -4419,27 +4415,27 @@ external_reset_register(void) static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's current drive/rel path(windows)") + else + TESTING("external links via main file's current drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks10" */ - HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ + /* set up name for target link: "/CWD/tmp/extlinks10" */ + HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4449,55 +4445,55 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's CWD*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* should be able to find the target file via main file's CWD*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win1() */ - + /*------------------------------------------------------------------------- * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 1. target link: "/CWD/tmp/extlinks11" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -4512,28 +4508,28 @@ external_link_win1(hid_t fapl, hbool_t new_format) static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") - else - TESTING("external links via target's rel drive/abs path directly(windows)") + else + TESTING("external links via target's rel drive/abs path directly(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks11" */ - HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ + /* set up name for target link: "/CWD/tmp/extlinks11" */ + HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[31]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4543,55 +4539,55 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win2() */ - + /*------------------------------------------------------------------------- * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 1. target link: ":tmp/extlinks12" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 @@ -4606,28 +4602,28 @@ external_link_win2(hid_t fapl, hbool_t new_format) static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") - else - TESTING("external links via target's abs drive/rel path directly (windows)") + else + TESTING("external links via target's abs drive/rel path directly (windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target link: ":tmp/extlinks12" */ - drive = HDgetdrive(); + /* set up name for target link: ":tmp/extlinks12" */ + drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4636,54 +4632,54 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win3() */ - + /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * 1. target link: ":extlinks13" + * 2. main file: ":tmp/extlinks0" + * 3. target file: tmp/extlinks13 + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4698,21 +4694,21 @@ external_link_win3(hid_t fapl, hbool_t new_format) static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") - else - TESTING("external links via main file's abs drive/rel path (windows)") + else + TESTING("external links via main file's abs drive/rel path (windows)") - /* set up name for main file: ":tmp/extlinks0" */ - drive = HDgetdrive(); + /* set up name for main file: ":tmp/extlinks0" */ + drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -4725,55 +4721,55 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's absolute drive/relative path */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* should be able to find the target file via main file's absolute drive/relative path */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win4() */ - + /*------------------------------------------------------------------------- * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 1. target link: ":tmp/extlinks14" + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 @@ -4788,23 +4784,23 @@ external_link_win4(hid_t fapl, hbool_t new_format) static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)") - else - TESTING("external links via main file's rel drive/abs path (windows)") + else + TESTING("external links via main file's rel drive/abs path (windows)") - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR - drive = HDgetdrive(); + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR + drive = HDgetdrive(); if (drive >= 26) drive -= 1; /* account for drive Z */ else @@ -4825,55 +4821,55 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* should be able to find the target file via main file's rel drive/abs path */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; - } + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* should be able to find the target file via main file's rel drive/abs path */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; + } - PASSED(); - return 0; + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; -} /* end external_link_win5() */ + PASSED(); + return 0; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; +} /* end external_link_win5() */ + /*------------------------------------------------------------------------- * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 1. target link: ":tmp/extlinks15" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4888,23 +4884,23 @@ external_link_win5(hid_t fapl, hbool_t new_format) static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") - else - TESTING("external links via target's current drive/rel path (windows)") + else + TESTING("external links via target's current drive/rel path (windows)") - /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR - drive = HDgetdrive(); + /* create tmp directory */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + drive = HDgetdrive(); if (drive >= 26) drive -= 1; /* account for drive Z */ else @@ -4922,47 +4918,47 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via target file's rel path in current drive */ - if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file via target file's rel path in current drive */ + if (gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win6() */ - + /*------------------------------------------------------------------------- * Function: external_link_win7 * @@ -4982,24 +4978,24 @@ external_link_win7(hid_t fapl, hbool_t new_format) hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's UNC local host/main drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's UNC local host/main drive/rel path(windows)") + else + TESTING("external links via main file's UNC local host/main drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ - HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ + /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ + HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -5009,47 +5005,47 @@ external_link_win7(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's local host/main drive*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in local host/main drive."); - goto error; - } + /* should be able to find the target file via main file's local host/main drive*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in local host/main drive."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win7() */ - + /*------------------------------------------------------------------------- * Function: external_link_win8 * @@ -5071,28 +5067,28 @@ external_link_win8(hid_t fapl, hbool_t new_format) hid_t gid = (-1); /* Group IDs */ int drive=0; char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's Long UNC abs drive/abs path directly (windows)(w/new group format)") - else - TESTING("external links via target's Long UNC abs drive/abs path directly (windows)") + else + TESTING("external links via target's Long UNC abs drive/abs path directly (windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* create tmp directory */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + /* create tmp directory */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR - /* set up name for target link: ":\CWD\extlinks10" */ - drive = HDgetdrive(); + /* set up name for target link: ":\CWD\extlinks10" */ + drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "\\\\?\\%c:%s\\%s", (drive+'A'-1), &cwdpath[2], FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -5101,47 +5097,47 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file directly */ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; - } + /* should be able to find the target file directly */ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win8() */ - + /*------------------------------------------------------------------------- * Function: external_link_win9 * @@ -5161,24 +5157,24 @@ external_link_win9(hid_t fapl, hbool_t new_format) hid_t fid = (-1); /* File ID */ hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)") - else - TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)") + else + TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)") - /* set up name for main file: "extlinks0" */ - h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); + /* set up name for main file: "extlinks0" */ + h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ - HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ + /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ + HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -5188,49 +5184,49 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* Create the target file */ if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* closing for target file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for target file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create the main file */ + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to target file */ - if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to target file */ + if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Open object through external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); - } H5E_END_TRY; + /* Open object through external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT); + } H5E_END_TRY; - /* should be able to find the target file via main file's local host/main drive*/ - if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in local host/main drive."); - goto error; - } + /* should be able to find the target file via main file's local host/main drive*/ + if(gid < 0) { + H5_FAILED(); + HDputs(" Should have found the file in local host/main drive."); + goto error; + } - /* closing for main file */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* closing for main file */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_win9() */ #endif /* H5_HAVE_WINDOW_PATH */ - + /*------------------------------------------------------------------------- * Function: external_link_recursive * @@ -5249,57 +5245,57 @@ external_link_win9(hid_t fapl, hbool_t new_format) static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") - else - TESTING("recursive external links") + else + TESTING("recursive external links") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); /* Create first file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create recursive external links */ - if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create recursive external links */ + if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open file */ + if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open object through dangling file external link */ - H5E_BEGIN_TRY { - gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; - } + /* Open object through dangling file external link */ + H5E_BEGIN_TRY { + gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; + } - /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end external_link_recursive() */ - + /*------------------------------------------------------------------------- * Function: external_link_query * @@ -5319,117 +5315,117 @@ external_link_recursive(hid_t fapl, hbool_t new_format) static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ - query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) TESTING("query aspects of external link (w/new group format)") - else - TESTING("query aspects of external link") + else + TESTING("query aspects of external link") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - /* (add a few extra '/'s to make certain library normalizes external link object names) */ - if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR - if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; - } + /* Create external link */ + /* (add a few extra '/'s to make certain library normalizes external link object names) */ + if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Get size of buffer for external link */ + if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if (H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Get size of buffer for external link */ - if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR - if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; - } + /* Get size of buffer for external link */ + if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR + if(H5L_TYPE_EXTERNAL != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; + } /* Get information for external link. It should be two strings right after each other */ if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - /* Extract the file and object names from the buffer */ - if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR + /* Extract the file and object names from the buffer */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR - /* Compare the file and object names */ - if(HDstrcmp(file_name, filename2)) TEST_ERROR - if(HDstrcmp(object_name, "/dst")) TEST_ERROR + /* Compare the file and object names */ + if(HDstrcmp(file_name, filename2)) TEST_ERROR + if(HDstrcmp(object_name, "/dst")) TEST_ERROR - /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; - } + /* Query information about object that external link points to */ + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5O_TYPE_GROUP != oi.type) { + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; + } /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ - if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR + /* Make sure that passing in NULLs to H5Lunpack_elink_val works */ + if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR - /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY - H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR - } H5E_END_TRY + /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY + H5E_BEGIN_TRY { + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + } H5E_END_TRY - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end external_link_query() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_compact * @@ -5446,76 +5442,76 @@ external_link_query(hid_t fapl, hbool_t new_format) static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("unlinking external link in compact group (w/new group format)") - else - TESTING("unlinking external link in compact group") + else + TESTING("unlinking external link in compact group") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link */ + if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Unlink external link */ +/* Unlink external link */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Unlink external link */ - if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink external link */ + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group for external link */ - if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group for external link */ + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_compact() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_dense * @@ -5532,136 +5528,136 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ if(new_format) TESTING("unlinking external link in dense group (w/new group format)") - else - TESTING("unlinking external link in dense group") + else + TESTING("unlinking external link in dense group") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Check on root group's status */ - if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Query the group creation properties */ - if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR - if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR - /* Create external link */ - /* (This also covers the case of having an external link in a compact group that's converted to a dense group) */ - if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Query the group creation properties */ + if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR + if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != 1) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + /* Create external link */ + /* (This also covers the case of having an external link in a compact group that's converted to a dense group) */ + if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create enough objects in the root group to change it into a "dense" group */ - for(u = 0; u < max_compact; u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - } /* end for */ + /* Check on root group's status */ + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != 1) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + + /* Create enough objects in the root group to change it into a "dense" group */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - /* Close group creation property list */ - if(H5Pclose(gcpl) < 0) TEST_ERROR + /* Close group creation property list */ + if(H5Pclose(gcpl) < 0) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Unlink external link */ +/* Unlink external link */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Unlink external link */ - if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink external link */ + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Remove enough objects in the root group to change it into a "compact" group */ - for(u = 0; u < ((max_compact - min_dense) + 1); u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Remove enough objects in the root group to change it into a "compact" group */ + for(u = 0; u < ((max_compact - min_dense) + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != (min_dense - 1)) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group for external link (should be unaffected) */ - if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group for external link (should be unaffected) */ + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_dense() */ - + /*------------------------------------------------------------------------- * Function: external_link_move * @@ -5678,181 +5674,181 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) static int external_link_move(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") - else - TESTING("move external link") + else + TESTING("move external link") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link */ - if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link */ + if(H5Lcreate_external(filename2, "/dst", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Move external link to different name within same group */ +/* Move external link to different name within same group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Move external link within same group */ - if(H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link within same group */ + if(H5Lmove(fid, "src", H5L_SAME_LOC, "src2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Move external link to different group */ +/* Move external link to different group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Create another group, to move the external link into */ - if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create another group, to move the external link into */ + if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Move external link to different group */ - if(H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link to different group */ + if(H5Lmove(fid, "src2", gid, "src3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close new group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close new group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Move external link back to original group */ +/* Move external link back to original group */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Move external link back to original location */ - if(H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move external link back to original location */ + if(H5Lmove(fid, "/group2/src3", H5L_SAME_LOC, "/src", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_move() */ - + /*------------------------------------------------------------------------- * Function: external_link_ride * @@ -5870,175 +5866,175 @@ external_link_move(hid_t fapl, hbool_t new_format) static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ if(new_format) TESTING("external link along for the ride (w/new group format)") - else - TESTING("external link along for the ride") + else + TESTING("external link along for the ride") - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR - /* Query the group creation properties */ - if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR - if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR - - /* Create enough objects in the root group to change it into a "dense" group */ - for(u = 0; u < (max_compact + 1); u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - } /* end for */ + /* Query the group creation properties */ + if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR + if(H5Pget_link_phase_change(gcpl, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Create enough objects in the root group to change it into a "dense" group */ + for(u = 0; u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(new_format) { - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - } /* end if */ - else { - if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR - } /* end else */ + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(new_format) { + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + } /* end if */ + else { + if(H5G__has_stab_test(gid) != TRUE) TEST_ERROR + } /* end else */ /* Create external link */ /* (This also covers the case of adding an external link to a dense group) */ if(H5Lcreate_external(filename2, "/dst", gid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Check on root group's status */ - if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR + /* Check on root group's status */ + if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR - /* Close group creation property list */ - if(H5Pclose(gcpl) < 0) TEST_ERROR + /* Close group creation property list */ + if(H5Pclose(gcpl) < 0) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Create second file to point to */ - if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create second file to point to */ + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create object to link to */ - if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create object to link to */ + if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Remove enough objects to convert group containing external link back into compact form */ +/* Remove enough objects to convert group containing external link back into compact form */ - /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Open first file */ + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) TEST_ERROR - /* Open root group */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open root group */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Remove enough objects in the root group to change it into a "compact" group */ - for(u = 0; u < ((max_compact - min_dense) + 3); u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Remove enough objects in the root group to change it into a "compact" group */ + for(u = 0; u < ((max_compact - min_dense) + 3); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ /* Check on root group's status */ if(H5G__is_empty_test(gid) == TRUE) TEST_ERROR - if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR - if(nmsgs != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR + if(H5G__has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR + if(nmsgs != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(gid) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(gid) == TRUE) TEST_ERROR - /* Close root group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close root group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open object through external link */ - if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open object through external link */ + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/dst")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/dst")) TEST_ERROR - /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create object in external file */ + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group in external file */ - if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR + /* Close group in external file */ + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR - /* Close external object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close external object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close first file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close first file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + /* Open second file */ + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Open group created through external link */ - if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created through external link */ + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close group */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_ride() */ - + /*------------------------------------------------------------------------- * Function: external_link_closing * @@ -6060,218 +6056,218 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; if(new_format) TESTING("that external files are closed during traversal (w/new group format)") - else - TESTING("that external files are closed during traversal") - - /* In this test, external links will go from file1 to file2 and from - * file2 to file3. - * Test that all functions that can traverse external files close - * the files they open. - * Test that providing unusual paths containing external links can't - * make HDF5 forget to close a file it opened. - */ - - /* Set up filenames */ - h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); + else + TESTING("that external files are closed during traversal") + + /* In this test, external links will go from file1 to file2 and from + * file2 to file3. + * Test that all functions that can traverse external files close + * the files they open. + * Test that providing unusual paths containing external links can't + * make HDF5 forget to close a file it opened. + */ + + /* Set up filenames */ + h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4); /* Create four files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ - dims[0] = 2; + /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */ + dims[0] = 2; dims[1] = 2; if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - - /* Create external links from each file to the next */ - if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Close all files but the first */ - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Test creating each kind of object */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test that getting info works */ - if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - - /* Test move */ - if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, - "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - - /* Open file 4 so we can do some fancy things */ - if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, - "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lmove(fid4, "dataset1", fid1, - "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Close file 4 again */ - if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR - - /* Test copy (as of this test, it uses the same code as move) */ - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcopy(fid1, "elink/elink/elink", fid1, - "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Test H5Gset and get comment */ - if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(buf, "comment")) TEST_ERROR - - /* Test H5*open */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5*open2 */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close objects */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if(H5Tclose(tid) < 0) FAIL_STACK_ERROR - if(H5Dclose(did) < 0) FAIL_STACK_ERROR - - /* Test H5Oopen */ - if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Test H5Fmount */ - if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - H5E_BEGIN_TRY { - if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR - } H5E_END_TRY - - /* Test H5Rcreate */ - if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR - - /* Test unlink */ - if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR - - /* We've tested that the various functions above don't leave files open. - * Now test that we can't confuse HDF5 by giving unusual paths with external links - */ - /* Create an external link that points to another external link */ - if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", - H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Do an external link traversal that recursively calls another external link. */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Create two more groups so that the last three elements in the path are - * all within the same external file - */ - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - - /* Add a few regular groups and a soft link in file2 using intermediate group creation */ - if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR - if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", - lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - - /* Try to traverse this path. There are three soft traversals in a row; - * slink points to (file2)/elink2, which points to (file3)/elink, which - * points to file 4. - */ - if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - - /* Some simpler tests */ - if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - - - /* Close file1, the only file that should still be open */ - if(H5Fclose(fid1) < 0) TEST_ERROR - - /* Re-create each file. If they are hanging open, these creates will fail */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Cleanup */ - if(H5Sclose(sid) < 0) TEST_ERROR - if(H5Tclose(tid2) < 0) TEST_ERROR - if(H5Fclose(fid4) < 0) TEST_ERROR - if(H5Fclose(fid3) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - if(H5Fclose(fid1) < 0) TEST_ERROR - - PASSED(); - - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Tclose(tid); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid2); - H5Fclose(fid4); - H5Fclose(fid3); - H5Fclose(fid2); - H5Fclose(fid1); - } H5E_END_TRY; - return -1; -} /* external_link_closing() */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + + /* Create external links from each file to the next */ + if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Close all files but the first */ + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Test creating each kind of object */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test that getting info works */ + if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Test move */ + if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, + "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + + /* Open file 4 so we can do some fancy things */ + if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid1, "elink/elink/elink/type1", fid4, + "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lmove(fid4, "dataset1", fid1, + "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close file 4 again */ + if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR + + /* Test copy (as of this test, it uses the same code as move) */ + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid1, "elink/elink/elink", fid1, + "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Test H5Gset and get comment */ + if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(buf, "comment")) TEST_ERROR + + /* Test H5*open */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5*open2 */ + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close objects */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + + /* Test H5Oopen */ + if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Test H5Fmount */ + if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + H5E_BEGIN_TRY { + if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR + } H5E_END_TRY + + /* Test H5Rcreate */ + if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR + + /* Test unlink */ + if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR + + /* We've tested that the various functions above don't leave files open. + * Now test that we can't confuse HDF5 by giving unusual paths with external links + */ + /* Create an external link that points to another external link */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/elink", fid2, "elink2", + H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Do an external link traversal that recursively calls another external link. */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Create two more groups so that the last three elements in the path are + * all within the same external file + */ + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + + /* Add a few regular groups and a soft link in file2 using intermediate group creation */ + if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR + if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink", + lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR + + /* Try to traverse this path. There are three soft traversals in a row; + * slink points to (file2)/elink2, which points to (file3)/elink, which + * points to file 4. + */ + if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + + /* Some simpler tests */ + if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR + + + /* Close file1, the only file that should still be open */ + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Re-create each file. If they are hanging open, these creates will fail */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Cleanup */ + if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Tclose(tid2) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Tclose(tid); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid2); + H5Fclose(fid4); + H5Fclose(fid3); + H5Fclose(fid2); + H5Fclose(fid1); + } H5E_END_TRY; + return -1; +} /* external_link_closing() */ + /*------------------------------------------------------------------------- * Function: ext_link_endian * @@ -6290,63 +6286,63 @@ external_link_closing(hid_t fapl, hbool_t new_format) static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; if(new_format) TESTING("endianness of external links (w/new group format)") - else - TESTING("endianness of external links") + else + TESTING("endianness of external links") - /* Create a link access property list with the path to the srcdir */ - if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR + /* Create a link access property list with the path to the srcdir */ + if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + if(H5Pset_elink_prefix(lapl_id, pathbuf) < 0) TEST_ERROR - namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ + namebuf = H5_get_srcdir_filename(LE_FILENAME); /* Corrected test file name */ /* Test LE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ + namebuf = H5_get_srcdir_filename(BE_FILENAME); /* Corrected test file name */ /* Test BE file; try to open a group through the external link */ if((fid = H5Fopen(namebuf, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR + if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR - /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group in the external file using that group ID */ + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the IDs */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close the IDs */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- * Function: external_link_strong * @@ -6368,58 +6364,58 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("that external files work with strong file close degree (w/new group format)") - else - TESTING("that external files work with strong file close degree") + else + TESTING("that external files work with strong file close degree") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Copy file access property list */ if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - /* Set strong file close degree */ - if(H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0) TEST_ERROR - - /* Create a group at /A/B/C in first file */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid1) < 0) TEST_ERROR - - /* Create an external link /W/X/DLINK in second file to :/A/B/C */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Access external link from file #1 */ - if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid2) < 0) TEST_ERROR - - /* Close fapl */ - if(H5Pclose(my_fapl) < 0) TEST_ERROR + /* Set strong file close degree */ + if(H5Pset_fclose_degree(my_fapl, H5F_CLOSE_STRONG) < 0) TEST_ERROR + + /* Create a group at /A/B/C in first file */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A/B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gcreate2(fid1, "A/B/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR + + /* Create an external link /W/X/DLINK in second file to :/A/B/C */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(fid2, "/W", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(fid2, "/W/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/A/B/C", gid2, "DLINK", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + + /* Access external link from file #1 */ + if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR - PASSED(); + /* Close fapl */ + if(H5Pclose(my_fapl) < 0) TEST_ERROR + + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(my_fapl); H5Gclose(fapl); @@ -6431,7 +6427,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_strong() */ - + /*------------------------------------------------------------------------- * Function: external_symlink * @@ -6452,202 +6448,202 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ -if(new_format) - TESTING("external links w/symlink files (w/new group format)") + if(new_format) + TESTING("external links w/symlink files (w/new group format)") else TESTING("external links w/symlink files") #ifdef H5_HAVE_SYMLINK - /* Skip test when using VFDs that can't provide a POSIX compatible file - * descriptor. - */ - have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") - || !HDstrcmp(env_h5_drvr, "core") - || !HDstrcmp(env_h5_drvr, "nomatch")); -if(have_posix_compat_vfd) { - /* set up name for main file: "extlinks21A" */ - h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); - - /* create tmp directory and get current working directory path */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + /* Skip test when using VFDs that can't provide a POSIX compatible file + * descriptor. + */ + have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2") + || !HDstrcmp(env_h5_drvr, "core") + || !HDstrcmp(env_h5_drvr, "nomatch")); + if(have_posix_compat_vfd) { + /* set up name for main file: "extlinks21A" */ + h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); + + /* create tmp directory and get current working directory path */ + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) + TEST_ERROR - /* Set up names for files in the subdirectories */ + /* Set up names for files in the subdirectories */ - /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ - h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[46]); - h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); + /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ + h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); + fix_ext_filename(tmpname, cwdpath, FILENAME[46]); + h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); - /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp/sym1.h5 -> /tmp2/extlinks21B.h5) */ - if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ + /* (i.e. tmp/sym1.h5 -> /tmp2/extlinks21B.h5) */ + if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ - h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); - h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); + /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ + h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); + h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); - /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ - h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); - fix_ext_filename(tmpname, cwdpath, FILENAME[49]); - h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); + /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ + h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); + fix_ext_filename(tmpname, cwdpath, FILENAME[49]); + h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); - /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2/sym2.h5 -> /tmp/extlinks21D.h5) */ - if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR + /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ + /* (i.e. tmp2/sym2.h5 -> /tmp/extlinks21D.h5) */ + if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ - h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); - h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); + /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ + h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); + h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); - /* Create file #1 in current directory */ - if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #1 in current directory */ + if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #2, using symlink #1 name */ - if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #2, using symlink #1 name */ + if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ - if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(file2) < 0) TEST_ERROR + /* Create file #2 in tmp directory #2 */ + if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(file2) < 0) TEST_ERROR - /* Re-open file #2 in tmp directory through symlink */ - if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open file #2 in tmp directory through symlink */ + if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Create group in file #2 in temporary directory */ - if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #2 in temporary directory */ + if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file #3 & object in temporary directory #2 */ - if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file #3 & object in temporary directory #2 */ + if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #2 */ - if(H5Gclose(group2) < 0) TEST_ERROR + /* Close group in file #2 */ + if(H5Gclose(group2) < 0) TEST_ERROR - /* Close file #2 */ - if(H5Fclose(file2) < 0) TEST_ERROR + /* Close file #2 */ + if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ - if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #3 in temp. directory #2 */ + if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #3 */ - if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #3 */ + if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file & object in temporary directory #1, using symlink #2 name */ - if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file & object in temporary directory #1, using symlink #2 name */ + if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #3 */ - if(H5Gclose(group3) < 0) TEST_ERROR + /* Close group in file #3 */ + if(H5Gclose(group3) < 0) TEST_ERROR - /* Close file #3 */ - if(H5Fclose(file3) < 0) TEST_ERROR + /* Close file #3 */ + if(H5Fclose(file3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ - if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #4 in temporary directory #1 */ + if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #4 in 'temporary' directory */ - if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group in file #4 in 'temporary' directory */ + if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create external link to file #5 & object in temporary directory #1 */ - if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to file #5 & object in temporary directory #1 */ + if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close group in file #4 */ - if(H5Gclose(group4) < 0) TEST_ERROR + /* Close group in file #4 */ + if(H5Gclose(group4) < 0) TEST_ERROR - /* Close file #4 */ - if(H5Fclose(file4) < 0) TEST_ERROR + /* Close file #4 */ + if(H5Fclose(file4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ - if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file #5 in temporary directory #1 */ + if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group in file #5 in 'temporary' directory #1 */ - if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Create group in file #5 in 'temporary' directory #1 */ + if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Close file #5 */ - if(H5Fclose(file5) < 0) TEST_ERROR + /* Close file #5 */ + if(H5Fclose(file5) < 0) TEST_ERROR - /* Actual tests... */ + /* Actual tests... */ - /* Reopen file #1 */ - if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Reopen file #1 */ + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group in file #2, through external link w/symlink */ - if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group2) < 0) TEST_ERROR + /* Open group in file #2, through external link w/symlink */ + if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) TEST_ERROR - /* Open group in file #3, through external link w/symlink to external link */ - if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group3) < 0) TEST_ERROR + /* Open group in file #3, through external link w/symlink to external link */ + if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3) < 0) TEST_ERROR - /* Open group in file #4, through external link w/symlink to external link w/symlink */ - if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group4) < 0) TEST_ERROR + /* Open group in file #4, through external link w/symlink to external link w/symlink */ + if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4) < 0) TEST_ERROR - /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ - if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group5) < 0) TEST_ERROR + /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */ + if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5) < 0) TEST_ERROR - /* Close file #1 */ - if(H5Fclose(file1) < 0) TEST_ERROR + /* Close file #1 */ + if(H5Fclose(file1) < 0) TEST_ERROR - PASSED(); -} /* end if */ -else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); -} /* end else */ + PASSED(); + } /* end if */ + else { + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); + } /* end else */ -return 0; + return 0; -error: -H5E_BEGIN_TRY { - H5Gclose(group5); - H5Gclose(group4); - H5Gclose(group3); - H5Gclose(group2); - H5Fclose(file5); - H5Fclose(file4); - H5Fclose(file3); - H5Fclose(file2); - H5Fclose(file1); -} H5E_END_TRY; -return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(group5); + H5Gclose(group4); + H5Gclose(group3); + H5Gclose(group2); + H5Fclose(file5); + H5Fclose(file4); + H5Fclose(file3); + H5Fclose(file2); + H5Fclose(file1); + } H5E_END_TRY; + return -1; #else /* H5_HAVE_SYMLINK */ -SKIPPED(); -HDputs(" Current file system or operating system doesn't support symbolic links"); + SKIPPED(); + HDputs(" Current file system or operating system doesn't support symbolic links"); -return 0; + return 0; #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ - + /*------------------------------------------------------------------------- * Function: external_copy_invalid_object * @@ -6674,43 +6670,43 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) if(new_format) TESTING("copying invalid external links to the source file (w/new group format)") - else - TESTING("copying invalid external links to the source file") + else + TESTING("copying invalid external links to the source file") - /* Set up filename */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create object copy plist, set expand external flag */ if((ocpyplid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR - if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR + if(H5Pset_copy_object(ocpyplid, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0) TEST_ERROR - /* Create file and group */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create file and group */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create an external link in the group to the source file with an invalid - * object name */ - if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link in the group to the source file with an invalid + * object name */ + if(H5Lcreate_external(filename, "no_object", fid, "/group1/link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Copy the group containing the external link */ - if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR + /* Copy the group containing the external link */ + if(H5Ocopy(fid, "group1", fid, "group2", ocpyplid, H5P_DEFAULT) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - /* Attempt to truncate the file again. If there is a lingering id for this - * file this will fail */ - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Attempt to truncate the file again. If there is a lingering id for this + * file this will fail */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Close */ - if(H5Fclose(fid) < 0) TEST_ERROR - if(H5Pclose(ocpyplid) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Pclose(ocpyplid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -6720,7 +6716,7 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) return -1; } /* end external_copy_invalid_object */ - + /*------------------------------------------------------------------------- * Function: external_dont_fail_to_source * @@ -6746,45 +6742,45 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) if(new_format) TESTING("that invalid external links don't open the source file (w/new group format)") - else - TESTING("that invalid external links don't open the source file") + else + TESTING("that invalid external links don't open the source file") - /* Set up filename */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Create file and group */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create an external link with an invalid file name, but the same object - * name as the group. This way, if the external link is interpreted to - * refer to the source file, it will link to the group */ - if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create an external link with an invalid file name, but the same object + * name as the group. This way, if the external link is interpreted to + * refer to the source file, it will link to the group */ + if(H5Lcreate_external("no_file", "/group", fid, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Attempt to open the object the link points to. This should fail */ - H5E_BEGIN_TRY { - oid = H5Oopen(fid, "link", H5P_DEFAULT); - } H5E_END_TRY - if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") + /* Attempt to open the object the link points to. This should fail */ + H5E_BEGIN_TRY { + oid = H5Oopen(fid, "link", H5P_DEFAULT); + } H5E_END_TRY + if(oid >= 0) FAIL_PUTS_ERROR("Succeeded in opening target of invalid external link") - /* Close */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Oclose(oid); - H5Fclose(fid); - } H5E_END_TRY +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Oclose(oid); + H5Fclose(fid); + } H5E_END_TRY - return -1; + return -1; } /* end external_dont_fail_to_source */ - + /*------------------------------------------------------------------------- * Function: external_file_cache * @@ -6817,11 +6813,11 @@ external_file_cache(hid_t fapl, hbool_t new_format) if(new_format) TESTING("external file cache with external links (w/new group format)") - else - TESTING("external file cache with external links") + else + TESTING("external file cache with external links") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4); @@ -6829,334 +6825,334 @@ external_file_cache(hid_t fapl, hbool_t new_format) /* Verify that the default EFC size is 0 */ if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR - if(efc_size != 0) - FAIL_PUTS_ERROR("default external file cache size is not 0") + if(efc_size != 0) + FAIL_PUTS_ERROR("default external file cache size is not 0") - /* Copy FAPL and enable external file caching */ - if((my_fapl = H5Pcopy(fapl)) < 0) - TEST_ERROR - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + /* Copy FAPL and enable external file caching */ + if((my_fapl = H5Pcopy(fapl)) < 0) + TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR - /* Verify that the external file cache size has been set */ - if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) - TEST_ERROR - if(efc_size != 8) - FAIL_PUTS_ERROR("external file cache size different from expected") + /* Verify that the external file cache size has been set */ + if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) + TEST_ERROR + if(efc_size != 8) + FAIL_PUTS_ERROR("external file cache size different from expected") - /* - * Test 1: One file caches another - */ - /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + /* + * Test 1: One file caches another + */ + /* Create files */ + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that both files are now open */ - H5F_sfile_assert_num(2); + /* Verify that both files are now open */ + H5F_sfile_assert_num(2); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 2: One file caches another, release parent's EFC - */ + * Test 2: One file caches another, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close the target of the external link */ if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that both files are now open */ - H5F_sfile_assert_num(2); + /* Verify that both files are now open */ + H5F_sfile_assert_num(2); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only the parent file is now open */ - H5F_sfile_assert_num(1); + /* Verify that only the parent file is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 3: "Y" shaped tree - */ + * Test 3: "Y" shaped tree + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR - - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close files 2-4 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR + if(H5Fclose(fid4) < 0) + TEST_ERROR + + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that files 2 and 3 are now open */ - H5F_sfile_assert_num(3); + /* Verify that files 2 and 3 are now open */ + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(4); + /* Verify that all files are now open */ + H5F_sfile_assert_num(4); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 4: "Y" shaped tree, release parent's EFC - */ + * Test 4: "Y" shaped tree, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR - - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close files 2-4 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR + if(H5Fclose(fid4) < 0) + TEST_ERROR + + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that files 2 and 3 are now open */ - H5F_sfile_assert_num(3); + /* Verify that files 2 and 3 are now open */ + H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(4); + /* Verify that all files are now open */ + H5F_sfile_assert_num(4); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only file 1 is now open */ - H5F_sfile_assert_num(1); + /* Verify that only file 1 is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 5: 3 file cycle - */ + * Test 5: 3 file cycle + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + /* Close files 2-3 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(3); + /* Verify that all files are now open */ + H5F_sfile_assert_num(3); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 6: 3 file cycle, release parent's EFC - */ + * Test 6: 3 file cycle, release parent's EFC + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) + TEST_ERROR - /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create links */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + /* Close files 2-3 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR + if(H5Fclose(fid3) < 0) + TEST_ERROR - /* Verify that only 1 file is open */ - H5F_sfile_assert_num(1); + /* Verify that only 1 file is open */ + H5F_sfile_assert_num(1); /* Open and close one complete cycle */ if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if(H5Oclose(oid) < 0) + TEST_ERROR - /* Verify that all files are now open */ - H5F_sfile_assert_num(3); + /* Verify that all files are now open */ + H5F_sfile_assert_num(3); /* Release file 1's EFC */ if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR - /* Verify that only file 1 is now open */ - H5F_sfile_assert_num(1); + /* Verify that only file 1 is now open */ + H5F_sfile_assert_num(1); /* Close file 1 */ if(H5Fclose(fid1) < 0) TEST_ERROR - /* Verify that all files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that all files are now closed */ + H5F_sfile_assert_num(0); /* Close fapl */ H5Pclose(my_fapl); @@ -7164,7 +7160,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Oclose(oid); H5Fclose(fid1); @@ -7177,7 +7173,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) return -1; } /* end external_file_cache */ - + /*------------------------------------------------------------------------- * Function: external_open_twice * @@ -7206,201 +7202,201 @@ external_open_twice(hid_t fapl, hbool_t new_format) if(new_format) TESTING("opening object twice through elink (w/new group format)") - else - TESTING("opening object twice through elink") + else + TESTING("opening object twice through elink") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* - * Test 1: Open root group twice - */ + * Test 1: Open root group twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 2: Open group twice - */ + * Test 2: Open group twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target group */ - if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - TEST_ERROR - if(H5Gclose(oid1) < 0) - TEST_ERROR + /* Create target group */ + if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) + < 0) + TEST_ERROR + if(H5Gclose(oid1) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 3: Open dataset twice - */ + * Test 3: Open dataset twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target dataset */ - if((space = H5Screate(H5S_SCALAR)) < 0) - TEST_ERROR - if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(oid1) < 0) - TEST_ERROR - if(H5Sclose(space) < 0) - TEST_ERROR + /* Create target dataset */ + if((space = H5Screate(H5S_SCALAR)) < 0) + TEST_ERROR + if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, + dcpl_g, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dclose(oid1) < 0) + TEST_ERROR + if(H5Sclose(space) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); /* - * Test 4: Open datatype twice - */ + * Test 4: Open datatype twice + */ /* Create files */ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR - /* Create target datatype */ - if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) - TEST_ERROR - if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) - < 0) - TEST_ERROR - if(H5Tclose(type) < 0) - TEST_ERROR + /* Create target datatype */ + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) + TEST_ERROR + if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) + < 0) + TEST_ERROR + if(H5Tclose(type) < 0) + TEST_ERROR - /* Create link */ - if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + /* Create link */ + if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, + H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + /* Close file 2 */ + if(H5Fclose(fid2) < 0) + TEST_ERROR - /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Open the target of the external link twice */ + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate + * bug */ + if(H5Oclose(oid2) < 0) + TEST_ERROR + if(H5Oclose(oid1) < 0) + TEST_ERROR - /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + /* Close file 1 */ + if(H5Fclose(fid1) < 0) + TEST_ERROR - /* Verify that both files are now closed */ - H5F_sfile_assert_num(0); + /* Verify that both files are now closed */ + H5F_sfile_assert_num(0); PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Oclose(oid1); H5Oclose(oid2); @@ -7413,7 +7409,7 @@ external_open_twice(hid_t fapl, hbool_t new_format) return -1; } /* end external_open_twice() */ - + /*------------------------------------------------------------------------- * Function: external_link_with_committed_datatype * @@ -7436,32 +7432,32 @@ external_open_twice(hid_t fapl, hbool_t new_format) static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { - hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ - char filename1[NAME_BUF_SIZE]; /* File name for main file */ - char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ + char filename1[NAME_BUF_SIZE]; /* File name for main file */ + char filename2[NAME_BUF_SIZE]; /* File name for target file */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") - else - TESTING("attach committed datatype to external group's attribute/dataset") + else + TESTING("attach committed datatype to external group's attribute/dataset") - /* Set up filenames */ - h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); + /* Set up filenames */ + h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); @@ -7469,206 +7465,206 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Create external link from main file to target file */ - if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR + /* Create external link from main file to target file */ + if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + + /* Create target file */ + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + /* Create group in target file */ + if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close the group */ + if(H5Gclose(gid2) < 0) + FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(fid2) < 0) + FAIL_STACK_ERROR + + /* Open the group which is externally linked to target file */ + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Create a copy of integer datatype */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + FAIL_STACK_ERROR + + /* Commit the datatype to the main file root group */ + if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + FAIL_STACK_ERROR + + /* Create dataspace */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + FAIL_STACK_ERROR + + /* Attach an attribute with the committed datatype to the group */ + if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Write data to the attribute */ + if(H5Awrite(aid, tid, &wdata) < 0) + FAIL_STACK_ERROR + + /* Get the attribute's datatype */ + if((atid = H5Aget_type(aid)) < 0) + FAIL_STACK_ERROR + + /* Verify the datatype is not committed */ + if(H5Tcommitted(atid) == TRUE) + FAIL_STACK_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + /* Create a chunked dataset */ + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) + FAIL_STACK_ERROR - /* Create target file */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - /* Create group in target file */ - if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid2) < 0) - FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(fid2) < 0) - FAIL_STACK_ERROR - - /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Create a copy of integer datatype */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - FAIL_STACK_ERROR - - /* Commit the datatype to the main file root group */ - if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - - /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR - - /* Attach an attribute with the committed datatype to the group */ - if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Write data to the attribute */ - if(H5Awrite(aid, tid, &wdata) < 0) - FAIL_STACK_ERROR - - /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR - - /* Verify the datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR - - /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR - - /* Create a chunked dataset */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) - FAIL_STACK_ERROR - - if (dcpl_g == H5P_DEFAULT) - dcpl = H5Pcreate(H5P_DATASET_CREATE); - else - dcpl = H5Pcopy(dcpl_g); + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); if (0 > dcpl) FAIL_STACK_ERROR - if(H5Pset_chunk(dcpl, 2, chunks) < 0) - FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunks) < 0) + FAIL_STACK_ERROR - /* Initialize data buffers */ - for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; - } + /* Initialize data buffers */ + for(i = 0; i < 60; i++) { + wbuf[i] = i; + rbuf[i] = 0; + } /* Create a dataset with the committed datatype in the group */ if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Write to the dataset */ - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - FAIL_STACK_ERROR + /* Write to the dataset */ + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) + FAIL_STACK_ERROR + + /* Get the dataset's datatype */ + if((dtid = H5Dget_type(did)) < 0) + FAIL_STACK_ERROR + + /* Verify the datatype is not committed */ + if(H5Tcommitted(dtid) == TRUE) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + /* Close the dataset creation property list */ + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR + + /* Close the dataspaces */ + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + if(H5Sclose(sid2) < 0) + FAIL_STACK_ERROR + + /* Close the datatypes */ + if(H5Tclose(tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) + FAIL_STACK_ERROR - /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + /* Close the group */ + if(H5Gclose(gid1) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + + + /* Open the mainfile */ + if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Open the committed datatype in the mainfile */ + if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Verify the datatype is committed */ + if(H5Tcommitted(tid) == FALSE) + FAIL_STACK_ERROR + + /* Open the group which is externally linked to target file */ + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Open the attribute attached to the group */ + if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Get the attribute's datatype */ + if((atid = H5Aget_type(aid)) < 0) + FAIL_STACK_ERROR + + /* Verify the attribute's datatype is not committed */ + if(H5Tcommitted(atid) == TRUE) + FAIL_STACK_ERROR + + /* Close the attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + + /* Delete the attribute */ + if(H5Adelete(gid1, "myAttribute") < 0) + FAIL_STACK_ERROR + + /* Open the dataset in the group */ + if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Get the dataset's datatype */ + if((dtid = H5Dget_type(did)) < 0) + FAIL_STACK_ERROR + + /* Verify the dataset's datatype is not committed */ + if(H5Tcommitted(dtid) == TRUE) + FAIL_STACK_ERROR + + /* Read the dataset */ + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) + FAIL_STACK_ERROR - /* Verify the datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR - - /* Close the dataset creation property list */ - if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR - - /* Close the dataspaces */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - if(H5Sclose(sid2) < 0) - FAIL_STACK_ERROR - - /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR - - /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - - - /* Open the mainfile */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR - - /* Open the committed datatype in the mainfile */ - if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Verify the datatype is committed */ - if(H5Tcommitted(tid) == FALSE) - FAIL_STACK_ERROR - - /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Open the attribute attached to the group */ - if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR - - /* Verify the attribute's datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR - - /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR - - /* Delete the attribute */ - if(H5Adelete(gid1, "myAttribute") < 0) - FAIL_STACK_ERROR - - /* Open the dataset in the group */ - if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR - - /* Verify the dataset's datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR - - /* Read the dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR - - /* Compare the data read should be the same as wbuf */ - if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR - - /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR - - /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR - - /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - - PASSED(); + /* Compare the data read should be the same as wbuf */ + if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + FAIL_STACK_ERROR + + /* Close the group */ + if(H5Gclose(gid1) < 0) + FAIL_STACK_ERROR + + /* Close the datatypes */ + if(H5Tclose(tid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) + FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) + FAIL_STACK_ERROR + + /* Close the file */ + if(H5Fclose(fid1) < 0) + FAIL_STACK_ERROR + + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(fid2); H5Fclose(fid1); @@ -7685,13 +7681,13 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY return -1; } /* end external_link_with_committed_datatype() */ - + /*------------------------------------------------------------------------- * Function: ud_hard_links * @@ -7710,7 +7706,7 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) /* UD_hard_create increments the object's reference count */ static herr_t UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata, - size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) + size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { haddr_t addr; hid_t target_obj = -1; @@ -7736,40 +7732,40 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi goto done; } /* end if */ - done: +done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: - if(H5Gclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATASET: - if(H5Dclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATATYPE: - if(H5Tclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - return -1; + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + return -1; } /* end switch */ } /* end if */ @@ -7779,8 +7775,8 @@ UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const voi /* Traverse a hard link by opening the object */ static hid_t UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, - const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { haddr_t addr; hid_t ret_value = -1; @@ -7798,7 +7794,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* UD_hard_delete decrements the object's reference count */ static herr_t UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata, - size_t udata_size) + size_t udata_size) { haddr_t addr; hid_t target_obj = -1; @@ -7824,40 +7820,40 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud goto done; } /* end if */ - done: +done: /* Close the target object if we opened it */ if(target_obj >= 0) { switch(H5Iget_type(target_obj)) { - case H5I_GROUP: - if(H5Gclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATASET: - if(H5Dclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_DATATYPE: - if(H5Tclose(target_obj) < 0) - ret_value = -1; - break; - - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - return -1; + case H5I_GROUP: + if(H5Gclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATASET: + if(H5Dclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_DATATYPE: + if(H5Tclose(target_obj) < 0) + ret_value = -1; + break; + + case H5I_UNINIT: + case H5I_BADID: + case H5I_FILE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + return -1; } /* end switch */ } /* end if */ @@ -7865,26 +7861,26 @@ UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *ud } /* end UD_hard_delete() */ const H5L_class_t UD_hard_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_hard_link", /* Link class name for debugging */ - UD_hard_create, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_hard_traverse, /* The actual traversal function */ - UD_hard_delete, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_hard_link", /* Link class name for debugging */ + UD_hard_create, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_hard_traverse, /* The actual traversal function */ + UD_hard_delete, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7893,110 +7889,110 @@ ud_hard_links(hid_t fapl) if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Get the size of the empty file for reference */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that external links are registered and UD hard links are not */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that external links are registered and UD hard links are not */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Register "user-defined hard links" with the library */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Check that UD hard links are now registered */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are now registered */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Create a group for the UD hard link to point to */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create a group for the UD hard link to point to */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get address for the group to give to the hard link */ - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + /* Get address for the group to give to the hard link */ + if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined "hard link" to the group using the address we got - * from H5Lget_info */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a user-defined "hard link" to the group using the address we got + * from H5Lget_info */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Close and re-open file to ensure that data is written to disk */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Close and re-open file to ensure that data is written to disk */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group through UD link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group through UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group")) TEST_ERROR - /* Create object in group */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups*/ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* UD hard links have no query function, thus return a "link length" of 0 */ - if(li.u.val_size != 0) TEST_ERROR - if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; - } /* end if */ + /* Check that H5Lget_objinfo works on the hard link */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* UD hard links have no query function, thus return a "link length" of 0 */ + if(li.u.val_size != 0) TEST_ERROR + if(UD_HARD_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be - * deleted because of the UD link. */ + * deleted because of the UD link. */ if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Ensure we can open the group through the UD link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Ensure we can open the group through the UD link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Unlink the group contained within it. */ - if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Unlink the group contained within it. */ + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Now delete the UD link. This should cause the group to be - * deleted, too. */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Now delete the UD link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* The file should be empty again. */ - if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_hard_links() */ - + /*------------------------------------------------------------------------- * Function: UD_rereg_traverse * @@ -8011,46 +8007,46 @@ ud_hard_links(hid_t fapl) * *------------------------------------------------------------------------- */ -/* A traversal function that ignores any udata and simply opens an object + /* A traversal function that ignores any udata and simply opens an object * in the current group named REREG_TARGET_NAME */ static hid_t UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { hid_t ret_value; if((ret_value = H5Oopen(cur_group, REREG_TARGET_NAME, lapl_id)) < 0) TEST_ERROR - return ret_value; + return ret_value; - error: +error: return -1; } /* end UD_rereg_traverse() */ /* This link class has the same ID number as the UD hard links but * has a very different traversal function */ const H5L_class_t UD_rereg_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ - "UD_reregistered_type", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_rereg_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_HARD_TYPE, /* Link type id number */ + "UD_reregistered_type", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_rereg_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") @@ -8060,129 +8056,129 @@ ud_link_reregister(hid_t fapl) if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Get the size of the empty file for reference */ - if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR + /* Get the size of the empty file for reference */ + if(H5Fclose(fid) < 0) TEST_ERROR + if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that UD hard links are not registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that UD hard links are not registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Register "user-defined hard links" with the library */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Register "user-defined hard links" with the library */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Check that UD hard links are registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Point a UD defined hard link to a group in the same way as the previous test */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Point a UD defined hard link to a group in the same way as the previous test */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR - /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ - if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a group named REREG_TARGET_NAME in the same group as the ud link */ + if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Now unregister UD hard links */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + /* Now unregister UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR - /* Check that UD hard links are no longer registered */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + /* Check that UD hard links are no longer registered */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - /* Verify that we can't traverse the ud link anymore */ - H5E_BEGIN_TRY { - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR - } H5E_END_TRY + /* Verify that we can't traverse the ud link anymore */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + } H5E_END_TRY - /* Verify that we can't create any new links of this type */ - H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - } H5E_END_TRY + /* Verify that we can't create any new links of this type */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY - /* Register a new kind of link with the same ID number */ - if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + /* Register a new kind of link with the same ID number */ + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR - /* Check that UD hard links are registered again */ - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + /* Check that UD hard links are registered again */ + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - /* Open a group through the ud link (now a different class of link). - * It should be a different group - * than the UD hard link pointed to */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open a group through the ud link (now a different class of link). + * It should be a different group + * than the UD hard link pointed to */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR - /* Create object in group */ - if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create object in group */ + if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups*/ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups*/ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Re-open group without using ud link to check that it was created properly */ + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR - /* Close opened object */ - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close opened object */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Unlink the group pointed to by the UD hard link. It shouldn't be - * deleted because the UD link incremented its reference count. */ - if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink the group pointed to by the UD hard link. It shouldn't be + * deleted because the UD link incremented its reference count. */ + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* What a mess! Re-register user-defined links to clean up the - * reference counts. We shouldn't actually need to unregister the - * other link type */ - if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR + /* What a mess! Re-register user-defined links to clean up the + * reference counts. We shouldn't actually need to unregister the + * other link type */ + if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR - /* Ensure we can open the group through the UD link (now that UD hard - * links have been registered) */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Ensure we can open the group through the UD link (now that UD hard + * links have been registered) */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Delete the UD hard link. This should cause the group to be - * deleted, too. */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Delete the UD hard link. This should cause the group to be + * deleted, too. */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Unlink the other two groups so that we can make sure the file is empty */ - if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Unlink the other two groups so that we can make sure the file is empty */ + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - /* The file should be empty again. */ - if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR + /* The file should be empty again. */ + if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + error: + H5E_BEGIN_TRY { + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end ud_link_reregister() */ - + /*------------------------------------------------------------------------- * Function: ud_callbacks * @@ -8201,245 +8197,245 @@ ud_link_reregister(hid_t fapl) /* Creation callback. Called during move as well. */ static herr_t UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, - size_t udata_size, hid_t lcpl_id) + size_t udata_size, hid_t lcpl_id) { if(!link_name) TEST_ERROR - if(loc_group < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR - if(lcpl_id < 0) TEST_ERROR + if(loc_group < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR + if(lcpl_id < 0) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; - error: +error: return -1; } /* end UD_cb_create() */ static hid_t UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, - size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) + size_t udata_size, hid_t lapl_id, hid_t H5_ATTR_UNUSED dxpl_id) { const char *target = (const char *)udata; hid_t ret_value; if(!link_name) TEST_ERROR - if(cur_group < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(cur_group < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) + TEST_ERROR - return ret_value; + return ret_value; - error: +error: return -1; } /* end UD_cb_traverse() */ /* Callback for when the link is moved or renamed */ static herr_t UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, - size_t udata_size) + size_t udata_size) { if(!new_name) TEST_ERROR - if(new_loc < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(new_loc < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(new_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; - error: +error: return -1; } /* end UD_cb_move() */ /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cb_delete(const char *link_name, hid_t file, const void *udata, - size_t udata_size) + size_t udata_size) { if(!link_name) TEST_ERROR - if(file < 0) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(file < 0) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return 0; - error: +error: return -1; } /* end UD_cb_delete() */ /* Callback for when the link is queried */ static ssize_t UD_cb_query(const char * link_name, const void *udata, size_t udata_size, - void *buf, size_t buf_size) + void *buf, size_t buf_size) { if(!link_name) TEST_ERROR - if(udata_size > 0 && !udata) TEST_ERROR + if(udata_size > 0 && !udata) TEST_ERROR - if(HDstrcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR - if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR - if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR + if(HDstrcmp(link_name, UD_CB_LINK_NAME)) TEST_ERROR + if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR + if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - if(buf) { - if(buf_size < 16) TEST_ERROR - HDstrcpy((char *)buf, "query succeeded"); - } /* end if */ + if(buf) { + if(buf_size < 16) TEST_ERROR + HDstrcpy((char *)buf, "query succeeded"); + } /* end if */ /* There are 15 characters and a NULL in "query succeeded" */ return 16; - error: +error: return -1; } /* end UD_cb_query() */ const H5L_class_t UD_cb_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CB_TYPE, /* Link type id number */ - NULL, /* NULL name (to make sure this doesn't break anything */ - UD_cb_create, /* Creation callback */ - UD_cb_move, /* Move/rename callback */ - UD_cb_move, /* Copy callback */ - UD_cb_traverse, /* The actual traversal function */ - UD_cb_delete, /* Deletion callback */ - UD_cb_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CB_TYPE, /* Link type id number */ + NULL, /* NULL name (to make sure this doesn't break anything */ + UD_cb_create, /* Creation callback */ + UD_cb_move, /* Move/rename callback */ + UD_cb_move, /* Copy callback */ + UD_cb_traverse, /* The actual traversal function */ + UD_cb_delete, /* Deletion callback */ + UD_cb_query /* Query callback */ }}; static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t lcpl = (-1); /* Link Creation PL */ H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) TESTING("user-defined link callbacks (w/new group format)") - else - TESTING("user-defined link callbacks") + else + TESTING("user-defined link callbacks") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Check that registered link classes are, and unregistered ones aren't */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR - - /* Hit two birds with one stone: register UD hard links from previous - * test to check that having two UD links registered at once presents - * no problems. */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - - /* Register user-defined link class. This is the one we'll actually - * be using. */ - if(H5Lregister(UD_cb_class) < 0) TEST_ERROR - - /* Check that registered link classes are, and unregistered ones aren't */ - if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR - if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR - - /* Create a group for the UD link to point to */ - if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create a user-defined link to the group. These UD links behave like soft links. */ - if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Try opening group through UD link */ - if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Query the link to test its query callback */ - if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.u.val_size != 16) TEST_ERROR - if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; - } + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR + + /* Hit two birds with one stone: register UD hard links from previous + * test to check that having two UD links registered at once presents + * no problems. */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + + /* Register user-defined link class. This is the one we'll actually + * be using. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + + /* Check that registered link classes are, and unregistered ones aren't */ + if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR + + /* Create a group for the UD link to point to */ + if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create a user-defined link to the group. These UD links behave like soft links. */ + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try opening group through UD link */ + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Query the link to test its query callback */ + if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.u.val_size != 16) TEST_ERROR + if (UD_CB_TYPE != li.type) { + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; + } /* Fill the query buffer */ if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR + if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR - /* Move the link */ - if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Move the link */ + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Re-open group to ensure that move worked */ - if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Re-open group to ensure that move worked */ + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Remove UD link */ - if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Remove UD link */ + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Test that the callbacks don't work if the link class is not registered */ + /* Test that the callbacks don't work if the link class is not registered */ - /* Create a new link. Just for fun, give it a non-default character - * encoding (to test that LAPLs work) */ - if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR - if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR + /* Create a new link. Just for fun, give it a non-default character + * encoding (to test that LAPLs work) */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR + if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR - /* Check its character encoding */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.cset != H5T_CSET_UTF8) TEST_ERROR + /* Check its character encoding */ + if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.cset != H5T_CSET_UTF8) TEST_ERROR - /* Unregister the link class so the library forgets what its callbacks do */ - if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR + /* Unregister the link class so the library forgets what its callbacks do */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR - /* Now test that each of the callbacks fails */ - H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR - if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - } H5E_END_TRY + /* Now test that each of the callbacks fails */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR + } H5E_END_TRY - /* The query callback should NOT fail, but should be unable to give a linklen */ - if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 0) TEST_ERROR - if(li.type != UD_CB_TYPE) TEST_ERROR + /* The query callback should NOT fail, but should be unable to give a linklen */ + if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + if(li.type != UD_CB_TYPE) TEST_ERROR - /* Unregister the UD hard links */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + /* Unregister the UD hard links */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Pclose (lcpl); - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; +error: + H5E_BEGIN_TRY { + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -8456,130 +8452,130 @@ ud_callbacks(hid_t fapl, hbool_t new_format) */ static hid_t UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, - const void H5_ATTR_UNUSED *udata, size_t udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void H5_ATTR_UNUSED *udata, size_t udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { char target[NAME_BUF_SIZE]; hid_t ret_value; if(udata_size != 0) TEST_ERROR - /* Get the name of the target from the property list. */ - if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR + /* Get the name of the target from the property list. */ + if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) + TEST_ERROR - return ret_value; + return ret_value; - error: +error: return -1; } /* end UD_plist_traverse() */ const H5L_class_t UD_plist_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ - "UD_plist_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_plist_traverse, /* The actual traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */ + "UD_plist_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_plist_traverse, /* The actual traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") - else - TESTING("user data passed through lapl") + else + TESTING("user data passed through lapl") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Register UD link types from previous tests to check that having - * multiple types registered at once presents no problems. */ - if(H5Lregister(UD_cb_class) < 0) TEST_ERROR + /* Register UD link types from previous tests to check that having + * multiple types registered at once presents no problems. */ + if(H5Lregister(UD_cb_class) < 0) TEST_ERROR - /* Register the link class. We'll actually be using for this test. */ - if(H5Lregister(UD_plist_class) < 0) TEST_ERROR + /* Register the link class. We'll actually be using for this test. */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR - /* Another link class from a previous test */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR + /* Another link class from a previous test */ + if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Unregister the first link type registered to make sure this doesn't - * break anything. */ - if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) TEST_ERROR + /* Unregister the first link type registered to make sure this doesn't + * break anything. */ + if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) TEST_ERROR - /* Create two groups for the UD link to point to */ - if((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create two groups for the UD link to point to */ + if((gid = H5Gcreate2(fid, "group_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined link to the group. These UD links have no udata. */ - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create a user-defined link to the group. These UD links have no udata. */ + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create a non-default lapl with a new property pointing to group a*/ - if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - HDstrcpy(group_a_name, "group_a"); + /* Create a non-default lapl with a new property pointing to group a*/ + if((plist_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + HDstrcpy(group_a_name, "group_a"); if(H5Pinsert2(plist_id, DEST_PROP_NAME, (size_t)NAME_BUF_SIZE, group_a_name, NULL, NULL, NULL, NULL, NULL, NULL) < 0) TEST_ERROR - /* Try opening group through UD link */ - if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Try opening group through UD link */ + if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "subgroup_a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Verify that we can open the new group without using the ud link */ + if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Now use the same ud link to access group_b */ - strcpy(group_b_name, "group_b"); + /* Now use the same ud link to access group_b */ + strcpy(group_b_name, "group_b"); if(H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR - /* Create a subgroup */ - if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Create a subgroup */ + if((gid = H5Oopen(fid, "ud_link", plist_id)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "subgroup_b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR + /* Verify that we can open the new group without using the ud link */ + if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR - /* Close property list */ - if(H5Pclose(plist_id) < 0) TEST_ERROR + /* Close property list */ + if(H5Pclose(plist_id) < 0) TEST_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Pclose (plist_id); - H5Gclose (gid); - H5Gclose (gid2); - H5Fclose (fid); + H5Pclose (plist_id); + H5Gclose (gid); + H5Gclose (gid2); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end lapl_udata() */ - + /*------------------------------------------------------------------------- * Function: ud_link_errors * @@ -8596,19 +8592,19 @@ lapl_udata(hid_t fapl, hbool_t new_format) */ static herr_t UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc_group, - const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) + const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { /* Check to make sure that this "soft link" has a target */ if(udata_size < 1 || !udata) - return -1; + return -1; return 0; } /* end UD_cbsucc_create() */ static hid_t UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, - const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, - hid_t H5_ATTR_UNUSED dxpl_id) + const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id) { const char *target = (const char *)udata; hid_t ret_value; @@ -8619,14 +8615,14 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, return ret_value; - error: +error: return -1; } /* end UD_cbsucc_traverse() */ /* Failure callback for when the link is moved or renamed */ static herr_t UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ return -1; @@ -8635,7 +8631,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc /* SuccessCallback for when the link is moved or renamed */ static herr_t UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always succeed. */ return 0; @@ -8644,7 +8640,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This callback will always succeed */ return 0; @@ -8653,7 +8649,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file /* Callback for when the link is deleted. Also called during move */ static herr_t UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file, - const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) + const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ /* Note: un-deletable links are in general a very bad idea! */ @@ -8663,7 +8659,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file /* Callback for when the link is queried */ static ssize_t UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) + size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will always fail. */ return -1; @@ -8672,12 +8668,12 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED /* Callback for when the link is queried */ static ssize_t UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size) + size_t H5_ATTR_UNUSED udata_size, void *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will return a buffer size, - * but will fail when a buffer is passed in ("writing to the buffer" - * fails - */ + * but will fail when a buffer is passed in ("writing to the buffer" + * fails + */ if(buf != NULL) return -1; @@ -8688,12 +8684,12 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT /* Callback for when the link is queried */ static ssize_t UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED *udata, - size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size) + size_t H5_ATTR_UNUSED udata_size, void *buf, size_t buf_size) { /* This traversal function will return a buffer size, - * but will fail when a buffer is passed in ("writing to the buffer" - * fails - */ + * but will fail when a buffer is passed in ("writing to the buffer" + * fails + */ if(buf != NULL && buf_size >= 8) HDstrcpy((char *)buf, "succeed"); @@ -8703,120 +8699,120 @@ UD_cbsucc_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED /* This class is full of failing callbacks */ const H5L_class_t UD_cbfail_class1[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link1", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbfail_move, /* Move/rename callback */ - UD_cbfail_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbfail_delete, /* Deletion callback */ - UD_cbfail_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link1", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbfail_move, /* Move/rename callback */ + UD_cbfail_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbfail_delete, /* Deletion callback */ + UD_cbfail_query /* Query callback */ }}; /* This class is has two failing callbacks, move and query */ const H5L_class_t UD_cbfail_class2[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link2", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbfail_move, /* Move/rename callback */ - UD_cbsucc_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbsucc_delete, /* Deletion callback */ - UD_cbfail_on_write_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link2", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbfail_move, /* Move/rename callback */ + UD_cbsucc_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbsucc_delete, /* Deletion callback */ + UD_cbfail_on_write_query /* Query callback */ }}; /* All of these callbacks will succeed */ const H5L_class_t UD_cbfail_class3[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ - "UD_cbfail_link3", /* Link class name for debugging */ - UD_cbsucc_create, /* Creation callback */ - UD_cbsucc_move, /* Move/rename callback */ - UD_cbsucc_move, /* Copy callback */ - UD_cbsucc_traverse, /* The actual traversal function */ - UD_cbsucc_delete, /* Deletion callback */ - UD_cbsucc_query /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_CBFAIL_TYPE, /* Link type id number */ + "UD_cbfail_link3", /* Link class name for debugging */ + UD_cbsucc_create, /* Creation callback */ + UD_cbsucc_move, /* Move/rename callback */ + UD_cbsucc_move, /* Copy callback */ + UD_cbsucc_traverse, /* The actual traversal function */ + UD_cbsucc_delete, /* Deletion callback */ + UD_cbsucc_query /* Query callback */ }}; /* Link classes that are invalid for various reasons */ const H5L_class_t UD_error1_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - NULL, /* This class has no traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + NULL, /* This class has no traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error2_class[1] = {{ - UD_BAD_VERS, /* Invalid H5L_class_t version */ - (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + UD_BAD_VERS, /* Invalid H5L_class_t version */ + (H5L_type_t)UD_ERROR_TYPE, /* Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error3_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_BAD_TYPE1, /* Invalid Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_BAD_TYPE1, /* Invalid Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; const H5L_class_t UD_error4_class[1] = {{ - H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ - (H5L_type_t)UD_BAD_TYPE2, /* Invalid Link type id number */ - "UD_error_link", /* Link class name for debugging */ - NULL, /* Creation callback */ - NULL, /* Move/rename callback */ - NULL, /* Copy callback */ - UD_cbsucc_traverse, /* Traversal function */ - NULL, /* Deletion callback */ - NULL /* Query callback */ + H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ + (H5L_type_t)UD_BAD_TYPE2, /* Invalid Link type id number */ + "UD_error_link", /* Link class name for debugging */ + NULL, /* Creation callback */ + NULL, /* Move/rename callback */ + NULL, /* Copy callback */ + UD_cbsucc_traverse, /* Traversal function */ + NULL, /* Deletion callback */ + NULL /* Query callback */ }}; static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; H5L_info_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") - else - TESTING("user-defined link error conditions") + else + TESTING("user-defined link error conditions") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Try to register some invalid link classes */ - H5E_BEGIN_TRY { - if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR + /* Try to register some invalid link classes */ + H5E_BEGIN_TRY { + if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR } H5E_END_TRY /* Register the UD plist class. */ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR /* Now register the first class we'll be using. - * It has the same ID as the plist class, and should replace it. */ + * It has the same ID as the plist class, and should replace it. */ if(H5Lregister(UD_cbfail_class1) < 0) FAIL_STACK_ERROR /* Create a group for the UD link to point to */ @@ -8827,86 +8823,86 @@ ud_link_errors(hid_t fapl, hbool_t new_format) H5E_BEGIN_TRY { if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR } H5E_END_TRY /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Open the group through the ud link */ - if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Open the group through the ud link */ + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Now test that each of the callbacks will cause a failure if it returns -1 */ - H5E_BEGIN_TRY { - /* The create callback will fail if we pass in no udata */ - if(H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + /* Now test that each of the callbacks will cause a failure if it returns -1 */ + H5E_BEGIN_TRY { + /* The create callback will fail if we pass in no udata */ + if(H5Lcreate_ud(fid, "fail", (H5L_type_t)UD_CBFAIL_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - /* The move and copy callbacks will fail */ - if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + /* The move and copy callbacks will fail */ + if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - /* The traversal callback will fail if we remove its target */ - if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR - if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR + /* The traversal callback will fail if we remove its target */ + if(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR - /* The deletion callback will always fail */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR + /* The deletion callback will always fail */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR - /* The query callback will fail */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY + /* The query callback will fail */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY - /* Now use a class with different callback functions */ - if(H5Lregister(UD_cbfail_class2) < 0) FAIL_STACK_ERROR + /* Now use a class with different callback functions */ + if(H5Lregister(UD_cbfail_class2) < 0) FAIL_STACK_ERROR - /* Moving should still fail, but copying will succeed */ - H5E_BEGIN_TRY { - if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR - } H5E_END_TRY - if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* The query callback will succeed when we only want to get the size of the buffer... */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 0) TEST_ERROR - /* ...but fail when we try to write data to the buffer itself*/ - H5E_BEGIN_TRY { - if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR - } H5E_END_TRY + /* Moving should still fail, but copying will succeed */ + H5E_BEGIN_TRY { + if(H5Lmove(fid, "ud_link", H5L_SAME_LOC, "move_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + } H5E_END_TRY + if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Register a new class */ - if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR + /* The query callback will succeed when we only want to get the size of the buffer... */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 0) TEST_ERROR + /* ...but fail when we try to write data to the buffer itself*/ + H5E_BEGIN_TRY { + if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) >=0) TEST_ERROR + } H5E_END_TRY - /* Now querying should succeed */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(li.u.val_size != 8) TEST_ERROR - if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR + /* Register a new class */ + if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR - /* Moving and copying should both succeed */ - if(H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Now querying should succeed */ + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(li.u.val_size != 8) TEST_ERROR + if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR - /* Delete link (this callback should work now) */ - if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Moving and copying should both succeed */ + if(H5Lmove(fid, "copy_succ", H5L_SAME_LOC, "move_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Delete link (this callback should work now) */ + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + /* Close file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - error: - H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); - } H5E_END_TRY; - return -1; -} /* end ud_link_errors() */ + PASSED(); + return 0; +error: + H5E_BEGIN_TRY { + H5Gclose (gid); + H5Fclose (fid); + } H5E_END_TRY; + return -1; +} /* end ud_link_errors() */ + /*------------------------------------------------------------------------- * Function: lapl_nlinks * @@ -8927,223 +8923,223 @@ ud_link_errors(hid_t fapl, hbool_t new_format) static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t plist = (-1); /* lapl ID */ hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") - else - TESTING("adjusting nlinks with LAPL") + else + TESTING("adjusting nlinks with LAPL") - /* Make certain test is valid */ - /* XXX: should probably make a "generic" test that creates the proper - * # of links based on this value - QAK - */ - HDassert(H5L_NUM_LINKS == 16); + /* Make certain test is valid */ + /* XXX: should probably make a "generic" test that creates the proper + * # of links based on this value - QAK + */ + HDassert(H5L_NUM_LINKS == 16); /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with short name in file (used as target for links) */ - if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create chain of soft links to existing object (limited) */ - if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Create LAPL with higher-than-usual nlinks value */ - /* Create a non-default lapl with udata set to point to the first group */ - if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR - nlinks = 20; + /* Create group with short name in file (used as target for links) */ + if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Create chain of soft links to existing object (limited) */ + if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Open file */ + if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create LAPL with higher-than-usual nlinks value */ + /* Create a non-default lapl with udata set to point to the first group */ + if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR + nlinks = 20; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - /* Ensure that nlinks was set successfully */ - nlinks = 0; + /* Ensure that nlinks was set successfully */ + nlinks = 0; if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR - if(nlinks != 20) TEST_ERROR + if(nlinks != 20) TEST_ERROR - /* Open object through what is normally too many soft links using - * new property list */ - if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR + /* Open object through what is normally too many soft links using + * new property list */ + if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft17")) TEST_ERROR + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft17")) TEST_ERROR - /* Create group using soft link */ - if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group using soft link */ + if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Set nlinks to a smaller number */ - nlinks = 4; + /* Set nlinks to a smaller number */ + nlinks = 4; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - /* Ensure that nlinks was set successfully */ - nlinks = 0; + /* Ensure that nlinks was set successfully */ + nlinks = 0; if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR - if(nlinks != 4) TEST_ERROR + if(nlinks != 4) TEST_ERROR - /* Try opening through what is now too many soft links */ - H5E_BEGIN_TRY { - gid = H5Oopen(fid, "soft5", plist); - } H5E_END_TRY; - if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; - } + /* Try opening through what is now too many soft links */ + H5E_BEGIN_TRY { + gid = H5Oopen(fid, "soft5", plist); + } H5E_END_TRY; + if (gid >= 0) { + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; + } - /* Open object through lesser soft link */ - if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR - - /* Check name */ - if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR - if(HDstrcmp(objname, "/soft4")) TEST_ERROR - - - /* Test other functions that should use a LAPL */ - nlinks = 20; - if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR - - /* Try copying and moving when both src and dst contain many soft links - * using a non-default LAPL - */ - if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Olink */ - if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Lcreate_hard and H5Lcreate_soft */ - if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* H5Ldelete */ - if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR - - /* H5Lget_val and H5Lget_info */ - if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR - if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR - - /* H5Lcreate_external and H5Lcreate_ud */ - if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR - if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR - if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR - - /* Close plist */ - if(H5Pclose(plist) < 0) TEST_ERROR - - - /* Create a datatype and dataset as targets inside the group */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - - dims[0] = 2; - dims[1] = 2; - if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR - if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR - - /* Try to open the objects using too many symlinks with default *APLs */ - H5E_BEGIN_TRY { - if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) - FAIL_PUTS_ERROR(" Should have failed for too many nested links.") - } H5E_END_TRY - - /* Create property lists with nlinks set */ - if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR - if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR - - nlinks = 20; - if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR - if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR - if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR - - /* We should now be able to use these property lists to open each kind - * of object. - */ - if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR - if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR - if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR - - /* Close objects */ - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR - - /* Close plists */ - if(H5Pclose(gapl) < 0) TEST_ERROR - if(H5Pclose(tapl) < 0) TEST_ERROR - if(H5Pclose(dapl) < 0) TEST_ERROR - - /* Unregister UD hard link class */ - if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - PASSED(); - return 0; - - error: - H5E_BEGIN_TRY { - H5Pclose(gapl); - H5Pclose(dapl); - H5Pclose(tapl); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(plist); - H5Fclose(fid); - } H5E_END_TRY; - return -1; -} /* end lapl_nlinks() */ + /* Open object through lesser soft link */ + if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR + + /* Check name */ + if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR + if(HDstrcmp(objname, "/soft4")) TEST_ERROR + + + /* Test other functions that should use a LAPL */ + nlinks = 20; + if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR + + /* Try copying and moving when both src and dst contain many soft links + * using a non-default LAPL + */ + if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Olink */ + if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Lcreate_hard and H5Lcreate_soft */ + if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* H5Ldelete */ + if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR + /* H5Lget_val and H5Lget_info */ + if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR + if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR + /* H5Lcreate_external and H5Lcreate_ud */ + if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR + if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR + if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR + + /* Close plist */ + if(H5Pclose(plist) < 0) TEST_ERROR + + + /* Create a datatype and dataset as targets inside the group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + + dims[0] = 2; + dims[1] = 2; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR + if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) TEST_ERROR + + /* Try to open the objects using too many symlinks with default *APLs */ + H5E_BEGIN_TRY { + if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0) + FAIL_PUTS_ERROR(" Should have failed for too many nested links.") + } H5E_END_TRY + + /* Create property lists with nlinks set */ + if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR + if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR + + nlinks = 20; + if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR + if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR + + /* We should now be able to use these property lists to open each kind + * of object. + */ + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR + if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR + if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR + + /* Close objects */ + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Close plists */ + if(H5Pclose(gapl) < 0) TEST_ERROR + if(H5Pclose(tapl) < 0) TEST_ERROR + if(H5Pclose(dapl) < 0) TEST_ERROR + + /* Unregister UD hard link class */ + if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end lapl_nlinks() */ + + /*------------------------------------------------------------------------- * Function: linkinfo * @@ -9160,77 +9156,77 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t tid = (-1); /* Type ID */ hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") - else - TESTING("link type field in H5Lget_info") + else + TESTING("link type field in H5Lget_info") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Register a couple of user-defined link classes with the library */ - if(H5Lregister(UD_plist_class) < 0) TEST_ERROR - - /* Create an object of each type */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - - if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - - if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Register a couple of user-defined link classes with the library */ + if(H5Lregister(UD_plist_class) < 0) TEST_ERROR - /* Close all objects */ - if(H5Tclose(tid) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + /* Create an object of each type */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Make sure that link type is correct when objects are queried */ - if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR - if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_HARD) TEST_ERROR + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR - if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5L_TYPE_SOFT) TEST_ERROR - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != UD_PLIST_TYPE) TEST_ERROR + if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Ensure that passing a NULL pointer doesn't cause an error */ - if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR + /* Close all objects */ + if(H5Tclose(tid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR + + /* Make sure that link type is correct when objects are queried */ + if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_HARD) TEST_ERROR + + if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR + if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(li.type != UD_PLIST_TYPE) TEST_ERROR + + /* Ensure that passing a NULL pointer doesn't cause an error */ + if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: + error: H5E_BEGIN_TRY { - H5Tclose (tid); - H5Dclose (did); - H5Gclose (gid); - H5Fclose (fid); + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end linkinfo() */ - + /*------------------------------------------------------------------------- * Function: check_all_closed * @@ -9258,26 +9254,26 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) if(new_format) TESTING("that all files were closed correctly (w/new group format)") - else - TESTING("that all files were closed correctly") - - /* Some of the external or UD link tests may have failed to close - * an external file properly. - * To check this, try to create every file used in this test. If - * a file is already open, creating it will fail. - */ - for(x=0; FILENAME[x] != NULL && x < stopat; x++) - { - h5_fixname(FILENAME[x], fapl, filename, sizeof filename); - - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - } + else + TESTING("that all files were closed correctly") + + /* Some of the external or UD link tests may have failed to close + * an external file properly. + * To check this, try to create every file used in this test. If + * a file is already open, creating it will fail. + */ + for(x=0; FILENAME[x] != NULL && x < stopat; x++) + { + h5_fixname(FILENAME[x], fapl, filename, sizeof filename); + + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + } PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; @@ -9285,7 +9281,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) } /* end check_all_closed() */ - + /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9315,77 +9311,77 @@ build_visit_file(hid_t fapl) /* Create file for visiting */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group */ - if((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group */ + if((gid = H5Gcreate2(fid, "/Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create nested group */ - if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create nested group */ + if((gid2 = H5Gcreate2(gid, "Group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close groups */ - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + /* Close groups */ + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) TEST_ERROR - /* Create soft links to groups created */ - if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft links to groups created */ + if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dangling soft link */ - if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling soft link */ + if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create hard links to all groups */ - if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create hard links to all groups */ + if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/Group1/Group2", fid, "hard_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create loops w/hard links */ - if(H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create loops w/hard links */ + if(H5Lcreate_hard(fid, "/Group1", fid, "/Group1/hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_hard(fid, "/", fid, "/Group1/Group2/hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create external link to existing file */ - if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link to existing file */ + if(H5Lcreate_external(pathname, "/group", fid, "/ext_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dangling external link to non-existent file */ - if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling external link to non-existent file */ + if(H5Lcreate_external("foo.h5", "/group", fid, "/ext_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create dataset in each group */ - if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + /* Create dataset in each group */ + if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose(did) < 0) TEST_ERROR + if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(did) < 0) TEST_ERROR - if(H5Sclose(sid) < 0) TEST_ERROR + if(H5Sclose(sid) < 0) TEST_ERROR - /* Create named datatype in each group */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + /* Create named datatype in each group */ + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Type_zero", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Group1/Type_one", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR - if(H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Tclose(tid) < 0) TEST_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid, "/Group1/Group2/Type_two", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(tid) < 0) TEST_ERROR - return(fid); + return(fid); - error: +error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; return -1; } /* end build_visit_file() */ - + /*------------------------------------------------------------------------- * Function: visit_link_cb * @@ -9401,7 +9397,7 @@ build_visit_file(hid_t fapl) */ static int visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, - void *_op_data) + void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -9415,7 +9411,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t return(H5_ITER_CONT); } /* end visit_link_cb() */ - + /*------------------------------------------------------------------------- * Function: link_visit * @@ -9438,46 +9434,46 @@ link_visit(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link visiting (w/new group format)") - else - TESTING("link visiting") + else + TESTING("link visiting") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the links reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the links reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from each internal group */ + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9485,7 +9481,7 @@ link_visit(hid_t fapl, hbool_t new_format) return -1; } /* end link_visit() */ - + /*------------------------------------------------------------------------- * Function: link_visit_by_name * @@ -9508,54 +9504,54 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(new_format) TESTING("link visiting by name (w/new group format)") - else - TESTING("link visiting by name") + else + TESTING("link visiting by name") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the links reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the links reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the links reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit0; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ - udata.idx = 0; + /* Visit all the links reachable from each internal group */ + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit1; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = lvisit2; if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9563,7 +9559,7 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) return -1; } /* end link_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_cb * @@ -9579,7 +9575,7 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) */ static int visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, - void *_op_data) + void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9593,7 +9589,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit * @@ -9616,46 +9612,46 @@ obj_visit(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object visiting (w/new group format)") - else - TESTING("object visiting") + else + TESTING("object visiting") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the objects reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the objects reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from each internal group */ + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9663,7 +9659,7 @@ obj_visit(hid_t fapl, hbool_t new_format) return -1; } /* end obj_visit() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_by_name * @@ -9686,55 +9682,55 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object visiting by name (w/new group format)") - else - TESTING("object visiting by name") + else + TESTING("object visiting by name") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Visit all the objects reachable from the root group (with file ID) */ - udata.idx = 0; + /* Visit all the objects reachable from the root group (with file ID) */ + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from the root group (with group ID) */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + /* Visit all the objects reachable from the root group (with group ID) */ + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ - udata.idx = 0; + /* Visit all the objects reachable from each internal group */ + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - udata.idx = 0; + if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); @@ -9742,7 +9738,7 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) return -1; } /* end obj_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_stop_cb * @@ -9757,7 +9753,7 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) */ static int visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, - void *_op_data) + void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9767,7 +9763,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name return(H5_ITER_STOP); } /* end visit_obj_stop_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_stop * @@ -9791,42 +9787,42 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) if(new_format) TESTING("stopping object iteration (w/new group format)") - else - TESTING("stopping object iteration") + else + TESTING("stopping object iteration") - /* Construct "interesting" file to visit */ - if((fid = build_visit_file(fapl)) < 0) TEST_ERROR + /* Construct "interesting" file to visit */ + if((fid = build_visit_file(fapl)) < 0) TEST_ERROR - /* Start iteration. The callback should only be called once because it - * returns H5_ITER_STOP - */ - nvisited = 0; + /* Start iteration. The callback should only be called once because it + * returns H5_ITER_STOP + */ + nvisited = 0; if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR - if(ret != H5_ITER_STOP) TEST_ERROR - if(nvisited != 1) TEST_ERROR + if(ret != H5_ITER_STOP) TEST_ERROR + if(nvisited != 1) TEST_ERROR - /* Same test with H5Ovisit_by_name */ - nvisited = 0; + /* Same test with H5Ovisit_by_name */ + nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(ret != H5_ITER_STOP) TEST_ERROR - if(nvisited != 1) TEST_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(ret != H5_ITER_STOP) TEST_ERROR + if(nvisited != 1) TEST_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; return -1; } /* end obj_visit_stop() */ - + /*------------------------------------------------------------------------- * Function: link_filters * @@ -9882,8 +9878,8 @@ static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id } /* end link_filter_set_local */ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, - const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, - void H5_ATTR_UNUSED **buf) + const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, + void H5_ATTR_UNUSED **buf) { if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0; @@ -9918,20 +9914,20 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; /* This test actually always uses the new group format for the main group. - * The new format flag affects the version of object header messages, - * etc., which are important for this test. */ + * The new format flag affects the version of object header messages, + * etc., which are important for this test. */ if(new_format) TESTING("group link filters (w/new group format)") - else - TESTING("group link filters") + else + TESTING("group link filters") - /* Initialize link filter state global */ - link_filter_state = LFS_INIT; + /* Initialize link filter state global */ + link_filter_state = LFS_INIT; /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -9939,21 +9935,21 @@ link_filters(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create gcpl, force use of dense storage */ - if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR - - /* Add deflate and checksum filters, if available */ - if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR - if(tri_ret) { - if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR - nfilters++; - } /* end if */ + /* Create gcpl, force use of dense storage */ + if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + if(H5Pset_link_phase_change(gcpl1, 2, 2) < 0) TEST_ERROR + + /* Add deflate and checksum filters, if available */ + if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR + if(tri_ret) { + if(H5Pset_deflate(gcpl1, 6) < 0) TEST_ERROR + nfilters++; + } /* end if */ if((tri_ret = H5Zfilter_avail(H5Z_FILTER_FLETCHER32)) < 0) TEST_ERROR - if(tri_ret) { - if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR - nfilters++; - } /* end if */ + if(tri_ret) { + if(H5Pset_fletcher32(gcpl1) < 0) TEST_ERROR + nfilters++; + } /* end if */ /* Register and add custom filter */ filter_class.version = H5Z_CLASS_T_VERS; @@ -9965,248 +9961,248 @@ link_filters(hid_t fapl, hbool_t new_format) filter_class.set_local = link_filter_set_local; filter_class.filter = link_filter_filter; if(H5Zregister(&filter_class) < 0) TEST_ERROR - if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR - nfilters++; + if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) + TEST_ERROR + nfilters++; /* Test various other filter functions for use on gcpl's */ if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR + if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR - /* Create a group using this filter, add some soft links to it */ - if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file and group */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Verify the filter has been applied */ - if(link_filter_state != LFS_ENCODED) TEST_ERROR - - /* Reopen file and group */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - - /* Retrieve gcpl, verify number of filters */ - if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Now try copying gcpl1, and verify number of filters */ - if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Add another soft link */ - if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Copy the group */ - if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR - - /* Verify that all links have been copied */ - if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR - if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR - - /* Retrieve gcpl, verify number of filters */ - if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR - - /* Delete 3 links to force the group back into compact mode */ - if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR - if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR - - /* Close file and groups */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Gclose(gid2) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR - - /* Reset link filter state */ - link_filter_state = LFS_INIT; + /* Create a group using this filter, add some soft links to it */ + if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close file and group */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Verify the filter has been applied */ + if(link_filter_state != LFS_ENCODED) TEST_ERROR + + /* Reopen file and group */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR + + /* Retrieve gcpl, verify number of filters */ + if((gcpl2 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Now try copying gcpl1, and verify number of filters */ + if((gcpl2 = H5Pcopy(gcpl1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Add another soft link */ + if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Copy the group */ + if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR + + /* Verify that all links have been copied */ + if(H5Lexists(gid2, "link1", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link2", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link3", H5P_DEFAULT) != TRUE) TEST_ERROR + if(H5Lexists(gid2, "link4", H5P_DEFAULT) != TRUE) TEST_ERROR + + /* Retrieve gcpl, verify number of filters */ + if((gcpl2 = H5Gget_create_plist(gid2)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl2) != nfilters) TEST_ERROR + + /* Delete 3 links to force the group back into compact mode */ + if(H5Ldelete(gid1, "link2", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(gid1, "link3", H5P_DEFAULT) < 0) TEST_ERROR + if(H5Ldelete(gid1, "link4", H5P_DEFAULT) < 0) TEST_ERROR + + /* Close file and groups */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR + + /* Reset link filter state */ + link_filter_state = LFS_INIT; /* Reopen file and group, add 2 links */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - /* Close file and group */ - if(H5Gclose(gid1) < 0) TEST_ERROR - if(H5Fclose(fid) < 0) TEST_ERROR + /* Close file and group */ + if(H5Gclose(gid1) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) TEST_ERROR - /* Verify that the filter was reapplied */ - if(link_filter_state != LFS_ENCODED) TEST_ERROR + /* Verify that the filter was reapplied */ + if(link_filter_state != LFS_ENCODED) TEST_ERROR - /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ - if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR - if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, - &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR - - /* Test H5Pmodify_filter */ - cd_value++; + /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ + if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR + if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, + &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR + + /* Test H5Pmodify_filter */ + cd_value++; if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR - if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) + TEST_ERROR + if(flags_out != 0 || cd_value_out != cd_value + || HDstrcmp(filter_class.name, name_out) + || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) + TEST_ERROR + + /* Test H5Premove_filter */ + if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR + H5E_BEGIN_TRY { + status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, + &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, + &filter_config_out); + } H5E_END_TRY + if(status >= 0) TEST_ERROR + + /* Close remaining ids */ + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Pclose(gcpl2) < 0) TEST_ERROR + + /* Now create an object in the compressed group, creating intermediate + * groups, to verify that the filter pipeline is inherited for the groups + * that are created along the way */ + /* Reopen file */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + + /* Create lcpl, setting the "create intermediate groups" flag */ + if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR + if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR + + /* Create new group, with missing intermediate groups, in compressed group */ + if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Close LCPL ID */ + if(H5Pclose(lcpl) < 0) TEST_ERROR + + /* Verify that new group doesn't have filters */ + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR + + /* Close group & GCPL IDs */ + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + + /* Open intermediate groups that were created and verify that they have filters */ + if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR + if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR + if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR + if(H5Pclose(gcpl1) < 0) TEST_ERROR + if(H5Gclose(gid1) < 0) TEST_ERROR + + /* Close file */ + if(H5Fclose(fid) < 0) TEST_ERROR + + + /* Now create the same file with and without deflate, and verify that the + * file size is smaller with deflate */ + /* But only if the deflate filter is available */ + if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR + if(tri_ret) { + h5_stat_size_t filesize_filtered; + h5_stat_size_t filesize_unfiltered; + + /* Create gcpl, force use of dense storage */ + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR + if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR + + /* Create file */ + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR - if(flags_out != 0 || cd_value_out != cd_value - || HDstrcmp(filter_class.name, name_out) - || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR - /* Test H5Premove_filter */ - if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR - H5E_BEGIN_TRY { - status = H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, - &flags_out, &cd_nelmts, &cd_value_out, (size_t)24, name_out, - &filter_config_out); - } H5E_END_TRY - if(status >= 0) TEST_ERROR - - /* Close remaining ids */ - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Pclose(gcpl2) < 0) TEST_ERROR - - /* Now create an object in the compressed group, creating intermediate - * groups, to verify that the filter pipeline is inherited for the groups - * that are created along the way */ - /* Reopen file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - - /* Create lcpl, setting the "create intermediate groups" flag */ - if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR - if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR - - /* Create new group, with missing intermediate groups, in compressed group */ - if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Close LCPL ID */ - if(H5Pclose(lcpl) < 0) TEST_ERROR - - /* Verify that new group doesn't have filters */ - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != 0) TEST_ERROR - - /* Close group & GCPL IDs */ - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - - /* Open intermediate groups that were created and verify that they have filters */ - if((gid1 = H5Gopen2(fid, "group1/group2", H5P_DEFAULT)) < 0) TEST_ERROR - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - if((gid1 = H5Gopen2(fid, "group1/group2/group3", H5P_DEFAULT)) < 0) TEST_ERROR - if((gcpl1 = H5Gget_create_plist(gid1)) < 0) TEST_ERROR - if(H5Pget_nfilters(gcpl1) != nfilters) TEST_ERROR - if(H5Pclose(gcpl1) < 0) TEST_ERROR - if(H5Gclose(gid1) < 0) TEST_ERROR - - /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR - - - /* Now create the same file with and without deflate, and verify that the - * file size is smaller with deflate */ - /* But only if the deflate filter is available */ - if((tri_ret = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) < 0) TEST_ERROR - if(tri_ret) { - h5_stat_size_t filesize_filtered; - h5_stat_size_t filesize_unfiltered; - - /* Create gcpl, force use of dense storage */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR - - /* Create file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR - - /* Create links in file */ - if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file, get file size */ - if(H5Fclose(fid) < 0) TEST_ERROR - filesize_unfiltered = h5_get_file_size(filename, fapl); - - /* Set deflate fitler */ - if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR - - /* Recreate the same file with the deflate filter */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close file, get file size */ - if(H5Fclose(fid) < 0) TEST_ERROR - filesize_filtered = h5_get_file_size(filename, fapl); - - /* Check that the file size is smaller with the filter */ - if((double)filesize_filtered - > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR - - /* Close */ - if(H5Pclose(fcpl) < 0) TEST_ERROR - } /* end if */ + /* Create links in file */ + if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR - PASSED(); - return 0; + /* Close file, get file size */ + if(H5Fclose(fid) < 0) TEST_ERROR + filesize_unfiltered = h5_get_file_size(filename, fapl); - error: - H5E_BEGIN_TRY { - H5Gclose(gid1); - H5Gclose(gid2); - H5Fclose(fid); - H5Pclose(lcpl); - H5Pclose(gcpl1); - H5Pclose(gcpl2); - H5Pclose(fcpl); - } H5E_END_TRY; - return -1; -} /* end link_filters() */ + /* Set deflate fitler */ + if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR + + /* Recreate the same file with the deflate filter */ + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + if(H5Lcreate_soft("/", fid, "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Close file, get file size */ + if(H5Fclose(fid) < 0) TEST_ERROR + filesize_filtered = h5_get_file_size(filename, fapl); + + /* Check that the file size is smaller with the filter */ + if((double)filesize_filtered + > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + TEST_ERROR + /* Close */ + if(H5Pclose(fcpl) < 0) TEST_ERROR + } /* end if */ + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid1); + H5Gclose(gid2); + H5Fclose(fid); + H5Pclose(lcpl); + H5Pclose(gcpl1); + H5Pclose(gcpl2); + H5Pclose(fcpl); + } H5E_END_TRY; + return -1; +} /* end link_filters() */ + /*------------------------------------------------------------------------- * Function: obj_exists * @@ -10230,18 +10226,18 @@ obj_exists(hid_t fapl, hbool_t new_format) if(new_format) TESTING("object exists (w/new group format)") - else - TESTING("object exists") + else + TESTING("object exists") - /* Set up filename and create file*/ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Set up filename and create file*/ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Hard links */ - /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ - H5E_BEGIN_TRY { +/* Hard links */ + /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ + H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); } H5E_END_TRY if(status >= 0) TEST_ERROR @@ -10249,252 +10245,252 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Create a group, as a destination for testing */ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() succeeds for hard linked object */ - if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() succeeds for hard linked object */ + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) + TEST_ERROR - /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ - H5E_BEGIN_TRY { - status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); - } H5E_END_TRY - if(status >= 0) TEST_ERROR + /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ + H5E_BEGIN_TRY { + status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); + } H5E_END_TRY + if(status >= 0) TEST_ERROR - /* Soft links */ - /* Create dangling soft-link in root group */ - if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR +/* Soft links */ + /* Create dangling soft-link in root group */ + if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ - if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to object */ - if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to object */ + if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling soft-link in non-root group */ - if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create dangling soft-link in non-root group */ + if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to object */ - if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to object */ + if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) + TEST_ERROR - /* External links */ - /* Create dangling (file doesn't exist) external link in root group */ - if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR +/* External links */ + /* Create dangling (file doesn't exist) external link in root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (object doesn't exist) external link in root group */ - if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (object doesn't exist) external link in root group */ + if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to object */ - if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) + TEST_ERROR - /* Create dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to object */ - if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) + TEST_ERROR - /* Soft->External links */ - /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ - if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR +/* Soft->External links */ + /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ - if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to external link that points to object */ - if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to external link that points to object */ + if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in root group that points to external link in non-root group that points to object */ - if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ - if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ + if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ - if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ + if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to external link that points to object */ - if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to external link that points to object */ + if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ - if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ + if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) + TEST_ERROR - /* Create soft-link in non-root group that points to external link in non-root group that points to object */ - if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Create soft-link in non-root group that points to external link in non-root group that points to object */ + if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) + TEST_ERROR - /* External->Soft links */ - /* Create external link in root group that points to dangling soft link in root group */ - if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR +/* External->Soft links */ + /* Create external link in root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to dangling soft link in non-root group */ - if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to dangling soft link in root group */ - if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to dangling soft link in root group */ + if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to soft link in root group that points to object */ - if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to soft link in root group that points to object */ + if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to dangling soft link in non-root group */ - if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to dangling soft link in non-root group */ + if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns FALSE */ + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) + TEST_ERROR - /* Create external link in non-root group that points to soft link in non-root group that points to object */ - if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create external link in non-root group that points to soft link in non-root group that points to object */ + if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR + /* Verify that H5Oexists_by_name() returns TRUE */ + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) + TEST_ERROR - /* Close file created */ - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close file created */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); - } H5E_END_TRY; - return -1; +error: + H5E_BEGIN_TRY { + H5Gclose(gid); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } /* end obj_exists() */ - + /*------------------------------------------------------------------------- * Function: corder_create_empty * @@ -10511,10 +10507,10 @@ obj_exists(hid_t fapl, hbool_t new_format) static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10524,84 +10520,84 @@ corder_create_empty(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order indexing on group */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR + /* Set creation order indexing on group */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR - /* Setting invalid combination of a group order creation order indexing on should fail */ - H5E_BEGIN_TRY { - ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); - } H5E_END_TRY; - if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR - } /* end if */ + /* Setting invalid combination of a group order creation order indexing on should fail */ + H5E_BEGIN_TRY { + ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); + } H5E_END_TRY; + if(ret > 0) { + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR + } /* end if */ - /* Set creation order tracking & indexing on group */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != 0) TEST_ERROR - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != 0) TEST_ERROR + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + /* Check on group's status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Check on group's status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + /* Check on group's status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - /* Retrieve group creation property list for group */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + /* Retrieve group creation property list for group */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR - if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) TEST_ERROR + if(crt_order_flags != (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - return 0; + PASSED(); + return 0; - error: - H5E_BEGIN_TRY { - H5Pclose(gcpl_id); - H5Gclose(group_id); - H5Fclose(file_id); - } H5E_END_TRY; - return -1; +error: + H5E_BEGIN_TRY { + H5Pclose(gcpl_id); + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return -1; } /* end corder_create_empty() */ - + /*------------------------------------------------------------------------- * Function: corder_create_compact * @@ -10619,12 +10615,12 @@ corder_create_empty(hid_t fapl) static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10635,82 +10631,82 @@ corder_create_compact(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's initial status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Create several links, but keep group in compact form */ - for(u = 0; u < max_compact; u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Create several links, but keep group in compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (u + 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - - - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != max_compact) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - /* Loop through links, checking their creation order values */ - /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < max_compact; u++) { - H5L_info_t linfo; /* Link information */ + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Retrieve information for link */ - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify creation order of link */ - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != u) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != max_compact) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < max_compact; u++) { + H5L_info_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -10719,7 +10715,7 @@ corder_create_compact(hid_t fapl) return -1; } /* end corder_create_compact() */ - + /*------------------------------------------------------------------------- * Function: corder_create_dense * @@ -10737,12 +10733,12 @@ corder_create_compact(hid_t fapl) static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10755,95 +10751,95 @@ corder_create_dense(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check on group's initial status */ - if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + /* Check on group's initial status */ + if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (u + 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (u + 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + } /* end for */ /* Create another link, to push group into dense form */ HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Loop through links, checking their creation order values */ - /* (the name index is used, but the creation order value is in the same order) */ - for(u = 0; u < (max_compact + 1); u++) { - H5L_info_t linfo; /* Link information */ - - /* Retrieve information for link */ - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify creation order of link */ - if(linfo.corder_valid != TRUE) TEST_ERROR - if(linfo.corder != u) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Loop through links, checking their creation order values */ + /* (the name index is used, but the creation order value is in the same order) */ + for(u = 0; u < (max_compact + 1); u++) { + H5L_info_t linfo; /* Link information */ + + /* Retrieve information for link */ + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify creation order of link */ + if(linfo.corder_valid != TRUE) TEST_ERROR + if(linfo.corder != u) TEST_ERROR + } /* end for */ /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -10852,7 +10848,7 @@ corder_create_dense(hid_t fapl) return -1; } /* end corder_create_dense() */ - + /*------------------------------------------------------------------------- * Function: corder_transition * @@ -10870,12 +10866,12 @@ corder_create_dense(hid_t fapl) static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ h5_stat_size_t empty_size; /* Size of empty file */ @@ -10890,189 +10886,189 @@ corder_transition(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR - /* Increase estimated link info, so the group's object header is large - * enough to hold all the link messages in one chunk - */ - if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR + /* Increase estimated link info, so the group's object header is large + * enough to hold all the link messages in one chunk + */ + if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Get the size of the file with an empty group */ - if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Get the size of the file with an empty group */ + if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Create another link, to push group into dense form */ HDsnprintf(objname, sizeof(objname), "filler %u", max_compact); if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - - /* Delete several links from group, until it resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - } /* end for */ + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Delete several links from group, until it resumes compact form */ + for(u = max_compact; u >= min_dense; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + } /* end for */ /* Delete another link, to push group into compact form */ HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Re-add links to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Re-add links to get back into dense form */ + for(u = (min_dense - 1); u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open group created */ - if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Open group created */ + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - - /* Delete several links from group, until it resumes compact form */ - for(u = max_compact; u >= min_dense; u--) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR - } /* end for */ + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + + /* Delete several links from group, until it resumes compact form */ + for(u = max_compact; u >= min_dense; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR + } /* end for */ /* Delete another link, to push group into compact form */ HDsnprintf(objname, sizeof(objname), "filler %u", (min_dense - 1)); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR - if(nlinks != (min_dense - 1)) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Re-add links to get back into dense form */ - for(u = (min_dense - 1); u < (max_compact + 1); u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Verify state of group */ + if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR + if(nlinks != (min_dense - 1)) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Re-add links to get back into dense form */ + for(u = (min_dense - 1); u < (max_compact + 1); u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Delete all the links */ - for(u = max_compact; u > 0; u--) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Delete all the links */ + for(u = max_compact; u > 0; u--) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ HDsnprintf(objname, sizeof(objname), "filler %u", (unsigned)0); if(H5Ldelete(group_id, objname, H5P_DEFAULT) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Get the size of the file now */ - if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - if(file_size != empty_size) TEST_ERROR + /* Get the size of the file now */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + if(file_size != empty_size) TEST_ERROR - PASSED(); + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11081,7 +11077,7 @@ corder_transition(hid_t fapl) return -1; } /* end corder_transition() */ - + /*------------------------------------------------------------------------- * Function: corder_delete * @@ -11100,9 +11096,9 @@ corder_transition(hid_t fapl) static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ @@ -11117,91 +11113,91 @@ corder_delete(hid_t fapl) TESTING("deleting group with creation order indexing in dense form") /* Loop to leave file open when deleting group, or to close & re-open file - * before deleting group */ + * before deleting group */ for(reopen_file = FALSE; reopen_file <= TRUE; reopen_file++) { /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Creating file with latest format will enable paged aggregation with persistent fs */ + /* Creating file with latest format will enable paged aggregation with persistent fs */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Close file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Get the size of an empty file */ - if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR + /* Get the size of an empty file */ + if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) FAIL_STACK_ERROR - /* Increase estimated link info, so the group's object header is large - * enough to hold all the link messages in one chunk - */ - if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR + /* Increase estimated link info, so the group's object header is large + * enough to hold all the link messages in one chunk + */ + if(H5Pset_est_link_info(gcpl_id, max_compact, CORDER_EST_ENTRY_LEN) < 0) TEST_ERROR - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) FAIL_STACK_ERROR - /* Create links until the group is in dense form */ - for(u = 0; u < max_compact * 2; u++) { - HDsnprintf(objname, sizeof(objname), "filler %u", u); - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR - } /* end for */ + /* Create links until the group is in dense form */ + for(u = 0; u < max_compact * 2; u++) { + HDsnprintf(objname, sizeof(objname), "filler %u", u); + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id2) < 0) FAIL_STACK_ERROR + } /* end for */ /* Verify state of group */ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Retrieve & verify # of records in the name & creation order indices */ - if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR - if(name_count != corder_count) TEST_ERROR + /* Retrieve & verify # of records in the name & creation order indices */ + if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR + if(name_count != corder_count) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - /* Check for deleting group without re-opening file */ - if(!reopen_file) - /* Delete the group with the creation order index */ - if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Check for deleting group without re-opening file */ + if(!reopen_file) + /* Delete the group with the creation order index */ + if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - /* Check for deleting group after re-opening file */ - if(reopen_file) { - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR + /* Check for deleting group after re-opening file */ + if(reopen_file) { + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR - /* Delete the group with the creation order index */ - if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + /* Delete the group with the creation order index */ + if(H5Ldelete(file_id, CORDER_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR - } /* end if */ + /* Close the file */ + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR + } /* end if */ /* Get the size of the file now */ if((file_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - if(file_size != empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR } /* end for */ PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11210,14 +11206,14 @@ corder_delete(hid_t fapl) return -1; } /* end corder_delete() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_check * * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 @@ -11230,7 +11226,7 @@ corder_delete(hid_t fapl) */ static int link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, - hbool_t hard_link, hbool_t use_index) + hbool_t hard_link, hbool_t use_index) { char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char valname[NAME_BUF_SIZE]; /* Link value name */ @@ -11243,133 +11239,133 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, /* Verify the link information for first link, in increasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in increasing creation order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in increasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in increasing creation order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in increasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in increasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR - - /* Don't test "native" order if there is no creation order index, since - * there's not a good way to easily predict the link's order in the name - * index. - */ - if(use_index) { - /* Verify the link information for first link, in native creation order (which is increasing) */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR - - /* Verify the link information for new link, in native creation order (which is increasing) */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR - - /* Verify value for new soft link, in native creation order (which is increasing) */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + + /* Don't test "native" order if there is no creation order index, since + * there's not a good way to easily predict the link's order in the name + * index. + */ + if(use_index) { + /* Verify the link information for first link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR + + /* Verify the link information for new link, in native creation order (which is increasing) */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR + + /* Verify value for new soft link, in native creation order (which is increasing) */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ - /* Verify the name for new link, in native creation order (which is increasing) */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR - } /* end if */ + /* Verify the name for new link, in native creation order (which is increasing) */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR + } /* end if */ /* Verify the link information for first link, in decreasing creation order */ HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in decreasing creation order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in decreasing creation order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in decreasing creation order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in decreasing creation order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in decreasing creation order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Verify the link information for first link, in increasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for first link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in increasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in increasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in increasing link name order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in increasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in increasing link name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Don't test "native" order queries on link name order, since there's not - * a good way to easily predict the order of the links in the name index. - */ + /* Don't test "native" order queries on link name order, since there's not + * a good way to easily predict the order of the links in the name index. + */ - /* Verify the link information for first link, in decreasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for first link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != 0) TEST_ERROR + if(linfo.corder != 0) TEST_ERROR - /* Verify the link information for new link, in decreasing link name order */ - HDmemset(&linfo, 0, sizeof(linfo)); + /* Verify the link information for new link, in decreasing link name order */ + HDmemset(&linfo, 0, sizeof(linfo)); if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(linfo.corder != (int64_t)n) TEST_ERROR + if(linfo.corder != (int64_t)n) TEST_ERROR - /* Verify value for new soft link, in decreasing link name order */ - if(!hard_link) { - HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end if */ + /* Verify value for new soft link, in decreasing link name order */ + if(!hard_link) { + HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end if */ /* Verify the name for new link, in decreasing link name order */ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(linkname, tmpname)) TEST_ERROR + if(HDstrcmp(linkname, tmpname)) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); - error: +error: /* Failure */ return(-1); } /* end link_info_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx * @@ -11387,9 +11383,9 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n, static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11410,142 +11406,142 @@ link_info_by_idx(hid_t fapl) if(hard_link) { if(use_index) TESTING("querying info by index w/creation order index, using hard links") - else - TESTING("querying info by index w/o creation order index, using hard links") + else + TESTING("querying info by index w/o creation order index, using hard links") } /* end if */ else { if(use_index) TESTING("querying info by index w/creation order index, using soft links") - else - TESTING("querying info by index w/o creation order index, using soft links") + else + TESTING("querying info by index w/o creation order index, using soft links") } /* end else */ /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - - /* Create group with creation order indexing & tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - - /* Check for query on empty group */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); - - /* Check for creating hard or soft link */ - if(hard_link) { - hid_t group_id2; /* Group ID */ - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - HDsnprintf(valname, sizeof(valname), "value %02u", u); - - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Verify state of group */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - - /* Check for out of bound offset queries */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); - - /* Check for creating hard or soft link */ - if(hard_link) { - hid_t group_id2; /* Group ID */ - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - HDsnprintf(valname, sizeof(valname), "value %02u", u); - - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - - /* Verify state of group */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Check for out of bound offset queries */ - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - - PASSED(); + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order indexing & tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + /* Check for query on empty group */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Check for creating hard or soft link */ + if(hard_link) { + hid_t group_id2; /* Group ID */ + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); + + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + + /* Verify state of group */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound offset queries */ + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); } /* end for */ } /* end for */ return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -11554,7 +11550,7 @@ link_info_by_idx(hid_t fapl) return -1; } /* end link_info_by_idx() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_old * @@ -11572,8 +11568,8 @@ link_info_by_idx(hid_t fapl) static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11590,43 +11586,43 @@ link_info_by_idx_old(hid_t fapl) for(hard_link = FALSE; hard_link <= TRUE; hard_link++) { if(hard_link) TESTING("querying info by index in old-style group, using hard links") - else - TESTING("querying info by index in old-style group, using soft links") + else + TESTING("querying info by index in old-style group, using soft links") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group to operate on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Check for creating hard or soft link */ - if(hard_link) { - H5O_info_t oi; /* Buffer for querying object's info */ + /* Check for creating hard or soft link */ + if(hard_link) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end if */ - else { - /* Make value for link */ - HDsnprintf(valname, sizeof(valname), "value %02u", u); + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end if */ + else { + /* Make value for link */ + HDsnprintf(valname, sizeof(valname), "value %02u", u); - /* Create soft link */ - if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ - } /* end for */ + /* Create soft link */ + if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ + } /* end for */ /* Verify link information for created links */ for(u = 0; u < CORDER_NLINKS; u++) { @@ -11641,35 +11637,35 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in increasing order) */ if(hard_link) { if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR } /* end else */ /* Verify link name (in increasing order) */ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR - /* Verify link information (in native order - native is increasing) */ - if(hard_link) { - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR - } /* end if */ - else { - if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR - } /* end else */ + /* Verify link information (in native order - native is increasing) */ + if(hard_link) { + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR + } /* end if */ + else { + if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR + } /* end else */ /* Verify link name (in native order - native is increasing) */ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR - /* Make link name for decreasing order queries */ - HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + /* Make link name for decreasing order queries */ + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); /* Make link value for decreasing order queries */ HDsnprintf(valname, sizeof(valname), "value %02u", dec_u); @@ -11677,16 +11673,16 @@ link_info_by_idx_old(hid_t fapl) /* Verify link information (in decreasing order) */ if(hard_link) { if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR } /* end if */ else { if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(valname, tmpval)) TEST_ERROR + if(HDstrcmp(valname, tmpval)) TEST_ERROR } /* end else */ /* Verify link name (in decreasing order) */ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(HDstrcmp(objname, tmpname)) TEST_ERROR + if(HDstrcmp(objname, tmpname)) TEST_ERROR } /* end for */ /* Check for creation order index queries */ @@ -11694,351 +11690,351 @@ link_info_by_idx_old(hid_t fapl) ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR + H5E_BEGIN_TRY { + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + } H5E_END_TRY; + if(name_len >= 0) TEST_ERROR + + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); + } /* end for */ + + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(group_id); + H5Fclose(file_id); + } H5E_END_TRY; + return -1; +} /* end link_info_by_idx_old() */ + + +/*------------------------------------------------------------------------- + * Function: delete_by_idx + * + * Purpose: Create a group with creation order indices and test deleting + * links by index. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Quincey Koziol + * Tuesday, November 14, 2006 + * + *------------------------------------------------------------------------- + */ +static int +delete_by_idx(hid_t fapl) +{ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + H5L_info_t linfo; /* Link info struct */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE];/* File name */ + char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by creation order index in increasing order w/creation order index") + else + TESTING("deleting links by creation order index in increasing order w/o creation order index") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by creation order index in decreasing order w/creation order index") + else + TESTING("deleting links by creation order index in decreasing order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("deleting links by name index in increasing order w/creation order index") + else + TESTING("deleting links by name index in increasing order w/o creation order index") + } /* end if */ + else { + if(use_index) + TESTING("deleting links by name index in decreasing order w/creation order index") + else + TESTING("deleting links by name index in decreasing order w/o creation order index") + } /* end else */ + } /* end else */ + + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR + + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + + + /* Delete links from one end */ + + + /* Check for deletion on empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Check for deletion on non-existing group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + + /* Check for out of bound deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from compact group */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); + + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ + + /* Check for out of bound deletion again */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + + /* Delete links from dense group, in appropriate order */ + for(u = 0; u < ((max_compact * 2) - 1); u++) { + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(linfo.corder != (u + 1)) TEST_ERROR + } /* end if */ + else { + if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + + /* Check for deletion on empty group again */ H5E_BEGIN_TRY { - name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); - } H5E_END_TRY; - if(name_len >= 0) TEST_ERROR + ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Delete links in middle */ - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ + /* Create more links, to push group into dense form */ + for(u = 0; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ - return 0; + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - error: - H5E_BEGIN_TRY { - H5Gclose(group_id); - H5Fclose(file_id); - } H5E_END_TRY; - return -1; -} /* end link_info_by_idx_old() */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Verify state of group (dense) */ + if(u >= max_compact) + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR -/*------------------------------------------------------------------------- - * Function: delete_by_idx - * - * Purpose: Create a group with creation order indices and test deleting - * links by index. - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * - *------------------------------------------------------------------------- - */ -static int -delete_by_idx(hid_t fapl) -{ - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - H5L_info_t linfo; /* Link info struct */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE];/* File name */ - char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + /* Verify link information for new link */ + if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR + } /* end for */ - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { + /* Delete every other link from dense group, in appropriate order */ + for(u = 0; u < max_compact; u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(use_index) - TESTING("deleting links by creation order index in increasing order w/creation order index") - else - TESTING("deleting links by creation order index in increasing order w/o creation order index") + if(linfo.corder != ((u * 2) + 1)) TEST_ERROR } /* end if */ else { - if(use_index) - TESTING("deleting links by creation order index in decreasing order w/creation order index") - else - TESTING("deleting links by creation order index in decreasing order w/o creation order index") + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR } /* end else */ - } /* end if */ - else { + + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from dense group, in appropriate order */ + for(u = 0; u < (max_compact - 1); u++) { + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(order == H5_ITER_INC) { - if(use_index) - TESTING("deleting links by name index in increasing order w/creation order index") - else - TESTING("deleting links by name index in increasing order w/o creation order index") + if(linfo.corder != ((u * 2) + 3)) TEST_ERROR } /* end if */ else { - if(use_index) - TESTING("deleting links by name index in decreasing order w/creation order index") - else - TESTING("deleting links by name index in decreasing order w/o creation order index") + if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR } /* end else */ - } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + + /* Verify state of group (empty) */ + if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR + if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR + - /* Create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Delete links from one end */ - - - /* Check for deletion on empty group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Check for deletion on non-existing group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ - - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - - /* Check for out of bound deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Delete links from compact group */ - for(u = 0; u < (max_compact - 1); u++) { - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != (u + 1)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR - } /* end else */ - - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - - /* Create more links, to push group into dense form */ - for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ - - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify state of group (dense) */ - if(u >= max_compact) - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Check for out of bound deletion again */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - /* Delete links from dense group, in appropriate order */ - for(u = 0; u < ((max_compact * 2) - 1); u++) { - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != (u + 1)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR - } /* end else */ - - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Check for deletion on empty group again */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR - - - /* Delete links in middle */ - - - /* Create more links, to push group into dense form */ - for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ - - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); - - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - - /* Verify state of group (dense) */ - if(u >= max_compact) - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - - /* Verify link information for new link */ - if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR - } /* end for */ - - /* Delete every other link from dense group, in appropriate order */ - for(u = 0; u < max_compact; u++) { - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for current link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != ((u * 2) + 1)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR - } /* end else */ - - /* Verify the name for current link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete remaining links from dense group, in appropriate order */ - for(u = 0; u < (max_compact - 1); u++) { - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(linfo.corder != ((u * 2) + 3)) TEST_ERROR - } /* end if */ - else { - if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR - } /* end else */ - - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4))); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ - - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify state of group (empty) */ - if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR - if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - - - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR - - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - - PASSED(); + PASSED(); } /* end for */ } /* end for */ } /* end for */ return 0; - error: +error: H5E_BEGIN_TRY { H5Pclose(gcpl_id); H5Gclose(group_id); @@ -12047,7 +12043,7 @@ delete_by_idx(hid_t fapl) return -1; } /* end delete_by_idx() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx_old * @@ -12065,8 +12061,8 @@ delete_by_idx(hid_t fapl) static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12081,189 +12077,189 @@ delete_by_idx_old(hid_t fapl) /* Print test banner */ if(order == H5_ITER_INC) TESTING("deleting links by index in increasing order in old-style group") - else - TESTING("deleting links by index in decreasing order in old-style group") + else + TESTING("deleting links by index in decreasing order in old-style group") - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group to operate on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group to operate on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete links from one end */ + /* Delete links from one end */ - /* Check for deletion in empty group */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for deletion in empty group */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ - /* Check for bad index type deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for bad index type deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for out of bounds deletion */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bounds deletion */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Delete links, in appropriate order */ - for(u = 0; u < (CORDER_NLINKS - 1); u++) { - unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ - - /* Delete first link in appropriate order */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ - - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Delete links, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS - 1); u++) { + unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */ - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Delete first link in appropriate order */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - /* Check for deletion in empty group (again) */ - H5E_BEGIN_TRY { - ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - /* Delete links in middle */ + /* Check for deletion in empty group (again) */ + H5E_BEGIN_TRY { + ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - H5O_info_t oi; /* Buffer for querying object's info */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Delete links in middle */ - /* Create group */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + H5O_info_t oi; /* Buffer for querying object's info */ - /* Close group */ - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Delete every other link from group, in appropriate order */ - for(u = 0; u < (CORDER_NLINKS / 2); u++) { - unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ + /* Create group */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for current link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Verify the name for current link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Close group */ + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ - /* Delete remaining links from group, in appropriate order */ - for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { - unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ + /* Delete every other link from group, in appropriate order */ + for(u = 0; u < (CORDER_NLINKS / 2); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */ - /* Delete link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - - /* Verify the link information for first link in appropriate order */ - HDmemset(&linfo, 0, sizeof(linfo)); - if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) { - if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR - } /* end if */ - else { - if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR - } /* end else */ + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR - /* Verify the name for first link in appropriate order */ - HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); - if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR - if(order == H5_ITER_INC) - HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); - else - HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); - if(HDstrcmp(objname, tmpname)) TEST_ERROR - } /* end for */ + /* Verify the link information for current link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ - /* Delete last link */ - if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR + /* Verify the name for current link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ + + /* Delete remaining links from group, in appropriate order */ + for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) { + unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */ - /* Verify state of group */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Delete link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Verify the link information for first link in appropriate order */ + HDmemset(&linfo, 0, sizeof(linfo)); + if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) { + if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR + } /* end if */ + else { + if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR + } /* end else */ + + /* Verify the name for first link in appropriate order */ + HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); + if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR + if(order == H5_ITER_INC) + HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3)); + else + HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u); + if(HDstrcmp(objname, tmpname)) TEST_ERROR + } /* end for */ - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Delete last link */ + if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR - PASSED(); + /* Verify state of group */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); } /* end for */ return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Fclose(file_id); @@ -12272,7 +12268,7 @@ delete_by_idx_old(hid_t fapl) return -1; } /* end delete_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_cb * @@ -12288,7 +12284,7 @@ delete_by_idx_old(hid_t fapl) */ static int link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) + void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12349,7 +12345,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_cb * @@ -12371,7 +12367,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_fail_cb * @@ -12388,12 +12384,12 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, - const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) + const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { return(H5_ITER_ERROR); } /* end link_iterate_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_check * @@ -12409,7 +12405,7 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l */ static int link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) + unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12427,15 +12423,15 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12443,15 +12439,15 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ - iter_info->nskipped = (unsigned)(skip = max_links / 2); + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12459,26 +12455,26 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12491,26 +12487,26 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12522,39 +12518,39 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ - skip = 0; + /* Check for iteration routine indicating failure */ + skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); - error: +error: return(-1); } /* end link_iterate_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate * @@ -12572,9 +12568,9 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, static int link_iterate(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -12591,13 +12587,13 @@ link_iterate(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate the "visited link" array */ - iter_info.max_visit = max_compact * 2; + /* Allocate the "visited link" array */ + iter_info.max_visit = max_compact * 2; if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR - iter_info.visited = visited; + iter_info.visited = visited; /* Loop over operating on different indices on link fields */ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { @@ -12610,42 +12606,42 @@ link_iterate(hid_t fapl) if(order == H5_ITER_INC) { if(use_index) TESTING("iterating over links by creation order index in increasing order w/creation order index") - else - TESTING("iterating over links by creation order index in increasing order w/o creation order index") + else + TESTING("iterating over links by creation order index in increasing order w/o creation order index") } /* end if */ else if(order == H5_ITER_DEC) { if(use_index) TESTING("iterating over links by creation order index in decreasing order w/creation order index") - else - TESTING("iterating over links by creation order index in decreasing order w/o creation order index") + else + TESTING("iterating over links by creation order index in decreasing order w/o creation order index") } /* end else */ else { HDassert(order == H5_ITER_NATIVE); if(use_index) TESTING("iterating over links by creation order index in native order w/creation order index") - else - TESTING("iterating over links by creation order index in native order w/o creation order index") + else + TESTING("iterating over links by creation order index in native order w/o creation order index") } /* end else */ } /* end if */ else { if(order == H5_ITER_INC) { if(use_index) TESTING("iterating over links by name index in increasing order w/creation order index") - else - TESTING("iterating over links by name index in increasing order w/o creation order index") + else + TESTING("iterating over links by name index in increasing order w/o creation order index") } /* end if */ else if(order == H5_ITER_DEC) { if(use_index) TESTING("iterating over links by name index in decreasing order w/creation order index") - else - TESTING("iterating over links by name index in decreasing order w/o creation order index") + else + TESTING("iterating over links by name index in decreasing order w/o creation order index") } /* end else */ else { HDassert(order == H5_ITER_NATIVE); if(use_index) TESTING("iterating over links by name index in native order w/creation order index") - else - TESTING("iterating over links by name index in native order w/o creation order index") + else + TESTING("iterating over links by name index in native order w/o creation order index") } /* end else */ } /* end else */ @@ -12653,76 +12649,76 @@ link_iterate(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ - /* (should be OK) */ - if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (compact) */ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound iteration on compact group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on compact group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in compact group */ - if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in compact group */ + if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (dense) */ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound iteration on dense group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on dense group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in dense group */ - if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in dense group */ + if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ } /* end for */ } /* end for */ @@ -12730,13 +12726,13 @@ link_iterate(hid_t fapl) /* Close the group creation property list */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Free resources */ - if(visited) - HDfree(visited); + /* Free resources */ + if(visited) + HDfree(visited); return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -12750,7 +12746,7 @@ link_iterate(hid_t fapl) return -1; } /* end link_iterate() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_cb * @@ -12766,7 +12762,7 @@ link_iterate(hid_t fapl) */ static int link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) + void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12821,7 +12817,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_old_cb * @@ -12843,7 +12839,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_check * @@ -12859,7 +12855,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) */ static int link_iterate_old_check(hid_t group_id, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) + unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12877,15 +12873,15 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, with H5Giterate */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12893,15 +12889,15 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ - iter_info->nskipped = (unsigned)(skip = max_links / 2); + /* Skip over some links in group */ + iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12909,26 +12905,26 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(skip != max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(skip != max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12941,26 +12937,26 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR - /* Verify that we visited all the links */ - if(gskip != (int)max_links) TEST_ERROR - if(order == H5_ITER_INC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - for(v = 0; v < (max_links / 2); v++) - if(iter_info->visited[v] == FALSE) TEST_ERROR - } /* end if */ - else { - unsigned nvisit = 0; /* # of links visited */ + /* Verify that we visited all the links */ + if(gskip != (int)max_links) TEST_ERROR + if(order == H5_ITER_INC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + for(v = 0; v < (max_links / 2); v++) + if(iter_info->visited[v] == FALSE) TEST_ERROR + } /* end if */ + else { + unsigned nvisit = 0; /* # of links visited */ - HDassert(order == H5_ITER_NATIVE); - for(v = 0; v < max_links; v++) - if(iter_info->visited[v] == TRUE) - nvisit++; + HDassert(order == H5_ITER_NATIVE); + for(v = 0; v < max_links; v++) + if(iter_info->visited[v] == TRUE) + nvisit++; - if(nvisit != (max_links / 2)) TEST_ERROR - } /* end else */ + if(nvisit != (max_links / 2)) TEST_ERROR + } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12972,53 +12968,53 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = (unsigned)(gskip = 0); + /* Iterate over links in group, stopping in the middle, with H5Giterate() */ + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info)) < 0) TEST_ERROR - if(ret != CORDER_ITER_STOP) TEST_ERROR - if(iter_info->ncalled != 3) TEST_ERROR + if(ret != CORDER_ITER_STOP) TEST_ERROR + if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ - skip = 0; + /* Check for iteration routine indicating failure */ + skip = 0; H5E_BEGIN_TRY { - ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); + ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Check for iteration w/bad location ID */ - skip = 0; + /* Check for iteration w/bad location ID */ + skip = 0; H5E_BEGIN_TRY { ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #ifndef H5_NO_DEPRECATED_SYMBOLS - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_cb, iter_info); } H5E_END_TRY; if(ret >= 0) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Success */ - return(0); + /* Success */ + return(0); - error: +error: return(-1); } /* end link_iterate_old_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old * @@ -13035,8 +13031,8 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13049,7 +13045,7 @@ link_iterate_old(hid_t fapl) /* Allocate the "visited link" array */ iter_info.max_visit = CORDER_NLINKS; if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR - iter_info.visited = visited; + iter_info.visited = visited; /* Loop over operating in different orders */ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { @@ -13069,55 +13065,55 @@ link_iterate_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ - /* (should be OK) */ - if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR + /* Check for iteration on empty group */ + /* (should be OK) */ + if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR - } /* end for */ + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + } /* end for */ /* Verify state of group (symbol table) */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound iteration on old-style group */ - skip = (hsize_t)u; + /* Check for out of bound iteration on old-style group */ + skip = (hsize_t)u; H5E_BEGIN_TRY { ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Check for iteration on creation order */ - /* (should fail) */ - skip = (hsize_t)0; + /* Check for iteration on creation order */ + /* (should fail) */ + skip = (hsize_t)0; H5E_BEGIN_TRY { ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Test iteration over links in group */ - if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR + /* Test iteration over links in group */ + if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ - if(H5Gclose(group_id) < 0) TEST_ERROR + /* Close the group */ + if(H5Gclose(group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ /* Free resources */ @@ -13126,7 +13122,7 @@ link_iterate_old(hid_t fapl) return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -13139,7 +13135,7 @@ link_iterate_old(hid_t fapl) return -1; } /* end link_iterate_old() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_check * @@ -13155,8 +13151,8 @@ link_iterate_old(hid_t fapl) */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, - haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, + haddr_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ hid_t group_id = (-1); /* ID of group to test */ @@ -13179,21 +13175,21 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Open the object */ if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + /* Get the object's information */ + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(order == H5_ITER_INC) { - if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR - } /* end if */ - else { - /* XXX: What to do about native order? */ - } /* end else */ + if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ /* Close object */ if(H5Oclose(obj_id) < 0) TEST_ERROR @@ -13202,43 +13198,43 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* - * Verify opening correct object by index when file mounting is present - */ + * Verify opening correct object by index when file mounting is present + */ /* Get the address of the root group in the file to mount */ if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - mnt_root_addr = oi.addr; + mnt_root_addr = oi.addr; /* Mount a file over a group in main group */ mnt_idx = 2; HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx); if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR - /* Open the object that the file is mounted on */ - if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR + /* Open the object that the file is mounted on */ + if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + /* Get the object's information */ + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - /* Check that the object is the root of the mounted file and not in the previous file */ - if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR - if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR + /* Check that the object is the root of the mounted file and not in the previous file */ + if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR + if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR - /* Close object */ - if(H5Oclose(obj_id) < 0) TEST_ERROR + /* Close object */ + if(H5Oclose(obj_id) < 0) TEST_ERROR - /* Unmount the file */ - if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR + /* Unmount the file */ + if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR - /* Success */ - return(0); + /* Success */ + return(0); - error: +error: return(-1); } /* end open_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx * @@ -13256,11 +13252,11 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -13269,7 +13265,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13277,182 +13273,182 @@ open_by_idx(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + /* Allocate object address array */ + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR - /* Create file to mount */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + /* Create file to mount */ + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("open object by creation order index in increasing order w/creation order index") - else - TESTING("open object by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("open object by creation order index in decreasing order w/creation order index") - else - TESTING("open object by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("open object by creation order index in native order w/creation order index") - else - TESTING("open object by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("open object by name index in increasing order w/creation order index") - else - TESTING("open object by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("open object by name index in decreasing order w/creation order index") - else - TESTING("open object by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("open object by name index in native order w/creation order index") - else - TESTING("open object by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("open object by creation order index in increasing order w/creation order index") + else + TESTING("open object by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("open object by creation order index in decreasing order w/creation order index") + else + TESTING("open object by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("open object by creation order index in native order w/creation order index") + else + TESTING("open object by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("open object by name index in increasing order w/creation order index") + else + TESTING("open object by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("open object by name index in decreasing order w/creation order index") + else + TESTING("open object by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("open object by name index in native order w/creation order index") + else + TESTING("open object by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Try to open on object in an empty group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound open by index on compact group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index on compact group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound open by index on compact group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index on compact group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ - } /* end for */ + PASSED(); } /* end for */ + } /* end for */ + } /* end for */ /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Free resources */ - if(objno) - HDfree(objno); + /* Free resources */ + if(objno) + HDfree(objno); return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -13468,7 +13464,7 @@ open_by_idx(hid_t fapl) return -1; } /* end open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_old * @@ -13486,15 +13482,15 @@ open_by_idx(hid_t fapl) static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13503,95 +13499,95 @@ open_by_idx_old(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Print appropriate test message */ - if(order == H5_ITER_INC) { - TESTING("open object by name index in increasing order in old-style group") - } /* end if */ - else if(order == H5_ITER_DEC) { - TESTING("open object by name index in decreasing order in old-style group") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - TESTING("open object by name index in native order in old-style group") - } /* end else */ + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("open object by name index in increasing order in old-style group") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("open object by name index in decreasing order in old-style group") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("open object by name index in native order in old-style group") + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Try to open on object in an empty group */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oi.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oi.addr; - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (symbol table) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound open by index */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound open by index */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for creation order index open */ - H5E_BEGIN_TRY { - ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for creation order index open */ + H5E_BEGIN_TRY { + ret = H5Oopen_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify opening objects by index */ - if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + /* Verify opening objects by index */ + if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ + PASSED(); + } /* end for */ /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - return 0; + return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -13603,7 +13599,7 @@ open_by_idx_old(hid_t fapl) return -1; } /* end open_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: object_info_check * @@ -13619,7 +13615,7 @@ open_by_idx_old(hid_t fapl) */ static int object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, - H5_iter_order_t order, unsigned max_links, haddr_t *objno) + H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ hid_t group_id = (-1); /* ID of group to test */ @@ -13642,27 +13638,27 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Query the object's information, by name */ if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + /* Check that the object is the correct one */ + if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR - /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + /* Query the object's information, by index */ + if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR - /* Check that the object is the correct one */ - if(order == H5_ITER_INC) { - if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR - } /* end if */ - else if(order == H5_ITER_DEC) { - unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ + /* Check that the object is the correct one */ + if(order == H5_ITER_INC) { + if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR + } /* end if */ + else if(order == H5_ITER_DEC) { + unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */ - if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR - if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR - } /* end if */ - else { - /* XXX: What to do about native order? */ - } /* end else */ + if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR + if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR + } /* end if */ + else { + /* XXX: What to do about native order? */ + } /* end else */ } /* end for */ } /* end for */ @@ -13670,11 +13666,11 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, /* Success */ return(0); - error: +error: return(-1); } /* end object_info_check() */ - + /*------------------------------------------------------------------------- * Function: object_info * @@ -13692,10 +13688,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ @@ -13705,7 +13701,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13714,202 +13710,202 @@ object_info(hid_t fapl) /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Allocate object address array */ - if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR - - /* Create dataspace for attributes */ - if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query object info by creation order index in increasing order w/creation order index") - else - TESTING("query object info by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query object info by creation order index in decreasing order w/creation order index") - else - TESTING("query object info by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query object info by creation order index in native order w/creation order index") - else - TESTING("query object info by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query object info by name index in increasing order w/creation order index") - else - TESTING("query object info by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query object info by name index in decreasing order w/creation order index") - else - TESTING("query object info by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query object info by name index in native order w/creation order index") - else - TESTING("query object info by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Allocate object address array */ + if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR + + /* Create dataspace for attributes */ + if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query object info by creation order index in increasing order w/creation order index") + else + TESTING("query object info by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query object info by creation order index in decreasing order w/creation order index") + else + TESTING("query object info by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query object info by creation order index in native order w/creation order index") + else + TESTING("query object info by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query object info by name index in increasing order w/creation order index") + else + TESTING("query object info by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query object info by name index in decreasing order w/creation order index") + else + TESTING("query object info by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query object info by name index in native order w/creation order index") + else + TESTING("query object info by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ - } /* end for */ + PASSED(); } /* end for */ + } /* end for */ + } /* end for */ /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Sclose(space_id) < 0) TEST_ERROR - if(objno) - HDfree(objno); + if(H5Sclose(space_id) < 0) TEST_ERROR + if(objno) + HDfree(objno); return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Sclose(space_id); @@ -13925,7 +13921,7 @@ object_info(hid_t fapl) return -1; } /* end object_info() */ - + /*------------------------------------------------------------------------- * Function: object_info_old * @@ -13942,15 +13938,15 @@ object_info(hid_t fapl) static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13959,107 +13955,107 @@ object_info_old(hid_t fapl) /* Create dataspace for attributes */ if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Print appropriate test message */ - if(order == H5_ITER_INC) { - TESTING("query object info by name index in increasing order in old-style group") - } /* end if */ - else if(order == H5_ITER_DEC) { - TESTING("query object info by name index in decreasing order in old-style group") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - TESTING("query object info by name index in native order in old-style group") - } /* end else */ + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Print appropriate test message */ + if(order == H5_ITER_INC) { + TESTING("query object info by name index in increasing order in old-style group") + } /* end if */ + else if(order == H5_ITER_DEC) { + TESTING("query object info by name index in decreasing order in old-style group") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + TESTING("query object info by name index in native order in old-style group") + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ - hid_t attr_id; /* Attribute ID */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2; /* Group ID */ + hid_t attr_id; /* Attribute ID */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - objno[u] = oinfo.addr; + /* Retrieve group's address on disk */ + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + objno[u] = oinfo.addr; - /* Create attributes on new object */ - for(v = 0; v < u; v++) { - /* Make name for attribute */ - HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); + /* Create attributes on new object */ + for(v = 0; v < u; v++) { + /* Make name for attribute */ + HDsnprintf(attrname, sizeof(attrname), "attr %02u", v); - /* Create attribute */ - if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create attribute */ + if((attr_id = H5Acreate2(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close attribute */ - if(H5Aclose(attr_id) < 0) TEST_ERROR - } /* end for */ + /* Close attribute */ + if(H5Aclose(attr_id) < 0) TEST_ERROR + } /* end for */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - } /* end for */ + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + } /* end for */ - /* Verify state of group (symbol table) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (symbol table) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for creation order index query */ - H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for creation order index query */ + H5E_BEGIN_TRY { + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Verify querying objects by name */ - if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR + /* Verify querying objects by name */ + if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ + PASSED(); + } /* end for */ /* Free resources */ if(H5Sclose(space_id) < 0) TEST_ERROR - return 0; + return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Sclose(space_id); @@ -14071,7 +14067,7 @@ object_info_old(hid_t fapl) return -1; } /* end object_info_old() */ - + /*------------------------------------------------------------------------- * Function: group_info * @@ -14089,10 +14085,10 @@ object_info_old(hid_t fapl) static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -14102,386 +14098,386 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ /* Create group creation property list */ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR - /* Query the group creation properties */ - if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR + /* Query the group creation properties */ + if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { - /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { - /* Loop over using index for creation order value */ - for(use_index = FALSE; use_index <= TRUE; use_index++) { - /* Print appropriate test message */ - if(idx_type == H5_INDEX_CRT_ORDER) { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query group info by creation order index in increasing order w/creation order index") - else - TESTING("query group info by creation order index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query group info by creation order index in decreasing order w/creation order index") - else - TESTING("query group info by creation order index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query group info by creation order index in native order w/creation order index") - else - TESTING("query group info by creation order index in native order w/o creation order index") - } /* end else */ - } /* end if */ - else { - if(order == H5_ITER_INC) { - if(use_index) - TESTING("query group info by name index in increasing order w/creation order index") - else - TESTING("query group info by name index in increasing order w/o creation order index") - } /* end if */ - else if(order == H5_ITER_DEC) { - if(use_index) - TESTING("query group info by name index in decreasing order w/creation order index") - else - TESTING("query group info by name index in decreasing order w/o creation order index") - } /* end else */ - else { - HDassert(order == H5_ITER_NATIVE); - if(use_index) - TESTING("query group info by name index in native order w/creation order index") - else - TESTING("query group info by name index in native order w/o creation order index") - } /* end else */ - } /* end else */ + /* Loop over operating on different indices on link fields */ + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + /* Loop over operating in different orders */ + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + /* Loop over using index for creation order value */ + for(use_index = FALSE; use_index <= TRUE; use_index++) { + /* Print appropriate test message */ + if(idx_type == H5_INDEX_CRT_ORDER) { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query group info by creation order index in increasing order w/creation order index") + else + TESTING("query group info by creation order index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query group info by creation order index in decreasing order w/creation order index") + else + TESTING("query group info by creation order index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query group info by creation order index in native order w/creation order index") + else + TESTING("query group info by creation order index in native order w/o creation order index") + } /* end else */ + } /* end if */ + else { + if(order == H5_ITER_INC) { + if(use_index) + TESTING("query group info by name index in increasing order w/creation order index") + else + TESTING("query group info by name index in increasing order w/o creation order index") + } /* end if */ + else if(order == H5_ITER_DEC) { + if(use_index) + TESTING("query group info by name index in decreasing order w/creation order index") + else + TESTING("query group info by name index in decreasing order w/o creation order index") + } /* end else */ + else { + HDassert(order == H5_ITER_NATIVE); + if(use_index) + TESTING("query group info by name index in native order w/creation order index") + else + TESTING("query group info by name index in native order w/o creation order index") + } /* end else */ + } /* end else */ - /* Create file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Create file */ + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Set creation order tracking & indexing on group */ - if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR + /* Set creation order tracking & indexing on group */ + if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR - /* Create group with creation order tracking on */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create group with creation order tracking on for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with creation order tracking on for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ - for(u = 0; u < max_compact; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create several links, up to limit of compact form */ + for(u = 0; u < max_compact; u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (compact) */ - if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR + /* Verify state of group (compact) */ + if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create more links, to push group into dense form */ - for(; u < (max_compact * 2); u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create more links, to push group into dense form */ + for(; u < (max_compact * 2); u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR - if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR + if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (dense) */ - if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (dense) */ + if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); - } /* end for */ - } /* end for */ + PASSED(); } /* end for */ + } /* end for */ + } /* end for */ /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - return 0; + return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -14493,7 +14489,7 @@ group_info(hid_t fapl) return -1; } /* end group_info() */ - + /*------------------------------------------------------------------------- * Function: group_info_old * @@ -14511,15 +14507,15 @@ group_info(hid_t fapl) static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[2 * NAME_BUF_SIZE]; /* Link value */ + char valname[NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14540,179 +14536,179 @@ group_info_old(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create old-style group */ - if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group */ + if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Create old-style group for soft links */ - if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create old-style group for soft links */ + if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index on empty group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Create several links */ - for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + /* Create several links */ + for(u = 0; u < CORDER_NLINKS; u++) { + hid_t group_id2, group_id3; /* Group IDs */ - /* Make name for link */ - HDsnprintf(objname, sizeof(objname), "filler %02u", u); + /* Make name for link */ + HDsnprintf(objname, sizeof(objname), "filler %02u", u); - /* Create hard link, with group object */ - if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new/empty) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != 0) TEST_ERROR + /* Check (new/empty) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ - for(v = 0; v <= u; v++) { - /* Make name for link */ - HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); + /* Create objects in new group created */ + for(v = 0; v <= u; v++) { + /* Make name for link */ + HDsnprintf(objname2, sizeof(objname2), "filler %02u", v); - /* Create hard link, with group object */ - if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create hard link, with group object */ + if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close group created */ - if(H5Gclose(group_id3) < 0) TEST_ERROR - } /* end for */ + /* Close group created */ + if(H5Gclose(group_id3) < 0) TEST_ERROR + } /* end for */ - /* Retrieve group's information */ - if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR + /* Retrieve group's information */ + if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information, by name */ - if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve group's information, by name */ + if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ - if(order != H5_ITER_NATIVE) { - if(order == H5_ITER_INC) { - if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end if */ - else { - if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - } /* end else */ + /* Retrieve group's information */ + if(order != H5_ITER_NATIVE) { + if(order == H5_ITER_INC) { + if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end if */ + else { + if(H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + } /* end else */ - /* Check (new) group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end if */ + /* Check (new) group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end if */ - /* Close group created */ - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close group created */ + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ - if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve main group's information */ + if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve main group's information, by name */ - if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR + /* Retrieve main group's information, by name */ + if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR - /* Check main group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + /* Check main group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ - HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); - if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + /* Create soft link in another group, to objects in main group */ + HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); + if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Retrieve soft link group's information, by name */ - if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR + /* Retrieve soft link group's information, by name */ + if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR - /* Check soft link group's information */ - if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR - if(grp_info.max_corder != 0) TEST_ERROR - if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - } /* end for */ + /* Check soft link group's information */ + if(grp_info.storage_type != H5G_STORAGE_TYPE_SYMBOL_TABLE) TEST_ERROR + if(grp_info.max_corder != 0) TEST_ERROR + if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR + } /* end for */ - /* Verify state of group (old-style) */ - if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR + /* Verify state of group (old-style) */ + if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Check for out of bound query by index */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for out of bound query by index */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Check for bad index query by index group */ - H5E_BEGIN_TRY { - ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info, H5P_DEFAULT); - } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + /* Check for bad index query by index group */ + H5E_BEGIN_TRY { + ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, &grp_info, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(soft_group_id) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(soft_group_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + PASSED(); } /* end for */ return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Gclose(group_id); @@ -14723,7 +14719,7 @@ group_info_old(hid_t fapl) return -1; } /* end group_info_old() */ - + /*------------------------------------------------------------------------- * Function: timestamps * @@ -14741,11 +14737,11 @@ group_info_old(hid_t fapl) static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t group_id2 = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t gcpl_id2 = (-1); /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14776,106 +14772,106 @@ timestamps(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - /* Create group with non-default object timestamp setting */ - if((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create group with non-default object timestamp setting */ + if((group_id = H5Gcreate2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close the group creation property list */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR + /* Close the group creation property list */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR - /* Create group with default object timestamp setting */ - if((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Retrieve the new groups' creation properties */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR - - /* Query & verify the object timestamp settings */ - if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR - if(track_times != FALSE) TEST_ERROR - if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR - if(track_times != TRUE) TEST_ERROR - - /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - - /* Sanity check object information for each group */ - if(oinfo.atime != 0) TEST_ERROR - if(oinfo.mtime != 0) TEST_ERROR - if(oinfo.ctime != 0) TEST_ERROR - if(oinfo.btime != 0) TEST_ERROR - if(oinfo.atime == oinfo2.atime) TEST_ERROR - if(oinfo.mtime == oinfo2.mtime) TEST_ERROR - if(oinfo.ctime == oinfo2.ctime) TEST_ERROR - if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR - - /* Close the property lists */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Pclose(gcpl_id2) < 0) TEST_ERROR + /* Create group with default object timestamp setting */ + if((group_id2 = H5Gcreate2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Retrieve the new groups' creation properties */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + /* Query & verify the object timestamp settings */ + if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR + if(track_times != FALSE) TEST_ERROR + if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR + if(track_times != TRUE) TEST_ERROR + /* Query the object information for each group */ + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + + /* Sanity check object information for each group */ + if(oinfo.atime != 0) TEST_ERROR + if(oinfo.mtime != 0) TEST_ERROR + if(oinfo.ctime != 0) TEST_ERROR + if(oinfo.btime != 0) TEST_ERROR + if(oinfo.atime == oinfo2.atime) TEST_ERROR + if(oinfo.mtime == oinfo2.mtime) TEST_ERROR + if(oinfo.ctime == oinfo2.ctime) TEST_ERROR + if(oinfo.btime == oinfo2.btime) TEST_ERROR + if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR + if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + + /* Close the property lists */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + if(H5Pclose(gcpl_id2) < 0) TEST_ERROR - /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - - /* Open groups */ - if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Retrieve the groups' creation properties */ - if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR - if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR - - /* Query & verify the object timestamp settings */ - if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR - if(track_times != FALSE) TEST_ERROR - if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR - if(track_times != TRUE) TEST_ERROR - - /* Query the object information for each group */ - if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR - - /* Sanity check object information for each group */ - if(oinfo.atime != 0) TEST_ERROR - if(oinfo.mtime != 0) TEST_ERROR - if(oinfo.ctime != 0) TEST_ERROR - if(oinfo.btime != 0) TEST_ERROR - if(oinfo.atime == oinfo2.atime) TEST_ERROR - if(oinfo.mtime == oinfo2.mtime) TEST_ERROR - if(oinfo.ctime == oinfo2.ctime) TEST_ERROR - if(oinfo.btime == oinfo2.btime) TEST_ERROR - if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR - if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR - if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR - if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR - - /* Close the property lists */ - if(H5Pclose(gcpl_id) < 0) TEST_ERROR - if(H5Pclose(gcpl_id2) < 0) TEST_ERROR + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Close the groups */ - if(H5Gclose(group_id) < 0) TEST_ERROR - if(H5Gclose(group_id2) < 0) TEST_ERROR + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR - /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR - PASSED(); + /* Re-open the file */ + if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + + /* Open groups */ + if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Retrieve the groups' creation properties */ + if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR + if((gcpl_id2 = H5Gget_create_plist(group_id2)) < 0) TEST_ERROR + + /* Query & verify the object timestamp settings */ + if(H5Pget_obj_track_times(gcpl_id, &track_times) < 0) TEST_ERROR + if(track_times != FALSE) TEST_ERROR + if(H5Pget_obj_track_times(gcpl_id2, &track_times) < 0) TEST_ERROR + if(track_times != TRUE) TEST_ERROR + + /* Query the object information for each group */ + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + + /* Sanity check object information for each group */ + if(oinfo.atime != 0) TEST_ERROR + if(oinfo.mtime != 0) TEST_ERROR + if(oinfo.ctime != 0) TEST_ERROR + if(oinfo.btime != 0) TEST_ERROR + if(oinfo.atime == oinfo2.atime) TEST_ERROR + if(oinfo.mtime == oinfo2.mtime) TEST_ERROR + if(oinfo.ctime == oinfo2.ctime) TEST_ERROR + if(oinfo.btime == oinfo2.btime) TEST_ERROR + if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR + if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR + if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR + if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR + + /* Close the property lists */ + if(H5Pclose(gcpl_id) < 0) TEST_ERROR + if(H5Pclose(gcpl_id2) < 0) TEST_ERROR + + /* Close the groups */ + if(H5Gclose(group_id) < 0) TEST_ERROR + if(H5Gclose(group_id2) < 0) TEST_ERROR + + /* Close the file */ + if(H5Fclose(file_id) < 0) TEST_ERROR + + PASSED(); return 0; - error: +error: /* Free resources */ H5E_BEGIN_TRY { H5Pclose(gcpl_id); @@ -14886,17 +14882,17 @@ timestamps(hid_t fapl) return -1; } /* end timestamps() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test links + * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * *------------------------------------------------------------------------- @@ -14904,8 +14900,8 @@ timestamps(hid_t fapl) int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ unsigned minimize_dset_oh; /* Whether to minimize dataset object headers */ unsigned efc; /* Whether to use the external file cache */ @@ -14920,185 +14916,183 @@ main(void) /* fapl2 uses "latest version bounds" */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR - if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR - - for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { - if (minimize_dset_oh) { - HDprintf("\n-Testing with minimzed dataset object headers-\n"); - dcpl_g = H5Pcreate(H5P_DATASET_CREATE); - if (0 > dcpl_g) TEST_ERROR - } else { - HDprintf("\n-Testing with unminimzed dataset object headers-\n"); - dcpl_g = H5P_DEFAULT; - } - - for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t my_fapl; - - /* Check for FAPL to use */ - if(new_format) { - my_fapl = fapl2; - HDprintf("\n--Testing with 'new format'--\n"); - } else { - my_fapl = fapl; - HDprintf("\n--Testing with 'old format'--\n"); - } - - /* always enter tests without external cache */ - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR + + for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) { + if (minimize_dset_oh) { + HDprintf("\n-Testing with minimzed dataset object headers-\n"); + dcpl_g = H5Pcreate(H5P_DATASET_CREATE); + if (0 > dcpl_g) TEST_ERROR + } else { + HDprintf("\n-Testing with unminimzed dataset object headers-\n"); + dcpl_g = H5P_DEFAULT; + } + + for(new_format = FALSE; new_format <= TRUE; new_format++) { + hid_t my_fapl; + + /* Check for FAPL to use */ + if(new_format) { + my_fapl = fapl2; + HDprintf("\n--Testing with 'new format'--\n"); + } else { + my_fapl = fapl; + HDprintf("\n--Testing with 'old format'--\n"); + } + + /* always enter tests without external cache */ + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR - /* General tests... (on both old & new format groups */ - nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; - - /* Test new H5L link creation routine */ - nerrors += test_lcpl(my_fapl, new_format); - nerrors += test_move(my_fapl, new_format); - nerrors += test_copy(my_fapl, new_format); - nerrors += test_move_preserves(my_fapl, new_format); + /* General tests... (on both old & new format groups */ + nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0; + + /* Test new H5L link creation routine */ + nerrors += test_lcpl(my_fapl, new_format); + nerrors += test_move(my_fapl, new_format); + nerrors += test_copy(my_fapl, new_format); + nerrors += test_move_preserves(my_fapl, new_format); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_deprec(my_fapl, new_format); + nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - - /* Try external link tests both with and without the external file cache - */ - for(efc = FALSE; efc <= TRUE; efc++) { - if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - HDprintf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - HDprintf("\n---Testing without external file cache---\n"); - } /* end else */ + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on + * the fapl */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache + */ + for(efc = FALSE; efc <= TRUE; efc++) { + if(efc) { + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH -nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif -nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; -nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* with/without external file cache */ - - /* These tests assume that external links are a form of UD links, - * so assume that everything that passed for external links - * above has already been tested for UD links. - */ - if(new_format == TRUE) { - nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ - } /* end if */ - nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; - - /* Misc. extra tests, useful for both new & old format files */ - nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; - - /* Keep this test last, it's testing files that are used above */ - /* do not do this for files used by external link tests */ - nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* new/old format */ - - /* New group revision feature tests */ - nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; - - /* XXX: when creation order indexing is fully working, go back and add checks - * to these tests to make certain that the creation order values are - * correct. - */ - nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; - nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; - nerrors += corder_transition(fapl2) < 0 ? 1 : 0; - nerrors += corder_delete(fapl2) < 0 ? 1 : 0; - nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += link_iterate(fapl2) < 0 ? 1 : 0; - nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; - nerrors += object_info(fapl2) < 0 ? 1 : 0; - nerrors += group_info(fapl2) < 0 ? 1 : 0; - nerrors += timestamps(fapl2) < 0 ? 1 : 0; - - /* Test new API calls on old-style groups */ - nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; - nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; - nerrors += object_info_old(fapl) < 0 ? 1 : 0; - nerrors += group_info_old(fapl) < 0 ? 1 : 0; - - if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) - TEST_ERROR; - dcpl_g = -1; - } - } /* [un]minimized dataset object headers */ + nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* for with/without external file cache (efc) */ + + /* These tests assume that external links are a form of UD links, + * so assume that everything that passed for external links + * above has already been tested for UD links. + */ + if(new_format == TRUE) { + nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */ + } /* end if */ + nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0; + + /* Misc. extra tests, useful for both new & old format files */ + nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; + + /* Keep this test last, it's testing files that are used above */ + /* do not do this for files used by external link tests */ + nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; + } /* for new/old format */ + + /* New group revision feature tests */ + nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; +/* XXX: when creation order indexing is fully working, go back and add checks +* to these tests to make certain that the creation order values are +* correct. +*/ + nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; + nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; + nerrors += corder_transition(fapl2) < 0 ? 1 : 0; + nerrors += corder_delete(fapl2) < 0 ? 1 : 0; + nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += link_iterate(fapl2) < 0 ? 1 : 0; + nerrors += open_by_idx(fapl2) < 0 ? 1 : 0; + nerrors += object_info(fapl2) < 0 ? 1 : 0; + nerrors += group_info(fapl2) < 0 ? 1 : 0; + nerrors += timestamps(fapl2) < 0 ? 1 : 0; + + /* Test new API calls on old-style groups */ + nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += link_iterate_old(fapl) < 0 ? 1 : 0; + nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0; + nerrors += object_info_old(fapl) < 0 ? 1 : 0; + nerrors += group_info_old(fapl) < 0 ? 1 : 0; + + if (minimize_dset_oh) { + if (H5Pclose(dcpl_g) < 0) TEST_ERROR; + dcpl_g = -1; + } + } /* [un]minimized dataset object headers */ /* Close 2nd FAPL */ H5Pclose(fapl2); @@ -15109,8 +15103,8 @@ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : h5_cleanup(FILENAME, fapl); /* Test that external links can be used after a library reset. MUST be - * called last so the reset doesn't interfere with the property lists. This - * routine will delete its own file. */ + * called last so the reset doesn't interfere with the property lists. This + * routine will delete its own file. */ nerrors += external_reset_register() < 0 ? 1 : 0; /* Results */ @@ -15131,7 +15125,7 @@ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : return 0; - error: +error: HDputs("*** TESTS FAILED ***"); return 1; } -- cgit v0.12 From 59d7db40a72142b9027748e762f4b2e8038aefa9 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 26 Jul 2019 15:01:40 -0500 Subject: HDFFV-10658: setting and getting properties in API context. Porting the changes to the develop branch into the 1.10 branch: mainly the external file prefix and VDS prefix. --- MANIFEST | 6 + configure.ac | 2 + src/H5CX.c | 159 +++++++++++++++++++++ src/H5CXprivate.h | 4 + src/H5Defl.c | 2 - src/H5Dint.c | 65 +++++---- src/H5Fprivate.h | 5 +- src/H5system.c | 6 +- test/CMakeLists.txt | 4 + test/CMakeTests.cmake | 128 +++++++++++++++++ test/Makefile.am | 20 +-- test/external.c | 248 ++------------------------------- test/external_common.c | 121 ++++++++++++++++ test/external_common.h | 45 ++++++ test/external_env.c | 214 +++++++++++++++++++++++++++++ test/testexternal_env.sh.in | 39 ++++++ test/testvds_env.sh.in | 44 ++++++ test/vds.c | 195 +------------------------- test/vds_env.c | 327 ++++++++++++++++++++++++++++++++++++++++++++ 19 files changed, 1165 insertions(+), 469 deletions(-) create mode 100644 test/external_common.c create mode 100644 test/external_common.h create mode 100644 test/external_env.c create mode 100644 test/testexternal_env.sh.in create mode 100644 test/testvds_env.sh.in create mode 100644 test/vds_env.c diff --git a/MANIFEST b/MANIFEST index 3040e1c..1d4ee06 100644 --- a/MANIFEST +++ b/MANIFEST @@ -975,6 +975,9 @@ ./test/evict_on_close.c ./test/extend.c ./test/external.c +./test/external_common.c +./test/external_common.h +./test/external_env.c ./test/error_test.c ./test/err_compat.c ./test/filter_error.h5 @@ -1097,6 +1100,7 @@ ./test/tcoords.c ./test/testabort_fail.sh.in ./test/testcheck_version.sh.in +./test/testexternal_env.sh.in ./test/testerror.sh.in ./test/testlinks_env.sh.in ./test/test_filter_plugin.sh.in @@ -1109,6 +1113,7 @@ ./test/testmeta.c ./test/testswmr.sh.in ./test/testvdsswmr.sh.in +./test/testvds_env.sh.in ./test/tfile.c ./test/tgenprop.c ./test/th5o.c @@ -1153,6 +1158,7 @@ ./test/gen_filters.c ./test/chunk_info.c ./test/vds.c +./test/vds_env.c ./test/vds_swmr.h ./test/vds_swmr_gen.c ./test/vds_swmr_reader.c diff --git a/configure.ac b/configure.ac index 6f6a91d..3c1e600 100644 --- a/configure.ac +++ b/configure.ac @@ -3519,10 +3519,12 @@ AC_CONFIG_FILES([src/libhdf5.settings test/testabort_fail.sh test/testcheck_version.sh test/testerror.sh + test/testexternal_env.sh test/testflushrefresh.sh test/testlibinfo.sh test/testlinks_env.sh test/testswmr.sh + test/testvds_env.sh test/testvdsswmr.sh test/test_filter_plugin.sh test/test_usecases.sh diff --git a/src/H5CX.c b/src/H5CX.c index 7cf283a..01962a1 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -186,6 +186,10 @@ typedef struct H5CX_t { hid_t lapl_id; /* LAPL ID for API operation */ H5P_genplist_t *lapl; /* Link Access Property List */ + /* DAPL */ + hid_t dapl_id; /* DAPL ID for API operation */ + H5P_genplist_t *dapl; /* Dataset Access Property List */ + /* FAPL */ hid_t fapl_id; /* FAPL ID for API operation */ H5P_genplist_t *fapl; /* File Access Property List */ @@ -275,6 +279,12 @@ typedef struct H5CX_t { size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + /* Cached DAPL properties */ + char *extfile_prefix; /* Prefix for external file */ + hbool_t extfile_prefix_valid; /* Whether the prefix for external file is valid */ + char *vds_prefix; /* Prefix for VDS */ + hbool_t vds_prefix_valid; /* Whether the prefix for VDS is valid */ + /* Cached FAPL properties */ H5F_libver_t low_bound; /* low_bound property for H5Pset_libver_bounds() */ hbool_t low_bound_valid; /* Whether low_bound property is valid */ @@ -329,6 +339,13 @@ typedef struct H5CX_lapl_cache_t { size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ } H5CX_lapl_cache_t; +/* Typedef for cached default dataset access property list information */ +/* (Same as the cached DXPL struct, above, except for the default DXPL) */ +typedef struct H5CX_dapl_cache_t { + char *extfile_prefix; /* Prefix for external file */ + char *vds_prefix; /* Prefix for VDS */ +} H5CX_dapl_cache_t; + /* Typedef for cached default file access property list information */ /* (Same as the cached DXPL struct, above, except for the default DCPL) */ typedef struct H5CX_fapl_cache_t { @@ -367,6 +384,9 @@ static H5CX_dxpl_cache_t H5CX_def_dxpl_cache; /* Define a "default" link access property list cache structure to use for default LAPLs */ static H5CX_lapl_cache_t H5CX_def_lapl_cache; +/* Define a "default" dataset access property list cache structure to use for default DAPLs */ +static H5CX_dapl_cache_t H5CX_def_dapl_cache; + /* Define a "default" file access property list cache structure to use for default FAPLs */ static H5CX_fapl_cache_t H5CX_def_fapl_cache; @@ -390,6 +410,7 @@ H5CX__init_package(void) { H5P_genplist_t *dx_plist; /* Data transfer property list */ H5P_genplist_t *la_plist; /* Link access property list */ + H5P_genplist_t *da_plist; /* Dataset access property list */ H5P_genplist_t *fa_plist; /* File access property list */ herr_t ret_value = SUCCEED; /* Return value */ @@ -490,6 +511,23 @@ H5CX__init_package(void) if(H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse") + /* Reset the "default DAPL cache" information */ + HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t)); + + /* Get the default DAPL cache information */ + + /* Get the default dataset access property list */ + if(NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + + /* Get the prefix for the external file */ + if(H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file") + + /* Get the prefix for the VDS file */ + if(H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS") + /* Reset the "default FAPL cache" information */ HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t)); @@ -630,6 +668,7 @@ H5CX__push_common(H5CX_node_t *cnode) /* Set non-zero context info */ cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT; cnode->ctx.lapl_id = H5P_LINK_ACCESS_DEFAULT; + cnode->ctx.dapl_id = H5P_DATASET_ACCESS_DEFAULT; cnode->ctx.fapl_id = H5P_FILE_ACCESS_DEFAULT; cnode->ctx.tag = H5AC__INVALID_TAG; cnode->ctx.ring = H5AC_RING_USER; @@ -867,6 +906,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, *acspl_id = *libclass->def_plist_id; else { htri_t is_lapl; /* Whether the access property list is (or is derived from) a link access property list */ + htri_t is_dapl; /* Whether the access property list is (or is derived from) a dataset access property list */ htri_t is_fapl; /* Whether the access property list is (or is derived from) a file access property list */ #ifdef H5CX_DEBUG @@ -881,6 +921,12 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, else if(is_lapl) (*head)->ctx.lapl_id = *acspl_id; + /* Check for dataset access property and set API context if so */ + if((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class") + else if(is_dapl) + (*head)->ctx.dapl_id = *acspl_id; + /* Check for file access property and set API context if so */ if((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class") @@ -1971,6 +2017,119 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_libver_bounds() */ +/*------------------------------------------------------------------------- + * Function: H5CX_get_ext_file_prefix + * + * Purpose: Retrieves the prefix for external file + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 6, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_ext_file_prefix(char **extfile_prefix) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(extfile_prefix); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id); + + /* Check if the value has been retrieved already */ + if(!(*head)->ctx.extfile_prefix_valid) { + /* Check for default DAPL */ + if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT) + (*head)->ctx.extfile_prefix = H5CX_def_dapl_cache.extfile_prefix; + else { + /* Check if the property list is already available */ + if(NULL == (*head)->ctx.dapl) + /* Get the dataset access property list pointer */ + if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list") + + /* Get the prefix for the external file */ + /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need + * to copy it and free this in the H5CX pop routine. -QAK) + */ + if(H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix") + } /* end else */ + + /* Mark the value as valid */ + (*head)->ctx.extfile_prefix_valid = TRUE; + } /* end if */ + + /* Get the value */ + *extfile_prefix = (*head)->ctx.extfile_prefix; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_ext_file_prefix() */ + + +/*------------------------------------------------------------------------- + * Function: H5CX_get_vds_prefix + * + * Purpose: Retrieves the prefix for VDS + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Raymond Lu + * March 6, 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vds_prefix(char **vds_prefix) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vds_prefix); + HDassert(head && *head); + HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id); + + /* Check if the value has been retrieved already */ + if(!(*head)->ctx.vds_prefix_valid) { + /* Check for default DAPL */ + if((*head)->ctx.dapl_id == H5P_DATASET_ACCESS_DEFAULT) + (*head)->ctx.vds_prefix = H5CX_def_dapl_cache.vds_prefix; + else { + /* Check if the property list is already available */ + if(NULL == (*head)->ctx.dapl) + /* Get the dataset access property list pointer */ + if(NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id))) + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "can't get default dataset access property list") + + /* Get the prefix for the VDS */ + /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need + * to copy it and free this in the H5CX pop routine. -QAK) + */ + if(H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix") + } /* end else */ + + /* Mark the value as valid */ + (*head)->ctx.vds_prefix_valid = TRUE; + } /* end if */ + + /* Get the value */ + *vds_prefix = (*head)->ctx.vds_prefix; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vds_prefix() */ + /*------------------------------------------------------------------------- * Function: H5CX_set_tag diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 6c01119..d67f226 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -102,6 +102,10 @@ H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct); /* "Getter" routines for LAPL properties cached in API context */ H5_DLL herr_t H5CX_get_nlinks(size_t *nlinks); +/* "Getter" routines for DAPL properties cached in API context */ +H5_DLL herr_t H5CX_get_ext_file_prefix(char **prefix_extfile); +H5_DLL herr_t H5CX_get_vds_prefix(char **prefix_vds); + /* "Getter" routines for FAPL properties cached in API context */ H5_DLL herr_t H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound); diff --git a/src/H5Defl.c b/src/H5Defl.c index 42b3947..ce0bb80 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -477,7 +477,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, HDassert(io_info->u.rbuf); HDassert(io_info->dset); HDassert(io_info->dset->shared); - HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -561,7 +560,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, HDassert(io_info->u.wbuf); HDassert(io_info->dset); HDassert(io_info->dset->shared); - HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); diff --git a/src/H5Dint.c b/src/H5Dint.c index d3cad8f..a54333f 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -54,8 +54,8 @@ static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); -static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, - const char *prefix_type, char **file_prefix); +static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, + char **file_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -112,6 +112,10 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ /* Flag indicating "top" of interface has been initialized */ static hbool_t H5D_top_package_initialize_s = FALSE; +/* Prefixes of VDS and external file from the environment variables + * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ +const static char *H5D_prefix_ext_env = NULL; +const static char *H5D_prefix_vds_env = NULL; /*------------------------------------------------------------------------- @@ -188,6 +192,10 @@ H5D__init_package(void) /* Mark "top" of interface as initialized, too */ H5D_top_package_initialize_s = TRUE; + /* Retrieve the prefixes of VDS and external file from the environment variable */ + H5D_prefix_vds_env = HDgetenv("HDF5_VDS_PREFIX"); + H5D_prefix_ext_env = HDgetenv("HDF5_EXTFILE_PREFIX"); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__init_package() */ @@ -1045,8 +1053,7 @@ done: *-------------------------------------------------------------------------- */ static herr_t -H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type, - char **file_prefix /*out*/) +H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix /*out*/) { char *prefix = NULL; /* prefix used to look for the file */ char *filepath = NULL; /* absolute path of directory the HDF5 file is in */ @@ -1067,20 +1074,22 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type /* XXX: Future thread-safety note - getenv is not required * to be reentrant. */ - if(HDstrcmp(prefix_type, H5D_ACS_VDS_PREFIX_NAME) == 0) - prefix = HDgetenv("HDF5_VDS_PREFIX"); - else if (HDstrcmp(prefix_type, H5D_ACS_EFILE_PREFIX_NAME) == 0) - prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); - else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "prefix name is not sensible") - - if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of prefix_type property */ - if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, prefix_type, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file prefix") - } /* end if */ + if(H5F_PREFIX_VDS == prefix_type) { + prefix = (char *)H5D_prefix_vds_env; + + if(prefix == NULL || *prefix == '\0') { + if(H5CX_get_vds_prefix(&prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file") + } + } else if(H5F_PREFIX_EFILE == prefix_type) { + prefix = (char *)H5D_prefix_ext_env; + + if(prefix == NULL || *prefix == '\0') { + if(H5CX_get_ext_file_prefix(&prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file") + } + } else + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible") /* Prefix has to be checked for NULL / empty string again because the * code above might have updated it. @@ -1089,8 +1098,7 @@ H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, const char *prefix_type /* filename is interpreted as relative to the current directory, * does not need to be expanded */ - if(NULL == (*file_prefix = (char *)H5MM_strdup(""))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + *file_prefix = NULL; } /* end if */ else { if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { @@ -1285,11 +1293,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ - if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &new_dset->shared->extfile_prefix) < 0) + if(H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") /* Set the VDS file prefix */ - if(H5D__build_file_prefix(new_dset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &new_dset->shared->vds_prefix) < 0) + if(H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix") /* Add the dataset to the list of opened objects in the file */ @@ -1444,11 +1452,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") /* Get the external file prefix */ - if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_EFILE_PREFIX_NAME, &extfile_prefix) < 0) + if(H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") /* Get the VDS prefix */ - if(H5D__build_file_prefix(dataset, dapl_id, H5D_ACS_VDS_PREFIX_NAME, &vds_prefix) < 0) + if(H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix") /* Check if dataset was already open */ @@ -1492,8 +1500,13 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) /* Check whether the external file prefix of the already open dataset * matches the new external file prefix */ - if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") + if(extfile_prefix && dataset->shared->extfile_prefix) { + if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") + } else { + if(extfile_prefix || dataset->shared->extfile_prefix) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") + } /* Check if the object has been opened through the top file yet */ if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index d60c08f..5e78d9e 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -702,8 +702,9 @@ typedef enum H5F_mem_page_t { /* Type of prefix for opening prefixed files */ typedef enum H5F_prefix_open_t { - H5F_PREFIX_VDS, /* Virtual dataset prefix */ - H5F_PREFIX_ELINK /* External link prefix */ + H5F_PREFIX_VDS = 0, /* Virtual dataset prefix */ + H5F_PREFIX_ELINK = 1, /* External link prefix */ + H5F_PREFIX_EFILE = 2 /* External file prefix */ } H5F_prefix_open_t; diff --git a/src/H5system.c b/src/H5system.c index 186d8fa..41e2a48 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -1125,13 +1125,13 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) FUNC_ENTER_NOAPI_NOINIT - HDassert(path1); HDassert(path2); - path1_len = HDstrlen(path1); + if(path1) + path1_len = HDstrlen(path1); path2_len = HDstrlen(path2); - if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { + if(path1 == NULL || *path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { /* If path1 is empty or path2 is absolute, simply use path2 */ if(NULL == (*full_name = (char *)H5MM_strdup(path2))) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5b34ec5..f5a6b60 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,12 +14,14 @@ set (TEST_LIB_SOURCES ${HDF5_TEST_SOURCE_DIR}/h5test.c ${HDF5_TEST_SOURCE_DIR}/testframe.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c + ${HDF5_TEST_SOURCE_DIR}/external_common.c ${HDF5_TEST_SOURCE_DIR}/swmr_common.c ) set (TEST_LIB_HEADERS ${HDF5_TEST_SOURCE_DIR}/h5test.h ${HDF5_TEST_SOURCE_DIR}/cache_common.h + ${HDF5_TEST_SOURCE_DIR}/external_common.h ${HDF5_TEST_SOURCE_DIR}/swmr_common.h ) @@ -208,6 +210,7 @@ set (H5_TESTS extend direct_chunk # compression lib link external + external_env efc objcopy links @@ -235,6 +238,7 @@ set (H5_TESTS freespace mf vds + vds_env file_image unregister cache_logging diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index fe6c695..6532536 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -463,8 +463,10 @@ set (H5TEST_SEPARATE_TESTS testhdf5 cache cache_image + external_env flush1 flush2 + vds_env ) foreach (h5_test ${H5_TESTS}) if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) @@ -558,6 +560,71 @@ if (TEST_CACHE_IMAGE) ) endif () +#-- Adding test for external_env +add_test ( + NAME H5TEST-clear-external_env-objects + COMMAND ${CMAKE_COMMAND} + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=external_env.txt" + -D "TEST_REFERENCE=external_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -E remove + extern_1r.raw + extern_2r.raw + extern_3r.raw + extern_4r.raw + extern_1w.raw + extern_2w.raw + extern_3w.raw + extern_4w.raw + external_env.txt + external_env.out + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) +add_test (NAME H5TEST-external_env COMMAND $) +set_tests_properties (H5TEST-external_env PROPERTIES + FIXTURES_REQUIRED external_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + +#-- Adding test for vds_env +add_test ( + NAME H5TEST-clear-vds_env-objects + COMMAND ${CMAKE_COMMAND} + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=vds_env.txt" + -D "TEST_REFERENCE=vds_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + -E remove + vds_virt_0.h5 + vds_virt_3.h5 + vds_src_2.h5 + vds_env.txt + vds_env.out + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) +add_test (NAME H5TEST-vds_env COMMAND $) +set_tests_properties (H5TEST-vds_env PROPERTIES + FIXTURES_REQUIRED vds_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for flush1/2 add_test (NAME H5TEST-clear-flush-objects COMMAND ${CMAKE_COMMAND} @@ -787,6 +854,67 @@ set_tests_properties (H5TEST-links_env PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + #-- Adding test for external_env + add_test (NAME H5TEST-shared-clear-external_env-objects + COMMAND ${CMAKE_COMMAND} + -E remove + extern_1r.raw + extern_2r.raw + extern_3r.raw + extern_4r.raw + extern_1w.raw + extern_2w.raw + extern_3w.raw + extern_4w.raw + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + set_tests_properties (H5TEST-shared-clear-external_env-objects PROPERTIES FIXTURES_SETUP shared_external_env_clear_objects) + add_test (NAME H5TEST-shared-external_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=external_env.txt" + -D "TEST_REFERENCE=external_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-shared-external_env PROPERTIES + FIXTURES_REQUIRED shared_external_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + + #-- Adding test for vds_env + add_test (NAME H5TEST-shared-clear-vds_env-objects + COMMAND ${CMAKE_COMMAND} + -E remove + vds_virt_0.h5 + vds_virt_3.h5 + vds_src_2.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + set_tests_properties (H5TEST-shared-clear-vds_env-objects PROPERTIES FIXTURES_SETUP shared_vds_env_clear_objects) + add_test (NAME H5TEST-shared-vds_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=vds_env.txt" + -D "TEST_REFERENCE=vds_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-shared-vds_env PROPERTIES + FIXTURES_REQUIRED shared_vds_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared + ) + if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo add_test (NAME H5TEST-testlibinfo diff --git a/test/Makefile.am b/test/Makefile.am index c4fb876..dce2f98 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -26,21 +26,23 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # testlibinfo.sh: # testcheck_version.sh: tcheck_version # testlinks_env.sh: links_env +# testexternal_env.sh: external_env # testflushrefresh.sh: flushrefresh +# testvds_env.sh: vds_env # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* # testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c # test_filter_plugin.sh: filter_plugin.c # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes -TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \ - testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh +TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh testexternal_env.sh \ + testswmr.sh testvds_env.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \ - flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ + external_env$(EXEEXT) flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \ swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \ swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \ - vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) + vds_env$(EXEEXT) vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) if HAVE_SHARED_CONDITIONAL TEST_SCRIPT += test_filter_plugin.sh SCRIPT_DEPEND += filter_plugin$(EXEEXT) @@ -69,21 +71,23 @@ TEST_PROG= testhdf5 \ # accum_swmr_reader is used by accum.c. # atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh +# external_env is used by testexternal_env.sh # filenotclosed and del_many_dense_attrs are used by testabort_fail.sh # flushrefresh is used by testflushrefresh.sh. # use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh # swmr_* files (besides swmr.c) are used by testswmr.sh. # vds_swmr_* files are used by testvdsswmr.sh +# vds_env is used by testvds_env.sh # 'make check' doesn't run them directly, so they are not included in TEST_PROG. # Also build testmeta, which is used for timings test. It builds quickly, # and this lets automake keep all its test programs in one place. check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ - testmeta accum_swmr_reader atomic_writer atomic_reader \ + testmeta accum_swmr_reader atomic_writer atomic_reader external_env \ links_env filenotclosed del_many_dense_attrs flushrefresh \ use_append_chunk use_append_mchunks use_disable_mdc_flushes \ swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \ swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ - swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer + swmr_check_compat_vfd vds_swmr_gen vds_env vds_swmr_reader vds_swmr_writer if HAVE_SHARED_CONDITIONAL check_PROGRAMS+= filter_plugin endif @@ -124,7 +128,7 @@ else noinst_LTLIBRARIES=libh5test.la endif -libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c +libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c # Use libhd5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) @@ -211,6 +215,6 @@ use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c # Temporary files. DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \ - testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh + testexternal_env.sh testswmr.sh testvds_env.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh include $(top_srcdir)/config/conclude.am diff --git a/test/external.c b/test/external.c index 20a9ed8..9644d86 100644 --- a/test/external.c +++ b/test/external.c @@ -18,24 +18,7 @@ * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" - -const char *FILENAME[] = { - "extern_1", - "extern_2", - "extern_3", - "extern_4", - "extern_dir/file_1", - "extern_5", - NULL -}; - -/* A similar collection of files is used for the tests that - * perform file I/O. - */ -#define N_EXT_FILES 4 -#define PART_SIZE 25 -#define TOTAL_SIZE 100 -#define GARBAGE_PER_FILE 10 +#include "external_common.h" /*------------------------------------------------------------------------- @@ -99,106 +82,6 @@ out: /*------------------------------------------------------------------------- - * Function: reset_raw_data_files - * - * Purpose: Resets the data in the raw data files for tests that - * perform dataset I/O on a set of files. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * February 2016 - * - *------------------------------------------------------------------------- - */ -static herr_t -reset_raw_data_files(void) -{ - int fd = 0; /* external file descriptor */ - size_t i, j; /* iterators */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file name */ - int data[PART_SIZE]; /* raw data buffer */ - uint8_t *garbage = NULL; /* buffer of garbage data */ - size_t garbage_count; /* size of garbage buffer */ - size_t garbage_bytes; /* # of garbage bytes written to file */ - - /* Set up garbage buffer */ - garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; - if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) - goto error; - for(i = 0; i < garbage_count; i++) - garbage[i] = 0xFF; - - /* The *r files are pre-filled with data and are used to - * verify that read operations work correctly. - */ - for(i = 0; i < N_EXT_FILES; i++) { - - /* Open file */ - HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) - goto error; - - /* Write garbage data to the file. This allows us to test the - * the ability to set an offset in the raw data file. - */ - garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) - goto error; - - /* Fill array with data */ - for(j = 0; j < PART_SIZE; j++) { - data[j] = (int)(i * 25 + j); - } /* end for */ - - /* Write raw data to the file. */ - n = HDwrite(fd, data, sizeof(data)); - if(n != sizeof(data)) - goto error; - - /* Close this file */ - HDclose(fd); - - } /* end for */ - - /* The *w files are only pre-filled with the garbage data and are - * used to verify that write operations work correctly. The individual - * tests fill in the actual data. - */ - for(i = 0; i < N_EXT_FILES; i++) { - - /* Open file */ - HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) - goto error; - - /* Write garbage data to the file. This allows us to test the - * the ability to set an offset in the raw data file. - */ - garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) - goto error; - - /* Close this file */ - HDclose(fd); - - } /* end for */ - HDfree(garbage); - return SUCCEED; - -error: - if(fd) - HDclose(fd); - if(garbage) - HDfree(garbage); - return FAIL; -} /* end reset_raw_data_files() */ - - -/*------------------------------------------------------------------------- * Function: test_non_extendible * * Purpose: Tests a non-extendible dataset with a single external file. @@ -760,7 +643,7 @@ test_read_file_set(hid_t fapl) * debugging to be emitted before we start playing games with what the * output looks like. */ - h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[1], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -871,7 +754,7 @@ test_write_file_set(hid_t fapl) TEST_ERROR /* Create another file */ - h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[2], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -989,7 +872,7 @@ test_path_absolute(hid_t fapl) TESTING("absolute filenames for external file"); - h5_fixname(FILENAME[3], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[3], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -1085,7 +968,7 @@ test_path_relative(hid_t fapl) if (HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR; - h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR; @@ -1180,7 +1063,7 @@ test_path_relative_cwd(hid_t fapl) if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR; - h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR; @@ -1297,116 +1180,6 @@ error: /*------------------------------------------------------------------------- - * Function: test_path_env - * - * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite - * the efile_prefix dataset access property. - * This will create an HDF5 file in a subdirectory which will - * refer to ../extern_*a.raw - * The files are then accessed by setting the HDF5_EXTFILE_PREFIX - * environment variable to "${ORIGIN}". - * The efile_prefix dataset access property is set to "someprefix", - * which will cause an error if the value is not overwritten by - * the environment variable. - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Steffen Kiess - * March 10, 2015 - * - *------------------------------------------------------------------------- - */ -static int -test_path_env(hid_t fapl) -{ - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dapl = -1; /* dataset access property list */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ - int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - char buffer[1024]; /* buffer to read efile_prefix */ - - TESTING("prefix in HDF5_EXTFILE_PREFIX"); - - if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1)) - TEST_ERROR - - if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR; - - h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - - /* Reset the raw data files */ - if(reset_raw_data_files() < 0) - TEST_ERROR - - /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR - if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) - TEST_ERROR - for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); - if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) - FAIL_STACK_ERROR - } /* end for */ - - cur_size = TOTAL_SIZE; - if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) - FAIL_STACK_ERROR - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if(H5Pset_efile_prefix(dapl, "someprefix") < 0) - FAIL_STACK_ERROR - if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0) - FAIL_STACK_ERROR - if(HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("efile prefix not set correctly"); - - /* Create dataset */ - if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0) - FAIL_STACK_ERROR - - /* Read the entire dataset and compare with the original */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR - for(i = 0; i < TOTAL_SIZE; i++) - if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read."); - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); - H5Fclose(file); - } H5E_END_TRY; - return 1; -} /* end test_path_env() */ - - -/*------------------------------------------------------------------------- * Function: test_h5d_get_access_plist * * Purpose: Ensure that H5Dget_access_plist returns correct values. @@ -1441,7 +1214,7 @@ test_h5d_get_access_plist(hid_t fapl_id) TEST_ERROR /* Create the file */ - h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[5], fapl_id, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR @@ -1532,7 +1305,7 @@ main(void) /* Get a fapl for the old (default) file format */ fapl_id_old = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl_id_old, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename)); /* Copy and set up a fapl for the latest file format */ if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0) @@ -1585,10 +1358,9 @@ main(void) nerrors += test_path_absolute(current_fapl_id); nerrors += test_path_relative(current_fapl_id); nerrors += test_path_relative_cwd(current_fapl_id); - nerrors += test_path_env(current_fapl_id); /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); + nerrors += (h5_verify_cached_stabs(EXT_FNAME, current_fapl_id) < 0 ? 1 : 0); /* Close the common file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR @@ -1603,7 +1375,7 @@ main(void) HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(FILENAME, fapl_id_old)) { + if(h5_cleanup(EXT_FNAME, fapl_id_old)) { HDremove("extern_1r.raw"); HDremove("extern_2r.raw"); HDremove("extern_3r.raw"); diff --git a/test/external_common.c b/test/external_common.c new file mode 100644 index 0000000..e43a713 --- /dev/null +++ b/test/external_common.c @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Raymond Lu + * April, 2019 + * + * Purpose: Private function for external.c and external_env.c + */ + +#include "external_common.h" + + +/*------------------------------------------------------------------------- + * Function: reset_raw_data_files + * + * Purpose: Resets the data in the raw data files for tests that + * perform dataset I/O on a set of files. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +reset_raw_data_files(void) +{ + int fd = 0; /* external file descriptor */ + size_t i, j; /* iterators */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file name */ + int data[PART_SIZE]; /* raw data buffer */ + uint8_t *garbage = NULL; /* buffer of garbage data */ + size_t garbage_count; /* size of garbage buffer */ + size_t garbage_bytes; /* # of garbage bytes written to file */ + + /* Set up garbage buffer */ + garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; + if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) + goto error; + for(i = 0; i < garbage_count; i++) + garbage[i] = 0xFF; + + /* The *r files are pre-filled with data and are used to + * verify that read operations work correctly. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Fill array with data */ + for(j = 0; j < PART_SIZE; j++) { + data[j] = (int)(i * 25 + j); + } /* end for */ + + /* Write raw data to the file. */ + n = HDwrite(fd, data, sizeof(data)); + if(n != sizeof(data)) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + + /* The *w files are only pre-filled with the garbage data and are + * used to verify that write operations work correctly. The individual + * tests fill in the actual data. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + HDfree(garbage); + return SUCCEED; + +error: + if(fd) + HDclose(fd); + if(garbage) + HDfree(garbage); + return FAIL; +} diff --git a/test/external_common.h b/test/external_common.h new file mode 100644 index 0000000..f1a15b5 --- /dev/null +++ b/test/external_common.h @@ -0,0 +1,45 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Raymond Lu + * April, 2019 + * + * Purpose: Private function for external.c and external_env.c + */ +#ifndef _EXTERNAL_COMMON_H +#define _EXTERNAL_COMMON_H + +/* Include test header files */ +#include "h5test.h" + +static const char *EXT_FNAME[] = { + "extern_1", + "extern_2", + "extern_3", + "extern_4", + "extern_dir/file_1", + "extern_5", + NULL +}; + +/* A similar collection of files is used for the tests that + * perform file I/O. + */ +#define N_EXT_FILES 4 +#define PART_SIZE 25 +#define TOTAL_SIZE 100 +#define GARBAGE_PER_FILE 10 + +herr_t reset_raw_data_files(void); +#endif /* _EXTERNAL_COMMON_H */ diff --git a/test/external_env.c b/test/external_env.c new file mode 100644 index 0000000..455cf8e --- /dev/null +++ b/test/external_env.c @@ -0,0 +1,214 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests datasets stored in external raw files. + */ +#include "external_common.h" + + +/*------------------------------------------------------------------------- + * Function: test_path_env + * + * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite + * the efile_prefix dataset access property. + * This will create an HDF5 file in a subdirectory which will + * refer to ../extern_*a.raw + * The files are then accessed by setting the HDF5_EXTFILE_PREFIX + * environment variable to "${ORIGIN}". + * The efile_prefix dataset access property is set to "someprefix", + * which will cause an error if the value is not overwritten by + * the environment variable. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Steffen Kiess + * March 10, 2015 + * + *------------------------------------------------------------------------- + */ +static int +test_path_env(hid_t fapl) +{ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ + + TESTING("prefix in HDF5_EXTFILE_PREFIX"); + + if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR; + + h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename)); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) + TEST_ERROR + + /* Create the dataset */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) + TEST_ERROR + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); + if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) + FAIL_STACK_ERROR + } /* end for */ + + cur_size = TOTAL_SIZE; + if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) + FAIL_STACK_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if(H5Pset_efile_prefix(dapl, "someprefix") < 0) + FAIL_STACK_ERROR + if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0) + FAIL_STACK_ERROR + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("efile prefix not set correctly"); + + /* Create dataset */ + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0) + FAIL_STACK_ERROR + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dapl); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* end test_path_env() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Runs external dataset tests. + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + * Programmer: Robb Matzke + * Tuesday, March 3, 1998 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ + hid_t fid = -1; /* file for test_1* functions */ + hid_t gid = -1; /* group to emit diagnostics */ + char filename[1024]; /* file name for test_1* funcs */ + unsigned latest_format; /* default or latest file format */ + int nerrors = 0; /* number of errors */ + + h5_reset(); + + /* Get a fapl for the old (default) file format */ + fapl_id_old = h5_fileaccess(); + h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename)); + + /* Copy and set up a fapl for the latest file format */ + if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0) + FAIL_STACK_ERROR + if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + FAIL_STACK_ERROR + + /* Test with old & new format groups */ + for(latest_format = FALSE; latest_format <= TRUE; latest_format++) { + hid_t current_fapl_id = -1; + + /* Set the fapl for different file formats */ + if(latest_format) { + HDputs("\nTesting with the latest file format:"); + current_fapl_id = fapl_id_new; + } /* end if */ + else { + HDputs("Testing with the default file format:"); + current_fapl_id = fapl_id_old; + } /* end else */ + + nerrors += test_path_env(current_fapl_id); + } /* end for */ + + if(nerrors > 0) goto error; + + /* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */ + if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR + + HDputs("All external storage tests passed."); + + /* Clean up files used by file set tests */ + if(h5_cleanup(EXT_FNAME, fapl_id_old)) { + HDremove("extern_1r.raw"); + HDremove("extern_2r.raw"); + HDremove("extern_3r.raw"); + HDremove("extern_4r.raw"); + + HDremove("extern_1w.raw"); + HDremove("extern_2w.raw"); + HDremove("extern_3w.raw"); + HDremove("extern_4w.raw"); + + HDrmdir("extern_dir"); + } /* end if */ + + return EXIT_SUCCESS; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Pclose(fapl_id_old); + H5Pclose(fapl_id_new); + H5Gclose(gid); + } H5E_END_TRY; + nerrors = MAX(1, nerrors); + printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); + return EXIT_FAILURE; +} /* end main() */ diff --git a/test/testexternal_env.sh.in b/test/testexternal_env.sh.in new file mode 100644 index 0000000..cfd0825 --- /dev/null +++ b/test/testexternal_env.sh.in @@ -0,0 +1,39 @@ +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +# +# Test for external file with environment variable: HDF5_EXTFILE_PREFIX + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for external file with HDF5_EXTFILE_PREFIX +echo "Testing external file with HDF5_EXTFILE_PREFIX" +TEST_NAME=external_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXTFILE_PREFIX=\${ORIGIN}" # The environment variable & value +# +# Run the test +# echo "$ENVCMD $RUNSERIAL $TEST_BIN" +$ENVCMD $RUNSERIAL $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test prefix for HDF5_EXTFILE_PREFIX PASSED" + else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXTFILE_PREFIX test***" +fi +exit $nerrors diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in new file mode 100644 index 0000000..894e52e --- /dev/null +++ b/test/testvds_env.sh.in @@ -0,0 +1,44 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +# +# Test for external file with environment variable: HDF5_VDS_PREFIX + +srcdir=@srcdir@ + +nerrors=0 + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# test for VDS with HDF5_VDS_PREFIX +echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix" +TEST_NAME=vds_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp" # Set the environment variable & value +UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value +# +# Run the test +# echo "$ENVCMD $RUNSERIAL $TEST_BIN" +$ENVCMD $RUNSERIAL $TEST_BIN +exitcode=$? +if [ $exitcode -eq 0 ]; then + echo "Test prefix for HDF5_VDS_PREFIX PASSED" + else + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_VDS_PREFIX test***" +fi +$UNENVCMD +exit $nerrors diff --git a/test/vds.c b/test/vds.c index e4f886e..fd5a431 100644 --- a/test/vds.c +++ b/test/vds.c @@ -1121,7 +1121,7 @@ error: } /* end test_api() */ /*------------------------------------------------------------------------- - * Function: vds_link_prefix + * Function: vds_link_prefix_first * * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" * Should be able to access the target source files in tmp directory via the prefix set @@ -1132,7 +1132,7 @@ error: *------------------------------------------------------------------------- */ static int -test_vds_prefix(unsigned config, hid_t fapl) +test_vds_prefix_first(unsigned config, hid_t fapl) { char srcfilename[FILENAME_BUF_SIZE]; char srcfilename_map[FILENAME_BUF_SIZE]; @@ -1158,7 +1158,7 @@ test_vds_prefix(unsigned config, hid_t fapl) int i, j; char buffer[1024]; /* buffer to read vds_prefix */ - TESTING("basic virtual dataset I/O via H5Pset_vds_prefix()") + TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection") h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); h5_fixname(FILENAME[7], fapl, vfilename2, sizeof vfilename2); @@ -1191,9 +1191,6 @@ test_vds_prefix(unsigned config, hid_t fapl) if(HDstrcmp(buffer, TMPDIR) != 0) FAIL_PUTS_ERROR("vds prefix not set correctly"); - /* - * Test 1: All - all selection - */ /* Create source dataspace */ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR @@ -1346,187 +1343,6 @@ test_vds_prefix(unsigned config, hid_t fapl) TEST_ERROR dcpl = -1; - /* - * Test 2: All - all selection with ENV prefix - */ - if(HDsetenv("HDF5_VDS_PREFIX", "${ORIGIN}/tmp", 1)) - TEST_ERROR - - /* Create DCPL */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR - - /* Set fill value */ - if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) - TEST_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - TEST_ERROR - - if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) - TEST_ERROR - if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) - TEST_ERROR - - if(HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("vds prefix not set correctly"); - - /* Create source dataspace */ - if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Create virtual dataspace */ - if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) - TEST_ERROR - - /* Select all (should not be necessary, but just to be sure) */ - if(H5Sselect_all(srcspace[0]) < 0) - TEST_ERROR - if(H5Sselect_all(vspace[0]) < 0) - TEST_ERROR - - /* Add virtual layout mapping */ - if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) - TEST_ERROR - - /* Create virtual file */ - if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create source file if requested */ - if(config & TEST_IO_DIFFERENT_FILE) { - HDgetcwd(buffer, 1024); - HDchdir(TMPDIR); - if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - else { - srcfile[0] = vfile; - if(H5Iinc_ref(srcfile[0]) < 0) - TEST_ERROR - } - - /* Create source dataset */ - if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create virtual dataset */ - if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR - - /* Populate write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; - - /* Write data directly to source dataset */ - if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* Close srcdset and srcfile if config option specified */ - if(config & TEST_IO_CLOSE_SRC) { - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - - if(config & TEST_IO_DIFFERENT_FILE) { - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - } - } - - /* Reopen virtual dataset and file if config option specified */ - if(config & TEST_IO_REOPEN_VIRT) { - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) - TEST_ERROR - } - - /* Read data through virtual dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) { - TEST_ERROR - } - } - - /* Adjust write buffer */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); - - /* Write data through virtual dataset */ - if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) - TEST_ERROR - - /* 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((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - HDchdir(buffer); - } - if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) - TEST_ERROR - } - - /* Read data directly from source dataset */ - HDmemset(rbuf[0], 0, sizeof(rbuf)); - if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) - TEST_ERROR - - /* Verify read data */ - for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) - for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) - if(rbuf[i][j] != buf[i][j]) - TEST_ERROR - - /* Close */ - if(H5Dclose(vdset) < 0) - TEST_ERROR - vdset = -1; - if(H5Dclose(srcdset[0]) < 0) - TEST_ERROR - srcdset[0] = -1; - if(H5Fclose(srcfile[0]) < 0) - TEST_ERROR - srcfile[0] = -1; - if(H5Fclose(vfile) < 0) - TEST_ERROR - vfile = -1; - if(H5Sclose(srcspace[0]) < 0) - TEST_ERROR - srcspace[0] = -1; - if(H5Sclose(vspace[0]) < 0) - TEST_ERROR - vspace[0] = -1; - if(H5Pclose(dapl) < 0) - TEST_ERROR - dapl = -1; - if(H5Pclose(dcpl) < 0) - TEST_ERROR - dcpl = -1; - - if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0) - TEST_ERROR - PASSED(); return 0; @@ -1538,7 +1354,6 @@ test_vds_prefix(unsigned config, hid_t fapl) for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) H5Fclose(srcfile[i]); H5Fclose(vfile); - H5Fclose(vfile2); for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) H5Sclose(srcspace[i]); for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) @@ -1552,7 +1367,7 @@ test_vds_prefix(unsigned config, hid_t fapl) TEST_ERROR return 1; -} /* end vds_link_prefix() */ +} /* end test_vds_prefix() */ /*------------------------------------------------------------------------- @@ -11623,7 +11438,7 @@ main(void) for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); nerrors += test_basic_io(bit_config, fapl); - nerrors += test_vds_prefix(bit_config, fapl); + nerrors += test_vds_prefix_first(bit_config, fapl); nerrors += test_unlim(bit_config, fapl); nerrors += test_printf(bit_config, fapl); nerrors += test_all(bit_config, fapl); diff --git a/test/vds_env.c b/test/vds_env.c new file mode 100644 index 0000000..1c2dba9 --- /dev/null +++ b/test/vds_env.c @@ -0,0 +1,327 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Neil Fortner + * Monday, February 16, 2015 + * + * Purpose: Tests datasets with virtual layout. + */ +#include "h5test.h" + +const char *FILENAME[] = { + "vds_env_virt_0", + "vds_env_virt_3", + "vds_env_src_2", + "vds_env_%%_src2", + NULL +}; + +/* I/O test config flags */ +#define TEST_IO_CLOSE_SRC 0x01u +#define TEST_IO_DIFFERENT_FILE 0x02u +#define TEST_IO_REOPEN_VIRT 0x04u +#define TEST_IO_NTESTS 0x08u + +#define FILENAME_BUF_SIZE 1024 + +#define TMPDIR "tmp/" + +/*------------------------------------------------------------------------- + * Function: test_vds_prefix_second + * + * Purpose: Set up vds link prefix via H5Pset_virtual_prefix() to be "tmp" + * Should be able to access the target source files in tmp directory via the prefix set + * by H5Pset_virtual_prefix() + * + * Return: Success: 0 + * Failure: -1 + *------------------------------------------------------------------------- + */ +static int +test_vds_prefix_second(unsigned config, hid_t fapl) +{ + char srcfilename[FILENAME_BUF_SIZE]; + char srcfilename_map[FILENAME_BUF_SIZE]; + char vfilename[FILENAME_BUF_SIZE]; + char vfilename2[FILENAME_BUF_SIZE]; + char srcfilenamepct[FILENAME_BUF_SIZE]; + char srcfilenamepct_map[FILENAME_BUF_SIZE]; + const char *srcfilenamepct_map_orig = "vds%%%%_src"; + hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */ + hid_t vfile = -1; /* File with virtual dset */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t dapl = -1; /* Dataset access property list */ + hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */ + hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */ + hid_t memspace = -1; /* Memory dataspace */ + hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */ + hid_t vdset = -1; /* Virtual dataset */ + hsize_t dims[4] = {10, 26, 0, 0}; /* Data space current size */ + int buf[10][26]; /* Write and expected read buffer */ + int rbuf[10][26]; /* Read buffer */ + int fill = -1; /* Fill value */ + int i, j; + char buffer[1024]; /* buffer to read vds_prefix */ + + TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix") + + h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename); + h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2); + h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename); + h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map); + h5_fixname(FILENAME[3], fapl, srcfilenamepct, sizeof srcfilenamepct); + h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map); + + /* create tmp directory and get current working directory path */ + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR + + /* Create DCPL */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + /* Set fill value */ + if(H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fill) < 0) + TEST_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + TEST_ERROR + + if(H5Pset_virtual_prefix(dapl, "someprefix") < 0) + TEST_ERROR + if(H5Pget_virtual_prefix(dapl, buffer, sizeof(buffer)) < 0) + TEST_ERROR + + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("vds prefix not set correctly"); + + /* Create source dataspace */ + if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Create virtual dataspace */ + if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0) + TEST_ERROR + + /* Select all (should not be necessary, but just to be sure) */ + if(H5Sselect_all(srcspace[0]) < 0) + TEST_ERROR + if(H5Sselect_all(vspace[0]) < 0) + TEST_ERROR + + /* Add virtual layout mapping */ + if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename_map : ".", "src_dset", srcspace[0]) < 0) + TEST_ERROR + + /* Create virtual file */ + if((vfile = H5Fcreate(vfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Create source file if requested */ + if(config & TEST_IO_DIFFERENT_FILE) { + HDgetcwd(buffer, 1024); + HDchdir(TMPDIR); + if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + else { + srcfile[0] = vfile; + if(H5Iinc_ref(srcfile[0]) < 0) + TEST_ERROR + } + + /* Create source dataset */ + if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace[0], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create virtual dataset */ + if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0) + TEST_ERROR + + /* Populate write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] = (i * (int)(sizeof(buf[0]) / sizeof(buf[0][0]))) + j; + + /* Write data directly to source dataset */ + if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* Close srcdset and srcfile if config option specified */ + if(config & TEST_IO_CLOSE_SRC) { + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + + if(config & TEST_IO_DIFFERENT_FILE) { + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + } + } + + /* Reopen virtual dataset and file if config option specified */ + if(config & TEST_IO_REOPEN_VIRT) { + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if((vfile = H5Fopen(vfilename2, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0) + TEST_ERROR + } + + /* Read data through virtual dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) { + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) { + TEST_ERROR + } + } + + /* Adjust write buffer */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + buf[i][j] += (int)(sizeof(buf) / sizeof(buf[0][0])); + + /* Write data through virtual dataset */ + if(H5Dwrite(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf[0]) < 0) + TEST_ERROR + + /* 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((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + HDchdir(buffer); + } + if((srcdset[0] = H5Dopen2(srcfile[0], "src_dset", H5P_DEFAULT)) < 0) + TEST_ERROR + } + + /* Read data directly from source dataset */ + HDmemset(rbuf[0], 0, sizeof(rbuf)); + if(H5Dread(srcdset[0], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0) + TEST_ERROR + + /* Verify read data */ + for(i = 0; i < (int)(sizeof(buf) / sizeof(buf[0])); i++) + for(j = 0; j < (int)(sizeof(buf[0]) / sizeof(buf[0][0])); j++) + if(rbuf[i][j] != buf[i][j]) + TEST_ERROR + + /* Close */ + if(H5Dclose(vdset) < 0) + TEST_ERROR + vdset = -1; + if(H5Dclose(srcdset[0]) < 0) + TEST_ERROR + srcdset[0] = -1; + if(H5Fclose(srcfile[0]) < 0) + TEST_ERROR + srcfile[0] = -1; + if(H5Fclose(vfile) < 0) + TEST_ERROR + vfile = -1; + if(H5Sclose(srcspace[0]) < 0) + TEST_ERROR + srcspace[0] = -1; + if(H5Sclose(vspace[0]) < 0) + TEST_ERROR + vspace[0] = -1; + if(H5Pclose(dapl) < 0) + TEST_ERROR + dapl = -1; + if(H5Pclose(dcpl) < 0) + TEST_ERROR + dcpl = -1; + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) + H5Dclose(srcdset[i]); + H5Dclose(vdset); + for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) + H5Fclose(srcfile[i]); + H5Fclose(vfile); + for(i = 0; i < (int)(sizeof(srcspace) / sizeof(srcspace[0])); i++) + H5Sclose(srcspace[i]); + for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) + H5Sclose(vspace[i]); + H5Sclose(memspace); + H5Pclose(dapl); + H5Pclose(dcpl); + } H5E_END_TRY; + + return 1; +} /* end test_vds_prefix2 */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests datasets with virtual layout + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl; + int test_api_config; + unsigned bit_config; + H5F_libver_t low, high; /* Low and high bounds */ + unsigned latest = FALSE; /* Using the latest library version bound */ + int nerrors = 0; + + /* Testing setup */ + h5_reset(); + fapl = h5_fileaccess(); + + for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) { + HDprintf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : ""); + nerrors += test_vds_prefix_second(bit_config, fapl); + } + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + + if(nerrors) + goto error; + HDprintf("All virtual dataset tests passed.\n"); + h5_cleanup(FILENAME, fapl); + + return EXIT_SUCCESS; + +error: + nerrors = MAX(1, nerrors); + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "S"); + return EXIT_FAILURE; +} /* end main() */ -- cgit v0.12 From e5c5e758d9d68eef64302f9bfdd96fcbe3d54aa4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 27 Jul 2019 12:53:15 -0500 Subject: Minor code fixes --- hl/test/test_ds.c | 2 +- hl/test/test_dset_append.c | 997 ++++++++++++++++++++++----------------------- hl/tools/gif2h5/gif2mem.c | 3 +- 3 files changed, 499 insertions(+), 503 deletions(-) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 95178fc..d7af9e9 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1138,7 +1138,7 @@ static int test_detachscales(void) int rank3 = 3; hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/ int *buf = NULL; - char dname[10]; + char dname[16]; int i; /* This tests creates two three dimensional datasets; then it creates diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index d890481..e050de2 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -21,28 +21,28 @@ # define H5_ZLIB_HEADER "zlib.h" #endif #if defined(H5_ZLIB_HEADER) -# include H5_ZLIB_HEADER /* "zlib.h" */ +#include H5_ZLIB_HEADER /* "zlib.h" */ #endif -#define FILE "test_append.h5" -#define DNAME_NOTSET "dataset_notset" -#define DNAME_UNLIM "dataset_unlim" -#define DNAME_LESS "dataset_less" -#define DNAME_VARY "dataset_vary" -#define DNAME_ROW "dataset_row" -#define DNAME_COLUMN "dataset_column" -#define DBUGNAME1 "dataset_bug1" -#define DBUGNAME2 "dataset_bug2" +#define FILENAME "test_append.h5" +#define DNAME_NOTSET "dataset_notset" +#define DNAME_UNLIM "dataset_unlim" +#define DNAME_LESS "dataset_less" +#define DNAME_VARY "dataset_vary" +#define DNAME_ROW "dataset_row" +#define DNAME_COLUMN "dataset_column" +#define DBUGNAME1 "dataset_bug1" +#define DBUGNAME2 "dataset_bug2" /*------------------------------------------------------------------------- - * Function: test_dataset_append_notset + * Function: test_dataset_append_notset * - * Purpose: Verify that H5DOappend works properly with default dapl. - * That is, H5Pset_append_flush() is not used to set boundary - * and callback in dapl. + * Purpose: Verify that H5DOappend works properly with default dapl. + * That is, H5Pset_append_flush() is not used to set boundary + * and callback in dapl. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Aug 2016 * @@ -51,68 +51,68 @@ static int test_dataset_append_notset(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10]; /* The data buffers */ - int i, j; /* Local index variables */ - h5_stat_t sb1, sb2; /* File info */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 20}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10]; /* The data buffers */ + int i, j; /* Local index variables */ + h5_stat_t sb1, sb2; /* File info */ TESTING("Append flush with H5DOappend()--append rows with default dapl"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = (i * 10) + (j + 1); - /* Append without boundary, callback and flush */ - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - FAIL_STACK_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = (i * 10) + (j + 1); + /* Append without boundary, callback and flush */ + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + FAIL_STACK_ERROR; } /* end for */ /* File size when not flushed */ - if(HDstat(FILE, &sb1) < 0) - TEST_ERROR; + if(HDstat(FILENAME, &sb1) < 0) + TEST_ERROR; /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* File size after flushing */ - if(HDstat(FILE, &sb2) < 0) - TEST_ERROR; + if(HDstat(FILENAME, &sb2) < 0) + TEST_ERROR; /* File size before flushing should be less */ if(sb1.st_size > sb2.st_size) - TEST_ERROR; + TEST_ERROR; /* Closing */ if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -120,10 +120,10 @@ test_dataset_append_notset(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; @@ -148,14 +148,14 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void } /*------------------------------------------------------------------------- - * Function: test_dataset_append_rows_columns + * Function: test_dataset_append_rows_columns * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to a dataset - * with 2 extendible dimensions. + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to a dataset + * with 2 extendible dimensions. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -164,91 +164,91 @@ append_func(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void static int test_dataset_append_rows_columns(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* The data buffers */ - int buf[6][13], rbuf[6][13]; /* The data buffers */ + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* The data buffers */ + int buf[6][13], rbuf[6][13]; /* The data buffers */ - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ - int i, j; /* Local index variables */ + int i, j; /* Local index variables */ TESTING("Append flush with H5DOappend()--append rows & columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -257,33 +257,33 @@ test_dataset_append_rows_columns(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_UNLIM, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -291,25 +291,25 @@ test_dataset_append_rows_columns(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_rows_columns() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_rows + * Function: test_dataset_append_rows * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows to a dataset with - * one extendible dimension (row). + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows to a dataset with + * one extendible dimension (row). * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -318,71 +318,71 @@ error: static int test_dataset_append_rows(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10]; /* The data buffer */ - int buf[6][10], rbuf[6][10]; /* The data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 0}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 10}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10]; /* The data buffer */ + int buf[6][10], rbuf[6][10]; /* The data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 0}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 10; j++) + for(j = 0; j < 10; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -391,33 +391,33 @@ test_dataset_append_rows(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_ROW, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 10; j++) + for(j = 0; j < 10; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -425,25 +425,25 @@ test_dataset_append_rows(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_rows() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_columns + * Function: test_dataset_append_columns * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending columns to a dataset - * with one extendible dimension (column). + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending columns to a dataset + * with one extendible dimension (column). * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -452,72 +452,72 @@ error: static int test_dataset_append_columns(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {6, 0}; /* Current dimension sizes */ - hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int cbuf[6]; /* The data buffer */ - int buf[6][3], rbuf[6][3]; /* The data buffers */ - int i, j; /* Local index variable */ - - hsize_t boundary[2] = {0, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {6, 0}; /* Current dimension sizes */ + hsize_t maxdims[2] = {6, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int cbuf[6]; /* The data buffer */ + int buf[6][3], rbuf[6][3]; /* The data buffers */ + int i, j; /* Local index variable */ + + hsize_t boundary[2] = {0, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 3) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 3) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 3; j++) + for(j = 0; j < 3; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -526,33 +526,33 @@ test_dataset_append_columns(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_COLUMN, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 3; j++) + for(j = 0; j < 3; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -560,33 +560,34 @@ test_dataset_append_columns(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_columns() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_BUG1 + * Function: test_dataset_append_BUG1 * - * Purpose: Verify that the object flush property and the append flush property + * Purpose: Verify that the object flush property and the append flush property * are working properly when appending rows and columns to an * extendible dataset. - * A BUG occurs: - * when the extendible dataset is set up as follows: - * hsize_t dims[2] = {0, 10}; - * hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; - * when append 6 rows and 3 columns to the dataset; - * The data is correct when the dataset is read at this point; - * The data is incorrect when the dataset is closed, opened again, and read at this point; - * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. * - * Return: Success: 0 - * Failure: 1 + * A BUG occurs: + * when the extendible dataset is set up as follows: + * hsize_t dims[2] = {0, 10}; + * hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; + * when append 6 rows and 3 columns to the dataset; + * The data is correct when the dataset is read at this point; + * The data is incorrect when the dataset is closed, opened again, and read at this point; + * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. + * + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -595,126 +596,124 @@ error: static int test_dataset_append_BUG1(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property */ - hid_t dapl = -1; /* Dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* The data buffers */ - int buf[6][13], rbuf[6][13]; /* The data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* Dataset creation property */ + hid_t dapl = -1; /* Dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, 50}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* The data buffers */ + int buf[6][13], rbuf[6][13]; /* The data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows & columns--BUG1"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#ifdef BUG1 HDmemset(rbuf, 0, sizeof(rbuf)); /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ - if((did = H5Dopen(fid, DBUGNAME1, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + if((did = H5Dopen2(fid, DBUGNAME1, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#endif /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -722,33 +721,34 @@ test_dataset_append_BUG1(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(dapl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(dapl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_BUG1() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_BUG2 + * Function: test_dataset_append_BUG2 * - * Purpose: Verify that the object flush property and the append flush property + * Purpose: Verify that the object flush property and the append flush property * are working properly when appending rows and columns to an * extendible dataset. - * A BUG occurs: - * when the extendible dataset is set up as follows: - * hsize_t dims[2] = {0, 10}; - * hsize_t maxdims[2] = {50, H5S_UNLIMITED}; - * when append 6 rows and 3 columns to the dataset; - * The data is correct when the dataset is read at this point; - * The data is incorrect when the dataset is closed, opened again, and read at this point; - * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. * - * Return: Success: 0 - * Failure: 1 + * A BUG occurs: + * when the extendible dataset is set up as follows: + * hsize_t dims[2] = {0, 10}; + * hsize_t maxdims[2] = {50, H5S_UNLIMITED}; + * when append 6 rows and 3 columns to the dataset; + * The data is correct when the dataset is read at this point; + * The data is incorrect when the dataset is closed, opened again, and read at this point; + * NOTE: the problem does not occur when H5Dflush() is not performed for each row/column. + * + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -757,127 +757,125 @@ error: static int test_dataset_append_BUG2(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property */ - hid_t dapl = -1; /* Dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[10], cbuf[6]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j; /* Local index variables */ - - hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* Dataset creation property */ + hid_t dapl = -1; /* Dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {50, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[10], cbuf[6]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j; /* Local index variables */ + + hsize_t boundary[2] = {1, 1}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append rows & columns--BUG2"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset */ for(i = 0; i < 6; i++) { - for(j = 0; j < 10; j++) - lbuf[j] = buf[i][j] = (i * 10) + (j + 1); - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + for(j = 0; j < 10; j++) + lbuf[j] = buf[i][j] = (i * 10) + (j + 1); + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)1, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 6) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 6) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset */ for(i = 0; i < 3; i++) { - for(j = 0; j < 6; j++) - cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; - if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + for(j = 0; j < 6; j++) + cbuf[j] = buf[j][i+10] = ((i * 6) + (j + 1)) * -1; + if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)1, H5T_NATIVE_INT, cbuf) < 0) + TEST_ERROR; } /* end for */ /* Verify the # of appends */ if(append_ct != 9) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 9) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#ifdef BUG2 HDmemset(rbuf, 0, sizeof(rbuf)); /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ - if((did = H5Dopen(fid, DBUGNAME2, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + if((did = H5Dopen2(fid, DBUGNAME2, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; -#endif /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -885,11 +883,11 @@ test_dataset_append_BUG2(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Pclose(dapl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dcpl); + H5Pclose(dapl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; @@ -897,15 +895,15 @@ error: /*------------------------------------------------------------------------- - * Function: test_dataset_append_less + * Function: test_dataset_append_less * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to an - * extendible dataset where the append size is less than the boundary - * size. + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to an + * extendible dataset where the append size is less than the boundary + * size. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -914,93 +912,93 @@ error: static int test_dataset_append_less(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[20], cbuf[6][3]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j, k; /* Local index variables */ - - hsize_t boundary[2] = {3, 3}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {100, 100}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[20], cbuf[6][3]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j, k; /* Local index variables */ + + hsize_t boundary[2] = {3, 3}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append size < boundary size"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append to the dataset 2 rows at a time for 3 times */ for(i = 0, k = 0; i < 6; i++) { - for(j = 0; j < 10; j++, k++) - buf[i][j] = lbuf[k] = (i * 10) + (j + 1); - - if((i + 1) % 2 == 0) { - if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; - k = 0; - } /* end if */ + for(j = 0; j < 10; j++, k++) + buf[i][j] = lbuf[k] = (i * 10) + (j + 1); + + if((i + 1) % 2 == 0) { + if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)2, H5T_NATIVE_INT, lbuf) < 0) + TEST_ERROR; + k = 0; + } /* end if */ } /* end for */ /* Verify the # of appends */ if(append_ct != 2) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 2) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset, once */ for(i = 0; i < 3; i++) - for(j = 0; j < 6; j++, k++) - cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + for(j = 0; j < 6; j++, k++) + cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 3) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 3) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -1009,33 +1007,33 @@ test_dataset_append_less(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_LESS, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -1043,29 +1041,29 @@ test_dataset_append_less(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_less() */ /*------------------------------------------------------------------------- - * Function: test_dataset_append_vary + * Function: test_dataset_append_vary * - * Purpose: Verify that the object flush property and the append flush property - * are working properly when appending rows and columns to an - * extendible dataset where - * row: the append size is 3 times of the boundary size - * the append callback/flush is performed on the 1st boundary hit - * column: the boundary is greater than the append size - * the boundary is not hit at all + * Purpose: Verify that the object flush property and the append flush property + * are working properly when appending rows and columns to an + * extendible dataset where + * row: the append size is 3 times of the boundary size + * the append callback/flush is performed on the 1st boundary hit + * column: the boundary is greater than the append size + * the boundary is not hit at all * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * * Programmer: Vailin Choi; Jan 2014 * @@ -1074,88 +1072,88 @@ error: static int test_dataset_append_vary(hid_t fid) { - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* A copy of dataset creation property */ - hid_t dapl = -1; /* A copy of dataset access property */ - hid_t ffapl = -1; /* The file's file access property list */ - - hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ - int lbuf[60], cbuf[6][3]; /* Data buffers */ - int buf[6][13], rbuf[6][13]; /* Data buffers */ - int i, j, k; /* Local index variables */ - - hsize_t boundary[2] = {3, 7}; /* Boundary sizes */ - unsigned append_ct = 0; /* The # of appends */ - unsigned *flush_ptr; /* Points to the flush counter */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t dcpl = -1; /* A copy of dataset creation property */ + hid_t dapl = -1; /* A copy of dataset access property */ + hid_t ffapl = -1; /* The file's file access property list */ + + hsize_t dims[2] = {0, 10}; /* Current dimension sizes */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dims[2] = {2,5}; /* Chunk dimension sizes */ + int lbuf[60], cbuf[6][3]; /* Data buffers */ + int buf[6][13], rbuf[6][13]; /* Data buffers */ + int i, j, k; /* Local index variables */ + + hsize_t boundary[2] = {3, 7}; /* Boundary sizes */ + unsigned append_ct = 0; /* The # of appends */ + unsigned *flush_ptr; /* Points to the flush counter */ TESTING("Append flush with H5DOappend()--append & boundary size vary"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ if((sid = H5Screate_simple(2, dims, maxdims)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set append flush property */ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the dataset */ if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) - TEST_ERROR; + TEST_ERROR; /* Append 6 rows to the dataset, once */ for(i = 0, k = 0; i < 6; i++) - for(j = 0; j < 10; j++, k++) - buf[i][j] = lbuf[k] = (i * 10) + (j + 1); + for(j = 0; j < 10; j++, k++) + buf[i][j] = lbuf[k] = (i * 10) + (j + 1); if(H5DOappend(did, H5P_DEFAULT, 0, (size_t)6, H5T_NATIVE_INT, lbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 1) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 1) - TEST_ERROR; + TEST_ERROR; /* Append 3 columns to the dataset, once */ for(i = 0; i < 3; i++) - for(j = 0; j < 6; j++, k++) - cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; + for(j = 0; j < 6; j++, k++) + cbuf[j][i] = buf[j][i + 10] = ((i * 6) + (j + 1)) * -1; if(H5DOappend(did, H5P_DEFAULT, 1, (size_t)3, H5T_NATIVE_INT, cbuf) < 0) - TEST_ERROR; + TEST_ERROR; /* Verify the # of appends */ if(append_ct != 1) - TEST_ERROR; + TEST_ERROR; /* Retrieve and verify object flush counts */ if(H5Pget_object_flush_cb(ffapl, NULL, (void **)&flush_ptr) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(*flush_ptr != 1) - TEST_ERROR; + TEST_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; @@ -1164,33 +1162,33 @@ test_dataset_append_vary(hid_t fid) /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Open the dataset again */ if((did = H5Dopen2(fid, DNAME_VARY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Verify the data */ for(i = 0; i < 6; i++) - for(j = 0; j < 13; j++) + for(j = 0; j < 13; j++) if(buf[i][j] != rbuf[i][j]) TEST_ERROR; /* Closing */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Pclose(ffapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; PASSED(); @@ -1198,24 +1196,23 @@ test_dataset_append_vary(hid_t fid) error: H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Pclose(dcpl); - H5Pclose(sid); - H5Dclose(did); - H5Pclose(ffapl); + H5Pclose(dapl); + H5Pclose(dcpl); + H5Pclose(sid); + H5Dclose(did); + H5Pclose(ffapl); } H5E_END_TRY; return 1; } /* test_dataset_append_vary() */ /*------------------------------------------------------------------------- - * Function: Main function + * Function: Main function * - * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush() - * along with H5DOappend(). + * Purpose: Test H5Pset/get_object_flush_cb() and H5Pset/get_append_flush() + * along with H5DOappend(). * - * Return: Success: 0 - * Failure: 1 + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Vailin Choi; Jan 2014 * @@ -1223,69 +1220,67 @@ error: */ int main(void) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - unsigned flush_ct = 0; /* The # of flushes */ - int nerrors = 0; /* The # of errors encountered */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + unsigned flush_ct = 0; /* The # of flushes */ + int nerrors = 0; /* The # of errors encountered */ /* Get a copy of file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set to use the latest library format */ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Set object flush property */ if(H5Pset_object_flush_cb(fapl, flush_func, &flush_ct) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Create the test file */ - if((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR; + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR; nerrors += test_dataset_append_notset(fid); nerrors += test_dataset_append_rows(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_columns(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_rows_columns(fid); -#ifdef BUG1_BUG2 /* * The following tests illustrate the scenarios when H5DOappend does not work with extensible array indexing: - * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible - * - the dataset expands along 1 dimension and then expands along the other dimension + * - when the the dataset has 1 unlimited dimension and the other dimension is fixed but extendible + * - the dataset expands along 1 dimension and then expands along the other dimension */ - flush_ct = 0; /* Reset flush counter */ - nerrors += test_dataset_append_BUG1(fid); + flush_ct = 0; /* Reset flush counter */ + nerrors += test_dataset_append_BUG1(fid); - flush_ct = 0; /* Reset flush counter */ - nerrors += test_dataset_append_BUG2(fid); -#endif + flush_ct = 0; /* Reset flush counter */ + nerrors += test_dataset_append_BUG2(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_less(fid); - flush_ct = 0; /* Reset flush counter */ + flush_ct = 0; /* Reset flush counter */ nerrors += test_dataset_append_vary(fid); /* Closing */ if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Check for errors */ if(nerrors) goto error; - return 0; + return EXIT_SUCCESS; error: - return 1; + return EXIT_FAILURE; } diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index ec029ea..8fb575c 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -295,7 +295,8 @@ Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) fprintf(stderr, "Error reading Graphic Control Extension information\n"); - if (!*MemGif++ == 0) + (*MemGif)++; + if ((!*MemGif) == 0) fprintf(stderr, "Error reading Graphic Control Extension\n"); -- cgit v0.12 From f7cc189609f046ccf1b145fae7b97c70b535e137 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Mon, 29 Jul 2019 11:22:20 -0500 Subject: 1. Updated the commands for compiling two new tests (external_env.c and vds_env.c). 2. Changed the data file names for external.c and external_env.c to avoid potential name conflict. --- test/CMakeTests.cmake | 197 +++++++++++++++++++------------------------------ test/external.c | 12 +-- test/external_common.c | 12 ++- test/external_common.h | 3 +- test/external_env.c | 28 ++++--- 5 files changed, 105 insertions(+), 147 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 6532536..60271ee 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -560,71 +560,6 @@ if (TEST_CACHE_IMAGE) ) endif () -#-- Adding test for external_env -add_test ( - NAME H5TEST-clear-external_env-objects - COMMAND ${CMAKE_COMMAND} - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=external_env.txt" - -D "TEST_REFERENCE=external_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - -E remove - extern_1r.raw - extern_2r.raw - extern_3r.raw - extern_4r.raw - extern_1w.raw - extern_2w.raw - extern_3w.raw - extern_4w.raw - external_env.txt - external_env.out - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) -add_test (NAME H5TEST-external_env COMMAND $) -set_tests_properties (H5TEST-external_env PROPERTIES - FIXTURES_REQUIRED external_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -#-- Adding test for vds_env -add_test ( - NAME H5TEST-clear-vds_env-objects - COMMAND ${CMAKE_COMMAND} - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=vds_env.txt" - -D "TEST_REFERENCE=vds_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - -E remove - vds_virt_0.h5 - vds_virt_3.h5 - vds_src_2.h5 - vds_env.txt - vds_env.out - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) -add_test (NAME H5TEST-vds_env COMMAND $) -set_tests_properties (H5TEST-vds_env PROPERTIES - FIXTURES_REQUIRED vds_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - #-- Adding test for flush1/2 add_test (NAME H5TEST-clear-flush-objects COMMAND ${CMAKE_COMMAND} @@ -854,66 +789,84 @@ set_tests_properties (H5TEST-links_env PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - #-- Adding test for external_env - add_test (NAME H5TEST-shared-clear-external_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - extern_1r.raw - extern_2r.raw - extern_3r.raw - extern_4r.raw - extern_1w.raw - extern_2w.raw - extern_3w.raw - extern_4w.raw - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-external_env-objects PROPERTIES FIXTURES_SETUP shared_external_env_clear_objects) - add_test (NAME H5TEST-shared-external_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=external_env.txt" - -D "TEST_REFERENCE=external_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-external_env PROPERTIES - FIXTURES_REQUIRED shared_external_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared +#-- Adding test for external_env +add_test ( + NAME H5TEST-clear-external_env-objects + COMMAND ${CMAKE_COMMAND} + -E remove + extern_env_1r.raw + extern_env_2r.raw + extern_env_3r.raw + extern_env_4r.raw + extern_env_1w.raw + extern_env_2w.raw + extern_env_3w.raw + extern_env_4w.raw + external_env.txt + external_env.out + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=external_env.txt" + #-D "TEST_REFERENCE=external_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) +endif () +set_tests_properties (H5TEST-external_env PROPERTIES + FIXTURES_REQUIRED external_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) - #-- Adding test for vds_env - add_test (NAME H5TEST-shared-clear-vds_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - vds_virt_0.h5 - vds_virt_3.h5 - vds_src_2.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST-shared - ) - set_tests_properties (H5TEST-shared-clear-vds_env-objects PROPERTIES FIXTURES_SETUP shared_vds_env_clear_objects) - add_test (NAME H5TEST-shared-vds_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=vds_env.txt" - -D "TEST_REFERENCE=vds_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5TEST-shared-vds_env PROPERTIES - FIXTURES_REQUIRED shared_vds_env_clear_objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared +#-- Adding test for vds_env +add_test ( + NAME H5TEST-clear-vds_env-objects + COMMAND ${CMAKE_COMMAND} + -E remove + vds_virt_0.h5 + vds_virt_3.h5 + vds_src_2.h5 + vds_env.txt + vds_env.out + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=vds_env.txt" + #-D "TEST_REFERENCE=vds_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) +endif () +set_tests_properties (H5TEST-vds_env PROPERTIES + FIXTURES_REQUIRED vds_env_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo diff --git a/test/external.c b/test/external.c index 9644d86..7e9ecf9 100644 --- a/test/external.c +++ b/test/external.c @@ -636,7 +636,7 @@ test_read_file_set(hid_t fapl) TEST_ERROR /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the file and an initial group. This causes messages about @@ -776,7 +776,7 @@ test_write_file_set(hid_t fapl) } /* end for */ /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -877,7 +877,7 @@ test_path_absolute(hid_t fapl) FAIL_STACK_ERROR /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dcpl */ @@ -973,7 +973,7 @@ test_path_relative(hid_t fapl) FAIL_STACK_ERROR; /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -1068,7 +1068,7 @@ test_path_relative_cwd(hid_t fapl) FAIL_STACK_ERROR; /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -1210,7 +1210,7 @@ test_h5d_get_access_plist(hid_t fapl_id) TEST_ERROR /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the file */ diff --git a/test/external_common.c b/test/external_common.c index e43a713..c9b6584 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -35,7 +35,7 @@ *------------------------------------------------------------------------- */ herr_t -reset_raw_data_files(void) +reset_raw_data_files(hbool_t is_env) { int fd = 0; /* external file descriptor */ size_t i, j; /* iterators */ @@ -59,7 +59,10 @@ reset_raw_data_files(void) for(i = 0; i < N_EXT_FILES; i++) { /* Open file */ - HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); + if(is_env) + HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1); + else + HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) goto error; @@ -93,7 +96,10 @@ reset_raw_data_files(void) for(i = 0; i < N_EXT_FILES; i++) { /* Open file */ - HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); + if(is_env) + HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1); + else + HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) goto error; diff --git a/test/external_common.h b/test/external_common.h index f1a15b5..304f3fb 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -30,6 +30,7 @@ static const char *EXT_FNAME[] = { "extern_4", "extern_dir/file_1", "extern_5", + "extern_env_dir/file_2", NULL }; @@ -41,5 +42,5 @@ static const char *EXT_FNAME[] = { #define TOTAL_SIZE 100 #define GARBAGE_PER_FILE 10 -herr_t reset_raw_data_files(void); +herr_t reset_raw_data_files(hbool_t is_env); #endif /* _EXTERNAL_COMMON_H */ diff --git a/test/external_env.c b/test/external_env.c index 455cf8e..284a2f0 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -56,15 +56,15 @@ test_path_env(hid_t fapl) TESTING("prefix in HDF5_EXTFILE_PREFIX"); - if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) + if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR; - h5_fixname(EXT_FNAME[4], fapl, filename, sizeof(filename)); + h5_fixname(EXT_FNAME[6], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + if(reset_raw_data_files(TRUE) < 0) TEST_ERROR /* Create the dataset */ @@ -73,7 +73,7 @@ test_path_env(hid_t fapl) if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) TEST_ERROR for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); + HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -144,7 +144,6 @@ main(void) hid_t fapl_id_new = -1; /* file access properties (new format) */ hid_t fid = -1; /* file for test_1* functions */ hid_t gid = -1; /* group to emit diagnostics */ - char filename[1024]; /* file name for test_1* funcs */ unsigned latest_format; /* default or latest file format */ int nerrors = 0; /* number of errors */ @@ -152,7 +151,6 @@ main(void) /* Get a fapl for the old (default) file format */ fapl_id_old = h5_fileaccess(); - h5_fixname(EXT_FNAME[0], fapl_id_old, filename, sizeof(filename)); /* Copy and set up a fapl for the latest file format */ if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0) @@ -186,15 +184,15 @@ main(void) /* Clean up files used by file set tests */ if(h5_cleanup(EXT_FNAME, fapl_id_old)) { - HDremove("extern_1r.raw"); - HDremove("extern_2r.raw"); - HDremove("extern_3r.raw"); - HDremove("extern_4r.raw"); - - HDremove("extern_1w.raw"); - HDremove("extern_2w.raw"); - HDremove("extern_3w.raw"); - HDremove("extern_4w.raw"); + HDremove("extern_env_1r.raw"); + HDremove("extern_env_2r.raw"); + HDremove("extern_env_3r.raw"); + HDremove("extern_env_4r.raw"); + + HDremove("extern_env_1w.raw"); + HDremove("extern_env_2w.raw"); + HDremove("extern_env_3w.raw"); + HDremove("extern_env_4w.raw"); HDrmdir("extern_dir"); } /* end if */ -- cgit v0.12 From 64c17fd18b2649fe4f571b7c10a0b1cc82856af8 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Mon, 29 Jul 2019 12:00:53 -0500 Subject: Updated the command for external_env and vds_env to the most recent changes. --- test/CMakeTests.cmake | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 60271ee..07f840a 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -791,9 +791,8 @@ set_tests_properties (H5TEST-links_env PROPERTIES #-- Adding test for external_env add_test ( - NAME H5TEST-clear-external_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove + NAME H5TEST-external_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove extern_env_1r.raw extern_env_2r.raw extern_env_3r.raw @@ -802,12 +801,10 @@ add_test ( extern_env_2w.raw extern_env_3w.raw extern_env_4w.raw - external_env.txt - external_env.out WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) +set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -826,25 +823,22 @@ else () ) endif () set_tests_properties (H5TEST-external_env PROPERTIES - FIXTURES_REQUIRED external_env_clear_objects + FIXTURES_REQUIRED clear_external_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for vds_env add_test ( - NAME H5TEST-clear-vds_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove + NAME H5TEST-vds_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove vds_virt_0.h5 vds_virt_3.h5 vds_src_2.h5 - vds_env.txt - vds_env.out WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) +set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -863,7 +857,7 @@ else () ) endif () set_tests_properties (H5TEST-vds_env PROPERTIES - FIXTURES_REQUIRED vds_env_clear_objects + FIXTURES_REQUIRED clear_vds_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -- cgit v0.12 From 6db61f4b91df48247f04e4864b01cb602411802a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Jul 2019 16:08:02 -0500 Subject: Correct syntax --- CTestConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 886228d..fd6b956 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -50,5 +50,5 @@ set (CTEST_TEST_TIMEOUT 1200 CACHE STRING set (DART_TESTING_TIMEOUT 1200 CACHE STRING "Maximum time allowed before CTest will kill the test." FORCE) -SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING +set (CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING "How long to wait between timed-out CTest submissions.") -- cgit v0.12 From 794c50e995c2c37c4ba85d7e19b80c4b20c9346b Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Mon, 29 Jul 2019 16:13:51 -0500 Subject: A minor bug fix. --- test/external_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/external_env.c b/test/external_env.c index 284a2f0..fca5458 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -194,7 +194,7 @@ main(void) HDremove("extern_env_3w.raw"); HDremove("extern_env_4w.raw"); - HDrmdir("extern_dir"); + HDrmdir("extern_env_dir"); } /* end if */ return EXIT_SUCCESS; -- cgit v0.12 From a873d149e535a32cc1125fb744b0344112096d48 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 30 Jul 2019 16:58:24 -0500 Subject: Cleanup when merging to other branches --- c++/test/dsets.cpp | 80 +- c++/test/tarray.cpp | 1 - examples/h5_extend_write.c | 6 +- fortran/src/H5Sf.c | 9 +- fortran/src/H5_f.c | 2 - fortran/src/H5match_types.c | 6 +- hl/test/test_ds.c | 6 +- hl/test/test_dset_append.c | 3 +- java/test/TestH5P.java | 4 +- test/CMakeTests.cmake | 146 +-- test/CMakeVFDTests.cmake | 2 + test/accum.c | 38 +- test/app_ref.c | 6 +- test/big.c | 4 +- test/bittests.c | 174 +-- test/cache_common.c | 107 +- test/cache_logging.c | 15 +- test/cache_tagging.c | 2 +- test/cmpd_dset.c | 10 +- test/dangle.c | 3 +- test/direct_chunk.c | 10 +- test/dsets.c | 955 ++++++++-------- test/dt_arith.c | 1472 +++++++++++++------------ test/dtypes.c | 24 +- test/earray.c | 6 +- test/efc.c | 10 +- test/enc_dec_plist_cross_platform.c | 4 +- test/err_compat.c | 2 +- test/error_test.c | 54 +- test/evict_on_close.c | 48 +- test/external.c | 1 - test/farray.c | 414 ++++--- test/fillval.c | 57 +- test/flush1.c | 2 +- test/flush2.c | 10 +- test/flushrefresh.c | 109 +- test/freespace.c | 26 +- test/istore.c | 2 +- test/lheap.c | 12 +- test/links.c | 1942 +++++++++++++++++---------------- test/mount.c | 38 +- test/objcopy.c | 14 +- test/ohdr.c | 32 +- test/page_buffer.c | 6 +- test/tarray.c | 42 +- test/testexternal_env.sh.in | 3 + test/testfiles/err_compat_1 | 2 +- test/testfiles/err_compat_2 | 2 +- test/testfiles/error_test_2 | 2 +- test/testframe.c | 346 +++--- test/th5o.c | 48 +- test/tid.c | 9 +- test/titerate.c | 9 +- test/tmisc.c | 30 +- test/ttime.c | 6 +- test/tunicode.c | 2 +- test/tvlstr.c | 27 +- test/tvltypes.c | 6 +- test/twriteorder.c | 384 +++---- test/unregister.c | 239 ++-- test/use_disable_mdc_flushes.c | 8 +- test/vds.c | 24 +- test/vfd.c | 117 +- testpar/t_cache.c | 4 +- testpar/t_filters_parallel.c | 5 + testpar/t_pread.c | 7 - tools/lib/h5diff.c | 1 - tools/lib/h5diff_array.c | 19 +- tools/lib/h5tools.c | 6 +- tools/lib/h5tools_str.c | 6 +- tools/lib/h5tools_utils.c | 26 +- tools/lib/h5trav.c | 2 +- tools/src/h5dump/h5dump_xml.c | 4 +- tools/src/h5repack/h5repack.c | 14 +- tools/src/h5repack/h5repack_copy.c | 30 +- tools/src/h5repack/h5repack_filters.c | 10 +- tools/src/h5repack/h5repack_refs.c | 24 +- tools/test/h5diff/h5diffgentest.c | 162 ++- tools/test/misc/h5clear_gentest.c | 2 +- tools/test/misc/talign.c | 8 +- 80 files changed, 3769 insertions(+), 3741 deletions(-) diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index cf4f6e4..14f1bd4 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -58,13 +58,13 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- * Function: test_create * - * Purpose: Attempts to create a dataset. + * Purpose Attempts to create a dataset. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -184,15 +184,15 @@ static herr_t test_create( H5File& file) /*------------------------------------------------------------------------- * Function: test_simple_io * - * Purpose: Tests simple I/O. That is, reading and writing a complete + * Purpose Tests simple I/O. That is, reading and writing a complete * multi-dimensional array without data type or data space * conversions, without compression, and stored contiguously. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -268,13 +268,13 @@ static herr_t test_simple_io( H5File& file) /*------------------------------------------------------------------------- * Function: test_datasize * - * Purpose: Tests DataSet::getInMemDataSize(). + * Purpose Tests DataSet::getInMemDataSize(). * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Thursday, March 22, 2012 *------------------------------------------------------------------------- */ @@ -334,13 +334,13 @@ static herr_t test_datasize(FileAccPropList &fapl) /*------------------------------------------------------------------------- * Function: test_tconv * - * Purpose: Test some simple data type conversion stuff. + * Purpose Test some simple data type conversion stuff. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -425,13 +425,13 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{ /*------------------------------------------------------------------------- * Function: bogus * - * Purpose: A bogus compression method that doesn't do anything. + * Purpose A bogus compression method that doesn't do anything. * - * Return: Success: Data chunk size + * Return Success: Data chunk size * * Failure: 0 * - * Programmer: Robb Matzke + * Programmer Robb Matzke * Tuesday, April 21, 1998 *------------------------------------------------------------------------- */ @@ -447,16 +447,16 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, /*------------------------------------------------------------------------- * Function: test_compression * - * Purpose: Tests dataset compression. If compression is requested when + * Purpose Tests dataset compression. If compression is requested when * it hasn't been compiled into the library (such as when * updating an existing compressed dataset) then data is sent to * the file uncompressed but no errors are returned. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 *------------------------------------------------------------------------- */ @@ -730,13 +730,13 @@ static herr_t test_compression(H5File& file) /*------------------------------------------------------------------------- * Function: test_nbit_methods * - * Purpose: Tests setting nbit compression methods. + * Purpose Tests setting nbit compression methods. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, April 22, 2016 * *------------------------------------------------------------------------- @@ -847,16 +847,16 @@ static herr_t test_nbit_compression(H5File& file) /*------------------------------------------------------------------------- * Function: test_multiopen * - * Purpose: Tests that a bug no longer exists. If a dataset is opened + * Purpose Tests that a bug no longer exists. If a dataset is opened * twice and one of the handles is used to extend the dataset, * then the other handle should return the new size when * queried. * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Saturday, February 17, 2001 *------------------------------------------------------------------------- */ @@ -929,13 +929,13 @@ static herr_t test_multiopen (H5File& file) /*------------------------------------------------------------------------- * Function: test_types * - * Purpose: Test various types - should be moved to dtypes.cpp + * Purpose Test various types - should be moved to dtypes.cpp * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * February 17, 2001 *------------------------------------------------------------------------- */ @@ -1118,9 +1118,9 @@ static herr_t test_types(H5File& file) /*------------------------------------------------------------------------- * Function: test_getObjinfo * - * Purpose: Tests getObjinfo() + * Purpose Tests getObjinfo() * - * Return: Success: 0 + * Return Success: 0 * Failure: -1 * * July, 2018 @@ -1178,10 +1178,10 @@ static herr_t test_getinfo(H5File& file) /*------------------------------------------------------------------------- * Function: test_chunk_cache * - * Purpose: Tests setting rdcc info on a DAPL, and interaction + * Purpose Tests setting rdcc info on a DAPL, and interaction * with the corresponding properties in the file structure. * - * Return: Success: 0 + * Return Success: 0 * Failure: number of errors * * July 2018 @@ -1290,13 +1290,13 @@ static herr_t test_chunk_cache(FileAccPropList fapl) /*------------------------------------------------------------------------- * Function: test_virtual * - * Purpose: Tests fixed, unlimited, and printf selections in the same + * Purpose Tests fixed, unlimited, and printf selections in the same * VDS * - * Return: Success: 0 + * Return Success: 0 * Failure: number of errors * - * Programmer: Binh-Minh Ribler + * Programmer Binh-Minh Ribler * Friday, March 10, 2017 * *------------------------------------------------------------------------- @@ -1368,13 +1368,13 @@ static herr_t test_virtual() /*------------------------------------------------------------------------- * Function: test_dset * - * Purpose: Tests the dataset interface (H5D) + * Purpose Tests the dataset interface (H5D) * - * Return: Success: 0 + * Return Success: 0 * * Failure: -1 * - * Programmer: Binh-Minh Ribler (using C version) + * Programmer Binh-Minh Ribler (using C version) * Friday, January 5, 2001 * * Modifications: @@ -1438,11 +1438,11 @@ void test_dset() /*------------------------------------------------------------------------- * Function: cleanup_dsets * - * Purpose: Cleanup temporary test files + * Purpose Cleanup temporary test files * - * Return: None + * Return None * - * Programmer: (use C version) + * Programmer (use C version) *------------------------------------------------------------------------- */ extern "C" diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index a341885..fccc556 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -371,7 +371,6 @@ static void test_array_info() s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; - int nmemb; // Number of compound members int ii; // counting variables hsize_t idxi, idxj, idxk; // dimension indicing variables H5T_class_t mclass; // Datatype class for field diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index f3f6077..4abda30 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -163,9 +163,9 @@ main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 * 2 0 0 0 0 * 2 0 0 0 0 * 2 0 0 0 0 diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 2eae0d9..0bafc58 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -1033,22 +1033,21 @@ h5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_ hsize_t *c_block = NULL; H5S_seloper_t c_op; - herr_t status; int rank; int i; rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_start == NULL) goto DONE; - c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_count == NULL) goto DONE; - c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_stride == NULL) goto DONE; - c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); + c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*(unsigned)rank); if (c_block == NULL) goto DONE; diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 69ba8b3..08b0212 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -632,7 +632,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5s_flags[15] = (int_f)H5S_SEL_POINTS; h5s_flags[16] = (int_f)H5S_SEL_HYPERSLABS; h5s_flags[17] = (int_f)H5S_SEL_ALL; - /* * H5T flags */ @@ -671,7 +670,6 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5t_flags[32] = (int_f)H5T_ARRAY; h5t_flags[33] = (int_f)H5T_DIR_ASCEND; h5t_flags[34] = (int_f)H5T_DIR_DESCEND; - /* * H5Z flags */ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index 57f7dda..e39e85a 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -143,7 +143,7 @@ void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char int main(void) { int i; - char chrA[32],chrB[32]; + char chrA[64],chrB[64]; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; @@ -347,8 +347,8 @@ int main(void) for(i=0;i 0) { - sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); - sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); + snprintf(chrA, sizeof(chrA), "Fortran_REAL_%s", Real_C_TYPES[i]); + snprintf(chrB, sizeof(chrB), "real_%s_f", Real_C_TYPES[i]); writeToFiles("float",chrA, chrB, RealKinds[i]); } } diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index d7af9e9..6c75423 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4876,12 +4876,12 @@ static int read_data( const char* fname, for(i=0, nelms=1; i < ndims; i++) { if(fscanf( f, "%s %u", str, &j) && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ @@ -4899,7 +4899,7 @@ static int read_data( const char* fname, for(j = 0; j < nelms; j++) { if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index e050de2..8bb4f84 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -11,11 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #include #include + #include "h5hltest.h" #include "H5DOpublic.h" -#include #if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) # define H5_ZLIB_HEADER "zlib.h" diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 981f34e..b1c29b2 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -209,12 +209,12 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidlow() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST); } @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); } @Test diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index f307950..dd977ce 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -554,6 +554,79 @@ if (TEST_CACHE_IMAGE) ) endif () +#-- Adding test for external_env +add_test ( + NAME H5TEST-external_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + extern_1r.raw + extern_2r.raw + extern_3r.raw + extern_4r.raw + extern_1w.raw + extern_2w.raw + extern_3w.raw + extern_4w.raw + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=external_env.txt" + #-D "TEST_REFERENCE=external_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-external_env PROPERTIES + FIXTURES_REQUIRED clear_external_env + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + +#-- Adding test for vds_env +add_test ( + NAME H5TEST-vds_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + vds_virt_0.h5 + vds_virt_3.h5 + vds_src_2.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST +) +set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) +if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +else () + add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=vds_env.txt" + #-D "TEST_REFERENCE=vds_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) +endif () +set_tests_properties (H5TEST-vds_env PROPERTIES + FIXTURES_REQUIRED clear_vds_env + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST +) + #-- Adding test for flush1/2 add_test (NAME H5TEST-flush-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -762,79 +835,6 @@ set_tests_properties (H5TEST-links_env PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -#-- Adding test for external_env -add_test ( - NAME H5TEST-external_env-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - extern_env_1r.raw - extern_env_2r.raw - extern_env_3r.raw - extern_env_4r.raw - extern_env_1w.raw - extern_env_2w.raw - extern_env_3w.raw - extern_env_4w.raw - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -else () - add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=external_env.txt" - #-D "TEST_REFERENCE=external_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (H5TEST-external_env PROPERTIES - FIXTURES_REQUIRED clear_external_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - -#-- Adding test for vds_env -add_test ( - NAME H5TEST-vds_env-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove - vds_virt_0.h5 - vds_virt_3.h5 - vds_src_2.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -else () - add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=vds_env.txt" - #-D "TEST_REFERENCE=vds_env.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (H5TEST-vds_env PROPERTIES - FIXTURES_REQUIRED clear_vds_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" - WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST -) - if (NOT BUILD_SHARED_LIBS) #-- Adding test for libinfo add_test (NAME H5TEST-testlibinfo diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index b94fc88..cf938f5 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -81,6 +81,8 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD tcheck_version testmeta links_env + external_env + vds_env ) if (NOT CYGWIN) list (REMOVE_ITEM H5_VFD_SKIP_TESTS big cache) diff --git a/test/accum.c b/test/accum.c index 19006b6..4cef35a 100644 --- a/test/accum.c +++ b/test/accum.c @@ -94,7 +94,7 @@ main(void) /* Test Setup */ - puts("Testing the metadata accumulator"); + HDputs("Testing the metadata accumulator"); /* Create a test file */ if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -141,14 +141,14 @@ main(void) if(nerrors) goto error; - puts("All metadata accumulator tests passed."); + HDputs("All metadata accumulator tests passed."); return 0; error: if(api_ctx_pushed) H5CX_pop(); - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } /* end main() */ @@ -1951,10 +1951,11 @@ test_swmr_write_big(hbool_t newest_format) if((pid = HDfork()) < 0) { HDperror("fork"); FAIL_STACK_ERROR; - } else if(0 == pid) { /* Child process */ + } + else if(0 == pid) { /* Child process */ /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - printf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", strerror(errno)); FAIL_STACK_ERROR; } /* end if */ @@ -2030,18 +2031,19 @@ accum_printf(const H5F_t *f) { H5F_meta_accum_t * accum = &f->shared->accum; - printf("\n"); - printf("Current contents of accumulator:\n"); - if (accum->alloc_size == 0) { - printf("=====================================================\n"); - printf(" No accumulator allocated.\n"); - printf("=====================================================\n"); - } else { - printf("=====================================================\n"); - printf(" accumulator allocated size == %zu\n", accum->alloc_size); - printf(" accumulated data size == %zu\n", accum->size); + HDprintf("\n"); + HDprintf("Current contents of accumulator:\n"); + if(accum->alloc_size == 0) { + HDprintf("=====================================================\n"); + HDprintf(" No accumulator allocated.\n"); + HDprintf("=====================================================\n"); + } + else { + HDprintf("=====================================================\n"); + HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); + HDprintf(" accumulated data size == %zu\n", accum->size); HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); if(accum->dirty) { HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); @@ -2049,8 +2051,8 @@ accum_printf(const H5F_t *f) } /* end if */ HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); - printf("=====================================================\n"); + HDprintf("=====================================================\n"); } - printf("\n\n"); + HDprintf("\n\n"); } /* accum_printf() */ diff --git a/test/app_ref.c b/test/app_ref.c index 3ef3fef..a4853fa 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -83,8 +83,8 @@ Abrt_Handler (int H5_ATTR_UNUSED sig) int i, n; for (i=0; i0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find copied region in destination"); + HDputs (" Unabled to find copied region in destination"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found copied bits when we shouldn't have"); + HDputs (" Found copied bits when we shouldn't have"); goto failed; } @@ -199,25 +199,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first copied bit in destination " + HDprintf (" Unable to find first copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits and shouldn't have!"); + HDputs (" Found copied bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -228,25 +228,25 @@ test_copy (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last copied bit in destination " + HDprintf (" Unable to find last copied bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found copied bits but shouldn't have (reverse)!"); + HDputs (" Found copied bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of copied data " + HDprintf (" Unable to find beginning of copied data " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading original data but shouldn't have!"); + HDputs (" Found leading original data but shouldn't have!"); goto failed; } @@ -256,14 +256,14 @@ test_copy (void) return 0; failed: - printf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, s_offset=%lu, d_offset=%lu, size=%lu\n", i, (unsigned long)s_offset, (unsigned long)d_offset, (unsigned long)size); - printf (" s = 0x"); - for (j=sizeof(v1)-1; j>=0; --j) printf ("%02x", v1[j]); - printf ("\n d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" s = 0x"); + for (j=sizeof(v1)-1; j>=0; --j) HDprintf ("%02x", v1[j]); + HDprintf ("\n d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -311,7 +311,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if(n != (ssize_t)offset + shift_dist) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -323,7 +323,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -338,7 +338,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -350,7 +350,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if(n != (ssize_t)(offset + size) - shift_dist - 1) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -373,7 +373,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(LSB) " + HDprintf (" Unable to verify all bits are zero in destination(LSB) " "(n=%d)\n", (int)n); goto failed; } @@ -382,7 +382,7 @@ test_shift (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n >= 0) { H5_FAILED(); - printf (" Unable to verify all bits are zero in destination(MSB) " + HDprintf (" Unable to verify all bits are zero in destination(MSB) " "(n=%d)\n", (int)n); goto failed; } @@ -392,11 +392,11 @@ test_shift (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu, shift_dist=%lu\n", i, (unsigned long)offset, (unsigned long)size, (unsigned long)shift_dist); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -446,13 +446,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (size!=1 && (size_t)n!=offset+size-1) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -464,13 +464,13 @@ test_increment (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (size!=1 && n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if(size==1 && n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bit in destination " + HDprintf (" Unable to verify all-zero bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -480,10 +480,10 @@ test_increment (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -530,7 +530,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -542,7 +542,7 @@ test_decrement (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -552,10 +552,10 @@ test_decrement (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -602,7 +602,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if ((size_t)n!=offset) { H5_FAILED(); - printf (" Unable to find first bit in destination " + HDprintf (" Unable to find first bit in destination " "(n=%d)\n", (int)n); goto failed; } @@ -614,7 +614,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n!=(ssize_t)(offset+size-1)) { H5_FAILED(); - printf (" Unable to find last bit in destination " + HDprintf (" Unable to find last bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -630,7 +630,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(n=%d)\n", (int)n); goto failed; } @@ -642,7 +642,7 @@ test_negate (void) n = H5T__bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1); if (n>=0) { H5_FAILED(); - printf (" Unable to verify all-zero bits in destination " + HDprintf (" Unable to verify all-zero bits in destination " "(reverse, n=%d)\n", (int)n); goto failed; } @@ -652,10 +652,10 @@ test_negate (void) return 0; failed: - printf (" i=%d, offset=%lu, size=%lu\n", + HDprintf (" i=%d, offset=%lu, size=%lu\n", i, (unsigned long)offset, (unsigned long)size); - for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]); - printf ("\n"); + for (j=sizeof(vector)-1; j>=0; --j) HDprintf ("%02x", vector[j]); + HDprintf ("\n"); return -1; } @@ -697,12 +697,12 @@ test_set (void) for (j=0; j<(int)sizeof(v2); j++) if (v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find set region in buffer"); + HDputs (" Unabled to find set region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found set bits when we shouldn't have"); + HDputs (" Found set bits when we shouldn't have"); goto failed; } @@ -711,25 +711,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 1); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first set bit in destination " + HDprintf (" Unable to find first set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits and shouldn't have!"); + HDputs (" Found set bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 0); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order zeros are present and shouldn't be!"); + HDputs (" High-order zeros are present and shouldn't be!"); goto failed; } @@ -740,25 +740,25 @@ test_set (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 1); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last set bit in destination " + HDprintf (" Unable to find last set bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found set bits but shouldn't have (reverse)!"); + HDputs (" Found set bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 0); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of set bit region " + HDprintf (" Unable to find beginning of set bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading zeros but shouldn't have!"); + HDputs (" Found leading zeros but shouldn't have!"); goto failed; } @@ -768,11 +768,11 @@ test_set (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -814,12 +814,12 @@ test_clear (void) for (j=0; j<(int)sizeof(v2); j++) if (0xff!=v2[j]) break; if (size>0 && j>=(int)sizeof(v2)) { H5_FAILED(); - puts (" Unabled to find cleared region in buffer"); + HDputs (" Unabled to find cleared region in buffer"); goto failed; } if (0==size && j<(int)sizeof(v2)) { H5_FAILED(); - puts (" Found cleared bits when we shouldn't have"); + HDputs (" Found cleared bits when we shouldn't have"); goto failed; } @@ -828,25 +828,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_LSB, 0); if (size>0 && n!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find first cleared bit in destination " + HDprintf (" Unable to find first cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits and shouldn't have!"); + HDputs (" Found cleared bits and shouldn't have!"); goto failed; } n = H5T__bit_find (v2, d_offset, 8*sizeof(v2)-d_offset, H5T_BIT_LSB, 1); if (d_offset+size<8*sizeof(v2) && n!=(ssize_t)size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(n=%d)\n", (int)n); goto failed; } if (d_offset+size==8*sizeof(v2) && n>=0) { H5_FAILED(); - puts (" High-order ones are present and shouldn't be!"); + HDputs (" High-order ones are present and shouldn't be!"); goto failed; } @@ -857,25 +857,25 @@ test_clear (void) n = H5T__bit_find (v2, (size_t)0, 8*sizeof(v2), H5T_BIT_MSB, 0); if (size>0 && (size_t)(n+1)!=d_offset+size) { H5_FAILED(); - printf (" Unable to find last cleared bit in destination " + HDprintf (" Unable to find last cleared bit in destination " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==size && n>=0) { H5_FAILED(); - puts (" Found cleared bits but shouldn't have (reverse)!"); + HDputs (" Found cleared bits but shouldn't have (reverse)!"); goto failed; } n = H5T__bit_find (v2, (size_t)0, d_offset+size, H5T_BIT_MSB, 1); if (d_offset>0 && n+1!=(ssize_t)d_offset) { H5_FAILED(); - printf (" Unable to find beginning of cleared bit region " + HDprintf (" Unable to find beginning of cleared bit region " "(reverse, n=%d)\n", (int)n); goto failed; } if (0==d_offset && n>=0) { H5_FAILED(); - puts (" Found leading ones but shouldn't have!"); + HDputs (" Found leading ones but shouldn't have!"); goto failed; } @@ -885,11 +885,11 @@ test_clear (void) return 0; failed: - printf (" i=%d, d_offset=%lu, size=%lu\n", + HDprintf (" i=%d, d_offset=%lu, size=%lu\n", i, (unsigned long)d_offset, (unsigned long)size); - printf (" d = 0x"); - for (j=sizeof(v2)-1; j>=0; --j) printf ("%02x", v2[j]); - printf ("\n"); + HDprintf (" d = 0x"); + for (j=sizeof(v2)-1; j>=0; --j) HDprintf ("%02x", v2[j]); + HDprintf ("\n"); return -1; } @@ -928,11 +928,11 @@ main(void) nerrors += test_negate() < 0 ? 1 : 0; if(nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All bit tests passed.\n"); + HDprintf("All bit tests passed.\n"); H5close(); diff --git a/test/cache_common.c b/test/cache_common.c index 2cc188e..b078964 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -20,6 +20,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" #include "H5MMprivate.h" + #include "cache_common.h" @@ -3276,23 +3277,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - HDassert(fid >= 0); - saved_fid = fid; + HDassert(fid >= 0); + saved_fid = fid; if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { pass = FALSE; failure_mssg = "H5Fflush() failed."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } else { + } + else { file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE); - if(file_ptr == NULL) { + if(file_ptr == NULL) { pass = FALSE; failure_mssg = "Can't get file_ptr."; if(verbose) HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC); - } + } } } @@ -3303,36 +3305,36 @@ setup_cache(size_t max_cache_size, if(pass) { /* A bit of fancy footwork here: - * - * The call to H5Fcreate() allocates an instance of H5C_t, - * initializes it, and stores its address in f->shared->cache. - * - * We don't want to use this cache, as it has a bunch of extra - * initialization that may change over time, and in any case - * it will not in general be configured the way we want it. - * - * We used to deal with this problem by storing the file pointer - * in another instance of H5C_t, and then ignoring the original - * version. However, this strategy doesn't work any more, as - * we can't store the file pointer in the instance of H5C_t, - * and we have modified many cache routines to use a file - * pointer to look up the target cache. - * - * Thus we now make note of the address of the instance of - * H5C_t created by the call to H5Fcreate(), set - * file_ptr->shared->cache to NULL, call H5C_create() - * to allocate a new instance of H5C_t for test purposes, - * and store than new instance's address in - * file_ptr->shared->cache. - * - * On shut down, we call H5C_dest on our instance of H5C_t, - * set file_ptr->shared->cache to point to the original - * instance, and then close the file normally. - */ + * + * The call to H5Fcreate() allocates an instance of H5C_t, + * initializes it, and stores its address in f->shared->cache. + * + * We don't want to use this cache, as it has a bunch of extra + * initialization that may change over time, and in any case + * it will not in general be configured the way we want it. + * + * We used to deal with this problem by storing the file pointer + * in another instance of H5C_t, and then ignoring the original + * version. However, this strategy doesn't work any more, as + * we can't store the file pointer in the instance of H5C_t, + * and we have modified many cache routines to use a file + * pointer to look up the target cache. + * + * Thus we now make note of the address of the instance of + * H5C_t created by the call to H5Fcreate(), set + * file_ptr->shared->cache to NULL, call H5C_create() + * to allocate a new instance of H5C_t for test purposes, + * and store than new instance's address in + * file_ptr->shared->cache. + * + * On shut down, we call H5C_dest on our instance of H5C_t, + * set file_ptr->shared->cache to point to the original + * instance, and then close the file normally. + */ HDassert(saved_cache == NULL); - saved_cache = file_ptr->shared->cache; - file_ptr->shared->cache = NULL; + saved_cache = file_ptr->shared->cache; + file_ptr->shared->cache = NULL; cache_ptr = H5C_create(max_cache_size, min_clean_size, @@ -3351,19 +3353,20 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass) { - if(cache_ptr == NULL) { + if(cache_ptr == NULL) { pass = FALSE; failure_mssg = "H5C_create() failed."; if(verbose) HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC); - } else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { + } + else if(cache_ptr->magic != H5C__H5C_T_MAGIC) { pass = FALSE; - failure_mssg = "Bad cache_ptr magic."; + failure_mssg = "Bad cache_ptr magic."; if(verbose) HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC); - } + } } if(show_progress) /* 7 */ @@ -3446,7 +3449,7 @@ takedown_cache(H5F_t * file_ptr, H5C_stats(cache_ptr, "test cache", dump_detailed_stats); } - if ( H5C_prep_for_file_close(file_ptr) < 0 ) { + if ( H5C_prep_for_file_close(file_ptr) < 0 ) { pass = FALSE; failure_mssg = "unexpected failure of prep for file close.\n"; @@ -3456,23 +3459,23 @@ takedown_cache(H5F_t * file_ptr, H5C_dest(file_ptr); - if ( saved_cache != NULL ) { + if ( saved_cache != NULL ) { - file_ptr->shared->cache = saved_cache; - saved_cache = NULL; - } + file_ptr->shared->cache = saved_cache; + saved_cache = NULL; + } } if ( saved_fapl_id != H5P_DEFAULT ) { H5Pclose(saved_fapl_id); - saved_fapl_id = H5P_DEFAULT; + saved_fapl_id = H5P_DEFAULT; } if ( saved_fcpl_id != H5P_DEFAULT ) { H5Pclose(saved_fcpl_id); - saved_fcpl_id = H5P_DEFAULT; + saved_fcpl_id = H5P_DEFAULT; } if ( saved_fid != -1 ) { @@ -3489,21 +3492,21 @@ takedown_cache(H5F_t * file_ptr, saved_actual_base_addr = HADDR_UNDEF; } - if ( H5Fclose(saved_fid) < 0 ) { + if ( H5Fclose(saved_fid) < 0 ) { pass = FALSE; - failure_mssg = "couldn't close test file."; + failure_mssg = "couldn't close test file."; - } else { + } else { - saved_fid = -1; + saved_fid = -1; } /* Pop API context */ H5CX_pop(); - if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { + if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) { if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename)) == NULL ) { @@ -3515,10 +3518,10 @@ takedown_cache(H5F_t * file_ptr, if ( HDremove(filename) < 0 ) { pass = FALSE; - failure_mssg = "couldn't delete test file."; + failure_mssg = "couldn't delete test file."; - } - } + } + } } return; diff --git a/test/cache_logging.c b/test/cache_logging.c index 1eb9d41..c43609b 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -40,10 +40,10 @@ test_logging_api(void) char *location = NULL; size_t size; - hid_t fid; - hid_t gid; + hid_t fid = -1; + hid_t gid = -1; hbool_t is_currently_logging; - char group_name[8]; + char group_name[12]; char filename[1024]; int i; @@ -111,8 +111,8 @@ test_logging_api(void) /* Perform some manipulations */ for(i = 0; i < N_GROUPS; i++) { - HDmemset(group_name, 0, 8); - HDsnprintf(group_name, 8, "%d", i); + HDmemset(group_name, 0, sizeof(group_name)); + HDsnprintf(group_name, sizeof(group_name), "%d", i); if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Gclose(gid) < 0) @@ -166,10 +166,11 @@ main(void) if(nerrors) { HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; + HDexit(EXIT_FAILURE); } HDprintf("All Metadata Cache Logging tests passed.\n"); - return 0; + + HDexit(EXIT_SUCCESS); } diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 119ba62..df28079 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -394,7 +394,7 @@ error: * Function: get_sbe_tag() * * Purpose: This function retrieves the tag associated with the superblock - * extension (the object header address stored in the superblock) + * extension (the object header address stored in the superblock) * * Return: 0 on Success; 1 on Failure * diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5d6cfc7..11bc2b7 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -910,7 +910,7 @@ initialize_stype1(unsigned char *buf, size_t num) stype1 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype1 *)buf + i; + s_ptr = (stype1 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -953,7 +953,7 @@ initialize_stype2(unsigned char *buf, size_t num) stype2 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype2 *)buf + i; + s_ptr = (stype2 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1000,7 +1000,7 @@ initialize_stype3(unsigned char *buf, size_t num) stype3 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype3 *)buf + i; + s_ptr = (stype3 *)((void *)buf) + i; s_ptr->a = i * 8 + 0; s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) @@ -1031,7 +1031,7 @@ initialize_stype4(unsigned char *buf, size_t num) stype4 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype4 *)buf + i; + s_ptr = (stype4 *)((void *)buf) + i; s_ptr->a = (int)(i * 8 + 0); s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) @@ -1808,7 +1808,7 @@ test_pack_ooo(void) unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */ unsigned num_free; /* Number of free slots in order */ unsigned sub_cmpd_order; /* Order to insert the inner compound */ - char name[6]; /* Member name */ + char name[16]; /* Member name */ unsigned extra_space; /* Whether to add extra space to the end of * the compound */ unsigned i, j; /* Indices */ diff --git a/test/dangle.c b/test/dangle.c index 75e9c84..9f30f10 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -602,7 +602,8 @@ test_dangle_force(void) TEST_ERROR; /* Allocate the array of object IDs */ - objs = (hid_t*)HDmalloc(sizeof(hid_t) * (size_t)count); + if(NULL == (objs = (hid_t *)HDcalloc((size_t)count, sizeof(hid_t)))) + TEST_ERROR; /* Get the list of open IDs */ if(H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)count, objs) < 0) diff --git a/test/direct_chunk.c b/test/direct_chunk.c index f68fb93..447e827 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2008,11 +2008,11 @@ error: static int test_single_chunk(unsigned config) { - hid_t fid; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */ hsize_t offset[2] = {0,0}; /* Offset for writing */ diff --git a/test/dsets.c b/test/dsets.c index 9562ec9..4302475 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -408,7 +408,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -430,7 +430,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -452,7 +452,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -491,10 +491,10 @@ test_create(hid_t file) if(H5Dclose(dataset) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_create() */ @@ -573,8 +573,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -597,8 +597,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -612,10 +612,10 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -630,7 +630,7 @@ error: HDclose(f); if(tconv_buf) HDfree(tconv_buf); - return -1; + return FAIL; } /* end test_simple_io() */ @@ -706,8 +706,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -720,10 +720,10 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ - return 0; + return SUCCEED; error: if(space > 0) @@ -736,7 +736,7 @@ error: if(H5Fclose(file) < 0) TEST_ERROR if(f > 0) HDclose(f); - return -1; + return FAIL; } /* end test_userblock_offset() */ @@ -821,10 +821,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -879,10 +879,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -917,7 +917,7 @@ test_compact_io(hid_t fapl) if(H5Pclose(plist) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -929,7 +929,7 @@ test_compact_io(hid_t fapl) H5Fclose(verfile); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_compact_io() */ @@ -1020,8 +1020,8 @@ test_max_compact(hid_t fapl) for(u = 0; u < compact_size; u++) if(rbuf[u] != wbuf[u]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)u); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)u); goto error; } /* end if */ @@ -1066,7 +1066,7 @@ test_max_compact(hid_t fapl) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: if(wbuf) @@ -1082,7 +1082,7 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_max_compact() */ @@ -1191,7 +1191,7 @@ test_layout_extend(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1205,7 +1205,7 @@ error: H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_layout_extend() */ @@ -1240,14 +1240,19 @@ test_conv_buffer(hid_t fid) CmpField *cf = NULL; CmpFieldR *cfrR = NULL; - hid_t dataset = -1; /* dataset ID */ - hid_t space = -1; /* data space ID */ - hid_t ctype1, ctype2; /* data type ID */ - hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5; + hid_t dataset = H5I_INVALID_HID; /* dataset ID */ + hid_t space = H5I_INVALID_HID; /* data space ID */ + hid_t ctype1 = H5I_INVALID_HID, + ctype2 = H5I_INVALID_HID; /* data type ID */ + hid_t arr_type1 = H5I_INVALID_HID, + arr_type2 = H5I_INVALID_HID, + arr_type3 = H5I_INVALID_HID, + arr_type4 = H5I_INVALID_HID, + arr_type5 = H5I_INVALID_HID; hsize_t dimsa[3]; hsize_t dimsb[1]; hsize_t dimsc[1]; - hid_t xfer_list; + hid_t xfer_list = H5I_INVALID_HID; size_t size; TESTING("data type conversion buffer size"); @@ -1315,7 +1320,7 @@ test_conv_buffer(hid_t fid) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Library shouldn't allow conversion buffer too small"); + HDputs(" Library shouldn't allow conversion buffer too small"); goto error; } @@ -1340,11 +1345,24 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); - puts(" PASSED"); - return 0; + HDputs(" PASSED"); + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Pclose(xfer_list); + H5Sclose(space); + H5Tclose(arr_type1); + H5Tclose(arr_type2); + H5Tclose(arr_type3); + H5Tclose(ctype1); + H5Tclose(ctype2); + H5Tclose(arr_type4); + H5Tclose(arr_type5); + H5Dclose(dataset); + } H5E_END_TRY; + + return FAIL; } /* end test_conv_buffer() */ @@ -1404,7 +1422,7 @@ test_tconv(hid_t file) in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) { H5_FAILED(); - puts(" Read with byte order conversion failed."); + HDputs(" Read with byte order conversion failed."); goto error; } } @@ -1414,8 +1432,8 @@ test_tconv(hid_t file) HDfree(out); HDfree(in); - puts(" PASSED"); - return 0; + HDputs(" PASSED"); + return SUCCEED; error: if(out) @@ -1428,7 +1446,7 @@ error: H5Sclose(space); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_tconv() */ /* This message derives from H5Z */ @@ -1760,7 +1778,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Check if all the filters are available */ if(H5Pall_filters_avail(dcpl)!=TRUE) { H5_FAILED(); - printf(" Line %d: Incorrect filter availability\n",__LINE__); + HDprintf(" Line %d: Incorrect filter availability\n",__LINE__); goto error; } /* end if */ @@ -1783,8 +1801,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j<(size_t)size[1]; j++) { if(0!=check[i][j]) { H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read a non-zero value.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -1849,10 +1867,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j= 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_get_filter_info() */ /*------------------------------------------------------------------------- @@ -2291,7 +2309,7 @@ H5_ATTR_UNUSED * STEP 0: Test null I/O filter by itself. *---------------------------------------------------------- */ - puts("Testing 'null' filter"); + HDputs("Testing 'null' filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Zregister (H5Z_BOGUS) < 0) goto error; @@ -2306,7 +2324,7 @@ H5_ATTR_UNUSED * STEP 1: Test Fletcher32 Checksum by itself. *---------------------------------------------------------- */ - puts("Testing Fletcher32 checksum(enabled for read)"); + HDputs("Testing Fletcher32 checksum(enabled for read)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_filter(dc, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL) < 0) goto error; @@ -2315,21 +2333,21 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_FLETCHER32_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Disable checksum during read */ - puts("Testing Fletcher32 checksum(disabled for read)"); + HDputs("Testing Fletcher32 checksum(disabled for read)"); if(test_filter_internal(file,DSET_FLETCHER32_NAME_2,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ /* Try to corrupt data and see if checksum fails */ - puts("Testing Fletcher32 checksum(when data is corrupted)"); + HDputs("Testing Fletcher32 checksum(when data is corrupted)"); data_corrupt[0] = 52; data_corrupt[1] = 33; data_corrupt[2] = 27; @@ -2339,7 +2357,7 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_FLETCHER32_NAME_3,dc,DISABLE_FLETCHER32,DATA_CORRUPTED,&fletcher32_size) < 0) goto error; if(fletcher32_size<=null_size) { H5_FAILED(); - puts(" Size after checksumming is incorrect."); + HDputs(" Size after checksumming is incorrect."); goto error; } /* end if */ @@ -2352,7 +2370,7 @@ H5_ATTR_UNUSED *---------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_DEFLATE - puts("Testing deflate filter"); + HDputs("Testing deflate filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_deflate (dc, 6) < 0) goto error; @@ -2363,7 +2381,7 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_DEFLATE */ TESTING("deflate filter"); SKIPPED(); - puts(" Deflate filter not enabled"); + HDputs(" Deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ /*---------------------------------------------------------- @@ -2376,7 +2394,7 @@ H5_ATTR_UNUSED if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; - puts(""); + HDputs(""); if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; if(test_filter_internal(file,DSET_SZIP_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&szip_size) < 0) goto error; if(H5Pclose (dc) < 0) goto error; @@ -2388,7 +2406,7 @@ H5_ATTR_UNUSED TESTING("szip filter (without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); + HDputs(""); if(test_filter_noencoder(NOENCODER_SZIP_DATASET) < 0) goto error; } else { @@ -2398,14 +2416,14 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_SZIP */ TESTING("szip filter"); SKIPPED(); - puts(" Szip filter not enabled"); + HDputs(" Szip filter not enabled"); #endif /* H5_HAVE_FILTER_SZIP */ /*---------------------------------------------------------- * STEP 4: Test shuffling by itself. *---------------------------------------------------------- */ - puts("Testing shuffle filter"); + HDputs("Testing shuffle filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2413,7 +2431,7 @@ H5_ATTR_UNUSED if(test_filter_internal(file,DSET_SHUFFLE_NAME,dc,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&shuffle_size) < 0) goto error; if(shuffle_size!=null_size) { H5_FAILED(); - puts(" Shuffled size not the same as uncompressed size."); + HDputs(" Shuffled size not the same as uncompressed size."); goto error; } /* end if */ @@ -2425,7 +2443,7 @@ H5_ATTR_UNUSED *---------------------------------------------------------- */ #ifdef H5_HAVE_FILTER_DEFLATE - puts("Testing shuffle+deflate+checksum filters(checksum first)"); + HDputs("Testing shuffle+deflate+checksum filters(checksum first)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_fletcher32 (dc) < 0) goto error; @@ -2437,7 +2455,7 @@ H5_ATTR_UNUSED /* Clean up objects used for this test */ if(H5Pclose (dc) < 0) goto error; - puts("Testing shuffle+deflate+checksum filters(checksum last)"); + HDputs("Testing shuffle+deflate+checksum filters(checksum last)"); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2451,7 +2469,7 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_DEFLATE */ TESTING("shuffle+deflate+fletcher32 filters"); SKIPPED(); - puts(" Deflate filter not enabled"); + HDputs(" Deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ /*---------------------------------------------------------- @@ -2468,7 +2486,7 @@ H5_ATTR_UNUSED /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); + HDputs(""); if(H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block) < 0) goto error; if(test_filter_internal(file,DSET_SHUF_SZIP_FLET_NAME,dc,ENABLE_FLETCHER32,DATA_NOT_CORRUPTED,&combo_size) < 0) goto error; } @@ -2479,7 +2497,7 @@ H5_ATTR_UNUSED TESTING("shuffle+szip+checksum filters(checksum first, without encoder)"); if( h5_szip_can_encode() != 1) { - puts(""); + HDputs(""); if(test_filter_noencoder(NOENCODER_SZIP_SHUFF_FLETCH_DATASET) < 0) goto error; } else { @@ -2493,7 +2511,7 @@ H5_ATTR_UNUSED /* Make sure encoding is enabled */ if( h5_szip_can_encode() == 1) { - puts(""); + HDputs(""); if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; if(H5Pset_shuffle (dc) < 0) goto error; @@ -2512,12 +2530,12 @@ H5_ATTR_UNUSED #else /* H5_HAVE_FILTER_SZIP */ TESTING("shuffle+szip+fletcher32 filters"); SKIPPED(); - puts(" szip filter not enabled"); + HDputs(" szip filter not enabled"); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_filters() */ @@ -2526,8 +2544,7 @@ error: * * Purpose: Tests library behavior when filter is missing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -2552,7 +2569,7 @@ test_missing_filter(hid_t file) /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ @@ -2564,31 +2581,31 @@ test_missing_filter(hid_t file) /* (Use private routine, to avoid range checking on filter ID) */ if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ /* Create dcpl with deflate filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Pset_deflate(dcpl, 9) < 0) { H5_FAILED(); - printf(" Line %d: Can't set deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't set deflate filter\n",__LINE__); goto error; } /* end if */ @@ -2596,47 +2613,47 @@ test_missing_filter(hid_t file) ret=H5Pall_filters_avail(dcpl); if(ret<0) { H5_FAILED(); - printf(" Line %d: Can't check filter availability\n",__LINE__); + HDprintf(" Line %d: Can't check filter availability\n",__LINE__); goto error; } /* end if */ if(ret!=FALSE) { H5_FAILED(); - printf(" Line %d: Filter shouldn't be available\n",__LINE__); + HDprintf(" Line %d: Filter shouldn't be available\n",__LINE__); goto error; } /* end if */ /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_MISSING_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if(0 == (dset_size = H5Dget_storage_size(dsid))) { H5_FAILED(); - printf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Error querying dataset size, dset_size=%lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ @@ -2644,14 +2661,14 @@ test_missing_filter(hid_t file) /* (i.e. the deflation filter we asked for was silently ignored) */ if((H5Tget_size(H5T_NATIVE_INT) * DSET_DIM1 * DSET_DIM2) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -2661,10 +2678,10 @@ test_missing_filter(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -2673,21 +2690,21 @@ test_missing_filter(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -2697,14 +2714,14 @@ test_missing_filter(hid_t file) /* Open existing file */ if((fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open existing deflated file\n", __LINE__); + HDprintf(" Line %d: Can't open existing deflated file\n", __LINE__); goto error; } /* end if */ /* Open dataset */ if((dsid = H5Dopen2(fid, "Dataset1", H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ @@ -2714,21 +2731,21 @@ test_missing_filter(hid_t file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Should not be able to read dataset data\n", __LINE__); + HDprintf(" Line %d: Should not be able to read dataset data\n", __LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n", __LINE__); + HDprintf(" Line %d: Can't close dataset\n", __LINE__); goto error; } /* end if */ /* Close existing file */ if(H5Fclose(fid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ @@ -2736,21 +2753,21 @@ test_missing_filter(hid_t file) /* Verify deflate filter is not registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) { H5_FAILED(); - printf(" Line %d: Deflate filter available\n",__LINE__); + HDprintf(" Line %d: Deflate filter available\n",__LINE__); goto error; } /* end if */ #ifdef H5_HAVE_FILTER_DEFLATE /* Register deflate filter (use internal function to avoid range checks) */ if(H5Z_register(H5Z_DEFLATE) < 0) { H5_FAILED(); - printf(" Line %d: Can't unregister deflate filter\n",__LINE__); + HDprintf(" Line %d: Can't unregister deflate filter\n",__LINE__); goto error; } /* end if */ /* Verify deflate filter is registered currently */ if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) { H5_FAILED(); - printf(" Line %d: Deflate filter not available\n",__LINE__); + HDprintf(" Line %d: Deflate filter not available\n",__LINE__); goto error; } /* end if */ #endif /* H5_HAVE_FILTER_DEFLATE */ @@ -2760,13 +2777,13 @@ test_missing_filter(hid_t file) api_ctx_pushed = FALSE; PASSED(); - return 0; + return SUCCEED; error: if(api_ctx_pushed) H5CX_pop(); - return -1; -} + return FAIL; +} /* end test_missing_filter() */ /*------------------------------------------------------------------------- @@ -2837,8 +2854,8 @@ test_onebyte_shuffle(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[i][j] != orig_data[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -2854,10 +2871,10 @@ test_onebyte_shuffle(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_onebyte_shuffle() */ @@ -2883,7 +2900,7 @@ test_nbit_int(hid_t file) double power; size_t i, j; - puts("Testing nbit filter"); + HDputs("Testing nbit filter"); TESTING(" nbit int (setup)"); /* Define dataset datatype (integer), and set precision, offset */ @@ -2953,8 +2970,8 @@ test_nbit_int(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -2972,10 +2989,10 @@ test_nbit_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_int() */ @@ -3068,8 +3085,8 @@ test_nbit_float(hid_t file) continue; /* skip if value is NaN */ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3090,10 +3107,10 @@ test_nbit_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_float() */ @@ -3200,8 +3217,8 @@ test_nbit_double(hid_t file) continue; /* skip if value is NaN */ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3222,10 +3239,10 @@ test_nbit_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_double() */ @@ -3328,8 +3345,8 @@ test_nbit_array(hid_t file) for(n = 0; n < (size_t)adims[1]; n++) { if(new_data[i][j][m][n]!= orig_data[i][j][m][n]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu,%lu,%lu\n", + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu,%lu,%lu\n", (unsigned long)i, (unsigned long)j, (unsigned long)m, (unsigned long)n); goto error; } @@ -3349,10 +3366,10 @@ test_nbit_array(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_array() */ @@ -3534,8 +3551,8 @@ test_nbit_compound(hid_t file) (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f))) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3566,10 +3583,10 @@ test_nbit_compound(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound() */ @@ -3865,8 +3882,8 @@ out: (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) || new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -3911,10 +3928,10 @@ out: PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound_2() */ @@ -4048,8 +4065,8 @@ test_nbit_compound_3(hid_t file) new_data[i].r != orig_data[i].r) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } @@ -4057,8 +4074,8 @@ test_nbit_compound_3(hid_t file) if(((unsigned int *)orig_data[i].v.p)[k] !=((unsigned int *)new_data[i].v.p)[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } @@ -4066,8 +4083,8 @@ test_nbit_compound_3(hid_t file) if(orig_data[i].o[j] != new_data[i].o[j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu\n", (unsigned long)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu\n", (unsigned long)i); goto error; } } @@ -4091,10 +4108,10 @@ test_nbit_compound_3(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_compound_3() */ @@ -4128,41 +4145,41 @@ test_nbit_int_size(hid_t file) /* Define dataset datatype (integer), and set precision, offset */ if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ precision = 16; /* precision includes sign bit */ if(H5Tset_precision(datatype,precision)<0) { H5_FAILED(); - printf(" line %d: H5Pset_precision failed\n",__LINE__); + HDprintf(" line %d: H5Pset_precision failed\n",__LINE__); goto error; } /* end if */ offset = 8; if(H5Tset_offset(datatype,offset)<0) { H5_FAILED(); - printf(" line %d: H5Tset_offset failed\n",__LINE__); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); goto error; } /* end if */ /* Copy to memory datatype */ if((mem_datatype = H5Tcopy(datatype)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ /* Set order of dataset datatype */ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { H5_FAILED(); - printf(" line %d: H5Pset_order failed\n",__LINE__); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_size(datatype, 4)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ @@ -4181,7 +4198,7 @@ test_nbit_int_size(hid_t file) dims[1] = DSET_DIM2; if((dataspace = H5Screate_simple (2, dims, NULL))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ @@ -4192,13 +4209,13 @@ test_nbit_int_size(hid_t file) chunk_size[1] = DSET_DIM2/10; if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { H5_FAILED(); - printf(" line %d: H5Pset_chunk failed\n",__LINE__); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); goto error; } /* end if */ @@ -4207,7 +4224,7 @@ test_nbit_int_size(hid_t file) */ if(H5Pset_nbit (dset_create_props)<0) { H5_FAILED(); - printf(" line %d: H5Pset_nbit failed\n",__LINE__); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); goto error; } /* end if */ @@ -4218,7 +4235,7 @@ test_nbit_int_size(hid_t file) dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); - printf(" line %d: H5dwrite failed\n",__LINE__); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4228,7 +4245,7 @@ test_nbit_int_size(hid_t file) if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { H5_FAILED(); - printf(" Line %d: H5Dwrite failed\n",__LINE__); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4237,7 +4254,7 @@ test_nbit_int_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4259,9 +4276,9 @@ test_nbit_int_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_int_size() */ @@ -4317,7 +4334,7 @@ test_nbit_flt_size(hid_t file) *-------------------------------------------------------------------*/ if((datatype = H5Tcopy(H5T_IEEE_F32LE)) < 0) { H5_FAILED(); - printf(" line %d: H5Tcopy failed\n",__LINE__); + HDprintf(" line %d: H5Tcopy failed\n",__LINE__); goto error; } /* end if */ @@ -4331,38 +4348,38 @@ test_nbit_flt_size(hid_t file) if(H5Tset_fields(datatype, spos, epos, esize, mpos, msize)<0) { H5_FAILED(); - printf(" line %d: H5Tset_fields failed\n",__LINE__); + HDprintf(" line %d: H5Tset_fields failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_offset(datatype,offset)<0) { H5_FAILED(); - printf(" line %d: H5Tset_offset failed\n",__LINE__); + HDprintf(" line %d: H5Tset_offset failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_precision(datatype,precision)<0) { H5_FAILED(); - printf(" line %d: H5Tset_precision failed\n",__LINE__); + HDprintf(" line %d: H5Tset_precision failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_size(datatype, 4)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ /* Set order of dataset datatype */ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) { H5_FAILED(); - printf(" line %d: H5Pset_order failed\n",__LINE__); + HDprintf(" line %d: H5Pset_order failed\n",__LINE__); goto error; } /* end if */ if(H5Tset_ebias(datatype, 31)<0) { H5_FAILED(); - printf(" line %d: H5Pset_size failed\n",__LINE__); + HDprintf(" line %d: H5Pset_size failed\n",__LINE__); goto error; } /* end if */ @@ -4379,7 +4396,7 @@ test_nbit_flt_size(hid_t file) dims[1] = DSET_DIM2; if((dataspace = H5Screate_simple (2, dims, NULL))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ @@ -4390,13 +4407,13 @@ test_nbit_flt_size(hid_t file) chunk_size[1] = DSET_DIM2/10; if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) { H5_FAILED(); - printf(" line %d: H5Pcreate failed\n",__LINE__); + HDprintf(" line %d: H5Pcreate failed\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) { H5_FAILED(); - printf(" line %d: H5Pset_chunk failed\n",__LINE__); + HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__); goto error; } /* end if */ @@ -4405,7 +4422,7 @@ test_nbit_flt_size(hid_t file) */ if(H5Pset_nbit (dset_create_props)<0) { H5_FAILED(); - printf(" line %d: H5Pset_nbit failed\n",__LINE__); + HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__); goto error; } /* end if */ @@ -4416,7 +4433,7 @@ test_nbit_flt_size(hid_t file) dataspace, H5P_DEFAULT, dset_create_props, H5P_DEFAULT))<0) { H5_FAILED(); - printf(" line %d: H5dwrite failed\n",__LINE__); + HDprintf(" line %d: H5dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4426,7 +4443,7 @@ test_nbit_flt_size(hid_t file) if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) { H5_FAILED(); - printf(" Line %d: H5Dwrite failed\n",__LINE__); + HDprintf(" Line %d: H5Dwrite failed\n",__LINE__); goto error; } /* end if */ @@ -4435,7 +4452,7 @@ test_nbit_flt_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); + HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4456,9 +4473,9 @@ test_nbit_flt_size(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_nbit_flt_size() */ /*------------------------------------------------------------------------- @@ -4486,7 +4503,7 @@ test_scaleoffset_int(hid_t file) int new_data[2][5]; size_t i, j; - puts("Testing scaleoffset filter"); + HDputs("Testing scaleoffset filter"); TESTING(" scaleoffset int without fill value (setup)"); datatype = H5Tcopy(H5T_NATIVE_INT); @@ -4549,8 +4566,8 @@ test_scaleoffset_int(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[i][j] != orig_data[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4567,9 +4584,9 @@ test_scaleoffset_int(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_int() */ @@ -4678,8 +4695,8 @@ test_scaleoffset_int_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(new_data[0][j] != orig_data[0][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -4695,9 +4712,9 @@ test_scaleoffset_int_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_int_2() */ @@ -4790,8 +4807,8 @@ test_scaleoffset_float(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4808,9 +4825,9 @@ test_scaleoffset_float(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_float() */ @@ -4921,8 +4938,8 @@ test_scaleoffset_float_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -4937,9 +4954,9 @@ test_scaleoffset_float_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_float_2() */ @@ -5032,8 +5049,8 @@ test_scaleoffset_double(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -5050,9 +5067,9 @@ test_scaleoffset_double(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_double() */ @@ -5163,8 +5180,8 @@ test_scaleoffset_double_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5180,9 +5197,9 @@ test_scaleoffset_double_2(hid_t file) PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_scaleoffset_double_2() */ @@ -5230,7 +5247,7 @@ test_multiopen (hid_t file) if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error; if(cur_size[0] != tmp_size[0]) { H5_FAILED(); - printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); + HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; } /* end if */ @@ -5240,17 +5257,17 @@ test_multiopen (hid_t file) if(H5Pclose(dcpl) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Dclose(dset1); - H5Dclose(dset2); - H5Sclose(space); - H5Pclose(dcpl); + H5Dclose(dset1); + H5Dclose(dset2); + H5Sclose(space); + H5Pclose(dcpl); } H5E_END_TRY; - return -1; -} /* end test_multiopen () */ + return FAIL; +} /* end test_multiopen() */ /*------------------------------------------------------------------------- @@ -5336,7 +5353,7 @@ test_types(hid_t file) /* Cleanup */ if(H5Gclose(grp) < 0) goto error; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5345,7 +5362,7 @@ test_types(hid_t file) H5Sclose(space); H5Dclose(dset); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_types() */ /* This message derives from H5Z */ @@ -5392,30 +5409,30 @@ test_can_apply(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is mandate. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ @@ -5427,7 +5444,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5438,7 +5455,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5446,42 +5463,42 @@ test_can_apply(hid_t file) /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5491,10 +5508,10 @@ test_can_apply(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5503,30 +5520,30 @@ test_can_apply(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply() */ /* This message derives from H5Z */ @@ -5575,72 +5592,72 @@ test_can_apply2(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is optional. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5650,10 +5667,10 @@ test_can_apply2(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5662,30 +5679,30 @@ test_can_apply2(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_can_apply2() */ @@ -5732,19 +5749,19 @@ file) /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5755,7 +5772,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5766,7 +5783,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5774,7 +5791,7 @@ file) szip_pixels_per_block=2; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5786,47 +5803,47 @@ file) } H5E_END_TRY; if(dsid <=0) { H5_FAILED(); - printf(" Line %d: Should have created dataset!\n",__LINE__); + HDprintf(" Line %d: Should have created dataset!\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ /* Create another data space */ if((sid = H5Screate_simple(2, dims2, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5834,7 +5851,7 @@ file) szip_pixels_per_block=32; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5845,7 +5862,7 @@ file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5853,14 +5870,14 @@ file) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5868,17 +5885,17 @@ file) PASSED(); } else { SKIPPED(); - puts(" Szip encoding is not enabled."); + HDputs(" Szip encoding is not enabled."); } #else /* H5_HAVE_FILTER_SZIP */ SKIPPED(); - puts(" Szip filter is not enabled."); + HDputs(" Szip filter is not enabled."); #endif /* H5_HAVE_FILTER_SZIP */ - return 0; + return SUCCEED; #ifdef H5_HAVE_FILTER_SZIP error: - return -1; + return FAIL; #endif /* H5_HAVE_FILTER_SZIP */ } /* end test_can_apply_szip() */ @@ -5938,57 +5955,57 @@ test_set_local(hid_t fapl) /* Open file */ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + HDprintf(" Line %d: Can't open file\n",__LINE__); goto error; } /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'set local' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus2 filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ @@ -5996,77 +6013,77 @@ test_set_local(hid_t fapl) /* (Shouldn't get modified by output filter) */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n", __LINE__); + HDprintf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n", __LINE__); + HDprintf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n", __LINE__); + HDprintf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n", __LINE__); + HDprintf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n", __LINE__); + HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -6076,10 +6093,10 @@ test_set_local(hid_t fapl) for(j=0; j=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6458,7 +6475,7 @@ test_filter_delete(hid_t file) } H5E_END_TRY; if(ret >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6490,7 +6507,7 @@ test_filter_delete(hid_t file) #else SKIPPED(); #endif - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6499,7 +6516,7 @@ error: H5Dclose(dsid); H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filter_delete() */ @@ -6556,7 +6573,7 @@ auxread_fdata(hid_t fid, const char *name) if(nelmts) { buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); goto error; } if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -6572,7 +6589,7 @@ auxread_fdata(hid_t fid, const char *name) if(buf) HDfree(buf); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6584,7 +6601,7 @@ error: if(buf) HDfree(buf); } H5E_END_TRY; - return -1; + return FAIL; } /* end auxread_fdata() */ @@ -6645,7 +6662,7 @@ test_filters_endianess(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6654,7 +6671,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_filters_endianess() */ @@ -6804,7 +6821,7 @@ test_zero_dims(hid_t file) if(H5Sclose(s2) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6818,7 +6835,7 @@ error: H5Dclose(d2); H5Sclose(s2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dims() */ @@ -6955,13 +6972,13 @@ test_missing_chunk(hid_t file) for(u=0; u=5) { if(rdata[u]!=911) { - printf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata[u]!=wdata[u]) { - printf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end else */ @@ -6973,14 +6990,14 @@ test_missing_chunk(hid_t file) if((i % 10) >= 5 || (j % 10) >= 5) { if(rdata2[i][j] != 911) { - printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata2[i][j] != wdata2[i][j]) { - printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ @@ -6997,7 +7014,7 @@ test_missing_chunk(hid_t file) if(H5Dclose(did2) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7010,7 +7027,7 @@ error: H5Sclose(s); H5Sclose(sid2); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_missing_chunk() */ @@ -7144,8 +7161,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - printf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); TEST_ERROR; } /* end if */ @@ -7251,7 +7268,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7357,7 +7374,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7368,7 +7385,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7378,7 +7395,7 @@ error: H5Dclose(d); H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_random_chunks_real() */ @@ -7498,7 +7515,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -7519,7 +7536,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -7568,7 +7585,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -7620,15 +7637,15 @@ test_deprec(hid_t file) if(H5Zregister(H5Z_DEPREC) < 0) goto error; if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; - puts(""); + HDputs(""); if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -7732,7 +7749,7 @@ test_huge_chunks(hid_t fapl) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7741,7 +7758,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_huge_chunks() */ @@ -7936,7 +7953,7 @@ test_chunk_cache(hid_t fapl) if (H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7949,7 +7966,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_cache() */ @@ -8120,15 +8137,15 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the first 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata1[i] != i) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); TEST_ERROR } /* end if */ for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(rdata1[j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); TEST_ERROR } /* end if */ @@ -8136,8 +8153,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata1[i][j] != j) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], j); TEST_ERROR } /* end if */ @@ -8145,8 +8162,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8192,8 +8209,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the second 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata2[i] != i) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); TEST_ERROR } /* end if */ @@ -8201,8 +8218,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata2[i][j] != j) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", __LINE__, i, j, t_rdata2[i][j], j); TEST_ERROR } /* end if */ @@ -8223,7 +8240,7 @@ test_big_chunks_bypass_cache(hid_t fapl) HDfree(rdata2); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8242,7 +8259,7 @@ error: HDfree(rdata1); if(rdata2) HDfree(rdata2); - return -1; + return FAIL; } /* end test_big_chunks_bypass_cache() */ @@ -8310,10 +8327,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over using SWMR access to write */ for(swmr = 0; swmr <= 1; swmr++) { - int compress; /* Whether chunks should be compressed */ + int compress; /* Whether chunks should be compressed */ /* SWMR is now supported with/without latest format: */ - /* (1) write+latest-format (2) SWMR-write+non-latest-format */ + /* (1) write+latest-format (2) SWMR-write+non-latest-format */ /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. @@ -8325,10 +8342,10 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Loop over compressing chunks */ for(compress = 0; compress <= 1; compress++) #else - /* Loop over without compression */ + /* Loop over without compression */ for(compress = 0; compress <= 0; compress++) #endif /* H5_HAVE_FILTER_DEFLATE */ - { + { H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ @@ -8578,7 +8595,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) if(H5Pclose(my_fapl) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8589,7 +8606,7 @@ error: H5Fclose(fid); H5Pclose(my_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast() */ @@ -8702,7 +8719,7 @@ test_reopen_chunk_fast(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8712,7 +8729,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_reopen_chunk_fast() */ @@ -8811,7 +8828,7 @@ test_chunk_fast_bug1(hid_t fapl) if(H5Sclose(sid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8820,7 +8837,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_fast_bug1() */ /* This message derives from H5Z */ @@ -8931,7 +8948,7 @@ test_chunk_expand(hid_t fapl) if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) { SKIPPED(); - puts(" Current machine can't test for error w/old file format"); + HDputs(" Current machine can't test for error w/old file format"); } /* end if */ else { /* Register "expansion" filter */ @@ -9266,7 +9283,7 @@ test_chunk_expand(hid_t fapl) PASSED(); } /* end else */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9279,7 +9296,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_chunk_expand() */ @@ -9594,7 +9611,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9622,7 +9639,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9648,7 +9665,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS_BIG; i++) if(rbuf_big[i] != wbuf_big[i]) { - printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); TEST_ERROR; } /* end if */ @@ -9684,7 +9701,7 @@ test_fixed_array(hid_t fapl) HDfree(rbuf_big); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9698,7 +9715,7 @@ error: HDfree(wbuf_big); if(rbuf_big) HDfree(rbuf_big); - return -1; + return FAIL; } /* end test_fixed_array() */ @@ -9887,7 +9904,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9906,7 +9923,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) if(t_rbuf[i] != t_wbuf[i]) { - printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); TEST_ERROR; } /* end if */ @@ -9942,7 +9959,7 @@ test_single_chunk(hid_t fapl) HDfree(t_rbuf); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -9962,7 +9979,7 @@ error: HDfree(t_wbuf); if(t_rbuf) HDfree(t_rbuf); - return -1; + return FAIL; } /* end test_single_chunk() */ @@ -10028,14 +10045,14 @@ test_idx_compatible(void) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_idx_compatible() */ /*------------------------------------------------------------------------- @@ -10166,7 +10183,7 @@ test_unfiltered_edge_chunks(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10175,7 +10192,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_unfiltered_edge_chunks() */ @@ -10280,7 +10297,7 @@ test_large_chunk_shrink(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10290,7 +10307,7 @@ error: H5Sclose(scalar_sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_large_chunk_shrink() */ @@ -10374,7 +10391,7 @@ test_zero_dim_dset(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10383,7 +10400,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_zero_dim_dset() */ @@ -10424,8 +10441,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } /* Check if we are using the latest version of the format */ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) @@ -10437,7 +10454,8 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Create file with write+latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - } else { + } + else { /* Create file with SWMR-write+non-latest-format */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -10622,7 +10640,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10632,7 +10650,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_swmr_non_latest() */ @@ -10673,8 +10691,8 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10740,7 +10758,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10752,7 +10770,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_earray_hdr_fd() */ @@ -10793,8 +10811,8 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10860,7 +10878,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10872,7 +10890,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_farray_hdr_fd() */ @@ -10913,8 +10931,8 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) if(!H5FD_supports_swmr_test(env_h5_driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); - return 0; - } /* end if */ + return SUCCEED; + } if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; @@ -10980,7 +10998,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10992,7 +11010,7 @@ error: H5Sclose(sid); H5Sclose(msid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_bt2_hdr_fd() */ @@ -11376,7 +11394,7 @@ test_storage_size(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11386,7 +11404,7 @@ error: H5Sclose(sid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_storage_size() */ @@ -11467,7 +11485,7 @@ test_power2up(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11477,7 +11495,7 @@ error: H5Pclose(dcpl); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_power2up() */ @@ -11507,7 +11525,7 @@ typedef struct scatter_info_t { for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \ if(ARR[i][j][k] != EXP[i][j][k]) { \ H5_FAILED(); AT(); \ - printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ + HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ goto error; \ } @@ -11789,13 +11807,13 @@ test_scatter(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter() */ @@ -11857,7 +11875,7 @@ gather_cb(const void *dst_buf, size_t dst_buf_bytes_used, error: return FAIL; -} +} /* end gather_cb() */ static herr_t test_gather(void) @@ -12151,13 +12169,13 @@ test_gather(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather() */ @@ -12220,7 +12238,7 @@ scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out* *src_buf_bytes_used = *(size_t *)_src_buf_bytes_used; return SUCCEED; -} /* end scatter_error_cb_unalign() */ +} /* endscatter_error_cb_unalign() */ static herr_t test_scatter_error(void) @@ -12354,13 +12372,13 @@ test_scatter_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_scatter_error() */ @@ -12493,13 +12511,13 @@ test_gather_error(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_gather_error() */ /*------------------------------------------------------------------------- @@ -12598,7 +12616,6 @@ static herr_t dls_01_main( void ); static herr_t dls_01_setup_file( hid_t fid ) { - int status = 0; hid_t sid = 0, did = 0, tid = 0, dcpl = 0; int ndims = 1; @@ -12636,18 +12653,15 @@ dls_01_setup_file( hid_t fid ) status = H5Sclose( sid ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_setup_file() */ static herr_t dls_01_write_data( hid_t fid, char* buffer ) { - int status = 0; hid_t did = 0, tid = 0; hsize_t extent[1] = {4}; @@ -12673,18 +12687,15 @@ dls_01_write_data( hid_t fid, char* buffer ) status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_write_data() */ static herr_t dls_01_read_stuff( hid_t fid ) { - int status = 0; hid_t did = 0; H5O_info_t info; @@ -12698,18 +12709,15 @@ dls_01_read_stuff( hid_t fid ) status = H5Dclose( did ); if ( status != 0 ) TEST_ERROR - return 0; + return SUCCEED; error: - - return -1; - + return FAIL; } /* end dls_01_read_stuff() */ static herr_t dls_01_main( void ) { - char filename[512]; int status = 0; hid_t fapl = 0, fid = 0; @@ -12766,14 +12774,11 @@ dls_01_main( void ) PASSED(); - return 0; + return SUCCEED; error: - if ( buffer ) HDfree(buffer); - - return -1; - + return FAIL; } /* end dls_01_main() */ /*------------------------------------------------------------------------- @@ -12882,7 +12887,7 @@ test_compact_open_close_dirty(hid_t fapl) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12891,7 +12896,7 @@ error: H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end test_compact_open_close_dirty() */ @@ -13119,25 +13124,25 @@ test_object_header_minimization_dcpl(hid_t fapl_id) ret = H5Pget_dset_no_attrs_hint(-1, &minimize); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, FALSE); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pset_dset_no_attrs_hint(-1, TRUE); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* Invalid DCPL ID should fail */ H5E_BEGIN_TRY { ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL); } H5E_END_TRY; if (ret == SUCCEED) - TEST_ERROR + TEST_ERROR /* NULL out pointer should fail */ /************/ /* TEARDOWN */ @@ -13249,20 +13254,20 @@ main(void) my_fapl = fapl2; if(paged) { my_fcpl = fcpl2; - puts("\nTesting with new file format and paged aggregation"); + HDputs("\nTesting with new file format and paged aggregation"); } else { my_fcpl = fcpl; - puts("\nTesting with new file format and non-paged aggregation"); + HDputs("\nTesting with new file format and non-paged aggregation"); } } /* end if */ else { my_fapl = fapl; if(paged) { my_fcpl = fcpl2; - puts("Testing with old file format and paged aggregation:"); + HDputs("Testing with old file format and paged aggregation:"); } else { my_fcpl = fcpl; - puts("Testing with old file format and non-paged aggregation:"); + HDputs("Testing with old file format and non-paged aggregation:"); } } /* end else */ @@ -13273,7 +13278,7 @@ main(void) if (TRUE == minimized_ohdr) { if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) goto error; - puts("(minimized dataset object headers with file setting)"); + HDputs("(minimized dataset object headers with file setting)"); } /* Cause the library to emit initial messages */ @@ -13380,7 +13385,7 @@ main(void) if(nerrors) goto error; - printf("All dataset tests passed.\n"); + HDprintf("All dataset tests passed.\n"); #ifdef H5_HAVE_FILTER_SZIP if (GetTestCleanup()) HDremove(NOENCODER_COPY_FILENAME); @@ -13391,7 +13396,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2729ba1..7e1adf5 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -21,7 +21,7 @@ #include "h5test.h" /* Number of elements in each random test */ -#define NTESTELEM 10000 +#define NTESTELEM 10000 /* Epsilon for floating-point comparisons */ #define FP_EPSILON 0.000001F @@ -30,7 +30,7 @@ * Offset from alinged memory returned by malloc(). This can be used to test * that type conversions handle non-aligned buffers correctly. */ -#define ALIGNMENT 1 +#define ALIGNMENT 1 /* * Define if you want to test alignment code on a machine that doesn't @@ -41,7 +41,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_FRIEND /*suppress error about including H5Tpkg */ +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -58,7 +58,7 @@ const char *FILENAME[] = { * endian. If local variable `endian' is H5T_ORDER_BE then the result will * be I, otherwise the result will be Z-(I+1). */ -#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) +#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) typedef enum dtype_t { INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT, @@ -100,8 +100,8 @@ static int skip_overflow_tests_g = 0; static int without_hardware_g = 0; /* Allocates memory aligned on a certain boundary. */ -#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) -#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) +#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) +#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) /* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test. * This algorithm is mainly to avoid any casting and comparison between source and destination types @@ -394,13 +394,13 @@ static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize); /*------------------------------------------------------------------------- - * Function: fpe_handler + * Function: fpe_handler * - * Purpose: Exit with 255 + * Purpose: Exit with 255 * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 6, 1998 * * Modifications: @@ -419,16 +419,16 @@ fpe_handler(int H5_ATTR_UNUSED signo) HDexit(255); } - + /*------------------------------------------------------------------------- - * Function: reset_hdf5 + * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -461,19 +461,19 @@ reset_hdf5(void) } - + /*------------------------------------------------------------------------- - * Function: except_func + * Function: except_func * - * Purpose: Gets called for all data type conversion exceptions. + * Purpose: Gets called for all data type conversion exceptions. * - * Return: H5T_CONV_ABORT: -1 + * Return: H5T_CONV_ABORT: -1 * * H5T_CONV_UNHANDLED 0 * * H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April 19, 2004 * * Modifications: @@ -482,7 +482,7 @@ reset_hdf5(void) */ static H5T_conv_ret_t except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { H5T_conv_ret_t ret = H5T_CONV_HANDLED; @@ -509,19 +509,19 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return ret; } - + /*------------------------------------------------------------------------- - * Function: some_dummy_func + * Function: some_dummy_func * - * Purpose: A dummy function to help check for overflow. + * Purpose: A dummy function to help check for overflow. * - * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT - * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW - * CHECKING. + * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT + * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW + * CHECKING. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * *------------------------------------------------------------------------- @@ -529,21 +529,21 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 void some_dummy_func(float x) { - char s[128]; + char s[128]; HDsnprintf(s, sizeof(s), "%g", (double)x); } - + /*------------------------------------------------------------------------- - * Function: generates_sigfpe + * Function: generates_sigfpe * - * Purpose: Determines if SIGFPE is generated from overflows. We must be - * able to fork() and waitpid() in order for this test to work - * properly. Sets skip_overflow_tests_g to non-zero if they - * would generate SIGBUS, zero otherwise. + * Purpose: Determines if SIGFPE is generated from overflows. We must be + * able to fork() and waitpid() in order for this test to work + * properly. Sets skip_overflow_tests_g to non-zero if they + * would generate SIGBUS, zero otherwise. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * * Modifications: @@ -554,38 +554,38 @@ static void generates_sigfpe(void) { #if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) - pid_t pid; - int status; - size_t i, j; - double d; + pid_t pid; + int status; + size_t i, j; + double d; unsigned char *dp = (unsigned char*)&d; - float f; + float f; HDfflush(stdout); HDfflush(stderr); if ((pid=fork()) < 0) { - HDperror("fork"); - HDexit(EXIT_FAILURE); + HDperror("fork"); + HDexit(EXIT_FAILURE); } else if (0==pid) { - for (i=0; i<2000; i++) { - for(j = 0; j < sizeof(double); j++) + for (i=0; i<2000; i++) { + for(j = 0; j < sizeof(double); j++) dp[j] = (unsigned char)HDrand(); - f = (float)d; - some_dummy_func((float)f); - } - HDexit(EXIT_SUCCESS); + f = (float)d; + some_dummy_func((float)f); + } + HDexit(EXIT_SUCCESS); } while (pid!=waitpid(pid, &status, 0)) /*void*/; if (WIFEXITED(status) && 0==WEXITSTATUS(status)) { - HDputs("Floating-point overflow cases will be tested."); - skip_overflow_tests_g = FALSE; + HDputs("Floating-point overflow cases will be tested."); + skip_overflow_tests_g = FALSE; } else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) { - HDputs("Floating-point overflow cases cannot be safely tested."); - skip_overflow_tests_g = TRUE; - /* delete the core dump file that SIGFPE may have created */ - HDunlink("core"); + HDputs("Floating-point overflow cases cannot be safely tested."); + skip_overflow_tests_g = TRUE; + /* delete the core dump file that SIGFPE may have created */ + HDunlink("core"); } #else HDputs("Cannot determine if floating-point overflows generate a SIGFPE;"); @@ -595,7 +595,7 @@ generates_sigfpe(void) #endif } - + /*------------------------------------------------------------------------- * Function: test_hard_query * @@ -621,25 +621,25 @@ test_hard_query(void) /* Verify the conversion from int to float is a hard conversion. */ if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } /* Unregister the hard conversion from int to float. Verify the conversion * is a soft conversion. */ - H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } /* Register the hard conversion from int to float. Verify the conversion * is a hard conversion. */ - H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T__conv_int_float); + H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } @@ -660,16 +660,16 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: expt_handle + * Function: expt_handle * - * Purpose: Gets called from test_particular_fp_integer() for data type + * Purpose: Gets called from test_particular_fp_integer() for data type * conversion exceptions. * - * Return: H5T_CONV_HANDLED 1 + * Return: H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Sept 7, 2005 * * Modifications: @@ -678,7 +678,7 @@ error: */ static H5T_conv_ret_t expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { signed char fill_value1 = 7; int fill_value2 = 13; @@ -694,7 +694,7 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return H5T_CONV_HANDLED; } - + /*------------------------------------------------------------------------- * Function: test_particular_fp_integer * @@ -714,12 +714,6 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 * Return: Success: 0 * * Failure: number of errors - * - * Programmer: Raymond Lu - * Sept 7, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_particular_fp_integer(void) @@ -735,7 +729,7 @@ static int test_particular_fp_integer(void) float src_f = (float)INT_MAX; int dst_i; int fill_value = 13; - int endian; /*endianess */ + int endian; /*endianess */ unsigned int fails_this_test = 0; size_t j; @@ -743,7 +737,7 @@ static int test_particular_fp_integer(void) if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } @@ -754,25 +748,25 @@ static int test_particular_fp_integer(void) buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); - memcpy(buf1, &src_d, src_size1); - memcpy(saved_buf1, &src_d, src_size1); + HDmemcpy(buf1, &src_d, src_size1); + HDmemcpy(saved_buf1, &src_d, src_size1); /* Register exception handling function and signal the destination is "signed char". */ flag = 1; if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) { H5_FAILED(); - printf("Can't register conversion callback\n"); + HDprintf("Can't register conversion callback\n"); goto error; } /* Do conversion */ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } - memcpy(&dst_c, buf1, dst_size1); + HDmemcpy(&dst_c, buf1, dst_size1); /* Print errors */ if(dst_c != SCHAR_MAX) { @@ -782,20 +776,20 @@ static int test_particular_fp_integer(void) if(0 == fails_this_test++) H5_FAILED(); - printf(" test double to signed char:\n"); - printf(" src = "); + HDprintf(" test double to signed char:\n"); + HDprintf(" src = "); for (j=0; j derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1127,43 +1121,43 @@ test_derived_flt(void) *--------------------------------------------------------------------------*/ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) { H5_FAILED(); - printf("Can't set fields\n"); + HDprintf("Can't set fields\n"); goto error; } if(H5Tset_offset(tid2, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_precision(tid2, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision 2\n"); + HDprintf("Can't set precision 2\n"); goto error; } if(H5Tset_size(tid2, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_ebias(tid2, (size_t)63) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) { H5_FAILED(); - printf("Can't set padding\n"); + HDprintf("Can't set padding\n"); goto error; } if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't set inpad\n"); + HDprintf("Can't set inpad\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1171,33 +1165,33 @@ test_derived_flt(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) { H5_FAILED(); - printf("Can't get fields\n"); + HDprintf("Can't get fields\n"); goto error; } if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) { H5_FAILED(); - printf("Wrong field values\n"); + HDprintf("Wrong field values\n"); goto error; } if(H5Tget_precision(tid2) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2)!=0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if((size = H5Tget_size(tid2))!=3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_ebias(tid2)!=63) { H5_FAILED(); - printf("Can't get exponent bias or wrong bias\n"); + HDprintf("Can't get exponent bias or wrong bias\n"); goto error; } @@ -1221,13 +1215,13 @@ test_derived_flt(void) * the precision and exponent power. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 1st back to the 2nd derived floating-point type. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1249,22 +1243,22 @@ test_derived_flt(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1277,25 +1271,25 @@ test_derived_flt(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1304,7 +1298,7 @@ test_derived_flt(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1328,7 +1322,7 @@ test_derived_flt(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- * Function: test_derived_integer * @@ -1353,11 +1347,11 @@ test_derived_integer(void) char filename[1024]; size_t src_size, dst_size; unsigned char *buf=NULL, *saved_buf=NULL; - int endian; /*endianess */ + int endian; /*endianess */ size_t nelmts = NTESTELEM; unsigned int fails_this_test = 0; - const size_t max_fails=40; /*max number of failures*/ - char str[256]; /*message string */ + const size_t max_fails=40; /*max number of failures*/ + char str[256]; /*message string */ unsigned int i, j; TESTING("user-define and query functions of integer types"); @@ -1366,25 +1360,25 @@ test_derived_integer(void) h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf("Can't create file\n"); + HDprintf("Can't create file\n"); goto error; } if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } @@ -1402,37 +1396,37 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_offset(tid1, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_size(tid1, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_precision(tid1, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) { H5_FAILED(); - printf("Can't set order\n"); + HDprintf("Can't set order\n"); goto error; } if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1440,22 +1434,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid1) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid1) != 0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid1) != 3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_order(tid1)!=H5T_ORDER_BE) { H5_FAILED(); - printf("Can't get order or wrong order\n"); + HDprintf("Can't get order or wrong order\n"); goto error; } @@ -1469,31 +1463,31 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_precision(tid2, (size_t)48) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_offset(tid2, (size_t)10) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_sign(tid2, H5T_SGN_2) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1501,22 +1495,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid2) != 48) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2) != 10) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid2) != 8) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_sign(tid2)!=H5T_SGN_2) { H5_FAILED(); - printf("Can't get sign or wrong sign\n"); + HDprintf("Can't get sign or wrong sign\n"); goto error; } @@ -1540,13 +1534,13 @@ test_derived_integer(void) * the 1st type's precision. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 2nd back to the 1st derived integer type. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1560,22 +1554,22 @@ test_derived_integer(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1585,25 +1579,25 @@ test_derived_integer(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1615,7 +1609,7 @@ test_derived_integer(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1638,24 +1632,24 @@ test_derived_integer(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- - * Function: test_conv_int_1 + * Function: test_conv_int_1 * - * Purpose: Test conversion of integer values from SRC to DST. - * These types should be any combination of: + * Purpose: Test conversion of integer values from SRC to DST. + * These types should be any combination of: * - * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR - * H5T_NATIVE_SHORT H5T_NATIVE_USHORT - * H5T_NATIVE_INT H5T_NATIVE_UINT - * H5T_NATIVE_LONG H5T_NATIVE_ULONG - * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG + * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR + * H5T_NATIVE_SHORT H5T_NATIVE_USHORT + * H5T_NATIVE_INT H5T_NATIVE_UINT + * H5T_NATIVE_LONG H5T_NATIVE_ULONG + * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -1665,121 +1659,121 @@ test_derived_integer(void) static int test_conv_int_1(const char *name, hid_t src, hid_t dst) { - size_t nelmts=0; /*num values per test */ - const size_t max_fails=8; /*max number of failures*/ - size_t fails_all_tests=0; /*number of failures */ - size_t fails_this_test; /*fails for this test */ - char str[256]; /*hello string */ - dtype_t src_type, dst_type; /*data types */ - const char *src_type_name=NULL; /*source type name */ - const char *dst_type_name=NULL; /*destination type name */ - int endian; /*machine endianess */ - size_t src_size, dst_size; /*type sizes */ - unsigned char *buf=NULL; /*buffer for conversion */ - unsigned char *saved=NULL; /*original values */ - size_t j, k; /*counters */ - unsigned char *hw=NULL; /*hardware conv result */ - unsigned char src_bits[32]; /*src value in LE order */ - unsigned char dst_bits[32]; /*dest value in LE order*/ - size_t src_nbits; /*source length in bits */ - size_t dst_nbits; /*dst length in bits */ + size_t nelmts=0; /*num values per test */ + const size_t max_fails=8; /*max number of failures*/ + size_t fails_all_tests=0; /*number of failures */ + size_t fails_this_test; /*fails for this test */ + char str[256]; /*hello string */ + dtype_t src_type, dst_type; /*data types */ + const char *src_type_name=NULL; /*source type name */ + const char *dst_type_name=NULL; /*destination type name */ + int endian; /*machine endianess */ + size_t src_size, dst_size; /*type sizes */ + unsigned char *buf=NULL; /*buffer for conversion */ + unsigned char *saved=NULL; /*original values */ + size_t j, k; /*counters */ + unsigned char *hw=NULL; /*hardware conv result */ + unsigned char src_bits[32]; /*src value in LE order */ + unsigned char dst_bits[32]; /*dest value in LE order*/ + size_t src_nbits; /*source length in bits */ + size_t dst_nbits; /*dst length in bits */ H5T_sign_t src_sign; /*source sign type */ H5T_sign_t dst_sign; /*dst sign type */ - void *aligned=NULL; /*aligned temp buffer */ - signed char hw_char; - unsigned char hw_uchar; - short hw_short; - unsigned short hw_ushort; - int hw_int; - unsigned hw_uint; - long hw_long; - unsigned long hw_ulong; - long long hw_llong; - unsigned long long hw_ullong; + void *aligned=NULL; /*aligned temp buffer */ + signed char hw_char; + unsigned char hw_uchar; + short hw_short; + unsigned short hw_ushort; + int hw_int; + unsigned hw_uint; + long hw_long; + unsigned long hw_ulong; + long long hw_llong; + unsigned long long hw_ullong; /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_SCHAR)) { - src_type_name = "signed char"; - src_type = INT_SCHAR; + src_type_name = "signed char"; + src_type = INT_SCHAR; } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) { - src_type_name = "unsigned char"; - src_type = INT_UCHAR; + src_type_name = "unsigned char"; + src_type = INT_UCHAR; } else if (H5Tequal(src, H5T_NATIVE_SHORT)) { - src_type_name = "short"; - src_type = INT_SHORT; + src_type_name = "short"; + src_type = INT_SHORT; } else if (H5Tequal(src, H5T_NATIVE_USHORT)) { - src_type_name = "unsigned short"; - src_type = INT_USHORT; + src_type_name = "unsigned short"; + src_type = INT_USHORT; } else if (H5Tequal(src, H5T_NATIVE_INT)) { - src_type_name = "int"; - src_type = INT_INT; + src_type_name = "int"; + src_type = INT_INT; } else if (H5Tequal(src, H5T_NATIVE_UINT)) { - src_type_name = "unsigned int"; - src_type = INT_UINT; + src_type_name = "unsigned int"; + src_type = INT_UINT; } else if (H5Tequal(src, H5T_NATIVE_LONG)) { - src_type_name = "long"; - src_type = INT_LONG; + src_type_name = "long"; + src_type = INT_LONG; } else if (H5Tequal(src, H5T_NATIVE_ULONG)) { - src_type_name = "unsigned long"; - src_type = INT_ULONG; + src_type_name = "unsigned long"; + src_type = INT_ULONG; } else if (H5Tequal(src, H5T_NATIVE_LLONG)) { - src_type_name = "long long"; - src_type = INT_LLONG; + src_type_name = "long long"; + src_type = INT_LLONG; } else if (H5Tequal(src, H5T_NATIVE_ULLONG)) { - src_type_name = "unsigned long long"; - src_type = INT_ULLONG; + src_type_name = "unsigned long long"; + src_type = INT_ULLONG; } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_SCHAR)) { - dst_type_name = "signed char"; - dst_type = INT_SCHAR; + dst_type_name = "signed char"; + dst_type = INT_SCHAR; } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) { - dst_type_name = "unsigned char"; - dst_type = INT_UCHAR; + dst_type_name = "unsigned char"; + dst_type = INT_UCHAR; } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) { - dst_type_name = "short"; - dst_type = INT_SHORT; + dst_type_name = "short"; + dst_type = INT_SHORT; } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) { - dst_type_name = "unsigned short"; - dst_type = INT_USHORT; + dst_type_name = "unsigned short"; + dst_type = INT_USHORT; } else if (H5Tequal(dst, H5T_NATIVE_INT)) { - dst_type_name = "int"; - dst_type = INT_INT; + dst_type_name = "int"; + dst_type = INT_INT; } else if (H5Tequal(dst, H5T_NATIVE_UINT)) { - dst_type_name = "unsigned int"; - dst_type = INT_UINT; + dst_type_name = "unsigned int"; + dst_type = INT_UINT; } else if (H5Tequal(dst, H5T_NATIVE_LONG)) { - dst_type_name = "long"; - dst_type = INT_LONG; + dst_type_name = "long"; + dst_type = INT_LONG; } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) { - dst_type_name = "unsigned long"; - dst_type = INT_ULONG; + dst_type_name = "unsigned long"; + dst_type = INT_ULONG; } else if (H5Tequal(dst, H5T_NATIVE_LLONG)) { - dst_type_name = "long long"; - dst_type = INT_LLONG; + dst_type_name = "long long"; + dst_type = INT_LLONG; } else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) { - dst_type_name = "unsigned long long"; - dst_type = INT_ULLONG; + dst_type_name = "unsigned long long"; + dst_type = INT_ULLONG; } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ if (OTHER==src_type || OTHER==dst_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -2462,44 +2456,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /* Print errors */ if (0==fails_this_test++) H5_FAILED(); - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k0) { - while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; - if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { - return 0; /*child exit after catching SIGFPE*/ - } else if (WIFEXITED(status)) { - return WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { - HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); - HDputs(str); - return 1; /*child exit after catching non-SIGFPE signal */ - } else { - HDputs(" Child didn't exit normally."); - return 1; - } + while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; + if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { + return 0; /*child exit after catching SIGFPE*/ + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); + HDputs(str); + return 1; /*child exit after catching non-SIGFPE signal */ + } else { + HDputs(" Child didn't exit normally."); + return 1; + } } #endif @@ -2916,35 +2910,35 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_FLOAT)) { - src_type_name = "float"; - src_type = FLT_FLOAT; + src_type_name = "float"; + src_type = FLT_FLOAT; } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) { - src_type_name = "double"; - src_type = FLT_DOUBLE; + src_type_name = "double"; + src_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) { - src_type_name = "long double"; - src_type = FLT_LDOUBLE; + src_type_name = "long double"; + src_type = FLT_LDOUBLE; #endif } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_FLOAT)) { - dst_type_name = "float"; - dst_type = FLT_FLOAT; + dst_type_name = "float"; + dst_type = FLT_FLOAT; } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) { - dst_type_name = "double"; - dst_type = FLT_DOUBLE; + dst_type_name = "double"; + dst_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) { - dst_type_name = "long double"; - dst_type = FLT_LDOUBLE; + dst_type_name = "long double"; + dst_type = FLT_LDOUBLE; #endif } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ @@ -2952,22 +2946,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER==src_type || OTHER==dst_type) { if(!strcmp(name, "noop")) - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_SPECIAL) - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", + name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { if(!strcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", @@ -2982,7 +2976,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test = 0; } @@ -3199,18 +3193,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) * the SGI compiler assigns the dst's maximal value. */ { - double check_mant[2]; - int check_expo[2]; + double check_mant[2]; + int check_expo[2]; if (FLT_FLOAT==dst_type) { float x; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { @@ -3218,10 +3212,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexp(x, check_expo+0); check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) @@ -3264,20 +3258,20 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src ="); + HDprintf(" src ="); for (k=0; k %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3566,12 +3560,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && FLT_LDOUBLE!=dst_type #endif )) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 1. Not an integer-float conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 1. Not an integer-float conversion."); + goto error; } if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type @@ -3583,12 +3577,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type && INT_ULLONG!=dst_type)) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 2. Not a float-integer conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 2. Not a float-integer conversion."); + goto error; } if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3597,7 +3591,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) INT_ULLONG==src_type) { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } else { @@ -3610,7 +3604,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) else HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -4347,44 +4341,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u: \n", (unsigned)j); + HDprintf(" elmt %u: \n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k %s conversions", name, "long double", "float"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4915,11 +4909,11 @@ run_fp_tests(const char *name) nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "float or double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4934,15 +4928,15 @@ done: return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_int_fp_conv + * Function: run_int_fp_conv * - * Purpose: Runs all integer-float tests. + * Purpose: Runs all integer-float tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -4952,7 +4946,7 @@ done: static int run_int_fp_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE); @@ -5001,11 +4995,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5020,11 +5014,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler error in handling conversion."); } @@ -5033,11 +5027,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler not handling conversion."); } @@ -5048,15 +5042,15 @@ run_int_fp_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_fp_int_conv + * Function: run_fp_int_conv * - * Purpose: Runs all float-integer tests. + * Purpose: Runs all float-integer tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -5066,7 +5060,7 @@ run_int_fp_conv(const char *name) static int run_fp_int_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; int test_values; for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) { @@ -5111,7 +5105,7 @@ run_fp_int_conv(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE if(test_values != TEST_SPECIAL) { - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); @@ -5119,18 +5113,18 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); } else { #ifndef H5_DISABLE_SOME_LDOUBLE_CONV - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); #else - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "signed and unsigned char, short, int, long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -5152,11 +5146,11 @@ run_fp_int_conv(const char *name) } #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "(unsigned) long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5172,11 +5166,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5189,11 +5183,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "unsigned long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5209,7 +5203,7 @@ run_fp_int_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- * Function: main * @@ -5233,7 +5227,7 @@ run_fp_int_conv(const char *name) int main(void) { - unsigned long nerrors = 0; + unsigned long nerrors = 0; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -5241,7 +5235,7 @@ main(void) reset_hdf5(); if (ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ @@ -5310,11 +5304,11 @@ main(void) h5_restore_err(); if (nerrors) { - printf("***** %lu FAILURE%s! *****\n", + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } - printf("All data type tests passed.\n"); + HDprintf("All data type tests passed.\n"); return 0; } diff --git a/test/dtypes.c b/test/dtypes.c index 3253d6c..e14ec5c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -716,7 +716,7 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -754,8 +754,8 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -847,7 +847,7 @@ test_compound_3(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = i*8+1; s_ptr->c[0] = i*8+2; @@ -884,8 +884,8 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->c[0] != d_ptr->c[0] || s_ptr->c[1] != d_ptr->c[1] || @@ -978,7 +978,7 @@ test_compound_4(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->a = i*8+0; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->c[0] = i*8+2; @@ -1017,8 +1017,8 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->a != d_ptr->a || s_ptr->b != d_ptr->b || s_ptr->c[0] != d_ptr->c[0] || @@ -1215,7 +1215,7 @@ test_compound_6(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; + s_ptr = ((struct st*)((void *)orig)) + i; s_ptr->b = (i*8+1) & 0x7fff; s_ptr->d = (i*8+6) & 0x7fff; } @@ -1244,8 +1244,8 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)orig) + i; - d_ptr = ((struct dt*)buf) + i; + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; if (s_ptr->b != d_ptr->b || s_ptr->d != d_ptr->d) { H5_FAILED(); diff --git a/test/earray.c b/test/earray.c index d72b3f5..be899b6 100644 --- a/test/earray.c +++ b/test/earray.c @@ -529,10 +529,10 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ @@ -2398,7 +2398,7 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; diff --git a/test/efc.c b/test/efc.c index 5a946bb..98d4948 100644 --- a/test/efc.c +++ b/test/efc.c @@ -2900,7 +2900,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Test Setup */ - puts("Testing the external file cache"); + HDputs("Testing the external file cache"); /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); @@ -2937,14 +2937,14 @@ main(void) if(nerrors) goto error; - puts("All external file cache tests passed."); + HDputs("All external file cache tests passed."); h5_clean_files(FILENAME, fapl_id); - return 0; + return EXIT_SUCCESS; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl_id); @@ -2952,6 +2952,6 @@ error: if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } /* end main() */ diff --git a/test/enc_dec_plist_cross_platform.c b/test/enc_dec_plist_cross_platform.c index 1fbb41b..15c7391 100644 --- a/test/enc_dec_plist_cross_platform.c +++ b/test/enc_dec_plist_cross_platform.c @@ -28,7 +28,7 @@ int main(void) { if(VERBOSE_MED) - printf("Encode/Decode property list endianess\n"); + HDprintf("Encode/Decode property list endianess\n"); /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); @@ -227,7 +227,7 @@ test_plists(const char *filename_prefix) return 1; error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); + HDprintf("***** Plist Encode/Decode tests FAILED! *****\n"); return -1; } diff --git a/test/err_compat.c b/test/err_compat.c index eee150b..4860a3c 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); + fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); diff --git a/test/error_test.c b/test/error_test.c index 5356fa7..580234a 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests the error API routines. + * Purpose: Tests the error API routines. */ #include "h5test.h" #include "H5srcdir.h" @@ -23,7 +23,7 @@ #ifdef H5_USE_16_API int main(void) { - HDfprintf(stderr, "Test skipped because backward compatbility with v1.6 is configured in\n"); + HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n"); return 0; } #else /* H5_USE_16_API */ @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -80,7 +80,7 @@ hid_t ERR_MIN_GETNUM; static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); - + /*------------------------------------------------------------------------- * Function: test_error * @@ -94,10 +94,10 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, static herr_t test_error(hid_t file) { - hid_t dataset = -1; + hid_t dataset = -1; hid_t space = -1; hid_t estack_id = -1; - hsize_t dims[2]; + hsize_t dims[2]; const char *FUNC_test_error = "test_error"; H5E_auto2_t old_func; void *old_data = NULL; @@ -169,7 +169,7 @@ test_error(hid_t file) return -1; } /* end test_error() */ - + /*------------------------------------------------------------------------- * Function: init_error * @@ -245,7 +245,7 @@ error: return -1; } /* end init_error() */ - + /*------------------------------------------------------------------------- * Function: error_stack * @@ -287,7 +287,7 @@ error: return -1; } /* end error_stack() */ - + /*------------------------------------------------------------------------- * Function: long_desc_cb * @@ -309,7 +309,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie return -1; } /* end long_desc_cb() */ - + /*------------------------------------------------------------------------- * Function: test_long_desc * @@ -375,7 +375,7 @@ error: return -1; } /* end test_long_desc() */ - + /*------------------------------------------------------------------------- * Function: dump_error * @@ -405,7 +405,7 @@ error: return -1; } /* end dump_error() */ - + /*------------------------------------------------------------------------- * Function: custom_print_cb * @@ -436,8 +436,8 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data) TEST_ERROR; HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls); HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -448,7 +448,7 @@ error: return -1; } /* end custom_print_cb() */ - + /*------------------------------------------------------------------------- * Function: test_create * @@ -531,11 +531,11 @@ test_copy(void) err_num = H5Eget_num(H5E_DEFAULT); if (err_num != 1) TEST_ERROR - + /* Copy error stack, which clears the original */ if ((estack_id = H5Eget_current_stack()) < 0) TEST_ERROR - + /* Check the number of errors on stack copy */ err_num = H5Eget_num(estack_id); if (err_num != 1) @@ -555,7 +555,7 @@ test_copy(void) if (err_num != 1) TEST_ERROR - /* Try to close error stack copy. Should fail because + /* Try to close error stack copy. Should fail because * the current H5Eset_current_stack closes the stack to be set. */ H5E_BEGIN_TRY { @@ -570,7 +570,7 @@ error: return -1; } /* end test_copy() */ - + /*------------------------------------------------------------------------- * Function: close_error * @@ -606,17 +606,17 @@ error: return -1; } /* end close_error() */ - + /*------------------------------------------------------------------------- * Function: test_filter_error * * Purpose: Make sure the error message prints out the filter name - * when the existent file is opened but the filter isn't - * registered. The existent file was created with - * gen_filters.c. + * when the existent file is opened but the filter isn't + * registered. The existent file was created with + * gen_filters.c. * * Return: Success: 0 - * Failure: -1 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -654,7 +654,7 @@ error: return -1; } /* end test_filter_error() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -736,7 +736,7 @@ main(void) if (close_error() < 0) TEST_ERROR; - /* Test error message during data reading when filter isn't registered + /* Test error message during data reading when filter isn't registered * Use default FAPL to avoid some VFD drivers by the check-vfd test because * the test file was pre-generated. */ diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 6536837..9d23f2f 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Dana Robinson - * Spring 2016 - * - * Purpose: Tests the basic operation of the evict-on-close cache +/* Purpose: Tests the basic operation of the evict-on-close cache * behavior. Tests that ensure the tagging is handled correctly * are located in cache.c. */ @@ -91,9 +87,6 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * * Return: TRUE/FALSE * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -114,8 +107,8 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) return TRUE; else entry_ptr = entry_ptr->ht_next; - } /* end while */ - } /* end for */ + } + } return FALSE; } /* end verify_tag_not_in_cache() */ @@ -129,9 +122,6 @@ verify_tag_not_in_cache(H5F_t *f, haddr_t tag) * Return: Success: The file ID of the created file * Failure: -1 * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static hid_t @@ -207,7 +197,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -303,7 +293,7 @@ generate_eoc_test_file(hid_t fapl_id) TEST_ERROR; if(H5Gclose(gid2) < 0) TEST_ERROR; - } /* end for */ + } if(H5Gclose(gid1) < 0) TEST_ERROR; @@ -593,9 +583,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -710,9 +697,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -815,9 +799,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -873,7 +854,7 @@ check_evict_on_close_api(void) /* ensure an invalid plist fails */ H5E_BEGIN_TRY { - status = H5Pget_evict_on_close((hid_t)-1, &evict_on_close); + status = H5Pget_evict_on_close(H5I_INVALID_HID, &evict_on_close); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR("H5Pget_evict_on_close() accepted invalid hid_t."); @@ -897,9 +878,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -979,7 +957,7 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: @@ -992,7 +970,7 @@ error: H5Pclose(fapl_id); } H5E_END_TRY; - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ @@ -1007,9 +985,6 @@ error: * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,9 +1027,6 @@ error: * * Return: EXIT_FAILURE/EXIT_SUCCESS * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ int @@ -1076,14 +1048,14 @@ main(void) HDprintf("All evict-on-close tests passed.\n"); HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: HDprintf("***** %u evict-on-close test%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* main() - parallel */ diff --git a/test/external.c b/test/external.c index 7e9ecf9..8a4ca86 100644 --- a/test/external.c +++ b/test/external.c @@ -1402,4 +1402,3 @@ error: printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ - diff --git a/test/farray.c b/test/farray.c index 383cb32..e1bc5bc 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,9 +25,9 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -113,121 +113,116 @@ h5_stat_size_t empty_size_g; /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t init_cparam(H5FA_create_t *cparam, farray_test_param_t *tparam) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); - cparam->cls = H5FA_CLS_TEST; - cparam->raw_elmt_size = ELMT_SIZE; - cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; - cparam->nelmts = tparam->nelmts; + cparam->cls = H5FA_CLS_TEST; + cparam->raw_elmt_size = ELMT_SIZE; + cparam->max_dblk_page_nelmts_bits = MAX_DBLOCK_PAGE_NELMTS_BITS; + cparam->nelmts = tparam->nelmts; - return(0); + return SUCCEED; } /* init_cparam() */ /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object - * - * Return: Success: 0 - * Failure: -1 + * Purpose: Create file and retrieve pointer to internal file object * + * Return: SUCCEED/FAIL + * *------------------------------------------------------------------------- */ -static int -create_file(hid_t fapl, hid_t *file, H5F_t **f) +static herr_t +create_file(hid_t fapl_id, hid_t *fid, H5F_t **f) { /* Create the file to work on */ - if((*file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if ((*fid = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR; /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) - FAIL_STACK_ERROR + if (H5AC_ignore_tags(*f) < 0) + FAIL_STACK_ERROR; /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_file() */ /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for a fixed array + * Purpose: Verify stats for a fixed array * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t check_stats(const H5FA_t *fa, const farray_state_t *state) { H5FA_stat_t farray_stats; /* Statistics about the array */ /* Get statistics for fixed array and verify they are correct */ - if(H5FA_get_stats(fa, &farray_stats) < 0) + if (H5FA_get_stats(fa, &farray_stats) < 0) FAIL_STACK_ERROR /* Compare information */ - if(farray_stats.hdr_size != state->hdr_size) { + if (farray_stats.hdr_size != state->hdr_size) { HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, state->hdr_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.dblk_size != state->dblk_size) { + if (farray_stats.dblk_size != state->dblk_size) { HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, state->dblk_size); TEST_ERROR - } /* end if */ + } - if(farray_stats.nelmts != state->nelmts) { + if (farray_stats.nelmts != state->nelmts) { HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, state->nelmts); TEST_ERROR - } /* end if */ + } - /* All tests passed */ - return(0); + /* Success */ + return SUCCEED; error: - return(-1); + return FAIL; } /* check_stats() */ /*------------------------------------------------------------------------- - * Function: set_fa_state - * - * Purpose: Set the state of the Fixed Array + * Function: set_fa_state * - * Return: does not fail + * Purpose: Set the state of the Fixed Array * - * Programmer: Vailin Choi; 5th August, 2009 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) { size_t dblk_page_nelmts; /* # of elements per page */ @@ -241,190 +236,190 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) state->nelmts = cparam->nelmts; dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; - if(state->nelmts > dblk_page_nelmts) { - size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - size_t dblk_page_init_size = (npages + 7) / 8; - hsize_t checksum_size = npages * 4; + if (state->nelmts > dblk_page_nelmts) { + size_t npages = (size_t)(((state->nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + size_t dblk_page_init_size = (npages + 7) / 8; + hsize_t checksum_size = npages * 4; - state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + + state->dblk_size = DBLOCK_PREFIX + dblk_page_init_size + checksum_size + state->nelmts * cparam->raw_elmt_size; - } else - state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; + } + else + state->dblk_size = DBLOCK_PREFIX + state->nelmts * cparam->raw_elmt_size; - return(0); + return SUCCEED; } /* end set_fa_state() */ /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *fid, H5F_t **f, hid_t fapl_id, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ /* (actually will close & re-open the file as well) */ - if(tparam->reopen_array) { + if (tparam->reopen_array) { + /* Close array, if given */ - if(fa && *fa) { - if(H5FA_close(*fa) < 0) + if (fa && *fa) { + if (H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; - } /* end if */ + } /* Close file */ - if(*file) { - if(H5Fclose(*file) < 0) + if (*fid) { + if (H5Fclose(*fid) < 0) FAIL_STACK_ERROR - *file = (-1); + *fid = H5I_INVALID_HID; *f = NULL; - } /* end if */ + } /* Re-open the file */ - if((*file = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((*fid = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (*f = (H5F_t *)H5I_object(*file))) - FAIL_STACK_ERROR + if (NULL == (*f = (H5F_t *)H5I_object(*fid))) + FAIL_STACK_ERROR; /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(*f) < 0) + if (H5AC_ignore_tags(*f) < 0) FAIL_STACK_ERROR /* Re-open array, if given */ - if(fa) - if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) + if (fa) + if (NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR - } /* end if */ + } /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* reopen_file() */ /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create a fixed array and perform initial checks + * Purpose: Create a fixed array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { farray_state_t state; /* State of extensible array */ /* Create array */ - if(NULL == (*fa = H5FA_create(f, cparam, NULL))) + if (NULL == (*fa = H5FA_create(f, cparam, NULL))) FAIL_STACK_ERROR /* Check status of array */ - if(H5FA_get_addr(*fa, fa_addr) < 0) + if (H5FA_get_addr(*fa, fa_addr) < 0) FAIL_STACK_ERROR - if(!H5F_addr_defined(*fa_addr)) + if (!H5F_addr_defined(*fa_addr)) TEST_ERROR + + /* Check array stats */ HDmemset(&state, 0, sizeof(state)); - state.hdr_size = FA_HDR_SIZE; - state.nelmts = cparam->nelmts; - if(check_stats(*fa, &state)) + state.hdr_size = FA_HDR_SIZE; + state.nelmts = cparam->nelmts; + if (check_stats(*fa, &state)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* create_array() */ /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int +static herr_t verify_cparam(const H5FA_t *fa, const H5FA_create_t *cparam) { H5FA_create_t test_cparam; /* Creation parameters for array */ /* Retrieve creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5FA_create_t)); - if(H5FA_get_cparam_test(fa, &test_cparam) < 0) + if (H5FA_get_cparam_test(fa, &test_cparam) < 0) FAIL_STACK_ERROR /* Verify creation parameters */ - if(H5FA_cmp_cparam_test(cparam, &test_cparam)) + if (H5FA_cmp_cparam_test(cparam, &test_cparam)) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* verify_cparam() */ /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ -static int -finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) +static herr_t +finish(hid_t fid, hid_t fapl_id, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) { h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, fa_addr, NULL) < 0) + if (H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename_g, fapl)) < 0) + if ((file_size = h5_get_file_size(filename_g, fapl_id)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size != empty_size_g) + if (file_size != empty_size_g) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* finish() */ @@ -627,66 +622,64 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR - /* - * Display testing message - */ + /* Display testing message */ TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ - if((file2 = H5Freopen(file)) < 0) + if ((fid2 = H5Freopen(fid)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5I_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -694,11 +687,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -708,12 +701,12 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(fid); + H5Fclose(fid2); } H5E_END_TRY; return 1; @@ -736,44 +729,42 @@ error: *------------------------------------------------------------------------- */ static unsigned -test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) +test_open_twice_diff(hid_t fapl_id, H5FA_create_t *cparam, farray_test_param_t *tparam) { - char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ - H5FA_t *fa = NULL; /* Fixed array wrapper */ - H5FA_t *fa2 = NULL; /* Fixed array wrapper */ - haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ - - /* - * Display testing message - */ + char filename_tmp[FARRAY_FILENAME_LEN]; /* Temporary file name */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid0 = H5I_INVALID_HID; /* File ID */ + hid_t fid00 = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ + H5FA_t *fa = NULL; /* Fixed array wrapper */ + H5FA_t *fa2 = NULL; /* Fixed array wrapper */ + haddr_t fa_addr = HADDR_UNDEF; /* Array address in file */ + + /* Display testing message */ TESTING("open fixed array twice, through different file handles"); /* Create file & retrieve pointer to internal file object */ - if(create_file(fapl, &file, &f) < 0) + if (create_file(fapl_id, &fid, &f) < 0) TEST_ERROR /* Create array */ - if(create_array(f, cparam, &fa, &fa_addr) < 0) + if (create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa, cparam) < 0) + if (verify_cparam(fa, cparam) < 0) TEST_ERROR - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2) < 0) + if (H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -781,15 +772,15 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (So that there is something holding the file open when the extensible * array is closed) */ - if((file0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid0 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) + if (reopen_file(&fid, &f, fapl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa) < 0) + if (H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -797,44 +788,43 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa /* (close before second file, to detect error on internal array header's * shared file information) */ - if(H5Fclose(file) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR - file = -1; + fid = H5I_INVALID_HID; /* Open a different file */ /* (This re-allocates the 'top' file pointer and assigns it a different * 'shared' file pointer, making the file pointer in the fixed array's * header stale) */ - h5_fixname(FILENAME[1], fapl, filename_tmp, sizeof(filename_tmp)); - if((file00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[1], fapl_id, filename_tmp, sizeof(filename_tmp)); + if ((fid00 = H5Fcreate(filename_tmp, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) FAIL_STACK_ERROR - /* Re-open the file with the fixed array */ - if((file2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl)) < 0) + if ((fid2 = H5Fopen(filename_g, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR /* Get a pointer to the internal file object */ - if(NULL == (f2 = (H5F_t *)H5I_object(file2))) - FAIL_STACK_ERROR + if (NULL == (f2 = (H5F_t *)H5I_object(fid2))) + FAIL_STACK_ERROR; /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) + if (NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ - if(verify_cparam(fa2, cparam) < 0) + if (verify_cparam(fa2, cparam) < 0) TEST_ERROR /* Close the extra file handles */ - if(H5Fclose(file0) < 0) + if (H5Fclose(fid0) < 0) FAIL_STACK_ERROR - if(H5Fclose(file00) < 0) + if (H5Fclose(fid00) < 0) FAIL_STACK_ERROR /* Close array, delete array, close file & verify file is empty */ - if(finish(file2, fapl, f2, fa2, fa_addr) < 0) + if (finish(fid2, fapl_id, f2, fa2, fa_addr) < 0) TEST_ERROR /* All tests passed */ @@ -844,14 +834,14 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa error: H5E_BEGIN_TRY { - if(fa) + if (fa) H5FA_close(fa); - if(fa2) + if (fa2) H5FA_close(fa2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(fid); + H5Fclose(fid2); + H5Fclose(fid0); + H5Fclose(fid00); } H5E_END_TRY; return 1; @@ -966,7 +956,7 @@ error: H5FA_close(fa); if(fa2) H5FA_close(fa2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1666,7 +1656,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -1706,12 +1696,12 @@ main(void) switch(curr_test) { /* "Normal" testing parameters */ case FARRAY_TEST_NORMAL: - puts("Testing with NORMAL PARAMETERS"); + HDputs("Testing with NORMAL PARAMETERS"); break; /* "Re-open array" testing parameters */ case FARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = FARRAY_TEST_REOPEN; break; @@ -1738,25 +1728,25 @@ main(void) switch(curr_iter) { /* "Forward" testing parameters */ case FARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.fiter = &fa_iter_fw; break; /* "Reverse" testing parameters */ case FARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.fiter = &fa_iter_rv; break; /* "Random" testing parameters */ case FARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.fiter = &fa_iter_rnd; break; /* "Cyclic" testing parameters */ case FARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.fiter = &fa_iter_cyc; break; @@ -1772,22 +1762,26 @@ main(void) nerrors += test_set_elmts(fapl, &cparam, &tparam, (hsize_t)tparam.nelmts, "setting all the array elements"); } /* end for */ - /* Check skipping elements */ + /* Check skipping elements */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)1, TRUE, "skipping to first element"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, ((hsize_t)1 << cparam.max_dblk_page_nelmts_bits), TRUE, "skipping to first element in data block page"); nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), TRUE, "skipping to last element"); - /* Create Fixed Array of MAX_NELMTS elements */ - /* - * MAX_NELMTS succeeds on jam and smirom. - * The value was adjusted for linew due to the following: - Linew failed with "H5FD_sec2_truncate(): unable to extend file properly" - Linew failed with "H5FD_sec2_truncate(): File too large" - */ + /* Create Fixed Array */ + /* MAX_NELMTS succeeds on some platforms buy may fail on others: + * + * "H5FD_sec2_truncate(): unable to extend file properly" + * + * and + * + * "H5FD_sec2_truncate(): File too large" + * + * have both been seen. + */ tparam.nelmts = MAX_NELMTS/17; - init_cparam(&cparam, &tparam); + init_cparam(&cparam, &tparam); - /* Set the last element in the Fixed Array */ + /* Set the last element in the Fixed Array */ nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ @@ -1800,22 +1794,22 @@ main(void) if(nerrors) goto error; - puts("All fixed array tests passed."); + HDputs("All fixed array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; if(api_ctx_pushed) H5CX_pop(); - return 1; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/fillval.c b/test/fillval.c index 8c8e902..5b95de9 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -762,15 +762,17 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, comp_datatype *buf_c=NULL; H5D_space_status_t allocation; - if(datatype==H5T_INTEGER) + if(datatype == H5T_INTEGER) { fillval = *(int*)_fillval; - else if(datatype==H5T_COMPOUND) { - fill_c.a=((comp_datatype*)_fillval)->a; + } + else if(datatype == H5T_COMPOUND) { + fill_c.a=((comp_datatype*)_fillval)->a; fill_c.x=((comp_datatype*)_fillval)->x; fill_c.y=((comp_datatype*)_fillval)->y; fill_c.z=((comp_datatype*)_fillval)->z; - } else { - puts("Invalid type for test"); + } + else { + HDputs("Invalid type for test"); goto error; } @@ -806,7 +808,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, goto error; } /* case for compound datatype */ - } else if(datatype==H5T_COMPOUND) { + } + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER && (!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || @@ -828,10 +831,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* Select all odd data locations in the file dataset */ for (i=0, nelmts=1; i<5; i++) { - hs_size[i] = cur_size[i]/2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = cur_size[i]/2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } if((mspace=H5Screate_simple(5, hs_size, hs_size)) < 0) goto error; if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, @@ -1089,17 +1092,23 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) } h5_fixname(base_name, fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; - } else if(H5D_COMPACT==layout) { - if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if(H5D_CHUNKED == layout) { + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) + goto error; + } + else if(H5D_COMPACT == layout) { + if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) + goto error; } - if((ctype_id=create_compound_type()) < 0) goto error; + if((ctype_id = create_compound_type()) < 0) + goto error; /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5D_COMPACT != layout) { @@ -2359,8 +2368,6 @@ test_partalloc(hid_t fapl, const char *base_name) * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2380,8 +2387,8 @@ main(int argc, char *argv[]) else if(!strcmp(argv[argno], "compact")) test_compact =1; else { - fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); - exit(EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); + HDexit(EXIT_FAILURE); } } /* end for */ } /* end if */ @@ -2444,15 +2451,15 @@ main(int argc, char *argv[]) if(nerrors) goto error; - puts("All fill value tests passed."); + HDputs("All fill value tests passed."); if(h5_cleanup(FILENAME, fapl)) HDremove(FILE_NAME_RAW); - return 0; + HDexit(EXIT_SUCCESS); error: - puts("***** FILL VALUE TESTS FAILED *****"); - return 1; + HDputs("***** FILL VALUE TESTS FAILED *****"); + HDexit(EXIT_FAILURE); } diff --git a/test/flush1.c b/test/flush1.c index bdbd731..d7d578b 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -73,7 +73,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ unsigned flags; /* file open flags */ int i; /* iterator */ diff --git a/test/flush2.c b/test/flush2.c index 9fdf6c1..519f1b2 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Purpose: This is the second half of a two-part test that makes sure - * that a file can be read after an application crashes as long - * as the file was flushed first. This half tries to read the - * file created by the first half. + * Purpose: This is the second half of a two-part test that makes sure + * that a file can be read after an application crashes as long + * as the file was flushed first. This half tries to read the + * file created by the first half. */ #include "h5test.h" @@ -135,7 +135,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ int i; /* iterator */ /* open file */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 4196d85..c933349 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -130,7 +130,7 @@ herr_t end_verification(void); * it will time out waiting for a signal from the test script * which will never come. * - * Return: 0 on Success, 1 on Failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Mike McGreevy * July 1, 2010 @@ -166,23 +166,26 @@ int main(int argc, const char *argv[]) if(end_verification() < 0) TEST_ERROR; if(end_verification() < 0) TEST_ERROR; } /* end else */ - } else if(argc == 3) { + } + else if(argc == 3) { /* Two arguments supplied. Pass them to flush verification routine. */ if(flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR; - } else if(argc == 2) { + } + else if(argc == 2) { /* One argument supplied. Pass it to refresh verification routine. */ if(refresh_verification(argv[1]) != 0) PROCESS_ERROR; - } else { + } + else { /* Illegal number of arguments supplied. Error. */ HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc); PROCESS_ERROR } /* end if */ - return SUCCEED; + return EXIT_SUCCESS; error: /* Return */ - return FAIL; + return EXIT_FAILURE; } /* main */ @@ -695,7 +698,6 @@ herr_t test_refresh(void) /* ================= */ /* Refresh Datatypes */ /* ================= */ - TESTING("to ensure that H5Trefresh correctly refreshes single datatypes"); /* Verify First Committed Datatype can be refreshed with H5Trefresh */ @@ -715,7 +717,6 @@ herr_t test_refresh(void) if(H5Oflush(tid2) < 0) TEST_ERROR; if(end_refresh_verification_process() != 0) TEST_ERROR; - PASSED(); /* =============== */ @@ -995,7 +996,7 @@ herr_t refresh_verification(const char * obj_pathname) check to ensure we didn't erroneously flush the attribute before starting the verification. */ if(flushed_oinfo.num_attrs != 0) - PROCESS_ERROR; + PROCESS_ERROR; /* Send Signal to MAIN PROCESS indicating that it can go ahead and modify the object. */ @@ -1027,55 +1028,57 @@ herr_t refresh_verification(const char * obj_pathname) * test cases is easy). */ do { - if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { - if(H5Drefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { - if(H5Grefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { - if(H5Trefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || + if((HDstrcmp(obj_pathname, D1) == 0) || (HDstrcmp(obj_pathname, D2) == 0)) { + if(H5Drefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, G1) == 0) || (HDstrcmp(obj_pathname, G2) == 0)) { + if(H5Grefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, T1) == 0) || (HDstrcmp(obj_pathname, T2) == 0)) { + if(H5Trefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else if((HDstrcmp(obj_pathname, D3) == 0) || (HDstrcmp(obj_pathname, G3) == 0) || (HDstrcmp(obj_pathname, T3) == 0)) { - if(H5Orefresh(oid) < 0) PROCESS_ERROR; - } /* end if */ - else { - HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); - PROCESS_ERROR; - } /* end else */ - - /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; - - /* Confirm following (first 4) attributes are the same: */ - /* Confirm following (last 4) attributes are different */ - if( (flushed_oinfo.addr == refreshed_oinfo.addr) && - (flushed_oinfo.type == refreshed_oinfo.type) && - (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && - (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && - (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && - (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && - (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && - (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { - ok = TRUE; - break; - } - if(tries == sleep_tries) - HDsleep(1); + if(H5Orefresh(oid) < 0) PROCESS_ERROR; + } /* end if */ + else { + HDfprintf(stdout, "Error. %s is an unrecognized object.\n", obj_pathname); + PROCESS_ERROR; + } /* end else */ + + /* Get object info. This should now accurately reflect the refreshed object on disk. */ + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) + PROCESS_ERROR; + + /* Confirm following (first 4) attributes are the same: */ + /* Confirm following (last 4) attributes are different */ + if( (flushed_oinfo.addr == refreshed_oinfo.addr) && + (flushed_oinfo.type == refreshed_oinfo.type) && + (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) && + (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) && + (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) && + (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) && + (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) && + (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) { + ok = TRUE; + break; + } + + if(tries == sleep_tries) + HDsleep(1); } while(--tries); - + if(!ok) { - printf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, - (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); - printf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", - (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, - (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); - PROCESS_ERROR; + HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs, + (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total); + HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n", + (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs, + (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total); + PROCESS_ERROR; } - + /* Close objects */ if(H5Oclose(oid) < 0) PROCESS_ERROR; if(H5Fclose(fid) < 0) PROCESS_ERROR; diff --git a/test/freespace.c b/test/freespace.c index 33a6f89..c0fbb76 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -24,7 +24,7 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -496,7 +496,7 @@ test_fs_create(hid_t fapl) if(!H5F_addr_defined(fs_addr)) TEST_ERROR - if (frsp->nclasses != nclasses) + if(frsp->nclasses != nclasses) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -879,7 +879,7 @@ test_fs_sect_add(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -1248,7 +1248,7 @@ test_fs_sect_find(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -1857,14 +1857,14 @@ test_fs_sect_shrink(hid_t fapl) * Re-add section A that allow shrinking and its section class type defines "can_shrink" */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1875,18 +1875,18 @@ test_fs_sect_shrink(hid_t fapl) /* section A should not be there in free-space */ if((node_found = H5FS_sect_find(f, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ if(H5FS_close(f, frsp) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ if(H5FS_delete(f, fs_addr) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -2082,7 +2082,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2357,7 +2357,7 @@ test_fs_sect_change_class(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2736,7 +2736,7 @@ test_fs_sect_extend(hid_t fapl) PASSED() - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2838,7 +2838,7 @@ test_fs_sect_iterate(hid_t fapl) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file and dxpl */ + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR diff --git a/test/istore.c b/test/istore.c index b5bac2c..1d57a2a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -216,7 +216,7 @@ test_create(hid_t f, const char *prefix) /* Create chunked dataset of this dimensionality */ HDsnprintf(name, sizeof name, "%s_%02u", prefix, u); - if ((dataset=new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) + if((dataset = new_object(f, name, (int)u, dims, my_chunk_dims)) < 0) return FAIL; /* Close dataset created */ diff --git a/test/lheap.c b/test/lheap.c index 4f09b6e..d309fb0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -41,9 +41,7 @@ const char *FILENAME[] = { * heap, close the file, open the file, read data out of the * local heap, close the file. * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, November 24, 1998 @@ -95,7 +93,7 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +145,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { + if(NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -211,7 +209,7 @@ main(void) HDputs("All local heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: HDputs("*** TESTS FAILED ***"); @@ -221,6 +219,6 @@ main(void) if(api_ctx_pushed) H5CX_pop(); - return 1; + return EXIT_FAILURE; } diff --git a/test/links.c b/test/links.c index 8d49069..371c2c5 100644 --- a/test/links.c +++ b/test/links.c @@ -15,28 +15,28 @@ * Programmer: Robb Matzke * Friday, April 10, 1998 * - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ /* * This file needs to access private information from the H5FD package. * This file also needs to access the file driver testing code. */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING /* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" #include "H5srcdir.h" #include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ @@ -62,55 +62,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ TMPDIR "extlinks10",/* 30: */ TMPDIR "extlinks11",/* 31: */ TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ + "extlinks13", /* 33: */ TMPDIR "extlinks13",/* 34: */ TMPDIR "extlinks14",/* 35: */ TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ TMPDIR2 "extlinks21B",/* 46: */ TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ TMPDIR "extlinks21D",/* 49: */ TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -318,7 +318,7 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ - + /*------------------------------------------------------------------------- * Function: fix_ext_filename * @@ -340,17 +340,17 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) HDstrcat(path_name, file_name); } - + /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * - * Purpose: Build a file with assorted links. + * Purpose: Build a file with assorted links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -360,9 +360,9 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) static int mklinks(hid_t fapl, hbool_t new_format) { - hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hid_t file, scalar, grp, d1; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -405,7 +405,7 @@ mklinks(hid_t fapl, hbool_t new_format) return -1; } - + /*------------------------------------------------------------------------- * Function: new_links * @@ -425,11 +425,11 @@ mklinks(hid_t fapl, hbool_t new_format) static int new_links(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); - hid_t scalar=(-1); - hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; + hid_t file_a, file_b=(-1); + hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); + hid_t scalar=(-1); + hid_t dset1=(-1), dset2=(-1); + char filename[NAME_BUF_SIZE]; hsize_t size[1] = {1}; if(new_format) @@ -492,31 +492,31 @@ new_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Sclose(scalar); - H5Dclose(dset1); - H5Dclose(dset2); - H5Gclose(grp1_a); - H5Gclose(grp2_a); - H5Gclose(grp1_b); - H5Gclose(grp2_b); - H5Fclose(file_a); - H5Fclose(file_b); + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * - * Purpose: Open the file created in the first step and check that the - * links look correct. + * Purpose: Open the file created in the first step and check that the + * links look correct. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -526,12 +526,12 @@ new_links(hid_t fapl, hbool_t new_format) static int cklinks(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + hid_t file; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +546,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -565,91 +565,91 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - printf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -665,7 +665,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: ck_new_links * @@ -684,9 +684,9 @@ error: static int ck_new_links(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + hid_t file; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -699,23 +699,23 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Get hard link info */ if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ @@ -728,7 +728,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: long_links * @@ -748,12 +748,12 @@ error: static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ char *objname = NULL; /* Name of object [Long] */ size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -796,15 +796,15 @@ long_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; HDfree(objname); return -1; } - + /*------------------------------------------------------------------------- * Function: toomany * @@ -824,10 +824,10 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +917,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -944,14 +944,14 @@ toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end toomany() */ - + /*------------------------------------------------------------------------- * Function: test_lcpl * @@ -1111,7 +1111,7 @@ error: return 1; } /* end test_lcpl() */ - + /*------------------------------------------------------------------------- * Function: test_move * @@ -1131,9 +1131,9 @@ error: static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1155,9 +1155,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1188,11 +1188,11 @@ test_move(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if( H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1201,38 +1201,38 @@ test_move(hid_t fapl, hbool_t new_format) moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1261,17 +1261,17 @@ test_move(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_copy * @@ -1291,9 +1291,9 @@ test_move(hid_t fapl, hbool_t new_format) static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lcopy (w/new group format)") @@ -1315,9 +1315,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1348,75 +1348,75 @@ test_copy(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1432,17 +1432,17 @@ test_copy(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_move_preserves * @@ -1608,16 +1608,16 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_move_preserves() */ - + /*------------------------------------------------------------------------- * Function: test_deprec * @@ -1640,7 +1640,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1768,7 +1768,7 @@ error: } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: external_link_root * @@ -1788,14 +1788,14 @@ error: static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - const char *file; /* File from external link */ - const char *path; /* Path from external link */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ if(new_format) TESTING("external link to root (w/new group format)") @@ -1824,21 +1824,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,21 +1848,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ @@ -1945,14 +1945,14 @@ external_link_root(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_root() */ - + /*------------------------------------------------------------------------- * Function: external_link_path * @@ -1973,11 +1973,11 @@ external_link_root(hid_t fapl, hbool_t new_format) static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2053,14 +2053,14 @@ external_link_path(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_path() */ - + /*------------------------------------------------------------------------- * Function: external_link_mult * @@ -2081,13 +2081,13 @@ external_link_path(hid_t fapl, hbool_t new_format) static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1), fid2 = (-1); /* File IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2217,14 +2217,14 @@ external_link_mult(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_mult() */ - + /*------------------------------------------------------------------------- * Function: external_link_self * @@ -2244,13 +2244,13 @@ external_link_mult(hid_t fapl, hbool_t new_format) static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t lcpl_id = (-1); /* Link Creation Property List ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2365,15 +2365,15 @@ external_link_self(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(lcpl_id); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ - + /*------------------------------------------------------------------------- * Function: external_link_pingpong * @@ -2401,11 +2401,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2488,14 +2488,14 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ - + /*------------------------------------------------------------------------- * Function: external_link_toomany * @@ -2536,11 +2536,11 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2603,9 +2603,9 @@ external_link_toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2632,14 +2632,14 @@ external_link_toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_toomany() */ - + /*------------------------------------------------------------------------- * Function: external_link_dangling * @@ -2660,12 +2660,12 @@ external_link_toomany(hid_t fapl, hbool_t new_format) static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t rid = (-1); /* Root Group ID */ hid_t status = (-1); /* Status */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("dangling external links (w/new group format)") @@ -2704,9 +2704,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2714,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2740,22 +2740,22 @@ external_link_dangling(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_dangling() */ - + /*------------------------------------------------------------------------- * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 @@ -2771,12 +2771,12 @@ external_link_dangling(hid_t fapl, hbool_t new_format) static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + hid_t gapl_id = (-1); + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2790,7 +2790,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR /* set up name for target file: "tmp/extlinks2" */ h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); @@ -2821,9 +2821,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2835,20 +2835,20 @@ external_link_prefix(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_prefix() */ - + /*------------------------------------------------------------------------- * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 @@ -2863,13 +2863,13 @@ external_link_prefix(hid_t fapl, hbool_t new_format) static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's absolute path (w/new group format)") @@ -2887,7 +2887,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Window: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -2915,9 +2915,9 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2929,20 +2929,20 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abs_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_rel_mainpath: test 4 * - * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * Purpose: 1. target link: "extlinks4" + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 @@ -2957,11 +2957,11 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + relative path(w/new group format)") @@ -3001,9 +3001,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3015,19 +3015,19 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_rel_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * * Return: Success: 0 @@ -3043,11 +3043,11 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; @@ -3065,7 +3065,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3093,9 +3093,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3107,21 +3107,21 @@ external_link_cwd(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_cwd() */ - + /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 @@ -3136,12 +3136,12 @@ external_link_cwd(hid_t fapl, hbool_t new_format) static int external_link_abstar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -3159,7 +3159,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" + * Windows: ":/CWD/tmp/extlinks6" */ fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3189,9 +3189,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3203,8 +3203,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar() */ @@ -3213,9 +3213,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 @@ -3230,13 +3230,13 @@ external_link_abstar(hid_t fapl, hbool_t new_format) static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD (w/new group format)") @@ -3256,7 +3256,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3283,9 +3283,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3297,20 +3297,20 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar_cur() */ - + /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 @@ -3325,10 +3325,10 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + target's relative path(w/new group format)") @@ -3363,9 +3363,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3377,22 +3377,22 @@ external_link_reltar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_reltar() */ - + /*------------------------------------------------------------------------- * Function: external_link_chdir: test 9 * * Purpose: - * 1. target link: "extlinks9" - * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" - * Should be able to access the target file in current working directory + * 1. target link: "extlinks9" + * 2. main file: "extlinks0" + * 3. target file" "tmp/extlinks9" + * 3. chdir "tmp" + * Should be able to access the target file in current working directory * * Return: Success: 0 * Failure: -1 @@ -3407,11 +3407,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format) static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via chdir and found in current working directory (w/new group format)") @@ -3460,9 +3460,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3474,28 +3474,28 @@ external_link_chdir(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_chdir() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. - * - * 1. target link: "extlinks16" - * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file A to be a "family" file: extlinks16A - * 4. Create target file B to be a "multi" file: extlinks16B - * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A - * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B - * 6. Should succeed in opening the target object: ext_extA - * 6. Should succeed in opening the target object: ext_extB + * different from the parent can be successfully opened. + * + * 1. target link: "extlinks16" + * 2. target file: "extlinks16" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file A to be a "family" file: extlinks16A + * 4. Create target file B to be a "multi" file: extlinks16B + * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A + * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B + * 6. Should succeed in opening the target object: ext_extA + * 6. Should succeed in opening the target object: ext_extB * * Return: Success: 0 * Failure: -1 @@ -3510,22 +3510,22 @@ external_link_chdir(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl1(hid_t fapl, hbool_t new_format) { - hid_t fid=(-1); - hid_t fidA=(-1), fidB=(-1); - hid_t gidA=(-1), gidB=(-1); - hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid=(-1); + hid_t fidA=(-1), fidB=(-1); + hid_t gidA=(-1), gidB=(-1); + hid_t oidA=(-1), oidB=(-1); + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; - hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + hid_t fam_fapl=-1, multi_fapl=-1; + hid_t lapl_idA=-1, lapl_idB=-1; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,11 +3533,11 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3560,8 +3560,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3569,27 +3569,27 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsnprintf(sv[H5FD_MEM_SUPER], sizeof(sv[H5FD_MEM_SUPER]), "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsnprintf(sv[H5FD_MEM_BTREE], sizeof(sv[H5FD_MEM_BTREE]), "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsnprintf(sv[H5FD_MEM_DRAW], sizeof(sv[H5FD_MEM_DRAW]), "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsnprintf(sv[H5FD_MEM_GHEAP], sizeof(sv[H5FD_MEM_GHEAP]), "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); + HDsnprintf(sv[H5FD_MEM_LHEAP], sizeof(sv[H5FD_MEM_LHEAP]), "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); + HDsnprintf(sv[H5FD_MEM_OHDR], sizeof(sv[H5FD_MEM_OHDR]), "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; @@ -3621,10 +3621,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* Create external link to target file A:/A */ if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Create external link to target file B:/B */ if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3635,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3649,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3668,38 +3668,38 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl1() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. - * - * 1. target link: "extlinks17" - * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. + * + * 1. target link: "extlinks17" + * 2. target file: "extlinks17" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 6. Should succeed in opening the target dataset: ext_link + * 7. Write data to the target dataset + * 8. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 @@ -3714,17 +3714,17 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; hsize_t dims[2]; - int points[NUM40][NUM40]; - h5_stat_size_t filesize, new_filesize; - int i, j, n; + int points[NUM40][NUM40]; + h5_stat_size_t filesize, new_filesize; + int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3736,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3760,12 +3760,16 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR /* Create dataset creation property list */ - if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) TEST_ERROR; + if (dcpl_g == H5P_DEFAULT) + dcpl = H5Pcreate(H5P_DATASET_CREATE); + else + dcpl = H5Pcopy(dcpl_g); + if (0 > dcpl) TEST_ERROR; if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3825,39 +3829,39 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl2() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl - * 10. Verify that the copied link access's fapl is the core driver - * 11. Get the fapl property value of the copied link access - * 12. H5Premove() the fapl property from the copied link access - * 13. H5Pclose() fapl set in the copied link access should fail since the - * removal in #12 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * 10. Verify that the copied link access's fapl is the core driver + * 11. Get the fapl property value of the copied link access + * 12. H5Premove() the fapl property from the copied link access + * 13. H5Pclose() fapl set in the copied link access should fail since the + * removal in #12 should also close its fapl * * Return: Success: 0 * Failure: -1 @@ -3873,7 +3877,7 @@ static int external_set_elink_fapl3(hbool_t new_format) { hid_t core_fapl = -1, stdio_fapl = -1; - hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; + hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) TESTING("H5Pset/get_fapl() (w/new group format)") @@ -3941,7 +3945,7 @@ external_set_elink_fapl3(hbool_t new_format) return -1; } /* end external_set_elink_fapl3() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_acc_flags * @@ -4162,7 +4166,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo return -1; } /* end external_set_elink_acc_flags() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -4238,7 +4242,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI @@ -4329,7 +4333,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) return -1; } /* end external_set_elink_cb() */ - + /*------------------------------------------------------------------------- * Function: external_reset_register * @@ -4390,14 +4394,14 @@ external_reset_register(void) return -1; } /* end external_reset_register() */ - + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" + * 1. target link: "/CWD/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" * Should be able to find the target file via main file's current drive/rel path @@ -4415,13 +4419,13 @@ external_reset_register(void) static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") @@ -4465,9 +4469,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4479,21 +4483,21 @@ external_link_win1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win1() */ - + /*------------------------------------------------------------------------- * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 1. target link: "/CWD/tmp/extlinks11" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -4508,13 +4512,13 @@ external_link_win1(hid_t fapl, hbool_t new_format) static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") @@ -4559,9 +4563,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4573,21 +4577,21 @@ external_link_win2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win2() */ - + /*------------------------------------------------------------------------- * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 1. target link: ":tmp/extlinks12" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 @@ -4602,13 +4606,13 @@ external_link_win2(hid_t fapl, hbool_t new_format) static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4652,9 +4656,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4666,20 +4670,20 @@ external_link_win3(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win3() */ - + /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * 1. target link: ":extlinks13" + * 2. main file: ":tmp/extlinks0" + * 3. target file: tmp/extlinks13 + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4694,13 +4698,13 @@ external_link_win3(hid_t fapl, hbool_t new_format) static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4741,9 +4745,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4755,21 +4759,21 @@ external_link_win4(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win4() */ - + /*------------------------------------------------------------------------- * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 1. target link: ":tmp/extlinks14" + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 @@ -4784,13 +4788,13 @@ external_link_win4(hid_t fapl, hbool_t new_format) static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -4841,9 +4845,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,21 +4859,21 @@ external_link_win5(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win5() */ - + /*------------------------------------------------------------------------- * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 1. target link: ":tmp/extlinks15" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4884,13 +4888,13 @@ external_link_win5(hid_t fapl, hbool_t new_format) static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4938,9 +4942,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4952,13 +4956,13 @@ external_link_win6(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win6() */ - + /*------------------------------------------------------------------------- * Function: external_link_win7 * @@ -5045,7 +5049,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win7() */ - + /*------------------------------------------------------------------------- * Function: external_link_win8 * @@ -5137,7 +5141,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win8() */ - + /*------------------------------------------------------------------------- * Function: external_link_win9 * @@ -5226,7 +5230,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_WINDOW_PATH */ - + /*------------------------------------------------------------------------- * Function: external_link_recursive * @@ -5245,9 +5249,9 @@ external_link_win9(hid_t fapl, hbool_t new_format) static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5275,9 +5279,9 @@ external_link_recursive(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ @@ -5289,13 +5293,13 @@ external_link_recursive(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_recursive() */ - + /*------------------------------------------------------------------------- * Function: external_link_query * @@ -5315,14 +5319,14 @@ external_link_recursive(hid_t fapl, hbool_t new_format) static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5345,9 +5349,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ @@ -5371,9 +5375,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5389,9 +5393,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5419,13 +5423,13 @@ external_link_query(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_query() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_compact * @@ -5442,10 +5446,10 @@ error: static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("unlinking external link in compact group (w/new group format)") @@ -5504,14 +5508,14 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_compact() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_dense * @@ -5528,13 +5532,13 @@ error: static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -5650,14 +5654,14 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_dense() */ - + /*------------------------------------------------------------------------- * Function: external_link_move * @@ -5674,11 +5678,11 @@ error: static int external_link_move(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5841,14 +5845,14 @@ external_link_move(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_move() */ - + /*------------------------------------------------------------------------- * Function: external_link_ride * @@ -5866,13 +5870,13 @@ error: static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -6027,14 +6031,14 @@ external_link_ride(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { H5Pclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_ride() */ - + /*------------------------------------------------------------------------- * Function: external_link_closing * @@ -6056,11 +6060,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6267,7 +6271,7 @@ error: return -1; } /* external_link_closing() */ - + /*------------------------------------------------------------------------- * Function: ext_link_endian * @@ -6286,8 +6290,8 @@ error: static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; @@ -6335,14 +6339,14 @@ external_link_endian(hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- * Function: external_link_strong * @@ -6364,7 +6368,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6427,7 +6431,7 @@ error: return -1; } /* end external_link_strong() */ - + /*------------------------------------------------------------------------- * Function: external_symlink * @@ -6448,17 +6452,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6616,8 +6620,8 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ return 0; @@ -6643,7 +6647,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ - + /*------------------------------------------------------------------------- * Function: external_copy_invalid_object * @@ -6716,7 +6720,7 @@ error: return -1; } /* end external_copy_invalid_object */ - + /*------------------------------------------------------------------------- * Function: external_dont_fail_to_source * @@ -6780,7 +6784,7 @@ error: return -1; } /* end external_dont_fail_to_source */ - + /*------------------------------------------------------------------------- * Function: external_file_cache * @@ -7173,7 +7177,7 @@ error: return -1; } /* end external_file_cache */ - + /*------------------------------------------------------------------------- * Function: external_open_twice * @@ -7409,7 +7413,7 @@ error: return -1; } /* end external_open_twice() */ - + /*------------------------------------------------------------------------- * Function: external_link_with_committed_datatype * @@ -7432,24 +7436,24 @@ error: static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { - hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ - char filename1[NAME_BUF_SIZE]; /* File name for main file */ - char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ + char filename1[NAME_BUF_SIZE]; /* File name for main file */ + char filename2[NAME_BUF_SIZE]; /* File name for target file */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7534,8 +7538,8 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ @@ -7681,13 +7685,13 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY return -1; } /* end external_link_with_committed_datatype() */ - + /*------------------------------------------------------------------------- * Function: ud_hard_links * @@ -7875,12 +7879,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7952,9 +7956,9 @@ ud_hard_links(hid_t fapl) /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be @@ -7985,14 +7989,14 @@ ud_hard_links(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_hard_links() */ - + /*------------------------------------------------------------------------- * Function: UD_rereg_traverse * @@ -8042,11 +8046,11 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") @@ -8171,14 +8175,14 @@ ud_link_reregister(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_link_reregister() */ - + /*------------------------------------------------------------------------- * Function: ud_callbacks * @@ -8315,12 +8319,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t lcpl = (-1); /* Link Creation PL */ H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8367,9 +8371,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != 16) TEST_ERROR if (UD_CB_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* Fill the query buffer */ @@ -8428,14 +8432,14 @@ ud_callbacks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lcpl); - H5Gclose (gid); - H5Fclose (fid); + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -8487,12 +8491,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8567,15 +8571,15 @@ lapl_udata(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (plist_id); - H5Gclose (gid); - H5Gclose (gid2); - H5Fclose (fid); + H5Pclose (plist_id); + H5Gclose (gid); + H5Gclose (gid2); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end lapl_udata() */ - + /*------------------------------------------------------------------------- * Function: ud_link_errors * @@ -8785,10 +8789,10 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; H5L_info_t li; /* Link information */ @@ -8827,6 +8831,12 @@ ud_link_errors(hid_t fapl, hbool_t new_format) TEST_ERROR } H5E_END_TRY + /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ + H5E_BEGIN_TRY { + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) + TEST_ERROR + } H5E_END_TRY; + /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -8896,13 +8906,13 @@ ud_link_errors(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_link_errors() */ - + /*------------------------------------------------------------------------- * Function: lapl_nlinks * @@ -8923,15 +8933,15 @@ error: static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t plist = (-1); /* lapl ID */ hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -9017,9 +9027,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) gid = H5Oopen(fid, "soft5", plist); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through lesser soft link */ @@ -9125,21 +9135,21 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(gapl); - H5Pclose(dapl); - H5Pclose(tapl); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(plist); - H5Fclose(fid); + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end lapl_nlinks() */ - + /*------------------------------------------------------------------------- * Function: linkinfo * @@ -9156,12 +9166,12 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t tid = (-1); /* Type ID */ hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9218,15 +9228,15 @@ linkinfo(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Tclose (tid); - H5Dclose (did); - H5Gclose (gid); - H5Fclose (fid); + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end linkinfo() */ - + /*------------------------------------------------------------------------- * Function: check_all_closed * @@ -9281,7 +9291,7 @@ error: } /* end check_all_closed() */ - + /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9381,7 +9391,7 @@ error: return -1; } /* end build_visit_file() */ - + /*------------------------------------------------------------------------- * Function: visit_link_cb * @@ -9411,7 +9421,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t return(H5_ITER_CONT); } /* end visit_link_cb() */ - + /*------------------------------------------------------------------------- * Function: link_visit * @@ -9481,7 +9491,7 @@ error: return -1; } /* end link_visit() */ - + /*------------------------------------------------------------------------- * Function: link_visit_by_name * @@ -9559,7 +9569,7 @@ error: return -1; } /* end link_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_cb * @@ -9589,7 +9599,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit * @@ -9659,7 +9669,7 @@ error: return -1; } /* end obj_visit() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_by_name * @@ -9738,7 +9748,7 @@ error: return -1; } /* end obj_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_stop_cb * @@ -9763,7 +9773,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name return(H5_ITER_STOP); } /* end visit_obj_stop_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_stop * @@ -9822,7 +9832,7 @@ error: return -1; } /* end obj_visit_stop() */ - + /*------------------------------------------------------------------------- * Function: link_filters * @@ -9914,7 +9924,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -10202,7 +10212,7 @@ error: return -1; } /* end link_filters() */ - + /*------------------------------------------------------------------------- * Function: obj_exists * @@ -10490,7 +10500,7 @@ error: return -1; } /* end obj_exists() */ - + /*------------------------------------------------------------------------- * Function: corder_create_empty * @@ -10507,10 +10517,10 @@ error: static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10532,9 +10542,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10597,7 +10607,7 @@ error: return -1; } /* end corder_create_empty() */ - + /*------------------------------------------------------------------------- * Function: corder_create_compact * @@ -10615,12 +10625,12 @@ error: static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10715,7 +10725,7 @@ error: return -1; } /* end corder_create_compact() */ - + /*------------------------------------------------------------------------- * Function: corder_create_dense * @@ -10733,12 +10743,12 @@ error: static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10848,7 +10858,7 @@ error: return -1; } /* end corder_create_dense() */ - + /*------------------------------------------------------------------------- * Function: corder_transition * @@ -10866,12 +10876,12 @@ error: static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ h5_stat_size_t empty_size; /* Size of empty file */ @@ -11077,7 +11087,7 @@ error: return -1; } /* end corder_transition() */ - + /*------------------------------------------------------------------------- * Function: corder_delete * @@ -11096,9 +11106,9 @@ error: static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ @@ -11118,7 +11128,7 @@ corder_delete(hid_t fapl) /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Creating file with latest format will enable paged aggregation with persistent fs */ + /* Creating file with latest format will enable paged aggregation with persistent fs */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Close file */ @@ -11206,14 +11216,14 @@ error: return -1; } /* end corder_delete() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_check * * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 @@ -11365,7 +11375,7 @@ error: return(-1); } /* end link_info_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx * @@ -11383,9 +11393,9 @@ error: static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11449,7 +11459,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11491,7 +11501,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11550,7 +11560,7 @@ error: return -1; } /* end link_info_by_idx() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_old * @@ -11568,8 +11578,8 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11717,7 +11727,7 @@ error: return -1; } /* end link_info_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx * @@ -11735,9 +11745,9 @@ error: static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -11820,7 +11830,7 @@ delete_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11875,7 +11885,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11942,7 +11952,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12043,7 +12053,7 @@ error: return -1; } /* end delete_by_idx() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx_old * @@ -12061,8 +12071,8 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12268,7 +12278,7 @@ error: return -1; } /* end delete_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_cb * @@ -12345,7 +12355,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_cb * @@ -12367,7 +12377,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_fail_cb * @@ -12389,7 +12399,7 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l return(H5_ITER_ERROR); } /* end link_iterate_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_check * @@ -12550,7 +12560,7 @@ error: return(-1); } /* end link_iterate_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate * @@ -12568,9 +12578,9 @@ error: static int link_iterate(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -12662,7 +12672,7 @@ link_iterate(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12688,7 +12698,7 @@ link_iterate(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12746,7 +12756,7 @@ error: return -1; } /* end link_iterate() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_cb * @@ -12817,7 +12827,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_old_cb * @@ -12839,7 +12849,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_check * @@ -13014,7 +13024,7 @@ error: return(-1); } /* end link_iterate_old_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old * @@ -13031,8 +13041,8 @@ error: static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13075,7 +13085,7 @@ link_iterate_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13135,7 +13145,7 @@ error: return -1; } /* end link_iterate_old() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_check * @@ -13234,7 +13244,7 @@ error: return(-1); } /* end open_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx * @@ -13252,11 +13262,11 @@ error: static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -13265,7 +13275,7 @@ open_by_idx(hid_t fapl) H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t *objno = NULL; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13356,7 +13366,7 @@ open_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13391,7 +13401,7 @@ open_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13464,7 +13474,7 @@ error: return -1; } /* end open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_old * @@ -13482,15 +13492,15 @@ error: static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ unsigned u; /* Local index variable */ hid_t ret; /* Generic return value */ @@ -13533,7 +13543,7 @@ open_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13599,7 +13609,7 @@ error: return -1; } /* end open_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: object_info_check * @@ -13670,7 +13680,7 @@ error: return(-1); } /* end object_info_check() */ - + /*------------------------------------------------------------------------- * Function: object_info * @@ -13688,10 +13698,10 @@ error: static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ @@ -13701,7 +13711,7 @@ object_info(hid_t fapl) H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t *objno = NULL; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13791,7 +13801,7 @@ object_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13839,7 +13849,7 @@ object_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13921,7 +13931,7 @@ error: return -1; } /* end object_info() */ - + /*------------------------------------------------------------------------- * Function: object_info_old * @@ -13938,15 +13948,15 @@ error: static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ char attrname[NAME_BUF_SIZE]; /* Attribute name */ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */ herr_t ret; /* Generic return value */ @@ -13988,7 +13998,7 @@ object_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -14067,7 +14077,7 @@ error: return -1; } /* end object_info_old() */ - + /*------------------------------------------------------------------------- * Function: group_info * @@ -14085,10 +14095,10 @@ error: static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -14098,7 +14108,7 @@ group_info(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14180,7 +14190,7 @@ group_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14321,7 +14331,7 @@ group_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14489,7 +14499,7 @@ error: return -1; } /* end group_info() */ - + /*------------------------------------------------------------------------- * Function: group_info_old * @@ -14507,15 +14517,15 @@ error: static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ char objname[NAME_BUF_SIZE]; /* Object name */ char objname2[NAME_BUF_SIZE]; /* Object name */ - char valname[NAME_BUF_SIZE]; /* Link value */ + char valname[2 * NAME_BUF_SIZE]; /* Link value */ herr_t ret; /* Generic return value */ unsigned u, v; /* Local index variables */ @@ -14551,7 +14561,7 @@ group_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14719,7 +14729,7 @@ error: return -1; } /* end group_info_old() */ - + /*------------------------------------------------------------------------- * Function: timestamps * @@ -14737,11 +14747,11 @@ error: static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t group_id2 = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t gcpl_id2 = (-1); /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14882,17 +14892,17 @@ error: return -1; } /* end timestamps() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test links + * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * *------------------------------------------------------------------------- @@ -14900,10 +14910,10 @@ error: int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ - unsigned minimize_dset_oh; /* Whether to minimize dataset object headers */ + unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ @@ -15031,8 +15041,8 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* for with/without external file cache (efc) */ + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links @@ -15060,10 +15070,11 @@ main(void) /* Keep this test last, it's testing files that are used above */ /* do not do this for files used by external link tests */ nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0; - } /* for new/old format */ + } /* new/old format */ /* New group revision feature tests */ nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; + /* XXX: when creation order indexing is fully working, go back and add checks * to these tests to make certain that the creation order values are * correct. @@ -15089,7 +15100,8 @@ main(void) nerrors += group_info_old(fapl) < 0 ? 1 : 0; if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) TEST_ERROR; + if (H5Pclose(dcpl_g) < 0) + TEST_ERROR; dcpl_g = -1; } } /* [un]minimized dataset object headers */ diff --git a/test/mount.c b/test/mount.c index c6230ee..b7d2858 100644 --- a/test/mount.c +++ b/test/mount.c @@ -192,7 +192,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting a file on itself should have failed."); + HDputs(" Mounting a file on itself should have failed."); TEST_ERROR } /* end if */ @@ -208,7 +208,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting two files at one mount point should have failed."); + HDputs(" Mounting two files at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -227,7 +227,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Mounting same file opened twice at one mount point should have failed."); + HDputs(" Mounting same file opened twice at one mount point should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -240,7 +240,7 @@ test_illegal(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Creating a cycle with mount points should have failed."); + HDputs(" Creating a cycle with mount points should have failed."); TEST_ERROR } /* end if */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -423,7 +423,7 @@ test_hide(hid_t fapl) } H5E_END_TRY; if(grp >= 0) { H5_FAILED(); - puts(" Name is still accessible under mount point."); + HDputs(" Name is still accessible under mount point."); TEST_ERROR } /* end if */ @@ -434,7 +434,7 @@ test_hide(hid_t fapl) if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Hard link failed for hidden object."); + HDputs(" Hard link failed for hidden object."); TEST_ERROR } /* end if */ @@ -503,7 +503,7 @@ test_assoc(hid_t fapl) if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); - puts(" Association failed."); + HDputs(" Association failed."); TEST_ERROR } /* end if */ @@ -628,7 +628,7 @@ test_move(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Moving an object across files should't have been possible"); + HDputs(" Moving an object across files should't have been possible"); TEST_ERROR } /* end if */ @@ -834,7 +834,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Incorrect traversal from mount point!"); + HDputs(" Incorrect traversal from mount point!"); TEST_ERROR } /* end if */ @@ -851,7 +851,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -859,7 +859,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Traversal through mount point should not have worked!"); + HDputs(" Traversal through mount point should not have worked!"); TEST_ERROR } /* end if */ @@ -873,7 +873,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ H5E_BEGIN_TRY { @@ -881,7 +881,7 @@ test_unlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); + HDprintf(" %d: Unmount by name should not have been allowed!\n",__LINE__); TEST_ERROR } /* end if */ if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR @@ -1005,7 +1005,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile hard link should not have been allowed!"); + HDputs(" Interfile hard link should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1015,7 +1015,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Interfile renaming should not have been allowed!"); + HDputs(" Interfile renaming should not have been allowed!"); TEST_ERROR } /* end if */ @@ -1033,7 +1033,7 @@ test_interlink(hid_t fapl) } H5E_END_TRY; if(dset >= 0) { H5_FAILED(); - puts(" Dataset and shared type must be in the same file!"); + HDputs(" Dataset and shared type must be in the same file!"); TEST_ERROR } /* end if */ @@ -1172,7 +1172,7 @@ test_close(hid_t fapl) if(H5Fclose(file1) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); - puts(" File1 contents are not accessible!"); + HDputs(" File1 contents are not accessible!"); TEST_ERROR } /* end if */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR @@ -4379,13 +4379,13 @@ main(void) if (nerrors) goto error; - puts("All mount tests passed."); + HDputs("All mount tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("***** MOUNT ERRORS *****"); + HDputs("***** MOUNT ERRORS *****"); return 1; } diff --git a/test/objcopy.c b/test/objcopy.c index 09dd459..b4854d0 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -986,15 +986,15 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, * for each */ for(elmt=0; elmtlen - != ((const hvl_t *)memb2)->len) + if(((const hvl_t *)((const void *)memb1))->len + != ((const hvl_t *)((const void *)memb2))->len) TEST_ERROR /* Check vlen data */ if(!compare_data(parent1, parent2, pid, base_id, - ((const hvl_t *)memb1)->len, - ((const hvl_t *)memb1)->p, - ((const hvl_t *)memb2)->p, obj_owner)) + ((const hvl_t *)((const void *)memb1))->len, + ((const hvl_t *)((const void *)memb1))->p, + ((const hvl_t *)((const void *)memb2))->p, obj_owner)) TEST_ERROR /* Update member pointers */ @@ -5875,7 +5875,7 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2) char *v; } s1; s1 rbuf; /* Buffer for data read */ - s1 rbuf2; /* Buffer for data read */ + s1 rbuf2; /* Buffer for data read */ /* Open the attributes attached to the objects */ if((aid = H5Aopen_by_idx(loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -13390,7 +13390,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl hid_t fid1 = -1, fid2 = -1; /* File IDs */ hid_t gid = -1; /* Group ID */ int i; - char grp_name[8]; + char grp_name[16]; char src_filename[NAME_BUF_SIZE]; char dst_filename[NAME_BUF_SIZE]; diff --git a/test/ohdr.c b/test/ohdr.c index 73ae8ac..c959e35 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -21,14 +21,14 @@ * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5O_FRIEND /* suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" #include "H5CXprivate.h" /* API Contexts */ @@ -1189,17 +1189,17 @@ error: static herr_t test_ohdr_swmr(hbool_t new_format) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t plist = -1; /* Dataset creation property list */ - size_t compact_size = 1024; /* The size of compact dataset */ - int *wbuf = NULL; /* Buffer for writing */ - hsize_t dims[1]; /* Dimension sizes */ - size_t u; /* Iterator */ - int n; /* Data variable */ - H5O_info_t obj_info; /* Information for the object */ + hid_t fid = -1; /* File ID */ + hid_t fapl = -1; /* File access property list */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t plist = -1; /* Dataset creation property list */ + size_t compact_size = 1024; /* The size of compact dataset */ + int *wbuf = NULL; /* Buffer for writing */ + hsize_t dims[1]; /* Dimension sizes */ + size_t u; /* Iterator */ + int n; /* Data variable */ + H5O_info_t obj_info; /* Information for the object */ if(new_format) { TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format"); @@ -1636,13 +1636,9 @@ error: * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Modification: - * - Added loop of combinations of low/high library format bounds - * (BMR, Feb 2018) - * *------------------------------------------------------------------------- */ int diff --git a/test/page_buffer.c b/test/page_buffer.c index 3c61ab0..39d6340 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -36,7 +36,7 @@ #include "H5PBprivate.h" -#define FILENAME_LEN 1024 +#define FILENAME_LEN 1024 #define NUM_DSETS 5 #define NX 100 #define NY 50 @@ -97,7 +97,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl) int i; int num_elements; int j; - char dset_name[10]; + char dset_name[32]; if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; @@ -234,7 +234,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, int i; int j; int num_elements; - char dset_name[10]; + char dset_name[32]; H5F_t *f = NULL; if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) diff --git a/test/tarray.c b/test/tarray.c index 99f7bf8..eb71ad6 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -26,8 +26,8 @@ #define TESTFILE "tarrold.h5" /* 1-D array datatype */ -#define ARRAY1_RANK 1 -#define ARRAY1_DIM1 4 +#define ARRAY1_RANK 1 +#define ARRAY1_DIM1 4 /* 3-D array datatype */ #define ARRAY2_RANK 3 @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1074,14 +1074,14 @@ test_array_free_custom(void *_mem, void *info) if(_mem != NULL) { mem = ((unsigned char *)_mem) - extra; - *mem_used -= *(size_t *)mem; + *mem_used -= *(size_t *)((void *)mem); HDfree(mem); } /* end if */ return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1341,7 +1341,7 @@ test_array_vlen_array(void) for(k=0; k<(i+j+1); k++) for(l=0; l * Tuesday, January 6, 2004 * - * Purpose: Provides support functions for the testing framework. + * Purpose: Provides support functions for the testing framework. * */ @@ -28,24 +28,25 @@ #define MAXTESTDESC 64 typedef struct TestStruct { - int NumErrors; - char Description[MAXTESTDESC]; - int SkipFlag; - char Name[MAXTESTNAME]; - void (*Call)(void); - void (*Cleanup)(void); - const void *Parameters; + int NumErrors; + char Description[MAXTESTDESC]; + int SkipFlag; + char Name[MAXTESTNAME]; + void (*Call)(void); + void (*Cleanup)(void); + const void *Parameters; } TestStruct; /* * Variables used by testing framework. */ +static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ -static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ static TestStruct *Test = NULL; /* Array of tests */ static unsigned TestAlloc = 0; /* Size of the Test array */ static unsigned Index = 0; @@ -54,7 +55,7 @@ static const char *TestProgName = NULL; static void (*TestPrivateUsage)(void) = NULL; static int (*TestPrivateParser)(int ac, char *av[]) = NULL; - + /* * Setup a test function and add it to the list of tests. * It must have no parameters and returns void. @@ -74,12 +75,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", - TheDescr, MAXTESTDESC); + TheDescr, MAXTESTDESC); exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { printf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); + MAXTESTNAME); exit(EXIT_FAILURE); } /* end if */ @@ -102,12 +103,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Set up test function */ HDstrcpy(Test[Index].Description, TheDescr); if(*TheName != '-') { - HDstrcpy(Test[Index].Name, TheName); - Test[Index].SkipFlag = 0; + HDstrcpy(Test[Index].Name, TheName); + Test[Index].SkipFlag = 0; } - else { /* skip test by default */ - HDstrcpy(Test[Index].Name, TheName+1); - Test[Index].SkipFlag = 1; + else { /* skip test by default */ + HDstrcpy(Test[Index].Name, TheName+1); + Test[Index].SkipFlag = 1; } Test[Index].Call = TheCall; Test[Index].Cleanup = Cleanup; @@ -118,7 +119,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con Index++; } - + /* * Initialize testing framework * @@ -130,8 +131,8 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con * private options. Default to NULL which means none is provided. * * Modifications: - * Albert Cheng 2004/08/17 - * Added the ProgName, private_usage and private_parser arguments. + * Albert Cheng 2004/08/17 + * Added the ProgName, private_usage and private_parser arguments. */ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_parser)(int ac, char *av[])) { @@ -140,62 +141,63 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + if (enable_error_stack == 0) + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. */ TestProgName = ProgName; - if (NULL != private_usage) - TestPrivateUsage = private_usage; - if (NULL != private_parser) - TestPrivateParser = private_parser; + if(NULL != private_usage) + TestPrivateUsage = private_usage; + if(NULL != private_parser) + TestPrivateParser = private_parser; } - + /* * Print test usage. - * First print the common test options, then the extra options if provided. + * First print the common test options, then the extra options if provided. * * Modification: - * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. + * 2004/08/18 Albert Cheng. Add TestPrivateUsage feature. */ void TestUsage(void) { - unsigned i; - - print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "" : "")); - print_func(" [-[e]x[clude] name]+ \n"); - print_func(" [-o[nly] name]+ \n"); - print_func(" [-b[egin] name] \n"); - print_func(" [-s[ummary]] \n"); - print_func(" [-c[leanoff]] \n"); - print_func(" [-h[elp]] \n"); - print_func("\n\n"); - print_func("verbose controls the amount of information displayed\n"); - print_func("exclude to exclude tests by name\n"); - print_func("only to name tests which should be run\n"); - print_func("begin start at the name of the test givin\n"); - print_func("summary prints a summary of test results at the end\n"); - print_func("cleanoff does not delete *.hdf files after execution of tests\n"); - print_func("help print out this information\n"); - if (TestPrivateUsage){ - print_func("\nExtra options\n"); - TestPrivateUsage(); - } - print_func("\n\n"); - print_func("This program currently tests the following: \n\n"); - print_func("%16s %s\n", "Name", "Description"); - print_func("%16s %s\n", "----", "-----------"); - - for (i = 0; i < Index; i++) - print_func("%16s %s\n", Test[i].Name, Test[i].Description); - - print_func("\n\n"); + unsigned i; + + print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", + TestProgName, (TestPrivateUsage ? "" : "")); + print_func(" [-[e]x[clude] name]+ \n"); + print_func(" [-o[nly] name]+ \n"); + print_func(" [-b[egin] name] \n"); + print_func(" [-s[ummary]] \n"); + print_func(" [-c[leanoff]] \n"); + print_func(" [-h[elp]] \n"); + print_func("\n\n"); + print_func("verbose controls the amount of information displayed\n"); + print_func("exclude to exclude tests by name\n"); + print_func("only to name tests which should be run\n"); + print_func("begin start at the name of the test givin\n"); + print_func("summary prints a summary of test results at the end\n"); + print_func("cleanoff does not delete *.hdf files after execution of tests\n"); + print_func("help print out this information\n"); + if (TestPrivateUsage){ + print_func("\nExtra options\n"); + TestPrivateUsage(); + } + print_func("\n\n"); + print_func("This program currently tests the following: \n\n"); + print_func("%16s %s\n", "Name", "Description"); + print_func("%16s %s\n", "----", "-----------"); + + for (i = 0; i < Index; i++) + print_func("%16s %s\n", Test[i].Name, Test[i].Description); + + print_func("\n\n"); } - + /* * Print test info. */ @@ -209,7 +211,7 @@ void TestInfo(const char *ProgName) print_func("Linked with hdf5 version %u.%u release %u\n", major, minor, release); } - + /* * Parse command line information. * argc, argv: the usual command line argument count and strings @@ -218,7 +220,7 @@ void TestInfo(const char *ProgName) * exit EXIT_FAILURE if error is encountered. * * Modification: - * 2004/08/18 Albert Cheng. Add extra_parse feature. + * 2004/08/18 Albert Cheng. Add extra_parse feature. */ void TestParseCmdLine(int argc, char *argv[]) { @@ -226,80 +228,82 @@ void TestParseCmdLine(int argc, char *argv[]) int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if(argc > 0) { - unsigned Loop; - - --argc; ++argv; - - /* Skip all tests, then activate only one. */ + if ((HDstrcmp(*argv, "-verbose") == 0) || + (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + }else{ + TestUsage(); + exit(EXIT_FAILURE); + } + } + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; + + --argc; ++argv; + + /* Skip all tests, then activate only one. */ if(!skipped_all) { for(Loop = 0; Loop < Index; Loop++) Test[Loop].SkipFlag = 1; skipped_all = TRUE; } /* end if */ - SetTest(*argv, ONLYTEST); - } /* end if */ + SetTest(*argv, ONLYTEST); + } /* end if */ else { - TestUsage(); - exit(EXIT_FAILURE); - } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) - Summary = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { - TestUsage(); - exit(EXIT_SUCCESS); + TestUsage(); + exit(EXIT_FAILURE); } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + Summary = 1; + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + TestUsage(); + exit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; + } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + exit(EXIT_FAILURE); } } - + /* * Perform Tests. */ @@ -314,10 +318,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -332,7 +336,7 @@ void PerformTests(void) print_func("All tests were successful. \n\n"); } - + /* * Display test summary. */ @@ -354,7 +358,7 @@ void TestSummary(void) print_func("\n\n"); } - + /* * Cleanup files from testing */ @@ -370,7 +374,7 @@ void TestCleanup(void) Test[Loop].Cleanup(); } - + /* * Shutdown the test infrastructure */ @@ -380,7 +384,7 @@ void TestShutdown(void) HDfree(Test); } - + /* * Retrieve the verbosity level for the testing framework */ @@ -504,16 +508,16 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } - + /* * Retrieve the number of testing errors for the testing framework */ @@ -522,7 +526,7 @@ H5_ATTR_PURE int GetTestNumErrs(void) return(num_errs); } - + /* * Increment the number of testing errors */ @@ -531,7 +535,7 @@ void IncTestNumErrs(void) num_errs++; } - + /* * Retrieve the current Test Parameters pointer. */ @@ -540,7 +544,7 @@ H5_ATTR_PURE const void *GetTestParameters(void) return(Test_parameters); } - + /* * This routine is designed to provide equivalent functionality to 'printf' * and also increment the error count for the testing framework. @@ -563,7 +567,7 @@ TestErrPrintf(const char *format, ...) return ret_value; } - + /* * Set (control) which test will be tested. * SKIPTEST: skip this test @@ -576,41 +580,41 @@ void SetTest(const char *testname, int action) unsigned Loop; switch (action){ - case SKIPTEST: - for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } - break; - case BEGINTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - case ONLYTEST: - for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) == 0) { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } - } - break; - default: - /* error */ - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); - break; + case SKIPTEST: + for (Loop = 0; Loop < Index; Loop++) + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } + break; + case BEGINTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + case ONLYTEST: + for (Loop = 0; Loop < Index; Loop++) { + if (HDstrcmp(testname, Test[Loop].Name) == 0) { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } + } + break; + default: + /* error */ + printf("*** ERROR: Unknown action (%d) for SetTest\n", action); + break; } } - + /* * Enable alarm on test execution, configurable by environment variable */ diff --git a/test/th5o.c b/test/th5o.c index 2949c4e..3ecd08b 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: th5o +* Test program: th5o * * Test public H5O functions for accessing * @@ -30,7 +30,7 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 - + /**************************************************************** ** ** test_h5o_open(): Test H5Oopen function. @@ -140,7 +140,7 @@ test_h5o_open(void) } /* test_h5o_open() */ - + /**************************************************************** ** ** test_h5o_close(): Test H5Oclose function. @@ -230,7 +230,7 @@ test_h5o_close(void) CHECK(ret, FAIL, "H5Fclose"); } - + /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -367,7 +367,7 @@ test_h5o_open_by_addr(void) VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ - + /**************************************************************** ** ** test_h5o_refcount(): Test H5O refcounting functions. @@ -378,7 +378,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -562,7 +562,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); } /* test_h5o_refcount() */ - + /**************************************************************** ** ** test_h5o_plist(): Test object creation properties @@ -756,7 +756,7 @@ test_h5o_plist(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_h5o_plist() */ - + /**************************************************************** ** ** test_h5o_link(): Test creating link to object @@ -910,7 +910,7 @@ test_h5o_link(void) HDfree(rdata); } /* end test_h5o_link() */ - + /**************************************************************** ** ** test_h5o_comment(): Test H5Oset(get)_comment functions. @@ -1083,7 +1083,7 @@ test_h5o_comment(void) } /* test_h5o_comment() */ - + /**************************************************************** ** ** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions. @@ -1242,7 +1242,7 @@ test_h5o_comment_by_name(void) } /* test_h5o_comment_by_name() */ - + /**************************************************************** ** ** test_h5o_getinfo_same_file(): Test that querying the object info for @@ -1254,7 +1254,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1382,7 +1382,7 @@ visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /**************************************************************** ** ** test_h5o_getinfo_visit(): @@ -1479,7 +1479,7 @@ test_h5o_getinfo_visit(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /**************************************************************** ** ** test_h5o(): Main H5O (generic object) testing routine. @@ -1491,21 +1491,21 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_open(); /* Test generic open function */ + test_h5o_open_by_addr(); /* Test opening objects by address */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info/2 and H5Ovisit */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info/2 and H5Ovisit */ #endif } /* test_h5o() */ - + /*------------------------------------------------------------------------- * Function: cleanup_h5o * diff --git a/test/tid.c b/test/tid.c index 8a27c3b..3587566 100644 --- a/test/tid.c +++ b/test/tid.c @@ -251,7 +251,10 @@ static int id_predefined_test(void ) testObj = HDmalloc(sizeof(int)); - /* Try to perform illegal functions on various predefined types */ + /* + * Attempt to perform public functions on various library types + */ + H5E_BEGIN_TRY testID = H5Iregister(H5I_FILE, testObj); H5E_END_TRY @@ -317,7 +320,7 @@ static int id_predefined_test(void ) H5Tclose(typeID); /* testObj was never registered as an atom, so it will not be - * automatically freed. */ + * automatically freed. */ HDfree(testObj); return 0; @@ -476,7 +479,7 @@ static int test_id_type_list(void) goto out; /* Sanity check */ - if(startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) + if((int)startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES) { /* Error condition, throw an error */ CHECK(1, 1, "H5Iregister_type"); diff --git a/test/titerate.c b/test/titerate.c index 093e8b5..696784d 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -116,7 +116,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_ return(count2 > 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end liter_cb() */ @@ -163,7 +163,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) CHECK(filespace, FAIL, "H5Screate"); for(i=0; i< NDATASETS; i++) { - sprintf(name,"Dataset %d",i); + HDsprintf(name,"Dataset %d",i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -737,7 +737,7 @@ static void test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for(i = 0; i < NDATASETS; i++) { - sprintf(name, "Dataset %d", i); + HDsprintf(name, "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); @@ -953,6 +953,7 @@ find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) searched_err->found = true; status = H5_ITER_STOP; } + return status; } /* end find_err_msg_cb() */ @@ -1077,6 +1078,6 @@ test_iterate(void) void cleanup_iterate(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tmisc.c b/test/tmisc.c index 22e1aad..47c0606 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2713,9 +2713,6 @@ test_misc15(void) fapl = H5Fget_access_plist(file); CHECK(fapl, FAIL, "H5Fget_access_plist"); - ret = H5Pclose(fapl); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2723,6 +2720,9 @@ test_misc15(void) ret = H5Fis_hdf5(MISC15_FILE); CHECK(ret, FAIL, "H5Fis_hdf5"); + ret = H5Pclose(fapl); + CHECK(ret, FAIL, "H5Pclose"); + file = H5Fopen(MISC15_FILE, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); @@ -4721,6 +4721,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4756,7 +4757,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4890,7 +4891,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -4976,7 +4977,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5021,7 +5022,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5198,7 +5199,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5247,7 +5248,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5312,7 +5313,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5410,7 +5411,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5584,7 +5585,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5637,7 +5638,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * @@ -5647,9 +5648,6 @@ test_misc(void) * * Programmer: Albert Cheng * July 2, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/test/ttime.c b/test/ttime.c index 48c9ba8..5b3436d 100644 --- a/test/ttime.c +++ b/test/ttime.c @@ -178,13 +178,13 @@ test_time_io(void) tid = H5Dget_type(dsid); CHECK(tid, FAIL, "H5Dget_type"); if( H5Tget_class (tid) == H5T_TIME) - fprintf(stderr,"datatype class is H5T_TIME\n"); + HDfprintf(stderr,"datatype class is H5T_TIME\n"); status = H5Tclose (tid); CHECK(status, FAIL, "H5Tclose"); status = H5Dread (dsid, H5T_UNIX_D32LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &timethen); CHECK(status, FAIL, "H5Dread"); -fprintf(stderr,"time written was: %s\n", HDctime(&timethen)); +HDfprintf(stderr,"time written was: %s\n", HDctime(&timethen)); status = H5Dclose(dsid); CHECK(status, FAIL, "H5Dclose"); @@ -231,6 +231,6 @@ test_time(void) void cleanup_time(void) { - remove(DATAFILE); + HDremove(DATAFILE); } diff --git a/test/tunicode.c b/test/tunicode.c index e0e1f24..5a60036 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -163,7 +163,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string) /* Fill the buffer with two copies of the UTF-8 string, each with a * terminating NULL. It will look like "abcdefg\0abcdefg\0". */ - strncpy(buf, new_string, big_len); + HDstrncpy(buf, new_string, big_len); HDstrncpy(&buf[big_len], new_string, big_len); ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT); diff --git a/test/tvlstr.c b/test/tvlstr.c index 2c552eb..5f715ce 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -32,7 +32,7 @@ #define SPACE1_DIM1 4 #define NUMP 4 -#define VLSTR_TYPE "vl_string_type" +#define VLSTR_TYPE "vl_string_type" /* Definitions for the VL re-writing test */ #define REWRITE_NDATASETS 32 @@ -94,7 +94,7 @@ void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; - *mem_used-=*(size_t *)mem; + *mem_used-=*(size_t *)((void *)mem); HDfree(mem); } /* end if */ } @@ -183,7 +183,7 @@ test_vlstrings_basic(void) /* Count the actual number of bytes used by the strings */ for(i=0,str_used=0; istring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ @@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void) } /* end if */ for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; jstring, t2->string) ) { + if(HDstrcmp(t1->string, t2->string)) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; } /* end if */ diff --git a/test/twriteorder.c b/test/twriteorder.c index 4c86636..60ee384 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -25,7 +25,6 @@ * get the same data the write has written. * * Created: Albert Cheng, 2013/8/28. -* Modified: *************************************************************/ /*********************************************************** @@ -69,18 +68,18 @@ #ifdef H5_HAVE_FORK #define DATAFILE "twriteorder.dat" -/* #define READERS_MAX 10 */ /* max number of readers */ -#define BLOCKSIZE_DFT 1024 /* 1KB */ -#define PARTITION_DFT 2048 /* 2KB */ -#define NLINKEDBLOCKS_DFT 512 /* default 512 */ -#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ -#define Hgoto_error(val) {ret_value=val; goto done;} +/* #define READERS_MAX 10 */ /* max number of readers */ +#define BLOCKSIZE_DFT 1024 /* 1KB */ +#define PARTITION_DFT 2048 /* 2KB */ +#define NLINKEDBLOCKS_DFT 512 /* default 512 */ +#define SIZE_BLKADDR 4 /* expected sizeof blkaddr */ +#define Hgoto_error(val) {ret_value=val; goto done;} /* type declarations */ typedef enum part_t { - UC_READWRITE =0, /* both writer and reader */ - UC_WRITER, /* writer only */ - UC_READER /* reader only */ + UC_READWRITE = 0, /* both writer and reader */ + UC_WRITER, /* writer only */ + UC_READER /* reader only */ } part_t; /* prototypes */ @@ -92,9 +91,9 @@ int setup_parameters(int argc, char * const argv[]); int parse_option(int argc, char * const argv[]); /* Global Variable definitions */ -const char *progname_g="twriteorder"; /* program name */ -int write_fd_g; -int blocksize_g, part_size_g, nlinkedblock_g; +const char *progname_g="twriteorder"; /* program name */ +int write_fd_g; +int blocksize_g, part_size_g, nlinkedblock_g; part_t launch_g; /* Function definitions */ @@ -103,15 +102,15 @@ part_t launch_g; void usage(const char *prog) { - fprintf(stderr, "usage: %s [OPTIONS]\n", prog); - fprintf(stderr, " OPTIONS\n"); - fprintf(stderr, " -h Print a usage message and exit\n"); - fprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); - fprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); - fprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); - fprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); - fprintf(stderr, " where N is an integer value\n"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "usage: %s [OPTIONS]\n", prog); + HDfprintf(stderr, " OPTIONS\n"); + HDfprintf(stderr, " -h Print a usage message and exit\n"); + HDfprintf(stderr, " -l w|r launch writer or reader only. [default: launch both]\n"); + HDfprintf(stderr, " -b N Block size [default: %d]\n", BLOCKSIZE_DFT); + HDfprintf(stderr, " -p N Partition size [default: %d]\n", PARTITION_DFT); + HDfprintf(stderr, " -n N Number of linked blocks [default: %d]\n", NLINKEDBLOCKS_DFT); + HDfprintf(stderr, " where N is an integer value\n"); + HDfprintf(stderr, "\n"); } /* Setup test parameters by parsing command line options. @@ -127,73 +126,73 @@ parse_option(int argc, char * const argv[]) /* suppress getopt from printing error */ opterr = 0; - while (1){ - c = getopt (argc, argv, cmd_options); - if (-1 == c) - break; - switch (c) { - case 'h': - usage(progname_g); - exit(0); - break; - case 'b': /* number of planes to write/read */ - if ((blocksize_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'n': /* number of planes to write/read */ - if ((nlinkedblock_g = atoi(optarg)) < 2){ - fprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'p': /* number of planes to write/read */ - if ((part_size_g = atoi(optarg)) <= 0){ - fprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'l': /* launch reader or writer only */ - switch (*optarg) { - case 'r': /* reader only */ - launch_g = UC_READER; - break; - case 'w': /* writer only */ - launch_g = UC_WRITER; - break; - default: - fprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); - usage(progname_g); - Hgoto_error(-1); - break; - } - printf("launch = %d\n", launch_g); - break; - case '?': - fprintf(stderr, "getopt returned '%c'.\n", c); - usage(progname_g); - Hgoto_error(-1); - default: - fprintf(stderr, "getopt returned unexpected value.\n"); - fprintf(stderr, "Unexpected value is %d\n", c); - Hgoto_error(-1); - } - } + while (1) { + c = getopt (argc, argv, cmd_options); + if (-1 == c) + break; + + switch (c) { + case 'h': + usage(progname_g); + HDexit(0); + break; + case 'b': /* number of planes to write/read */ + if ((blocksize_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'n': /* number of planes to write/read */ + if ((nlinkedblock_g = atoi(optarg)) < 2) { + HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'p': /* number of planes to write/read */ + if ((part_size_g = atoi(optarg)) <= 0) { + HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'l': /* launch reader or writer only */ + switch (*optarg) { + case 'r': /* reader only */ + launch_g = UC_READER; + break; + case 'w': /* writer only */ + launch_g = UC_WRITER; + break; + default: + HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); + usage(progname_g); + Hgoto_error(-1); + break; + } /* end inner switch */ + HDprintf("launch = %d\n", launch_g); + break; + case '?': + HDfprintf(stderr, "getopt returned '%c'.\n", c); + usage(progname_g); + Hgoto_error(-1); + default: + HDfprintf(stderr, "getopt returned unexpected value.\n"); + HDfprintf(stderr, "Unexpected value is %d\n", c); + Hgoto_error(-1); + } /* end outer switch */ + } /* end while */ /* verify partition size must be >= blocksize */ if (part_size_g < blocksize_g ){ - fprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", - blocksize_g, part_size_g); - Hgoto_error(-1); + HDfprintf(stderr, "Blocksize %d should not be bigger than partition size %d\n", blocksize_g, part_size_g); + Hgoto_error(-1); } done: /* All done. */ - return(ret_value); + return ret_value; } /* Setup parameters for the test case. @@ -209,15 +208,16 @@ int setup_parameters(int argc, char * const argv[]) /* parse options */ if (parse_option(argc, argv) < 0){ - return(-1); + return -1; } /* show parameters and return */ - printf("blocksize = %ld\n", (long)blocksize_g); - printf("part_size = %ld\n", (long)part_size_g); - printf("nlinkedblock = %ld\n", (long)nlinkedblock_g); - printf("launch = %d\n", launch_g); - return(0); + HDprintf("blocksize = %ld\n", (long)blocksize_g); + HDprintf("part_size = %ld\n", (long)part_size_g); + HDprintf("nlinkedblock = %ld\n", (long)nlinkedblock_g); + HDprintf("launch = %d\n", launch_g); + + return 0; } /* Create the test file with initial "empty" file, that is, @@ -227,19 +227,19 @@ int setup_parameters(int argc, char * const argv[]) */ int create_wo_file(void) { - int blkaddr=0; /* blkaddress of next linked block */ - int ret_code; + int blkaddr = 0; /* blkaddress of next linked block */ + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* Create the data file */ if ((write_fd_g = HDopen(DATAFILE, O_RDWR|O_TRUNC|O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) { HDprintf("WRITER: error from open\n"); return -1; } - blkaddr=0; + blkaddr = 0; /* write it to partition 0 */ - if ((ret_code=HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ - printf("blkaddr write failed\n"); - return -1; + if ((bytes_wrote = HDwrite(write_fd_g, &blkaddr, (size_t)SIZE_BLKADDR)) != SIZE_BLKADDR){ + HDprintf("blkaddr write failed\n"); + return -1; } /* File initialized, return success */ @@ -252,38 +252,45 @@ int write_wo_file(void) int blkaddr_old=0; int i; char buffer[BLOCKSIZE_DFT]; - int ret_code; + h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ /* write block 1, 2, ... */ - for (i=1; i=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } /* Close the group */ - if(H5Gclose(gid) < 0) goto error; + if(H5Gclose(gid) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (gcpl) < 0) goto error; + if(H5Pclose (gcpl_id) < 0) + goto error; - if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + /********************* + * PART 2 - DATASETS * + *********************/ - if(H5Pset_filter(dc, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) goto error; + /* Use DUMMY filter for creating datasets */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0) + goto error; + if(H5Pset_filter(dcpl_id, H5Z_FILTER_DUMMY, 0, (size_t)0, NULL) < 0) + goto error; - /* Initialize the dataset */ + /* Initialize the data for writing */ for(i = n = 0; i < DSET_DIM1; i++) for(j = 0; j < DSET_DIM2; j++) - points[i][j] = n++; + data[i][j] = n++; - /* Create the data space */ + /* Create the dataspace */ dims[0] = DSET_DIM1; dims[1] = DSET_DIM2; - if((space = H5Screate_simple(2, dims, NULL)) < 0) goto error; + if((sid = H5Screate_simple(2, dims, NULL)) < 0) + goto error; /* Create a dataset in the first file */ - if((dataset = H5Dcreate2(file1, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid1, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; /* Unregister the filter before closing the dataset. It should fail */ H5E_BEGIN_TRY { ret = H5Zunregister(H5Z_FILTER_DUMMY); } H5E_END_TRY; - if(ret>=0) { + if(ret >= 0) { H5_FAILED(); - printf(" Line %d: Should not be able to unregister filter\n", __LINE__); + HDprintf(" Line %d: Should not be able to unregister filter\n", __LINE__); goto error; - } /* end if */ + } - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset */ + if(H5Dclose(did) < 0) + goto error; /* Create a dataset in the second file */ - if((dataset = H5Dcreate2(file2, DSET_NAME, H5T_NATIVE_INT, space, - H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(fid2, DSET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + goto error; /* Write the data to the dataset */ - if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) goto error; - if(H5Dclose(dataset) < 0) goto error; + /* Close the dataset in the second file */ + if(H5Dclose(did) < 0) + goto error; /* Unregister the filter after closing all objects but before closing files. - * It should flush all files. */ - if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) goto error; + * It should flush all files. + */ + if(H5Zunregister(H5Z_FILTER_DUMMY) < 0) + goto error; /* Clean up objects used for this test */ - if(H5Pclose (dc) < 0) goto error; - if(H5Fclose(file1) < 0) goto error; - if(H5Fclose(file2) < 0) goto error; + if(H5Pclose(dcpl_id) < 0) + goto error; + if(H5Fclose(fid1) < 0) + goto error; + if(H5Fclose(fid2) < 0) + goto error; PASSED(); - return 0; + return SUCCEED; error: - return -1; + H5E_BEGIN_TRY { + H5Fclose(fid1); + H5Fclose(fid2); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Gclose(gid); + H5Gclose(gid_loop); + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; + + return FAIL; } /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Tests unregistering filter with H5Zunregister + * Function: main * - * Return: Success: exit(EXIT_SUCCESS) + * Purpose: Tests unregistering filter with H5Zunregister * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Raymond Lu - * 11 April 2013 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; - int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Testing setup */ h5_reset(); - fapl = h5_fileaccess(); + fapl_id = h5_fileaccess(); /* Push API context */ if(H5CX_push() < 0) FAIL_STACK_ERROR api_ctx_pushed = TRUE; /* Test unregistering filter in its own file */ - nerrors += (test_unregister_filters(fapl) < 0 ? 1 : 0); + nerrors += (test_unregister_filters(fapl_id) < 0 ? 1 : 0); - if(nerrors) + h5_cleanup(FILENAME, fapl_id); + + if (nerrors) goto error; - printf("All filter unregistration tests passed.\n"); + HDprintf("All filter unregistration tests passed.\n"); /* Pop API context */ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR api_ctx_pushed = FALSE; - h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); - printf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", + HDprintf("***** %d FILTER UNREGISTRATION TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(api_ctx_pushed) H5CX_pop(); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 340f578..67e2226 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -108,28 +108,28 @@ parse_option(int argc, char * const argv[]) filename_g = optarg; break; case 'n': /* number of planes to write/read */ - if ((nplanes_g = atoi(optarg)) <= 0){ + if ((nplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 's': /* use swmr file open mode */ - if ((use_swmr_g = atoi(optarg)) < 0){ + if ((use_swmr_g = HDatoi(optarg)) < 0){ fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); usage(progname_g); Hgoto_error(-1); }; break; case 'y': /* Number of planes per chunk */ - if ((chunkplanes_g = atoi(optarg)) <= 0){ + if ((chunkplanes_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'z': /* size of chunk=(z,z) */ - if ((chunksize_g = atoi(optarg)) <= 0){ + if ((chunksize_g = HDatoi(optarg)) <= 0){ fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); diff --git a/test/vds.c b/test/vds.c index fd5a431..459ca6b 100644 --- a/test/vds.c +++ b/test/vds.c @@ -378,7 +378,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR if(config == TEST_API_REOPEN_FILE) { if(oinfo.meta_size.obj.heap_size != exp_meta_size) { - printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); TEST_ERROR } } @@ -1215,11 +1215,14 @@ test_vds_prefix_first(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; @@ -1296,11 +1299,14 @@ test_vds_prefix_first(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 @@ -11451,14 +11457,14 @@ main(void) if(nerrors) goto error; - printf("All virtual dataset tests passed.\n"); + HDprintf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); - printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/vfd.c b/test/vfd.c index dfc5047..8e46850 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -66,7 +66,7 @@ const char *FILENAME[] = { #define COMPAT_BASENAME "family_v16_" #define MULTI_COMPAT_BASENAME "multi_file_v16" - + /*------------------------------------------------------------------------- * Function: test_sec2 * @@ -178,7 +178,7 @@ error: return -1; } /* end test_sec2() */ - + /*------------------------------------------------------------------------- * Function: test_core * @@ -412,8 +412,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pr++ != *pw++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -480,8 +480,8 @@ test_core(void) for(j = 0; j < CORE_DSET_DIM2; j++) if(*pw++ != *pr++) { H5_FAILED(); - printf(" Read different values than written in data set.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -534,7 +534,7 @@ error: return -1; } /* end test_core() */ - + /*------------------------------------------------------------------------- * Function: test_direct * @@ -597,7 +597,7 @@ test_direct(void) if(file<0) { H5Pclose (fapl); SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); + HDprintf(" Probably the file system doesn't support Direct I/O\n"); return 0; } @@ -674,8 +674,8 @@ test_direct(void) for(j = 0; j < DSET1_DIM2; j++) if(*p1++ != *p2++) { H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written in data set 1.\n"); + HDprintf(" At index %d,%d\n", i, j); TEST_ERROR; } /* end if */ @@ -706,8 +706,8 @@ test_direct(void) for(i = 0; i < DSET2_DIM; i++) if(wdata2[i] != rdata2[i]) { H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written in data set 2.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR; } /* end if */ @@ -754,7 +754,7 @@ error: #endif /*H5_HAVE_DIRECT*/ } - + /*------------------------------------------------------------------------- * Function: test_family_opens * @@ -769,6 +769,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'first_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 herr_t test_family_opens(char *fname, hid_t fa_pl) { @@ -825,8 +833,9 @@ test_family_opens(char *fname, hid_t fa_pl) error: return -1; } /* end test_family_opens() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_family * @@ -1008,7 +1017,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_family_compat * @@ -1027,6 +1036,14 @@ error: * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'newname_individual', etc. 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_family_compat(void) { @@ -1110,26 +1127,34 @@ error: return -1; } /* end test_family_compat() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_multi_opens * * Purpose: Private function for test_multi() to tests wrong ways of * reopening multi file. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Thursday, May 19, 2005 * *------------------------------------------------------------------------- */ +/* Disable warning for "format not a string literal" here -QAK */ +/* + * This pragma only needs to surround the snprintf() calls with + * 'sf_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 herr_t test_multi_opens(char *fname) { - hid_t file=-1; + hid_t fid = H5I_INVALID_HID; char super_name[1024]; /*name string "%%s-s.h5"*/ char sf_name[1024]; /*name string "multi_file-s.h5"*/ @@ -1138,20 +1163,20 @@ test_multi_opens(char *fname) HDsnprintf(sf_name, sizeof(sf_name), super_name, fname); H5E_BEGIN_TRY { - file = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(sf_name, H5F_ACC_RDWR, H5P_DEFAULT); } H5E_END_TRY; - return(file >= 0 ? -1 : 0); -} + return(fid >= 0 ? FAIL : SUCCEED); +} /* end test_multi_opens() */ +#pragma GCC diagnostic pop + - /*------------------------------------------------------------------------- * Function: test_multi * * Purpose: Tests the file handle interface for MUTLI driver * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1201,19 +1226,19 @@ test_multi(void) memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE; memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/4; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; @@ -1365,7 +1390,7 @@ test_multi(void) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1374,11 +1399,12 @@ error: H5Pclose(fapl); H5Pclose(fapl2); H5Fclose(file); + H5Aclose(attr); } H5E_END_TRY; - return -1; -} + return FAIL; +} /* end test_multi() */ + - /*------------------------------------------------------------------------- * Function: test_multi_compat * @@ -1432,12 +1458,12 @@ test_multi_compat(void) memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; memb_addr[H5FD_MEM_SUPER] = 0; memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; @@ -1447,17 +1473,19 @@ test_multi_compat(void) h5_fixname(FILENAME[9], fapl, newname, sizeof newname); /* Make copy for the data file in the build directory, to protect the - * original file in the source directory */ - sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); - sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); + * original file in the source directory + */ + HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's'); + HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's'); h5_make_local_copy(filename_s, newname_s); - sprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); - sprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); + HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r'); + HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r'); h5_make_local_copy(filename_r, newname_r); /* Reopen the file for read only. Verify 1.8 library can open file - * created with 1.6 library. */ + * created with 1.6 library. + */ if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; @@ -1550,7 +1578,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_log * @@ -1661,7 +1689,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_stdio * @@ -1766,7 +1794,7 @@ error: } - + /*------------------------------------------------------------------------- * Function: test_windows * @@ -1888,7 +1916,6 @@ error: } /* end test_windows() */ - /*------------------------------------------------------------------------- * Function: main * diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 29c6f4a..3004f9f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1228,7 +1228,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Get_Address() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Get_address() call failed.\n", world_mpi_rank, FUNC); } @@ -1250,7 +1250,7 @@ setup_derived_types(void) nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Type_struct() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Type_create_struct() call failed.\n", world_mpi_rank, FUNC); } } diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 1f26e0d..db5bd13 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -3683,6 +3683,8 @@ test_read_filtered_dataset_point_selection(void) if (read_buf) HDfree(read_buf); if (correct_buf) HDfree(correct_buf); + HDfree(coords); + VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Sclose(filespace) >= 0), "File dataspace close succeeded"); VRFY((H5Sclose(memspace) >= 0), "Memory dataspace close succeeded"); @@ -5791,6 +5793,9 @@ test_write_parallel_read_serial(void) VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded"); VRFY((H5Fclose(file_id) >= 0), "File close succeeded"); + + HDfree(correct_buf); + HDfree(read_buf); } return; diff --git a/testpar/t_pread.c b/testpar/t_pread.c index ac33b88..74feeb6 100644 --- a/testpar/t_pread.c +++ b/testpar/t_pread.c @@ -1079,18 +1079,11 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id) * with the opening and validation of the data contained * therein. * - * WARNING: This test uses fork() and execve(), and - * therefore will not run on Windows. - * * Return: Success: 0 - * * Failure: 1 * * Programmer: Richard Warren * 10/1/17 - * - * Modifications: - * *------------------------------------------------------------------------- */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 594bf51..3ee5393 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ -out: opts->err_stat = opts->err_stat | ret_value; /* free table */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9d5f062..2a45913 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -516,14 +516,14 @@ static hsize_t diff_datum( if (H5Tis_variable_str(m_type)) { h5difftrace("diff_datum H5T_STRING variable\n"); /* Get pointer to first string */ - s1 = *(char**) mem1; + s1 = *(char **)((void *)mem1); if (s1) size1 = HDstrlen(s1); else size1 = 0; /* Get pointer to second string */ - s2 = *(char**) mem2; + s2 = *(char **)((void *)mem2); if (s2) size2 = HDstrlen(s2); else @@ -783,12 +783,11 @@ static hsize_t diff_datum( } /* check object type */ - if (ret_value >= 0) - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); - } + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + HGOTO_DONE (opts->err_stat); + } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { opts->err_stat = 1; @@ -829,10 +828,10 @@ static hsize_t diff_datum( size = H5Tget_size(memb_type); /* get the number of sequence elements */ - nelmts = ((hvl_t *) mem1)->len; + nelmts = ((hvl_t *)((void *)mem1))->len; for (j = 0; j < nelmts; j++) - nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index, + nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members); H5Tclose(memb_type); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index d93f7b0..f103647 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1283,7 +1283,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t mem = ((unsigned char*)_mem) + block_index * size; if (H5Tis_variable_str(tid)) { - s = *(char**) mem; + s = *(char **)((void *)mem); if (s != NULL) size = HDstrlen(s); else @@ -1375,10 +1375,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; /* Get the number of sequence elements */ - nelmts = ((hvl_t *) mem)->len; + nelmts = ((hvl_t *)((void *)mem))->len; /* dump the array element */ - if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") } diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3e8f1fe..17e3f18 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -787,7 +787,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ - s = *(char**) cp_vp; + s = *(char **)((void *)cp_vp); if(s != NULL) size = HDstrlen(s); } else { @@ -1240,7 +1240,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, "%s", OPT(info->vlen_pre, "(")); /* Get the number of sequence elements */ - nelmts = ((hvl_t *) cp_vp)->len; + nelmts = ((hvl_t *)((void *)cp_vp))->len; for(i = 0; i < nelmts; i++) { if(i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK)); @@ -1264,7 +1264,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; /* Dump the array element */ - h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx); + h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *)((void *)cp_vp))->p)) + i * size, ctx); ctx->indent_level--; } /* end for */ diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e7e017f..d97b5c9 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -97,7 +97,7 @@ parallel_print(const char* format, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: error_msg * @@ -122,7 +122,7 @@ error_msg(const char *fmt, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: warn_msg * @@ -161,7 +161,7 @@ help_ref_msg(FILE *output) HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname()); } - + /*------------------------------------------------------------------------- * Function: get_option * @@ -344,7 +344,7 @@ indentation(unsigned x) } } - + /*------------------------------------------------------------------------- * Function: print_version * @@ -362,7 +362,7 @@ print_version(const char *progname) ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } - + /*------------------------------------------------------------------------- * Function: init_table * @@ -384,7 +384,7 @@ init_table(table_t **tbl) *tbl = table; } - + /*------------------------------------------------------------------------- * Function: free_table * @@ -408,7 +408,7 @@ free_table(table_t *table) } #ifdef H5DUMP_DEBUG - + /*------------------------------------------------------------------------- * Function: dump_table * @@ -429,7 +429,7 @@ dump_table(char* tablename, table_t *table) table->objs[u].displayed, table->objs[u].recorded); } - + /*------------------------------------------------------------------------- * Function: dump_tables * @@ -447,7 +447,7 @@ dump_tables(find_objs_t *info) } #endif /* H5DUMP_DEBUG */ - + /*------------------------------------------------------------------------- * Function: search_obj * @@ -470,7 +470,7 @@ search_obj(table_t *table, haddr_t objno) return NULL; } - + /*------------------------------------------------------------------------- * Function: find_objs_cb * @@ -546,7 +546,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen return ret_value; } - + /*------------------------------------------------------------------------- * Function: init_objs * @@ -591,7 +591,7 @@ done: return ret_value; } - + /*------------------------------------------------------------------------- * Function: add_obj * @@ -622,7 +622,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) table->objs[u].displayed = 0; } - + #ifndef H5_HAVE_TMPFILE /*------------------------------------------------------------------------- * Function: tmpfile diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 917d5f5..5519437 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, if(udata->is_absolute) { size_t base_len = HDstrlen(udata->base_grp_name); size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1; - size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1; + size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if(NULL == (new_name = (char*)HDmalloc(new_name_len))) return(H5_ITER_ERROR); diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index ec76511..2fa9fd0 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source) goto error; } - refbuf = (hobj_ref_t *) buf; + refbuf = (hobj_ref_t *)((void *)buf); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source) for (i = 0; i < (hsize_t)ssiz; i++) { if (is_vlstr) { - onestring = *(char **) bp; + onestring = *(char **)((void *)bp); if (onestring) str_size = HDstrlen(onestring); } diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a63e56f..e96dea5 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { hid_t did = -1; hid_t sid = -1; unsigned int i; - unsigned int uf; + int ifil; trav_table_t *travt = NULL; /* nothing to do */ @@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) { if (options->verbose) printf("...Found\n"); - for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { - if (options->op_tbl->objs[i].filter[uf].filtn < 0) + for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) { + if (options->op_tbl->objs[i].filter[ifil].filtn < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter[uf].filtn) { + switch (options->op_tbl->objs[i].filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; @@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { default: break; } - } /* for uf */ + } /* for ifil */ } /* for i */ done: diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0567269..8122d6d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -33,20 +33,6 @@ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 -/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ - H5E_BEGIN_TRY { \ - if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - hid_t _err_num = 0; \ - char _msg[80]; \ - H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ - error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - HGOTO_DONE(_fail) \ - } \ - } H5E_END_TRY; \ -} - /*------------------------------------------------------------------------- * local functions *------------------------------------------------------------------------- @@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile, #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif -static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); -/* get the major number from the error stack. */ -static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; - - return 0; -} /*------------------------------------------------------------------------- * Function: copy_objects @@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; - unsigned uf; + int ifil; int is_ref = 0; htri_t is_named; hbool_t limit_maxdims; @@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->op_tbl->objs) { for (u = 0; u < options->op_tbl->nelems; u++) { if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) { - if (options->op_tbl->objs[u].filter[uf].filtn > 0) + for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) { + if (options->op_tbl->objs[u].filter[ifil].filtn > 0) req_filter = 1; } } @@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) if (!pr) printf(FORMAT_OBJ, "dset", objname); else { - char str[255], temp[28]; + char str[512], temp[512]; HDstrcpy(str, "dset "); HDstrcat(str, strfilter); diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 3d9472a..7e32def 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ H5D_layout_t layout; int rank; /* rank of dataset */ hsize_t chsize[64]; /* chunk size in elements */ - unsigned int i; + int i; + unsigned u; /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) @@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); objout->chunk.rank = rank; - for (i = 0; i < rank; i++) - objout->chunk.chunk_lengths[i] = chsize[i]; + for (u = 0; u < (unsigned)rank; u++) + objout->chunk.chunk_lengths[u] = chsize[u]; } done: @@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest = NULL; - char *pname = NULL; - int result; + const char *pname = NULL; unsigned int i; for (i = 0; i < options->op_tbl->nelems; i++) { diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a275443..f5846ba 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -22,7 +22,7 @@ */ static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt); -static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options, +static int copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout); static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, hid_t fid_out, void *ref_out, trav_table_t *travt); @@ -81,7 +81,7 @@ int do_copy_refobjs(hid_t fidin, if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); - if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) + if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) @@ -316,7 +316,7 @@ int do_copy_refobjs(hid_t fidin, * copy referenced objects in attributes *------------------------------------------------------------------------- */ - if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0) + if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); /*------------------------------------------------------------------------- @@ -426,7 +426,6 @@ done: static int copy_refs_attr(hid_t loc_in, hid_t loc_out, - pack_opt_t *options, trav_table_t *travt, hid_t fidout) /* for saving references */ { @@ -450,7 +449,6 @@ static int copy_refs_attr(hid_t loc_in, is_ref_comp = 0; void *refbuf = NULL; void *buf = NULL; - const char *refname = NULL; unsigned *ref_comp_index = NULL; size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; @@ -604,12 +602,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> reference created to <%s>\n", name, refname); - } /* i */ } /* H5T_STD_REF_OBJ */ /* handle region references */ else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { @@ -632,12 +627,9 @@ static int copy_refs_attr(hid_t loc_in, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ - for(i = 0; i < (unsigned)nelmts; i++) { - if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0) + for(i = 0; i < (unsigned)nelmts; i++) + if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0) continue; - if(options->verbose) - printf("object <%s> region reference created to <%s>\n", name, refname); - } } /* H5T_STD_REF_DSETREG */ else if (is_ref_vlen) { /* handle VLEN of references */ @@ -700,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in, size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]); hobj_ref_t ref_out; - if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0) + if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */ continue; HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]); } /* if */ diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index ac3bbee..4f92cae 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -108,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024); #define SPACE1_DIM1 0 #define SPACE1_DIM2 0 +/* Error macros */ +#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); +#define PROGRAM_ERROR {AT(); goto error;} + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group, @@ -176,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma static void gen_datareg(hid_t fid, int make_diffs); /* utilities */ static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); -static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); +static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf); static int gen_dataset_idx(const char *file, int format); /*------------------------------------------------------------------------- @@ -284,7 +288,7 @@ int main(void) /* string dataset and attribute. HDFFV-10028 */ test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2); - return 0; + return EXIT_SUCCESS; } /*------------------------------------------------------------------------- @@ -4906,9 +4910,9 @@ out: * types. * h5diff should show non-comparable output from these common objects. *-------------------------------------------------------------------------*/ -static void test_objs_nocomparables(const char *fname1, const char *fname2) +static void +test_objs_nocomparables(const char *fname1, const char *fname2) { - herr_t status = SUCCEED; hid_t fid1 = -1; hid_t fid2 = -1; hid_t topgid1 = -1; @@ -4925,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2) * Open file(s) to add objects *------------------------------------------------------------------------*/ /* file1 */ - fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); - status = FAIL; - goto out; - } + if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* file2 */ - fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT); - if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2); - status = FAIL; - goto out; - } + if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file1 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); - goto out; - } + if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0) + PROGRAM_ERROR /* group */ - gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); - status = FAIL; - goto out; - } + if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid1 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); - goto out; - } + if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /*----------------------------------------------------------------------- * in file2 : add member objects *------------------------------------------------------------------------*/ /* parent group */ - topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (topgid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* group */ - gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); - status = FAIL; - goto out; - } + if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* committed type */ - tid2 = H5Tcopy(H5T_NATIVE_INT); - status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); - goto out; - } + if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) + PROGRAM_ERROR + if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + PROGRAM_ERROR /* dataset */ - status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2); - if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); - goto out; - } + if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0) + PROGRAM_ERROR -out: /*----------------------------------------------------------------------- * Close IDs *-----------------------------------------------------------------------*/ - if (fid1) + if(H5Fclose(fid1) < 0) + PROGRAM_ERROR + if(H5Fclose(fid2) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid1) < 0) + PROGRAM_ERROR + if(H5Gclose(topgid2) < 0) + PROGRAM_ERROR + if(H5Gclose(gid1) < 0) + PROGRAM_ERROR + if(H5Gclose(gid2) < 0) + PROGRAM_ERROR + if(H5Tclose(tid1) < 0) + PROGRAM_ERROR + if(H5Tclose(tid2) < 0) + PROGRAM_ERROR + + return; + +error: + H5E_BEGIN_TRY { H5Fclose(fid1); - if (fid2) H5Fclose(fid2); - if (topgid1) H5Gclose(topgid1); - if (topgid2) H5Gclose(topgid2); - if (gid1) H5Gclose(gid1); - if (gid2) H5Gclose(gid2); - if (tid1) H5Tclose(tid1); - if (tid2) H5Tclose(tid2); + } H5E_END_TRY; + return; } static hid_t mkstr(int size, H5T_str_t pad) @@ -8083,36 +8067,40 @@ out: * *------------------------------------------------------------------------- */ -static -int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) +static herr_t +write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf) { hid_t did = -1; hid_t sid = -1; /* create a space */ - if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) - goto out; + if((sid = H5Screate_simple(rank, dims, NULL)) < 0) + PROGRAM_ERROR /* create the dataset */ - if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto out; + if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + PROGRAM_ERROR /* write */ - if (buf) { - if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - goto out; - } + if(buf) + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + PROGRAM_ERROR /* close */ - H5Dclose(did); - H5Sclose(sid); + if(H5Dclose(did) < 0) + PROGRAM_ERROR + if(H5Sclose(sid) < 0) + PROGRAM_ERROR return SUCCEED; -out: +error: + + H5E_BEGIN_TRY { + H5Dclose(did); + H5Sclose(sid); + } H5E_END_TRY; - H5Dclose(did); - H5Sclose(sid); return FAIL; -} +} /* end write_dset() */ diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 88c8ea5..7f80c23 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -172,7 +172,7 @@ gen_enhance_files(hbool_t user) int data[NUM_ELMTS]; /* Buffer for data */ int fd = -1; /* The file descriptor ID */ int64_t eoa; /* The EOA value */ - int32_t chksum; /* The chksum value */ + uint32_t chksum; /* The chksum value */ int i = 0 , j = 0, u = 0; /* Local index variable */ /* Get a copy of the default file creation property */ diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index ce866b4..08ebfc7 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -130,7 +130,7 @@ int main(void) set = H5Dopen2(fil, setname, H5P_DEFAULT); H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); H5Dclose(set); out: @@ -151,7 +151,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); printf("Data comparison:\n" "%14s (%2d) %6f = %f\n" @@ -162,7 +162,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 2)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); printf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", @@ -172,7 +172,7 @@ out: if(mname) H5free_memory(mname); - fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); printf("\n" "Short circuit\n" " %6f = %f\n" -- cgit v0.12 From 32e1c9f89d1685572445217d1293df2dcb0eeb13 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 31 Jul 2019 10:58:26 -0500 Subject: Changes based on PR review. --- src/H5Fsuper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 8d165ec..4999565 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1855,7 +1855,7 @@ H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) /* Version bounds check */ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") /* Set the message version */ fsinfo->version = version; -- cgit v0.12 From 58d941293aa7ab7d5a824ea5951d7eff32bc1ac5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 31 Jul 2019 15:09:54 -0500 Subject: Mostly whitespace and consistent test format --- test/links.c | 3833 +++++++++++++++++++++------------------------------------- 1 file changed, 1411 insertions(+), 2422 deletions(-) diff --git a/test/links.c b/test/links.c index 371c2c5..f5b1716 100644 --- a/test/links.c +++ b/test/links.c @@ -12,9 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Friday, April 10, 1998 - * * Purpose: Tests hard, soft (symbolic) & external links. */ @@ -34,10 +31,10 @@ #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ +#include "H5FDpkg.h" /* File drivers */ +#include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -62,55 +59,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10",/* 30: */ - TMPDIR "extlinks11",/* 31: */ - TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13",/* 34: */ - TMPDIR "extlinks14",/* 35: */ - TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B",/* 46: */ - TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D",/* 49: */ - TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10", /* 30: */ + TMPDIR "extlinks11", /* 31: */ + TMPDIR "extlinks12", /* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13", /* 34: */ + TMPDIR "extlinks14", /* 35: */ + TMPDIR "extlinks15", /* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B", /* 46: */ + TMPDIR2 "extlinks21C", /* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D", /* 49: */ + TMPDIR "extlinks21E", /* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -326,43 +323,32 @@ static hid_t dcpl_g; /* for [un]minimized dataset object headers */ * path name of Unix and Windows. * * Return: void - * - * Programmer: Raymond Lu - * 14 Jan. 2009 *------------------------------------------------------------------------- */ static void fix_ext_filename(char *path_name, char *cwd, const char *file_name) { HDstrcpy(path_name, cwd); - HDstrcat(path_name, "/"); HDstrcat(path_name, file_name); } /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * * Purpose: Build a file with assorted links. * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: - * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int mklinks(hid_t fapl, hbool_t new_format) { hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -399,10 +385,10 @@ mklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -412,14 +398,7 @@ mklinks(hid_t fapl, hbool_t new_format) * Purpose: Build a file with assorted links for different locations. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Friday, April 19, 2002 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -429,8 +408,8 @@ new_links(hid_t fapl, hbool_t new_format) hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); hid_t scalar=(-1); hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; - hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; if(new_format) TESTING("H5Lcreate functions (w/new group format)") @@ -488,7 +467,7 @@ new_links(hid_t fapl, hbool_t new_format) if(H5Fclose(file_b) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -502,36 +481,29 @@ new_links(hid_t fapl, hbool_t new_format) H5Fclose(file_a); H5Fclose(file_b); } H5E_END_TRY; - return -1; + return FAIL; } /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * * Purpose: Open the file created in the first step and check that the - * links look correct. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: + * links look correct. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +518,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -573,83 +545,83 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -659,10 +631,10 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -673,20 +645,15 @@ error: * links look correct. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Thursday, April 25, 2002 - * *------------------------------------------------------------------------- */ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -698,34 +665,31 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -735,25 +699,18 @@ error: * Purpose: Build a file with long names * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, April 16, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ - char *objname = NULL; /* Name of object [Long] */ - size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t gid2 = -1; /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -792,7 +749,7 @@ long_links(hid_t fapl, hbool_t new_format) HDfree(objname); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -801,7 +758,7 @@ long_links(hid_t fapl, hbool_t new_format) H5Fclose (fid); } H5E_END_TRY; HDfree(objname); - return -1; + return FAIL; } @@ -811,23 +768,16 @@ long_links(hid_t fapl, hbool_t new_format) * Purpose: Build a file with too many symbolic links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +867,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -940,7 +890,7 @@ toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -948,7 +898,7 @@ toomany(hid_t fapl, hbool_t new_format) H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end toomany() */ @@ -959,26 +909,20 @@ toomany(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_lcpl(hid_t fapl, hbool_t new_format) { - hid_t file_id=-1; - hid_t group_id=-1; - hid_t space_id=-1; - hid_t dset_id=-1; - hid_t type_id=-1; - hid_t lcpl_id=-1; - H5L_info_t linfo; - char filename[1024]; - hsize_t dims[2]; + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info_t linfo; + char filename[1024]; + hsize_t dims[2]; if(new_format) TESTING("link creation property lists (w/new group format)") @@ -1097,7 +1041,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1118,22 +1062,15 @@ error: * Purpose: Tests H5Lmove() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1142,11 +1079,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1154,99 +1089,75 @@ test_move(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Move a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a soft link across files. Should succeed. */ - if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move an external link across files. Should succeed. */ - if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) - TEST_ERROR + if( H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is no longer in the original location */ H5E_BEGIN_TRY { moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ - if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ - if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ - if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is in no previous locations */ H5E_BEGIN_TRY { - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR } H5E_END_TRY; H5Gclose(grp_1); @@ -1256,17 +1167,17 @@ test_move(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1278,21 +1189,14 @@ test_move(hid_t fapl, hbool_t new_format) * Purpose: Tests H5Lcopy() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; char filename[1024]; if(new_format) @@ -1302,11 +1206,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1314,111 +1216,76 @@ test_copy(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a soft link across files. Should succeed. */ - if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Copy an external link across files. Should succeed. */ - if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ - if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ - if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ - if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR H5Gclose(grp_1); H5Gclose(grp_2); @@ -1427,17 +1294,17 @@ test_copy(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1451,12 +1318,6 @@ test_copy(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1604,13 +1465,13 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; @@ -1625,12 +1486,6 @@ error: * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Wednesday, April 26 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1756,7 +1611,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1775,25 +1630,18 @@ error: * Purpose: Build a file with external link to root group in external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, May 25, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; const char *file; /* File from external link */ const char *path; /* Path from external link */ @@ -1824,21 +1672,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,28 +1696,27 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1941,15 +1788,15 @@ external_link_root(hid_t fapl, hbool_t new_format) H5F_sfile_assert_num(0); PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_root() */ @@ -1960,24 +1807,17 @@ external_link_root(hid_t fapl, hbool_t new_format) * external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2049,15 +1889,15 @@ external_link_path(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_path() */ @@ -2068,26 +1908,19 @@ external_link_path(hid_t fapl, hbool_t new_format) * external file links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1, fid2 = -1; /* File IDs */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2213,15 +2046,15 @@ external_link_mult(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_mult() */ @@ -2231,26 +2064,19 @@ external_link_mult(hid_t fapl, hbool_t new_format) * Purpose: Build a file with external link to itself * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Wednesday, July 12, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lcpl_id = -1; /* Link Creation Property List ID */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2311,8 +2137,8 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ /* Create file2 with an external link to file1 */ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -2336,7 +2162,6 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Close file1 */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -2361,16 +2186,16 @@ external_link_self(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Pclose(lcpl_id); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_self() */ @@ -2401,11 +2226,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2417,7 +2242,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2432,7 +2257,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2444,7 +2269,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2465,7 +2290,6 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -2484,15 +2308,15 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_pingpong() */ @@ -2523,24 +2347,17 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) * file1:/link17 -> file2: /final * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 8, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2575,7 +2392,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2596,16 +2413,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2628,15 +2445,15 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_toomany() */ @@ -2647,23 +2464,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) * missing files and missing objects. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t rid = (-1); /* Root Group ID */ - hid_t status = (-1); /* Status */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t rid = -1; /* Root Group ID */ + hid_t status = -1; /* Status */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -2677,7 +2487,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create dangling external links */ if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2687,26 +2497,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file (for dangling object test) */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Get root group ID */ - if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2524,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2736,14 +2546,14 @@ external_link_dangling(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_dangling() */ @@ -2751,32 +2561,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t gapl_id = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2796,8 +2600,8 @@ external_link_prefix(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2805,7 +2609,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file (without the absolute path) */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2821,9 +2625,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2831,14 +2635,14 @@ external_link_prefix(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_prefix() */ @@ -2846,25 +2650,19 @@ external_link_prefix(hid_t fapl, hbool_t new_format) * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -2925,14 +2723,14 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abs_mainpath() */ @@ -2940,25 +2738,19 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) * Function: external_link_rel_mainpath: test 4 * * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -2980,8 +2772,8 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2989,7 +2781,7 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3001,9 +2793,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3011,45 +2803,37 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_rel_mainpath() */ /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory - * + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 3. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via current working directory(w/new group format)") @@ -3093,9 +2877,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3103,46 +2887,39 @@ external_link_cwd(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_cwd() */ - /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's absolute path (w/new group format)") @@ -3175,7 +2952,6 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3189,9 +2965,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3199,39 +2975,33 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar() */ /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -3256,7 +3026,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3269,7 +3039,6 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3283,9 +3052,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3293,14 +3062,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar_cur() */ @@ -3308,25 +3077,19 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -3339,8 +3102,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name: "tmp/extlinks8" */ /* set up name for external linked target file: "tmp/extlinks8" */ @@ -3363,9 +3125,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3373,14 +3135,14 @@ external_link_reltar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_reltar() */ @@ -3396,19 +3158,13 @@ external_link_reltar(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -3424,8 +3180,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name ("tmp/extlinks9") */ h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); @@ -3438,9 +3193,8 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3460,9 +3214,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3470,14 +3224,14 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_chdir() */ @@ -3485,10 +3239,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. + * different from the parent can be successfully opened. * * 1. target link: "extlinks16" - * 2. target file: "extlinks16" + * 2. target file: "extlinks16" * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" * 4. Create target file A to be a "family" file: extlinks16A * 4. Create target file B to be a "multi" file: extlinks16B @@ -3499,12 +3253,6 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -3514,18 +3262,18 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) hid_t fidA=(-1), fidB=(-1); hid_t gidA=(-1), gidB=(-1); hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hid_t fam_fapl=-1, multi_fapl=-1; hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][64]; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,7 +3281,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: @@ -3545,8 +3293,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "family" fapl */ fam_fapl = h5_fileaccess(); - if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) - TEST_ERROR; + if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; /* set up name for external linked target file A: "extlinks16A" */ /* set up name for target file A: "extlinks16A" */ @@ -3560,8 +3307,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3595,8 +3342,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "multi" fapl */ multi_fapl = h5_fileaccess(); - if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) - TEST_ERROR; + if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) TEST_ERROR; /* set up name for external linked target file B: "extlinks16B" */ /* set up name for target file B: "extlinks16B" */ @@ -3620,11 +3366,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file A:/A */ - if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create external link to target file B:/B */ - if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3379,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3393,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3664,21 +3408,21 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl1() */ @@ -3686,45 +3430,39 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. * * 1. target link: "extlinks17" * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 7. Should succeed in opening the target dataset: ext_link + * 8. Write data to the target dataset + * 9. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hsize_t dims[2]; - int points[NUM40][NUM40]; + hid_t gid = (-1); /* Group IDs */ + hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hsize_t dims[2]; + int points[NUM40][NUM40]; + int i, j, n; h5_stat_size_t filesize, new_filesize; - int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3474,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3744,8 +3482,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR /* set up name for external linked target file: "extlinks17" */ /* set up name for target file: "extlinks17" */ @@ -3768,8 +3505,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ - if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3785,12 +3521,10 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ - if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* create fapl to be a "core" file without backing store */ - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR /* Set file access property list for link access to use the "core" driver */ if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR @@ -3810,8 +3544,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) points[i][j] = n++; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR if(H5Pclose(dapl_id) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -3825,20 +3558,20 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pclose(core_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl2() */ @@ -3846,17 +3579,17 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl * 10. Verify that the copied link access's fapl is the core driver * 11. Get the fapl property value of the copied link access * 12. H5Premove() the fapl property from the copied link access @@ -3865,18 +3598,12 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl3(hbool_t new_format) { - hid_t core_fapl = -1, stdio_fapl = -1; + hid_t core_fapl = -1, stdio_fapl = -1; hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) @@ -3886,12 +3613,10 @@ external_set_elink_fapl3(hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR stdio_fapl = h5_fileaccess(); - if(H5Pset_fapl_stdio(stdio_fapl) < 0) - TEST_ERROR + if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR /* Set file access property list for link access to use the "stdio" driver */ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3932,9 +3657,9 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pclose(stdio_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(l_fapl); H5Pclose(lapl_id); @@ -3942,7 +3667,7 @@ external_set_elink_fapl3(hbool_t new_format) H5Pclose(core_fapl); H5Pclose(stdio_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl3() */ @@ -3953,12 +3678,6 @@ external_set_elink_fapl3(hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4153,9 +3872,9 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Gclose(subgroup); @@ -4163,7 +3882,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo H5Fclose(file2); H5Pclose(gapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_acc_flags() */ @@ -4174,12 +3893,6 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ /* User data structure for callback function */ @@ -4217,7 +3930,7 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, if (op_data->code == 2) *flags = H5F_ACC_DEFAULT; - return 0; + return SUCCEED; } /* Main test function */ @@ -4226,7 +3939,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver; set_elink_cb_t op_data, - *op_data_p; + *op_data_p; H5L_elink_traverse_t cb; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -4319,9 +4032,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Fclose(file1); @@ -4330,7 +4043,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) H5Pclose(ret_fapl); H5Pclose(fam_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_cb() */ @@ -4342,12 +4055,6 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Apr. 9, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4385,13 +4092,13 @@ external_reset_register(void) if(HDremove(filename) != 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_reset_register() */ @@ -4401,31 +4108,25 @@ external_reset_register(void) * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" - * 2. main file: "extlinks0" - * 3. target file: "extlinks10" - * Should be able to find the target file via main file's current drive/rel path + * 1. target link: "/CWD/tmp/extlinks10" + * 2. main file: "extlinks0" + * 3. target file: "extlinks10" + * Should be able to find the target file via main file's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") @@ -4455,7 +4156,6 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4469,9 +4169,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4479,14 +4179,14 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win1() */ @@ -4495,30 +4195,24 @@ external_link_win1(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") @@ -4563,9 +4257,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4573,14 +4267,14 @@ external_link_win2(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win2() */ @@ -4589,30 +4283,24 @@ external_link_win2(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April i15 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4656,9 +4344,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4666,45 +4354,39 @@ external_link_win3(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win3() */ /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" + * 1. target link: ":extlinks13" * 2. main file: ":tmp/extlinks0" * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4724,16 +4406,15 @@ external_link_win4(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4745,9 +4426,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4755,14 +4436,14 @@ external_link_win4(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win4() */ @@ -4771,31 +4452,25 @@ external_link_win4(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)") @@ -4831,7 +4506,6 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4845,9 +4519,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,14 +4529,14 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win5() */ @@ -4871,30 +4545,24 @@ external_link_win5(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4921,16 +4589,15 @@ external_link_win6(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[36], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4942,9 +4609,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4952,14 +4619,14 @@ external_link_win6(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win6() */ @@ -4970,7 +4637,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4979,8 +4646,8 @@ external_link_win6(hid_t fapl, hbool_t new_format) static int external_link_win7(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5015,7 +4682,6 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5039,14 +4705,14 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win7() */ @@ -5057,7 +4723,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\:\CWD\extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" - * Should be able to access the target file directly (abs drive/abs path) + * Should be able to access the target file directly (abs drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -5067,9 +4733,9 @@ external_link_win7(hid_t fapl, hbool_t new_format) static int external_link_win8(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5084,12 +4750,10 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* create tmp directory */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target link: ":\CWD\extlinks10" */ drive = HDgetdrive(); @@ -5107,7 +4771,6 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5131,14 +4794,14 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win8() */ @@ -5149,7 +4812,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -5158,13 +4821,13 @@ external_link_win8(hid_t fapl, hbool_t new_format) static int external_link_win9(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)") @@ -5174,8 +4837,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ @@ -5194,7 +4856,6 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5218,14 +4879,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win9() */ #endif /* H5_HAVE_WINDOW_PATH */ @@ -5238,20 +4899,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5262,7 +4917,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create recursive external links */ if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -5270,33 +4925,31 @@ external_link_recursive(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_recursive() */ @@ -5308,25 +4961,19 @@ external_link_recursive(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5339,7 +4986,7 @@ external_link_query(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link */ /* (add a few extra '/'s to make certain library normalizes external link object names) */ @@ -5349,16 +4996,16 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create object to link to */ if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -5367,7 +5014,6 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -5375,9 +5021,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5393,9 +5039,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5406,27 +5052,27 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_query() */ @@ -5437,17 +5083,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -5479,9 +5121,6 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5504,7 +5143,7 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5512,7 +5151,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_compact() */ @@ -5523,25 +5162,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("unlinking external link in dense group (w/new group format)") @@ -5606,9 +5241,6 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5650,7 +5282,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5658,7 +5290,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_dense() */ @@ -5669,20 +5301,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, December 5, 2005 - * *------------------------------------------------------------------------- - */ -static int -external_link_move(hid_t fapl, hbool_t new_format) -{ - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + */ +static int +external_link_move(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5712,9 +5340,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Move external link to different name within same group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5798,7 +5424,6 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Move external link back to original group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5841,7 +5466,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5849,7 +5474,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_move() */ @@ -5861,25 +5486,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("external link along for the ride (w/new group format)") @@ -6026,7 +5647,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6035,7 +5656,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_ride() */ @@ -6047,10 +5668,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Wednesday, August 16, 2006 - * *------------------------------------------------------------------------- */ static int @@ -6060,11 +5677,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6254,7 +5871,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6268,7 +5885,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* external_link_closing() */ @@ -6281,19 +5898,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lapl_id = (-1); /* Prop List ID */ - const char *pathbuf = H5_get_srcdir(); /* Path to the files */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lapl_id = -1; /* Prop List ID */ + const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; if(new_format) @@ -6335,7 +5948,7 @@ external_link_endian(hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6343,7 +5956,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } @@ -6355,10 +5968,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, March 5, 2007 - * *------------------------------------------------------------------------- */ static int @@ -6368,7 +5977,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6417,7 +6026,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) if(H5Pclose(my_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6428,7 +6037,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_strong() */ @@ -6440,10 +6049,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Nov. 23, 2009 - * *------------------------------------------------------------------------- */ static int @@ -6452,17 +6057,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6518,7 +6123,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); - /* Create file #1 in current directory */ if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6528,7 +6132,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(file2) < 0) TEST_ERROR @@ -6548,7 +6151,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #2 */ if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6564,7 +6166,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #3 */ if(H5Fclose(file3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6580,7 +6181,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #4 */ if(H5Fclose(file4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6591,7 +6191,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #5 */ if(H5Fclose(file5) < 0) TEST_ERROR - /* Actual tests... */ /* Reopen file #1 */ @@ -6616,17 +6215,16 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group5); H5Gclose(group4); @@ -6638,12 +6236,12 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; - return -1; + return FAIL; #else /* H5_HAVE_SYMLINK */ SKIPPED(); HDputs(" Current file system or operating system doesn't support symbolic links"); - return 0; + return SUCCEED; #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ @@ -6658,18 +6256,14 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_copy_invalid_object(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t ocpyplid = (-1); /* Object copy plist ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t ocpyplid = -1; /* Object copy plist ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6708,7 +6302,7 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) if(H5Pclose(ocpyplid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6717,7 +6311,7 @@ error: H5Pclose(ocpyplid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_copy_invalid_object */ @@ -6730,18 +6324,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_dont_fail_to_source(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t oid = (-1); /* Object ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t oid = -1; /* Object ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6772,7 +6362,7 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6781,7 +6371,7 @@ error: H5Fclose(fid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_dont_fail_to_source */ @@ -6794,21 +6384,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Thursday, January 13, 2011 - * *------------------------------------------------------------------------- */ static int external_file_cache(hid_t fapl, hbool_t new_format) { - hid_t my_fapl = (-1); /* Temporary FAPL */ - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t fid3 = (-1); /* File ID */ - hid_t fid4 = (-1); /* File ID */ - hid_t oid = (-1); /* Object ID */ + hid_t my_fapl = -1; /* Temporary FAPL */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t fid3 = -1; /* File ID */ + hid_t fid4 = -1; /* File ID */ + hid_t oid = -1; /* Object ID */ unsigned efc_size; char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -6827,333 +6413,229 @@ external_file_cache(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4); /* Verify that the default EFC size is 0 */ - if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 0) FAIL_PUTS_ERROR("default external file cache size is not 0") /* Copy FAPL and enable external file caching */ - if((my_fapl = H5Pcopy(fapl)) < 0) - TEST_ERROR - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR /* Verify that the external file cache size has been set */ - if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 8) FAIL_PUTS_ERROR("external file cache size different from expected") - - /* - * Test 1: One file caches another - */ + /* Test 1: One file caches another */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: One file caches another, release parent's EFC - */ + /* Test 2: One file caches another, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only the parent file is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: "Y" shaped tree - */ + /* Test 3: "Y" shaped tree */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: "Y" shaped tree, release parent's EFC - */ + /* Test 4: "Y" shaped tree, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - /* - * Test 5: 3 file cycle - */ + /* Test 5: 3 file cycle */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 6: 3 file cycle, release parent's EFC - */ + /* Test 6: 3 file cycle, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); @@ -7162,7 +6644,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) H5Pclose(my_fapl); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7174,7 +6656,7 @@ error: H5Pclose(my_fapl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_file_cache */ @@ -7186,21 +6668,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Saturday, April 30, 2011 - * *------------------------------------------------------------------------- */ static int external_open_twice(hid_t fapl, hbool_t new_format) { - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t oid1 = (-1); /* Object ID */ - hid_t oid2 = (-1); /* Object ID */ - hid_t type = (-1); /* Datatype ID */ - hid_t space = (-1); /* Dataspace ID */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t oid1 = -1; /* Object ID */ + hid_t oid2 = -1; /* Object ID */ + hid_t type = -1; /* Datatype ID */ + hid_t space = -1; /* Dataspace ID */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -7213,192 +6691,123 @@ external_open_twice(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - - /* - * Test 1: Open root group twice - */ + /* Test 1: Open root group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: Open group twice - */ + /* Test 2: Open group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target group */ - if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - TEST_ERROR - if(H5Gclose(oid1) < 0) - TEST_ERROR + if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(oid1) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: Open dataset twice - */ + /* Test 3: Open dataset twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target dataset */ - if((space = H5Screate(H5S_SCALAR)) < 0) - TEST_ERROR - if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(oid1) < 0) - TEST_ERROR - if(H5Sclose(space) < 0) - TEST_ERROR + if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(oid1) < 0) TEST_ERROR + if(H5Sclose(space) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: Open datatype twice - */ + /* Test 4: Open datatype twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target datatype */ - if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) - TEST_ERROR - if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) - < 0) - TEST_ERROR - if(H5Tclose(type) < 0) - TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7410,7 +6819,7 @@ error: H5Sclose(space); } H5E_END_TRY - return -1; + return FAIL; } /* end external_open_twice() */ @@ -7437,23 +6846,23 @@ static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ char filename1[NAME_BUF_SIZE]; /* File name for main file */ char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7464,209 +6873,157 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - /* Main file */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create external link from main file to target file */ - if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - + if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create target file */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create group in target file */ - if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid2) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid2) < 0) - FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a copy of integer datatype */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Commit the datatype to the main file root group */ - if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR + if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR + if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR /* Attach an attribute with the committed datatype to the group */ - if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write data to the attribute */ - if(H5Awrite(aid, tid, &wdata) < 0) - FAIL_STACK_ERROR + if(H5Awrite(aid, tid, &wdata) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Create a chunked dataset */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) - FAIL_STACK_ERROR + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR if (dcpl_g == H5P_DEFAULT) dcpl = H5Pcreate(H5P_DATASET_CREATE); else dcpl = H5Pcopy(dcpl_g); if (0 > dcpl) FAIL_STACK_ERROR - if(H5Pset_chunk(dcpl, 2, chunks) < 0) - FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ - if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write to the dataset */ - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - FAIL_STACK_ERROR + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the dataset creation property list */ - if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Close the dataspaces */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - if(H5Sclose(sid2) < 0) - FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - + if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR /* Open the mainfile */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open the committed datatype in the mainfile */ - if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify the datatype is committed */ - if(H5Tcommitted(tid) == FALSE) - FAIL_STACK_ERROR + if(H5Tcommitted(tid) == FALSE) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open the attribute attached to the group */ - if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the attribute's datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Delete the attribute */ - if(H5Adelete(gid1, "myAttribute") < 0) - FAIL_STACK_ERROR + if(H5Adelete(gid1, "myAttribute") < 0) FAIL_STACK_ERROR /* Open the dataset in the group */ - if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the dataset's datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Read the dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR /* Compare the data read should be the same as wbuf */ - if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) - FAIL_STACK_ERROR + if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7685,10 +7042,10 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_link_with_committed_datatype() */ @@ -7700,10 +7057,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD hard links. */ @@ -7769,7 +7122,7 @@ done: case H5I_ERROR_STACK: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7786,7 +7139,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, hid_t ret_value = -1; if(udata_size != sizeof(haddr_t)) - return -1; + return FAIL; addr = *((const haddr_t *) udata); @@ -7857,7 +7210,7 @@ done: case H5I_ERROR_STACK: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7879,12 +7232,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7918,7 +7271,6 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined "hard link" to the group using the address we got * from H5Lget_info */ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -7956,9 +7308,9 @@ ud_hard_links(hid_t fapl) /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be @@ -7985,15 +7337,15 @@ ud_hard_links(hid_t fapl) if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_hard_links() */ @@ -8005,10 +7357,6 @@ ud_hard_links(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* A traversal function that ignores any udata and simply opens an object @@ -8026,7 +7374,7 @@ UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_rereg_traverse() */ /* This link class has the same ID number as the UD hard links but @@ -8046,23 +7394,23 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - h5_stat_size_t empty_size; /* Size of an empty file */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Get the size of the empty file for reference */ if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -8101,9 +7449,9 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + TEST_ERROR } H5E_END_TRY /* Register a new kind of link with the same ID number */ @@ -8171,15 +7519,15 @@ ud_link_reregister(hid_t fapl) if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_reregister() */ @@ -8191,10 +7539,6 @@ ud_link_reregister(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD "callback" links. */ @@ -8212,10 +7556,10 @@ UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_create() */ static hid_t @@ -8239,7 +7583,7 @@ UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, return ret_value; error: - return -1; + return FAIL; } /* end UD_cb_traverse() */ /* Callback for when the link is moved or renamed */ @@ -8255,10 +7599,10 @@ UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8274,10 +7618,10 @@ UD_cb_delete(const char *link_name, hid_t file, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_delete() */ /* Callback for when the link is queried */ @@ -8301,7 +7645,7 @@ UD_cb_query(const char * link_name, const void *udata, size_t udata_size, return 16; error: - return -1; + return FAIL; } /* end UD_cb_query() */ const H5L_class_t UD_cb_class[1] = {{ @@ -8319,12 +7663,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t lcpl = (-1); /* Link Creation PL */ - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8347,8 +7691,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) * no problems. */ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Register user-defined link class. This is the one we'll actually - * be using. */ + /* Register user-defined link class. This is the one we'll actually be using. */ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR /* Check that registered link classes are, and unregistered ones aren't */ @@ -8390,7 +7733,6 @@ ud_callbacks(hid_t fapl, hbool_t new_format) /* Remove UD link */ if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Test that the callbacks don't work if the link class is not registered */ /* Create a new link. Just for fun, give it a non-default character @@ -8428,7 +7770,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8436,7 +7778,7 @@ error: H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_callbacks() */ @@ -8448,10 +7790,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static hid_t @@ -8467,13 +7805,12 @@ UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, /* Get the name of the target from the property list. */ if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) TEST_ERROR return ret_value; error: - return -1; + return FAIL; } /* end UD_plist_traverse() */ const H5L_class_t UD_plist_class[1] = {{ @@ -8491,12 +7828,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist_id = -1; /* Property List ID */ + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8567,16 +7904,16 @@ lapl_udata(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose (plist_id); H5Gclose (gid); H5Gclose (gid2); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_udata() */ @@ -8588,10 +7925,6 @@ lapl_udata(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -8599,10 +7932,9 @@ UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { /* Check to make sure that this "soft link" has a target */ - if(udata_size < 1 || !udata) - return -1; + if(udata_size < 1 || !udata) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbsucc_create() */ static hid_t @@ -8620,7 +7952,7 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_cbsucc_traverse() */ /* Failure callback for when the link is moved or renamed */ @@ -8629,7 +7961,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_move() */ /* SuccessCallback for when the link is moved or renamed */ @@ -8638,7 +7970,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always succeed. */ - return 0; + return SUCCEED; } /* end UD_cbsucc_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8647,7 +7979,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This callback will always succeed */ - return 0; + return SUCCEED; } /* end UD_cbsucc_delete() */ /* Callback for when the link is deleted. Also called during move */ @@ -8657,7 +7989,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file { /* This traversal function will always fail. */ /* Note: un-deletable links are in general a very bad idea! */ - return -1; + return FAIL; } /* end UD_cbfail_delete() */ /* Callback for when the link is queried */ @@ -8666,7 +7998,7 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_query() */ /* Callback for when the link is queried */ @@ -8679,10 +8011,9 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT * fails */ - if(buf != NULL) - return -1; + if(buf != NULL) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbfail_on_write_query() */ /* Callback for when the link is queried */ @@ -8789,12 +8120,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8807,10 +8138,10 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to register some invalid link classes */ H5E_BEGIN_TRY { - if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR } H5E_END_TRY /* Register the UD plist class. */ @@ -8825,18 +8156,10 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to create internally defined links with H5Lcreate_ud */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY - /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ - H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - } H5E_END_TRY; - /* Create a user-defined link to the group. */ strcpy(group_name, "/group"); if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -8902,14 +8225,14 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_errors() */ @@ -8920,28 +8243,21 @@ error: * by the user using the Link Access Property List. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ - hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ - hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -8956,7 +8272,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create group with short name in file (used as target for links) */ if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -8985,7 +8301,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create LAPL with higher-than-usual nlinks value */ /* Create a non-default lapl with udata set to point to the first group */ @@ -9039,7 +8355,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR if(HDstrcmp(objname, "/soft4")) TEST_ERROR - /* Test other functions that should use a LAPL */ nlinks = 20; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR @@ -9072,7 +8387,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Close plist */ if(H5Pclose(plist) < 0) TEST_ERROR - /* Create a datatype and dataset as targets inside the group */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9131,9 +8445,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(gapl); H5Pclose(dapl); @@ -9146,7 +8460,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) H5Pclose(plist); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_nlinks() */ @@ -9157,21 +8471,17 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t tid = (-1); /* Type ID */ - hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9224,16 +8534,16 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Tclose (tid); H5Dclose (did); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end linkinfo() */ @@ -9249,10 +8559,6 @@ linkinfo(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Thursday, August 17, 2006 - * *------------------------------------------------------------------------- */ static int @@ -9272,8 +8578,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) * To check this, try to create every file used in this test. If * a file is already open, creating it will fail. */ - for(x=0; FILENAME[x] != NULL && x < stopat; x++) - { + for(x=0; FILENAME[x] != NULL && x < stopat; x++) { h5_fixname(FILENAME[x], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -9281,17 +8586,15 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end check_all_closed() */ - - /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9299,10 +8602,6 @@ error: * * Return: Success: >0, File ID for file built * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static hid_t @@ -9310,9 +8609,9 @@ build_visit_file(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - hid_t sid = (-1); /* Dataspace ID */ - hid_t did = (-1); /* Dataset ID */ - hid_t tid = (-1); /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hid_t tid = -1; /* Datatype ID */ char filename[NAME_BUF_SIZE]; const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ @@ -9331,7 +8630,6 @@ build_visit_file(hid_t fapl) if(H5Gclose(gid2) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - /* Create soft links to groups created */ if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9339,7 +8637,6 @@ build_visit_file(hid_t fapl) /* Create dangling soft link */ if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create hard links to all groups */ if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9388,7 +8685,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end build_visit_file() */ @@ -9399,15 +8696,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, - void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -9429,10 +8721,6 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9462,7 +8750,6 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9476,19 +8763,18 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit() */ @@ -9499,10 +8785,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9532,7 +8814,6 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; @@ -9554,19 +8835,18 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit_by_name() */ @@ -9577,15 +8857,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, - void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9607,10 +8882,6 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9640,7 +8911,6 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9654,19 +8924,18 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit() */ @@ -9677,10 +8946,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9710,7 +8975,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; @@ -9722,7 +8986,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -9733,19 +8996,18 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_by_name() */ @@ -9755,15 +9017,10 @@ error: * Purpose: Callback routine for visiting objects in a file * * Return: 1 (H5_ITER_STOP) - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, - void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9782,10 +9039,6 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int @@ -9815,7 +9068,7 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) /* Same test with H5Ovisit_by_name */ nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9823,13 +9076,13 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_stop() */ @@ -9841,10 +9094,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Tuesday, June 16, 2009 - * *------------------------------------------------------------------------- */ static enum { @@ -9857,14 +9106,11 @@ static enum { static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 1; + if(link_filter_state >= LFS_ENCODED) return 1; - if(link_filter_state != LFS_INIT) - return -1; + if(link_filter_state != LFS_INIT) return -1; link_filter_state = LFS_CAN_APPLY_CALLED; @@ -9873,14 +9119,11 @@ static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 0; + if(link_filter_state >= LFS_ENCODED) return 0; - if(link_filter_state != LFS_CAN_APPLY_CALLED) - return -1; + if(link_filter_state != LFS_CAN_APPLY_CALLED) return -1; link_filter_state = LFS_SET_LOCAL_CALLED; @@ -9891,19 +9134,16 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { - if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) - return 0; + if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0; - if(link_filter_state == LFS_DECODED) - return nbytes; + if(link_filter_state == LFS_DECODED) return nbytes; if(flags & H5Z_FLAG_REVERSE) { - if(link_filter_state != LFS_ENCODED) - return 0; + if(link_filter_state != LFS_ENCODED) return 0; link_filter_state = LFS_DECODED; - } else { - if(link_filter_state < LFS_SET_LOCAL_CALLED) - return 0; + } + else { + if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0; link_filter_state = LFS_ENCODED; } /* end else */ @@ -9924,7 +9164,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -9942,8 +9182,7 @@ link_filters(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create gcpl, force use of dense storage */ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR @@ -9971,8 +9210,7 @@ link_filters(hid_t fapl, hbool_t new_format) filter_class.set_local = link_filter_set_local; filter_class.filter = link_filter_filter; if(H5Zregister(&filter_class) < 0) TEST_ERROR - if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR nfilters++; /* Test various other filter functions for use on gcpl's */ @@ -9980,14 +9218,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR /* Create a group using this filter, add some soft links to it */ - if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10011,12 +9245,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pclose(gcpl2) < 0) TEST_ERROR /* Add another soft link */ - if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy the group */ - if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR /* Verify that all links have been copied */ @@ -10045,10 +9277,8 @@ link_filters(hid_t fapl, hbool_t new_format) /* Reopen file and group, add 2 links */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10059,34 +9289,27 @@ link_filters(hid_t fapl, hbool_t new_format) /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, - &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Pmodify_filter */ cd_value++; - if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Premove_filter */ if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR @@ -10112,8 +9335,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR /* Create new group, with missing intermediate groups, in compressed group */ - if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Close LCPL ID */ if(H5Pclose(lcpl) < 0) TEST_ERROR @@ -10141,7 +9363,6 @@ link_filters(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Now create the same file with and without deflate, and verify that the * file size is smaller with deflate */ /* But only if the deflate filter is available */ @@ -10155,8 +9376,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR /* Create file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR /* Create links in file */ if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10174,8 +9394,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR /* Recreate the same file with the deflate filter */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10188,16 +9407,14 @@ link_filters(hid_t fapl, hbool_t new_format) filesize_filtered = h5_get_file_size(filename, fapl); /* Check that the file size is smaller with the filter */ - if((double)filesize_filtered - > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR + if((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR /* Close */ if(H5Pclose(fcpl) < 0) TEST_ERROR } /* end if */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10209,7 +9426,7 @@ error: H5Pclose(gcpl2); H5Pclose(fcpl); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_filters() */ @@ -10220,19 +9437,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, February 2, 2010 - * *------------------------------------------------------------------------- */ static int obj_exists(hid_t fapl, hbool_t new_format) { - char filename[NAME_BUF_SIZE]; /* Buffer for file name */ - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - herr_t status; /* Generic return value */ + char filename[NAME_BUF_SIZE]; /* Buffer for file name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + herr_t status; /* Generic return value */ if(new_format) TESTING("object exists (w/new group format)") @@ -10242,8 +9455,7 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Hard links */ /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ @@ -10253,13 +9465,11 @@ obj_exists(hid_t fapl, hbool_t new_format) if(status >= 0) TEST_ERROR /* Create a group, as a destination for testing */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() succeeds for hard linked object */ - if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ H5E_BEGIN_TRY { @@ -10267,237 +9477,202 @@ obj_exists(hid_t fapl, hbool_t new_format) } H5E_END_TRY if(status >= 0) TEST_ERROR - /* Soft links */ /* Create dangling soft-link in root group */ if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ - if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to object */ if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) TEST_ERROR /* Create dangling soft-link in non-root group */ if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to object */ if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) TEST_ERROR /* External links */ /* Create dangling (file doesn't exist) external link in root group */ if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in root group */ if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) TEST_ERROR /* Create dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) TEST_ERROR /* Soft->External links */ /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link that points to object */ if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link that points to object */ if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) TEST_ERROR /* External->Soft links */ /* Create external link in root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in non-root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Close file created */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_exists() */ @@ -10508,19 +9683,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10542,9 +9713,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10569,7 +9740,6 @@ corder_create_empty(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10596,7 +9766,7 @@ corder_create_empty(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10604,7 +9774,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_empty() */ @@ -10616,21 +9786,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10680,7 +9846,6 @@ corder_create_compact(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10714,7 +9879,7 @@ corder_create_compact(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10722,7 +9887,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_compact() */ @@ -10734,21 +9899,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10814,7 +9975,6 @@ corder_create_dense(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10847,7 +10007,7 @@ corder_create_dense(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10855,7 +10015,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_dense() */ @@ -10867,25 +10027,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10925,7 +10081,6 @@ corder_transition(hid_t fapl) /* Get the size of the file with an empty group */ if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -11000,7 +10155,6 @@ corder_transition(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -11076,7 +10230,7 @@ corder_transition(hid_t fapl) if(file_size != empty_size) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11084,7 +10238,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_transition() */ @@ -11097,25 +10251,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ unsigned reopen_file; /* Whether to re-open the file before deleting group */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -11205,7 +10355,7 @@ corder_delete(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11213,7 +10363,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_delete() */ @@ -11223,15 +10373,11 @@ error: * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int @@ -11384,18 +10530,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11549,7 +10691,7 @@ link_info_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11557,7 +10699,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx() */ @@ -11569,17 +10711,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11717,14 +10855,14 @@ link_info_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx_old() */ @@ -11736,19 +10874,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11812,10 +10946,8 @@ delete_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion on empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -11946,10 +11078,8 @@ delete_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Delete links in middle */ - /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12026,8 +11156,6 @@ delete_by_idx(hid_t fapl) if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12042,7 +11170,7 @@ delete_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12050,7 +11178,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx() */ @@ -12062,17 +11190,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, November 15, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12097,10 +11221,8 @@ delete_by_idx_old(hid_t fapl) /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion in empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); @@ -12176,10 +11298,8 @@ delete_by_idx_old(hid_t fapl) /* Verify state of group */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Delete links in middle */ - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { H5O_info_t oi; /* Buffer for querying object's info */ @@ -12267,7 +11387,7 @@ delete_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12275,7 +11395,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx_old() */ @@ -12286,10 +11406,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12298,14 +11414,14 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { @@ -12313,31 +11429,31 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) if(info->corder != op_data->curr) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12349,9 +11465,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12364,16 +11480,12 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12386,17 +11498,13 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -12407,10 +11515,6 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12438,7 +11542,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12455,7 +11558,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12486,7 +11588,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12519,7 +11620,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12531,7 +11631,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12545,7 +11644,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -12554,10 +11652,10 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret >= 0) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_check() */ @@ -12665,7 +11763,6 @@ link_iterate(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR @@ -12695,7 +11792,6 @@ link_iterate(hid_t fapl) /* Test iteration over links in compact group */ if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12740,7 +11836,7 @@ link_iterate(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -12753,7 +11849,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate() */ @@ -12764,52 +11860,47 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12821,9 +11912,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12836,16 +11927,12 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_old_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_old_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12857,15 +11944,10 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_check(hid_t group_id, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) +link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12888,7 +11970,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12905,7 +11986,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12936,7 +12016,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12969,7 +12048,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12981,7 +12059,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12995,7 +12072,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -13018,10 +12094,10 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_old_check() */ @@ -13032,17 +12108,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13078,7 +12150,6 @@ link_iterate_old(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR @@ -13116,7 +12187,6 @@ link_iterate_old(hid_t fapl) /* Test iteration over links in group */ if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13130,7 +12200,7 @@ link_iterate_old(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13142,7 +12212,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate_old() */ @@ -13153,19 +12223,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, - haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oi; /* Buffer for querying object's info */ haddr_t mnt_root_addr; /* Address of root group in file to mount */ hid_t obj_id; /* ID of object opened */ @@ -13206,10 +12271,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, } /* end for */ } /* end for */ - - /* - * Verify opening correct object by index when file mounting is present - */ + /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR @@ -13236,12 +12298,11 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Unmount the file */ if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR - /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end open_by_idx_check() */ @@ -13253,21 +12314,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13356,14 +12413,12 @@ open_by_idx(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { hid_t group_id2; /* Group ID */ @@ -13398,7 +12453,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -13433,7 +12487,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13456,7 +12509,7 @@ open_by_idx(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13471,7 +12524,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end open_by_idx() */ @@ -13483,19 +12536,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13540,7 +12589,6 @@ open_by_idx_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { hid_t group_id2; /* Group ID */ @@ -13581,7 +12629,6 @@ open_by_idx_old(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13595,7 +12642,7 @@ open_by_idx_old(hid_t fapl) /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -13606,7 +12653,7 @@ error: H5Fclose(mount_file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end open_by_idx_old() */ @@ -13617,10 +12664,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int @@ -13628,7 +12671,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ @@ -13674,10 +12717,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, } /* end for */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end object_info_check() */ @@ -13689,21 +12732,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13913,7 +12952,7 @@ object_info(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13928,7 +12967,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end object_info() */ @@ -13939,19 +12978,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13989,7 +13024,6 @@ object_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); @@ -14049,7 +13083,6 @@ object_info_old(hid_t fapl) /* Verify querying objects by name */ if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14063,7 +13096,7 @@ object_info_old(hid_t fapl) /* Free resources */ if(H5Sclose(space_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14074,7 +13107,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end object_info_old() */ @@ -14086,20 +13119,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -14181,7 +13210,6 @@ group_info(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14198,7 +13226,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14223,7 +13250,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14236,7 +13262,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14261,7 +13286,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14280,7 +13304,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14305,7 +13328,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14328,7 +13350,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2, group_id3; /* Group IDs */ @@ -14339,7 +13360,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14364,7 +13384,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14377,7 +13396,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14402,7 +13420,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14421,7 +13438,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14446,7 +13462,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14469,7 +13484,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14485,7 +13499,7 @@ group_info(hid_t fapl) /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14496,7 +13510,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info() */ @@ -14508,18 +13522,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -14552,7 +13562,6 @@ group_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14569,7 +13578,6 @@ group_info_old(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14594,7 +13602,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14607,7 +13614,6 @@ group_info_old(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14632,7 +13638,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14651,7 +13656,6 @@ group_info_old(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14676,7 +13680,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14705,7 +13708,6 @@ group_info_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14716,7 +13718,7 @@ group_info_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: /* Free resources */ @@ -14726,7 +13728,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info_old() */ @@ -14738,20 +13740,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, March 3, 2007 - * *------------------------------------------------------------------------- */ static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t group_id2 = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t gcpl_id2 = -1; /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14777,7 +13775,6 @@ timestamps(hid_t fapl) /* Check default timestamp information */ if(track_times != FALSE) TEST_ERROR - /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -14830,7 +13827,6 @@ timestamps(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -14879,7 +13875,7 @@ timestamps(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: /* Free resources */ @@ -14889,32 +13885,27 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end timestamps() */ /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test links - * - * Return: Success: exit(EXIT_SUCCESS) - * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 + * Purpose: Test links * + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; - unsigned new_format; /* Whether to use the new format or not */ - unsigned minimize_dset_oh; - unsigned efc; /* Whether to use the external file cache */ + hid_t fapl = -1, fapl2 = -1; /* File access property lists */ + int nerrors = 0; + unsigned new_format; /* Whether to use the new format or not */ + unsigned minimize_dset_oh; + unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -14933,7 +13924,8 @@ main(void) HDprintf("\n-Testing with minimzed dataset object headers-\n"); dcpl_g = H5Pcreate(H5P_DATASET_CREATE); if (0 > dcpl_g) TEST_ERROR - } else { + } + else { HDprintf("\n-Testing with unminimzed dataset object headers-\n"); dcpl_g = H5P_DEFAULT; } @@ -14945,14 +13937,14 @@ main(void) if(new_format) { my_fapl = fapl2; HDprintf("\n--Testing with 'new format'--\n"); - } else { + } + else { my_fapl = fapl; HDprintf("\n--Testing with 'old format'--\n"); } /* always enter tests without external cache */ - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; @@ -14972,29 +13964,28 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ + * intermediate file is not held open + */ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ + * reopen a cached file with a different intent + */ nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - /* Try external link tests both with and without the external file cache - */ + /* Try external link tests both with and without the external file cache */ for(efc = FALSE; efc <= TRUE; efc++) { if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR HDprintf("\n---Testing with external file cache---\n"); } /* end if */ else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR HDprintf("\n---Testing without external file cache---\n"); } /* end else */ @@ -15041,7 +14032,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, @@ -15076,9 +14067,9 @@ main(void) nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; /* XXX: when creation order indexing is fully working, go back and add checks -* to these tests to make certain that the creation order values are -* correct. -*/ + * to these tests to make certain that the creation order values are + * correct. + */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; nerrors += corder_transition(fapl2) < 0 ? 1 : 0; @@ -15100,8 +14091,7 @@ main(void) nerrors += group_info_old(fapl) < 0 ? 1 : 0; if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) - TEST_ERROR; + if (H5Pclose(dcpl_g) < 0) TEST_ERROR; dcpl_g = -1; } } /* [un]minimized dataset object headers */ @@ -15121,8 +14111,7 @@ main(void) /* Results */ if(nerrors) { - HDprintf("***** %d LINK TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } HDprintf("All link tests passed.\n"); @@ -15135,7 +14124,7 @@ main(void) HDrmdir(TMPDIR); HDrmdir(TMPDIR2); - return 0; + return SUCCEED; error: HDputs("*** TESTS FAILED ***"); -- cgit v0.12 From 898b6d650b2e321b8d3b29ebee4e8f9a48161d92 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 31 Jul 2019 16:51:36 -0500 Subject: Fix missing export tag --- test/external_common.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/external_common.h b/test/external_common.h index 304f3fb..043f36b 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -42,5 +42,15 @@ static const char *EXT_FNAME[] = { #define TOTAL_SIZE 100 #define GARBAGE_PER_FILE 10 -herr_t reset_raw_data_files(hbool_t is_env); + +#ifdef __cplusplus +extern "C" { +#endif + +H5TEST_DLL herr_t reset_raw_data_files(hbool_t is_env); + +#ifdef __cplusplus +} +#endif + #endif /* _EXTERNAL_COMMON_H */ -- cgit v0.12 From 4165f341945adf3bbfa2318badbe1057ccffca52 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 1 Aug 2019 13:35:09 -0500 Subject: Add missing function --- testpar/t_mdset.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 16eb13c..7f75d20 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -838,6 +838,13 @@ void dataset_fillvalue(void) HDfree(wdata); } +/* combined cngrpw and ingrpr tests because ingrpr reads file created by cngrpw. */ +void collective_group_write_independent_group_read(void) +{ + collective_group_write(); + independent_group_read(); +} + /* Write multiple groups with a chunked dataset in each group collectively. * These groups and datasets are for testing independent read later. * -- cgit v0.12 From c7fe7382279c1c109d03216115df5f53d34bce96 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Fri, 2 Aug 2019 12:45:03 -0500 Subject: Changed the external files to a directory (extern_env_dir) to avoid possible conflict in daily test on jelly. --- test/external_common.c | 4 ++-- test/external_common.h | 1 - test/external_env.c | 33 ++++++++++++++++++++------------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/test/external_common.c b/test/external_common.c index c9b6584..9e759cd 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -60,7 +60,7 @@ reset_raw_data_files(hbool_t is_env) /* Open file */ if(is_env) - HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1); + HDsprintf(filename, "extern_env_dir%sextern_env_%lur.raw", H5_DIR_SEPS, (unsigned long)i + 1); else HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) @@ -97,7 +97,7 @@ reset_raw_data_files(hbool_t is_env) /* Open file */ if(is_env) - HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1); + HDsprintf(filename, "extern_env_dir%sextern_env_%luw.raw", H5_DIR_SEPS, (unsigned long)i + 1); else HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) diff --git a/test/external_common.h b/test/external_common.h index 304f3fb..a99ba48 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -30,7 +30,6 @@ static const char *EXT_FNAME[] = { "extern_4", "extern_dir/file_1", "extern_5", - "extern_env_dir/file_2", NULL }; diff --git a/test/external_env.c b/test/external_env.c index fca5458..484b3ea4 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -16,6 +16,11 @@ */ #include "external_common.h" +const static char *EXT_ENV_FNAME[] = { + "extern_env_dir/file_2", + NULL +}; + /*------------------------------------------------------------------------- * Function: test_path_env @@ -56,10 +61,8 @@ test_path_env(hid_t fapl) TESTING("prefix in HDF5_EXTFILE_PREFIX"); - if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR; + h5_fixname(EXT_ENV_FNAME[0], fapl, filename, sizeof(filename)); - h5_fixname(EXT_FNAME[6], fapl, filename, sizeof(filename)); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -73,7 +76,7 @@ test_path_env(hid_t fapl) if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) TEST_ERROR for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "..%sextern_env_%dr.raw", H5_DIR_SEPS, (int) i + 1); + HDsnprintf(filename, sizeof(filename), "extern_env_%dr.raw", (int) i + 1); if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -158,6 +161,9 @@ main(void) if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + if(HDmkdir("extern_env_dir", (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR; + /* Test with old & new format groups */ for(latest_format = FALSE; latest_format <= TRUE; latest_format++) { hid_t current_fapl_id = -1; @@ -183,16 +189,16 @@ main(void) HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(EXT_FNAME, fapl_id_old)) { - HDremove("extern_env_1r.raw"); - HDremove("extern_env_2r.raw"); - HDremove("extern_env_3r.raw"); - HDremove("extern_env_4r.raw"); + if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) { + char filename[1024]; /* file name */ + int i; - HDremove("extern_env_1w.raw"); - HDremove("extern_env_2w.raw"); - HDremove("extern_env_3w.raw"); - HDremove("extern_env_4w.raw"); + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "extern_env_dir%sextern_env_%dr.raw", H5_DIR_SEPS, i + 1); + HDremove(filename); + HDsnprintf(filename, sizeof(filename), "extern_env_dir%sextern_env_%dw.raw", H5_DIR_SEPS, i + 1); + HDremove(filename); + } HDrmdir("extern_env_dir"); } /* end if */ @@ -206,6 +212,7 @@ error: H5Pclose(fapl_id_new); H5Gclose(gid); } H5E_END_TRY; + nerrors = MAX(1, nerrors); printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; -- cgit v0.12 From b9c948644d8e92ea9c90b593a3dfac3a4d45f44e Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 2 Aug 2019 16:16:40 -0500 Subject: Add contents of HDF5 1.10.5 RELEASE.txt to HISTORY-1_10.txt file. Remove 1.10.5 entries from current RELEASE.txt and update version numbers. --- release_docs/HISTORY-1_10.txt | 706 +++++++++++++++++++++++++++++++++++++++++- release_docs/RELEASE.txt | 406 +----------------------- 2 files changed, 712 insertions(+), 400 deletions(-) diff --git a/release_docs/HISTORY-1_10.txt b/release_docs/HISTORY-1_10.txt index ad8beb2..17678bb 100644 --- a/release_docs/HISTORY-1_10.txt +++ b/release_docs/HISTORY-1_10.txt @@ -3,15 +3,719 @@ HDF5 History This file contains development history of the HDF5 1.10 branch +07. Release Information for hdf5-1.10.5 06. Release Information for hdf5-1.10.4 05. Release Information for hdf5-1.10.3 04. Release Information for hdf5-1.10.2 03. Release Information for hdf5-1.10.1 -02. Release Information for hdf5-1.10.0-patch1 +02. Release Information for hdf5-1.10.0-patch1 01. Release Information for hdf5-1.10.0 [Search on the string '%%%%' for section breaks of each release.] +%%%%1.10.5%%%% + +HDF5 version 1.10.5 released on 2019-02-25 +================================================================================ + + +INTRODUCTION + +This document describes the differences between this release and the previous +HDF5 release. It contains information on the platforms tested and known +problems in this release. For more details check the HISTORY*.txt files in the +HDF5 source. + +Note that documentation in the links below will be updated at the time of each +final release. + +Links to HDF5 documentation can be found on The HDF5 web page: + + https://portal.hdfgroup.org/display/HDF5/HDF5 + +The official HDF5 releases can be obtained from: + + https://www.hdfgroup.org/downloads/hdf5/ + +Changes from Release to Release and New Features in the HDF5-1.10.x release series +can be found at: + + https://portal.hdfgroup.org/display/HDF5/HDF5+Application+Developer%27s+Guide + +If you have any questions or comments, please send them to the HDF Help Desk: + + help@hdfgroup.org + + +CONTENTS + +- New Features +- Support for new platforms and languages +- Bug Fixes since HDF5-1.10.4 +- Supported Platforms +- Tested Configuration Features Summary +- More Tested Platforms +- Known Problems +- CMake vs. Autotools installations + + +New Features +============ + + Configuration: + ------------- + - Cross compile on mutrino and other Cray XC40 systems. + + Added support for CMake options to use CrayLinuxEnvironment, craype-mic-knl + module for building with craype-haswell module for configuration, and + batch scripts in bin/batch for use with sbatch or bsub to run tests in + batch jobs on compute nodes. An instruction file README_HPC describing + the use of these options was added in release_docs. + + (LRK - 2019/02/18, TRILABS-34) + + - Rework CMake command files to fix MPI testing. + + Added setup fixture to remove any test generated files and added DEPENDS + to test properties to execute tests in order expected. + + (ADB - 2019/02/14, TRILABS-111) + + - Disable SZIP or ZLIB options if TGZ files are not available. + + Changed the TGZ option for SZip and ZLib to disable the options + if the source tar.gz files are not found. + + (ADB - 2019/02/05, HDFFV-10697) + + - Added a new option to enable/disable using pread/pwrite instead of + read/write in the sec2, log, and core VFDs. + + This option is enabled by default when pread/pwrite are detected. + + Autotools: --enable-preadwrite + CMake: HDF5_ENABLE_PREADWRITE + + (DER - 2019/02/03, HDFFV-10696) + + - Rework CMake versioning for OSX platforms. + + Changed the current_version and compatibility_version flags from optional + with HDF5_BUILD_WITH_INSTALL_NAME to always setting the flags for OSX. + + (ADB - 2019/01/22, HDFFV-10685) + + - Rework CMake command files to eliminate developer CMP005 warning + + Use variables without quotes in if () statements. + + (ADB - 2019/01/18, TILABS-105) + + - Rework CMake configure files to eliminate developer CMP0075 warning + + Renamed varname to HDF5_REQUIRED_LIBRARIES as the contents were not + required for configuration. Also moved check includes calls to top of + files. + + (ADB - 2019/01/03, HDFFV-10546) + + - Keep stderr and stdout separate in tests + + Changed test handling of output capture. Tests now keep the stderr + output separate from the stdout output. It is up to the test to decide + which output to check against a reference. Also added the option + to grep for a string in either output. + + (ADB - 2018/12/12, HDFFV-10632) + + - Incorrectly installed private header files were removed from + CMake installs. + + The CMake build files incorrectly flagged the following header files + as public and installed them. They are private and will no longer be + installed. + + HDF5 library private package files (H5Xpkg.h) + H5Edefin.h + H5Einit.h + H5Eterm.h + H5LTparse.h + h5diff.h + h5tools_dump.h + h5tools.h + h5tools_ref.h + h5tools_str.h + h5tools_utils.h + h5trav.h + + (DER - 2018/10/26, HDFFV-10614, 10609) + + - Autotools installs now install H5FDwindows.h + + This is simply to align the installed header files between the + autotools and CMake. H5FDwindows.h has no functionality on + non-Windows systems. + + (DER - 2018/10/26, HDFFV-10614) + + + Library: + -------- + - The sec2, log, and core VFDs can now use pread/pwrite instead of + read/write. + + pread and pwrite do not change the file offset, a feature that was + requested by a user working with a multi-threaded application. + + The option to configure this feature is described above. + + (DER - 2019/02/03, HDFFV-10696) + + - Add ability to minimze dataset object headers. + + Creation of many, very small datasets resulted in extensive file bloat + due to extra space in the dataset object headers -- this space is + allocated by default to allow for the insertion of a small number of + attributes within the object header and not require a continuation + block, an unnecessary provision in the target use case. + + Inform the library to expect no attributes on created datasets, and to + allocate the least space possible for the object headers. + NOTE: A continuation block is created if attributes are added to a + 'minimized' dataset, which can reduce performance. + NOTE: Some extra space is allocated for attributes essential to the + correct behavior of the object header (store creation times, e.g.). This + does not violate the design principle, as the space is calculated and + allocated as needed at the time of dataset object header creation -- + unused space is not generated. + New API calls: + H5Fget_dset_no_attrs_hint + H5Fset_dset_no_attrs_hint + H5Pget_dset_no_attrs_hint + H5Pset_dset_no_attrs_hint + + (JOS - 2019/01/04, TRILAB-45) + + - Added new chunk query functions + + The following public functions were added to discover information about + the chunks in an HDF5 file. + herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks) + herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size) + herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size) + + (BMR - 2018/11/07, HDFFV-10615) + + - Several empty public header files where removed from the distribution + + The following files were empty placeholders. They are for internal + packages that are unlikely to ever have public functionality and have + thus been removed. + + H5Bpublic.h + H5B2public.h + H5FSpublic.h + H5HFpublic.h + H5HGpublic.h + H5HLpublic.h + + They were only installed in CMake builds. + + (DER - 2018/10/26, HDFFV-10614) + + + Parallel Library: + ----------------- + - Changed the default behavior in parallel when reading the same dataset in its entirety + (i.e. H5S_ALL dataset selection) which is being read by all the processes collectively. + The dataset must be contiguous, less than 2GB, and of an atomic datatype. + The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from + the disk by the root process to the remain processes in the MPI communicator associated + with the HDF5 file. + + (MSB - 2019/01/02, HDFFV-10652) + + - All MPI-1 API calls have been replaced with MPI-2 equivalents. + + This was done to better support OpenMPI, as default builds no longer + include MPI-1 support (as of OpenMPI 4.0). + + (DER - 2018/12/30, HDFFV-10566) + + Fortran Library: + ---------------- + - Added wrappers for dataset object header minimization calls. + (see the note for TRILAB-45, above) + + New API calls: + + h5fget_dset_no_attrs_hint_f + h5fset_dset_no_attrs_hint_f + h5pget_dset_no_attrs_hint_f + h5pset_dset_no_attrs_hint_f + + (DER - 2019/01/09, TRILAB-45) + + - Added new Fortran derived type, c_h5o_info_t, which is interoperable with + C's h5o_info_t. This is needed for callback functions which + pass C's h5o_info_t data type definition. + + (MSB, 2019/01/08, HDFFV-10443) + + - Added new Fortran API, H5gmtime, which converts (C) 'time_t' structure + to Fortran DATE AND TIME storage format. + + (MSB, 2019/01/08, HDFFV-10443) + + - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f, + h5oget_info, h5oget_info_by_idx and h5ovisit_by_name_f. + + (MSB, 2019/01/08, HDFFV-10443) + + C++ Library: + ------------ + - Added new function to the C++ interface + + Added wrapper for H5Ovisit2: + H5Object::visit() + + (BMR - 2019/02/14, HDFFV-10532) + + + Java Library: + ---------------- + - Rewrote the JNI error handling to be much cleaner + + (JTH - 2019/02/12) + + - Add new functions to java interface + + Added wrappers for: + H5Fset_libver_bounds + H5Fget_dset_no_attrs_hint/H5Fset_dset_no_attrs_hint + H5Pget_dset_no_attrs_hint/H5Pset_dset_no_attrs_hint + + (ADB - 2019/01/07, HDFFV-10664) + + - Fix java unit tests when Time is a natural number + + Time substitution in java/test/junit.sh.in doesn't + handle the case when Time is a natural number. Fixed + the regular expression. + + (ADB - 2019/01/07, HDFFV-10674) + + - Duplicate the data read/write functions of Datasets for Attributes. + + Region references could not be displayed for attributes as they could + for datasets. Datasets had overloaded read and write functions for different + datatypes that were not available for attributes. After adding similar + functions, attribute region references work normally. + + (ADB - 2018/12/12, HDFVIEW-4) + + + Tools: + ------ + - The h5repart -family-to-sec2 argument was changed to -family-to-single + + In order to better support other single-file VFDs which could work with + h5repart, the -family-to-sec2 argument was renamed to -family-to-single. + This is just a name change and the functionality of the argument has not + changed. + + The -family-to-sec2 argument has been kept for backwards-compatibility. + This argument should be considered deprecated. + + (DER - 2018/11/14, HDFFV-10633) + + +Bug Fixes since HDF5-1.10.4 release +================================== + + Library + ------- + - Fix hangs with collective metadata reads during chunked dataset I/O + + In the parallel library, it was discovered that when a particular + sequence of operations following a pattern of: + + "write to chunked dataset" -> "flush file" -> "read from dataset" + + occurred with collective metadata reads enabled, hangs could be + observed due to certain MPI ranks not participating in the collective + metadata reads. + + To fix the issue, collective metadata reads are now disabled during + chunked dataset raw data I/O. + + (JTH - 2019/02/11, HDFFV-10563, HDFFV-10688) + + - Performance issue when closing an object + + The slow down is due to the search of the "tag_list" to find + out the "corked" status of an object and "uncork" it if so. + + Improve performance by skipping the search of the "tag_list" + if there are no "corked" objects when closing an object. + + (VC - 2019/02/06) + + - Uninitialized bytes from a type conversion buffer could be written + to disk in H5Dwrite calls where type conversion takes place + and the type conversion buffer was created by the HDF5 library. + + When H5Dwrite is called and datatype conversion must be performed, + the library will create a temporary buffer for type conversion if + one is not provided by the user via H5Pset_buffer. This internal + buffer is allocated via malloc and contains uninitialized data. In + some datatype conversions (float to long double, possibly others), + some of this uninitialized data could be written to disk. + + This was flagged by valgrind in the dtransform test and does not + appear to be a common occurrence (it is flagged in one test out + of the entire HDF5 test suite). + + Switching to calloc fixed the problem. + + (DER - 2019/02/03, HDFFV-10694) + + - There was missing protection against division by zero reported to + The HDF Group as issue #CVE-2018-17434. + + Protection against division by zero was added to address the issue + #CVE-2018-17434. + + (BMR - 2019/01/29, HDFFV-10586) + + - The issue CVE-2018-17437 was reported to The HDF Group + + Although CVE-2018-17437 reported a memory leak, the actual issue + was invalid read. It was found that the attribute name length + in an attribute message was corrupted, which caused the buffer + pointer to be advanced too far and later caused an invalid read. + + A check was added to detect when the attribute name or its length + was corrupted and report the potential of data corruption. + + (BMR - 2019/01/29, HDFFV-10588) + + - H5Ewalk did not stop when it was supposed to + + H5Ewalk was supposed to stop when the callback function stopped + even though the errors in the stack were not all visited, but it + did not. This problem is now fixed. + + (BMR - 2019/01/29, HDFFV-10684) + + - Revert H5Oget_info* and H5Ovisit* functions + + In 1.10.3 new H5Oget_info*2 and H5Ovisit*2 functions were + added for performance. Inadvertently, the original functions; + H5Oget_info, + H5Oget_info_by_name, + H5Oget_info_by_idx, + H5Ovisit, + H5Ovisit_by_name + were versioned to H5Oget_info*1 and H5Ovisit*1. This + broke the API compatibility for a maintenance release. The + original functions have been restored. + + (ADB - 2019/01/24, HDFFV-10686) + + - Fixed a potential invalid memory access and failure that could occur when + decoding an unknown object header message (from a future version of the + library). + + (NAF - 2019/01/07) + + - Deleting attributes in dense storage + + The library aborts with "infinite loop closing library" after + attributes in dense storage are created and then deleted. + + When deleting the attribute nodes from the name index v2 B-tree, + if an attribute is found in the intermediate B-tree nodes, + which may be merged/redistributed in the process, we need to + free the dynamically allocated spaces for the intermediate + decoded attribute. + + (VC - 2018/12/26, HDFFV-10659) + + - There was missing protection against division by zero reported to + The HDF Group as issue #CVE-2018-17233. + + Protection against division by zero was added to address the issue + #CVE-2018-17233. In addition, several similar occurrences in the same + file were fixed as well. + + (BMR - 2018/12/23, HDFFV-10577) + + - Fixed an issue where the parallel filters tests would fail + if zlib was not available on the system. Until support can + be added in the tests for filters beyond gzip/zlib, the tests + will be skipped if zlib is not available. + + (JTH - 2018/12/05) + + - A bug was discovered in the parallel library where an application + would eventually consume all of the available MPI communicators + when continually writing to a compressed dataset in parallel. This + was due to internal copies of an HDF5 File Access Property List, + which each contained a copy of the MPI communicator, not being + closed at the end of each write operation. This problem was + exacerbated by larger numbers of processors. + + (JTH - 2018/12/05, HDFFV-10629) + + + Fortran + -------- + - Fixed issue with Fortran not returning h5o_info_t field values + meta_size%attr%index_size and meta_size%attr%heap_size. + + (MSB, 2019/01/08, HDFFV-10443) + + - Added symbolic links libhdf5_hl_fortran.so to libhdf5hl_fortran.so and + libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for + autotools installs. These were added to match the name of the files + installed by cmake and the general pattern of hl lib files. We will + change the names of the installed lib files to the matching name in + the next major release. + + (LRK - 2019/01/04, HDFFV-10596) + + - Made Fortran specific subroutines PRIVATE in generic procedures. + + Affected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. + + (MSB, 2018/12/04, HDFFV-10511) + + + Testing + ------- + - Fixed a test failure in testpar/t_dset.c caused by + the test trying to use the parallel filters feature + on MPI-2 implementations. + + (JTH, 2019/2/7) + + +Supported Platforms +=================== + + Linux 2.6.32-696.16.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) + IBM XL C/C++ V13.1 + IBM XL Fortran V15.1 + + Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4) + Version 4.9.3, Version 5.2.0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.0.098 Build 20160721 + MPICH 3.1.4 compiled with GCC 4.9.3 + + SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc + (emu) Sun Fortran 95 8.6 SunOS_sparc + Sun C++ 5.12 SunOS_sparc + + Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake) + + Windows 7 x64 Visual Studio 2013 + Visual Studio 2015 w/ Intel Fortran 16 (cmake) + Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake) + Visual Studio 2015 w/ MSMPI 8 (cmake) + + Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake) + + Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake) + Visual Studio 2017 w/ Intel Fortran 18 (cmake) + + Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0 + 64-bit gfortran GNU Fortran (GCC) 4.9.2 + (osx1010dev/osx1010test) Intel icc/icpc/ifort version 15.0.3 + + Mac OS X El Capitan 10.11.6 Apple clang/clang++ version 7.3.0 from Xcode 7.3 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (osx1011dev/osx1011test) Intel icc/icpc/ifort version 16.0.2 + + MacOS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang/clang++-1000.10.44.4) + 64-bit gfortran GNU Fortran (GCC) 8.3.0 + + +Tested Configuration Features Summary +===================================== + + In the tables below + y = tested + n = not tested in this release + C = Cluster + W = Workstation + x = not working in this release + dna = does not apply + ( ) = footnote appears below second table + = testing incomplete on this feature or platform + +Platform C F90/ F90 C++ zlib SZIP + parallel F2003 parallel +Solaris2.11 32-bit n y/y n y y y +Solaris2.11 64-bit n y/n n y y y +Windows 7 y y/y n y y y +Windows 7 x64 y y/y y y y y +Windows 7 Cygwin n y/n n y y y +Windows 7 x64 Cygwin n y/n n y y y +Windows 10 y y/y n y y y +Windows 10 x64 y y/y n y y y +Mac OS X Yosemite 10.10.5 64-bit n y/y n y y y +Mac OS X El Capitan 10.11.6 64-bit n y/y n y y y +MacOS High Sierra 10.13.6 64-bit n y/y n y y y +CentOS 7.2 Linux 3.10.0 x86_64 PGI n y/y n y y y +CentOS 7.2 Linux 3.10.0 x86_64 GNU y y/y y y y y +CentOS 7.2 Linux 3.10.0 x86_64 Intel n y/y n y y y +Linux 2.6.32-573.18.1.el6.ppc64 n y/y n y y y + + +Platform Shared Shared Shared Thread- + C libs F90 libs C++ libs safe +Solaris2.11 32-bit y y y y +Solaris2.11 64-bit y y y y +Windows 7 y y y y +Windows 7 x64 y y y y +Windows 7 Cygwin n n n y +Windows 7 x64 Cygwin n n n y +Windows 10 y y y y +Windows 10 x64 y y y y +Mac OS X Yosemite 10.10.5 64-bit y y y y +Mac OS X El Capitan 10.11.6 64-bit y y y y +MacOS High Sierra 10.13.6 64-bit y y y y +CentOS 7.2 Linux 3.10.0 x86_64 PGI y y y n +CentOS 7.2 Linux 3.10.0 x86_64 GNU y y y y +CentOS 7.2 Linux 3.10.0 x86_64 Intel y y y n +Linux 2.6.32-573.18.1.el6.ppc64 y y y n + +Compiler versions for each platform are listed in the preceding +"Supported Platforms" table. + + +More Tested Platforms +===================== +The following configurations are not supported but have been tested for this release. + + Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + (mayll/platypus) Version 4.4.7 20120313 + Version 4.9.3, 5.3.0, 6.2.0 + PGI C, Fortran, C++ for 64-bit target on + x86-64; + Version 17.10-0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.4.196 Build 20170411 + MPICH 3.1.4 compiled with GCC 4.9.3 + + Linux 3.10.0-327.18.2.el7 GNU C (gcc) and C++ (g++) compilers + #1 SMP x86_64 GNU/Linux Version 4.8.5 20150623 (Red Hat 4.8.5-4) + (jelly) with NAG Fortran Compiler Release 6.1(Tozai) + GCC Version 7.1.0 + MPICH 3.2-GCC-4.9.3 + MPICH 3.2.1-GCC-7.2.0-2.29 + OpenMPI 2.1.5-GCC-7.2.0-2.29 + Intel(R) C (icc) and C++ (icpc) compilers + Version 17.0.0.098 Build 20160721 + with NAG Fortran Compiler Release 6.1(Tozai) + + Linux 3.10.0-327.10.1.el7 MPICH 3.2 compiled with GCC 5.3.0 + #1 SMP x86_64 GNU/Linux + (moohan) + + Fedora 29 4.20.10-200.fc29.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux + gcc, g++ (GCC) 8.2.1 20181215 + (Red Hat 8.2.1-6) + GNU Fortran (GCC) 8.2.1 20181215 + (Red Hat 8.2.1-6) + (cmake and autotools) + + Windows 7 x64 Visual Studio 2008 + + +Known Problems +============== + + At present, metadata cache images may not be generated by parallel + applications. Parallel applications can read files with metadata cache + images, but since this is a collective operation, a deadlock is possible + if one or more processes do not participate. + + Three tests fail with OpenMPI 3.0.0/GCC-7.2.0-2.29: + testphdf5 (ecdsetw, selnone, cchunk1, cchunk3, cchunk4, and actualio) + t_shapesame (sscontig2) + t_pflush1/fails on exit + The first two tests fail attempting collective writes. + + CPP ptable test fails on VS2017 with Intel compiler, JIRA issue: HDFFV-10628. + This test will pass with VS2015 with Intel compiler. + + Older MPI libraries such as OpenMPI 2.0.1 and MPICH 2.1.5 were tested + while attempting to resolve the Jira issue: HDFFV-10540. + The known problems of reading or writing > 2GBs when using MPI-2 was + partially resolved with the MPICH library. The proposed support recognizes + IO operations > 2GB and if the datatype is not a derived type, the library + breaks the IO into chunks which can be input or output with the existing + MPI 2 limitations, i.e. size reporting and function API size/count + arguments are restricted to be 32 bit integers. For derived types larger + than 2GB, MPICH 2.1.5 fails while attempting to read or write data. + OpenMPI in contrast, implements MPI-3 APIs even in the older releases + and thus does not suffer from the 32 bit size limitation described here. + OpenMPI releases prior to v3.1.3 appear to have other datatype issues however, + e.g. within a single parallel test (testphdf5) the subtests (cdsetr, eidsetr) + report data verfication errors before eventually aborting. + The most recent versions of OpenMPI (v3.1.3 or newer) have evidently + resolved these isses and parallel HDF5 testing does not currently report + errors though occasional hangs have been observed. + + Known problems in previous releases can be found in the HISTORY*.txt files + in the HDF5 source. Please report any new problems found to + help@hdfgroup.org. + + +CMake vs. Autotools installations +================================= +While both build systems produce similar results, there are differences. +Each system produces the same set of folders on linux (only CMake works +on standard Windows); bin, include, lib and share. Autotools places the +COPYING and RELEASE.txt file in the root folder, CMake places them in +the share folder. + +The bin folder contains the tools and the build scripts. Additionally, CMake +creates dynamic versions of the tools with the suffix "-shared". Autotools +installs one set of tools depending on the "--enable-shared" configuration +option. + build scripts + ------------- + Autotools: h5c++, h5cc, h5fc + CMake: h5c++, h5cc, h5hlc++, h5hlcc + +The include folder holds the header files and the fortran mod files. CMake +places the fortran mod files into separate shared and static subfolders, +while Autotools places one set of mod files into the include folder. Because +CMake produces a tools library, the header files for tools will appear in +the include folder. + +The lib folder contains the library files, and CMake adds the pkgconfig +subfolder with the hdf5*.pc files used by the bin/build scripts created by +the CMake build. CMake separates the C interface code from the fortran code by +creating C-stub libraries for each Fortran library. In addition, only CMake +installs the tools library. The names of the szip libraries are different +between the build systems. + +The share folder will have the most differences because CMake builds include +a number of CMake specific files for support of CMake's find_package and support +for the HDF5 Examples CMake project. + %%%%1.10.4%%%% HDF5 version 1.10.4 released on 2018-10-05 diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 42dc6d2..a40f092 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -34,7 +34,7 @@ CONTENTS - New Features - Support for new platforms and languages -- Bug Fixes since HDF5-1.10.4 +- Bug Fixes since HDF5-1.10.5 - Supported Platforms - Tested Configuration Features Summary - More Tested Platforms @@ -116,203 +116,14 @@ New Features (ADB - 2019/04/15, HDFFV-10741) - - Rework CMake command files to fix MPI testing. - - Added setup fixture to remove any test generated files and added DEPENDS - to test properties to execute tests in order expected. - - (ADB - 2019/02/14, TRILABS-111) - - - Disable SZIP or ZLIB options if TGZ files are not available. - - Changed the TGZ option for SZip and ZLib to disable the options - if the source tar.gz files are not found. - - (ADB - 2019/02/05, HDFFV-10697) - - - Added a new option to enable/disable using pread/pwrite instead of - read/write in the sec2, log, and core VFDs. - - This option is enabled by default when pread/pwrite are detected. - - Autotools: --enable-preadwrite - CMake: HDF5_ENABLE_PREADWRITE - - (DER - 2019/02/03, HDFFV-10696) - - - Rework CMake versioning for OSX platforms. - - Changed the current_version and compatibility_version flags from optional - with HDF5_BUILD_WITH_INSTALL_NAME to always setting the flags for OSX. - - (ADB - 2019/01/22, HDFFV-10685) - - - Rework CMake command files to eliminate developer CMP005 warning - - Use variables without quotes in if () statements. - - (ADB - 2019/01/18, TILABS-105) - - - Rework CMake configure files to eliminate developer CMP0075 warning - - Renamed varname to HDF5_REQUIRED_LIBRARIES as the contents were not - required for configuration. Also moved check includes calls to top of - files. - - (ADB - 2019/01/03, HDFFV-10546) - - - Keep stderr and stdout separate in tests - - Changed test handling of output capture. Tests now keep the stderr - output separate from the stdout output. It is up to the test to decide - which output to check against a reference. Also added the option - to grep for a string in either output. - - (ADB - 2018/12/12, HDFFV-10632) - - - Incorrectly installed private header files were removed from - CMake installs. - - The CMake build files incorrectly flagged the following header files - as public and installed them. They are private and will no longer be - installed. - - HDF5 library private package files (H5Xpkg.h) - H5Edefin.h - H5Einit.h - H5Eterm.h - H5LTparse.h - h5diff.h - h5tools_dump.h - h5tools.h - h5tools_ref.h - h5tools_str.h - h5tools_utils.h - h5trav.h - - (DER - 2018/10/26, HDFFV-10614, 10609) - - - Autotools installs now install H5FDwindows.h - - This is simply to align the installed header files between the - autotools and CMake. H5FDwindows.h has no functionality on - non-Windows systems. - - (DER - 2018/10/26, HDFFV-10614) - Library: -------- - - The sec2, log, and core VFDs can now use pread/pwrite instead of - read/write. - - pread and pwrite do not change the file offset, a feature that was - requested by a user working with a multi-threaded application. - - The option to configure this feature is described above. - - (DER - 2019/02/03, HDFFV-10696) - - - Add ability to minimze dataset object headers. - - Creation of many, very small datasets resulted in extensive file bloat - due to extra space in the dataset object headers -- this space is - allocated by default to allow for the insertion of a small number of - attributes within the object header and not require a continuation - block, an unnecessary provision in the target use case. - - Inform the library to expect no attributes on created datasets, and to - allocate the least space possible for the object headers. - NOTE: A continuation block is created if attributes are added to a - 'minimized' dataset, which can reduce performance. - NOTE: Some extra space is allocated for attributes essential to the - correct behavior of the object header (store creation times, e.g.). This - does not violate the design principle, as the space is calculated and - allocated as needed at the time of dataset object header creation -- - unused space is not generated. - New API calls: - H5Fget_dset_no_attrs_hint - H5Fset_dset_no_attrs_hint - H5Pget_dset_no_attrs_hint - H5Pset_dset_no_attrs_hint - - (JOS - 2019/01/04, TRILAB-45) - - - Added new chunk query functions - - The following public functions were added to discover information about - the chunks in an HDF5 file. - herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks) - herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size) - herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size) - - (BMR - 2018/11/07, HDFFV-10615) - - - Several empty public header files where removed from the distribution - - The following files were empty placeholders. They are for internal - packages that are unlikely to ever have public functionality and have - thus been removed. - - H5Bpublic.h - H5B2public.h - H5FSpublic.h - H5HFpublic.h - H5HGpublic.h - H5HLpublic.h - - They were only installed in CMake builds. - - (DER - 2018/10/26, HDFFV-10614) - + - Parallel Library: ----------------- - - Changed the default behavior in parallel when reading the same dataset in its entirety - (i.e. H5S_ALL dataset selection) which is being read by all the processes collectively. - The dataset must be contiguous, less than 2GB, and of an atomic datatype. - The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from - the disk by the root process to the remain processes in the MPI communicator associated - with the HDF5 file. - - (MSB - 2019/01/02, HDFFV-10652) - - - All MPI-1 API calls have been replaced with MPI-2 equivalents. - - This was done to better support OpenMPI, as default builds no longer - include MPI-1 support (as of OpenMPI 4.0). - - (DER - 2018/12/30, HDFFV-10566) - - Fortran Library: - ---------------- - - Added wrappers for dataset object header minimization calls. - (see the note for TRILAB-45, above) - - New API calls: - - h5fget_dset_no_attrs_hint_f - h5fset_dset_no_attrs_hint_f - h5pget_dset_no_attrs_hint_f - h5pset_dset_no_attrs_hint_f - - (DER - 2019/01/09, TRILAB-45) - - - Added new Fortran derived type, c_h5o_info_t, which is interoperable with - C's h5o_info_t. This is needed for callback functions which - pass C's h5o_info_t data type definition. - - (MSB, 2019/01/08, HDFFV-10443) - - - Added new Fortran API, H5gmtime, which converts (C) 'time_t' structure - to Fortran DATE AND TIME storage format. - - (MSB, 2019/01/08, HDFFV-10443) - - - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f, - h5oget_info, h5oget_info_by_idx and h5ovisit_by_name_f. - - (MSB, 2019/01/08, HDFFV-10443) + - C++ Library: ------------ @@ -322,13 +133,6 @@ New Features (BMR - 2019/04/22, HDFFV-10622) - - Added new function to the C++ interface - - Added wrapper for H5Ovisit2: - H5Object::visit() - - (BMR - 2019/02/14, HDFFV-10532) - Java Library: ---------------- @@ -336,50 +140,10 @@ New Features (JTH - 2019/04/30) - - Rewrote the JNI error handling to be much cleaner - - (JTH - 2019/02/12) - - - Add new functions to java interface - - Added wrappers for: - H5Fset_libver_bounds - H5Fget_dset_no_attrs_hint/H5Fset_dset_no_attrs_hint - H5Pget_dset_no_attrs_hint/H5Pset_dset_no_attrs_hint - - (ADB - 2019/01/07, HDFFV-10664) - - - Fix java unit tests when Time is a natural number - - Time substitution in java/test/junit.sh.in doesn't - handle the case when Time is a natural number. Fixed - the regular expression. - - (ADB - 2019/01/07, HDFFV-10674) - - - Duplicate the data read/write functions of Datasets for Attributes. - - Region references could not be displayed for attributes as they could - for datasets. Datasets had overloaded read and write functions for different - datatypes that were not available for attributes. After adding similar - functions, attribute region references work normally. - - (ADB - 2018/12/12, HDFVIEW-4) - Tools: ------ - - The h5repart -family-to-sec2 argument was changed to -family-to-single - - In order to better support other single-file VFDs which could work with - h5repart, the -family-to-sec2 argument was renamed to -family-to-single. - This is just a name change and the functionality of the argument has not - changed. - - The -family-to-sec2 argument has been kept for backwards-compatibility. - This argument should be considered deprecated. - - (DER - 2018/11/14, HDFFV-10633) + - High-Level APIs: --------------- @@ -401,7 +165,7 @@ Support for new platforms, languages and compilers. ======================================= - -Bug Fixes since HDF5-1.10.4 release +Bug Fixes since HDF5-1.10.5 release ================================== Library @@ -457,139 +221,6 @@ Bug Fixes since HDF5-1.10.4 release (RL - 2019/3/4, HDFFV-10705) - - Fix hangs with collective metadata reads during chunked dataset I/O - - In the parallel library, it was discovered that when a particular - sequence of operations following a pattern of: - - "write to chunked dataset" -> "flush file" -> "read from dataset" - - occurred with collective metadata reads enabled, hangs could be - observed due to certain MPI ranks not participating in the collective - metadata reads. - - To fix the issue, collective metadata reads are now disabled during - chunked dataset raw data I/O. - - (JTH - 2019/02/11, HDFFV-10563, HDFFV-10688) - - - Performance issue when closing an object - - The slow down is due to the search of the "tag_list" to find - out the "corked" status of an object and "uncork" it if so. - - Improve performance by skipping the search of the "tag_list" - if there are no "corked" objects when closing an object. - - (VC - 2019/02/06) - - - Uninitialized bytes from a type conversion buffer could be written - to disk in H5Dwrite calls where type conversion takes place - and the type conversion buffer was created by the HDF5 library. - - When H5Dwrite is called and datatype conversion must be performed, - the library will create a temporary buffer for type conversion if - one is not provided by the user via H5Pset_buffer. This internal - buffer is allocated via malloc and contains uninitialized data. In - some datatype conversions (float to long double, possibly others), - some of this uninitialized data could be written to disk. - - This was flagged by valgrind in the dtransform test and does not - appear to be a common occurrence (it is flagged in one test out - of the entire HDF5 test suite). - - Switching to calloc fixed the problem. - - (DER - 2019/02/03, HDFFV-10694) - - - There was missing protection against division by zero reported to - The HDF Group as issue #CVE-2018-17434. - - Protection against division by zero was added to address the issue - #CVE-2018-17434. - - (BMR - 2019/01/29, HDFFV-10586) - - - The issue CVE-2018-17437 was reported to The HDF Group - - Although CVE-2018-17437 reported a memory leak, the actual issue - was invalid read. It was found that the attribute name length - in an attribute message was corrupted, which caused the buffer - pointer to be advanced too far and later caused an invalid read. - - A check was added to detect when the attribute name or its length - was corrupted and report the potential of data corruption. - - (BMR - 2019/01/29, HDFFV-10588) - - - H5Ewalk did not stop when it was supposed to - - H5Ewalk was supposed to stop when the callback function stopped - even though the errors in the stack were not all visited, but it - did not. This problem is now fixed. - - (BMR - 2019/01/29, HDFFV-10684) - - - Revert H5Oget_info* and H5Ovisit* functions - - In 1.10.3 new H5Oget_info*2 and H5Ovisit*2 functions were - added for performance. Inadvertently, the original functions; - H5Oget_info, - H5Oget_info_by_name, - H5Oget_info_by_idx, - H5Ovisit, - H5Ovisit_by_name - were versioned to H5Oget_info*1 and H5Ovisit*1. This - broke the API compatibility for a maintenance release. The - original functions have been restored. - - (ADB - 2019/01/24, HDFFV-10686) - - - Fixed a potential invalid memory access and failure that could occur when - decoding an unknown object header message (from a future version of the - library). - - (NAF - 2019/01/07) - - - Deleting attributes in dense storage - - The library aborts with "infinite loop closing library" after - attributes in dense storage are created and then deleted. - - When deleting the attribute nodes from the name index v2 B-tree, - if an attribute is found in the intermediate B-tree nodes, - which may be merged/redistributed in the process, we need to - free the dynamically allocated spaces for the intermediate - decoded attribute. - - (VC - 2018/12/26, HDFFV-10659) - - - There was missing protection against division by zero reported to - The HDF Group as issue #CVE-2018-17233. - - Protection against division by zero was added to address the issue - #CVE-2018-17233. In addition, several similar occurrences in the same - file were fixed as well. - - (BMR - 2018/12/23, HDFFV-10577) - - - Fixed an issue where the parallel filters tests would fail - if zlib was not available on the system. Until support can - be added in the tests for filters beyond gzip/zlib, the tests - will be skipped if zlib is not available. - - (JTH - 2018/12/05) - - - A bug was discovered in the parallel library where an application - would eventually consume all of the available MPI communicators - when continually writing to a compressed dataset in parallel. This - was due to internal copies of an HDF5 File Access Property List, - which each contained a copy of the MPI communicator, not being - closed at the end of each write operation. This problem was - exacerbated by larger numbers of processors. - - (JTH - 2018/12/05, HDFFV-10629) - Java Library: ---------------- @@ -597,26 +228,7 @@ Bug Fixes since HDF5-1.10.4 release Fortran -------- - - Fixed issue with Fortran not returning h5o_info_t field values - meta_size%attr%index_size and meta_size%attr%heap_size. - - (MSB, 2019/01/08, HDFFV-10443) - - - Added symbolic links libhdf5_hl_fortran.so to libhdf5hl_fortran.so and - libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for - autotools installs. These were added to match the name of the files - installed by cmake and the general pattern of hl lib files. We will - change the names of the installed lib files to the matching name in - the next major release. - - (LRK - 2019/01/04, HDFFV-10596) - - - Made Fortran specific subroutines PRIVATE in generic procedures. - - Affected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. - - (MSB, 2018/12/04, HDFFV-10511) - + - Tools ----- @@ -644,11 +256,7 @@ Bug Fixes since HDF5-1.10.4 release Testing ------- - - Fixed a test failure in testpar/t_dset.c caused by - the test trying to use the parallel filters feature - on MPI-2 implementations. - - (JTH, 2019/2/7) + - Supported Platforms -- cgit v0.12 From 32fd14afa4b4d77812dc510486aff6971a0d3b49 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 2 Aug 2019 16:24:12 -0500 Subject: Delete unused batch scripts for cori. --- bin/batch/cori_ctestP.sl.in.cmake | 17 ----------------- bin/batch/cori_ctestS.sl.in.cmake | 16 ---------------- bin/batch/cori_knl_ctestP.sl.in.cmake | 17 ----------------- 3 files changed, 50 deletions(-) delete mode 100644 bin/batch/cori_ctestP.sl.in.cmake delete mode 100644 bin/batch/cori_ctestS.sl.in.cmake delete mode 100644 bin/batch/cori_knl_ctestP.sl.in.cmake diff --git a/bin/batch/cori_ctestP.sl.in.cmake b/bin/batch/cori_ctestP.sl.in.cmake deleted file mode 100644 index 287fe3c..0000000 --- a/bin/batch/cori_ctestP.sl.in.cmake +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -#SBATCH -C haswell -#SBATCH --nodes=1 -#SBATCH -t 00:30:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestP - -cd @HDF5_BINARY_DIR@ -CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test" - -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out -echo "Done running $CMD" - diff --git a/bin/batch/cori_ctestS.sl.in.cmake b/bin/batch/cori_ctestS.sl.in.cmake deleted file mode 100644 index 50bef6b..0000000 --- a/bin/batch/cori_ctestS.sl.in.cmake +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -#SBATCH -C haswell -#SBATCH --nodes=1 -#SBATCH -t 00:30:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestS - -cd @HDF5_BINARY_DIR@ -CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test" - -echo "Run $CMD. Test output will be in build/ctestS.out" -$CMD >& ctestS.out -echo "Done running $CMD" diff --git a/bin/batch/cori_knl_ctestP.sl.in.cmake b/bin/batch/cori_knl_ctestP.sl.in.cmake deleted file mode 100644 index 82378ec..0000000 --- a/bin/batch/cori_knl_ctestP.sl.in.cmake +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -#SBATCH -C knl,quad,cache -#SBATCH --nodes=1 -#SBATCH -t 00:30:00 -#SBATCH --mail-type=BEGIN,END,FAIL -##SBATCH --mail-user=@sandia.gov -#SBATCH --export=ALL -#SBATCH --job-name=h5_ctestP - -cd @HDF5_BINARY_DIR@ -CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test" - -echo "Run $CMD. Test output will be in build/ctestP.out" -$CMD >& ctestP.out -echo "Done running $CMD" - -- cgit v0.12 From 59a8b10b881b33a9d47243c16600be18e697a68c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Aug 2019 07:32:01 -0500 Subject: Merge fixes and code reconciliation wit develop --- MANIFEST | 1 + bin/genparser | 2 +- bin/make_err | 4 +- bin/snapshot | 12 +- c++/test/CMakeVFDTests.cmake | 80 ++-- config/cmake/HDFCompilerFlags.cmake | 17 +- config/conclude.am | 2 +- config/gnu-fflags | 154 ++++++-- config/gnu-flags | 491 ++++++++--------------- fortran/src/H5_f.c | 4 - test/big.c | 9 + test/cache_image.c | 7 +- test/error_test.c | 9 + test/fheap.c | 84 ++-- test/file_image.c | 9 + test/gheap.c | 324 +++++++-------- test/h5test.c | 52 ++- test/h5test.h | 2 +- test/mf.c | 58 +-- test/swmr.c | 168 ++++---- test/tattr.c | 352 +++++++++++------ test/tgenprop.c | 4 +- test/th5s.c | 64 ++- test/titerate.c | 3 +- test/trefer.c | 14 +- test/tselect.c | 676 +++++++++++++++----------------- test/tsohm.c | 260 ++++++------ test/tunicode.c | 2 +- test/vds_env.c | 20 +- testpar/CMakeVFDTests.cmake | 68 ++-- tools/src/h5ls/h5ls.c | 54 +-- tools/src/h5stat/h5stat.c | 54 +-- tools/test/h5dump/CMakeTests.cmake | 10 + tools/test/h5dump/CMakeVFDTests.cmake | 91 +++++ tools/test/h5dump/h5dumpgentest.c | 12 +- tools/test/h5repack/CMakeTests.cmake | 27 +- tools/test/h5repack/CMakeVFDTests.cmake | 95 +++-- 37 files changed, 1763 insertions(+), 1532 deletions(-) create mode 100644 tools/test/h5dump/CMakeVFDTests.cmake diff --git a/MANIFEST b/MANIFEST index 6b9dde1..013b635 100644 --- a/MANIFEST +++ b/MANIFEST @@ -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 < [diff] [test] [srcdir] [release] [help] - [clean] [distclean] [echo] [deploy ] [deploydir ] - [zlib ] [releasedir ] [srcdirname ] [check-vfd] - [exec ] [module-load ] [op-configure