[svn-r20429] CMake: correct h5copy test macros, add userblock script test to h5jam tests, and correct h5jam tests

Tested: local linux
This commit is contained in:
Allen Byrne 2011-04-07 09:03:08 -05:00
parent 00b2dc9137
commit 7728391265
5 changed files with 269 additions and 102 deletions

View File

@ -1991,6 +1991,7 @@
./config/cmake/CTest.cmake
./config/cmake/grepTest.cmake
./config/cmake/runTest.cmake
./config/cmake/userblockTest.cmake
./config/cmake/vfdTest.cmake
./config/cmake/CTestCustom.cmake
./config/cmake/ConfigureChecks.cmake

View File

@ -29,6 +29,7 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE
H5COPY-clear-refs
H5COPY-clear-ext-links
H5COPY-clear-misc
H5COPY-clear-samefile
######### tools/h5diff #########
H5DIFF-clearall-objects
######### tools/h5dump #########

View File

@ -0,0 +1,120 @@
# runTest.cmake executes a command and captures the output in a file. File is then compared
# against a reference file. Exit status of command can also be compared.
# arguments checking
IF (NOT TEST_PROGRAM)
MESSAGE (FATAL_ERROR "Require TEST_PROGRAM tellub to be defined")
ENDIF (NOT TEST_PROGRAM)
IF (NOT TEST_GET_PROGRAM)
MESSAGE (FATAL_ERROR "Require TEST_GET_PROGRAM getub to be defined")
ENDIF (NOT TEST_GET_PROGRAM)
IF (NOT TEST_FOLDER)
MESSAGE ( FATAL_ERROR "Require TEST_FOLDER to be defined")
ENDIF (NOT TEST_FOLDER)
IF (NOT TEST_HFILE)
MESSAGE (FATAL_ERROR "Require TEST_HFILE the hdf file to be defined")
ENDIF (NOT TEST_HFILE)
IF (NOT TEST_UFILE)
MESSAGE (FATAL_ERROR "Require TEST_UFILE the ub file to be defined")
ENDIF (NOT TEST_UFILE)
IF (NOT TEST_CHECKUB)
MESSAGE (STATUS "Require TEST_CHECKUB - YES or NO - to be defined")
ENDIF (NOT TEST_CHECKUB)
#IF (NOT TEST_EXPECT)
# MESSAGE (STATUS "Require TEST_EXPECT to be defined")
#ENDIF (NOT TEST_EXPECT)
#IF (NOT TEST_OFILE)
# MESSAGE (FATAL_ERROR "Require TEST_OFILE the original hdf file to be defined")
#ENDIF (NOT TEST_OFILE)
SET (TEST_U_STRING_LEN 0)
SET (TEST_O_STRING_LEN 0)
SET (TEST_H_STRING_LEN 0)
SET (TEST_STRING_SIZE 0)
IF (TEST_CHECKUB STREQUAL "YES")
# find the length of the user block to check
#s1=`cat $ufile | wc -c | sed -e 's/ //g'`
FILE (STRINGS ${TEST_FOLDER}/${TEST_UFILE} TEST_U_STRING)
STRING (LENGTH ${TEST_U_STRING} TEST_U_STRING_LEN)
# Get the size of the original user block, if any.
IF (TEST_OFILE)
# 'tellub' calls H5Fget_user_block to get the size
# of the user block
#s2=`$JAM_BIN/tellub $origfile`
EXECUTE_PROCESS (
COMMAND ${TEST_PROGRAM} ${TEST_OFILE}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
OUTPUT_FILE ${TEST_HFILE}.len.txt
OUTPUT_VARIABLE TEST_ERROR
ERROR_VARIABLE TEST_ERROR
)
IF (NOT ${TEST_RESULT} STREQUAL "0")
MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} ${TEST_OFILE} is: ${TEST_ERROR}")
ENDIF (NOT ${TEST_RESULT} STREQUAL "0")
FILE (READ ${TEST_HFILE}.len.txt TEST_O_STRING_LEN)
ENDIF (TEST_OFILE)
MATH( EXPR TEST_STRING_SIZE "${TEST_U_STRING_LEN} + ${TEST_O_STRING_LEN}" )
IF (NOT TEST_O_STRING_LEN STREQUAL "0")
#$JAM_BIN/getub -c $s2 $origfile > $cmpfile
EXECUTE_PROCESS (
COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
OUTPUT_FILE ${TEST_UFILE}.cmp
OUTPUT_VARIABLE TEST_ERROR
ERROR_VARIABLE TEST_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
#cat $ufile >> $cmpfile
FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME)
FILE (APPEND ${TEST_UFILE}.cmp "${TEST_STREAM}")
ELSE (NOT TEST_O_STRING_LEN STREQUAL "0")
FILE (STRINGS ${TEST_UFILE} TEST_STREAM NEWLINE_CONSUME)
FILE (WRITE ${TEST_UFILE}.cmp ${TEST_STREAM})
ENDIF (NOT TEST_O_STRING_LEN STREQUAL "0")
#$JAM_BIN/getub -c $size $hfile > $tfile
EXECUTE_PROCESS (
COMMAND ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_RESULT
OUTPUT_FILE ${TEST_HFILE}.cmp
OUTPUT_VARIABLE TEST_ERROR
ERROR_VARIABLE TEST_ERROR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# now compare the outputs
EXECUTE_PROCESS (
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_UFILE}.cmp ${TEST_HFILE}.cmp
RESULT_VARIABLE TEST_RESULT
)
MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}: ${TEST_STRING_SIZE}=${TEST_U_STRING_LEN}+${TEST_O_STRING_LEN}")
# if the return value is !=${TEST_EXPECT} bail out
IF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_UFILE} did not match ${TEST_HFILE}.\n${TEST_ERROR}")
ENDIF (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
ELSE (TEST_CHECKUB STREQUAL "YES")
# call 'ubsize' to get the size of the user block
#ubsize=`$JAM_BIN/tellub $hfile`
EXECUTE_PROCESS (
COMMAND ${TEST_PROGRAM} ${TEST_HFILE}
WORKING_DIRECTORY ${TEST_FOLDER}
RESULT_VARIABLE TEST_H_STRING_LEN
OUTPUT_VARIABLE TEST_ERROR
ERROR_VARIABLE TEST_ERROR
)
IF (NOT TEST_H_STRING_LEN STREQUAL "0")
MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_HFILE} was NOT empty")
ENDIF (NOT TEST_H_STRING_LEN STREQUAL "0")
ENDIF (TEST_CHECKUB STREQUAL "YES")
# everything went fine...
MESSAGE ("Passed: The output of CHECK matched expectation")

View File

@ -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)
##############################################################################

View File

@ -165,29 +165,56 @@ IF (BUILD_TESTING)
ENDMACRO(SETUP testname infile outfile)
MACRO (CHECK_UB_1 testname testfile ufile)
IF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary
ADD_TEST (
NAME H5JAM-CHECK_UB_1-${testname}
COMMAND ${CMAKE_COMMAND} -E echo "CHECK_UB_1 ${testname} ${testfile} ${ufile} ${ARGN}"
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5JAM-CHECK_UB_1-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
NAME H5JAM-CHECK_UB_1-${testname}-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
${testfile}.len.txt
${testfile}.cmp
${ufile}.cmp
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
ADD_TEST (
NAME H5JAM-CHECK_UB_1-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
-D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
-D "TEST_CHECKUB=YES"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_HFILE=${testfile}"
-D "TEST_UFILE=${ufile}"
-D "TEST_EXPECT=0"
-D "TEST_OFILE=${ARGN}"
-P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
)
SET_TESTS_PROPERTIES (H5JAM-CHECK_UB_1-${testname} PROPERTIES DEPENDS H5JAM-CHECK_UB_1-${testname}-clear-objects)
SET (last_test "H5JAM-CHECK_UB_1-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO(CHECK_UB_1 testname testfile ufile)
MACRO (CHECK_NOUB testname testfile)
IF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary
ADD_TEST (
NAME H5JAM-CHECK_NOUB-${testname}
COMMAND ${CMAKE_COMMAND} -E echo "CHECK_NOUB ${testname} ${testfile} ${ARGN}"
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5JAM-CHECK_NOUB-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) #Temporary
IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ADD_TEST (
NAME H5JAM-CHECK_NOUB-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:tellub>"
-D "TEST_GET_PROGRAM=$<TARGET_FILE:getub>"
-D "TEST_CHECKUB=NO"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_HFILE=${testfile}"
-D "TEST_EXPECT=0"
-D "TEST_UFILE=NULL"
-D "TEST_OFILE=NULL"
-P "${HDF5_RESOURCES_DIR}/userblockTest.cmake"
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5JAM-CHECK_NOUB-${testname} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5JAM-CHECK_NOUB-${testname}")
ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO(CHECK_NOUB testname testfile)
MACRO (UNJAMTEST testname infile ufile outfile)
@ -204,7 +231,7 @@ IF (BUILD_TESTING)
COMMAND ${CMAKE_COMMAND} -E remove ${ufile}
)
SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile} ${ARGN})
ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -u ${ufile} -o ${outfile})
SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects)
SET (compare_test ${ufile})
ELSE (NOT "${ufile}" STREQUAL "NONE")
@ -232,38 +259,46 @@ IF (BUILD_TESTING)
SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects)
SET (compare_test "${outfile}.ufile.txt")
ELSE (NOT "${ARGN}" STREQUAL "--delete")
ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile} ${ARGN})
ADD_TEST (NAME H5JAM-UNJAM-${testname} COMMAND $<TARGET_FILE:h5unjam> -i ${infile} -o ${outfile})
SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
SET (compare_test "")
ENDIF (NOT "${ARGN}" STREQUAL "--delete")
ENDIF (NOT "${ufile}" STREQUAL "NONE")
SET (last_test "H5JAM-UNJAM-${testname}")
IF (NOT "${compare_test}" STREQUAL "")
CHECK_UB_1 (${testname} ${infile} ${compare_test})
ENDIF (NOT "${compare_test}" STREQUAL "")
CHECK_NOUB (${testname} ${compare_test})
CHECK_NOUB (${testname} ${outfile})
ENDMACRO(UNJAMTEST testname infile ufile outfile)
MACRO (JAMTEST testname jamfile infile outfile)
ADD_TEST (
NAME H5JAM-${testname}-clear-objects
COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5
)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5JAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5JAM-${testname}-clear-objects")
IF ("${outfile}" STREQUAL "NONE")
ADD_TEST (
NAME H5JAM-NONE_COPY-${testname}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${infile} ${infile}.cpy.h5
)
SET_TESTS_PROPERTIES (H5JAM-NONE_COPY-${testname} PROPERTIES DEPENDS ${last_test})
SET (last_test "H5JAM-NONE_COPY-${testname}")
ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${infile} ${ARGN})
SET (compare_test testfiles/${infile})
SET (compare_test ${infile})
SET (compare_orig ${infile}.cpy.h5)
ELSE ("${outfile}" STREQUAL "NONE")
ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN})
SET (compare_test testfiles/${outfile})
SET (compare_test ${outfile})
SET (compare_orig testfiles/${infile})
ENDIF ("${outfile}" STREQUAL "NONE")
SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects)
SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS ${last_test})
SET (last_test "H5JAM-${testname}")
IF ("${ARGN}" STREQUAL "--clobber")
SET (compare_orig "NONE")
ELSE ("${ARGN}" STREQUAL "--clobber")
SET (compare_orig testfiles/${infile})
SET (compare_orig "")
ENDIF ("${ARGN}" STREQUAL "--clobber")
CHECK_UB_1 (${testname} ${compare_test} testfiles/${jamfile} ${compare_orig})
ENDMACRO (JAMTEST testname jamfile infile outfile)