diff options
author | Brad King <brad.king@kitware.com> | 2019-10-03 13:10:35 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-10-03 13:10:50 (GMT) |
commit | 4a68c85073f80fd8f96c93eb5b3ead3058c84391 (patch) | |
tree | 206dab44495f9d71096fb8e44047d06de4229f96 /Tests | |
parent | 2921c5e4d102a3429b1e36ffd15715edaa46ef3f (diff) | |
parent | 3d025939868a9722e889e3b4361b56d4c4138025 (diff) | |
download | CMake-4a68c85073f80fd8f96c93eb5b3ead3058c84391.zip CMake-4a68c85073f80fd8f96c93eb5b3ead3058c84391.tar.gz CMake-4a68c85073f80fd8f96c93eb5b3ead3058c84391.tar.bz2 |
Merge topic 'FindJava-all-versions'
3d02593986 FindJava: ensure all versions can be found
14ac253af7 FindJava: tests clean-up
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3871
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 50 | ||||
-rw-r--r-- | Tests/Java/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/JavaJavah/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/JavaNativeHeaders/CMakeLists.txt | 6 |
4 files changed, 27 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() diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt index 0b8269b..aea4282 100644 --- a/Tests/Java/CMakeLists.txt +++ b/Tests/Java/CMakeLists.txt @@ -3,6 +3,8 @@ project(hello Java) cmake_minimum_required (VERSION 2.6) set(CMAKE_VERBOSE_MAKEFILE 1) +include(CTest) + find_package(Java COMPONENTS Development) include (UseJava) @@ -14,3 +16,10 @@ add_jar(hello2 @${CMAKE_CURRENT_BINARY_DIR}/java_fileslist) # use listing file to specify sources and specify output directory (issue #17316) add_jar(hello3 @${CMAKE_CURRENT_BINARY_DIR}/java_fileslist OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/hello3") + +add_test (NAME Java.Jar + COMMAND "${Java_JAVA_EXECUTABLE}" -classpath hello.jar HelloWorld) +add_test (NAME Java.JarSourceList + COMMAND "${Java_JAVA_EXECUTABLE}" -classpath hello2.jar HelloWorld) +add_test (NAME Java.JarSourceListAndOutput + COMMAND "${Java_JAVA_EXECUTABLE}" -classpath "${CMAKE_CURRENT_BINARY_DIR}/hello3/hello3.jar" HelloWorld) diff --git a/Tests/JavaJavah/CMakeLists.txt b/Tests/JavaJavah/CMakeLists.txt index 071bf20..77c292a 100644 --- a/Tests/JavaJavah/CMakeLists.txt +++ b/Tests/JavaJavah/CMakeLists.txt @@ -3,6 +3,8 @@ project(helloJavah Java CXX) cmake_minimum_required (VERSION 2.6) set(CMAKE_VERBOSE_MAKEFILE 1) +include(CTest) + find_package(Java COMPONENTS Development) include (UseJava) @@ -21,3 +23,6 @@ add_dependencies(B B_javah) target_include_directories(B PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) + +add_test (NAME Java.Javah + COMMAND "${Java_JAVA_EXECUTABLE}" -Djava.library.path=$<TARGET_FILE_DIR:B> -classpath hello3.jar HelloWorld2) diff --git a/Tests/JavaNativeHeaders/CMakeLists.txt b/Tests/JavaNativeHeaders/CMakeLists.txt index 7dc2679..2023d25 100644 --- a/Tests/JavaNativeHeaders/CMakeLists.txt +++ b/Tests/JavaNativeHeaders/CMakeLists.txt @@ -3,6 +3,8 @@ project(helloJavaNativeHeaders Java CXX) cmake_minimum_required (VERSION 2.6) set(CMAKE_VERBOSE_MAKEFILE 1) +include (CTest) + find_package(Java COMPONENTS Development) include (UseJava) @@ -16,3 +18,7 @@ add_jar(hello4 HelloWorld3.java) add_library(D SHARED D.cpp E.cpp) target_link_libraries (D PRIVATE D1-native E1-native) + + +add_test (NAME Java.NativeHeaders + COMMAND "${Java_JAVA_EXECUTABLE}" -Djava.library.path=$<TARGET_FILE_DIR:D> -classpath hello4.jar HelloWorld3) |