Merge pull request #14566 from fjmolinas/pr_test_periph_gpio_pin
tests/periph_gpio: allow specifying port under test
This commit is contained in:
commit
ec487138bf
@ -7,7 +7,22 @@ USEMODULE += shell
|
|||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += benchmark
|
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
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
$(call target-export-variables,test,PORT_UNDER_TEST)
|
||||||
|
|
||||||
bench:
|
bench:
|
||||||
tests/02-bench.py
|
tests/02-bench.py
|
||||||
|
|||||||
@ -7,16 +7,19 @@
|
|||||||
# directory for more details.
|
# directory for more details.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
from testrunner import run
|
from testrunner import run
|
||||||
|
|
||||||
|
|
||||||
# On slow platforms, like AVR, this test can take some time to complete.
|
# On slow platforms, like AVR, this test can take some time to complete.
|
||||||
TIMEOUT = 30
|
TIMEOUT = 30
|
||||||
|
# Allow setting a specific port to test
|
||||||
|
PORT_UNDER_TEST = int(os.environ.get('PORT_UNDER_TEST') or 0)
|
||||||
|
|
||||||
|
|
||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
for pin in range(0, 8):
|
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" *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_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")
|
child.expect(r" *gpio_clear: +(\d+)us --- +(\d+\.\d+)us per call --- +(\d+) calls per sec")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user