~renatofilho/address-book-app/fix-1200397

« back to all changes in this revision

Viewing changes to cmake/autopilot.cmake

  • Committer: Tarmac
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2013-07-09 19:46:49 UTC
  • mfrom: (4.1.3 autopilot)
  • Revision ID: tarmac-20130709194649-569bvf3vdf2gi1fa
Initial structure for autopilot.

Approved by Omer Akram, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
add_custom_target(autopilot)
 
2
 
 
3
option(ENABLE_AUTOPILOT "Enable or Disable autopilot tests" On)
 
4
option(AUTOPILOT_RECORD "Enable or Disable autopilot record tests" OFF)
 
5
option(AUTOPILOT_RECORD_PATH "Directory to put recorded tests" OFF)
 
6
 
 
7
if(ENABLE_AUTOPILOT)
 
8
    find_program(AUTOPILOT_BIN autopilot)
 
9
    if(AUTOPILOT_BIN)
 
10
        message(STATUS "Autopilot tests enabled.")
 
11
    else()
 
12
        message(STATUS "Autopilot tests disabled: autopilot binary not found")
 
13
    endif()
 
14
endif()
 
15
 
 
16
if(AUTOPILOT_RECORD OR AUTOPILOT_RECORD_PATH)
 
17
    find_program(AUTOPILOT_REC_BIN recordmydesktop)
 
18
    if(AUTOPILOT_REC_BIN)
 
19
        message(STATUS "Record autopilot enabled")
 
20
        if(AUTOPILOT_RECORD_PATH)
 
21
            message(STATUS "Save autopilot tests video in: ${AUTOPILOT_RECORD_PATH}")
 
22
            set(AUTOPILOT_TESTS_ARGS -r -rd ${AUTOPILOT_RECORD_PATH})
 
23
        else()
 
24
            set(AUTOPILOT_TESTS_ARGS -r)
 
25
        endif()
 
26
    else()
 
27
        message(STATUS "recordmydesktop necessary for record autopilot tests not found.")
 
28
        set(AUTOPILOT_TESTS_ARGS "")
 
29
    endif()
 
30
endif()
 
31
 
 
32
function(declare_autopilot_test ENVIROMENT TEST_NAME WORKING_DIR)
 
33
    if(AUTOPILOT_BIN)
 
34
        add_custom_command(TARGET autopilot
 
35
            COMMAND ${ENVIROMENT} autopilot run ${TEST_NAME} ${AUTOPILOT_TESTS_ARGS}
 
36
            WORKING_DIRECTORY ${WORKING_DIR}) 
 
37
    endif()
 
38
endfunction()