Skip to content

Commit 53f4263

Browse files
committed
Split into binaries by test directory
1 parent 6aea2b2 commit 53f4263

File tree

6 files changed

+196
-59
lines changed

6 files changed

+196
-59
lines changed

build/chip/tests.gni

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ declare_args() {
3636

3737
declare_args() {
3838
# Use source_set instead of static_lib for tests.
39-
chip_build_test_static_libraries = chip_device_platform != "efr32"
39+
chip_build_test_static_libraries = chip_device_platform != "efr32" #++++
40+
#chip_build_test_static_libraries = true
4041
}
4142

4243
declare_args() {

scripts/build/builders/efr32.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def FlashBundleName(self):
7777
elif self == Efr32App.PUMP:
7878
return 'pump_app.flashbundle.txt'
7979
elif self == Efr32App.UNIT_TEST:
80-
return 'efr32_device_tests.flashbundle.txt'
80+
return 'efr32_device_tests.flashbundle.txt' # ++++ target name has changed
8181
else:
8282
raise Exception('Unknown app type: %r' % self)
8383

src/credentials/tests/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ chip_test_suite("tests") {
5656
]
5757

5858
# DUTVectors test requires <dirent.h> which is not supported on all platforms
59-
if (chip_device_platform != "openiotsdk" && chip_device_platform != "nxp") {
59+
if (chip_device_platform != "openiotsdk" && chip_device_platform != "nxp" &&
60+
chip_device_platform != "efr32") {
6061
test_sources += [ "TestCommissionerDUTVectors.cpp" ]
6162
}
6263

src/test_driver/efr32/BUILD.gn

+180-50
Original file line numberDiff line numberDiff line change
@@ -63,78 +63,208 @@ efr32_sdk("sdk") {
6363
]
6464
}
6565

66-
silabs_executable("efr32_device_tests") {
67-
output_name = "matter-silabs-device_tests.out"
66+
# silabs_executable("efr32_device_tests") {
67+
# output_name = "matter-silabs-device_tests.out"
6868

69-
defines = [ "PW_RPC_ENABLED" ]
70-
sources = [
71-
"${chip_root}/examples/common/pigweed/RpcService.cpp",
72-
"${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
73-
"${examples_common_plat_dir}/PigweedLogger.cpp",
74-
"${examples_common_plat_dir}/heap_4_silabs.c",
75-
"${examples_common_plat_dir}/syscalls_stubs.cpp",
76-
"${examples_plat_dir}/uart.cpp",
77-
"src/main.cpp",
78-
]
69+
# defines = [ "PW_RPC_ENABLED" ]
70+
# sources = [
71+
# "${chip_root}/examples/common/pigweed/RpcService.cpp",
72+
# "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
73+
# "${examples_common_plat_dir}/PigweedLogger.cpp",
74+
# "${examples_common_plat_dir}/heap_4_silabs.c",
75+
# "${examples_common_plat_dir}/syscalls_stubs.cpp",
76+
# "${examples_plat_dir}/uart.cpp",
77+
# "src/main.cpp",
78+
# ]
7979

80-
deps = [
81-
":nl_test_service.nanopb_rpc",
82-
":sdk",
83-
"$dir_pw_unit_test:rpc_service",
84-
"${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
85-
"${chip_root}/examples/common/pigweed:system_rpc_server",
86-
"${chip_root}/src:tests",
87-
"${chip_root}/src/lib",
88-
"${chip_root}/src/lib/support:pw_tests_wrapper",
89-
"${chip_root}/src/lib/support:testing_nlunit",
90-
"${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs",
91-
"${nlunit_test_root}:nlunit-test",
92-
]
80+
# deps = [
81+
# ":nl_test_service.nanopb_rpc",
82+
# ":sdk",
83+
# "$dir_pw_unit_test:rpc_service",
84+
# "${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
85+
# "${chip_root}/examples/common/pigweed:system_rpc_server",
86+
# "${chip_root}/src:tests",
87+
# "${chip_root}/src/lib",
88+
# "${chip_root}/src/lib/support:pw_tests_wrapper",
89+
# "${chip_root}/src/lib/support:testing_nlunit",
90+
# "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs",
91+
# "${nlunit_test_root}:nlunit-test",
92+
# ]
93+
94+
# # OpenThread Settings
95+
# if (chip_enable_openthread) {
96+
# deps += [
97+
# "${chip_root}/third_party/openthread:openthread",
98+
# "${chip_root}/third_party/openthread:openthread-platform",
99+
# "${examples_plat_dir}:efr-matter-shell",
100+
# ]
101+
# }
102+
103+
# # Attestation Credentials
104+
# deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
105+
106+
# # Factory Data Provider
107+
# if (use_efr32_factory_data_provider) {
108+
# deps += [ "${examples_plat_dir}:silabs-factory-data-provider" ]
109+
# }
110+
111+
# deps += pw_build_LINK_DEPS
112+
113+
# include_dirs = [ "${chip_root}/examples/common/pigweed/efr32" ]
114+
115+
# ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
116+
117+
# inputs = [ ldscript ]
118+
119+
# ldflags = [
120+
# "-T" + rebase_path(ldscript, root_build_dir),
121+
# "-Wl,--no-warn-rwx-segment",
122+
# ]
123+
124+
# output_dir = root_out_dir
125+
# }
126+
127+
# group("efr32") {
128+
# deps = [ ":efr32_device_tests" ]
129+
# }
130+
131+
132+
_tests = [
133+
"${chip_root}/src/app/interaction-model/tests",
134+
"${chip_root}/src/access/tests",
135+
"${chip_root}/src/crypto/tests",
136+
"${chip_root}/src/inet/tests",
137+
"${chip_root}/src/lib/address_resolve/tests",
138+
"${chip_root}/src/lib/asn1/tests",
139+
"${chip_root}/src/lib/core/tests",
140+
"${chip_root}/src/messaging/tests",
141+
"${chip_root}/src/protocols/bdx/tests",
142+
"${chip_root}/src/protocols/interaction_model/tests",
143+
"${chip_root}/src/protocols/user_directed_commissioning/tests",
144+
"${chip_root}/src/transport/retransmit/tests",
145+
"${chip_root}/src/app/icd/server/tests",
146+
"${chip_root}/src/lib/dnssd/minimal_mdns/core/tests",
147+
"${chip_root}/src/lib/dnssd/minimal_mdns/responders/tests",
148+
"${chip_root}/src/lib/dnssd/minimal_mdns/tests",
149+
"${chip_root}/src/lib/dnssd/tests",
150+
"${chip_root}/src/lib/dnssd/minimal_mdns/records/tests",
151+
"${chip_root}/src/setup_payload/tests",
152+
"${chip_root}/src/transport/raw/tests",
153+
"${chip_root}/src/app/tests",
154+
#"${chip_root}/src/credentials/tests", # openr.c:(.text._open_r+0x10): warning: _open is not implemented and will always fail
155+
"${chip_root}/src/lib/format/tests",
156+
#"${chip_root}/src/lib/support/tests", # openr.c:(.text._open_r+0x10): warning: _open is not implemented and will always fail
157+
"${chip_root}/src/protocols/secure_channel/tests",
158+
"${chip_root}/src/system/tests",
159+
"${chip_root}/src/transport/tests",
160+
"${chip_root}/src/platform/tests",
161+
"${chip_root}/src/lib/shell/tests",
162+
]
163+
164+
if (defined(matter_enable_tracing_support) && matter_enable_tracing_support &&
165+
defined(matter_trace_config) && matter_trace_config == "${chip_root}/src/tracing/multiplexed") {
166+
_tests += [ "${chip_root}/src/tracing/tests" ]
167+
}
93168

94-
# OpenThread Settings
95-
if (chip_enable_openthread) {
96-
deps += [
97-
"${chip_root}/third_party/openthread:openthread",
98-
"${chip_root}/third_party/openthread:openthread-platform",
99-
"${examples_plat_dir}:efr-matter-shell",
169+
if (defined(matter_enable_tracing_support) && chip_config_network_layer_ble) {
170+
_tests += [ "${chip_root}/src/ble/tests" ]
171+
}
172+
173+
if (chip_device_platform != "efr32") {
174+
# Doesn't compile on ef32. Multiple definitions issues with attribute storage and overflows flash memory.
175+
_tests += [ "${chip_root}/src/controller/tests/data_model" ]
176+
177+
_tests += [ "${chip_root}/src/controller/tests" ]
178+
}
179+
180+
copy_py_files = true # Copy silabs_firmware_utils.py and firmware_utils.py to the output directory only the first time silabs_executable is called.
181+
_deps = []
182+
foreach(_test, _tests) {
183+
_test_suffix = string_replace(_test, "/tests", "")
184+
_test_suffix = string_replace(_test_suffix, "${chip_root}/src/", "")
185+
_test_suffix = string_replace(_test_suffix, "/", "-")
186+
187+
silabs_executable("efr32_device_tests--${_test_suffix}") {
188+
output_name = "matter-silabs-device_tests--${_test_suffix}.out"
189+
190+
defines = [ "PW_RPC_ENABLED" ]
191+
sources = [
192+
"${chip_root}/examples/common/pigweed/RpcService.cpp",
193+
"${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
194+
"${examples_common_plat_dir}/PigweedLogger.cpp",
195+
"${examples_common_plat_dir}/heap_4_silabs.c",
196+
"${examples_common_plat_dir}/syscalls_stubs.cpp",
197+
"${examples_plat_dir}/uart.cpp",
198+
"src/main.cpp",
199+
]
200+
201+
deps = [
202+
":nl_test_service.nanopb_rpc",
203+
":sdk",
204+
"$dir_pw_unit_test:rpc_service",
205+
"${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
206+
"${chip_root}/examples/common/pigweed:system_rpc_server",
207+
"${_test}:tests",
208+
"${chip_root}/src/lib",
209+
"${chip_root}/src/lib/support:pw_tests_wrapper",
210+
"${chip_root}/src/lib/support:testing_nlunit",
211+
"${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs",
212+
"${nlunit_test_root}:nlunit-test",
100213
]
101-
}
102214

103-
# Attestation Credentials
104-
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
215+
# OpenThread Settings
216+
if (chip_enable_openthread) {
217+
deps += [
218+
"${chip_root}/third_party/openthread:openthread",
219+
"${chip_root}/third_party/openthread:openthread-platform",
220+
"${examples_plat_dir}:efr-matter-shell",
221+
]
222+
}
105223

106-
# Factory Data Provider
107-
if (use_efr32_factory_data_provider) {
108-
deps += [ "${examples_plat_dir}:silabs-factory-data-provider" ]
109-
}
224+
# Attestation Credentials
225+
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
110226

111-
deps += pw_build_LINK_DEPS
227+
# Factory Data Provider
228+
if (use_efr32_factory_data_provider) {
229+
deps += [ "${examples_plat_dir}:silabs-factory-data-provider" ]
230+
}
112231

113-
include_dirs = [ "${chip_root}/examples/common/pigweed/efr32" ]
232+
deps += pw_build_LINK_DEPS
114233

115-
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
234+
include_dirs = [ "${chip_root}/examples/common/pigweed/efr32" ]
116235

117-
inputs = [ ldscript ]
236+
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
118237

119-
ldflags = [
120-
"-T" + rebase_path(ldscript, root_build_dir),
121-
"-Wl,--no-warn-rwx-segment",
122-
]
238+
inputs = [ ldscript ]
239+
240+
ldflags = [
241+
"-T" + rebase_path(ldscript, root_build_dir),
242+
"-Wl,--no-warn-rwx-segment",
243+
]
244+
245+
output_dir = root_out_dir
246+
}
247+
248+
copy_py_files = false # Don't copy them next time.
249+
250+
_deps += [ ":efr32_device_tests--${_test_suffix}" ]
251+
}
123252

124-
output_dir = root_out_dir
253+
group("efr32_device_tests") {
254+
deps = _deps
125255
}
126256

127257
group("efr32") {
128-
deps = [ ":efr32_device_tests" ]
258+
deps = [ ":efr32_device_tests" ] #++++ Should we get rid of "efr32_device_tests" and move its contents here?
129259
}
130260

131261
group("runner") {
132262
deps = [
133263
"${efr32_project_dir}/py:pw_test_runner.install",
134264
"${efr32_project_dir}/py:pw_test_runner_wheel",
135265
# TODO [PW_MIGRATION]: remove the following when transition from nlunit-test is complete.
136-
"${efr32_project_dir}/py:nl_test_runner.install",
137-
"${efr32_project_dir}/py:nl_test_runner_wheel",
266+
#++++"${efr32_project_dir}/py:nl_test_runner.install",
267+
#++++"${efr32_project_dir}/py:nl_test_runner_wheel",
138268
]
139269
}
140270

src/test_driver/efr32/args.gni

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ chip_enable_pw_rpc = true
2424
chip_build_tests = true
2525
chip_enable_openthread = true
2626
chip_openthread_ftd = false # use mtd as it is smaller.
27-
chip_monolithic_tests = true
27+
28+
chip_monolithic_tests = true #++++
2829

2930
openthread_external_platform =
3031
"${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32"

third_party/silabs/silabs_executable.gni

+9-5
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ template("silabs_executable") {
6161
flashing_image_name = output_base_name + ".rps"
6262
}
6363

64-
flashing_runtime_target = target_name + ".flashing_runtime"
6564
flashing_script_inputs = [
6665
"${chip_root}/scripts/flashing/silabs_firmware_utils.py",
6766
"${chip_root}/scripts/flashing/firmware_utils.py",
6867
]
69-
copy(flashing_runtime_target) {
70-
sources = flashing_script_inputs
71-
outputs = [ "${root_out_dir}/{{source_file_part}}" ]
68+
if (defined(invoker.copy_py_files) && invoker.copy_py_files) { #++++ added this
69+
flashing_runtime_target = target_name + ".flashing_runtime"
70+
copy(flashing_runtime_target) {
71+
sources = flashing_script_inputs
72+
outputs = [ "${root_out_dir}/{{source_file_part}}" ]
73+
}
7274
}
7375

7476
flashing_script_generator =
@@ -80,7 +82,9 @@ template("silabs_executable") {
8082
flashbundle_name = "${target_name}.flashbundle.txt"
8183
flashable_executable(flash_target_name) {
8284
forward_variables_from(invoker, "*")
83-
data_deps = [ ":${flashing_runtime_target}" ]
85+
if (defined(invoker.copy_py_files) && invoker.copy_py_files) { #++++ added this
86+
data_deps = [ ":${flashing_runtime_target}" ]
87+
}
8488
}
8589

8690
# Add a target which generates the hex file in addition to s37.

0 commit comments

Comments
 (0)