Giter VIP home page Giter VIP logo

robotfw-tests's Introduction

RIOT HIL Tests

A suite of applications and scripts to run hardware-in-the-loop (HIL) tests for the RIOT-OS.

Prerequisites

  • RIOT-OS development environment, i.e., compilers and tools
  • Python 3.x and pip3 to run tests
  • Python dependencies, to install:
pip3 install -r dist/robotframework/requirements.txt

Getting started

For the impatient developer or user familiar with RIOT-OS follow these steps for a quick start:

  1. Clone this repository recursively:
git clone --recursive ...
  1. Connect your favourite board
  2. From the root folder of this repository run
BOARD=<name> make -C tests/xtimer_cli flash robot-test

Further Information

All test applications, scripts and tools here should follow the guide lines specified in the RIOT RDM Guidelines for Write Firmware to Expose RIOT APIs, (see draft).

The tests scripts utilise format and syntax of the RobotFramework. Additional files related to RF can be found in dist/robotframework, this includes common keywords and custom libraries.

Besides the applications that are written in C, it is recommend to use Python to write tools or interfaces related to running tests. That allows for simple integration with the RF test scripts (and re-usability in general).

Testing and Changing RIOT Versions

To test a RIOT version go into the RIOT subdirectory and change to the desired state. Alternatively, the RIOTBASE=<path_to_riot_directory> can be used.

Build System Integration

The (HIL) tests, i.e., the RF test scripts, utilise and integrate with the RIOT build system. For instance, it uses existing make targets like flash and environment variables such as BOARD and PORT. Further, new targets are introduced namely robot-test to specifically trigger RF based HIL testing without interfering with the existing test target in RIOT and robot-clean to clean the build folder and hence, enable the tests to be rerun.

Additional robot flags can be added with ROBOT_EXTRA_ARGS. This can be useful for fine-tuning robot performance while taking advantage of the build system. For example, selecting a single test suite for a test binary:

ROBOT_EXTRA_ARGS="-s mytestsuitename" make robot-test

robotfw-tests's People

Contributors

akshaim avatar cgundogan avatar gschorcht avatar leandrolanzieri avatar marcelstenzel avatar michelrottleuthner avatar mrkevinweiss avatar ngandrass avatar ozfox avatar peterkietzmann avatar pokgak avatar smlng avatar yegorich avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotfw-tests's Issues

Improve PHiLIP API documentation

It would be good to give more information on how to use philip in tests. This could just be a link or a full API description for Robot

Allow owner of build to cancel their own running build

In case the user started a build with a faulty configuration, it might be useful to cancel it instead of waiting for the whole pipeline to finish. The ownership-plugin seems to allow this by using the @currentUserIsOwner or the @currentUserIsPrimaryOwner role. Link to plugin page.

The global admin will still be able to override that and cancel any job.

tests: problems with ESP32 and tests/periph_uart

When I was testing PR #12955 as DUT with a nucleo-f103rb, I encountered a problem with tests/periph_uart. While all tests are working with ESP32 and the current RIOT master, the following tests fail with PR #12955 for the ESP32.

------------------------------------------------------------------------------
Extended Short Echo Should Succeed :: Verify echo of short string ... | FAIL |
[ t111 ] does not contain match for pattern 'u222'.
------------------------------------------------------------------------------
Extended Long Echo Should Succeed :: Verify echo of long string to... | FAIL |
[ t796676701934836782036789096074901985358332 ] does not contain match for pattern 'u8:7787812:4594789314789:1:7185:12:96469443'.
------------------------------------------------------------------------------

With the logic analyzer, no difference can be observed from the ESP32 side. The following snapshots show the reaction of ESP32 to the uart_write 1 flushcommand.

Figure 1: with current master
screenshot_master
Figure 2: with PR #12955
screenshot_deduplication

The signals in these snapshots are

Channel Signal name direction
2 UART0_RX from host to ESP32
3 UART0_TX from ESP32 to host
4 UART1_RX/DUT_TX from PHiLIP-n to ESP32
5 UART1_TX/DUT_RX from ESP32 toPHiLIP-n
6 DUT_RST from PHiLIP-n to ESP32

That is channel 3 and 5 are the signals generated by the ESP. The signal in channel 5 is the reaction of the ESP32 on the command uart_write 1 flush. In both cases, the test string flush is sent from ESP32 to PHiLIP-n. But in second case, PHiLIP-n doesn't answer with the incremented string.

Therefore, the uart_write 1 flush command is repeated after 2 seconds without any reaction from PHiLIP-n before PHiLIP-n restarts after a further second.

The only visible difference is that the ESP32 sends the test string on UART1 one character earlier relative to the output on UART0.

The complete captures from the logic analyzer:
master.logicdata.zip
deduplication.logicdata.zip

The Extended Short Echo test starts about 4 seconds after the first DUT_RST pulse in channel 6.

feat(error_code): Add more verbose error code

Currently the console gives feedback if something fails such as

==============================================================================
tests_periph_timer                                                            
==============================================================================
tests_periph_timer.Periph Timer Base :: Verify basic functionality of the P...
==============================================================================
Timer Init Should Succeed :: Verify timer_init return code            | FAIL |
'Error' does not contain 'Success'
------------------------------------------------------------------------------

It would be nice to have the full struct printed so we can see the values and the command in the console output, something like:

==============================================================================
tests_periph_timer                                                            
==============================================================================
tests_periph_timer.Periph Timer Base :: Verify basic functionality of the P...
==============================================================================
Timer Init Should Succeed :: Verify timer_init return code            | FAIL |
`Error' does not contain 'Success'
cmd: init_val(dev=0)
data: 5
msg: Initializing the periph timer
result: Error

------------------------------------------------------------------------------

[TRACKER] Jenkinsfile rework

There are a number of improves that should happen with the CI and specifically Jenkinsfile.

  • Make Jenkinsfile declarative as it is better documented and seems to be preferred
  • Run all tests on nodes before releasing them to prevent async behaviour
  • Tune timeouts (total, node_total, per test)
  • Proper error handling
  • Cancel whole job quickly
  • Build on master and only send binaries
    • Master can use build in docker to get binaries
    • Nodes must have a static RIOT folder /opt/RIOT used for flashing and make robot-test
    • Master only unstashes RobotFW and binaries in nodes for tests
  • Only run nodes with unique boards
  • Don't run tests if wiring isn't present
  • Add params to only run selected boards
  • Add params to only run selected applications
  • Add params to run all cpu?
  • Run RIOT tests?
  • Add args for make as parameter

esp32_env: What are the plans for ADC, DAC and PWM

As the title says, what are the plans for ADC, DAC and PWM?

ADC, DAC and PWM pins are already listed in the environment configuration and also defined as PHiLIP ports. But it is not clear to me on how to map the the GPIO definition in the environment definition to an ADC/DAC line or a PWM channel.

Dependent on the plans for ADC, DAC and PWM, the GPIOs in esp32-wroom-32.env should be different. For example, using GPIOs 25, 26, 27 for GPIO tests would prevent to test a DAC pin.

Update riot_pal to not send on connect

It appears the attempt to flush on the interface level during connection causes some issues with the arduino. When sending characters in bootloader mode (the first 2 seconds during startup) it could cause the arduino to stay in bootloader mode for up to 10 seconds. The timeout is reset every time a new character is sent. So it would be good to remove the flash on connect (or make it optional) from the riot pal interface. If this is done then the arduino should only need a RESET_WAIT of 3 or so then everything should be good.

Add checks to philip

So far philip needs to get some modes set and read some register. It doesn't have any checks or logging to see if it works. We should fix that.

Prepare for update to Robot Framework v4.x

Robot Framework 4.0 beta 1 was released on Oct 19, 2020 and the new major version has several incompatible changes which have to be addressed before a update can happen. The newest release notes contains all changes and necessary steps.

  • Changes to test and suite statuses
  • Old :FOR loop syntax is not supported anymore
  • Meaning of @{var}[item] and &{var}[item] syntax has changed
  • Argument conversion changes
  • Libdoc spec changes
  • Other backwards incompatible changes

Most important enhancements as listed in the README.

  • New SKIP status
  • Criticality has been removed
  • Native IF/ELSE syntax
  • Support for nested control structures
  • Libdoc enhancements
  • Argument conversion enhancements
  • List and dictionary expansion with item access
  • Positional-only arguments

Worth mentioning is the change from the concept of "critical tests" to a new "SKIP" status, which would need to review/rework every existing test, but in my opinion would be quite a improvement. There are several resources on the web about this feature:

Cannot reproduce failure with i2c nack on frdm-k22f

Currently the nightlies fail Read Register After NACK Should Succeed test. It gets a nack successfully but then fails on the recovery.

When I try to do this manually on the desk and on the HiL rack (by calling the values from term), it recovers. Could this be a timing issue?

Documentation clarifications

After running though the documentation a few things could be clarified.

  • Document how to confirm PHiLIP flash was successful (by blinking LED)
  • Reference how to get portnames on linux (/dev/tty*)
  • Add troubleshooting if DUT portname is not default
  • make sure you run from test folder or use -C tests/per...
  • Add troubleshooting (tell people to double check pinout if only a few tests fail, point out you need to point to a riot version)
  • Clarify example use of RIOTBASE

tests: Periph I2C Flags

While analyzing why the following tests in tests/periph_i2c/tests/04__periph_i2c_flags fail for esp32-wroom-32

  • Repeated Start Read Bytes 0 Should Succeed

    Repeated Start Read Bytes 0 Should Succeed
    [Documentation] Verify DUT does not lockup on repeated start read
    PHiLIP.write reg user_reg 0
    API Call Should Succeed I2C Read Bytes leng=2 flag=${I2C_FLAG_NOSTOP}
    API Call Should Error I2C Read Bytes leng=2
    API Call Should Succeed I2C Read Bytes leng=2 flag=${I2C_FLAG_NOSTART}

  • Repeated Start Read Bytes 0xFF Should Succeed

    Repeated Start Read Bytes 0xFF Should Succeed
    [Documentation] Verify DUT does not lockup on repeated start read
    PHiLIP.write reg user_reg 255
    API Call Should Succeed I2C Read Bytes leng=2 flag=${I2C_FLAG_NOSTOP}
    API Call Should Error I2C Read Bytes leng=2
    API Call Should Succeed I2C Read Bytes leng=2 flag=${I2C_FLAG_NOSTART}

I was wondering why the second i2c_read_bytes call should fail?

In section 3.1.10, the I2C standard only specifies:

"A data transfer is always terminated by a STOP condition (P) generated by the master. However, if a master still wishes to communicate on the bus, it can generate a repeated START condition (Sr) and address another slave without first generating a STOP condition. Various combinations of read/write formats are then possible within such a transfer."

From my point of view, "address another slave ..." doesn't mean necessarily that a second read with the same slave address should fail. It just says, that the master can continue the communication on the bus with another slave. In fact, the slave address in combined format is the same and only the direction is changed. Furthermore, "Various combinations ..." does not imply that the combined read after write transfer must be the only one.

Furthermore, according to Note 4 in section 3.1.10

"I2C-bus compatible devices must reset their bus logic on receipt of a START or repeated START condition such that they all anticipate the sending of a slave address"

That is, all slaves including the former one should await an address field after a repeated start. So why shouldn't it be the same address as before?

Although it might not make sense to have consecutive read transfers from the same slave, the standard does not forbid this.

I have tested it with a chip PCF8575 chip from NXP, the owner of the I2C standard. The chip accepts consecutive i2c_read_bytes calls with repeated START conditions. So IMHO, the ESP32 I2C behaves correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.