Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/sys/progress_bar: move configuration to app.config #20764

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions tests/sys/progress_bar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 9 additions & 0 deletions tests/sys/progress_bar/app.config
Original file line number Diff line number Diff line change
@@ -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="▢"
4 changes: 2 additions & 2 deletions tests/sys/progress_bar/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@


def testfunc(child):
for i in range(0, 100, 10):
for i in range(0, 101, 10):
miri64 marked this conversation as resolved.
Show resolved Hide resolved
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!")

Expand Down
Loading