summaryrefslogtreecommitdiffstats
path: root/tools/h5copy
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-03-21 15:10:17 (GMT)
commiteb89d7b53ab95623ab454186a602e1cafc7391f0 (patch)
treeceafe458b3011e38853e765352d3c7e59bbecce1 /tools/h5copy
parent3e468e6ff65d540a439e99ea568a6bff7add7cea (diff)
downloadhdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz
hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other issues/failures in the branch simultaneously. The h5repack tests are still failing, but Neil will be checking into those, so the branch can be fully functional again. Tested on: Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'tools/h5copy')
-rw-r--r--tools/h5copy/CMakeLists.txt84
-rw-r--r--tools/h5copy/Makefile.in3
-rw-r--r--tools/h5copy/h5copy.c9
-rw-r--r--tools/h5copy/h5copygentest.c65
-rw-r--r--tools/h5copy/testfiles/h5copy_extlinks_src.out.ls3
-rw-r--r--tools/h5copy/testfiles/h5copy_misc1.out2
-rw-r--r--tools/h5copy/testfiles/h5copy_ref.out.ls3
-rw-r--r--tools/h5copy/testfiles/h5copytst.out.ls177
-rw-r--r--tools/h5copy/testh5copy.sh138
9 files changed, 270 insertions, 214 deletions
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index b15f5c1..f9e7c12 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -1,11 +1,10 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_TOOLS_H5COPY)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
-INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
# Add the h5copy and test executables
@@ -13,6 +12,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
ADD_EXECUTABLE (h5copy ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copy.c)
TARGET_NAMING (h5copy ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_TARGET_PROPERTIES (h5copy PROPERTIES FOLDER tools)
SET (H5_DEP_EXECUTABLES h5copy)
@@ -26,56 +26,56 @@ IF (BUILD_TESTING)
IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c)
TARGET_NAMING (h5copygentest ${LIB_TYPE})
- TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ 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 AND NOT BUILD_SHARED_LIBS)
# --------------------------------------------------------------------
- # Copy all the HDF5 files from the test directory into the source directory
+ # Copy all the HDF5 files from the source directory into the test directory
# --------------------------------------------------------------------
- SET (HDF5_REFERENCE_FILES
- h5copy_extlinks_src.out.ls
- h5copy_ref.out.ls
- h5copytst.out.ls
+ SET (LIST_HDF5_TEST_FILES
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_ref.h5
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5
)
- SET (HDF5_REFERENCE_TEST_FILES
- h5copy_extlinks_src.h5
- h5copy_extlinks_trg.h5
- h5copy_ref.h5
- h5copytst.h5
- h5copy_misc1.out
+
+ SET (LIST_OTHER_TEST_FILES
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_extlinks_src.out.ls
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copy_ref.out.ls
+ ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.out.ls
)
FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- FOREACH (ls_file ${HDF5_REFERENCE_FILES})
- SET (lsdest "${PROJECT_BINARY_DIR}/testfiles/${ls_file}")
- #MESSAGE (STATUS " Translating ${ls_file}")
- ADD_CUSTOM_COMMAND (
- TARGET h5copy
- POST_BUILD
- COMMAND ${XLATE_UTILITY}
- ARGS ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
- )
- ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES})
- FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
- SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
- #MESSAGE (STATUS " Copying ${h5_file}")
+ FOREACH (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ GET_FILENAME_COMPONENT(fname "${listfiles}" NAME)
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}")
+ #MESSAGE (STATUS " Copying ${listfiles}")
ADD_CUSTOM_COMMAND (
TARGET h5copy
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${listfiles} ${dest}
)
- ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
-
- ADD_CUSTOM_COMMAND (
- TARGET h5copy
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/h5copytst.h5 ${PROJECT_BINARY_DIR}/h5copytst.h5
- )
+ ENDFOREACH (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+
+ #
+ # This section can be removed, but leave here for a reference later.
+ # Purpose: '-l3' ignores top 3 lines when copy text file.
+ #
+ #FOREACH (listfiles ${LIST_OTHER_TEST_FILES})
+ # SET (lsdest "${PROJECT_BINARY_DIR}/testfiles/${listfiles}")
+ # ADD_CUSTOM_COMMAND (
+ # TARGET h5copy
+ # POST_BUILD
+ # COMMAND ${XLATE_UTILITY}
+ # ARGS ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${listfiles} ${lsdest} -l3
+ # )
+ #ENDFOREACH (listfiles ${LIST_OTHER_TEST_FILES})
##############################################################################
##############################################################################
@@ -131,10 +131,10 @@ IF (BUILD_TESTING)
MACRO (ADD_H5LS_TEST file filetest)
# If using memchecker add tests without using scripts
IF (HDF5_ENABLE_USING_MEMCHECKER)
- ADD_TEST (NAME H5COPY-H5LS_${file}-${filetest} COMMAND $<TARGET_FILE:h5ls> -Svr ./testfiles/${file}.out.h5)
+ ADD_TEST (NAME H5COPY-h5ls_${file}-${filetest} COMMAND $<TARGET_FILE:h5ls> -Svr ./testfiles/${file}.out.h5)
ELSE (HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
- NAME H5COPY-H5LS_${file}-${filetest}
+ NAME H5COPY-h5ls_${file}-${filetest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
-D "TEST_ARGS=-Svr;./testfiles/${file}.out.h5"
@@ -147,9 +147,9 @@ IF (BUILD_TESTING)
)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (H5COPY-H5LS_${file}-${filetest} PROPERTIES DEPENDS ${last_test})
+ SET_TESTS_PROPERTIES (H5COPY-h5ls_${file}-${filetest} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
- SET (last_test "H5COPY-H5LS_${file}-${filetest}")
+ SET (last_test "H5COPY-h5ls_${file}-${filetest}")
ENDMACRO (ADD_H5LS_TEST)
#
@@ -159,7 +159,7 @@ IF (BUILD_TESTING)
MACRO (ADD_H5_CMP_TEST testname resultcode infile outfile 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 ${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
+ ADD_TEST (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN})
IF (${resultcode} STREQUAL "1")
SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true")
ENDIF (${resultcode} STREQUAL "1")
@@ -168,7 +168,7 @@ IF (BUILD_TESTING)
NAME H5COPY-CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5copy>"
- -D "TEST_ARGS=-i;${infile};-o;./testfiles/${outfile};${vparam};${sparam};${srcname};${dparam};${dstname}"
+ -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${outfile};${vparam};${sparam};${srcname};${dparam};${dstname}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=./testfiles/${testname}.out.out"
-D "TEST_EXPECT=${resultcode}"
diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in
index 5a300aa..b71ee70 100644
--- a/tools/h5copy/Makefile.in
+++ b/tools/h5copy/Makefile.in
@@ -181,6 +181,7 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
+FC2003 = @FC2003@
FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
@@ -201,10 +202,12 @@ H5_LONE_COLON = @H5_LONE_COLON@
H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
+HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
+HDF_FORTRAN2003 = @HDF_FORTRAN2003@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index fb8bb81..574ba94 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -55,7 +55,7 @@ static void
leave(int ret)
{
h5tools_close();
- exit(ret);
+ HDexit(ret);
}
@@ -75,7 +75,7 @@ leave(int ret)
static void
usage (void)
{
- fprintf(stdout, "\
+ HDfprintf(stdout, "\
usage: h5copy [OPTIONS] [OBJECTS...]\n\
OBJECTS\n\
-i, --input input file name\n\
@@ -219,6 +219,7 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
+
/* initialize h5tools lib */
h5tools_init();
@@ -464,7 +465,7 @@ main (int argc, const char *argv[])
/* free link info path */
if (linkinfo.trg_path)
- HDfree(linkinfo.trg_path);
+ HDfree((char*)linkinfo.trg_path);
/* close propertis */
if(H5Pclose(ocpl_id)<0)
@@ -496,7 +497,7 @@ error:
/* free link info path */
if (linkinfo.trg_path)
- HDfree(linkinfo.trg_path);
+ HDfree((char*)linkinfo.trg_path);
H5E_BEGIN_TRY {
H5Pclose(ocpl_id);
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index f655c39..ee98d7e 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -19,10 +19,6 @@
#include <stdlib.h>
#include "hdf5.h"
#include "H5private.h"
-#include "h5tools.h"
-
-/* Name of tool */
-#define PROGRAMNAME "h5copygentest"
/* HDF file names */
#define HDF_FILE1 "h5copytst.h5"
@@ -368,7 +364,7 @@ static void gent_empty_group(hid_t loc_id)
* Function: gent_nested_datasets
*
* Purpose: Generate a group in a location and populate it with the "standard"
- * datasets
+ * datasets
*
*-------------------------------------------------------------------------
*/
@@ -390,7 +386,7 @@ static void gent_nested_datasets(hid_t loc_id)
* Function: gent_nested_group
*
* Purpose: Generate a group in a location and populate it with another group
- * containing the "standard" datasets
+ * containing the "standard" datasets
*
*-------------------------------------------------------------------------
*/
@@ -435,7 +431,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
sid = H5Screate_simple(1, dims1, NULL);
if (sid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -443,7 +439,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -451,7 +447,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -464,7 +460,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (oid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -473,14 +469,14 @@ static herr_t gen_obj_ref(hid_t loc_id)
status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, -1);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ 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, -1);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -488,7 +484,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
sid = H5Screate_simple (1, dims2, NULL);
if (sid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -496,7 +492,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -504,7 +500,7 @@ static herr_t gen_obj_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -544,7 +540,7 @@ static herr_t gen_region_ref(hid_t loc_id)
sid = H5Screate_simple (2, dims2, NULL);
if (sid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -553,7 +549,7 @@ static herr_t gen_region_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -562,7 +558,7 @@ static herr_t gen_region_ref(hid_t loc_id)
status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -571,7 +567,7 @@ static herr_t gen_region_ref(hid_t loc_id)
status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -580,7 +576,7 @@ static herr_t gen_region_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -589,7 +585,7 @@ static herr_t gen_region_ref(hid_t loc_id)
status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -598,7 +594,7 @@ static herr_t gen_region_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -609,7 +605,7 @@ static herr_t gen_region_ref(hid_t loc_id)
sid = H5Screate_simple (1, dims1, NULL);
if (sid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -618,7 +614,7 @@ static herr_t gen_region_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -627,7 +623,7 @@ static herr_t gen_region_ref(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -754,7 +750,7 @@ static herr_t gen_extlink_trg(hid_t loc_id)
gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -770,7 +766,7 @@ static herr_t gen_extlink_trg(hid_t loc_id)
status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
- fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -803,7 +799,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid < 0)
{
- fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -815,7 +811,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -824,7 +820,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -833,7 +829,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -842,7 +838,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -851,7 +847,7 @@ static herr_t gen_extlink_src(hid_t loc_id)
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", __FUNCTION__, __LINE__);
+ fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__);
ret = FAIL;
goto out;
}
@@ -917,9 +913,6 @@ out:
int main(void)
{
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
-
Test_Obj_Copy();
Test_Ref_Copy();
Test_Extlink_Copy();
diff --git a/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls b/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls
index e0047a7..0134714 100644
--- a/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls
+++ b/tools/h5copy/testfiles/h5copy_extlinks_src.out.ls
@@ -1,6 +1,3 @@
-#############################
-Expected output for 'h5ls ./testfiles/h5copy_extlinks_src.out.h5'
-#############################
Opened "./testfiles/h5copy_extlinks_src.out.h5" with sec2 driver.
/ Group
Location: 1:96
diff --git a/tools/h5copy/testfiles/h5copy_misc1.out b/tools/h5copy/testfiles/h5copy_misc1.out
index 370b1a5..10dd1a6 100644
--- a/tools/h5copy/testfiles/h5copy_misc1.out
+++ b/tools/h5copy/testfiles/h5copy_misc1.out
@@ -1,3 +1,3 @@
-Copying file <h5copytst.h5> and object </simple> to file <./testfiles/h5copytst.out.h5> and object </g1/g2/simple>
+Copying file <./testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copytst.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/h5copy/testfiles/h5copy_ref.out.ls b/tools/h5copy/testfiles/h5copy_ref.out.ls
index 8549842..0769dc8 100644
--- a/tools/h5copy/testfiles/h5copy_ref.out.ls
+++ b/tools/h5copy/testfiles/h5copy_ref.out.ls
@@ -1,6 +1,3 @@
-#############################
-Expected output for 'h5ls ./testfiles/h5copy_ref.out.h5'
-#############################
Opened "./testfiles/h5copy_ref.out.h5" with sec2 driver.
/ Group
Location: 1:96
diff --git a/tools/h5copy/testfiles/h5copytst.out.ls b/tools/h5copy/testfiles/h5copytst.out.ls
index af6cd8f..62c860b 100644
--- a/tools/h5copy/testfiles/h5copytst.out.ls
+++ b/tools/h5copy/testfiles/h5copytst.out.ls
@@ -1,62 +1,59 @@
-#############################
-Expected output for 'h5ls ./testfiles/h5copytst.out.h5'
-#############################
Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
/ Group
Location: 1:96
Links: 1
/A Group
- Location: 1:90032
+ Location: 1:88336
Links: 1
/A/B1 Group
- Location: 1:90736
+ Location: 1:89040
Links: 1
/A/B1/simple Dataset {6/6}
- Location: 1:89904
+ Location: 1:88208
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/A/B2 Group
- Location: 1:94272
+ Location: 1:92576
Links: 1
/A/B2/simple2 Dataset {6/6}
- Location: 1:94144
+ Location: 1:92448
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/C Group
- Location: 1:97480
+ Location: 1:95784
Links: 1
/C/D Group
- Location: 1:98184
+ Location: 1:96488
Links: 1
/C/D/simple Dataset {6/6}
- Location: 1:97352
+ Location: 1:95656
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E Group
- Location: 1:112096
+ Location: 1:110400
Links: 1
/E/F Group
- Location: 1:112800
+ Location: 1:111104
Links: 1
/E/F/grp_dsets Group
- Location: 1:100296
+ Location: 1:98600
Links: 1
/E/F/grp_dsets/chunk Dataset {6/6}
- Location: 1:104480
+ Location: 1:102784
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:104936
+ Location: 1:103240
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E/F/grp_dsets/compound Dataset {2/2}
- Location: 1:105072
+ Location: 1:103376
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -64,60 +61,60 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/E/F/grp_dsets/compressed Dataset {6/6}
- Location: 1:107384
+ Location: 1:105688
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:111696
+ Location: 1:109952
Links: 1
Storage: <details removed for portability>
- Type: shared-1:107552 variable length of
+ Type: shared-1:110080 variable length of
32-bit little-endian integer
/E/F/grp_dsets/nested_vl Dataset {2/2}
- Location: 1:111824
+ Location: 1:110128
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:111968
+ Location: 1:110272
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/E/F/grp_dsets/vl Type
- Location: 1:107552
+ Location: 1:110080
Links: 2
- Type: shared-1:107552 variable length of
+ Type: shared-1:110080 variable length of
32-bit little-endian integer
/G Group
- Location: 1:127744
+ Location: 1:126048
Links: 1
/G/H Group
- Location: 1:128448
+ Location: 1:126752
Links: 1
/G/H/grp_nested Group
- Location: 1:114824
+ Location: 1:113128
Links: 1
/G/H/grp_nested/grp_dsets Group
- Location: 1:115616
+ Location: 1:113920
Links: 1
/G/H/grp_nested/grp_dsets/chunk Dataset {6/6}
- Location: 1:119800
+ Location: 1:118104
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:120256
+ Location: 1:118560
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:120392
+ Location: 1:118696
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -125,34 +122,34 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/G/H/grp_nested/grp_dsets/compressed Dataset {6/6}
- Location: 1:122704
+ Location: 1:121008
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:127016
+ Location: 1:125272
Links: 1
Storage: <details removed for portability>
- Type: shared-1:122872 variable length of
+ Type: shared-1:125400 variable length of
32-bit little-endian integer
/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2}
- Location: 1:127144
+ Location: 1:125448
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:127288
+ Location: 1:125592
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/G/H/grp_nested/grp_dsets/vl Type
- Location: 1:122872
+ Location: 1:125400
Links: 2
- Type: shared-1:122872 variable length of
+ Type: shared-1:125400 variable length of
32-bit little-endian integer
/chunk Dataset {6/6}
Location: 1:6312
@@ -181,21 +178,21 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
Filter-0: deflate-1 OPT {1}
Type: 32-bit little-endian integer
/grp_dsets Group
- Location: 1:33856
+ Location: 1:32160
Links: 1
/grp_dsets/chunk Dataset {6/6}
- Location: 1:38040
+ Location: 1:36344
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:38496
+ Location: 1:36800
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/compound Dataset {2/2}
- Location: 1:38632
+ Location: 1:36936
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -203,62 +200,62 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/grp_dsets/compressed Dataset {6/6}
- Location: 1:40944
+ Location: 1:39248
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:45256
+ Location: 1:43512
Links: 1
Storage: <details removed for portability>
- Type: shared-1:41112 variable length of
+ Type: shared-1:43640 variable length of
32-bit little-endian integer
/grp_dsets/nested_vl Dataset {2/2}
- Location: 1:45384
+ Location: 1:43688
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:45528
+ Location: 1:43832
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/simple_group Dataset {6/6}
- Location: 1:61640
+ Location: 1:59944
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_dsets/vl Type
- Location: 1:41112
+ Location: 1:43640
Links: 2
- Type: shared-1:41112 variable length of
+ Type: shared-1:43640 variable length of
32-bit little-endian integer
/grp_empty Group
- Location: 1:33064
+ Location: 1:31368
Links: 1
/grp_nested Group
- Location: 1:46320
+ Location: 1:44624
Links: 1
/grp_nested/grp_dsets Group
- Location: 1:47112
+ Location: 1:45416
Links: 1
/grp_nested/grp_dsets/chunk Dataset {6/6}
- Location: 1:51296
+ Location: 1:49600
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:51752
+ Location: 1:50056
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_nested/grp_dsets/compound Dataset {2/2}
- Location: 1:51888
+ Location: 1:50192
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -266,51 +263,51 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/grp_nested/grp_dsets/compressed Dataset {6/6}
- Location: 1:54200
+ Location: 1:52504
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:58512
+ Location: 1:56768
Links: 1
Storage: <details removed for portability>
- Type: shared-1:54368 variable length of
+ Type: shared-1:56896 variable length of
32-bit little-endian integer
/grp_nested/grp_dsets/nested_vl Dataset {2/2}
- Location: 1:58640
+ Location: 1:56944
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:58784
+ Location: 1:57088
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_nested/grp_dsets/vl Type
- Location: 1:54368
+ Location: 1:56896
Links: 2
- Type: shared-1:54368 variable length of
+ Type: shared-1:56896 variable length of
32-bit little-endian integer
/grp_rename Group
- Location: 1:62848
+ Location: 1:61152
Links: 1
/grp_rename/chunk Dataset {6/6}
- Location: 1:67032
+ Location: 1:65336
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:67488
+ Location: 1:65792
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/compound Dataset {2/2}
- Location: 1:67624
+ Location: 1:65928
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -318,28 +315,28 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/grp_rename/compressed Dataset {6/6}
- Location: 1:69936
+ Location: 1:68240
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:75728
+ Location: 1:74032
Links: 1
/grp_rename/grp_dsets/chunk Dataset {6/6}
- Location: 1:79912
+ Location: 1:78216
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:80368
+ Location: 1:78672
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/grp_dsets/compound Dataset {2/2}
- Location: 1:80504
+ Location: 1:78808
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -347,73 +344,73 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
"str2" +20 20-byte null-terminated ASCII string
} 40 bytes
/grp_rename/grp_dsets/compressed Dataset {6/6}
- Location: 1:82816
+ Location: 1:81120
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:87128
+ Location: 1:85384
Links: 1
Storage: <details removed for portability>
- Type: shared-1:82984 variable length of
+ Type: shared-1:85512 variable length of
32-bit little-endian integer
/grp_rename/grp_dsets/nested_vl Dataset {2/2}
- Location: 1:87256
+ Location: 1:85560
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:87400
+ Location: 1:85704
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/grp_dsets/vl Type
- Location: 1:82984
+ Location: 1:85512
Links: 2
- Type: shared-1:82984 variable length of
+ Type: shared-1:85512 variable length of
32-bit little-endian integer
/grp_rename/named_vl Dataset {2/2}
- Location: 1:74248
+ Location: 1:72504
Links: 1
Storage: <details removed for portability>
- Type: shared-1:70104 variable length of
+ Type: shared-1:72632 variable length of
32-bit little-endian integer
/grp_rename/nested_vl Dataset {2/2}
- Location: 1:74376
+ Location: 1:72680
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:74520
+ Location: 1:72824
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/grp_rename/vl Type
- Location: 1:70104
+ Location: 1:72632
Links: 2
- Type: shared-1:70104 variable length of
+ Type: shared-1:72632 variable length of
32-bit little-endian integer
/named_vl Dataset {2/2}
- Location: 1:13200
+ Location: 1:19296
Links: 1
Storage: <details removed for portability>
- Type: shared-1:13152 variable length of
+ Type: shared-1:19424 variable length of
32-bit little-endian integer
/nested_vl Dataset {2/2}
- Location: 1:27488
+ Location: 1:25792
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:31856
+ Location: 1:30160
Links: 1
Storage: <details removed for portability>
Type: struct {
@@ -426,7 +423,7 @@ Opened "./testfiles/h5copytst.out.h5" with sec2 driver.
Storage: <details removed for portability>
Type: 32-bit little-endian integer
/simple_top Dataset {6/6}
- Location: 1:29680
+ Location: 1:27984
Links: 1
Storage: <details removed for portability>
Type: 32-bit little-endian integer
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index 3816def..4501e29 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -19,15 +19,52 @@
# Thursday, July 20, 2006
#
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# 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/h5diff/testfiles"
+SRC_H5COPY_TESTFILES="$SRC_TOOLS/h5copy/testfiles"
+SRC_H5REPACK_TESTFILES="$SRC_TOOLS/h5repack/testfiles"
+SRC_H5JAM_TESTFILES="$SRC_TOOLS/h5jam/testfiles"
+SRC_H5STAT_TESTFILES="$SRC_TOOLS/h5stat/testfiles"
+SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/h5import/testfiles"
+
TESTNAME=h5copy
EXIT_SUCCESS=0
EXIT_FAILURE=1
-# Test files
-HDF_FILE1=h5copytst.h5
-HDF_FILE2=h5copy_ref.h5
-HDF_EXT_SRC_FILE=h5copy_extlinks_src.h5
-HDF_EXT_TRG_FILE=h5copy_extlinks_trg.h5
+######################################################################
+# 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_extlinks_src.out.ls
+$SRC_H5COPY_TESTFILES/h5copy_ref.out.ls
+$SRC_H5COPY_TESTFILES/h5copytst.out.ls
+$SRC_H5COPY_TESTFILES/h5copy_misc1.out
+"
H5COPY=h5copy # The tool name
H5COPY_BIN=`pwd`/$H5COPY # The path of the tool binary
@@ -38,19 +75,14 @@ H5LS_ARGS=-Svr # Arguments to the h5ls tool
H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary
CMP='cmp -s'
DIFF='diff -c'
+CP='cp'
nerrors=0
verbose=yes
h5haveexitcode=yes # default is yes
-# The build (current) directory might be different than the source directory.
-if test -z "$srcdir"; then
- srcdir=.
-fi
-INDIR=$srcdir/testfiles
-OUTDIR=./testfiles
-
-test -d $OUTDIR || mkdir $OUTDIR
+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
@@ -59,6 +91,31 @@ if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
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
+ if [ -a $tstfile ]; then
+ $CP -f $tstfile $TESTDIR
+ else
+ echo "Error: FAILED to copy $tstfile."
+ echo " $tstfile doesn't exist!"
+ exit $EXIT_FAILURE
+ fi
+ fi
+ done
+}
+
# Print a "SKIP" message
SKIP() {
TESTING $H5COPY $@
@@ -100,6 +157,9 @@ VERIFY_OUTPUT()
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.
@@ -112,6 +172,8 @@ VERIFY_OUTPUT()
TOOLTEST()
{
+ actualout="$TESTDIR/tooltest.actualout"
+ actualerr="$TESTDIR/tooltest.actualerr"
runh5diff=yes
if [ "$1" = -i ]; then
inputfile=$2
@@ -130,19 +192,19 @@ TOOLTEST()
echo " output for '$H5COPY $@'"
echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
- ) > output.out
+ ) > $actualout 2> $actualerr
RET=$?
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
- cat output.out
+ cat $actualout
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f output.out
+ rm -f $actualout $actualerr
fi
fi
@@ -181,9 +243,11 @@ CMP_OUTPUT()
TOOLTEST_FAIL()
{
- expectout="$INDIR/$1"
- actualout="$OUTDIR/$1.out"
- actualerr="$OUTDIR/$1.err"
+ 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
@@ -199,7 +263,13 @@ TOOLTEST_FAIL()
#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
@@ -219,7 +289,7 @@ TOOLTEST_FAIL()
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actualout $actualerr
+ rm -f $actualout $actualerr $actualout_sav $actualerr_sav
fi
}
@@ -259,8 +329,8 @@ H5DIFFTEST_FAIL()
#
H5LSTEST()
{
- expect="$INDIR/`basename $1 .h5`.ls"
- actual="$OUTDIR/`basename $1 .h5`.out"
+ expect="$TESTDIR/`basename $1 .h5`.ls"
+ actual="$TESTDIR/`basename $1 .h5`.ls.actualout"
# Stderr is included in stdout so that the diff can detect
# any unexpected output from that stream too.
@@ -269,9 +339,6 @@ H5LSTEST()
# so that the output is more portable
VERIFY_H5LS $@
(
- echo "#############################"
- echo "Expected output for '$H5LS $@'"
- echo "#############################"
$RUNSERIAL $H5LS_BIN $H5LS_ARGS $@
) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' |sed 's/Storage:.*/Storage: <details removed for portability>/' >$actual
@@ -302,8 +369,8 @@ H5LSTEST()
# <none>
COPY_OBJECTS()
{
- TESTFILE="$INDIR/$HDF_FILE1"
- FILEOUT="$OUTDIR/`basename $HDF_FILE1 .h5`.out.h5"
+ TESTFILE="$TESTDIR/h5copytst.h5"
+ FILEOUT="$TESTDIR/`basename h5copytst.h5 .h5`.out.h5"
# Remove any output file left over from previous test run
rm -f $FILEOUT
@@ -362,8 +429,8 @@ COPY_OBJECTS()
# <none>
COPY_REFERENCES()
{
- TESTFILE="$INDIR/$HDF_FILE2"
- FILEOUT="$OUTDIR/`basename $HDF_FILE2 .h5`.out.h5"
+ TESTFILE="$TESTDIR/h5copy_ref.h5"
+ FILEOUT="$TESTDIR/`basename h5copy_ref.h5 .h5`.out.h5"
# Remove any output file left over from previous test run
rm -f $FILEOUT
@@ -388,8 +455,8 @@ COPY_REFERENCES()
# <none>
COPY_EXT_LINKS()
{
- TESTFILE="$INDIR/$HDF_EXT_SRC_FILE"
- FILEOUT="$OUTDIR/`basename $HDF_EXT_SRC_FILE .h5`.out.h5"
+ TESTFILE="$TESTDIR/h5copy_extlinks_src.h5"
+ FILEOUT="$TESTDIR/`basename h5copy_extlinks_src.h5 .h5`.out.h5"
# Remove any output file left over from previous test run
rm -f $FILEOUT
@@ -434,8 +501,8 @@ COPY_EXT_LINKS()
# <none>
TEST_MISC()
{
- TESTFILE="$HDF_FILE1"
- FILEOUT="$OUTDIR/`basename $HDF_FILE1 .h5`.out.h5"
+ TESTFILE="$TESTDIR/h5copytst.h5"
+ FILEOUT="$TESTDIR/`basename h5copytst.h5 .h5`.out.h5"
# Remove any output file left over from previous test run
rm -f $FILEOUT
@@ -462,7 +529,10 @@ TEST_MISC()
##############################################################################
### T H E T E S T S ###
##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+# Start tests
COPY_OBJECTS
COPY_REFERENCES
COPY_EXT_LINKS
@@ -471,8 +541,6 @@ TEST_MISC
# Add newline for nicer formatting
echo " "
-COPYOBJECTS h5copytst_new.h5
-
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS