tests/periph_gpio: allow specifying port under test

This commit is contained in:
Francisco Molina 2020-07-21 11:45:02 +02:00
parent e8a8d12d96
commit 92d2a727f5
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
2 changed files with 19 additions and 1 deletions

View File

@ -7,7 +7,22 @@ USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += benchmark
BOARDS_BENCH_PORT_1 = \
slstk3402a \
#
# port 0 pins are used for serial output on these boards, e.g.: on slstk3402a
# PA5 (or port 0, pin 5) is used to control the BC enabling serial output,
# therefore test on port 1.
ifneq (,$(filter $(BOARD),$(BOARDS_BENCH_PORT_1)))
PORT_UNDER_TEST ?= 1
else
PORT_UNDER_TEST ?= 0
endif
include $(RIOTBASE)/Makefile.include
$(call target-export-variables,test,PORT_UNDER_TEST)
bench:
tests/02-bench.py

View File

@ -7,16 +7,19 @@
# directory for more details.
import sys
import os
from testrunner import run
# On slow platforms, like AVR, this test can take some time to complete.
TIMEOUT = 30
# Allow setting a specific port to test
PORT_UNDER_TEST = int(os.environ.get('PORT_UNDER_TEST') or 0)
def testfunc(child):
for pin in range(0, 8):
child.sendline("bench 0 {}".format(pin))
child.sendline("bench {} {}".format(PORT_UNDER_TEST, pin))
child.expect(r" *nop loop: +(\d+)us --- +(\d+\.\d+)us per call --- +(\d+) calls per sec")
child.expect(r" *gpio_set: +(\d+)us --- +(\d+\.\d+)us per call --- +(\d+) calls per sec")
child.expect(r" *gpio_clear: +(\d+)us --- +(\d+\.\d+)us per call --- +(\d+) calls per sec")