-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Add tests for the 'robot2' framework
These tests works only this branch: https://github.com/tiacsys/zephyr/tree/snks/robot-twister-int See also: zephyrproject-rtos/zephyr#64825 Signed-off-by: Kerstin Jenett <[email protected]>
- Loading branch information
Showing
10 changed files
with
433 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2021-2023 TiaC Systems | ||
# Copyright (c) 2019-2021 Li-Pro.Net | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
# Standard Bridle application boilerplate, includes Zephyr. | ||
find_package(Bridle REQUIRED HINTS $ENV{BRIDLE_BASE}) | ||
project("Robot Test" VERSION 0.1) | ||
|
||
assert(CONFIG_SHELL "Zephyr's embedded shell must be enabled") | ||
|
||
# Add your source file to the "app" target. This must come after | ||
# the boilerplate code, which defines the target. | ||
target_sources(app PRIVATE src/main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.. _robot_framework: | ||
|
||
Robot Framework | ||
############### | ||
|
||
Overview | ||
******** | ||
|
||
A sample how you can use the Robot Framework without Renode to run | ||
tests on a development board. | ||
|
||
Requirements | ||
************ | ||
|
||
* Checkout the branch "snks/robot-twister-int" from the Zephyr | ||
repository in case it is not merged into main. | ||
|
||
https://github.com/tiacsys/zephyr/tree/snks/robot-twister-int | ||
* Install the Robot Framework using pip: | ||
|
||
.. code-block:: console | ||
pip install robotframework | ||
* One of the following development boards: | ||
|
||
* :ref:`zephyr:nucleo_f303re_board` (NUCLEO-F303RE) | ||
* :ref:`zephyr:nucleo_f401re_board` (NUCLEO-F401RE) | ||
* :ref:`zephyr:mimxrt1060_evk` | ||
|
||
Building and Running | ||
******************** | ||
|
||
* On :ref:`zephyr:nucleo_f303re_board` board run the following command: | ||
|
||
.. code-block:: console | ||
west twister --verbose --inline-logs --platform nucleo_f303re \ | ||
--testsuite-root bridle/samples/robot2 \ | ||
--device-testing --device-serial /dev/ttyACM0 | ||
* On :ref:`zephyr:nucleo_f401re_board` board run the following command: | ||
|
||
.. code-block:: console | ||
west twister --verbose --inline-logs --platform nucleo_f401re \ | ||
--testsuite-root bridle/samples/robot2 \ | ||
--device-testing --device-serial /dev/ttyACM0 | ||
* On :ref:`zephyr:mimxrt1060_evk` or MIMXRT1060_EVKB board run the | ||
following command: | ||
|
||
.. code-block:: console | ||
west twister --verbose --inline-logs --west-flash --west-runner=pyocd \ | ||
--platform mimxrt1060_evkb --testsuite-root bridle/samples/robot2 \ | ||
--device-testing --device-serial /dev/ttyACM0 | ||
Sample output | ||
============= | ||
|
||
The log, report and output files from the Robot Framework can be found | ||
in the 'twister_out' folder, e.g: | ||
|
||
.. code-block:: console | ||
ls twister-out/*2023* | ||
twister-out/log*.html | ||
twister-out/output*.xml | ||
twister-out/report*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2021-2023 TiaC Systems | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* disable unsupported components or components with issues | ||
* | ||
*/ | ||
|
||
/* FLEXPWM not routed to LED on this EVK revision, thus why board DTS | ||
* disables &flexpwm2_pwm3 but neither related &pwmleds node nor alias. */ | ||
|
||
/ { | ||
aliases { | ||
/delete-property/ pwm-led0; | ||
}; | ||
|
||
/delete-node/ pwmleds; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2021-2023 TiaC Systems | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* disable unsupported components or components with issues | ||
* | ||
*/ | ||
|
||
/* FLEXPWM not routed to LED on this EVK revision, thus why board DTS | ||
* disables &flexpwm2_pwm3 but neither related &pwmleds node nor alias. */ | ||
|
||
/ { | ||
aliases { | ||
/delete-property/ pwm-led0; | ||
}; | ||
|
||
/delete-node/ pwmleds; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) 2021-2023 TiaC Systems | ||
# Copyright (c) 2019-2021 Li-Pro.Net | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Multi-threaded, with timer support in the kernel | ||
CONFIG_MULTITHREADING=y | ||
CONFIG_NUM_COOP_PRIORITIES=16 | ||
CONFIG_NUM_METAIRQ_PRIORITIES=0 | ||
|
||
CONFIG_ERRNO=y | ||
CONFIG_SCHED_DUMB=y | ||
CONFIG_WAITQ_DUMB=y | ||
|
||
# shell with log, kernel, and device commands | ||
CONFIG_BOOT_BANNER=y | ||
CONFIG_PRINTK=y | ||
CONFIG_SHELL=y | ||
CONFIG_LOG=y | ||
CONFIG_KERNEL_SHELL=y | ||
CONFIG_INIT_STACKS=y | ||
CONFIG_THREAD_MONITOR=y | ||
CONFIG_THREAD_NAME=y | ||
CONFIG_THREAD_STACK_INFO=y | ||
CONFIG_DEVICE_SHELL=y | ||
|
||
# shell with hwinfo, regulator, and counter commands | ||
CONFIG_HWINFO=y | ||
CONFIG_HWINFO_SHELL=y | ||
CONFIG_REGULATOR=y | ||
CONFIG_REGULATOR_SHELL=y | ||
CONFIG_COUNTER=y | ||
CONFIG_COUNTER_SHELL=y | ||
|
||
# shell with flash, led, and sensor commands | ||
CONFIG_FLASH=y | ||
CONFIG_FLASH_SHELL=y | ||
CONFIG_LED=y | ||
CONFIG_LED_SHELL=y | ||
CONFIG_SENSOR=y | ||
CONFIG_SENSOR_INFO=y | ||
CONFIG_SENSOR_SHELL=y | ||
|
||
# shell with adc, dac, pwm, gpio, and i2c commands | ||
CONFIG_ADC=y | ||
CONFIG_ADC_SHELL=y | ||
CONFIG_DAC=y | ||
CONFIG_DAC_SHELL=y | ||
CONFIG_PWM=y | ||
CONFIG_PWM_SHELL=y | ||
CONFIG_GPIO=y | ||
CONFIG_GPIO_SHELL=y | ||
CONFIG_I2C=y | ||
CONFIG_I2C_SHELL=y | ||
|
||
# Bridle secific configuration | ||
CONFIG_BRIDLE_COMMANDS=y | ||
CONFIG_BRIDLE_CMD_HELLO=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
*** Settings *** | ||
Documentation This robot example runs some commands on the connected board | ||
... (e.g.nucleo_f303re, nucleo_f401re, mimxrt1060_evkb). It uses | ||
... the space separated plain text format. | ||
Library twister_harness.robot_framework.ZephyrLibrary | ||
Suite Setup Get a Device | ||
Suite Teardown Close Device | ||
|
||
*** Variables *** | ||
${CMD_LED_ON} led on leds 0 | ||
${LED_0} 0 | ||
|
||
*** Test Cases *** | ||
Should Set Led On | ||
[Documentation] Test that the led can be switched on. | ||
[Tags] SWRQT-LED_RQT SYSRQT-LED_SYSTEM_RQT | ||
Run Device | ||
Run Command ${CMD_LED_ON} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
*** Settings *** | ||
Documentation This robot example runs some commands on the connected board | ||
... (e.g.nucleo_f303re, nucleo_f401re, mimxrt1060_evkb). It uses | ||
... the space separated plain text format. | ||
Library twister_harness.robot_framework.ZephyrLibrary | ||
Suite Setup Get a Device | ||
Suite Teardown Close Device | ||
|
||
*** Variables *** | ||
${CMD_KERNEL_VERSION} kernel version | ||
${RSP_ZEPHYR_VERSION} Zephyr version 3.5.99 | ||
${CMD_DEVICE_LIST} device list | ||
${RSP_I2C_0005400} i2c@40005400 (READY) | ||
${CMD_SCAN_I2C} i2c scan i2c@40005400 | ||
${RSP_SCAN_I2C} devices found on i2c@40005400 | ||
|
||
*** Test Cases *** | ||
Should Read Version | ||
[Documentation] Test that the Zephyr version is correct. | ||
... ${RSP_ZEPHYR_VERSION} | ||
[Tags] SWRQT-VERSION_RQT SWRQT-OTHER_RQT SYSRQT-VERSION_SYSTEM_RQT | ||
Run Device | ||
Run Command ${CMD_KERNEL_VERSION} | ||
|
||
Check I2C Interface | ||
[Documentation] Test that the I2C bus is configured. | ||
... ${RSP_I2C_0005400} | ||
[Tags] SWRQT-I2C_RQT SYSRQT-I2C_SYSTEM_RQT | ||
Run Command ${CMD_DEVICE_LIST} | ||
Run Command ${CMD_SCAN_I2C} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
sample: | ||
description: Robot Framework sample to test uart and led on a device | ||
name: robot2 tests | ||
common: | ||
tags: introduction | ||
integration_platforms: | ||
- nucleo_f303re | ||
- nucleo_f401re | ||
- mimxrt1060_evkb | ||
tests: | ||
bridle.samples.robot2: | ||
harness: robot2 | ||
platform_allow: | ||
- nucleo_f401re | ||
- mimxrt1060_evkb | ||
timeout: 300 | ||
tags: | ||
- test_framework | ||
- robot | ||
- shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright (c) 2021-2023 TiaC Systems | ||
* Copyright (c) 2019-2021 Li-Pro.Net | ||
* Copyright (c) 2012-2014 Wind River Systems, Inc. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/init.h> | ||
|
||
/* Empty main */ | ||
int main(void) {return 0;} |
Oops, something went wrong.