-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add arduino-core-tests submodule for test reuse (#313)
* refact: change the unity test to submodule and clean up workflow & make test command * build: change unit test submodule dependencies to new url * core: update unit test setup * fix: add time out to spin lock in hardware serial * test: add small changes to I2C change, add it to HIL * fix: pull submodules when checkout repo * fix: pull private submodule with GITHUB_TOKEN? * Update hil-unity-checks.yml fix: use PAT * fix: using ssh key to unit test repo * Change sender/reciever order for CAN * Use access token for submodule * Use access token for submodule * Use access token for submodule * Use access token for submodule * Use access token for submodule * Use access token * Use access token * Use access token * Use access token * Small change to trigger new checkout * Small change to trigger new checkout * to latest * Add badge for HIL testing * Move Unity path to system wide path * test: update test submodule and according files. update the README * fix: small change of test target name * There is still a problem in the make file setting * We must be sure that the submodule is clone on all runner * fix: change some naming lowercase in unity test * test: remove test_wire_connected1_pingpong for not supported board (xmc1400 2go and xmc1100 2go) * fix: update makefile target * fix: update unity because of some typo * fix: copie only required test source in build folder * fix: typo in makefile * feature: update unity test and reference command * doc: update documentation of test and formatting * chore: add .gitsttribute to avoit eol problem in future * chore: reset HardwareSerial.cpp for eol problem * chore: reset hil-unity-checks for eol problem * chore: remove old submodule * chore: add arduino-core-tests submodule * ci: change the tests path --------- Co-authored-by: Filies Olaf (IFAG DES TOC PSA) <[email protected]>
- Loading branch information
Showing
30 changed files
with
235 additions
and
1,657 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,17 @@ | ||
# Configuration to handle line endings for working with Windows and Unix | ||
# Reference: | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# https://git-scm.com/docs/gitattributes#_checking_out_and_checking_in | ||
|
||
* text=auto | ||
|
||
*.c text | ||
*.cpp text | ||
*.h text | ||
*.hpp text | ||
*.ino text | ||
*.py text | ||
|
||
|
||
*.sh text eol=lf | ||
*.bat text eol=crlf |
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
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 |
---|---|---|
@@ -1,19 +1,21 @@ | ||
.history | ||
.vscode | ||
|
||
# build folder | ||
pkg_build | ||
build | ||
|
||
# python | ||
**/__pycache__/ | ||
venv/ | ||
|
||
# code-check reports | ||
clang-tidy-report.txt | ||
|
||
scan-build-reports/ | ||
|
||
cppcheck_reports/ | ||
cppcheck.checkers | ||
err.xml | ||
# vscode | ||
.history | ||
.vscode | ||
.editorconfig | ||
|
||
# build folder | ||
pkg_build | ||
build | ||
|
||
# python | ||
**/__pycache__/ | ||
venv/ | ||
|
||
# code-check reports | ||
clang-tidy-report.txt | ||
|
||
scan-build-reports/ | ||
|
||
cppcheck_reports/ | ||
cppcheck.checkers | ||
err.xml |
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,3 @@ | ||
[submodule "arduino-core-tests"] | ||
path = tests/arduino-core-tests | ||
url = https://github.com/Infineon/arduino-core-tests.git |
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 |
---|---|---|
@@ -1,47 +1,55 @@ | ||
# Contributing to XMC for Arduino | ||
First important point: **All Contributions** are welcomed :open_hands:. | ||
|
||
Please contribute and raise issues via the [github repository](https://github.com/Infineon/XMC-for-Arduino/tree/master) | ||
|
||
### Overview for Contributors | ||
|
||
- Start your contribution by creating a [fork](https://github.com/Infineon/XMC-for-Arduino/fork) of this repository | ||
- It's recommended to create a separate branch for your contribution in your fork | ||
- Once your contribution is ready & tested, please create a [Pull Request](https://github.com/Infineon/XMC-for-Arduino/compare) to the master branch | ||
- Once we merged your changes to the master branch, they are automatically included in the next release | ||
|
||
### Testing in Arduino IDE (on Windows) | ||
Clone the repository in Arduino folder: | ||
- Open Arduino and install any version of this project as described [here](https://xmc-arduino.readthedocs.io/en/latest/installation-instructions.html). | ||
- Open the installation location in your Arduino program folder, e.g. | ||
`C:\Users\<username>\AppData\Local\Arduino15\packages\Infineon\hardware\xmc` | ||
- Open git bash, type command: | ||
`git clone <your-xmc-for-arduino-fork> <version>` | ||
|
||
This allows quick testing of local changes during development. | ||
|
||
[!TIP] | ||
If you encounter strange behavior with Arduino IDE during development, try cleaning up the cache: | ||
* Windows: `C:\User\"username"\AppData\Roaming\arduino-ide` | ||
* Linux: `~/.config/arduino-ide` | ||
* macOS: `~/Library/Application Support/arduino-ide/` | ||
|
||
### Automated Build Checks | ||
|
||
Currently a Github workflow is used for automatic compilation checking and releasing. Workflows are defined [here](https://github.com/Infineon/XMC-for-Arduino/tree/master/.github/workflows). | ||
Before opening a Pull Request for your contribution, please add a git tag in the format `Vx.y.z` (e.g. V3.3.0) to trigger the release process in your fork and pass the compilation tests. | ||
|
||
### Creating and Maintaining Third Party Libraries | ||
#### Basics | ||
The Arduino IDE allows for external libraries to be added to support specific devices and functions which are not part of the core setup. For details on creating libraries see the | ||
[Arduino library specifications](https://arduino.github.io/arduino-cli/library-specification/). If you add additional libraries to this project, make sure to [document them](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html) accordingly. | ||
|
||
#### XMC-for-Arduino Configuration | ||
To ensure that a library specific to one architecture or board type is only compiled when a supporting board is set up, this specification includes a setting for *architecture* in the *library.properties* file. | ||
|
||
When creating or maintaining third party or external libraries for XMC-for-Arduino please use this setting: | ||
~~~ | ||
architecture=xmc | ||
~~~ | ||
|
||
If your library also supports other boards and architectures, add those in as well. | ||
# Contributing to XMC for Arduino | ||
First important point: **All Contributions** are welcomed :open_hands:. | ||
|
||
Please contribute and raise issues via the [github repository](https://github.com/Infineon/XMC-for-Arduino/tree/master) | ||
|
||
## Overview for Contributors | ||
|
||
- Start your contribution by creating a [fork](https://github.com/Infineon/XMC-for-Arduino/fork) of this repository | ||
- It's recommended to create a separate branch for your contribution in your fork | ||
- Once your contribution is ready & tested, please create a [Pull Request](https://github.com/Infineon/XMC-for-Arduino/compare) to the master branch | ||
- Once we merged your changes to the master branch, they are automatically included in the next release | ||
|
||
## Install the BSP under development (on Windows) | ||
Clone the repository in Arduino folder: | ||
- Open Arduino and install any version of this project as described [here](https://xmc-arduino.readthedocs.io/en/latest/installation-instructions.html). | ||
- Open the installation location in your Arduino program folder, e.g. | ||
`C:\Users\<username>\AppData\Local\Arduino15\packages\Infineon\hardware\xmc` | ||
- Open git bash, type command: | ||
`git clone <your-xmc-for-arduino-fork> <version>` | ||
|
||
This allows quick testing of local changes during development. | ||
|
||
[!TIP] | ||
If you encounter strange behavior with Arduino IDE during development, try cleaning up the cache: | ||
* Windows: `C:\User\"username"\AppData\Roaming\arduino-ide` | ||
* Linux: `~/.config/arduino-ide` | ||
* macOS: `~/Library/Application Support/arduino-ide/` | ||
|
||
## Automated Build Checks | ||
|
||
Currently a Github workflow is used for automatic compilation checking and releasing. Workflows are defined [here](https://github.com/Infineon/XMC-for-Arduino/tree/master/.github/workflows). | ||
Before opening a Pull Request for your contribution, please add a git tag in the format `Vx.y.z` (e.g. V3.3.0) to trigger the release process in your fork and pass the compilation tests. | ||
|
||
## Creating and Maintaining Third Party Libraries | ||
### Basics | ||
The Arduino IDE allows for external libraries to be added to support specific devices and functions which are not part of the core setup. For details on creating libraries see the | ||
[Arduino library specifications](https://arduino.github.io/arduino-cli/library-specification/). If you add additional libraries to this project, make sure to [document them](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html) accordingly. | ||
|
||
### XMC-for-Arduino Configuration | ||
To ensure that a library specific to one architecture or board type is only compiled when a supporting board is set up, this specification includes a setting for *architecture* in the *library.properties* file. | ||
|
||
When creating or maintaining third party or external libraries for XMC-for-Arduino please use this setting: | ||
~~~ | ||
architecture=xmc | ||
~~~ | ||
|
||
If your library also supports other boards and architectures, add those in as well. | ||
|
||
## Validation test | ||
To test the XMC4arduino, we used unity to test some of the features of the arduino core/builtin library. | ||
Tests are located in tests\unity and included as submodule in this project. Run `git submodule update --init --recursive` to update them. If you are nor familiar with submodules, check out: https://git-scm.com/book/en/v2/Git-Tools-Submodules | ||
|
||
## Code checks (WIP) | ||
Refer to libraries\CAN\Makefile.codecheck | ||
* Regarding formatting, we currently use [pre-commit](https://pre-commit.com/) to automatically run clang-formatting to format all c/c++ code. Please install this python package, and follow the quick start (the pre-commit configuration file is already there). You should be able to format your code automatically on git commit! |
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
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
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,23 @@ | ||
### Build commands | ||
### ! Please note that you need to change the port and path of Unity as appropriate ! | ||
|
||
### Unit tests | ||
|
||
##CAN | ||
|
||
# 1 board, no wire | ||
make FQBN=Infineon:xmc:XMC1400_XMC2GO PORT=COM42 UNITY_PATH=\Unity test_can_single monitor | ||
|
||
# 2 boards | ||
make FQBN=Infineon:xmc:XMC1400_XMC2GO PORT=COM42 UNITY_PATH=\Unity test_can_connected2_node2 monitor | ||
make FQBN=Infineon:xmc:XMC1400_XMC2GO PORT=COM41 UNITY_PATH=\Unity test_can_connected2_node1 monitor | ||
|
||
|
||
## IIC | ||
|
||
# 1 board "talking to itself", wire needed | ||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM28 UNITY_PATH=\Unity test_wire_connected1_pingpong monitor | ||
|
||
# 2 boards | ||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM85 test_wire_connected2_masterpingpong monitor | ||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM28 UNITY_ |
Oops, something went wrong.