Skip to content

Commit

Permalink
Merge branch 'master' into refactor/spi-multiplex-rs91x-ncp
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs authored Oct 10, 2023
2 parents 5966818 + c534070 commit 65ee0e4
Show file tree
Hide file tree
Showing 148 changed files with 128,187 additions and 505,665 deletions.
11 changes: 11 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ default_args = {

# GN target to use for the default Python build venv.
pw_build_PYTHON_BUILD_VENV = "//:matter_build_venv"

# Required for pw_unit_test
pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio"
pw_assert_BACKEND = "$dir_pw_assert_log"
pw_log_BACKEND = "$dir_pw_log_basic"

# TODO: Make sure only unit tests link against this
pw_build_LINK_DEPS = [
"$dir_pw_assert:impl",
"$dir_pw_log:impl",
]
}
6 changes: 3 additions & 3 deletions build/chip/chip_test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ if (chip_link_tests) {
output_dir = _test_output_dir
}

group(_test_name + "_lib") {
group(_test_name + ".lib") {
}

if (chip_pw_run_tests) {
pw_python_action(_test_name + "_run") {
pw_python_action(_test_name + ".run") {
deps = [ ":${_test_name}" ]
inputs = [ pw_unit_test_AUTOMATIC_RUNNER ]
module = "pw_unit_test.test_runner"
Expand All @@ -64,7 +64,7 @@ if (chip_link_tests) {
template("chip_test") {
group(target_name) {
}
group(target_name + "_lib") {
group(target_name + ".lib") {
}
not_needed(invoker, "*")
}
Expand Down
4 changes: 2 additions & 2 deletions build/chip/chip_test_group.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template("chip_test_group") {
_target_type = "group"
}

_lib_target_name = "${_test_group_name}_lib"
_lib_target_name = "${_test_group_name}.lib"

target(_target_type, _lib_target_name) {
forward_variables_from(invoker,
Expand All @@ -43,7 +43,7 @@ template("chip_test_group") {

deps = []
foreach(_test, invoker.deps) {
deps += [ get_label_info(_test, "label_no_toolchain") + "_lib" ]
deps += [ get_label_info(_test, "label_no_toolchain") + ".lib" ]
}

if (_build_monolithic_library && chip_build_test_static_libraries) {
Expand Down
109 changes: 102 additions & 7 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ template("chip_test_suite") {
} else {
_target_type = "source_set"
}
target(_target_type, "${_suite_name}_lib") {
target(_target_type, "${_suite_name}.lib") {
forward_variables_from(invoker, "*", [ "tests" ])

output_dir = "${root_out_dir}/lib"
Expand All @@ -99,7 +99,104 @@ template("chip_test_suite") {
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
}
}
if (chip_link_tests) {
tests = []

if (defined(invoker.test_sources)) {
foreach(_test, invoker.test_sources) {
_test_name = string_replace(_test, ".cpp", "")

pw_test(_test_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"cflags",
"configs",
])
public_deps += [ ":${_suite_name}.lib" ]
sources = [ _test ]
}
tests += [ _test_name ]
}
}

if (defined(invoker.tests)) {
foreach(_test, invoker.tests) {
pw_test(_test) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"cflags",
"configs",
])
public_deps += [ ":${_suite_name}.lib" ]
test_main = ""
sources = [
"${_test}.cpp",
"${_test}Driver.cpp",
]
}
tests += [ _test ]
}
}

group(_suite_name) {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}" ]
}
}

if (chip_pw_run_tests) {
group("${_suite_name}_run") {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}.run" ]
}
}
}
} else {
group(_suite_name) {
deps = [ ":${_suite_name}.lib" ]
}
}
}

# TODO: remove this once transition away from nlunit-test is completed
template("chip_test_suite_using_nltest") {
_suite_name = target_name

# Ensures that the common library has sources containing both common
# and individual unit tests.
if (!defined(invoker.sources)) {
invoker.sources = []
}

if (defined(invoker.test_sources)) {
invoker.sources += invoker.test_sources
}

if (chip_build_test_static_libraries) {
_target_type = "static_library"
} else {
_target_type = "source_set"
}
target(_target_type, "${_suite_name}.lib") {
forward_variables_from(invoker, "*", [ "tests" ])

output_dir = "${root_out_dir}/lib"

if (!defined(invoker.public_deps)) {
public_deps = []
}

if (current_os != "zephyr" && current_os != "mbed") {
# Depend on stdio logging, and have it take precedence over the default platform backend
public_deps += [ "${chip_root}/src/platform/logging:force_stdio" ]
}
}
if (chip_link_tests) {
tests = []

Expand All @@ -123,11 +220,10 @@ template("chip_test_suite") {
chip_test(_test_name) {
sources = [ _driver_name ]
public_deps = [
":${_suite_name}_lib",
":${_suite_name}.lib",
":${_test_name}_generate_driver",
]
}

tests += [ _test_name ]
}
}
Expand All @@ -137,9 +233,8 @@ template("chip_test_suite") {
chip_test(_test) {
sources = [ "${_test}Driver.cpp" ]

public_deps = [ ":${_suite_name}_lib" ]
public_deps = [ ":${_suite_name}.lib" ]
}

tests += [ _test ]
}
}
Expand All @@ -155,13 +250,13 @@ template("chip_test_suite") {
group("${_suite_name}_run") {
deps = []
foreach(_test, tests) {
deps += [ ":${_test}_run" ]
deps += [ ":${_test}.run" ]
}
}
}
} else {
group(_suite_name) {
deps = [ ":${_suite_name}_lib" ]
deps = [ ":${_suite_name}.lib" ]
}
}
}
1 change: 0 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ config("strict_warnings") {
# to be more fine-grained than current_os, but it's not clear that
# we can access that here.
if (current_os != "freertos" && current_os != "mbed" &&
current_os != "zephyr" &&
# cmsis-rtos is OpenIOT
current_os != "cmsis-rtos" &&
# cyw30739 is one of the Infineon builds
Expand Down
Loading

0 comments on commit 65ee0e4

Please sign in to comment.