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