summaryrefslogtreecommitdiffstats
path: root/dcop/tests/CMakeLists.txt
blob: 1eb0c4227db277002176a2ffb14886c3ac030c93 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#################################################
#
#  (C) 2016 Alexander Golubev
#  fatzer2 (AT) gmail.com
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

include_directories(
  ${TQT_INCLUDE_DIRS}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_SOURCE_DIR}/dcop
  ${CMAKE_SOURCE_DIR}/tdecore
  ${CMAKE_BINARY_DIR}/tdecore
)

link_directories(
  ${TQT_LIBRARY_DIRS}
)


##### checks ####################################

tde_add_check_executable( dcop_test AUTOMOC
  SOURCES test.cpp ${CMAKE_CURRENT_BINARY_DIR}/test.skel
  LINK tdecore-shared
  DEPENDENCIES dcop_tests_generated
)

set_property(
  SOURCE test.cpp
  APPEND PROPERTY
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_skel.cpp
)

tde_add_check_executable( driver AUTOMOC
  SOURCES driver.cpp ${CMAKE_CURRENT_BINARY_DIR}/test.stub
  LINK tdecore-shared
  DEPENDENCIES dcop_tests_generated
)

set_property(
  SOURCE driver.cpp
  APPEND PROPERTY
  OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_stub.cpp
)

add_test( NAME "dcop/dcop-tests"
    COMMAND sh -x "${CMAKE_CURRENT_SOURCE_DIR}/run-tests.sh"
    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" )

set_tests_properties( dcop/dcop-tests PROPERTIES TIMEOUT 30)


##### test.h and files ##########################

add_custom_target( dcop_tests_generated DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test.h )

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/test.h ${CMAKE_CURRENT_BINARY_DIR}/shell.generated
  COMMAND perl "${CMAKE_CURRENT_SOURCE_DIR}/generate.pl"
    <"${CMAKE_CURRENT_SOURCE_DIR}/testcases"
  DEPENDS testcases generate.pl
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)