summaryrefslogtreecommitdiffstats
path: root/tools/h5copy
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-07 14:03:08 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-07 14:03:08 (GMT)
commit7728391265eb19e7c0f341ac05b52d6b55f35e7e (patch)
treebc892d7de5a075f49db42043a2ee3e132f9b2364 /tools/h5copy
parent00b2dc91371db626740ec579c88bc7a852280701 (diff)
downloadhdf5-7728391265eb19e7c0f341ac05b52d6b55f35e7e.zip
hdf5-7728391265eb19e7c0f341ac05b52d6b55f35e7e.tar.gz
hdf5-7728391265eb19e7c0f341ac05b52d6b55f35e7e.tar.bz2
[svn-r20429] CMake: correct h5copy test macros, add userblock script test to h5jam tests, and correct h5jam tests
Tested: local linux
Diffstat (limited to 'tools/h5copy')
-rw-r--r--tools/h5copy/CMakeLists.txt154
1 files changed, 82 insertions, 72 deletions
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 8a6ca11..90ad711 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -70,6 +70,13 @@ IF (BUILD_TESTING)
)
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
+ )
+
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
@@ -79,44 +86,46 @@ IF (BUILD_TESTING)
#
# Perform h5copy according to passing parmeters
#
- MACRO (ADD_H5COPY_TEST testname resultcode infile outfile vparam srcname dstname)
+ MACRO (ADD_H5_F_TEST testname resultcode infile outfile fparam vparam sparam srcname dparam dstname)
+ ADD_TEST (
+ NAME H5COPY_F-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5COPY_F-${testname}")
+ ADD_H5_DIFF_TEST (${testname} ${resultcode} ${infile} ${outfile} ${srcname} ${dstname})
+ ENDMACRO (ADD_H5_F_TEST)
- IF (NOT "${ARGN}" STREQUAL "")
- ADD_TEST (
- NAME H5COPY-${testname}
- COMMAND $<TARGET_FILE:h5copy> -f ${ARGN} -i ./testfiles/${infile} -o ./testfiles/${outfile} -${vparam} -s ${srcname} -d ${dstname}
- )
- ELSE (NOT "${ARGN}" STREQUAL "")
- ADD_TEST (
- NAME H5COPY-${testname}
- COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${outfile} -${vparam} -s ${srcname} -d ${dstname}
- )
- ENDIF (NOT "${ARGN}" STREQUAL "")
+ MACRO (ADD_H5_TEST testname resultcode infile outfile vparam sparam srcname dparam dstname)
+ ADD_TEST (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${outfile} ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}
+ )
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5COPY-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-${testname}")
+ ADD_H5_DIFF_TEST (${testname} ${resultcode} ${infile} ${outfile} ${srcname} ${dstname})
+ ENDMACRO (ADD_H5_TEST)
+
+ MACRO (ADD_H5_DIFF_TEST testname resultcode infile outfile srcname dstname)
# resultcode=2 will cause the test to skip the diff test
IF (NOT ${resultcode} STREQUAL "2")
ADD_TEST (
NAME H5COPY-DIFF_${testname}
COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${infile} ./testfiles/${outfile} ${srcname} ${dstname}
)
- SET_TESTS_PROPERTIES(H5COPY-DIFF_${testname} PROPERTIES DEPENDS H5COPY-${testname})
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES(H5COPY-DIFF_${testname} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-DIFF_${testname}")
IF (${resultcode} STREQUAL "1")
SET_TESTS_PROPERTIES (H5COPY-DIFF_${testname} PROPERTIES WILL_FAIL "true")
ENDIF (${resultcode} STREQUAL "1")
ENDIF (NOT ${resultcode} STREQUAL "2")
- ENDMACRO (ADD_H5COPY_TEST)
-
- #
- # call ADD_H5COPY_TEST macro with assumption that source and target file
- # is different
- #
- MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
- ADD_H5COPY_TEST (${testname} ${resultcode} ${testfile}.h5 ${testfile}.out.h5 ${vparam} ${srcname} ${dstname} ${ARGN})
- ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+ ENDMACRO (ADD_H5_DIFF_TEST)
#
# Test result with h5ls
@@ -143,16 +152,16 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5COPY-H5LS_${file}-${filetest} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-H5LS_${file}-${filetest}")
- ENDMACRO (ADD_H5LS_TEST file filetest)
+ ENDMACRO (ADD_H5LS_TEST)
#
# 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 testfile vparam srcname dstname)
+ 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 ${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname})
+ ADD_TEST (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ${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")
@@ -161,7 +170,7 @@ IF (BUILD_TESTING)
NAME H5COPY-CMP-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5copy>"
- -D "TEST_ARGS=-i;${testfile}.h5;-o;./testfiles/${testfile}.out.h5;-${vparam};-s;${srcname};-d;${dstname}"
+ -D "TEST_ARGS=-i;${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}"
@@ -174,7 +183,7 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5COPY-CMP-${testname}")
- ENDMACRO (ADD_H5_CMP_TEST testname resultcode testfile vparam srcname dstname)
+ ENDMACRO (ADD_H5_CMP_TEST)
##############################################################################
##############################################################################
@@ -189,7 +198,6 @@ IF (BUILD_TESTING)
SET (HDF_FILE2 h5copy_ref)
SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
- SET (HDF_FILE1_TMP h5copytst_tmp)
# Remove any output file left over from previous test run
ADD_TEST (
@@ -212,40 +220,40 @@ IF (BUILD_TESTING)
SET (last_test "H5COPY-clearall-objects")
# "Test copying various forms of datasets"
- ADD_H5_TEST (simple 0 ${HDF_FILE1} v simple simple)
- ADD_H5_TEST (chunk 0 ${HDF_FILE1} v chunk chunk)
- ADD_H5_TEST (compact 0 ${HDF_FILE1} v compact compact)
- ADD_H5_TEST (compound 0 ${HDF_FILE1} v compound compound)
- ADD_H5_TEST (compressed 0 ${HDF_FILE1} v compressed compressed)
- ADD_H5_TEST (named_vl 0 ${HDF_FILE1} v named_vl named_vl)
- ADD_H5_TEST (nested_vl 0 ${HDF_FILE1} v nested_vl nested_vl)
+ ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s simple -d simple)
+ ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s chunk -d chunk)
+ ADD_H5_TEST (compact 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compact -d compact)
+ ADD_H5_TEST (compound 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d compound)
+ ADD_H5_TEST (compressed 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compressed -d compressed)
+ ADD_H5_TEST (named_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s named_vl -d named_vl)
+ ADD_H5_TEST (nested_vl 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.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} v grp_dsets/simple simple_top)
+ ADD_H5_TEST (simple_top 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets/simple -d simple_top)
# "Test copying & renaming dataset"
- ADD_H5_TEST (rename 0 ${HDF_FILE1} v compound rename)
+ ADD_H5_TEST (rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s compound -d rename)
# "Test copying empty, 'full' & 'nested' groups"
- ADD_H5_TEST (grp_empty 0 ${HDF_FILE1} v grp_empty grp_empty)
- ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1} v grp_dsets grp_dsets)
- ADD_H5_TEST (grp_nested 0 ${HDF_FILE1} v grp_nested grp_nested)
+ ADD_H5_TEST (grp_empty 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_empty -d grp_empty)
+ ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_dsets)
+ ADD_H5_TEST (grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_nested -d grp_nested)
# "Test copying dataset within group in source file to group in destination"
- ADD_H5_TEST (simple_group 0 ${HDF_FILE1} v /grp_dsets/simple /grp_dsets/simple_group)
+ ADD_H5_TEST (simple_group 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets/simple -d /grp_dsets/simple_group)
# "Test copying & renaming group"
- ADD_H5_TEST (grp_rename 0 ${HDF_FILE1} v grp_dsets grp_rename)
+ ADD_H5_TEST (grp_rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s grp_dsets -d grp_rename)
# "Test copying 'full' group hierarchy into group in destination file"
- ADD_H5_TEST (grp_dsets_rename 0 ${HDF_FILE1} v grp_dsets /grp_rename/grp_dsets)
+ ADD_H5_TEST (grp_dsets_rename 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -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} vp simple /A/B1/simple)
- ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1} vp simple /A/B2/simple2)
- ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1} vp /grp_dsets/simple /C/D/simple)
- ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1} vp /grp_dsets /E/F/grp_dsets)
- ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1} vp /grp_nested /G/H/grp_nested)
+ ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B1/simple)
+ ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s simple -d /A/B2/simple2)
+ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets/simple -d /C/D/simple)
+ ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_dsets -d /E/F/grp_dsets)
+ ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -vp -s /grp_nested -d /G/H/grp_nested)
# Verify that the file created above is correct
ADD_H5LS_TEST (${HDF_FILE1} basic)
@@ -267,7 +275,7 @@ IF (BUILD_TESTING)
SET (last_test "H5COPY-clear-refs")
# "Test copying object and region references"
- ADD_H5_TEST (region_ref 2 ${HDF_FILE2} v / /COPY ref)
+ ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ${HDF_FILE2}.out.h5 ref -v -s / -d /COPY)
# Verify that the file created above is correct
ADD_H5LS_TEST (${HDF_FILE2} refs)
@@ -289,41 +297,33 @@ IF (BUILD_TESTING)
SET (last_test "H5COPY-clear-ext-links")
# "Test copying external link directly without -f ext"
- ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy1_dset)
+ ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_dset -d /copy1_dset)
# "Test copying external link directly with -f ext"
- ADD_H5_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy2_dset ext)
+ ADD_H5_F_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.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} v /group_ext/extlink_notyet1 /copy_dangle1_1)
+ ADD_H5_TEST (ext_dangle_noobj 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet1 -d /copy_dangle1_1)
# "Test copying dangling external link (no obj) directly with -f ext"
- ADD_H5_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_2 ext)
+ ADD_H5_F_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.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} v /group_ext/extlink_notyet2 /copy_dangle2_1)
+ ADD_H5_TEST (ext_dangle_nofile 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext/extlink_notyet2 -d /copy_dangle2_1)
# "Test copying dangling external link (no file) directly with -f ext"
- ADD_H5_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_2 ext)
+ ADD_H5_F_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.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} v /group_ext /copy1_group)
+ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 -v -s /group_ext -d /copy1_group)
# "Test copying a group contains external links with -f ext"
- ADD_H5_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy2_group ext)
+ ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ${HDF_EXT_SRC_FILE}.out.h5 ext -v -s /group_ext -d /copy2_group)
# Verify that the file created above is correct
ADD_H5LS_TEST (${HDF_EXT_SRC_FILE} links)
############# Test misc. ##############
-
- 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
- )
-
# Remove any output file left over from previous test run
ADD_TEST (
NAME H5COPY-clear-misc
@@ -331,8 +331,7 @@ IF (BUILD_TESTING)
-E remove
./testfiles/h5copy_misc1.out.out
./testfiles/h5copy_misc1.out.out.err
- ./testfiles/${HDF_FILE1_TMP}.h5
- ./testfiles/h5copy_misc1.out.h5
+ ./testfiles/${HDF_FILE1}.out.h5
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5COPY-clear-misc PROPERTIES DEPENDS ${last_test})
@@ -342,19 +341,30 @@ IF (BUILD_TESTING)
#-----------------------------------------------------------------
# "Test copying object into group which doesn't exist, without -p"
#
- ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1} v /simple /g1/g2/simple)
+ ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /g1/g2/simple)
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-samefile
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_FILE1}.out.h5
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5COPY-clear-samefile PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5COPY-clear-samefile")
#-------------------------------------------
# "Test copying objects to the same file "
#
# create temporary test file with some objects
- ADD_H5COPY_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple)
- ADD_H5COPY_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets)
+ ADD_H5_TEST (samefile1_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple)
+ ADD_H5_TEST (samefile2_pre 0 ${HDF_FILE1}.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets)
# actual test cases
# - dataset
- ADD_H5COPY_TEST (samefile1 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /simple /simple_cp)
+ ADD_H5_TEST (samefile1 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /simple -d /simple_cp)
# - group with some datasets
- ADD_H5COPY_TEST (samefile2 0 ${HDF_FILE1_TMP}.h5 ${HDF_FILE1_TMP}.h5 v /grp_dsets /grp_dsets_cp)
+ ADD_H5_TEST (samefile2 0 ${HDF_FILE1}.out.h5 ${HDF_FILE1}.out.h5 -v -s /grp_dsets -d /grp_dsets_cp)
ENDIF (BUILD_TESTING)
##############################################################################