mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20764 from mguetschow/tests-progressbar-kconfig
tests/sys/progress_bar: move configuration to app.config
This commit is contained in:
commit
7225dc2e9d
@ -3,24 +3,10 @@ include ../Makefile.sys_common
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += progress_bar
|
||||
|
||||
CONFIG_PROGRESS_BAR_LENGTH ?= 50
|
||||
CONFIG_PROGRESS_BAR_FULL_CHARACTER ?= "█"
|
||||
CONFIG_PROGRESS_BAR_EMPTY_CHARACTER ?= " "
|
||||
|
||||
# Other nice progress bar characters:
|
||||
#CONFIG_PROGRESS_BAR_FULL_CHARACTER ?= "◉"
|
||||
#CONFIG_PROGRESS_BAR_EMPTY_CHARACTER ?= "◯"
|
||||
#CONFIG_PROGRESS_BAR_FULL_CHARACTER ?= "▣"
|
||||
#CONFIG_PROGRESS_BAR_EMPTY_CHARACTER ?= "▢"
|
||||
|
||||
CFLAGS += -DCONFIG_PROGRESS_BAR_FULL_CHARACTER=\"$(CONFIG_PROGRESS_BAR_FULL_CHARACTER)\"
|
||||
CFLAGS += -DCONFIG_PROGRESS_BAR_EMPTY_CHARACTER=\"$(CONFIG_PROGRESS_BAR_EMPTY_CHARACTER)\"
|
||||
CFLAGS += -DCONFIG_PROGRESS_BAR_LENGTH=$(CONFIG_PROGRESS_BAR_LENGTH)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
# Make custom progress bar characters available in Python test script via
|
||||
# environment variables
|
||||
# Make custom progress bar configuration from app.config
|
||||
# available in Python test script via environment variables
|
||||
export CONFIG_PROGRESS_BAR_FULL_CHARACTER
|
||||
export CONFIG_PROGRESS_BAR_EMPTY_CHARACTER
|
||||
export CONFIG_PROGRESS_BAR_LENGTH
|
||||
|
9
tests/sys/progress_bar/app.config
Normal file
9
tests/sys/progress_bar/app.config
Normal file
@ -0,0 +1,9 @@
|
||||
CONFIG_PROGRESS_BAR_LENGTH=50
|
||||
CONFIG_PROGRESS_BAR_FULL_CHARACTER="█"
|
||||
CONFIG_PROGRESS_BAR_EMPTY_CHARACTER=" "
|
||||
|
||||
# Other nice progress bar characters:
|
||||
#CONFIG_PROGRESS_BAR_FULL_CHARACTER="◉"
|
||||
#CONFIG_PROGRESS_BAR_EMPTY_CHARACTER="◯"
|
||||
#CONFIG_PROGRESS_BAR_FULL_CHARACTER="▣"
|
||||
#CONFIG_PROGRESS_BAR_EMPTY_CHARACTER="▢"
|
@ -18,14 +18,14 @@ EMPTY_CHARACTER = os.getenv('CONFIG_PROGRESS_BAR_EMPTY_CHARACTER')[1:-1]
|
||||
|
||||
|
||||
def testfunc(child):
|
||||
for i in range(0, 100, 10):
|
||||
for i in range(0, 101, 10):
|
||||
ratio = int(i * LENGTH / 100.0)
|
||||
progress_str = FULL_CHARACTER * ratio
|
||||
progress_str += EMPTY_CHARACTER * (LENGTH - ratio)
|
||||
check_str = 'Progress bar 0 |{}| {:3}%'.format(
|
||||
progress_str, i)
|
||||
# todo: temporary printout for debugging this flaky test
|
||||
print("EXPECTS:", check_str)
|
||||
print("EXPECTS:", check_str, "LENGTH:", LENGTH, "ratio:", ratio)
|
||||
child.expect_exact(check_str)
|
||||
child.expect_exact("Done!")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user