~ken-vandine/content-hub/no-change-rebuild

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/CMakeLists.txt

  • Committer: Bileto Bot
  • Author(s): Ken VanDine
  • Date: 2016-11-28 17:39:34 UTC
  • mfrom: (307.1.1 zesty-gmock-fix)
  • Revision ID: ci-train-bot@canonical.com-20161128173934-qct36b581ob1h3bp
Fix build failure on zesty due to googletest 1.8. Also refactored tests/acceptance-tests/CMakeLists.txt to make adding tests less cumbersome. (LP: #1644062)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
#
15
15
# Authored by: Thomas Voss <thomas.voss@canonical.com>
16
16
 
 
17
project(test CXX C)
17
18
qt5_wrap_cpp(MOCS test_harness.h)
18
19
 
19
 
add_executable(
 
20
set(TESTS
20
21
  app_hub_communication_default_source
21
 
  app_hub_communication_default_source.cpp
22
 
  ${MOCS}
23
 
)
24
 
 
25
 
add_executable(
26
22
  app_hub_communication_known_sources
27
 
  app_hub_communication_known_sources.cpp
28
 
  ${MOCS}
29
 
)
30
 
 
31
 
add_executable(
32
23
  app_hub_communication_stores
33
 
  app_hub_communication_stores.cpp
34
 
  ${MOCS}
35
 
)
36
 
 
37
 
add_executable(
38
24
  app_hub_communication_transfer
39
 
  app_hub_communication_transfer.cpp
40
 
  ${MOCS}
41
 
)
42
 
 
43
 
add_executable(
44
25
  app_hub_communication_paste
45
 
  app_hub_communication_paste.cpp
46
 
  ${MOCS}
47
 
)
48
 
 
49
 
add_executable(
50
26
  app_hub_communication_handler
51
 
  app_hub_communication_handler.cpp
52
 
  ${MOCS}
53
 
  transfer_files
54
 
)
55
 
 
56
 
add_executable(
57
27
  test_utils
58
 
  test_utils.cpp
59
 
)
60
 
 
61
 
add_executable(
62
28
  test_types
63
 
  test_types.cpp
64
 
)
 
29
  mimedata_test
 
30
)
 
31
 
 
32
set(TEST_LIBS
 
33
  ${GMOCK_LIBRARY}
 
34
  ${GTEST_BOTH_LIBRARIES}
 
35
  content-hub
 
36
)
 
37
 
 
38
foreach(test ${TESTS})
 
39
  # set the sources per test
 
40
  set(${test}_SOURCES
 
41
    ${test}.cpp
 
42
    ${MOCS}
 
43
    transfer_files
 
44
  )
 
45
endforeach(test)
 
46
 
 
47
foreach(test ${TESTS})
 
48
  # set targets, linked libs and test
 
49
  add_executable(${test}
 
50
    ${${test}_SOURCES}
 
51
  )
 
52
  qt5_use_modules(${test} Core Gui DBus Test)
 
53
 
 
54
  target_link_libraries(${test}
 
55
    ${TEST_LIBS}
 
56
  )
 
57
 
 
58
  add_test(NAME ${test} COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/${test})
 
59
 
 
60
  SET_TESTS_PROPERTIES(${test}
 
61
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
 
62
endforeach(test)
65
63
 
66
64
add_executable(
67
65
  test_hook
74
72
  source_all.json
75
73
)
76
74
 
77
 
add_executable(
78
 
  mimedata_test
79
 
  mimedata_test.cpp
80
 
  ${MOCS}
81
 
)
82
 
 
83
 
qt5_use_modules(app_hub_communication_default_source Core Gui DBus Test)
84
 
qt5_use_modules(app_hub_communication_known_sources Core Gui DBus Test)
85
 
qt5_use_modules(app_hub_communication_stores Core Gui DBus Test)
86
 
qt5_use_modules(app_hub_communication_transfer Core Gui DBus Test)
87
 
qt5_use_modules(app_hub_communication_paste Core Gui DBus Test)
88
 
qt5_use_modules(app_hub_communication_handler Core Gui DBus Test)
89
 
qt5_use_modules(test_utils Core Test)
90
75
qt5_use_modules(test_hook Core Gui DBus Test)
91
 
qt5_use_modules(mimedata_test Core Test)
92
 
 
93
 
target_link_libraries(app_hub_communication_stores content-hub gmock gtest gtest_main)
94
 
target_link_libraries(app_hub_communication_default_source content-hub gmock gtest gtest_main)
95
 
target_link_libraries(app_hub_communication_known_sources content-hub gmock gtest gtest_main)
96
 
target_link_libraries(app_hub_communication_stores content-hub gmock gtest gtest_main)
97
 
target_link_libraries(app_hub_communication_transfer content-hub gmock gtest gtest_main)
98
 
target_link_libraries(app_hub_communication_paste content-hub gmock gtest gtest_main)
99
 
target_link_libraries(app_hub_communication_handler content-hub gmock gtest gtest_main)
100
 
target_link_libraries(test_utils content-hub gmock gtest gtest_main)
101
 
target_link_libraries(test_types content-hub gmock gtest gtest_main)
102
 
target_link_libraries(test_hook content-hub gmock gtest gtest_main ${GSETTINGS_LDFLAGS})
103
 
target_link_libraries(mimedata_test content-hub gmock gtest gtest_main)
104
 
 
105
 
add_test(NAME app_hub_communication_default_source COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_default_source)
106
 
add_test(NAME app_hub_communication_known_sources COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_known_sources)
107
 
add_test(NAME app_hub_communication_stores COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_stores)
108
 
add_test(NAME app_hub_communication_transfer COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_transfer)
109
 
add_test(NAME app_hub_communication_paste COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_paste)
110
 
add_test(NAME app_hub_communication_handler COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/app_hub_communication_handler)
111
 
add_test(NAME test_utils COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/test_utils)
112
 
add_test(NAME test_types COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/test_types)
 
76
target_link_libraries(test_hook content-hub ${GTEST_ALL_LIBRARIES} ${GSETTINGS_LDFLAGS})
113
77
add_test(NAME test_hook COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/test_hook)
114
 
add_test(NAME mimedata_test COMMAND mimedata_test)
115
78
 
116
 
SET_TESTS_PROPERTIES(app_hub_communication_stores
117
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
118
 
SET_TESTS_PROPERTIES(app_hub_communication_default_source
119
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
120
 
SET_TESTS_PROPERTIES(app_hub_communication_known_sources
121
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
122
 
SET_TESTS_PROPERTIES(app_hub_communication_transfer
123
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
124
 
SET_TESTS_PROPERTIES(app_hub_communication_paste
125
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
126
 
SET_TESTS_PROPERTIES(app_hub_communication_handler
127
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
128
 
SET_TESTS_PROPERTIES(test_utils
129
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
130
 
SET_TESTS_PROPERTIES(test_types
131
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
132
79
SET_TESTS_PROPERTIES(test_hook
133
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
134
 
SET_TESTS_PROPERTIES(mimedata_test
135
 
    PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
 
80
  PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
136
81
 
137
82
set_target_properties(
138
83
  test_hook