summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-08-01 17:35:00 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-08-01 17:35:00 (GMT)
commite55844b7523676c381eb22f638369a794021d798 (patch)
tree9121dc5ee07215bc6389dc8bcf61e96b4040e69f /hl
parent1494413413932f1e640815d109fd1e8386bab3f9 (diff)
downloadhdf5-e55844b7523676c381eb22f638369a794021d798.zip
hdf5-e55844b7523676c381eb22f638369a794021d798.tar.gz
hdf5-e55844b7523676c381eb22f638369a794021d798.tar.bz2
[svn-r30237] HDFFV-9939: Change cmake commands to reduce POST_BUILD custom commands. Fixes possible overruns on windows command lines.
Diffstat (limited to 'hl')
-rw-r--r--hl/examples/CMakeTests.cmake16
-rw-r--r--hl/test/CMakeTests.cmake64
-rw-r--r--hl/tools/gif2h5/CMakeTests.cmake25
3 files changed, 47 insertions, 58 deletions
diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake
index 8cf74d9..6384aa5 100644
--- a/hl/examples/CMakeTests.cmake
+++ b/hl/examples/CMakeTests.cmake
@@ -11,21 +11,15 @@ set (HDF5_TEST_FILES
)
foreach (h5_file ${HDF5_TEST_FILES})
- set (dest "${PROJECT_BINARY_DIR}/${h5_file}")
- #message (STATUS " Copying ${h5_file}")
- add_custom_command (
- TARGET hl_ex_ex_ds1
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest}
- )
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "hl_ex_ex_ds1_files")
endforeach (h5_file ${HDF5_TEST_FILES})
+add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list})
# Remove any output file left over from previous test run
add_test (
NAME HL_ex-clear-objects
COMMAND ${CMAKE_COMMAND}
- -E remove
+ -E remove
ex_lite1.h5
ex_lite2.h5
ex_lite3.h5
@@ -48,13 +42,13 @@ endforeach (h5_file ${HDF5_TEST_FILES})
)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "HL_ex-clear-objects")
foreach (example ${examples})
add_test (NAME HL_ex_${example} COMMAND $<TARGET_FILE:hl_ex_${example}>)
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "HL_ex_${example}")
endforeach (example ${examples})
diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake
index 95eca4b..228853d 100644
--- a/hl/test/CMakeTests.cmake
+++ b/hl/test/CMakeTests.cmake
@@ -5,32 +5,44 @@
##############################################################################
##############################################################################
+set (HL_REFERENCE_TEST_FILES
+ dtype_file.txt
+ image8.txt
+ sepia.pal
+ earth.pal
+ image24pixel.txt
+ image24plane.txt
+ usa.wri
+ test_table_be.h5
+ test_table_cray.h5
+ test_table_le.h5
+ dsdata.txt
+ dslat.txt
+ dslon.txt
+ test_ds_be.h5
+ test_ds_le.h5
+ test_ld.h5
+)
+
+# --------------------------------------------------------------------
+#-- Copy the necessary files.
+# --------------------------------------------------------------------
+foreach (h5_file ${HL_REFERENCE_TEST_FILES})
+ HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files")
+endforeach (h5_file ${HL_REFERENCE_TEST_FILES})
+add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list})
+
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_TEST hl_name files)
+MACRO (HL_ADD_TEST hl_name)
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}
ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}"
WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR}
)
- 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})
+ endif ()
ENDMACRO (HL_ADD_TEST)
# Remove any output file left over from previous test run
@@ -73,13 +85,13 @@ if (NOT "${last_test}" STREQUAL "")
endif (NOT "${last_test}" STREQUAL "")
set (last_test "HL_test-clear-objects")
-HL_add_test (test_lite "dtype_file.txt")
-HL_add_test (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri")
-HL_add_test (test_file_image "")
-HL_add_test (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5")
-HL_add_test (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5")
-HL_add_test (test_packet "")
-HL_add_test (test_dset_opt "")
-HL_add_test (test_ld "test_ld.h5")
-HL_add_test (test_dset_append "")
+HL_add_test (test_lite )
+HL_add_test (test_image)
+HL_add_test (test_file_image)
+HL_add_test (test_table)
+HL_add_test (test_ds)
+HL_add_test (test_packet)
+HL_add_test (test_dset_opt)
+HL_add_test (test_ld)
+HL_add_test (test_dset_append)
diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake
index 832d2df..1cffe55 100644
--- a/hl/tools/gif2h5/CMakeTests.cmake
+++ b/hl/tools/gif2h5/CMakeTests.cmake
@@ -11,27 +11,10 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
#
# copy test files from source to build dir
#
-
-add_custom_command (
- TARGET gif2h5
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/image1.gif ${PROJECT_BINARY_DIR}/testfiles/image1.gif
-)
-
-add_custom_command (
- TARGET h52gif
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5
-)
-
-add_custom_command (
- TARGET h52gif
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5 ${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5
-)
+HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/image1.gif" "${PROJECT_BINARY_DIR}/testfiles/image1.gif" "gif2h5_files")
+HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/h52giftst.h5" "${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5" "gif2h5_files")
+HDFTEST_COPY_FILE("${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/testfiles/ex_image2.h5" "${PROJECT_BINARY_DIR}/testfiles/ex_image2.h5" "gif2h5_files")
+add_custom_target(gif2h5_files ALL COMMENT "Copying files needed by gif2h5 tests" DEPENDS ${gif2h5_files_list})
# Remove any output file left over from previous test run
add_test (