summaryrefslogtreecommitdiffstats
path: root/tools/test/h5copy
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-10-27 15:06:00 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-10-27 15:06:00 (GMT)
commit2c6dbbf2129c4997606be4b130346d42fe12eae3 (patch)
treedb8430aa5757b32f3bd46928798cc2b686a72bfb /tools/test/h5copy
parent5b562d9ce9b2945d0378b9c03e01f42923da80f4 (diff)
downloadhdf5-2c6dbbf2129c4997606be4b130346d42fe12eae3.zip
hdf5-2c6dbbf2129c4997606be4b130346d42fe12eae3.tar.gz
hdf5-2c6dbbf2129c4997606be4b130346d42fe12eae3.tar.bz2
Split tools into src and test - add folders
Diffstat (limited to 'tools/test/h5copy')
-rw-r--r--tools/test/h5copy/CMakeLists.txt23
-rw-r--r--tools/test/h5copy/CMakeTests.cmake373
-rw-r--r--tools/test/h5copy/Makefile.am46
-rw-r--r--tools/test/h5copy/h5copygentest.c1004
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_src.h5bin0 -> 2184 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls43
-rw-r--r--tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5bin0 -> 2168 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_misc1.out3
-rw-r--r--tools/test/h5copy/testfiles/h5copy_ref.h5bin0 -> 9104 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copy_ref.out.ls31
-rw-r--r--tools/test/h5copy/testfiles/h5copytst.h5bin0 -> 15900 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copytst.out.ls429
-rw-r--r--tools/test/h5copy/testfiles/h5copytst_new.h5bin0 -> 31856 bytes
-rw-r--r--tools/test/h5copy/testfiles/h5copytst_new.out.ls502
-rw-r--r--tools/test/h5copy/testh5copy.sh.in607
15 files changed, 3061 insertions, 0 deletions
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
new file mode 100644
index 0000000..5bab57b
--- /dev/null
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -0,0 +1,23 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF5_TOOLS_TEST_H5COPY)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+
+# --------------------------------------------------------------------
+# Add the h5copy test executables
+# --------------------------------------------------------------------
+
+ if (HDF5_BUILD_GENERATORS)
+ add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c)
+ TARGET_NAMING (h5copygentest STATIC)
+ TARGET_C_PROPERTIES (h5copygentest STATIC " " " ")
+ target_link_libraries (h5copygentest ${HDF5_LIB_TARGET})
+ set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools)
+
+ #add_test (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
+ endif (HDF5_BUILD_GENERATORS)
+
+ include (CMakeTests.cmake)
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
new file mode 100644
index 0000000..fe36ca9
--- /dev/null
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -0,0 +1,373 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the source directory into the test directory
+ # --------------------------------------------------------------------
+ set (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_ref.h5
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5
+ )
+
+ set (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out
+ )
+
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+
+ foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ get_filename_component(fname "${listfiles}" NAME)
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5copy_files")
+ endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ #
+ # Perform h5copy according to passing parmeters
+ #
+ MACRO (ADD_H5_F_TEST testname resultcode infile fparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # 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
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_F-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS H5COPY_F-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY_F-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_F_TEST)
+
+ MACRO (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # 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
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # resultcode=2 will cause the test to skip the diff test
+ if (NOT ${resultcode} STREQUAL "2")
+ add_test (
+ NAME H5COPY-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST)
+
+ MACRO (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # 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
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}-prefill
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS H5COPY-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -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} STREQUAL "2")
+ add_test (
+ NAME H5COPY-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST2)
+
+ MACRO (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # 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
+ )
+ endif (NOT HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_SAME-${testname}-prefill
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam}
+ )
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS H5COPY_SAME-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ add_test (
+ NAME H5COPY_SAME-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -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} STREQUAL "2")
+ add_test (
+ NAME H5COPY_SAME-${testname}-DIFF
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname}
+ )
+ SET_TESTS_PROPERTIES(H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ endif (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST_SAME)
+
+ #
+ # Similiar to ADD_H5_TEST macro. Compare to outputs from source & target
+ # files instead of checking with h5ls.
+ #
+ 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 $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
+ if (${resultcode} STREQUAL "1")
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true")
+ endif (${resultcode} STREQUAL "1")
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ # 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
+ )
+ add_test (
+ NAME H5COPY-CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5copy>"
+ -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${testname}.out.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=./testfiles/${testname}.out"
+ -D "TEST_MASK=true"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS H5COPY-CMP-${testname}-clear-objects)
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_CMP_TEST)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ set (HDF_FILE1 h5copytst)
+ set (HDF_FILE2 h5copy_ref)
+ set (HDF_EXT_SRC_FILE h5copy_extlinks_src)
+ set (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5COPY-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ simple.out.h5
+ chunk.out.h5
+ compact.out.h5
+ compound.out.h5
+ compressed.out.h5
+ named_vl.out.h5
+ nested_vl.out.h5
+ simple_top.out.h5
+ dsrename.out.h5
+ grp_empty.out.h5
+ grp_dsets.out.h5
+ grp_nested.out.h5
+ simple_group.out.h5
+ grp_rename.out.h5
+ grp_dsets_rename.out.h5
+ A_B1_simple.out.h5
+ A_B2_simple2.out.h5
+ C_D_simple.out.h5
+ E_F_grp_dsets.out.h5
+ G_H_grp_nested.out.h5
+ region_ref.out.h5
+ ext_link.out.h5
+ ext_link_f.out.h5
+ ext_dangle_noobj.out.h5
+ ext_dangle_noobj_f.out.h5
+ ext_dangle_nofile.out.h5
+ ext_dangle_nofile_f.out.h5
+ ext_link_group.out.h5
+ ext_link_group_f.out.h5
+ 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 (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test})
+ endif (NOT "${last_test}" STREQUAL "")
+ set (last_test "H5COPY-clearall-objects")
+ endif (HDF5_ENABLE_USING_MEMCHECKER)
+
+ # "Test copying various forms of datasets"
+ ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 -v -s simple -d simple)
+ ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 -v -s chunk -d chunk)
+ ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 -v -s compact -d compact)
+ ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 -v -s compound -d compound)
+ ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 -v -s compressed -d compressed)
+ ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 -v -s named_vl -d named_vl)
+ ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 -v -s nested_vl -d nested_vl)
+
+ # "Test copying dataset within group in source file to root of destination"
+ ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 -v -s grp_dsets/simple -d simple_top)
+
+ # "Test copying & renaming dataset"
+ ADD_H5_TEST (dsrename 0 ${HDF_FILE1}.h5 -v -s compound -d rename)
+
+ # "Test copying empty, 'full' & 'nested' groups"
+ ADD_H5_TEST (grp_empty 0 ${HDF_FILE1}.h5 -v -s grp_empty -d grp_empty)
+ ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_dsets)
+ ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 -v -s grp_nested -d grp_nested)
+
+ # "Test copying dataset within group in source file to group in destination"
+ ADD_H5_TEST2 (simple_group 0 ${HDF_FILE1}.h5 grp_dsets grp_dsets -v -s /grp_dsets/simple -d /grp_dsets/simple_group)
+
+ # "Test copying & renaming group"
+ ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 -v -s grp_dsets -d grp_rename)
+
+ # "Test copying 'full' group hierarchy into group in destination file"
+ ADD_H5_TEST2 (grp_dsets_rename 0 ${HDF_FILE1}.h5 grp_dsets grp_rename -v -s grp_dsets -d /grp_rename/grp_dsets)
+
+ # "Test copying objects into group hier. that doesn't exist yet in destination file"
+ ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B1/simple)
+ ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 -vp -s simple -d /A/B2/simple2)
+ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets/simple -d /C/D/simple)
+ ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets)
+ ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested)
+
+############# COPY REFERENCES ##############
+
+ # "Test copying object and region references"
+ ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ref -v -s / -d /COPY)
+
+############# COPY EXT LINKS ##############
+
+ # "Test copying external link directly without -f ext"
+ ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_dset -d /copy1_dset)
+
+ # "Test copying external link directly with -f ext"
+ ADD_H5_F_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_dset -d /copy2_dset)
+
+ # "Test copying dangling external link (no obj) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_noobj 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_1)
+
+ # "Test copying dangling external link (no obj) directly with -f ext"
+ ADD_H5_F_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2)
+
+ # "Test copying dangling external link (no file) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_nofile 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_1)
+
+ # "Test copying dangling external link (no file) directly with -f ext"
+ ADD_H5_F_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2)
+
+ # "Test copying a group contains external links without -f ext"
+ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext -d /copy1_group)
+
+ # "Test copying a group contains external links with -f ext"
+ ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext -d /copy2_group)
+
+############# Test misc. ##############
+
+ #-----------------------------------------------------------------
+ # "Test copying object into group which doesn't exist, without -p"
+ #
+ ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple)
+
+ #-------------------------------------------
+ # "Test copying objects to the same file "
+ #
+ # - dataset
+ ADD_H5_TEST_SAME (samefile1 0 ${HDF_FILE1}.h5 /simple /simple -v -s /simple -d /simple_cp)
+ # - group with some datasets
+ ADD_H5_TEST_SAME (samefile2 0 ${HDF_FILE1}.h5 /grp_dsets /grp_dsets -v -s /grp_dsets -d /grp_dsets_cp)
diff --git a/tools/test/h5copy/Makefile.am b/tools/test/h5copy/Makefile.am
new file mode 100644
index 0000000..becb55f
--- /dev/null
+++ b/tools/test/h5copy/Makefile.am
@@ -0,0 +1,46 @@
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+##
+## Makefile.am
+## Run automake to generate a Makefile.in from this file.
+#
+# HDF5 Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Include src and tools/lib directories
+AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
+
+# Test programs and scripts
+TEST_PROG=h5copygentest
+TEST_SCRIPT=testh5copy.sh
+
+check_SCRIPTS=$(TEST_SCRIPT)
+SCRIPT_DEPEND=../../src/h5copy/h5copy$(EXEEXT)
+
+# This is our main target, the h5copy tool
+check_PROGRAMS=$(TEST_PROG)
+
+# source file for the test file generator
+h5copygentest_SOURCES=h5copygentest.c
+
+# All programs depend on the hdf5 and h5tools libraries
+LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+
+# Temporary files. *.h5 are generated by h5dumpgentest. They should
+# copied to the testfiles/ directory if update is required.
+CHECK_CLEANFILES+=*.h5
+
+include $(top_srcdir)/config/conclude.am
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
new file mode 100644
index 0000000..7669702
--- /dev/null
+++ b/tools/test/h5copy/h5copygentest.c
@@ -0,0 +1,1004 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Generate the binary hdf5 file for the h5copy tests
+ */
+#include <stdlib.h>
+#include "hdf5.h"
+#include "H5private.h"
+
+/* HDF file names */
+#define HDF_FILE1 "h5copytst.h5"
+#define HDF_FILE1_NEW "h5copytst_new.h5"
+#define HDF_FILE2 "h5copy_ref.h5"
+#define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5"
+#define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5"
+
+/* objects in HDF_FILE1 */
+#define DATASET_SIMPLE "simple"
+#define DATASET_CHUNK "chunk"
+#define DATASET_COMPACT "compact"
+#define DATASET_COMPOUND "compound"
+#define DATASET_COMPRESSED "compressed"
+#define DATASET_NAMED_VL "named_vl"
+#define DATASET_NESTED_VL "nested_vl"
+#define DATASET_ATTR "dset_attr"
+#define ATTR "attr"
+#define GROUP_EMPTY "grp_empty"
+#define GROUP_DATASETS "grp_dsets"
+#define GROUP_NESTED "grp_nested"
+#define GROUP_ATTR "grp_attr"
+
+/* Obj reference */
+#define OBJ_REF_DS "Dset1"
+#define OBJ_REF_GRP "Group"
+/* Region reference */
+#define REG_REF_DS1 "Dset_REGREF"
+#define REG_REF_DS2 "Dset2"
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_simple
+ *
+ * Purpose: Generate a simple dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_simple(hid_t loc_id)
+{
+ hid_t sid, did;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_chunked
+ *
+ * Purpose: Generate a chunked dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_chunked(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ hsize_t chunk_dims[1] = {2};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist */
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_chunk(pid, 1, chunk_dims);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_CHUNK, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compact
+ *
+ * Purpose: Generate a compact dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compact(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist */
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_layout (pid,H5D_COMPACT);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPACT, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compound
+ *
+ * Purpose: Generate a compound dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compound(hid_t loc_id)
+{
+ typedef struct s_t
+ {
+ char str1[20];
+ char str2[20];
+ } s_t;
+ hid_t sid, did, tid_c, tid_s;
+ hsize_t dims[1] = {2};
+ s_t buf[2] = {{"str1", "str2"}, {"str3", "str4"}};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create a compound type */
+ tid_c = H5Tcreate(H5T_COMPOUND, sizeof(s_t));
+ tid_s = H5Tcopy(H5T_C_S1);
+ H5Tset_size(tid_s, 20);
+
+ H5Tinsert(tid_c, "str1", HOFFSET(s_t,str1), tid_s);
+ H5Tinsert(tid_c, "str2", HOFFSET(s_t,str2), tid_s);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPOUND, tid_c, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid_c, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid_c);
+ H5Tclose(tid_s);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_compressed
+ *
+ * Purpose: Generate a compressed dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_compressed(hid_t loc_id)
+{
+ hid_t sid, did, pid;
+ hsize_t dims[1] = {6};
+ hsize_t chunk_dims[1] = {2};
+ int buf[6] = {1,2,3,4,5,6};
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create property plist for chunk*/
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ H5Pset_chunk(pid, 1, chunk_dims);
+
+ /* set the deflate filter */
+#if defined (H5_HAVE_FILTER_DEFLATE)
+ H5Pset_deflate(pid, 1);
+#endif
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_COMPRESSED, H5T_NATIVE_INT, sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Pclose(pid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_named_vl
+ *
+ * Purpose: Generate a variable lenght named datatype for a dataset in
+ LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_named_vl(hid_t loc_id)
+{
+ hid_t sid, did, tid;
+ hsize_t dims[1] = {2};
+ hvl_t buf[2];
+
+ /* allocate and initialize VL dataset to write */
+ buf[0].len = 1;
+ buf[0].p = HDmalloc( 1 * sizeof(int));
+ ((int *)buf[0].p)[0]=1;
+ buf[1].len = 2;
+ buf[1].p = HDmalloc( 2 * sizeof(int));
+ ((int *)buf[1].p)[0]=2;
+ ((int *)buf[1].p)[1]=3;
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create datatype */
+ tid = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /* create named datatype */
+ H5Tcommit2(loc_id, "vl", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_NAMED_VL, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_vl
+ *
+ * Purpose: Generate a nested variable length dataset in LOC_ID
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_vl(hid_t loc_id)
+{
+ hid_t sid, did, tid1, tid2;
+ hsize_t dims[1] = {2};
+ hvl_t buf[2];
+ hvl_t *tvl;
+
+ /* allocate and initialize VL dataset to write */
+ buf[0].len = 1;
+ buf[0].p = HDmalloc( 1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[0].p;
+ tvl->p = HDmalloc( 1 * sizeof(int) );
+ tvl->len = 1;
+ ((int *)tvl->p)[0]=1;
+
+ buf[1].len = 1;
+ buf[1].p = HDmalloc( 1 * sizeof(hvl_t));
+ tvl = (hvl_t *)buf[1].p;
+ tvl->p = HDmalloc( 2 * sizeof(int) );
+ tvl->len = 2;
+ ((int *)tvl->p)[0]=2;
+ ((int *)tvl->p)[1]=3;
+
+ /* create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+
+ /* create datatype */
+ tid1 = H5Tvlen_create(H5T_NATIVE_INT);
+
+ /* create nested VL datatype */
+ tid2 = H5Tvlen_create(tid1);
+
+ /* create dataset */
+ did = H5Dcreate2(loc_id, DATASET_NESTED_VL, tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* write */
+ H5Dwrite(did, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+
+ /* close */
+ H5Dvlen_reclaim(tid2,sid,H5P_DEFAULT,buf);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gent_att_compound_vlstr
+ *
+ * Purpose: Generate a dataset and a group.
+ * Both has an attribute with a compound datatype consisting
+ * of a variable length string
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_att_compound_vlstr(hid_t loc_id)
+{
+ typedef struct { /* Compound structure for the attribute */
+ int i;
+ char *v;
+ } s1;
+ hsize_t dim[1] = {1}; /* Dimension size */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t vl_str_tid = -1; /* Variable length datatype ID */
+ hid_t cmpd_tid = -1; /* Compound datatype ID */
+ hid_t null_sid = -1; /* Null dataspace ID */
+ s1 buf; /* Buffer */
+
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+
+ /* Create an integer datatype */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+
+ /* Create a variable length string */
+ vl_str_tid = H5Tcopy(H5T_C_S1);
+ H5Tset_size(vl_str_tid, H5T_VARIABLE);
+
+ /* Create a compound datatype with a variable length string and an integer */
+ cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+ H5Tinsert(cmpd_tid, "i", HOFFSET(s1, i), tid);
+ H5Tinsert(cmpd_tid, "v", HOFFSET(s1, v), vl_str_tid);
+
+ /* Create a dataset */
+ null_sid = H5Screate(H5S_NULL);
+ did = H5Dcreate2(loc_id, DATASET_ATTR, H5T_NATIVE_INT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the dataset */
+ sid = H5Screate_simple(1, dim, dim);
+ aid = H5Acreate2(did, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Write the attribute */
+ buf.i = 9;
+ buf.v = "ThisIsAString";
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the dataset and its attribute */
+ H5Dclose(did);
+ H5Aclose(aid);
+
+ /* Create a group */
+ gid = H5Gcreate2(loc_id, GROUP_ATTR, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Attach an attribute with the compound datatype to the group */
+ aid = H5Acreate2(gid, ATTR, cmpd_tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ H5Awrite(aid, cmpd_tid, &buf);
+
+ /* Close the group and its attribute */
+ H5Aclose(aid);
+ H5Gclose(gid);
+
+ /* Close dataspaces */
+ H5Sclose(sid);
+ H5Sclose(null_sid);
+
+ /* Close datatypes */
+ H5Tclose(tid);
+ H5Tclose(vl_str_tid);
+ H5Tclose(cmpd_tid);
+
+} /* gen_att_compound_vlstr() */
+
+/*-------------------------------------------------------------------------
+ * Function: gent_datasets
+ *
+ * Purpose: Generate all datasets in a particular location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_datasets(hid_t loc_id)
+{
+ gent_simple(loc_id);
+ gent_chunked(loc_id);
+ gent_compact(loc_id);
+ gent_compound(loc_id);
+ gent_compressed(loc_id);
+ gent_named_vl(loc_id);
+ gent_nested_vl(loc_id);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_empty_group
+ *
+ * Purpose: Generate an empty group in a location
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_empty_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_datasets
+ *
+ * Purpose: Generate a group in a location and populate it with the "standard"
+ * datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_datasets(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_DATASETS, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Add datasets to group created */
+ gent_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gent_nested_group
+ *
+ * Purpose: Generate a group in a location and populate it with another group
+ * containing the "standard" datasets
+ *
+ *-------------------------------------------------------------------------
+ */
+static void gent_nested_group(hid_t loc_id)
+{
+ hid_t gid;
+
+ /* Create group in location */
+ gid = H5Gcreate2(loc_id, GROUP_NESTED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ /* Add datasets to group created */
+ gent_nested_datasets(gid);
+
+ /* Release resources */
+ H5Gclose(gid);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_obj_ref
+ *
+ * Purpose: Generate object references to dataset and group
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_obj_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid=0;
+ hsize_t dims1[1]={3};
+ hsize_t dims2[1]={2};
+ int data[3] = {10,20,30};
+ int status;
+
+ /*---------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+ hobj_ref_t or_data[2]; /* write buffer */
+ herr_t ret = SUCCEED;
+
+ /*--------------
+ * add dataset */
+ sid = H5Screate_simple(1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Dclose(oid);
+ H5Sclose(sid);
+
+ /*--------------
+ * add group */
+ oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ H5Gclose(oid);
+
+ status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+ status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ sid = H5Screate_simple (1, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(oid > 0)
+ H5Dclose(oid);
+ if(sid > 0)
+ H5Sclose(sid);
+
+ return ret;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: gen_region_ref
+ *
+ * Purpose: Generate dataset region references
+ *
+ * Programmer: Jonathan Kim (Feb 23, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_region_ref(hid_t loc_id)
+{
+ hid_t sid=0, oid1=0, oid2=0;
+ int status;
+ herr_t ret = SUCCEED;
+ char data[3][16] = {"The quick brown", "fox jumps over ", "the 5 lazy dogs"};
+ hsize_t dims2[2] = {3,16};
+ hsize_t coords[4][2] = { {0,1}, {2,11}, {1,0}, {2,4} };
+ hdset_reg_ref_t rr_data[2];
+ hsize_t start[2] = {0,0};
+ hsize_t stride[2] = {2,11};
+ hsize_t count[2] = {2,2};
+ hsize_t block[2] = {1,3};
+ hsize_t dims1[1] = {2};
+
+ sid = H5Screate_simple (2, dims2, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create normal dataset which is refered */
+ oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid2 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write values to dataset */
+ status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select elements space for reference */
+ status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from elements space */
+ status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* select hyperslab space for reference */
+ status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference from hyperslab space */
+ status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ H5Sclose (sid);
+
+ /* Create dataspace. */
+ sid = H5Screate_simple (1, dims1, NULL);
+ if (sid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* create region reference dataset */
+ oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT);
+ if (oid1 < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* write data as region references */
+ status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if (oid1 > 0)
+ H5Dclose (oid1);
+ if (oid2 > 0)
+ H5Dclose (oid2);
+ if (sid > 0)
+ H5Sclose (sid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Obj_Copy
+ *
+ * Purpose: Testing with various objects
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Obj_Copy(void)
+{
+ hid_t fid = -1; /* File id */
+ hid_t fapl_new = (-1); /* File access property id */
+ unsigned new_format; /* New format or old format */
+
+ if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
+ fprintf(stderr, "Error: H5Pcreate failed.\n");
+ goto out;
+ }
+ if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
+ fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n");
+ goto out;
+ }
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+
+ /* Set the FAPL for the type of format */
+ /* Create source file */
+ if(new_format)
+ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new);
+ else
+ fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(fid < 0) {
+ fprintf(stderr, "Error: H5Fcreate failed.\n");
+ goto out;
+ }
+
+ gent_datasets(fid);
+ gent_empty_group(fid);
+ gent_nested_datasets(fid);
+ gent_nested_group(fid);
+ gent_att_compound_vlstr(fid);
+
+ H5Fclose(fid);
+ fid = (-1);
+ } /* end for */
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+ if(fapl_new > 0)
+ H5Pclose(fapl_new);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Ref_Copy
+ *
+ * Purpose: Testing with various references
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Ref_Copy(void)
+{
+ hid_t fid=0;
+ herr_t status;
+
+ fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2);
+ goto out;
+ }
+
+ /* add object reference */
+ status = gen_obj_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate object reference.\n");
+
+ /* add region reference */
+ status = gen_region_ref(fid);
+ if (status < 0)
+ fprintf(stderr, "Failed to generate region reference.\n");
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid > 0)
+ H5Fclose(fid);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_trg
+ *
+ * Purpose: generate target external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_trg(hid_t loc_id)
+{
+ hid_t gid=0, tid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ /*--------------
+ * target file */
+ gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*--------------
+ * add dataset */
+ gent_simple(loc_id);
+
+ /*--------------------
+ * add named datatype
+ */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+ if(tid > 0)
+ H5Tclose(tid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: gen_extlink_src
+ *
+ * Purpose: generate source external link objs
+ *
+ * Programmer: Jonathan Kim (March 03, 2010)
+ *------------------------------------------------------------------------*/
+static herr_t gen_extlink_src(hid_t loc_id)
+{
+ hid_t gid=0;
+ int status;
+ herr_t ret = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * External links
+ *------------------------------------------------------------------------*/
+ /* link to dataset */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to group */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* link to datatype */
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no obj*/
+ status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+ /* dangling link - no file */
+ status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
+ ret = FAIL;
+ goto out;
+ }
+
+out:
+ if(gid > 0)
+ H5Gclose(gid);
+
+ return ret;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: Test_Extlink_Copy
+ *
+ * Purpose: gerenate external link files
+ *
+ *------------------------------------------------------------------------*/
+static void Test_Extlink_Copy(void)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ herr_t status;
+
+ fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE);
+ goto out;
+ }
+
+ fid2 = H5Fcreate (HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE);
+ goto out;
+ }
+
+ /* add links to source external link file */
+ status = gen_extlink_src(fid1);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_src failed.\n", HDF_EXT_SRC_FILE);
+
+ /* add objs to target external link file */
+ status = gen_extlink_trg(fid2);
+ if (status < 0)
+ fprintf(stderr, "Error: %s> gen_extlink_trg failed.\n", HDF_EXT_TRG_FILE);
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *------------------------------------------------------------------------*/
+ if(fid1 > 0)
+ H5Fclose(fid1);
+ if(fid2 > 0)
+ H5Fclose(fid2);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int main(void)
+{
+ Test_Obj_Copy();
+ Test_Ref_Copy();
+ Test_Extlink_Copy();
+
+ return 0;
+}
+
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5 b/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
new file mode 100644
index 0000000..7b8621e
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls b/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
new file mode 100644
index 0000000..0134714
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
@@ -0,0 +1,43 @@
+Opened "./testfiles/h5copy_extlinks_src.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/copy1_dset Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy1_group Group
+ Location: 1:4696
+ Links: 1
+/copy1_group/extlink_datatype External Link {h5copy_extlinks_trg.h5//datatype}
+/copy1_group/extlink_dset External Link {h5copy_extlinks_trg.h5//simple}
+/copy1_group/extlink_grp External Link {h5copy_extlinks_trg.h5//group}
+/copy1_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy1_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
+/copy2_dset Dataset {6/6}
+ Location: 1:4216
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group Group
+ Location: 1:5128
+ Links: 1
+/copy2_group/extlink_datatype Type
+ Location: 1:6328
+ Links: 1
+ Type: shared-1:6328 32-bit little-endian integer
+/copy2_group/extlink_dset Dataset {6/6}
+ Location: 1:5496
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/copy2_group/extlink_grp Group
+ Location: 1:6288
+ Links: 1
+/copy2_group/extlink_notyet1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy2_group/extlink_notyet2 External Link {notyet_file.h5//notyet}
+/copy_dangle1_1 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy_dangle1_2 External Link {h5copy_extlinks_trg.h5//notyet}
+/copy_dangle2_1 External Link {notyet_file.h5//notyet}
+/copy_dangle2_2 External Link {notyet_file.h5//notyet}
diff --git a/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5 b/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
new file mode 100644
index 0000000..3a0242d
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.out b/tools/test/h5copy/testfiles/h5copy_misc1.out
new file mode 100644
index 0000000..1624f2b
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_misc1.out
@@ -0,0 +1,3 @@
+Copying file <./testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copy_misc1.out.h5> and object </g1/g2/simple>
+Error in copy...Exiting
+h5copy error: group </g1> doesn't exist. Use -p to create parent groups.
diff --git a/tools/test/h5copy/testfiles/h5copy_ref.h5 b/tools/test/h5copy/testfiles/h5copy_ref.h5
new file mode 100644
index 0000000..bd727e6
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_ref.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copy_ref.out.ls b/tools/test/h5copy/testfiles/h5copy_ref.out.ls
new file mode 100644
index 0000000..d685af2
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_ref.out.ls
@@ -0,0 +1,31 @@
+Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/COPY Group
+ Location: 1:1464
+ Links: 1
+/COPY/Dset1 Dataset {3/3}
+ Location: 1:1504
+ Links: 2
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/COPY/Dset2 Dataset {3/3, 16/16}
+ Location: 1:1960
+ Links: 3
+ Storage: <details removed for portability>
+ Type: 8-bit integer
+/COPY/Dset_OBJREF Dataset {2/2}
+ Location: 1:5184
+ Links: 1
+ Storage: <details removed for portability>
+ Type: object reference
+/COPY/Dset_REGREF Dataset {2/2}
+ Location: 1:5304
+ Links: 1
+ Storage: <details removed for portability>
+ Type: dataset region reference
+/COPY/Group Group
+ Location: 1:2096
+ Links: 3
+/~obj_pointed_by_2096 Group, same as /COPY/Group
diff --git a/tools/test/h5copy/testfiles/h5copytst.h5 b/tools/test/h5copy/testfiles/h5copytst.h5
new file mode 100644
index 0000000..1d1cbf1
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copytst.out.ls b/tools/test/h5copy/testfiles/h5copytst.out.ls
new file mode 100644
index 0000000..4044aaf
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst.out.ls
@@ -0,0 +1,429 @@
+Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/A Group
+ Location: 1:84304
+ Links: 1
+/A/B1 Group
+ Location: 1:85008
+ Links: 1
+/A/B1/simple Dataset {6/6}
+ Location: 1:84176
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/A/B2 Group
+ Location: 1:88544
+ Links: 1
+/A/B2/simple2 Dataset {6/6}
+ Location: 1:88416
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/C Group
+ Location: 1:91752
+ Links: 1
+/C/D Group
+ Location: 1:92456
+ Links: 1
+/C/D/simple Dataset {6/6}
+ Location: 1:91624
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E Group
+ Location: 1:106368
+ Links: 1
+/E/F Group
+ Location: 1:107072
+ Links: 1
+/E/F/grp_dsets Group
+ Location: 1:94568
+ Links: 1
+/E/F/grp_dsets/chunk Dataset {6/6}
+ Location: 1:98752
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compact Dataset {6/6}
+ Location: 1:99208
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compound Dataset {2/2}
+ Location: 1:99344
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/E/F/grp_dsets/compressed Dataset {6/6}
+ Location: 1:101656
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:105920
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:106048 variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:106096
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/simple Dataset {6/6}
+ Location: 1:106240
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/vl Type
+ Location: 1:106048
+ Links: 2
+ Type: shared-1:106048 variable length of
+ 32-bit little-endian integer
+/G Group
+ Location: 1:122016
+ Links: 1
+/G/H Group
+ Location: 1:122720
+ Links: 1
+/G/H/grp_nested Group
+ Location: 1:109096
+ Links: 1
+/G/H/grp_nested/grp_dsets Group
+ Location: 1:109888
+ Links: 1
+/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:114072
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:114528
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:114664
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:116976
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:121240
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:121368 variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:121416
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:121560
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/vl Type
+ Location: 1:121368
+ Links: 2
+ Type: shared-1:121368 variable length of
+ 32-bit little-endian integer
+/chunk Dataset {6/6}
+ Location: 1:6312
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compact Dataset {6/6}
+ Location: 1:6440
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compound Dataset {2/2}
+ Location: 1:8624
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/compressed Dataset {6/6}
+ Location: 1:12984
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets Group
+ Location: 1:28128
+ Links: 1
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:32312
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:32768
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:32904
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_dsets/compressed Dataset {6/6}
+ Location: 1:35216
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:39480
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:39608 variable length of
+ 32-bit little-endian integer
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:39656
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_dsets/simple Dataset {6/6}
+ Location: 1:39800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/simple_group Dataset {6/6}
+ Location: 1:55912
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/vl Type
+ Location: 1:39608
+ Links: 2
+ Type: shared-1:39608 variable length of
+ 32-bit little-endian integer
+/grp_empty Group
+ Location: 1:27336
+ Links: 1
+/grp_nested Group
+ Location: 1:40592
+ Links: 1
+/grp_nested/grp_dsets Group
+ Location: 1:41384
+ Links: 1
+/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:45568
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:46024
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:46160
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:48472
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:52736
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:52864 variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:52912
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:53056
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/vl Type
+ Location: 1:52864
+ Links: 2
+ Type: shared-1:52864 variable length of
+ 32-bit little-endian integer
+/grp_rename Group
+ Location: 1:57120
+ Links: 1
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:61304
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compact Dataset {6/6}
+ Location: 1:61760
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compound Dataset {2/2}
+ Location: 1:61896
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/compressed Dataset {6/6}
+ Location: 1:64208
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets Group
+ Location: 1:70000
+ Links: 1
+/grp_rename/grp_dsets/chunk Dataset {6/6}
+ Location: 1:74184
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compact Dataset {6/6}
+ Location: 1:74640
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compound Dataset {2/2}
+ Location: 1:74776
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/grp_dsets/compressed Dataset {6/6}
+ Location: 1:77088
+ Links: 1
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:81352
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:81480 variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:81528
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/simple Dataset {6/6}
+ Location: 1:81672
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/vl Type
+ Location: 1:81480
+ Links: 2
+ Type: shared-1:81480 variable length of
+ 32-bit little-endian integer
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:68472
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:68600 variable length of
+ 32-bit little-endian integer
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:68648
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/simple Dataset {6/6}
+ Location: 1:68792
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/vl Type
+ Location: 1:68600
+ Links: 2
+ Type: shared-1:68600 variable length of
+ 32-bit little-endian integer
+/named_vl Dataset {2/2}
+ Location: 1:17280
+ Links: 1
+ Storage: <details removed for portability>
+ Type: shared-1:17408 variable length of
+ 32-bit little-endian integer
+/nested_vl Dataset {2/2}
+ Location: 1:21760
+ Links: 1
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/rename Dataset {2/2}
+ Location: 1:26128
+ Links: 1
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/simple Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/simple_top Dataset {6/6}
+ Location: 1:23952
+ Links: 1
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
diff --git a/tools/test/h5copy/testfiles/h5copytst_new.h5 b/tools/test/h5copy/testfiles/h5copytst_new.h5
new file mode 100644
index 0000000..fd820ca
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst_new.h5
Binary files differ
diff --git a/tools/test/h5copy/testfiles/h5copytst_new.out.ls b/tools/test/h5copy/testfiles/h5copytst_new.out.ls
new file mode 100644
index 0000000..9df6b2e
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copytst_new.out.ls
@@ -0,0 +1,502 @@
+#############################
+Expected output for 'h5ls ../testfiles/h5copytst_new.out.h5'
+#############################
+Opened "../testfiles/h5copytst_new.out.h5" with sec2 driver.
+/ Group
+ Location: 1:96
+ Links: 1
+/A Group
+ Location: 1:65602
+ Links: 1
+/A/B1 Group
+ Location: 1:66306
+ Links: 1
+/A/B1/simple Dataset {6/6}
+ Location: 1:65509
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/A/B2 Group
+ Location: 1:69807
+ Links: 1
+/A/B2/simple2 Dataset {6/6}
+ Location: 1:69714
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/C Group
+ Location: 1:72980
+ Links: 1
+/C/D Group
+ Location: 1:73684
+ Links: 1
+/C/D/simple Dataset {6/6}
+ Location: 1:72887
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E Group
+ Location: 1:76217
+ Links: 1
+/E/F Group
+ Location: 1:76921
+ Links: 1
+/E/F/grp_dsets Group
+ Location: 1:75044
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/E/F/grp_dsets/chunk Dataset {6/6}
+ Location: 1:76014
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compact Dataset {6/6}
+ Location: 1:75367
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/compound Dataset {2/2}
+ Location: 1:75470
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/E/F/grp_dsets/compressed Dataset {6/6}
+ Location: 1:75683
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:75853
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:76108
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/E/F/grp_dsets/simple Dataset {6/6}
+ Location: 1:75274
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/E/F/grp_dsets/vl Type
+ Location: 1:75793
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:75793 variable length of
+ 32-bit little-endian integer
+/G Group
+ Location: 1:85688
+ Links: 1
+/G/H Group
+ Location: 1:86392
+ Links: 1
+/G/H/grp_nested Group
+ Location: 1:84436
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets Group
+ Location: 1:84515
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:85485
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:84838
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:84941
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:85154
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:85324
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:85579
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:84745
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/G/H/grp_nested/grp_dsets/vl Type
+ Location: 1:85264
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:85264 variable length of
+ 32-bit little-endian integer
+/chunk Dataset {6/6}
+ Location: 1:2238
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compact Dataset {6/6}
+ Location: 1:4240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/compound Dataset {2/2}
+ Location: 1:6391
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/compressed Dataset {6/6}
+ Location: 1:6604
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets Group
+ Location: 1:27748
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_dsets/chunk Dataset {6/6}
+ Location: 1:28718
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compact Dataset {6/6}
+ Location: 1:28071
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/compound Dataset {2/2}
+ Location: 1:28174
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_dsets/compressed Dataset {6/6}
+ Location: 1:28387
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:28557
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:28812
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_dsets/simple Dataset {6/6}
+ Location: 1:27978
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/simple_group Dataset {6/6}
+ Location: 1:46180
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_dsets/vl Type
+ Location: 1:28497
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:28497 variable length of
+ 32-bit little-endian integer
+/grp_empty Group
+ Location: 1:27693
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested Group
+ Location: 1:35940
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets Group
+ Location: 1:36019
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_nested/grp_dsets/chunk Dataset {6/6}
+ Location: 1:36989
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compact Dataset {6/6}
+ Location: 1:36342
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/compound Dataset {2/2}
+ Location: 1:36445
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_nested/grp_dsets/compressed Dataset {6/6}
+ Location: 1:36658
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:36828
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:37083
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_nested/grp_dsets/simple Dataset {6/6}
+ Location: 1:36249
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_nested/grp_dsets/vl Type
+ Location: 1:36768
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:36768 variable length of
+ 32-bit little-endian integer
+/grp_rename Group
+ Location: 1:47077
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/chunk Dataset {6/6}
+ Location: 1:48047
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compact Dataset {6/6}
+ Location: 1:47400
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/compound Dataset {2/2}
+ Location: 1:47503
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/compressed Dataset {6/6}
+ Location: 1:47716
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets Group
+ Location: 1:55269
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+/grp_rename/grp_dsets/chunk Dataset {6/6}
+ Location: 1:56239
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compact Dataset {6/6}
+ Location: 1:55592
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/compound Dataset {2/2}
+ Location: 1:55695
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/grp_rename/grp_dsets/compressed Dataset {6/6}
+ Location: 1:55908
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Chunks: {2} 8 bytes
+ Storage: <details removed for portability>
+ Filter-0: deflate-1 OPT {1}
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/named_vl Dataset {2/2}
+ Location: 1:56078
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/nested_vl Dataset {2/2}
+ Location: 1:56333
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/grp_dsets/simple Dataset {6/6}
+ Location: 1:55499
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/grp_dsets/vl Type
+ Location: 1:56018
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:56018 variable length of
+ 32-bit little-endian integer
+/grp_rename/named_vl Dataset {2/2}
+ Location: 1:47886
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/grp_rename/nested_vl Dataset {2/2}
+ Location: 1:48141
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/grp_rename/simple Dataset {6/6}
+ Location: 1:47307
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/grp_rename/vl Type
+ Location: 1:47826
+ Links: 2
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Type: shared-1:47826 variable length of
+ 32-bit little-endian integer
+/named_vl Dataset {2/2}
+ Location: 1:8657
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: shared-1:8606 variable length of
+ 32-bit little-endian integer
+/nested_vl Dataset {2/2}
+ Location: 1:22942
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: variable length of
+ variable length of
+ 32-bit little-endian integer
+/rename Dataset {2/2}
+ Location: 1:27240
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: struct {
+ "str1" +0 20-byte null-terminated ASCII string
+ "str2" +20 20-byte null-terminated ASCII string
+ } 40 bytes
+/simple Dataset {6/6}
+ Location: 1:800
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
+/simple_top Dataset {6/6}
+ Location: 1:25099
+ Links: 1
+ Modified: XXXX-XX-XX XX:XX:XX XXX
+ Storage: <details removed for portability>
+ Type: 32-bit little-endian integer
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
new file mode 100644
index 0000000..6d1478a
--- /dev/null
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -0,0 +1,607 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+# Tests for the h5copy tool
+#
+# Pedro Vicente Nunes (pvn@hdfgroup.org), Albert Cheng (acheng@hdfgroup.org)
+# Thursday, July 20, 2006
+#
+
+srcdir=@srcdir@
+
+# source dirs
+SRC_TOOLS="$srcdir/../.."
+SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
+# testfiles source dirs for tools
+SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DUMP_TESTFILES="$SRC_TOOLS_TESTFILES"
+SRC_H5DIFF_TESTFILES="$SRC_TOOLS/test/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/test/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+
+TESTNAME=h5copy
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+######################################################################
+# test files
+# --------------------------------------------------------------------
+# All the test files copy from source directory to test directory
+# NOTE: Keep this framework to add/remove test files.
+# Any test files from other tools can be used in this framework.
+# This list are also used for checking exist.
+# Comment '#' without space can be used.
+# --------------------------------------------------------------------
+# List of files that will be copied over to local test dir
+LIST_HDF5_TEST_FILES="
+$SRC_H5COPY_TESTFILES/h5copytst.h5
+$SRC_H5COPY_TESTFILES/h5copy_ref.h5
+$SRC_H5COPY_TESTFILES/h5copy_extlinks_src.h5
+$SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5
+"
+
+# List of expect files that will be copied over to local test dir
+LIST_OTHER_TEST_FILES="
+$SRC_H5COPY_TESTFILES/h5copy_misc1.out
+"
+
+H5COPY=../../src/h5copy/h5copy # The tool name
+H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary
+H5DIFF=../../src/h5diff/h5diff # The h5diff tool name
+H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
+H5LS=../../src/h5ls/h5ls # The h5ls tool name
+H5LS_ARGS=-Svr # Arguments to the h5ls tool
+H5LS_BIN=`pwd`/$H5LS # The path of the h5ls tool binary
+
+RM='rm -rf'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+
+TESTDIR=./testfiles
+test -d $TESTDIR || mkdir $TESTDIR
+
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+
+COPY_TESTFILES_TO_TESTDIR()
+{
+ # copy test files. Used -f to make sure get a new copy
+ for tstfile in $COPY_TESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5COPY_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5COPY $@
+ echo " -SKIP-"
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+TESTING()
+{
+ SPACES=" "
+ echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY()
+{
+ SPACES=" "
+ echo "Verifying h5diff output $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Verifying".
+#
+VERIFY_OUTPUT()
+{
+ SPACES=" "
+ echo "Verifying output files $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Source in the output filter function definitions.
+. $srcdir/../../../bin/output_filter.sh
+
+# Run a test and print PASS or *FAIL*. If h5copy can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable.
+# Assumed arguments:
+# $1 is -i
+# $2 is input file
+# $3 is -o
+# $4 is output file
+# $* everything else arguments for h5copy.
+
+TOOLTEST()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ if [ "$1" = -f ]; then
+ inputfile=$4
+ else
+ inputfile=$3
+ fi
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ if [ "$1" = -f ]; then
+ outputfile=$6
+ else
+ outputfile=$5
+ fi
+ runh5diff=no
+ fi
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN $@
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $inputfile $outputfile $7 $9
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+}
+
+# TOOLTEST back-to-back
+TOOLTEST_PREFILL()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ runh5diff=no
+ fi
+
+ grp_name=$5
+ grp_name2=$6
+ obj_name=$7
+ obj_name2=$8
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $inputfile $outputfile $obj_name $obj_name2
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+ fi
+}
+
+# TOOLTEST back-to-back
+TOOLTEST_SAME()
+{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
+ runh5diff=yes
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ else
+ runh5diff=no
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ else
+ runh5diff=no
+ fi
+
+ grp_name=$5
+ grp_name2=$6
+
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ TESTING $H5COPY $@
+ (
+ echo "#############################"
+ echo " output for '$H5COPY $@'"
+ echo "#############################"
+ $RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2
+ ) > $actualout 2> $actualerr
+ RET=$?
+ if [ $RET != 0 ]; then
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+
+ if [ $runh5diff != no ]; then
+ H5DIFFTEST $outputfile $outputfile $grp_name $grp_name2
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $outputfile
+ fi
+ fi
+ fi
+}
+
+
+# Compare the two text files
+# PASS if same
+# FAIL if different, and show the diff
+#
+# Assumed arguments:
+# $1 is text file1 (expected output)
+# $2 is text file2 (actual output)
+CMP_OUTPUT()
+{
+ expect=$1
+ actual=$2
+
+ VERIFY_OUTPUT $@
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected output differs from actual output"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+}
+
+TOOLTEST_FAIL()
+{
+ expectout="$TESTDIR/$1"
+ actualout="$TESTDIR/$1.actualout"
+ actualerr="$TESTDIR/$1.actualerr"
+ actualout_sav=${actualout}-sav
+ actualerr_sav=${actualerr}-sav
+ shift
+ if [ "$1" = -i ]; then
+ inputfile=$2
+ fi
+ if [ "$3" = -o ]; then
+ outputfile=$4
+ fi
+
+ TESTING $H5COPY $@
+ (
+ #echo "#############################"
+ #echo " output for '$H5COPY $@'"
+ #echo "#############################"
+ $RUNSERIAL $H5COPY_BIN $@
+ ) > $actualout 2> $actualerr
+
+ RET=$?
+ # save actualout and actualerr in case they are needed later.
+ cp $actualout $actualout_sav
+ STDOUT_FILTER $actualout
+ cp $actualerr $actualerr_sav
+ STDERR_FILTER $actualerr
+ if [ $RET != 0 ]; then
+ echo " PASSED"
+ # Verifying output text from h5copy
+ if [ "$expectout" != "SKIP" ]; then
+ # combine stderr to stdout to compare the output at once.
+ # We may seperate stdout and stderr later.
+ cat $actualerr >> $actualout
+ CMP_OUTPUT $expectout $actualout
+ fi
+ else
+ echo "*FAILED*"
+ echo "failed result is:"
+ cat $actualout
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actualout $actualerr $actualout_sav $actualerr_sav $outputfile
+ fi
+}
+
+
+# Call the h5diff tool
+#
+H5DIFFTEST()
+{
+ VERIFY $@
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# Call the h5diff tool with a call that is expected to fail
+#
+H5DIFFTEST_FAIL()
+{
+ VERIFY $@
+ $RUNSERIAL $H5DIFF_BIN -q "$@"
+ RET=$?
+
+ if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+}
+
+# Copy single datasets of various forms from one group to another,
+# adding object copied to the destination file each time
+#
+# Assumed arguments:
+# <none>
+COPY_OBJECTS()
+{
+ TESTFILE="$TESTDIR/h5copytst.h5"
+
+ echo "Test copying various forms of datasets"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/simple.out.h5 -v -s simple -d simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/chunk.out.h5 -v -s chunk -d chunk
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compact.out.h5 -v -s compact -d compact
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compound.out.h5 -v -s compound -d compound
+ TOOLTEST -i $TESTFILE -o $TESTDIR/compressed.out.h5 -v -s compressed -d compressed
+ TOOLTEST -i $TESTFILE -o $TESTDIR/named_vl.out.h5 -v -s named_vl -d named_vl
+ TOOLTEST -i $TESTFILE -o $TESTDIR/nested_vl.out.h5 -v -s nested_vl -d nested_vl
+ TOOLTEST -i $TESTFILE -o $TESTDIR/dset_attr.out.h5 -v -s /dset_attr -d /dset_attr
+
+ echo "Test copying dataset within group in source file to root of destination"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/simple_top.out.h5 -v -s grp_dsets/simple -d simple_top
+
+ echo "Test copying & renaming dataset"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename
+
+ echo "Test copying empty, 'full' & 'nested' groups"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr
+
+ echo "Test copying dataset within group in source file to group in destination"
+ TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group
+
+ echo "Test copying & renaming group"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename
+
+ echo "Test copying 'full' group hierarchy into group in destination file"
+ TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets
+
+ echo "Test copying objects into group hier. that doesn't exist yet in destination file"
+ TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/A_B2_simple2.out.h5 -vp -s simple -d /A/B2/simple2
+ TOOLTEST -i $TESTFILE -o $TESTDIR/C_D_simple.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple
+ TOOLTEST -i $TESTFILE -o $TESTDIR/E_F_grp_dsets.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets
+ TOOLTEST -i $TESTFILE -o $TESTDIR/G_H_grp_nested.out.h5 -vp -s /grp_nested -d /G/H/grp_nested
+}
+
+# Copy references in various way.
+#
+# Assumed arguments:
+# <none>
+COPY_REFERENCES()
+{
+ TESTFILE="$TESTDIR/h5copy_ref.h5"
+
+ echo "Test copying object and region references"
+ TOOLTEST -f ref -i $TESTFILE -o $TESTDIR/region_ref.out.h5 -v -s / -d /COPY
+}
+
+# Copy external links.
+# adding to the destination file each time compare the result
+#
+# Assumed arguments:
+# <none>
+COPY_EXT_LINKS()
+{
+ TESTFILE="$TESTDIR/h5copy_extlinks_src.h5"
+
+ echo "Test copying external link directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link.out.h5 -s /group_ext/extlink_dset -d /copy1_dset
+
+ echo "Test copying external link directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_f.out.h5 -v -s /group_ext/extlink_dset -d /copy2_dset
+
+ echo "Test copying dangling external link (no obj) directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_noobj.out.h5 -s /group_ext/extlink_notyet1 -d /copy_dangle1_1
+
+ echo "Test copying dangling external link (no obj) directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_noobj_f.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_2
+
+ echo "Test copying dangling external link (no file) directly without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_dangle_nofile.out.h5 -s /group_ext/extlink_notyet2 -d /copy_dangle2_1
+
+ echo "Test copying dangling external link (no file) directly with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_dangle_nofile_f.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_2
+
+ echo "Test copying a group contains external links without -f ext"
+ TOOLTEST -v -i $TESTFILE -o $TESTDIR/ext_link_group.out.h5 -s /group_ext -d /copy1_group
+
+ echo "Test copying a group contains external links with -f ext"
+ TOOLTEST -f ext -i $TESTFILE -o $TESTDIR/ext_link_group_f.out.h5 -v -s /group_ext -d /copy2_group
+}
+
+# Test misc.
+#
+# Assumed arguments:
+# <none>
+TEST_MISC()
+{
+ TESTFILE="$TESTDIR/h5copytst.h5"
+
+ echo "Test copying object into group which doesn't exist, without -p"
+ TOOLTEST_FAIL h5copy_misc1.out -i $TESTFILE -o $TESTDIR/h5copy_misc1.out.h5 -v -s /simple -d /g1/g2/simple
+
+ echo "Test copying objects to the same file "
+ TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile1.out.h5 /simple /simple_cp
+ TOOLTEST_SAME -i $TESTFILE -o $TESTDIR/samefile2.out.h5 /grp_dsets /grp_dsets_cp
+}
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Start tests
+COPY_OBJECTS
+COPY_REFERENCES
+COPY_EXT_LINKS
+TEST_MISC
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+if test $nerrors -eq 0 ; then
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors errors."
+ exit $EXIT_FAILURE
+fi