1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
19102: gh-actions: report release-tests result to Matrix r=maribu a=miri64



19128: boards: common: stdio_cdc_acm: let tests wait a bit for serial port r=miri64 a=miri64



19133: makefiles/utils/strings.mk: Fix version_is_greater_or_equal r=maribu a=maribu

### Contribution description

The Makefile function `version_is_greater_or_equal` is used to check if a version of GNU Make is at least the required one. However, it has the built-in assumption the version numbers have to format x.y.z, but Alpine Linux currently ships GNU Make 4.4. This results in `$(call _pad_number,3,)` which runs `printf '$03d' ''` in the shell, which is not valid.

This fixes the issue by making `_pad_number` more robust by fall back to printing `0` with the given padding, if the number given to print is empty.

### Testing procedure

Append

```Makefile

$(info A=$(call version_is_greater_or_equal,4.2.0,4.2.0))
$(info B=$(call version_is_greater_or_equal,4.2,4.2.0))
$(info C=$(call version_is_greater_or_equal,4.1,4.2.0))
$(info D=$(call version_is_greater_or_equal,4.1.9,4.2.0))
$(info E=$(call version_is_greater_or_equal,5.1.9,4.2.0))
$(info F=$(call version_is_greater_or_equal,5.0.0,4.2.0))
$(info G=$(call version_is_greater_or_equal,4.2.1,4.2.0))
$(info H=$(call version_is_greater_or_equal,4.3.1,4.2.0))
```

e.g. to `makefiles/utils/strings.mk`, build something and observe the info output.

This yields

```
A=1
B=1
C=
D=
E=1
F=1
G=1
H=1
```

for me and does not complain about invalid `printf` invocations.

### Issues/PRs references

None

Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
This commit is contained in:
bors[bot] 2023-01-12 19:01:35 +00:00 committed by GitHub
commit 1dcccdc99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 2 deletions

View File

@ -123,6 +123,7 @@ jobs:
sudo apt-get install lib32asan6
- name: Run release tests
timeout-minutes: 350
id: tests
run: |
RIOTBASE="$GITHUB_WORKSPACE/RIOT"
TOX_ARGS=""
@ -173,6 +174,27 @@ jobs:
mkdir test-reports/
junit2html ${REPORT_XML} ${REPORT_NAME}.html
cp ${REPORT_XML} ${REPORT_NAME}.xml
- name: Generate result message
if: always()
id: generate_results
run: |
if [ "${{ steps.tests.conclusion }}" == "success" ]; then
nice_str=echo "&#x2705; **PASSED**"
elif [ "${{ steps.tests.conclusion }}" == "failure" ]; then
nice_str="&#x274C; **FAILED**"
fi
echo "nice_str=${nice_str}" >> ${GITHUB_OUTPUT}
- name: Report to Matrix channel
if: ${{ always() && steps.generate_results.outputs.nice_str != '' }}
uses: fadenb/matrix-chat-message@v0.0.6
with:
homeserver: matrix.org
token: ${{ secrets.RIOT_CI_MATRIX_TOKEN }}
channel: '!UXNJuMzHTSAnwntbbN:utwente.io'
message: |
${{ steps.generate_results.outputs.nice_str}}: Release tests
[${{ matrix.pytest_mark }}, ${{ matrix.sudo }}] on "*${{ github.event_name }}*":
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/upload-artifact@v2
if: always()
with:

View File

@ -8,4 +8,9 @@ ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_% slipdev_stdio,$(USEMODULE))))
USEMODULE += stdio_cdc_acm
endif
FEATURES_REQUIRED += highlevel_stdio
# Enforce tests to wait a bit for the serial port after reset
TERM_DELAY ?= 2
TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY)
$(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY)
endif

View File

@ -7,8 +7,8 @@ lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst
uppercase = $(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
uppercase_and_underscore = $(call uppercase,$(subst -,_,$1))
# Padds $2 number to $1 digits
_pad_number = $(shell printf '%0$1d' $2)
# Padds number $2 to $1 digits. If $2 is empty, zero will be printed instead.
_pad_number = $(shell printf '%0$1d' $(if $2,$2,0))
# Gets major, minor, patch from 'major.minor.patch', e.g.: 4.2.1 by index
# $1: index

View File

@ -8,6 +8,7 @@
import logging
import sys
import time
import unittest
from riotctrl.ctrl import RIOTCtrl
@ -15,6 +16,8 @@ from riotctrl.shell.json import RapidJSONShellInteractionParser, rapidjson
from riotctrl_shell.congure_test import CongureTest
from testrunner.spawn import MAKE_TERM_CONNECT_DELAY
class TestCongUREBase(unittest.TestCase):
# pylint: disable=too-many-public-methods
@ -25,6 +28,7 @@ class TestCongUREBase(unittest.TestCase):
def setUpClass(cls):
cls.ctrl = RIOTCtrl()
cls.ctrl.reset()
time.sleep(MAKE_TERM_CONNECT_DELAY)
cls.ctrl.start_term()
if cls.DEBUG:
cls.ctrl.term.logfile = sys.stdout

View File

@ -8,6 +8,7 @@
import logging
import sys
import time
import unittest
from riotctrl.ctrl import RIOTCtrl
@ -15,6 +16,8 @@ from riotctrl.shell.json import RapidJSONShellInteractionParser, rapidjson
from riotctrl_shell.congure_test import CongureTest
from testrunner.spawn import MAKE_TERM_CONNECT_DELAY
class TestCongUREBase(unittest.TestCase):
DEBUG = False
@ -25,6 +28,7 @@ class TestCongUREBase(unittest.TestCase):
def setUpClass(cls):
cls.ctrl = RIOTCtrl()
cls.ctrl.reset()
time.sleep(MAKE_TERM_CONNECT_DELAY)
cls.ctrl.start_term()
if cls.DEBUG:
cls.ctrl.term.logfile = sys.stdout

View File

@ -8,6 +8,7 @@
import logging
import sys
import time
import unittest
from riotctrl.ctrl import RIOTCtrl
@ -15,6 +16,8 @@ from riotctrl.shell.json import RapidJSONShellInteractionParser, rapidjson
from riotctrl_shell.congure_test import CongureTest
from testrunner.spawn import MAKE_TERM_CONNECT_DELAY
class TestCongUREBase(unittest.TestCase):
# pylint: disable=too-many-public-methods
@ -25,6 +28,7 @@ class TestCongUREBase(unittest.TestCase):
def setUpClass(cls):
cls.ctrl = RIOTCtrl()
cls.ctrl.reset()
time.sleep(MAKE_TERM_CONNECT_DELAY)
cls.ctrl.start_term()
if cls.DEBUG:
cls.ctrl.term.logfile = sys.stdout

View File

@ -9,6 +9,7 @@
import logging
import os
import sys
import time
import unittest
from riotctrl.ctrl import RIOTCtrl
@ -17,6 +18,8 @@ from riotctrl.shell.json import RapidJSONShellInteractionParser, rapidjson
from riotctrl_shell.congure_test import CongureTest
from testrunner.spawn import MAKE_TERM_CONNECT_DELAY
class TestCongUREBase(unittest.TestCase):
DEBUG = False
@ -25,6 +28,7 @@ class TestCongUREBase(unittest.TestCase):
def setUpClass(cls):
cls.ctrl = RIOTCtrl()
cls.ctrl.reset()
time.sleep(MAKE_TERM_CONNECT_DELAY)
cls.ctrl.start_term()
if cls.DEBUG:
cls.ctrl.term.logfile = sys.stdout