File: run_test_with_cin.cmake

package info (click to toggle)
cgal 6.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (31 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
if(NOT CMD OR (NOT ANDROID AND NOT CGAL_RUN_TESTS_THROUGH_SSH AND NOT EXISTS ${CMD}))
  message(FATAL_ERROR
    "The variable `CMD` should be defined to the test program to run!")
endif()

if(NOT CIN OR NOT EXISTS ${CIN})
  message(FATAL_ERROR
    "The variable `CIN` should be defined to the input file for the test!")
endif()

if(ANDROID)
  execute_process(
    COMMAND adb shell "cd ${ANDROID_DIR_PREFIX}${PROJECT_NAME} && ${ANDROID_DIR_PREFIX}${PROJECT_NAME}/${CMD}"
    INPUT_FILE ${CIN}
    RESULT_VARIABLE error_result)
elseif(CGAL_RUN_TESTS_THROUGH_SSH)
  execute_process(
    COMMAND ${ssh_executable} ${SSH_HOST} "cd ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME} && LD_LIBRARY_PATH=${CGAL_REMOTE_TEST_DIR_PREFIX}/lib ${CGAL_REMOTE_TEST_DIR_PREFIX}${PROJECT_NAME}/${CMD}"
    INPUT_FILE ${CIN}
    RESULT_VARIABLE error_result)
else()
  execute_process(
    COMMAND ${CMD}
    INPUT_FILE ${CIN}
    RESULT_VARIABLE error_result)
endif()

if(error_result)
  message(SEND_ERROR
    "The test `${CMD} < ${CIN}` ended with the error code ${error_result}.")
endif()