Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/arduino_core_tests"]
path = tests/arduino_core_tests
url = https://github.com/Infineon/arduino-core-tests.git
53 changes: 53 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Arduino core test configuration

Configuration for the shared
[`arduino-core-tests`](https://github.com/Infineon/arduino-core-tests) suite
(vendored at [`arduino_core_tests`](arduino_core_tests)) lives
in a single file, `tests/test_config.h`, exactly where that submodule's own
Makefile expects it (`../../tests/test_config.h`, relative to the submodule).

One file, with a `#if defined(ARDUINO_<BOARD>)` block per board.
`arduino-cli` already defines `ARDUINO_{build.board}` for every compile, so
the right block is selected automatically.

## Adding a board

1. Add a `#if defined(ARDUINO_<BOARD>)` block to `tests/test_config.h`, using
the board's `build.board` value from `boards.txt` (e.g. `KIT_PSE84_AI`).
2. Define the pins required by the selected tests, using Arduino pin numbers
(e.g. `D0`), not MCU port/pin names.
3. Verify each Arduino pin against the board's variant overlay
(`variants/<variant>/*.overlay`, `zephyr,user` / `digital-pin-gpios`) and
the board schematic or official pinout.
4. Document any required jumpers or external connections next to the block.

For example, `test_digitalio_single` requires two physically connected GPIOs:

```c
#if defined(ARDUINO_<BOARD>)
#define TEST_PIN_DIGITAL_IO_OUTPUT <output pin>
#define TEST_PIN_DIGITAL_IO_INPUT <input pin>
#endif
```

## Running a test

```bash
make -C tests/arduino_core_tests FQBN=<fqbn> UNITY_PATH=Unity \
TESTS=-DTEST_DIGITALIO_SINGLE test_digitalio_single compile
```

To flash and run on a single connected board, add `PORT=` and
`ENABLE_SYNC=0`:

```bash
make -C tests/arduino_core_tests FQBN=<fqbn> UNITY_PATH=Unity PORT=<port> \
TESTS=-DTEST_DIGITALIO_SINGLE ENABLE_SYNC=0 test_digitalio_single
```

`ENABLE_SYNC` defaults to `1`: tests named `*_connected2_*` (e.g.
`test_wire_connected2_masterpingpong`) need two boards and wait for each
other's handshake over serial, so leave it enabled for those. Tests named
`*_single` (or loopback tests like `test_spi_connected1_loopback`) only use
one board; without `ENABLE_SYNC=0` they hang forever printing
`synchronising with host...`, since nothing ever answers the handshake.
1 change: 1 addition & 0 deletions tests/arduino_core_tests
Submodule arduino_core_tests added at 0f52c0
15 changes: 15 additions & 0 deletions tests/test_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) Infineon Technologies AG
*
* SPDX-License-Identifier: Apache-2.0
*
* Board-specific test pin definitions for tests/arduino_core_tests.
*
* Each board adds its own #if defined(ARDUINO_<BOARD>) block below (see
* tests/README.md). This file intentionally has no board blocks of its own:
* board-specific content belongs to the branch that owns that board.
*/
#ifndef TEST_CONFIG_H
#define TEST_CONFIG_H

#endif // TEST_CONFIG_H
Loading