summaryrefslogtreecommitdiffstats
path: root/hl/test
diff options
context:
space:
mode:
Diffstat (limited to 'hl/test')
-rw-r--r--hl/test/CMakeLists.txt70
-rw-r--r--hl/test/CMakeTests.cmake70
2 files changed, 80 insertions, 60 deletions
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 9cb61e0..f969dbf 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -20,7 +20,7 @@ INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_TEST hl_name files)
+MACRO (HL_ADD_EXE hl_name)
ADD_EXECUTABLE (hl_${hl_name} ${hl_name}.c)
TARGET_NAMING (hl_${hl_name} ${LIB_TYPE})
TARGET_C_PROPERTIES (hl_${hl_name} " " " ")
@@ -30,66 +30,14 @@ MACRO (HL_ADD_TEST hl_name files)
${HDF5_TEST_LIB_TARGET}
)
SET_TARGET_PROPERTIES (hl_${hl_name} PROPERTIES FOLDER test/hl)
+ENDMACRO (HL_ADD_EXE)
- ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
- IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test})
- ENDIF (NOT "${last_test}" STREQUAL "")
-
- # --------------------------------------------------------------------
- #-- Copy the necessary files.
- # --------------------------------------------------------------------
- FOREACH (h5_file ${files})
- SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}")
- #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}")
- ADD_CUSTOM_COMMAND (
- TARGET hl_${hl_name}
- PRE_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest}
- )
-
- ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES})
-ENDMACRO (HL_ADD_TEST)
-
-# Remove any output file left over from previous test run
-ADD_TEST (
- NAME hl_test-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- combine_tables1.h5
- combine_tables2.h5
- test_detach.h5
- test_ds1.h5
- test_ds2.h5
- test_ds3.h5
- test_ds4.h5
- test_ds5.h5
- test_ds6.h5
- test_ds7.h5
- test_ds8.h5
- test_ds9.h5
- test_dectris.h5
- test_image1.h5
- test_image2.h5
- test_image3.h5
- test_lite1.h5
- test_lite2.h5
- test_packet_compress.h5
- test_packet_table.h5
- test_table.h5
-)
-IF (NOT "${last_test}" STREQUAL "")
- SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test})
-ENDIF (NOT "${last_test}" STREQUAL "")
-SET (last_test "hl_test-clear-objects")
-
-HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5")
-HL_ADD_TEST (test_dset_opt "")
-HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri")
-HL_ADD_TEST (test_lite "dtype_file.txt")
-HL_ADD_TEST (test_packet "")
-HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5")
+HL_ADD_EXE (test_ds)
+HL_ADD_EXE (test_dset_opt)
+HL_ADD_EXE (test_image)
+HL_ADD_EXE (test_lite)
+HL_ADD_EXE (test_packet)
+HL_ADD_EXE (test_table)
# --------------------------------------------------------------------
# This executable is used to generate test files for the test_ds test.
@@ -106,3 +54,5 @@ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
)
SET_TARGET_PROPERTIES (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+INCLUDE (CMakeTests.cmake)
diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake
new file mode 100644
index 0000000..aa9c1c3
--- /dev/null
+++ b/hl/test/CMakeTests.cmake
@@ -0,0 +1,70 @@
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+# --------------------------------------------------------------------
+# Macro used to add a unit test
+# --------------------------------------------------------------------
+MACRO (HL_ADD_TEST hl_name files)
+ ADD_TEST (NAME hl_${hl_name} COMMAND $<TARGET_FILE:hl_${hl_name}>)
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (hl_${hl_name} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+
+ # --------------------------------------------------------------------
+ #-- Copy the necessary files.
+ # --------------------------------------------------------------------
+ FOREACH (h5_file ${files})
+ SET (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying HL Test File ${h5_file} to ${dest}")
+ ADD_CUSTOM_COMMAND (
+ TARGET hl_${hl_name}
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest}
+ )
+
+ ENDFOREACH (h5_file ${HL_REFERENCE_TEST_FILES})
+ENDMACRO (HL_ADD_TEST)
+
+# Remove any output file left over from previous test run
+ADD_TEST (
+ NAME hl_test-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ combine_tables1.h5
+ combine_tables2.h5
+ test_detach.h5
+ test_ds1.h5
+ test_ds2.h5
+ test_ds3.h5
+ test_ds4.h5
+ test_ds5.h5
+ test_ds6.h5
+ test_ds7.h5
+ test_ds8.h5
+ test_ds9.h5
+ test_dectris.h5
+ test_image1.h5
+ test_image2.h5
+ test_image3.h5
+ test_lite1.h5
+ test_lite2.h5
+ test_packet_compress.h5
+ test_packet_table.h5
+ test_table.h5
+)
+IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (hl_test-clear-objects PROPERTIES DEPENDS ${last_test})
+ENDIF (NOT "${last_test}" STREQUAL "")
+SET (last_test "hl_test-clear-objects")
+
+HL_ADD_TEST (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5")
+HL_ADD_TEST (test_dset_opt "")
+HL_ADD_TEST (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri")
+HL_ADD_TEST (test_lite "dtype_file.txt")
+HL_ADD_TEST (test_packet "")
+HL_ADD_TEST (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5")