TestDriverJava.cmake.in 1.02 KB
Newer Older
1 2 3
SET(java_runtime @JAVA_RUNTIME@)
SET(java_binary_dir @CMAKE_CURRENT_BINARY_DIR@)

4 5 6
SET(ENV{PATH} "${PATH}${SEPARATOR}$ENV{PATH}")
SET(ENV{LD_LIBRARY_PATH} "${LDPATH}${SEPARATOR}$ENV{LD_LIBRARY_PATH}")
SET(ENV{CLASSPATH} "${CLASSPATH}${SEPARATOR}$ENV{CLASSPATH}")
7

8
MESSAGE("| Calling:\t${java_runtime} ${EXECUTABLE} ${ARGUMENTS}")
9 10 11 12 13 14 15 16
EXECUTE_PROCESS(
       COMMAND ${java_runtime} ${EXECUTABLE} ${ARGUMENTS} 
               	WORKING_DIRECTORY ${java_binary_dir}
		RESULT_VARIABLE java_result
               	OUTPUT_VARIABLE java_output
               	ERROR_VARIABLE  java_error
)

17 18 19 20 21 22 23 24 25
MESSAGE("| Call Result:\t${java_result}")
MESSAGE("| Call Output: Begin\n${java_output}")
MESSAGE("| Call Output: End")
IF(java_error)
	MESSAGE("| Call Error: Begin\n${java_error}")
	MESSAGE("| Call Error: End")
ENDIF(java_error)
MESSAGE("| Call Ended")
MESSAGE("----------------------------------------------------------")
26

27 28 29 30
# Let's make sure that if the test failed, it failed with CTest too
IF(java_error)
	MESSAGE(SEND_ERROR "Test Failed.")
ENDIF(java_error)