From 58758abd673b32d99f209005774ae5edd48568ef Mon Sep 17 00:00:00 2001 From: Jeff Feasel Date: Wed, 18 Dec 2024 18:18:04 +0000 Subject: [PATCH 1/5] Updating unit test runner script for EFR32 and associated documentation. --- src/test_driver/efr32/README.md | 99 +++++-------------- .../efr32/py/pw_test_runner/pw_test_runner.py | 3 +- 2 files changed, 23 insertions(+), 79 deletions(-) diff --git a/src/test_driver/efr32/README.md b/src/test_driver/efr32/README.md index c846426890abaa..e854619f6610f5 100644 --- a/src/test_driver/efr32/README.md +++ b/src/test_driver/efr32/README.md @@ -1,30 +1,17 @@ -#CHIP EFR32 Test Driver +This is a test driver for the Matter unit tests to be run on an EFR32 device. +It builds a set of test binaries, each of which contains one directory of unit tests +that can be flashed onto a device and run. The device is controlled using the included +RPCs through the python test runner. -This builds and runs the unit tests on the efr32 device. +- [Prerequisites](#prerequisites) +- [Building The Unit Tests](#building-the-unit-tests) +- [Running The Unit Tests](#running-the-unit-tests) -
- -- [Introduction](#introduction) -- [Building](#building) -- [Running The Tests](#running-the-tests) - -
- - - -## Introduction - -This builds a set of test binaries which contain the unit tests and can be -flashed onto a device. The device is controlled using the included RPCs, through -the python test runner. - - - -## Building +## Prerequisites - Download the [Simplicity Commander](https://www.silabs.com/mcu/programming-options) - command line tool, and ensure that `commander` is your shell search path. + command line tool, and ensure that `commander` is in your shell search path. (For Mac OS X, `commander` is located inside `Commander.app/Contents/MacOS/`.) @@ -32,11 +19,11 @@ the python test runner. bootstrap already installs the toolchain): [GNU Arm Embedded Toolchain 12.2 Rel1](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) -- Install some additional tools(likely already present for CHIP developers): +- Install some additional tools: -#Linux `sudo apt-get install git libwebkitgtk-1.0-0 ninja-build` + For Linux: `sudo apt-get install git libwebkitgtk-1.0-0 ninja-build` -#Mac OS X `brew install ninja` + For Mac OS: `brew install ninja` - Supported hardware: @@ -49,60 +36,18 @@ the python test runner. - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm -OR use GN/Ninja directly - - ``` - cd ~/connectedhomeip/src/test_driver/efr32/ - git submodule update --init - source third_party/connectedhomeip/scripts/activate.sh - export SILABS_BOARD=BRD4187C - gn gen out/debug - ninja -C out/debug - ``` - -- To delete generated executable, libraries and object files use: - - ``` - cd ~/connectedhomeip/src/test_driver/efr32/ - rm -rf out/ - ``` +## Building The Unit Tests - +The unit tests can be built using gn and ninja: -## Running The Tests - -Build the runner using gn: - - ``` - cd /src/test_driver/efr32 + source scripts/activate.sh + cd src/test_driver/efr32 + export SILABS_BOARD=BRD2703A gn gen out/debug - ninja -C out/debug runner - ``` - -Or build using build script from the root - - ``` - cd - ./scripts/build/build_examples.py --target linux-x64-pw-test-runner build - ``` - -The runner will be installed into the venv and python wheels will be packaged in -the output folder for deploying. - -Then the python wheels need to installed using pip3. - - ``` - pip3 install out/debug/chip_pw_test_runner_wheels/*.whl - ``` - -Other python libraries may need to be installed such as - - ``` - pip3 install pyserial - ``` + ninja -C out/debug -- To run all tests: +## Running The Unit Tests - ``` - python -m pw_test_runner.pw_test_runner -d /dev/ttyACM1 -f out/debug/matter-silabs-device_tests.s37 -o out.log - ``` +The unit tests can be run using the test runner python script: + + python py/pw_test_runner/pw_test_runner.py -d /dev/ttyACM1 -f out/debug/tests -o out.log diff --git a/src/test_driver/efr32/py/pw_test_runner/pw_test_runner.py b/src/test_driver/efr32/py/pw_test_runner/pw_test_runner.py index 8e10903920cc77..ed8c43f0190623 100644 --- a/src/test_driver/efr32/py/pw_test_runner/pw_test_runner.py +++ b/src/test_driver/efr32/py/pw_test_runner/pw_test_runner.py @@ -105,8 +105,7 @@ def run(args) -> int: def list_images(flash_directory: str) -> list[str]: - filenames: list[str] = glob.glob(os.path.join(flash_directory, "*.s37")) - return list(map(lambda x: os.path.join(flash_directory, x), filenames)) + return glob.glob(os.path.join(flash_directory, "*.s37")) def main() -> int: From 0ed7d80d1de9812cec94fff7cbe186de552442b6 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 18 Dec 2024 18:22:04 +0000 Subject: [PATCH 2/5] Restyled by prettier-markdown --- src/test_driver/efr32/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test_driver/efr32/README.md b/src/test_driver/efr32/README.md index e854619f6610f5..d127643a0ec0e3 100644 --- a/src/test_driver/efr32/README.md +++ b/src/test_driver/efr32/README.md @@ -1,7 +1,7 @@ -This is a test driver for the Matter unit tests to be run on an EFR32 device. -It builds a set of test binaries, each of which contains one directory of unit tests -that can be flashed onto a device and run. The device is controlled using the included -RPCs through the python test runner. +This is a test driver for the Matter unit tests to be run on an EFR32 device. It +builds a set of test binaries, each of which contains one directory of unit +tests that can be flashed onto a device and run. The device is controlled using +the included RPCs through the python test runner. - [Prerequisites](#prerequisites) - [Building The Unit Tests](#building-the-unit-tests) @@ -48,6 +48,6 @@ The unit tests can be built using gn and ninja: ## Running The Unit Tests -The unit tests can be run using the test runner python script: - - python py/pw_test_runner/pw_test_runner.py -d /dev/ttyACM1 -f out/debug/tests -o out.log +The unit tests can be run using the test runner python script: + python py/pw_test_runner/pw_test_runner.py -d /dev/ttyACM1 -f out/debug/tests -o +out.log From ef74dc91a5f47a13671ce7c2e670ad1351de487b Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 18 Dec 2024 18:35:29 +0000 Subject: [PATCH 3/5] Restyled by prettier-markdown --- src/test_driver/efr32/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test_driver/efr32/README.md b/src/test_driver/efr32/README.md index d127643a0ec0e3..d28fe6f2dcc3eb 100644 --- a/src/test_driver/efr32/README.md +++ b/src/test_driver/efr32/README.md @@ -48,6 +48,6 @@ The unit tests can be built using gn and ninja: ## Running The Unit Tests -The unit tests can be run using the test runner python script: +The unit tests can be run using the test runner python script: python py/pw_test_runner/pw_test_runner.py -d /dev/ttyACM1 -f out/debug/tests -o out.log From 1af181267b8b1e6f346030ac43c1de94ebbf3d39 Mon Sep 17 00:00:00 2001 From: Jeff Feasel Date: Thu, 19 Dec 2024 02:20:38 +0000 Subject: [PATCH 4/5] Readme updates --- src/test_driver/efr32/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/test_driver/efr32/README.md b/src/test_driver/efr32/README.md index d28fe6f2dcc3eb..6b2008fcc4ded5 100644 --- a/src/test_driver/efr32/README.md +++ b/src/test_driver/efr32/README.md @@ -46,8 +46,15 @@ The unit tests can be built using gn and ninja: gn gen out/debug ninja -C out/debug +## Building and Installing the Runner + +The python wheels for the runner can be built and installed like this: + + ninja -C out/debug runner + pip3 install out/debug/chip_pw_test_runner_wheels/*.whl --force-reinstall + ## Running The Unit Tests -The unit tests can be run using the test runner python script: - python py/pw_test_runner/pw_test_runner.py -d /dev/ttyACM1 -f out/debug/tests -o -out.log +The unit tests can be run using the test runner python script: + + python -m py.pw_test_runner.pw_test_runner -d /dev/ttyACM1 -f out/debug/tests -o out.log From 8fb9f100c0554ddbb7116651662eefffd7c54be0 Mon Sep 17 00:00:00 2001 From: Jeff Feasel Date: Thu, 19 Dec 2024 02:23:27 +0000 Subject: [PATCH 5/5] Readme updates --- src/test_driver/efr32/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test_driver/efr32/README.md b/src/test_driver/efr32/README.md index 6b2008fcc4ded5..b2f9a527fa05c4 100644 --- a/src/test_driver/efr32/README.md +++ b/src/test_driver/efr32/README.md @@ -4,8 +4,9 @@ tests that can be flashed onto a device and run. The device is controlled using the included RPCs through the python test runner. - [Prerequisites](#prerequisites) -- [Building The Unit Tests](#building-the-unit-tests) -- [Running The Unit Tests](#running-the-unit-tests) +- [Building the Unit Tests](#building-the-unit-tests) +- [Building and Installing the Runner](#building-and-installing-the-runner) +- [Running the Unit Tests](#running-the-unit-tests) ## Prerequisites @@ -36,7 +37,7 @@ the included RPCs through the python test runner. - BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm - BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm -## Building The Unit Tests +## Building the Unit Tests The unit tests can be built using gn and ninja: @@ -53,7 +54,7 @@ The python wheels for the runner can be built and installed like this: ninja -C out/debug runner pip3 install out/debug/chip_pw_test_runner_wheels/*.whl --force-reinstall -## Running The Unit Tests +## Running the Unit Tests The unit tests can be run using the test runner python script: