summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-10-01 10:40:35 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-10-02 12:47:11 (GMT)
commit14ac253af716432d20380d155131fa6fd6d03400 (patch)
tree405f358cdab3a52cf9aba6e96183e2c362c0c91d /Tests/CMakeLists.txt
parenta1f78a481c8cbda1f0c8503c4d661c3c3ddf00a6 (diff)
downloadCMake-14ac253af716432d20380d155131fa6fd6d03400.zip
CMake-14ac253af716432d20380d155131fa6fd6d03400.tar.gz
CMake-14ac253af716432d20380d155131fa6fd6d03400.tar.bz2
FindJava: tests clean-up
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt50
1 files changed, 7 insertions, 43 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 789fc0e..ed20b91 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3349,81 +3349,45 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
if(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
file(READ "${JNI_H}" JNI_FILE)
if("${JNI_FILE}" MATCHES "JDK1_2")
- add_test(Java.Jar ${CMAKE_CTEST_COMMAND}
+ add_test(NAME Java.Jar COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Java"
"${CMake_BINARY_DIR}/Tests/JavaJar"
${build_generator_args}
--build-project hello
- --build-target hello
- --build-two-config
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJar/"
- --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJar")
- add_test(Java.JarSourceList ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Java"
- "${CMake_BINARY_DIR}/Tests/JavaJarSourceList"
- ${build_generator_args}
- --build-project hello
- --build-target hello2
- --build-two-config
- --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceList/"
- --test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
- add_test(Java.JarSourceListAndOutput ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Java"
- "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput"
- ${build_generator_args}
- --build-project hello
- --build-target hello3
- --build-two-config
- --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput/hello3"
- --test-command ${JAVA_RUNTIME} -classpath hello3.jar HelloWorld)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput")
# For next tests, java tool must have same architecture as toolchain
math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
execute_process(
- COMMAND "${Java_JAVA_EXECUTABLE}" -d${_object_mode} -version
- OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result
+ COMMAND "${Java_JAVA_EXECUTABLE}" -version
+ OUTPUT_VARIABLE _version ERROR_VARIABLE _version RESULT_VARIABLE _result
)
- if(_result EQUAL 0)
+ if(_result EQUAL 0 AND _version MATCHES "${_object_mode}-Bit")
## next test is valid only if Java version is less than 1.10
if ("${Java_VERSION}" VERSION_LESS 1.10)
- if(_isMultiConfig)
- set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
- else()
- set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
- endif()
add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/JavaJavah"
"${CMake_BINARY_DIR}/Tests/JavaJavah"
${build_generator_args}
--build-project helloJavah
- --build-two-config
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
- --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2)
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
endif()
## next test is valid only if Java is, at least, version 1.8
if (NOT "${Java_VERSION}" VERSION_LESS 1.8)
- if(_isMultiConfig)
- set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/$<CONFIGURATION>)
- else()
- set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders)
- endif()
add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders"
"${CMake_BINARY_DIR}/Tests/JavaNativeHeaders"
${build_generator_args}
--build-project helloJavaNativeHeaders
- --build-two-config
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/"
- --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVANATIVEHEADERS_LIBRARY_PATH} -classpath hello4.jar HelloWorld3)
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIG>)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders")
endif()
endif()