]> granicus.if.org Git - icinga2/blob - test/CMakeLists.txt
6f43285451b75857bc07d51d4992e58f48c390d5
[icinga2] / test / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 set(Boost_USE_STATIC_LIBS OFF)
19
20 include(BoostTestTargets)
21
22 set(base_test_SOURCES
23   base-array.cpp base-base64.cpp base-convert.cpp base-dictionary.cpp base-fifo.cpp
24   base-json.cpp base-match.cpp base-netstring.cpp base-object.cpp
25   base-serialize.cpp base-shellescape.cpp base-stacktrace.cpp
26   base-stream.cpp base-string.cpp base-timer.cpp base-type.cpp
27   base-value.cpp config-ops.cpp icinga-checkresult.cpp icinga-legacytimeperiod.cpp
28   icinga-macros.cpp icinga-notification.cpp
29   icinga-perfdata.cpp remote-url.cpp
30 )
31
32 if(ICINGA2_UNITY_BUILD)
33     mkunity_target(base test base_test_SOURCES)
34 endif()
35
36 add_boost_test(base
37   SOURCES test-runner.cpp ${base_test_SOURCES}
38   TESTS base_array/construct
39         base_array/getset
40         base_array/resize
41         base_array/insert
42         base_array/remove
43         base_array/foreach
44         base_array/clone
45         base_array/json
46         base_base64/base64
47         base_convert/tolong
48         base_convert/todouble
49         base_convert/tostring
50         base_convert/tobool
51         base_dictionary/construct
52         base_dictionary/get1
53         base_dictionary/get2
54         base_dictionary/foreach
55         base_dictionary/remove
56         base_dictionary/clone
57         base_dictionary/json
58         base_fifo/construct
59         base_fifo/io
60         base_json/invalid1
61         base_match/tolong
62         base_netstring/netstring
63         base_object/construct
64         base_object/getself
65         base_serialize/scalar
66         base_serialize/array
67         base_serialize/dictionary
68         base_serialize/object
69         base_shellescape/escape_basic
70         base_shellescape/escape_quoted
71         base_stacktrace/stacktrace
72         base_stream/readline_stdio
73         base_string/construct
74         base_string/equal
75         base_string/clear
76         base_string/append
77         base_string/trim
78         base_string/contains
79         base_string/replace
80         base_string/index
81         base_string/find
82         base_timer/construct
83         base_timer/interval
84         base_timer/invoke
85         base_timer/scope
86         base_type/gettype
87         base_type/assign
88         base_type/byname
89         base_type/instantiate
90         base_value/scalar
91         base_value/convert
92         base_value/format
93         config_ops/simple
94         config_ops/advanced
95         icinga_checkresult/host_1attempt
96         icinga_checkresult/host_2attempts
97         icinga_checkresult/host_3attempts
98         icinga_checkresult/service_1attempt
99         icinga_checkresult/service_2attempts
100         icinga_checkresult/service_3attempts
101         icinga_checkresult/host_flapping_notification
102         icinga_checkresult/service_flapping_notification
103         icinga_notification/state_filter
104         icinga_notification/type_filter
105         icinga_macros/simple
106         icinga_legacytimeperiod/simple
107         icinga_perfdata/empty
108         icinga_perfdata/simple
109         icinga_perfdata/quotes
110         icinga_perfdata/multiple
111         icinga_perfdata/uom
112         icinga_perfdata/warncritminmax
113         icinga_perfdata/ignore_invalid_warn_crit_min_max
114         icinga_perfdata/invalid
115         icinga_perfdata/multi
116         remote_url/id_and_path
117         remote_url/parameters
118         remote_url/get_and_set
119         remote_url/format
120         remote_url/illegal_legal_strings
121 )
122
123 add_whole_static_library(${base_TARGET_NAME} base)
124 add_whole_static_library(${base_TARGET_NAME} config)
125 add_whole_static_library(${base_TARGET_NAME} icinga)
126
127 if(ICINGA2_WITH_LIVESTATUS)
128   set(livestatus_test_SOURCES
129     livestatus.cpp
130   )
131
132   if(ICINGA2_UNITY_BUILD)
133       mkunity_target(livestatus test livestatus_test_SOURCES)
134   endif()
135
136   add_boost_test(livestatus
137     SOURCES test-runner.cpp livestatus-fixture.cpp ${livestatus_test_SOURCES}
138     TESTS livestatus/hosts livestatus/services
139   )
140
141   add_whole_static_library(${livestatus_TARGET_NAME} base)
142   add_whole_static_library(${livestatus_TARGET_NAME} config)
143   add_whole_static_library(${livestatus_TARGET_NAME} icinga)
144   add_whole_static_library(${livestatus_TARGET_NAME} livestatus)
145   add_whole_static_library(${livestatus_TARGET_NAME} methods)
146 endif()
147
148 set(icinga_checkable_test_SOURCES
149     icinga-checkable-flapping.cpp
150 )
151
152 if(ICINGA2_UNITY_BUILD)
153     mkunity_target(icinga_checkable test icinga_checkable_test_SOURCES)
154 endif()
155
156 add_boost_test(icinga_checkable
157   SOURCES test-runner.cpp icinga-checkable-test.cpp ${icinga_checkable_test_SOURCES}
158   TESTS icinga_checkable_flapping/host_not_flapping
159         icinga_checkable_flapping/host_flapping
160         icinga_checkable_flapping/host_flapping_recover
161         icinga_checkable_flapping/host_flapping_docs_example
162 )
163
164 add_whole_static_library(${icinga_checkable_TARGET_NAME} base)
165 add_whole_static_library(${icinga_checkable_TARGET_NAME} config)
166 add_whole_static_library(${icinga_checkable_TARGET_NAME} icinga)
167 add_whole_static_library(${icinga_checkable_TARGET_NAME} cli)