Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/fixing_code_bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs authored Sep 5, 2024
2 parents f848468 + 6ade0df commit 5e4dd02
Show file tree
Hide file tree
Showing 368 changed files with 6,366 additions and 4,470 deletions.
6 changes: 4 additions & 2 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ AdvSendAdvert
AE
aef
AES
AFL
AIDL
algs
alloc
Expand Down Expand Up @@ -340,6 +341,7 @@ datamodel
DataModelRevision
dataset
datasets
datastore
DataVersion
dbf
DBG
Expand Down Expand Up @@ -570,6 +572,7 @@ fsync
ftd
fullclean
fuzzer
fuzztest
FW
gbl
gcloud
Expand Down Expand Up @@ -948,8 +951,6 @@ NitricOxideConcentrationMeasurement
NitrogenDioxideConcentrationMeasurement
nl
nltest
NLUnitTest
NLUnitTests
nmcli
nmtui
noc
Expand Down Expand Up @@ -1008,6 +1009,7 @@ optionOverride
optionsMask
optionsOverride
orgs
OSS
OTA
OTADownloader
otaDownloadPath
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,17 @@ jobs:
mkdir objdir-clone || true
- name: Build Python REPL and example apps
# NOTE: the data-mode-check + check-failure-die is not 100% perfect as different
# encoding sizes for data that keeps changing may alter over time (e.g. anything relating to time
# or resources such as packet counts or other similar counters)
#
# This may result in invalid errors, however for most purposes of our testing, we are unlikely to
# hit such cases so we remain very strict on testing here.
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die \
--target linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test \
--target linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test \
Expand All @@ -496,7 +502,7 @@ jobs:
- name: Generate an argument environment file
run: |
echo -n "" >/tmp/test_env.yaml
echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml
echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app" >> /tmp/test_env.yaml
echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml
echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml
echo "LIT_ICD_APP: out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app" >> /tmp/test_env.yaml
Expand All @@ -515,13 +521,14 @@ jobs:
mkdir -p out/trace_data
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/controller/python/test/test_scripts/mobile-device-test.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/execute_python_tests.py --env-file /tmp/test_env.yaml --search-directory src/python_testing'
scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py'
scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py --all-clusters out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test-data-model-check-check-failure-die/chip-all-clusters-app'
scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingDeviceType.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestSpecParsingSupport.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceTest.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceSupport.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestConformanceTest.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestChoiceConformanceSupport.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_IDM_10_4.py'
scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/test_testing/test_TC_SC_7_1.py'
Expand Down
16 changes: 16 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,19 @@
path = third_party/infineon/psoc6/psoc6_sdk/libs/lwip-network-interface-integration
url = https://github.com/Infineon/lwip-network-interface-integration.git
platforms = infineon
[submodule "third_party/abseil-cpp/src"]
path = third_party/abseil-cpp/src
url = https://github.com/abseil/abseil-cpp.git
platforms = linux,darwin
[submodule "third_party/fuzztest"]
path = third_party/fuzztest
url = https://github.com/google/fuzztest.git
platforms = linux,darwin
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest
platforms = linux,darwin
[submodule "third_party/re2/src"]
path = third_party/re2/src
url = https://github.com/google/re2.git
platforms = linux,darwin
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
".gitmodules": "ini",
"*.mm": "cpp",
"iostream": "cpp",
"array": "cpp",
Expand Down Expand Up @@ -138,6 +139,9 @@
"list": "cpp",
"unordered_set": "cpp"
},
"[ini]": {
"editor.formatOnSave": false
},
// Configure paths or glob patterns to exclude from file watching.
"files.watcherExclude": {
"**/.git/objects/**": true,
Expand Down
16 changes: 16 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
}
}

if (pw_enable_fuzz_test_targets) {
group("pw_fuzz_tests") {
deps = [
"${chip_root}/src/credentials/tests:fuzz-chip-cert-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)",
"${chip_root}/src/lib/core/tests:fuzz-tlv-reader-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)",
"${chip_root}/src/lib/dnssd/minimal_mdns/tests:fuzz-minmdns-packet-parsing-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)",
"${chip_root}/src/lib/format/tests:fuzz-payload-decoder-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)",
"${chip_root}/src/setup_payload/tests:fuzz-setup-payload-base38-pw(//build/toolchain/pw_fuzzer:chip_pw_fuzztest)",
]
}
}

# Matter's in-tree pw_python_package or pw_python_distribution targets.
_matter_python_packages = [
"//examples/chef",
Expand Down Expand Up @@ -140,6 +152,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
deps += [ "//:fuzz_tests" ]
}

if (pw_enable_fuzz_test_targets) {
deps += [ "//:pw_fuzz_tests" ]
}

if (chip_device_platform != "none") {
deps += [ "${chip_root}/src/app/server" ]
}
Expand Down
71 changes: 0 additions & 71 deletions build/chip/chip_test.gni

This file was deleted.

101 changes: 42 additions & 59 deletions build/chip/chip_test_suite.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test.gni")
import("${chip_root}/build/chip/tests.gni")
import("${dir_pw_unit_test}/test.gni")

assert(chip_build_tests)

declare_args() {
# These may be overridden in args.gni to build platform-specific test binaries.
test_executable_output_name = ""
test_executable_output_name_suffix = ""
test_executable_ldflags = []
}

# Define CHIP unit tests
#
# Simple usage
Expand All @@ -41,50 +48,34 @@ assert(chip_build_tests)
# "${chip_root}/src/lib/foo", # add dependencies here
# ]
# }
#
#
# Deprecated usage (writing own driver files):
#
# chip_test_suite("tests") {
# output_name = "libFooTests"
#
# sources = [
# "TestDeclarations.h",
# "TestFoo.cpp",
# "TestBar.cpp",
# ]
#
# public_deps = [
# "${chip_root}/src/lib/foo", # add dependencies here
# ]
#
# tests = [
# "TestFoo", # Assumes TestFooDriver.cpp exists
# "TestBar", # Assumes TestBarDriver.cpp exists
# ]
# }

#
template("chip_test_suite") {
_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
exclude_variables = [ "tests" ]
if (chip_link_tests && chip_device_platform != "darwin") {
# Common library shouldn't have all the individual unit tests, only the common sources.
exclude_variables += [ "test_sources" ]
# NOTE: For `Build on Darwin (clang, python_lib, simulated)` the test_sources must be in common lib.
} else {
# Common library should have all the individual unit tests, in addition to the common sources.
if (!defined(invoker.sources)) {
invoker.sources = []
}
if (defined(invoker.test_sources)) {
invoker.sources += invoker.test_sources
}
}

# Target for the common library. Contains all the common sources, and sometimes all the individual 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" ])
forward_variables_from(invoker, "*", exclude_variables)

output_dir = "${root_out_dir}/lib"

Expand All @@ -102,6 +93,8 @@ template("chip_test_suite") {
public_deps += [ "${chip_root}/src/platform/logging:default" ]
}
}

# Build a source_set or a flashable executable for each individual unit test source, which also includes the common files.
if (chip_link_tests) {
tests = []

Expand All @@ -115,50 +108,38 @@ template("chip_test_suite") {
}

pw_test(_test_name) {
# Forward certain variables from the invoker.
forward_variables_from(invoker,
[
"deps",
"public_deps",
"cflags",
"configs",
])

# Link to the common lib for this suite so we get its `sources`.
public_deps += [ ":${_suite_name}.lib" ]
sources = [ _test ]
output_dir = _test_output_dir
}
tests += [ _test_name ]
}
}

if (defined(invoker.tests)) {
foreach(_test, invoker.tests) {
_test_output_dir = "${root_out_dir}/tests"
if (defined(invoker.output_dir)) {
_test_output_dir = invoker.output_dir
}
# Set variables that the platform executable may need.
if (test_executable_output_name != "") {
output_name = test_executable_output_name + _test_name +
test_executable_output_name_suffix
}
ldflags = test_executable_ldflags

# Add the individual test source file (e.g. "TestSomething.cpp").
sources = [ _test ]

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",
]
output_dir = _test_output_dir
}
tests += [ _test ]
tests += [ _test_name ]
}
}

group(_suite_name) {
deps = []

# Add each individual unit test.
foreach(_test, tests) {
deps += [ ":${_test}" ]
}
Expand All @@ -167,6 +148,8 @@ template("chip_test_suite") {
if (chip_pw_run_tests) {
group("${_suite_name}_run") {
deps = []

# Add the .run targets created by pw_test.
foreach(_test, tests) {
deps += [ ":${_test}.run" ]
}
Expand Down
Loading

0 comments on commit 5e4dd02

Please sign in to comment.