-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify Java unit test setup and fix issues with setting system prop…
…erties for tests.
- Loading branch information
Showing
3 changed files
with
69 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
# Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
# This is a windows only file so we can run gradle tests via ctest | ||
# This is a helper script that enables us to run gradle tests via ctest. | ||
|
||
FILE(TO_NATIVE_PATH ${GRADLE_EXECUTABLE} GRADLE_NATIVE_PATH) | ||
FILE(TO_NATIVE_PATH ${BIN_DIR} BINDIR_NATIVE_PATH) | ||
|
||
message(STATUS "GRADLE_TEST_EP_FLAGS: ${ORT_PROVIDER_FLAGS}") | ||
if (onnxruntime_ENABLE_TRAINING_APIS) | ||
message(STATUS "Running ORT Java training tests") | ||
execute_process(COMMAND cmd /C ${GRADLE_NATIVE_PATH} --console=plain cmakeCheck -DcmakeBuildDir=${BINDIR_NATIVE_PATH} -Dorg.gradle.daemon=false ${ORT_PROVIDER_FLAGS} -DENABLE_TRAINING_APIS=1 | ||
WORKING_DIRECTORY ${REPO_ROOT}/java | ||
RESULT_VARIABLE HAD_ERROR) | ||
else() | ||
execute_process(COMMAND cmd /C ${GRADLE_NATIVE_PATH} --console=plain cmakeCheck -DcmakeBuildDir=${BINDIR_NATIVE_PATH} -Dorg.gradle.daemon=false ${ORT_PROVIDER_FLAGS} | ||
WORKING_DIRECTORY ${REPO_ROOT}/java | ||
RESULT_VARIABLE HAD_ERROR) | ||
message(STATUS "gradle additional system property definitions: ${GRADLE_SYSTEM_PROPERTY_DEFINITIONS}") | ||
|
||
set(GRADLE_TEST_ARGS | ||
${GRADLE_NATIVE_PATH} | ||
cmakeCheck | ||
--console=plain | ||
-DcmakeBuildDir=${BINDIR_NATIVE_PATH} | ||
-Dorg.gradle.daemon=false | ||
${GRADLE_SYSTEM_PROPERTY_DEFINITIONS}) | ||
|
||
if(WIN32) | ||
list(PREPEND GRADLE_TEST_ARGS cmd /C) | ||
endif() | ||
|
||
message(STATUS "gradle test command args: ${GRADLE_TEST_ARGS}") | ||
|
||
execute_process(COMMAND ${GRADLE_TEST_ARGS} | ||
WORKING_DIRECTORY ${REPO_ROOT}/java | ||
RESULT_VARIABLE HAD_ERROR) | ||
|
||
if(HAD_ERROR) | ||
message(FATAL_ERROR "Java Unitests failed") | ||
message(FATAL_ERROR "Java Unitests failed") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters