summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-03-23 21:23:11 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-03-23 21:23:11 (GMT)
commit76abbdeff03a5025d8786f3fdc4007c5bed64a71 (patch)
treebcbf816942e85942e250063bf140abe79ecaee4f
parent4147de8d02fdfb651e860df999f87263d72be573 (diff)
downloadhdf5-76abbdeff03a5025d8786f3fdc4007c5bed64a71.zip
hdf5-76abbdeff03a5025d8786f3fdc4007c5bed64a71.tar.gz
hdf5-76abbdeff03a5025d8786f3fdc4007c5bed64a71.tar.bz2
[svn-r20305] Add tests to h5import and 80% of h5jam
Tested: local linux
-rwxr-xr-xconfig/cmake/CTestCustom.cmake113
-rw-r--r--config/cmake/runTest.cmake26
-rw-r--r--tools/h5import/CMakeLists.txt195
-rw-r--r--tools/h5jam/CMakeLists.txt345
4 files changed, 647 insertions, 32 deletions
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
index ac400fb..2a3159b 100755
--- a/config/cmake/CTestCustom.cmake
+++ b/config/cmake/CTestCustom.cmake
@@ -26,26 +26,9 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE
hl_fortran_test-clear-objects
######### tools/h5copy #########
H5COPY-clearall-objects
- H5COPY-H5LS_h5copytst-basic #uses runTest.cmake
H5COPY-clear-refs
- H5COPY-region_ref #needs clear-refs
- H5COPY-H5LS_h5copy_ref-refs #uses runTest.cmake
H5COPY-clear-ext-links
- H5COPY-ext_link #needs clear-ext-links
- H5COPY-ext_link_f #needs clear-ext-links
- H5COPY-ext_dangle_noobj #needs clear-ext-links
- H5COPY-ext_dangle_noobj_f #needs clear-ext-links
- H5COPY-ext_dangle_nofile #needs clear-ext-links
- H5COPY-ext_dangle_nofile_f #needs clear-ext-links
- H5COPY-ext_link_group #needs clear-ext-links
- H5COPY-ext_link_group_f #needs clear-ext-links
- H5COPY-H5LS_h5copy_extlinks_src-links #uses runTest.cmake
H5COPY-clear-misc
- H5COPY-CMP-h5copy_misc1 #uses runTest.cmake
- H5COPY-samefile1_pre #needs clear-ext-links
- H5COPY-samefile2_pre #needs clear-ext-links
- H5COPY-samefile1 #needs clear-ext-links
- H5COPY-samefile2 #needs clear-ext-links
######### tools/h5diff #########
H5DIFF-clearall-objects
######### tools/h5dump #########
@@ -57,6 +40,102 @@ SET (CTEST_CUSTOM_MEMCHECK_IGNORE
H5DUMP-XML-clearall-objects
######### tools/h5import #########
H5IMPORT-clear-objects
+ H5IMPORT-ASCII_F32-clear-objects
+ H5IMPORT-ASCII_UI16-clear-objects
+ H5IMPORT-ASCII_UI32-clear-objects
+ H5IMPORT-ASCII_I8-clear-objects
+ H5IMPORT-ASCII_I16-clear-objects
+ H5IMPORT-ASCII_I32-clear-objects
+ H5IMPORT-ASCII_F64_R1-clear-objects
+ H5IMPORT-BINARY_I8_EOF-clear-objects
+ H5IMPORT-STR-clear-objects
+ H5IMPORT-BINARY_UI32-clear-objects
+ H5IMPORT-BINARY_UI16-clear-objects
+ H5IMPORT-BINARY_I32-clear-objects
+ H5IMPORT-BINARY_I8-clear-objects
+ H5IMPORT-BINARY_I16-clear-objects
+ H5IMPORT-BINARY_F64-clear-objects
+ H5IMPORT-ASCII_F64-clear-objects
+ ######### tools/h5jam #########
+ H5JAM-SETUP-N_twithub_u511_c-clear-objects
+ H5JAM-N_twithub_u511_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub_u511_c-clear-objects
+ H5JAM-SETUP-N_twithub_u512_c-clear-objects
+ H5JAM-N_twithub_u512_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub_u512_c-clear-objects
+ H5JAM-SETUP-N_twithub_u513_c-clear-objects
+ H5JAM-N_twithub_u513_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub_u513_c-clear-objects
+ H5JAM-SETUP-N_twithub513_u10_c-clear-objects
+ H5JAM-N_twithub513_u10_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub513_u10_c-clear-objects
+ H5JAM-SETUP-N_twithub513_u511_c-clear-objects
+ H5JAM-N_twithub513_u511_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub513_u511_c-clear-objects
+ H5JAM-SETUP-N_twithub513_u512_c-clear-objects
+ H5JAM-N_twithub513_u512_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub513_u512_c-clear-objects
+ H5JAM-CHECKFILE-twithub_u10_c-clear-objects
+ H5JAM-twithub_u511_c-clear-objects
+ H5JAM-CHECKFILE-twithub_u511_c-clear-objects
+ H5JAM-twithub_u512_c-clear-objects
+ H5JAM-CHECKFILE-twithub_u512_c-clear-objects
+ H5JAM-twithub_u513_c-clear-objects
+ H5JAM-CHECKFILE-twithub_u513_c-clear-objects
+ H5JAM-twithub513_u10_c-clear-objects
+ H5JAM-CHECKFILE-twithub513_u10_c-clear-objects
+ H5JAM-twithub513_u511_c-clear-objects
+ H5JAM-CHECKFILE-twithub513_u511_c-clear-objects
+ H5JAM-twithub513_u512_c-clear-objects
+ H5JAM-CHECKFILE-twithub513_u512_c-clear-objects
+ H5JAM-twithub513_u513_c-clear-objects
+ H5JAM-CHECKFILE-twithub513_u513_c-clear-objects
+ H5JAM-SETUP-N_twithub_u10_c-clear-objects
+ H5JAM-N_twithub_u10_c-clear-objects
+ H5JAM-CHECKFILE-N_twithub_u10_c-clear-objects
+ H5JAM-SETUP-D_twithub_tall-clear-objects
+ H5JAM-UNJAM-D_twithub_tall-clear-objects
+ H5JAM-CHECKFILE-D_twithub_tall-clear-objects
+ H5JAM-SETUP-D_twithub513_tall-clear-objects
+ H5JAM-UNJAM-D_twithub513_tall-clear-objects
+ H5JAM-CHECKFILE-D_twithub513_tall-clear-objects
+ H5JAM-CHECKFILE-ta_u513-clear-objects
+ H5JAM-twithub_u10-clear-objects
+ H5JAM-CHECKFILE-twithub_u10-clear-objects
+ H5JAM-twithub_u511-clear-objects
+ H5JAM-CHECKFILE-twithub_u511-clear-objects
+ H5JAM-twithub_u512-clear-objects
+ H5JAM-CHECKFILE-twithub_u512-clear-objects
+ H5JAM-twithub_u513-clear-objects
+ H5JAM-CHECKFILE-twithub_u513-clear-objects
+ H5JAM-twithub513_u10-clear-objects
+ H5JAM-CHECKFILE-twithub513_u10-clear-objects
+ H5JAM-twithub513_u511-clear-objects
+ H5JAM-CHECKFILE-twithub513_u511-clear-objects
+ H5JAM-twithub513_u512-clear-objects
+ H5JAM-CHECKFILE-twithub513_u512-clear-objects
+ H5JAM-twithub513_u513-clear-objects
+ H5JAM-CHECKFILE-twithub513_u513-clear-objects
+ H5JAM-twithub_u10_c-clear-objects
+ H5JAM-tall_u10-clear-objects
+ H5JAM-CHECKFILE-tall_u10-clear-objects
+ H5JAM-tall_u511-clear-objects
+ H5JAM-CHECKFILE-tall_u511-clear-objects
+ H5JAM-tall_u512-clear-objects
+ H5JAM-CHECKFILE-tall_u512-clear-objects
+ H5JAM-tall_u513-clear-objects
+ H5JAM-CHECKFILE-tall_u513-clear-objects
+ H5JAM-SETUP-ta_u10-clear-objects
+ H5JAM-ta_u10-clear-objects
+ H5JAM-CHECKFILE-ta_u10-clear-objects
+ H5JAM-SETUP-ta_u511-clear-objects
+ H5JAM-ta_u511-clear-objects
+ H5JAM-CHECKFILE-ta_u511-clear-objects
+ H5JAM-SETUP-ta_u512-clear-objects
+ H5JAM-ta_u512-clear-objects
+ H5JAM-CHECKFILE-ta_u512-clear-objects
+ H5JAM-SETUP-ta_u513-clear-objects
+ H5JAM-ta_u513-clear-objects
######### tools/h5ls #########
H5LS-clearall-objects
######### tools/h5repack #########
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 4bdc4fd..28f4114 100644
--- a/config/cmake/runTest.cmake
+++ b/config/cmake/runTest.cmake
@@ -20,9 +20,9 @@ ENDIF (NOT TEST_OUTPUT)
#IF (NOT TEST_FILTER)
# MESSAGE (STATUS "Require TEST_FILTER to be defined")
#ENDIF (NOT TEST_FILTER)
-IF (NOT TEST_REFERENCE)
+IF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
-ENDIF (NOT TEST_REFERENCE)
+ENDIF (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
SET (ERROR_APPEND 1)
@@ -96,18 +96,20 @@ IF (WIN32 AND NOT MINGW)
FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
ENDIF (WIN32 AND NOT MINGW)
-# now compare the output with the reference
-EXECUTE_PROCESS (
- COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
- RESULT_VARIABLE TEST_RESULT
-)
+IF (NOT TEST_SKIP_COMPARE)
+ # now compare the output with the reference
+ EXECUTE_PROCESS (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+ )
-MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
+ MESSAGE (STATUS "COMPARE Result: ${TEST_RESULT}")
-# again, if return value is !=0 scream and shout
-IF (NOT ${TEST_RESULT} STREQUAL 0)
- MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
-ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+ # again, if return value is !=0 scream and shout
+ IF (NOT ${TEST_RESULT} STREQUAL 0)
+ MESSAGE (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
+ ENDIF (NOT ${TEST_RESULT} STREQUAL 0)
+ENDIF (NOT TEST_SKIP_COMPARE)
# everything went fine...
MESSAGE ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
index 8a2ec82..3c5cbe0 100644
--- a/tools/h5import/CMakeLists.txt
+++ b/tools/h5import/CMakeLists.txt
@@ -29,12 +29,150 @@ IF (BUILD_TESTING)
ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c)
TARGET_NAMING (h5importtest ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ SET (HDF5_REFERENCE_CONF_FILES
+ binfp64.conf
+ binin8.conf
+ binin8w.conf
+ binin16.conf
+ binin32.conf
+ binuin16.conf
+ binuin32.conf
+ txtfp32.conf
+ txtfp64.conf
+ txtin8.conf
+ txtin16.conf
+ txtin32.conf
+ txtuin16.conf
+ txtuin32.conf
+ textpfe.conf
+ txtstr.conf
+ )
+ SET (HDF5_REFERENCE_TXT_FILES
+ txtfp32.txt
+ txtfp64.txt
+ txtuin32.txt
+ txtin16.txt
+ txtin32.txt
+ in64.txt
+ txtstr.txt
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ binfp64.h5
+ binin8.h5
+ binin8w.h5
+ binin16.h5
+ binin32.h5
+ binuin16.h5
+ binuin32.h5
+ txtfp32.h5
+ txtfp64.h5
+ txtin8.h5
+ txtin16.h5
+ txtin32.h5
+ txtuin16.h5
+ txtuin32.h5
+ txtstr.h5
+ test15.h5
+ )
+
+ FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ FOREACH (conf_file ${HDF5_REFERENCE_CONF_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${conf_file}")
+ #MESSAGE (STATUS " Copying ${conf_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5import
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file} ${dest}
+ )
+ ENDFOREACH (conf_file ${HDF5_REFERENCE_CONF_FILES})
+
+ FOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${txt_file}")
+ #MESSAGE (STATUS " Copying ${txt_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5import
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file} ${dest}
+ )
+ ENDFOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES})
+
+ FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/tmp_testfiles")
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (tmpdest "${PROJECT_BINARY_DIR}/tmp_testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5import
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file} ${tmpdest}
+ )
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5import
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
##############################################################################
##############################################################################
+ MACRO (ADD_H5_TEST testname importfile conffile testfile)
+ ADD_TEST (
+ NAME H5IMPORT-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${testfile}
+ ${testfile}.new
+ ${testfile}.new.err
+ ${testfile}.out
+ ${testfile}.out.err
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c testfiles/${conffile} -o ${testfile})
+ SET_TESTS_PROPERTIES (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects)
+ SET (last_test "H5IMPORT-${testname}")
+
+ # If using memchecker add tests without using scripts
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5IMPORT-H5DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testfile}.new"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5IMPORT-H5DUMP-${testname} PROPERTIES DEPENDS H5IMPORT-${testname})
+ ADD_TEST (
+ NAME H5IMPORT-H5DUMP_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=tmp_testfiles/${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${testfile}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_REFERENCE=${testfile}.new"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5IMPORT-H5DUMP_CMP-${testname} PROPERTIES DEPENDS H5IMPORT-H5DUMP-${testname})
+ SET (last_test "H5IMPORT-H5DUMP_CMP-${testname}")
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
##############################################################################
##############################################################################
@@ -57,9 +195,62 @@ IF (BUILD_TESTING)
txtin16.txt
txtin32.txt
)
+ SET (last_test "H5IMPORT-clear-objects")
+
+ ADD_TEST (NAME H5IMPORT-h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5IMPORT-h5importtest PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5IMPORT-h5importtest")
+
+ # ----- TESTING "ASCII I32 rank 3 - Output BE " ;
+ ADD_H5_TEST (ASCII_I32 txtin16.txt txtin32.conf txtin32.h5)
+
+ # ----- TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended"
+ ADD_H5_TEST (ASCII_I16 txtin16.txt txtin16.conf txtin16.h5)
+
+ # ----- TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed "
+ ADD_H5_TEST (ASCII_I8 txtin16.txt txtin8.conf txtin8.h5)
+
+ # ----- TESTING "ASCII UI32 - rank 3 - Output BE"
+ ADD_H5_TEST (ASCII_UI32 txtuin32.txt txtuin32.conf txtuin32.h5)
+
+ # ----- TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed "
+ ADD_H5_TEST (ASCII_UI16 txtuin32.txt txtuin16.conf txtuin16.h5)
+
+ # ----- TESTING "ASCII F32 - rank 3 - Output LE "
+ ADD_H5_TEST (ASCII_F32 txtfp32.txt txtfp32.conf txtfp32.h5)
+
+ # ----- TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed "
+ ADD_H5_TEST (ASCII_F64 txtfp64.txt txtfp64.conf txtfp64.h5)
+
+ # ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed "
+ ADD_H5_TEST (BINARY_F64 binfp64.bin binfp64.conf binfp64.h5)
+
+ # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended "
+ ADD_H5_TEST (BINARY_I16 binin16.bin binin16.conf binin16.h5)
+
+ # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed "
+ ADD_H5_TEST (BINARY_I8 binin8.bin binin8.conf binin8.h5)
+
+ # ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED "
+ ADD_H5_TEST (BINARY_I32 binin32.bin binin32.conf binin32.h5)
+
+ # ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED "
+ ADD_H5_TEST (BINARY_UI16 binuin16.bin binuin16.conf binuin16.h5)
+
+ # ----- TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED "
+ ADD_H5_TEST (BINARY_UI32 binuin32.bin binuin32.conf binuin32.h5)
+
+ # ----- TESTING "STR"
+ ADD_H5_TEST (STR txtstr.txt txtstr.conf txtstr.h5)
+
+ # ----- TESTING "BINARY I8 CR LF EOF"
+ ADD_H5_TEST (BINARY_I8_EOF binin8w.bin binin8w.conf binin8w.h5)
+
+ # ----- TESTING "ASCII F64 - rank 1 - INPUT-CLASS TEXTFPE "
+ ADD_H5_TEST (ASCII_F64_R1 in64.txt textpfe.conf test15.h5)
- ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
- SET_TESTS_PROPERTIES (h5importtest PROPERTIES DEPENDS H5IMPORT-clear-objects)
ENDIF (BUILD_TESTING)
##############################################################################
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
index fce4e0c..475f159 100644
--- a/tools/h5jam/CMakeLists.txt
+++ b/tools/h5jam/CMakeLists.txt
@@ -50,19 +50,362 @@ IF (BUILD_TESTING)
#ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
-
+
+ SET (HDF5_REFERENCE_TXT_FILES
+ u10.txt
+ u511.txt
+ u512.txt
+ u513.txt
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ tall.h5
+ twithub.h5
+ twithub513.h5
+ )
+
+ FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5jam
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ FOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}")
+ #MESSAGE (STATUS " Copying ${txt_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5jam
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${txt_file} ${dest}
+ )
+ ENDFOREACH (txt_file ${HDF5_REFERENCE_TXT_FILES})
+
##############################################################################
##############################################################################
### T H E T E S T S M A C R O S ###
##############################################################################
##############################################################################
+ MACRO (CLEANUP testname)
+ ADD_TEST (
+ NAME H5JAM-CLEANUP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${ARGN}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-CLEANUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5JAM-CLEANUP-${testname}-clear-objects")
+ ENDMACRO(CLEANUP testname testfile)
+
+ MACRO (CHECKFILE testname expected actual)
+ # If using memchecker add tests without using scripts
+ IF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (
+ NAME H5JAM-CHECKFILE-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${expected}.new
+ ${expected}.new.err
+ ${actual}.out
+ ${actual}.out.err
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (
+ NAME H5JAM-CHECKFILE-H5DUMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=testfiles/${expected}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${expected}.new"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DUMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-${testname}-clear-objects)
+ ADD_TEST (
+ NAME H5JAM-CHECKFILE-H5DUMP_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${actual}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${actual}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_FILTER=(^(HDF5)[^\n]*)"
+ -D "TEST_REFERENCE=${expected}.new"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ SET_TESTS_PROPERTIES (H5JAM-CHECKFILE-H5DUMP_CMP-${testname} PROPERTIES DEPENDS H5JAM-CHECKFILE-H5DUMP-${testname})
+ SET (last_test "H5JAM-CHECKFILE-H5DUMP_CMP-${testname}")
+ ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ ENDMACRO(CHECKFILE testname expected actual)
+
+ MACRO (SETUP testname infile outfile)
+ ADD_TEST (
+ NAME H5JAM-SETUP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ ADD_TEST (
+ NAME H5JAM-SETUP-${testname}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${infile} ${PROJECT_BINARY_DIR}/${outfile}
+ )
+ SET_TESTS_PROPERTIES (H5JAM-SETUP-${testname} PROPERTIES DEPENDS H5JAM-SETUP-${testname}-clear-objects)
+ SET (last_test "H5JAM-SETUP-${testname}")
+ ENDMACRO(SETUP testname infile outfile)
+
+ MACRO (CHECK_UB_1 testname testfile ufile)
+ 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}")
+ ENDMACRO(CHECK_UB_1 testname testfile ufile)
+
+ MACRO (CHECK_NOUB testname testfile)
+ 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}")
+ ENDMACRO(CHECK_NOUB testname testfile)
+
+ MACRO (UNJAMTEST testname infile ufile outfile)
+ ADD_TEST (
+ NAME H5JAM-UNJAM-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ IF (NOT "${ufile}" STREQUAL "NONE")
+ ADD_TEST (
+ NAME H5JAM-UNJAM_D-${testname}-clear-objects
+ 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})
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM_D-${testname}-clear-objects)
+ SET (compare_test ${ufile})
+ ELSE (NOT "${ufile}" STREQUAL "NONE")
+ IF (NOT "${ARGN}" STREQUAL "--delete")
+ ADD_TEST (
+ NAME H5JAM-UNJAM_D-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${outfile}.ufile.txt ${outfile}.ufile.txt.err
+ )
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM_D-${testname}-clear-objects PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
+ ADD_TEST (
+ NAME H5JAM-UNJAM-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
+ -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${outfile}.ufile.txt"
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ 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})
+ SET_TESTS_PROPERTIES (H5JAM-UNJAM-${testname} PROPERTIES DEPENDS H5JAM-UNJAM-${testname}-clear-objects)
+ 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})
+ 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}
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5JAM-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ IF ("${outfile}" STREQUAL "NONE")
+ ADD_TEST (NAME H5JAM-${testname} COMMAND $<TARGET_FILE:h5jam> -u testfiles/${jamfile} -i ${infile} ${ARGN})
+ SET (compare_test testfiles/${infile})
+ 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})
+ ENDIF ("${outfile}" STREQUAL "NONE")
+ SET_TESTS_PROPERTIES (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects)
+ SET (last_test "H5JAM-${testname}")
+ IF ("${ARGN}" STREQUAL "--clobber")
+ SET (compare_orig "NONE")
+ ELSE ("${ARGN}" STREQUAL "--clobber")
+ SET (compare_orig testfiles/${infile})
+ ENDIF ("${ARGN}" STREQUAL "--clobber")
+ CHECK_UB_1 (${testname} ${compare_test} testfiles/${jamfile} ${compare_orig})
+ ENDMACRO (JAMTEST testname jamfile infile outfile)
+
##############################################################################
##############################################################################
### T H E T E S T S ###
##############################################################################
##############################################################################
+ JAMTEST (tall_u10 u10.txt tall.h5 ta2.h5)
+ CHECKFILE (tall_u10 tall.h5 ta2.h5)
+# CLEANUP (tall_u10 ta2.h5)
+ JAMTEST (tall_u511 u511.txt tall.h5 ta3.h5)
+ CHECKFILE (tall_u511 tall.h5 ta3.h5)
+# CLEANUP (tall_u511 ta3.h5)
+ JAMTEST (tall_u512 u512.txt tall.h5 ta4.h5)
+ CHECKFILE (tall_u512 tall.h5 ta4.h5)
+# CLEANUP (tall_u512 ta4.h5)
+ JAMTEST (tall_u513 u513.txt tall.h5 ta5.h5)
+ CHECKFILE (tall_u513 tall.h5 ta5.h5)
+# CLEANUP (tall_u513 ta5.h5)
+
+ SETUP (ta_u10 tall.h5 ta.h5)
+ JAMTEST (ta_u10 u10.txt ta.h5 NONE)
+ CHECKFILE (ta_u10 tall.h5 ta.h5)
+ SETUP (ta_u511 tall.h5 ta.h5 NOCLEAN)
+ JAMTEST (ta_u511 u511.txt ta.h5 NONE)
+ CHECKFILE (ta_u511 tall.h5 ta.h5)
+ SETUP (ta_u512 tall.h5 ta.h5 NOCLEAN)
+ JAMTEST (ta_u512 u512.txt ta.h5 NONE)
+ CHECKFILE (ta_u512 tall.h5 ta.h5)
+ SETUP (ta_u513 tall.h5 ta.h5 NOCLEAN)
+ JAMTEST (ta_u513 u513.txt ta.h5 NONE)
+ CHECKFILE (ta_u513 tall.h5 ta.h5)
+# CLEANUP (ta ta.h5)
+
+ JAMTEST (twithub_u10 u10.txt twithub.h5 tax2.h5)
+ CHECKFILE (twithub_u10 tall.h5 tax2.h5)
+# CLEANUP (twithub_u10 tax2.h5)
+ JAMTEST (twithub_u511 u511.txt twithub.h5 tax3.h5)
+ CHECKFILE (twithub_u511 tall.h5 tax3.h5)
+# CLEANUP (twithub_u511 tax3.h5)
+ JAMTEST (twithub_u512 u512.txt twithub.h5 tax4.h5)
+ CHECKFILE (twithub_u512 tall.h5 tax4.h5)
+# CLEANUP (twithub_u512 tax4.h5)
+ JAMTEST (twithub_u513 u513.txt twithub.h5 tax5.h5)
+ CHECKFILE (twithub_u513 tall.h5 tax5.h5)
+# CLEANUP (twithub_u513 tax5.h5)
+
+ JAMTEST (twithub513_u10 u10.txt twithub513.h5 tax6.h5)
+ CHECKFILE (twithub513_u10 tall.h5 tax6.h5)
+# CLEANUP (twithub513_u10 tax6.h5)
+ JAMTEST (twithub513_u511 u511.txt twithub513.h5 tax7.h5)
+ CHECKFILE (twithub513_u511 tall.h5 tax7.h5)
+# CLEANUP (twithub513_u511 tax7.h5)
+ JAMTEST (twithub513_u512 u512.txt twithub513.h5 tax8.h5)
+ CHECKFILE (twithub513_u512 tall.h5 tax8.h5)
+# CLEANUP (twithub513_u512 tax8.h5)
+ JAMTEST (twithub513_u513 u513.txt twithub513.h5 tax9.h5)
+ CHECKFILE (twithub513_u513 tall.h5 tax9.h5)
+# CLEANUP (twithub513_u513 tax9.h5)
+
+ JAMTEST (twithub_u10_c u10.txt twithub.h5 taz2.h5 --clobber)
+ CHECKFILE (twithub_u10_c tall.h5 taz2.h5)
+# CLEANUP (twithub_u10_c taz2.h5)
+ JAMTEST (twithub_u511_c u511.txt twithub.h5 taz3.h5 --clobber)
+ CHECKFILE (twithub_u511_c tall.h5 taz3.h5)
+# CLEANUP (twithub_u511_c taz3.h5)
+ JAMTEST (twithub_u512_c u512.txt twithub.h5 taz4.h5 --clobber)
+ CHECKFILE (twithub_u512_c tall.h5 taz4.h5)
+# CLEANUP (twithub_u512_c taz4.h5)
+ JAMTEST (twithub_u513_c u513.txt twithub.h5 taz5.h5 --clobber)
+ CHECKFILE (twithub_u513_c tall.h5 taz5.h5)
+# CLEANUP (twithub_u513_c taz5.h5)
+
+ JAMTEST (twithub513_u10_c u10.txt twithub513.h5 taz6.h5 --clobber)
+ CHECKFILE (twithub513_u10_c tall.h5 taz6.h5)
+# CLEANUP (twithub513_u10_c taz6.h5)
+ JAMTEST (twithub513_u511_c u511.txt twithub513.h5 taz7.h5 --clobber)
+ CHECKFILE (twithub513_u511_c tall.h5 taz7.h5)
+# CLEANUP (twithub513_u511_c taz7.h5)
+ JAMTEST (twithub513_u512_c u512.txt twithub513.h5 taz8.h5 --clobber)
+ CHECKFILE (twithub513_u512_c tall.h5 taz8.h5)
+# CLEANUP (twithub513_u512_c taz8.h5)
+ JAMTEST (twithub513_u513_c u513.txt twithub513.h5 taz9.h5 --clobber)
+ CHECKFILE (twithub513_u513_c tall.h5 taz9.h5)
+# CLEANUP (twithub513_u513_c taz9.h5)
+
+ SETUP (N_twithub_u10_c twithub.h5 tay2.h5)
+ JAMTEST (N_twithub_u10_c u10.txt tay2.h5 NONE --clobber)
+ CHECKFILE (N_twithub_u10_c tall.h5 tay2.h5)
+# CLEANUP (N_twithub_u10_c tay2.h5)
+ SETUP (N_twithub_u511_c twithub.h5 tay3.h5)
+ JAMTEST (N_twithub_u511_c u511.txt tay3.h5 NONE --clobber)
+ CHECKFILE (N_twithub_u511_c tall.h5 tay3.h5)
+# CLEANUP (N_twithub_u511_c tay3.h5)
+ SETUP (N_twithub_u512_c twithub.h5 tay4.h5)
+ JAMTEST (N_twithub_u512_c u512.txt tay4.h5 NONE --clobber)
+ CHECKFILE (N_twithub_u512_c tall.h5 tay4.h5)
+# CLEANUP (N_twithub_u512_c tay4.h5)
+ SETUP (N_twithub_u513_c twithub.h5 tay5.h5)
+ JAMTEST (N_twithub_u513_c u513.txt tay5.h5 NONE --clobber)
+ CHECKFILE (N_twithub_u513_c tall.h5 tay5.h5)
+# CLEANUP (N_twithub_u513_c tay5.h5)
+
+ SETUP (N_twithub513_u10_c twithub513.h5 tay6.h5)
+ JAMTEST (N_twithub513_u10_c u10.txt tay6.h5 NONE --clobber)
+ CHECKFILE (N_twithub513_u10_c tall.h5 tay6.h5)
+# CLEANUP (N_twithub513_u10_c tay6.h5)
+ SETUP (N_twithub513_u511_c twithub513.h5 tay7.h5)
+ JAMTEST (N_twithub513_u511_c u511.txt tay7.h5 NONE --clobber)
+ CHECKFILE (N_twithub513_u511_c tall.h5 tay7.h5)
+# CLEANUP (N_twithub513_u511_c tay7.h5)
+ SETUP (N_twithub513_u512_c twithub513.h5 tay8.h5)
+ JAMTEST (N_twithub513_u512_c u512.txt tay8.h5 NONE --clobber)
+ CHECKFILE (N_twithub513_u512_c tall.h5 tay8.h5)
+# CLEANUP (N_twithub513_u512_c tay8.h5)
+ SETUP (N_twithub513_u513_c twithub513.h5 tay9.h5)
+ JAMTEST (N_twithub513_u513_c u513.txt tay9.h5 NONE --clobber)
+ CHECKFILE (N_twithub513_u513_c tall.h5 tay9.h5)
+# CLEANUP (N_twithub513_u513_c tay9.h5)
+
+ SETUP (twithub_tall twithub.h5 tai1.h5)
+ UNJAMTEST (twithub_tall tai1.h5 o10.txt taa1.h5)
+ CHECKFILE (twithub_tall tall.h5 taa1.h5)
+# CLEANUP (twithub_tall taa1.h5 tai1.h5 o10.txt)
+ SETUP (twithub513_tall twithub513.h5 tai2.h5)
+ UNJAMTEST (twithub513_tall tai2.h5 o512.txt taa2.h5)
+ CHECKFILE (twithub513_tall tall.h5 taa2.h5)
+# CLEANUP (twithub513_tall taa2.h5 tai2.h5 o512.txt)
+
+ SETUP (N_twithub_tall twithub.h5 tai3.h5)
+ UNJAMTEST (N_twithub_tall tai3.h5 NONE taa3.h5)
+ CHECKFILE (N_twithub_tall tall.h5 taa3.h5)
+# CLEANUP (N_twithub_tall taa3.h5 tai3.h5)
+ SETUP (N_twithub513_tall twithub513.h5 tai4.h5)
+ UNJAMTEST (N_twithub513_tall tai4.h5 NONE taa4.h5)
+ CHECKFILE (N_twithub513_tall tall.h5 taa4.h5)
+# CLEANUP (N_twithub513_tall taa4.h5 tai4.h5)
+
+ SETUP (D_twithub_tall twithub.h5 taj2.h5)
+ UNJAMTEST (D_twithub_tall taj2.h5 NONE tac2.h5 --delete)
+ CHECKFILE (D_twithub_tall tall.h5 tac2.h5)
+# CLEANUP (D_twithub_tall tac2.h5 taj2.h5)
+ SETUP (D_twithub513_tall twithub513.h5 taj3.h5)
+ UNJAMTEST (D_twithub513_tall taj3.h5 NONE tac3.h5 --delete)
+ CHECKFILE (D_twithub513_tall tall.h5 tac3.h5)
+# CLEANUP (D_twithub513_tall tac3.h5 taj3.h5)
+
ENDIF (BUILD_TESTING)
##############################################################################