-
Notifications
You must be signed in to change notification settings - Fork 242
/
CMakeLists.txt
827 lines (723 loc) · 18.2 KB
/
CMakeLists.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.2)
project(openr)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Disable all warnings. Warnings can vary across toolchains. We rely on
# internaly configured CI (lint and compile) to raise the warnings we find
# useful
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
# Optionally build with LTO
option(BUILD_WITH_LTO "BUILD_WITH_LTO" OFF)
if (BUILD_WITH_LTO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
endif()
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
set(
CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/build/fbcode_builder/CMake"
"${CMAKE_SOURCE_DIR}"
${CMAKE_MODULE_PATH}
)
include(FBThriftCppLibrary)
include(FBGenCMakeBuildInfo)
set(REQ_BOOST_COMPONENTS ${REQ_BOOST_COMPONENTS} system thread context filesystem program_options regex)
find_library(ASYNC async PATHS)
find_package(Boost REQUIRED COMPONENTS ${REQ_BOOST_COMPONENTS})
find_library(CONCURRENCY concurrency PATHS)
find_library(DOUBLE-CONVERSION double-conversion)
find_package(folly REQUIRED)
find_package(fb303 CONFIG REQUIRED)
find_package(fizz REQUIRED)
find_package(fmt REQUIRED)
find_package(Gflags REQUIRED)
find_package(Glog REQUIRED)
find_library(RE2 re2)
find_library(SODIUM sodium)
find_package(FBThrift REQUIRED)
find_package(wangle REQUIRED)
find_package(Threads REQUIRED)
find_library(ZSTD zstd)
find_library(BENCHMARK follybenchmark PATHS)
find_package(range-v3 REQUIRED)
find_package(Xxhash REQUIRED)
find_path(RE2_INCLUDE_DIR re2/re2.h)
set(FOLLY_EXCEPTION_TRACER)
if (TARGET Folly::folly_exception_tracer)
set(FOLLY_EXCEPTION_TRACER Folly::folly_exception_tracer)
endif()
add_compile_definitions(NO_FOLLY_EXCEPTION_TRACER)
# enable coroutine compiler option if supported by compiler
include(CheckCXXCompilerFlag)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
check_cxx_compiler_flag(-fcoroutines COMPILER_HAS_F_COROUTINES)
if (COMPILER_HAS_F_COROUTINES)
message(
STATUS
"GCC has support for C++ coroutines, "
"disabling since fbthrift service is not ready"
)
# add_compile_options(-fcoroutines)
else()
message(
STATUS
"GCC does not have support for C++ coroutines, "
"disabling Folly coroutine support."
)
endif()
endif()
include_directories(
${Boost_INCLUDE_DIR}
${FB303_INCLUDE_DIR}
${FBTHRIFT_INCLUDE_DIR}
${FOLLY_INCLUDE_DIR}
${RE2_INCLUDE_DIR}
${Xxhash_INCLUDE_DIR}
)
#
# Build thrift libs
#
SET(OPENR_THRIFT_LIBS)
add_fbthrift_cpp_library(
routing_policy_cpp2
configerator/structs/neteng/config/routing_policy.thrift
OPTIONS
json
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} routing_policy_cpp2)
add_fbthrift_cpp_library(
vip_service_config_cpp2
configerator/structs/neteng/config/vip_service_config.thrift
OPTIONS
json
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} vip_service_config_cpp2)
add_fbthrift_cpp_library(
openr_config_cpp2
openr/if/OpenrConfig.thrift
OPTIONS
json
DEPENDS
routing_policy_cpp2
vip_service_config_cpp2
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} openr_config_cpp2)
add_fbthrift_cpp_library(
network_cpp2
openr/if/Network.thrift
OPTIONS
json
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} network_cpp2)
add_fbthrift_cpp_library(
platform_cpp2
openr/if/Platform.thrift
SERVICES
FibService
NeighborListenerClientForFibagent
OPTIONS
json
DEPENDS
fb303::fb303_thrift_cpp
network_cpp2
types_cpp2
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} platform_cpp2)
add_fbthrift_cpp_library(
dual_cpp2
openr/if/Dual.thrift
OPTIONS
json
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} dual_cpp2)
add_fbthrift_cpp_library(
kv_store_cpp2
openr/if/KvStore.thrift
OPTIONS
json
DEPENDS
fb303::fb303_thrift_cpp
SERVICES
KvStoreService
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} kv_store_cpp2)
add_fbthrift_cpp_library(
types_cpp2
openr/if/Types.thrift
OPTIONS
json
DEPENDS
network_cpp2
openr_config_cpp2
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} types_cpp2)
add_fbthrift_cpp_library(
openr_ctrl_cpp2
openr/if/OpenrCtrl.thrift
SERVICES
OpenrCtrl
OPTIONS
json
DEPENDS
openr_config_cpp2
kv_store_cpp2
types_cpp2
network_cpp2
fb303::fb303_thrift_cpp
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} openr_ctrl_cpp2)
add_fbthrift_cpp_library(
openr_ctrl_cpp_cpp2
openr/if/OpenrCtrlCpp.thrift
SERVICES
OpenrCtrlCpp
OPTIONS
json
stream
server_stream
DEPENDS
openr_ctrl_cpp2
kv_store_cpp2
types_cpp2
)
SET(OPENR_THRIFT_LIBS ${OPENR_THRIFT_LIBS} openr_ctrl_cpp_cpp2)
add_build_info(build_info)
install(TARGETS
${OPENR_THRIFT_LIBS}
DESTINATION lib
)
add_library(openrlib
openr/common/AsyncThrottle.cpp
openr/common/BuildInfo.cpp
openr/common/Constants.cpp
openr/common/ExponentialBackoff.cpp
openr/common/Flags.cpp
openr/common/FileUtil.cpp
openr/common/LsdbTypes.cpp
openr/common/LsdbUtil.cpp
openr/common/MainUtil.cpp
openr/common/NetworkUtil.cpp
openr/common/OpenrEventBase.cpp
openr/common/Types.cpp
openr/common/Util.cpp
openr/config/Config.cpp
openr/config-store/PersistentStore.cpp
openr/config-store/PersistentStoreWrapper.cpp
openr/ctrl-server/OpenrCtrlHandler.cpp
openr/decision/Decision.cpp
openr/decision/LinkState.cpp
openr/decision/PrefixState.cpp
openr/decision/RibPolicy.cpp
openr/decision/SpfSolver.cpp
openr/decision/tests/DecisionTestUtils.cpp
openr/decision/tests/RoutingBenchmarkUtils.cpp
openr/dispatcher/Dispatcher.cpp
openr/dispatcher/DispatcherQueue.cpp
openr/kvstore/Dual.cpp
openr/fib/Fib.cpp
openr/kvstore/KvStorePublisher.cpp
openr/kvstore/KvStoreUtil.cpp
openr/kvstore/KvStoreWrapper.cpp
openr/link-monitor/AdjacencyEntry.cpp
openr/link-monitor/LinkMonitor.cpp
openr/link-monitor/InterfaceEntry.cpp
openr/neighbor-monitor/NeighborMonitor.cpp
openr/nl/NetlinkAddrMessage.cpp
openr/nl/NetlinkLinkMessage.cpp
openr/nl/NetlinkNeighborMessage.cpp
openr/nl/NetlinkRouteMessage.cpp
openr/nl/NetlinkRuleMessage.cpp
openr/nl/NetlinkMessageBase.cpp
openr/nl/NetlinkProtocolSocket.cpp
openr/nl/NetlinkTypes.cpp
openr/monitor/LogSample.cpp
openr/monitor/Monitor.cpp
openr/monitor/MonitorBase.cpp
openr/monitor/SystemMetrics.cpp
openr/platform/NetlinkFibHandler.cpp
openr/plugin/Plugin.cpp
openr/policy/PolicyManager.cpp
openr/prefix-manager/PrefixManager.cpp
openr/spark/IoProvider.cpp
openr/spark/SparkWrapper.cpp
openr/spark/Spark.cpp
openr/tests/mocks/MockNetlinkProtocolSocket.cpp
openr/tests/mocks/PrefixGenerator.cpp
openr/tests/utils/Utils.cpp
openr/watchdog/Watchdog.cpp
)
if (BUILD_SHARED_LIBS)
set_target_properties(openrlib PROPERTIES VERSION 1.0.0 SOVERSION 1)
endif()
target_link_libraries(openrlib
build_info
${BENCHMARK}
${OPENR_THRIFT_LIBS}
${DOUBLE-CONVERSION}
glog::glog
gflags
FBThrift::thriftcpp2
fb303::fb303
${ASYNC}
${CONCURRENCY}
${ZSTD}
Folly::folly
${FOLLY_EXCEPTION_TRACER}
${SODIUM}
${RE2}
${Boost_LIBRARIES}
-lpthread
-lcrypto
stdc++fs
range-v3
)
install(TARGETS
openrlib
DESTINATION lib
)
add_executable(openr_bin
openr/Main.cpp
)
target_link_libraries(openr_bin
openrlib
${OPENR_THRIFT_LIBS}
${GLOG}
${GFLAGS}
${THRIFT}
${ZSTD}
FBThrift::thriftcpp2
${ASYNC}
${CONCURRENCY}
Folly::folly
${FOLLY_EXCEPTION_TRACER}
${SODIUM}
${Boost_LIBRARIES}
-lpthread
-lcrypto
)
install(TARGETS
openr_bin
DESTINATION sbin
RENAME openr
)
option(BUILD_TOOLS "BUILD_TOOLS" ON)
if(BUILD_TOOLS)
add_executable(openr_kvstore_snooper
openr/kvstore/tools/KvStoreSnooper.cpp
)
target_link_libraries(openr_kvstore_snooper
openrlib
${GLOG}
${GFLAGS}
${THRIFT}
${ZSTD}
${THRIFTCPP2}
${ASYNC}
${TRANSPORT}
${CONCURRENCY}
${THRIFTPROTOCOL}
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${SODIUM}
${Boost_LIBRARIES}
-lpthread
-lcrypto
)
install(TARGETS
openr_kvstore_snooper
DESTINATION sbin
)
endif()
add_executable(platform_linux
openr/platform/LinuxPlatformMain.cpp
openr/platform/NetlinkFibHandler.cpp
)
target_link_libraries(platform_linux
openrlib
${OPENR_THRIFT_LIBS}
${GLOG}
${GFLAGS}
Folly::folly
${FOLLY_EXCEPTION_TRACER}
FBThrift::thriftcpp2
${ZSTD}
${ASYNC}
${CONCURRENCY}
${SODIUM}
${Boost_LIBRARIES}
-lpthread
)
install(TARGETS
platform_linux
DESTINATION sbin
)
#
# Install files
#
# headers
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/openr
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/common
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
# thrift files
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/openr
DESTINATION include
FILES_MATCHING PATTERN "*.thrift"
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/common
DESTINATION include
FILES_MATCHING PATTERN "*.thrift"
)
#
# Tests
#
option(BUILD_TESTS "BUILD_TESTS" ON)
option(ADD_ROOT_TESTS "ADD_ROOT_TESTS" ON)
if(BUILD_TESTS)
enable_testing()
find_package(GMock MODULE REQUIRED)
find_package(GTest MODULE REQUIRED)
include_directories(
${GTEST_INCLUDE_DIRS}
${GMOCK_INCLUDE_DIRS}
)
# function that adds tests, typical usage example:
# add_openr_test(TestName test_bin_name
# SOURCES Feature1Test.cpp Feature2Test.cpp
# LIBRARIES additional_library1 -lcrypto
# DESTINATION folder/where/to/place/binary
# )
function(add_openr_test TEST_NAME BIN_NAME)
set(one_value_args DESTINATION)
set(multi_value_args SOURCES LIBRARIES)
fb_cmake_parse_args(
ARG
""
"${one_value_args}"
"${multi_value_args}"
"${ARGN}"
)
add_executable(
${BIN_NAME}
${ARG_SOURCES}
)
target_link_libraries(${BIN_NAME}
openrlib
${OPENR_THRIFT_LIBS}
${GTEST_BOTH_LIBRARIES}
${LIBGMOCK_LIBRARIES}
${ARG_LIBRARIES}
)
add_test(${TEST_NAME} ${BIN_NAME})
if(NOT "${ARG_DESTINATION}" STREQUAL "")
install(TARGETS
${BIN_NAME}
DESTINATION ${ARG_DESTINATION}
)
endif()
endfunction()
add_openr_test(OpenrSystemTest openr_system_test
SOURCES
openr/tests/OpenrSystemTest.cpp
openr/tests/OpenrWrapper.cpp
openr/tests/mocks/NetlinkEventsInjector.cpp
openr/tests/mocks/MockIoProvider.cpp
openr/tests/mocks/MockIoProviderUtils.cpp
LIBRARIES
${GLOG}
${GFLAGS}
FBThrift::thriftcpp2
${ZSTD}
Folly::folly
${FOLLY_EXCEPTION_TRACER}
${SODIUM}
${Boost_LIBRARIES}
-lpthread
-lcrypto
DESTINATION sbin/tests/openr
)
add_openr_test(OpenrCtrlHandlerTest openr_ctrl_handler_test
SOURCES
openr/ctrl-server/tests/OpenrCtrlHandlerTest.cpp
openr/tests/mocks/NetlinkEventsInjector.cpp
DESTINATION sbin/tests/openr/ctrl-server
)
add_openr_test(OpenrCtrlLongPollTest openr_ctrl_longpoll_test
SOURCES
openr/ctrl-server/tests/OpenrCtrlLongPollTest.cpp
DESTINATION sbin/tests/openr/ctrl-server
)
add_openr_test(AsyncDebounceTest async_debounce_test
SOURCES
openr/common/tests/AsyncDebounceTest.cpp
DESTINATION sbin/tests/openr/common
)
add_openr_test(AsyncThrottleTest async_throttle_test
SOURCES
openr/common/tests/AsyncThrottleTest.cpp
DESTINATION sbin/tests/openr/common
)
add_openr_test(ExponentialBackoffTest exp_backoff_test
SOURCES
openr/common/tests/ExponentialBackoffTest.cpp
DESTINATION sbin/tests/openr/common
)
add_openr_test(OpenrEventBaseTest openr_event_base_test
SOURCES
openr/common/tests/OpenrEventBaseTest.cpp
DESTINATION sbin/tests/openr/common
)
add_openr_test(UtilTest util_test
SOURCES
openr/common/tests/UtilTest.cpp
DESTINATION sbin/tests/openr/common
)
add_openr_test(PersistentStoreTest config_store_test
SOURCES
openr/config-store/tests/PersistentStoreTest.cpp
DESTINATION sbin/tests/openr/config-store
)
add_openr_test(DecisionTest decision_test
SOURCES
openr/decision/tests/DecisionTest.cpp
DESTINATION sbin/tests/openr/decision
)
add_openr_test(DispatcherTest dispatcher_test
SOURCES
openr/dispatcher/tests/DispatcherTest.cpp
DESTINATION sbin/tests/openr/dispatcher
)
add_openr_test(DispatcherQueueTest dispatcher_queue_test
SOURCES
openr/dispatcher/tests/DispatcherQueueTest.cpp
DESTINATION sbin/tests/openr/dispatcher
)
add_openr_test(DualTest dual_test
SOURCES
openr/kvstore/tests/DualTest.cpp
DESTINATION sbin/tests/openr/kvstore
)
add_openr_test(LinkStateTest link_state_test
SOURCES
openr/decision/tests/LinkStateTest.cpp
DESTINATION sbin/tests/openr/decision
)
add_openr_test(PrefixStateTest prefix_state_test
SOURCES
openr/decision/tests/PrefixStateTest.cpp
DESTINATION sbin/tests/openr/decision
)
add_openr_test(RibPolicyTest rib_policy_test
SOURCES
openr/decision/tests/RibPolicyTest.cpp
DESTINATION sbin/tests/openr/decision
)
add_openr_test(RibEntryTest rib_entry_test
SOURCES
openr/decision/tests/RibEntryTest.cpp
DESTINATION sbin/tests/openr/decision
)
add_openr_test(KvStoreTest kvstore_test
SOURCES
openr/kvstore/tests/KvStoreTest.cpp
DESTINATION sbin/tests/openr/kvstore
)
add_openr_test(KvStoreTtlTest kvstore_ttl_test
SOURCES
openr/kvstore/tests/KvStoreTtlTest.cpp
DESTINATION sbin/tests/openr/kvstore
)
add_openr_test(KvStoreSelfOriginatedKeyTest kvstore_self_originated_key_test
SOURCES
openr/kvstore/tests/KvStoreSelfOriginatedKeyTest.cpp
DESTINATION sbin/tests/openr/kvstore
)
add_openr_test(KvStoreUtilTest kvstore_util_test
SOURCES
openr/kvstore/tests/KvStoreUtilTest.cpp
DESTINATION sbin/tests/openr/kvstore
)
add_openr_test(LinkMonitorTest link_monitor_test
SOURCES
openr/link-monitor/tests/LinkMonitorTest.cpp
openr/tests/mocks/NetlinkEventsInjector.cpp
DESTINATION sbin/tests/openr/link-monitor
)
if(ADD_ROOT_TESTS)
# This test fails under Travis, so adding it as an exception
add_openr_test(FibTest fib_test
SOURCES
openr/fib/tests/FibTest.cpp
openr/tests/mocks/MockNetlinkFibHandler.cpp
DESTINATION sbin/tests/openr/fib
)
endif()
add_openr_test(NetlinkTypesTest netlink_types_test
SOURCES
openr/nl/tests/NetlinkTypesTest.cpp
DESTINATION sbin/tests/openr/nl
)
if(ADD_ROOT_TESTS)
# these tests must be run by root user
add_openr_test(NetlinkProtocolSocketTest netlink_message_test
SOURCES
openr/nl/tests/NetlinkProtocolSocketTest.cpp
DESTINATION sbin/tests/openr/nl
)
endif()
add_openr_test(PrefixManagerTest prefix_manager_test
SOURCES
openr/prefix-manager/tests/PrefixManagerTest.cpp
DESTINATION sbin/tests/openr/prefix-manager
)
add_openr_test(SparkTest spark_test
SOURCES
openr/spark/tests/SparkTest.cpp
openr/tests/mocks/MockIoProvider.cpp
openr/tests/mocks/MockIoProviderUtils.cpp
DESTINATION sbin/tests/openr/spark
)
add_openr_test(MockIoProviderTest mock_io_provider_test
SOURCES
openr/tests/MockIoProviderTest.cpp
openr/tests/mocks/MockIoProvider.cpp
openr/tests/mocks/MockIoProviderUtils.cpp
DESTINATION sbin/tests/openr/spark
)
add_openr_test(MessagingQueueTest queue_test
SOURCES
openr/messaging/tests/QueueTest.cpp
LIBRARIES
Folly::folly
DESTINATION sbin/tests/openr/messaging
)
add_openr_test(MessagingReplicateQueueTest replicate_queue_test
SOURCES
openr/messaging/tests/ReplicateQueueTest.cpp
LIBRARIES
Folly::folly
DESTINATION sbin/tests/openr/messaging
)
add_openr_test(NetlinkFibHandlerTest netlink_fib_handler_test
SOURCES
openr/platform/tests/NetlinkFibHandlerTest.cpp
DESTINATION sbin/tests/openr/platform
)
add_openr_test(WatchdogTest watchdog_test
SOURCES
openr/watchdog/tests/WatchdogTest.cpp
DESTINATION sbin/tests/openr/watchdog
)
#
# benchmarks
#
add_executable(config_store_benchmark
openr/config-store/tests/PersistentStoreBenchmark.cpp
)
target_link_libraries(config_store_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${BENCHMARK}
)
install(TARGETS
config_store_benchmark
DESTINATION sbin/tests/openr/config-store
)
add_executable(fib_benchmark
openr/fib/tests/FibBenchmark.cpp
openr/tests/mocks/MockNetlinkFibHandler.cpp
)
target_link_libraries(fib_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${GMOCK}
${GMOCK_MAIN}
${GTEST_BOTH_LIBRARIES}
${GTEST_MAIN}
${THRIFTCPP2}
${BENCHMARK}
)
install(TARGETS
fib_benchmark
DESTINATION sbin/tests/openr/fib
)
add_executable(netlink_fib_handler_benchmark
openr/platform/tests/NetlinkFibHandlerBenchmark.cpp
)
target_link_libraries(netlink_fib_handler_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${LIBGMOCK_LIBRARIES}
${GTEST_BOTH_LIBRARIES}
${BENCHMARK}
)
install(TARGETS
netlink_fib_handler_benchmark
DESTINATION sbin/tests/openr/platform
)
add_executable(decision_benchmark
openr/decision/tests/DecisionBenchmark.cpp
)
target_link_libraries(decision_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${GMOCK}
${GMOCK_MAIN}
${GTEST_BOTH_LIBRARIES}
${GTEST_MAIN}
${THRIFTCPP2}
${BENCHMARK}
)
install(TARGETS
decision_benchmark
DESTINATION sbin/tests/openr/decision
)
add_executable(dispatcher_queue_benchmark
openr/dispatcher/tests/DispatcherQueueBenchmark.cpp
)
target_link_libraries(dispatcher_queue_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${GMOCK}
${GMOCK_MAIN}
${GTEST_BOTH_LIBRARIES}
${GTEST_MAIN}
${THRIFTCPP2}
${BENCHMARK}
)
install(TARGETS
dispatcher_queue_benchmark
DESTINATION sbin/tests/openr/dispatcher
)
add_executable(kvstore_benchmark
openr/kvstore/tests/KvStoreBenchmark.cpp
)
target_link_libraries(kvstore_benchmark
openrlib
${FOLLY}
${FOLLY_EXCEPTION_TRACER}
${BENCHMARK}
)
install(TARGETS
kvstore_benchmark
DESTINATION sbin/tests/openr/kvstore
)
endif()