-
Notifications
You must be signed in to change notification settings - Fork 313
/
Copy pathAgentHwSaiHwTest.cmake
274 lines (227 loc) · 7.5 KB
/
AgentHwSaiHwTest.cmake
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
# CMake to build libraries and binaries in fboss/agent/hw/sai/hw_test
# In general, libraries and binaries in fboss/foo/bar are built by
# cmake/FooBar.cmake
add_library(thrift_test_handler
fboss/agent/hw/sai/hw_test/SaiTestHandler.cpp
)
target_link_libraries(thrift_test_handler
diag_shell
sai_test_ctrl_cpp2
)
set_target_properties(thrift_test_handler PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_switch_ensemble
fboss/agent/hw/sai/hw_test/HwSwitchEnsembleFactory.cpp
fboss/agent/hw/sai/hw_test/SaiSwitchEnsemble.cpp
)
target_link_libraries(sai_switch_ensemble
core
setup_thrift
sai_switch
thrift_test_handler
hw_switch_ensemble
hw_link_state_toggler
sai_platform
sai_test_ctrl_cpp2
sai_traced_api
)
add_library(sai_phy_capabilities
fboss/agent/hw/sai/hw_test/PhyCapabilities.cpp
)
target_link_libraries(sai_phy_capabilities
sai_switch
)
set_target_properties(sai_switch_ensemble PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
set_target_properties(sai_phy_capabilities PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_ecmp_utils
fboss/agent/hw/sai/hw_test/HwTestEcmpUtils.cpp
)
target_link_libraries(sai_ecmp_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
)
set_target_properties(sai_ecmp_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_ptp_tc_utils
fboss/agent/hw/sai/hw_test/HwTestPtpTcUtils.cpp
)
target_link_libraries(sai_ptp_tc_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
)
set_target_properties(sai_ptp_tc_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_udf_utils
fboss/agent/hw/sai/hw_test/HwTestUdfUtils.cpp
)
target_link_libraries(sai_udf_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
)
set_target_properties(sai_udf_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_port_utils
fboss/agent/hw/sai/hw_test/HwTestPortUtils.cpp
)
target_link_libraries(sai_port_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
sai_platform
)
set_target_properties(sai_port_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_copp_utils
fboss/agent/hw/sai/hw_test/HwTestCoppUtils.cpp
)
target_link_libraries(sai_copp_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
hw_copp_utils
)
set_target_properties(sai_copp_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_acl_utils
fboss/agent/hw/sai/hw_test/HwTestAclUtils.cpp
)
target_link_libraries(sai_acl_utils
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
hw_acl_utils
)
set_target_properties(sai_acl_utils PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(sai_packet_trap_helper
fboss/agent/hw/sai/hw_test/HwTestPacketTrapEntry.cpp
)
target_link_libraries(sai_packet_trap_helper
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
)
set_target_properties(sai_packet_trap_helper PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
add_library(agent_hw_test_thrift_handler
fboss/agent/hw/test/HwTestThriftHandler.h
fboss/agent/hw/sai/hw_test/HwTestThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestAclUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestMirrorUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestNeighborUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestEcmpUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestPortUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestVoqSwitchUtilsThriftHandler.cpp
fboss/agent/hw/sai/hw_test/HwTestRouteUtilsThriftHandler.cpp
)
target_link_libraries(agent_hw_test_thrift_handler
sai_switch # //fboss/agent/hw/sai/switch:sai_switch
acl_test_utils
agent_hw_test_ctrl_cpp2
sai_ecmp_utils
diag_shell
)
function(BUILD_SAI_TEST SAI_IMPL_NAME SAI_IMPL_ARG)
message(STATUS "Building SAI_IMPL_NAME: ${SAI_IMPL_NAME} SAI_IMPL_ARG: ${SAI_IMPL_ARG}")
add_executable(sai_test-${SAI_IMPL_NAME}
fboss/agent/hw/sai/hw_test/dataplane_tests/SaiAclTableGroupTrafficTests.cpp
fboss/agent/hw/sai/hw_test/HwTestTamUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestAclUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestPfcUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestAqmUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestCoppUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestEcmpUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestFabricUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestFlowletSwitchingUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestNeighborUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestMirrorUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestMplsUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestPacketTrapEntry.cpp
fboss/agent/hw/sai/hw_test/HwTestPtpTcUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestTeFlowUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestTrunkUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestPortUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestRouteUtils.cpp
fboss/agent/hw/sai/hw_test/HwTestUdfUtils.cpp
fboss/agent/hw/sai/hw_test/HwVlanUtils.cpp
fboss/agent/hw/sai/hw_test/SaiAclTableGroupTests.cpp
fboss/agent/hw/sai/hw_test/SaiNextHopGroupTest.cpp
fboss/agent/hw/sai/hw_test/SaiPortUtils.cpp
fboss/agent/hw/sai/hw_test/SaiPortAdminStateTests.cpp
fboss/agent/hw/sai/hw_test/SaiLinkStateRollbackTests.cpp
fboss/agent/hw/sai/hw_test/SaiNeighborRollbackTests.cpp
fboss/agent/hw/sai/hw_test/SaiRollbackTest.cpp
fboss/agent/hw/sai/hw_test/SaiRouteRollbackTests.cpp
fboss/agent/hw/sai/hw_test/SaiQPHRollbackTests.cpp
)
add_sai_sdk_dependencies(sai_test-${SAI_IMPL_NAME})
target_link_libraries(sai_test-${SAI_IMPL_NAME}
# --whole-archive is needed for gtest to find these tests
-Wl,--whole-archive
${SAI_IMPL_ARG}
sai_switch_ensemble
sai_phy_capabilities
hw_switch_test
hw_test_main
-Wl,--no-whole-archive
ref_map
${GTEST}
${LIBGMOCK_LIBRARIES}
)
if(SAI_TAJO_IMPL)
target_link_libraries(sai_test-${SAI_IMPL_NAME}
${GRPC}
${ABSL_SYNCHRONIZATION}
${PROTOBUF}
${LIBNL3}
${LIBNL_GENL3}
)
endif()
if (SAI_BRCM_IMPL)
target_link_libraries(sai_test-${SAI_IMPL_NAME}
${YAML}
)
endif()
set_target_properties(sai_test-${SAI_IMPL_NAME}
PROPERTIES COMPILE_FLAGS
"-DSAI_VER_MAJOR=${SAI_VER_MAJOR} \
-DSAI_VER_MINOR=${SAI_VER_MINOR} \
-DSAI_VER_RELEASE=${SAI_VER_RELEASE}"
)
endfunction()
if(BUILD_SAI_FAKE)
BUILD_SAI_TEST("fake" fake_sai)
install(
TARGETS
sai_test-fake)
endif()
# If libsai_impl is provided, build sai tests linking with it
find_library(SAI_IMPL sai_impl)
message(STATUS "SAI_IMPL: ${SAI_IMPL}")
if(SAI_IMPL)
BUILD_SAI_TEST("sai_impl" ${SAI_IMPL})
install(
TARGETS
sai_test-sai_impl)
endif()