diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index 2d5b69c1b8d4ce..653bc0515d55d8 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -82,11 +82,14 @@ pw_source_set("system_rpc_server") { sources = [ "system_rpc_server.cc" ] deps = [ + "$dir_pw_rpc/system_server:facade", + dir_pw_log, + ] + + public_deps = [ "$dir_pw_hdlc:pw_rpc", "$dir_pw_hdlc:rpc_channel_output", - "$dir_pw_rpc/system_server:facade", "$dir_pw_stream:sys_io_stream", - dir_pw_log, ] public_configs = [ ":default_config" ] diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 62aad0dfaa2964..1e45d762440c8b 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -35,7 +35,7 @@ steps: args: - >- ./scripts/build/build_examples.py --enable-flashbundle - --target-glob '*-nrf52840-{lock,light}' build --create-archives + --target-glob '*-nrf52840-{lock,light}*' build --create-archives /workspace/artifacts/ waitFor: - Bootstrap @@ -52,8 +52,8 @@ steps: args: - >- ./scripts/build/build_examples.py --enable-flashbundle - --target-glob '*-brd4161a-{lock,light}' build --create-archives - /workspace/artifacts/ + --target-glob '*-brd4161a-{lock,light,unit-test}*' build + --create-archives /workspace/artifacts/ waitFor: - Bootstrap - NRFConnect diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index da3a2a830821f7..bfe09d3128103c 100644 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -144,6 +144,7 @@ def Efr32Targets(): yield efr_target.Extend('window-covering', app=Efr32App.WINDOW_COVERING) yield efr_target.Extend('lock', app=Efr32App.LOCK) + yield efr_target.Extend('unit-test', app=Efr32App.UNIT_TEST) rpc_aware_targets = [ efr_target.Extend('light', app=Efr32App.LIGHT), diff --git a/scripts/build/builders/efr32.py b/scripts/build/builders/efr32.py index 41c4acb54369c5..4f90419291bb6c 100644 --- a/scripts/build/builders/efr32.py +++ b/scripts/build/builders/efr32.py @@ -22,6 +22,7 @@ class Efr32App(Enum): LIGHT = auto() LOCK = auto() WINDOW_COVERING = auto() + UNIT_TEST = auto() def ExampleName(self): if self == Efr32App.LIGHT: @@ -40,6 +41,8 @@ def AppNamePrefix(self): return 'chip-efr32-lock-example' elif self == Efr32App.WINDOW_COVERING: return 'chip-efr32-window-example' + elif self == Efr32App.UNIT_TEST: + return 'chip-efr32-device_tests' else: raise Exception('Unknown app type: %r' % self) @@ -50,9 +53,17 @@ def FlashBundleName(self): return 'lock_app.flashbundle.txt' elif self == Efr32App.WINDOW_COVERING: return 'window_app.flashbundle.txt' + elif self == Efr32App.UNIT_TEST: + return 'efr32_device_tests.flashbundle.txt' else: raise Exception('Unknown app type: %r' % self) + def BuildRoot(self, root): + if self == Efr32App.UNIT_TEST: + return os.path.join(root, 'src', 'test_driver', 'efr32') + else: + return os.path.join(root, 'examples', self.ExampleName(), 'efr32') + class Efr32Board(Enum): BRD4161A = 1 @@ -71,7 +82,7 @@ def __init__(self, board: Efr32Board = Efr32Board.BRD4161A, enable_rpcs: bool = False): super(Efr32Builder, self).__init__( - root=os.path.join(root, 'examples', app.ExampleName(), 'efr32'), + root=app.BuildRoot(root), runner=runner) self.app = app self.board = board @@ -93,6 +104,11 @@ def build_outputs(self): '%s.out.map' % self.app.AppNamePrefix()), } + if self.app == Efr32App.UNIT_TEST: + # Include test runner python wheels + items["chip_nl_test_runner_wheels"] = os.path.join( + self.output_dir, 'chip_nl_test_runner_wheels') + # Figure out flash bundle files and build accordingly with open(os.path.join(self.output_dir, self.app.FlashBundleName())) as f: for line in f.readlines(): diff --git a/scripts/build/testdata/all_targets_except_host.txt b/scripts/build/testdata/all_targets_except_host.txt index 7324824301a35d..62abd8211112f8 100644 --- a/scripts/build/testdata/all_targets_except_host.txt +++ b/scripts/build/testdata/all_targets_except_host.txt @@ -12,6 +12,7 @@ android-x86-chip-tool efr32-brd4161a-light efr32-brd4161a-light-rpc efr32-brd4161a-lock +efr32-brd4161a-unit-test efr32-brd4161a-window-covering esp32-c3devkit-all-clusters esp32-devkitc-all-clusters diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index f928f42467e56f..bea6e68bc04ed8 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -133,6 +133,9 @@ gn gen --check --fail-on-unused-args --root={root}/examples/lighting-app/efr32 ' # Generating efr32-brd4161a-lock gn gen --check --fail-on-unused-args --root={root}/examples/lock-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-lock +# Generating efr32-brd4161a-unit-test +gn gen --check --fail-on-unused-args --root={root}/src/test_driver/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-unit-test + # Generating efr32-brd4161a-window-covering gn gen --check --fail-on-unused-args --root={root}/examples/window-app/efr32 '--args=efr32_board="BRD4161A"' {out}/efr32-brd4161a-window-covering @@ -606,6 +609,9 @@ ninja -C {out}/efr32-brd4161a-light-rpc # Building efr32-brd4161a-lock ninja -C {out}/efr32-brd4161a-lock +# Building efr32-brd4161a-unit-test +ninja -C {out}/efr32-brd4161a-unit-test + # Building efr32-brd4161a-window-covering ninja -C {out}/efr32-brd4161a-window-covering diff --git a/scripts/build/testdata/glob_star_targets_except_host.txt b/scripts/build/testdata/glob_star_targets_except_host.txt index 8ef68760e5175e..a78108879d08eb 100644 --- a/scripts/build/testdata/glob_star_targets_except_host.txt +++ b/scripts/build/testdata/glob_star_targets_except_host.txt @@ -12,6 +12,7 @@ android-x86-chip-tool efr32-brd4161a-light efr32-brd4161a-light-rpc efr32-brd4161a-lock +efr32-brd4161a-unit-test efr32-brd4161a-window-covering esp32-c3devkit-all-clusters esp32-devkitc-all-clusters diff --git a/src/BUILD.gn b/src/BUILD.gn index 3c226c5fdb61de..79e18e0afc490a 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -45,7 +45,6 @@ if (chip_build_tests) { chip_test_group("tests") { deps = [ "${chip_root}/src/access/tests", - "${chip_root}/src/app/tests", "${chip_root}/src/crypto/tests", "${chip_root}/src/inet/tests", "${chip_root}/src/lib/asn1/tests", @@ -74,6 +73,8 @@ if (chip_build_tests) { if (chip_device_platform != "efr32") { deps += [ + # TODO(#10447): App test has HF on EFR32. + "${chip_root}/src/app/tests", "${chip_root}/src/credentials/tests", "${chip_root}/src/lib/support/tests", "${chip_root}/src/protocols/secure_channel/tests", @@ -97,7 +98,9 @@ if (chip_build_tests) { # On nrfconnect, the controller tests run into # https://github.com/project-chip/connectedhomeip/issues/9630 - if (chip_device_platform != "nrfconnect") { + if (chip_device_platform != "nrfconnect" && + chip_device_platform != "efr32") { + # TODO(#10447): Controller test has HF on EFR32. deps += [ "${chip_root}/src/controller/tests" ] } diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 4d88360a527865..1cb62b6cc93d83 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -45,24 +45,19 @@ chip_test_suite("tests") { "TestBuilderParser.cpp", "TestCHIPDeviceCallbacksMgr.cpp", "TestClusterInfo.cpp", + "TestCommandInteraction.cpp", "TestCommandPathParams.cpp", "TestDataModelSerialization.cpp", "TestEventLogging.cpp", "TestEventPathParams.cpp", "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", + "TestReadInteraction.cpp", + "TestReportingEngine.cpp", "TestStatusResponseMessage.cpp", + "TestWriteInteraction.cpp", ] - if (chip_device_platform != "efr32") { - test_sources += [ - "TestCommandInteraction.cpp", - "TestReadInteraction.cpp", - "TestReportingEngine.cpp", - "TestWriteInteraction.cpp", - ] - } - cflags = [ "-Wconversion" ] public_deps = [ diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index ce1852d03251de..bfc6ce28bd33b9 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -45,9 +45,13 @@ chip_test_suite("tests") { sources = [ "TestExchangeMgr.cpp", "TestMessagingLayer.h", - "TestReliableMessageProtocol.cpp", ] + if (chip_device_platform != "efr32") { + # TODO(#10447): Test has HF on EFR32. + sources += [ "TestReliableMessageProtocol.cpp" ] + } + cflags = [ "-Wconversion" ] public_deps = [ diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index c333614c482cfd..d5bb25ff017f49 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -105,6 +105,7 @@ group("efr32") { deps = [ ":efr32_device_tests", "${efr32_project_dir}/py:nl_test_runner.install", + "${efr32_project_dir}/py:nl_test_runner_wheel", ] } diff --git a/src/test_driver/efr32/py/BUILD.gn b/src/test_driver/efr32/py/BUILD.gn index c4d0dd0610ad61..539d56d062fe25 100644 --- a/src/test_driver/efr32/py/BUILD.gn +++ b/src/test_driver/efr32/py/BUILD.gn @@ -33,3 +33,9 @@ pw_python_package("nl_test_runner") { "${chip_root}/src/test_driver/efr32:nl_test_service.python", ] } + +pw_mirror_tree("nl_test_runner_wheel") { + path_data_keys = [ "pw_python_package_wheels" ] + deps = [ ":nl_test_runner.wheel" ] + directory = "$root_out_dir/chip_nl_test_runner_wheels" +} diff --git a/src/test_driver/efr32/py/nl_test_runner/nl_test_runner.py b/src/test_driver/efr32/py/nl_test_runner/nl_test_runner.py index 1f4e5bd3f9eef0..492fc3fa8ecf22 100644 --- a/src/test_driver/efr32/py/nl_test_runner/nl_test_runner.py +++ b/src/test_driver/efr32/py/nl_test_runner/nl_test_runner.py @@ -89,15 +89,15 @@ def read(): return serial_device.read(8192) def runner(client) -> int: """ Run the tests""" - status, result = client.client.channel( - 1).rpcs.chip.rpc.NlTest.Run(pw_rpc_timeout_s=120) - - if not status.ok(): + def on_error_callback(call_object, error): raise Exception("Error running test RPC: {}".format(status)) + rpc = client.client.channel(1).rpcs.chip.rpc.NlTest.Run + invoke = rpc.invoke(rpc.request(), on_error=on_error_callback) + total_failed = 0 total_run = 0 - for streamed_data in result: + for streamed_data in invoke.get_responses(): if streamed_data.HasField("test_suite_start"): print("\n{}".format( colors.HEADER + streamed_data.test_suite_start.suite_name) + colors.ENDC)