summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-07-22 21:23:38 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-07-22 21:23:38 (GMT)
commitfbc06ff9b8e12f542814d6e5dc08c19680a5429d (patch)
tree00bb7d88c53b840051d9249f9592bf7c176b67cb
parent64733980e5f595ab6e267405284a4461261644ea (diff)
downloadhdf5-fbc06ff9b8e12f542814d6e5dc08c19680a5429d.zip
hdf5-fbc06ff9b8e12f542814d6e5dc08c19680a5429d.tar.gz
hdf5-fbc06ff9b8e12f542814d6e5dc08c19680a5429d.tar.bz2
Use generator expr to get correct name
-rw-r--r--java/examples/datasets/CMakeLists.txt56
-rw-r--r--java/examples/datatypes/CMakeLists.txt53
-rw-r--r--java/examples/groups/CMakeLists.txt61
-rw-r--r--java/examples/intro/CMakeLists.txt55
-rw-r--r--java/test/CMakeLists.txt6
5 files changed, 86 insertions, 145 deletions
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index 83343fc..c64e02e 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -71,61 +71,47 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-macro (ADD_H5_TEST resultfile resultcode)
+if (BUILD_TESTING)
get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
- get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<IF:$<CONFIG:Debug>,${target_name_debug},${target_name}>;")
- add_test (
- NAME JAVA_datasets-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_PROGRAM=examples.datasets.${resultfile}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=datasets/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=datasets/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (last_test)
- set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_datasets-${resultfile}")
-endmacro ()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
-if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
if (example STREQUAL "H5Ex_D_External")
add_test (
NAME JAVA_datasets-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ COMMAND ${CMAKE_COMMAND} -E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data
)
else ()
add_test (
NAME JAVA_datasets-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (last_test)
- set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_datasets-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt
${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects)
- set (last_test "JAVA_datasets-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+ add_test (
+ NAME JAVA_datasets-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_PROGRAM=examples.datasets.${example}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=datasets/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=datasets/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_datasets-${example} PROPERTIES DEPENDS JAVA_datasets-${example}-copy-objects)
endforeach ()
endif ()
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 701fe2a..70648e4 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -56,50 +56,37 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-MACRO (ADD_H5_TEST resultfile resultcode)
+if (BUILD_TESTING)
get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
- get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<IF:$<CONFIG:Debug>,${target_name_debug},${target_name}>;")
- add_test (
- NAME JAVA_datatypes-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.datatypes.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=datatypes/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=datatypes/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (last_test)
- set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_datatypes-${resultfile}")
-ENDMACRO ()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
-if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
add_test (
NAME JAVA_datatypes-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (last_test)
- set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_datatypes-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt
${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clear-objects)
- set (last_test "JAVA_datatypes-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+ add_test (
+ NAME JAVA_datatypes-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.datatypes.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=datatypes/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=datatypes/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_datatypes-${example} PROPERTIES DEPENDS JAVA_datatypes-${example}-copy-objects)
endforeach ()
endif ()
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index f0693ba..e1ad108 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -55,65 +55,48 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES})
endforeach ()
add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list})
-macro (ADD_H5_TEST resultfile resultcode)
+if (BUILD_TESTING)
get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
- get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<IF:$<CONFIG:Debug>,${target_name_debug},${target_name}>;")
- add_test (
- NAME JAVA_groups-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.groups.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=groups/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=groups/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (last_test)
- set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${resultfile}")
-endmacro ()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
-if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit")
if (example STREQUAL "H5Ex_G_Compact")
add_test (
NAME JAVA_groups-${example}-clear-h5s
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ COMMAND ${CMAKE_COMMAND} -E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5
)
else ()
add_test (
NAME JAVA_groups-${example}-clear-h5s
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (last_test)
- set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${example}-clear-h5s")
endif ()
+
add_test (
NAME JAVA_groups-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt
${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt
)
- if (last_test)
- set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+ set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-h5s)
+ add_test (
+ NAME JAVA_groups-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.groups.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=groups/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=groups/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_groups-${example} PROPERTIES DEPENDS JAVA_groups-${example}-copy-objects)
endforeach ()
endif ()
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index a4f0cdd..e60af88 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -57,52 +57,39 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES})
add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET})
endforeach ()
-MACRO (ADD_H5_TEST resultfile resultcode)
- get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
- get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<IF:$<CONFIG:Debug>,${target_name_debug},${target_name}>;")
- add_test (
- NAME JAVA_intro-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.intro.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=intro/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=intro/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (last_test)
- set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_intro-${resultfile}")
-ENDMACRO ()
-
if (BUILD_TESTING)
+ get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
foreach (example ${HDF_JAVA_EXAMPLES})
add_test (
NAME JAVA_intro-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (last_test)
- set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_intro-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt
${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clear-objects)
- set (last_test "JAVA_intro-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+
+ add_test (
+ NAME JAVA_intro-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.intro.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=intro/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=intro/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_intro-${example} PROPERTIES DEPENDS JAVA_intro-${example}-copy-objects)
endforeach ()
endif ()
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index d677b5f..3298a47 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -89,8 +89,7 @@ else ()
endif ()
get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
-get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG)
-set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$<IF:$<CONFIG:Debug>,${target_name_debug},${target_name}>;")
+set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
set (CMAKE_JAVA_CLASSPATH ".")
@@ -101,8 +100,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
add_test (
NAME JUnit-${test_file}-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ COMMAND ${CMAKE_COMMAND} -E remove
JUnit-${test_file}.out
JUnit-${test_file}.out.err
)