From 92d2a727f5c34d418628e7970e37eeb3302e89ac Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 21 Jul 2020 11:45:02 +0200 Subject: [PATCH] tests/periph_gpio: allow specifying port under test --- tests/periph_gpio/Makefile | 15 +++++++++++++++ tests/periph_gpio/tests/02-bench.py | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/periph_gpio/Makefile b/tests/periph_gpio/Makefile index 49bebb41a7..0bcec0ce42 100644 --- a/tests/periph_gpio/Makefile +++ b/tests/periph_gpio/Makefile @@ -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 diff --git a/tests/periph_gpio/tests/02-bench.py b/tests/periph_gpio/tests/02-bench.py index 1932e41021..7439ce02d8 100755 --- a/tests/periph_gpio/tests/02-bench.py +++ b/tests/periph_gpio/tests/02-bench.py @@ -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")