summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-10-29 21:32:28 +0100
committerLennart Poettering <lennart@poettering.net>2024-10-29 21:37:26 +0100
commit91d640435d0fd79fe74f6c558d69ffdcbdf86234 (patch)
treeff8c75d0c5c5c5b6d12e44d830a8b47e8f4d2de9 /src/test
parentpretty-print: rename draw_progress_bar_impl()→draw_progress_bar_unbuffered() (diff)
downloadsystemd-91d640435d0fd79fe74f6c558d69ffdcbdf86234.tar.xz
systemd-91d640435d0fd79fe74f6c558d69ffdcbdf86234.zip
pretty-print: add format-string version of draw_progress_bar()
We often format the prefix string via asprintf() before, let's hence add a helper for that.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-progress-bar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test-progress-bar.c b/src/test/test-progress-bar.c
index abc1d292dc..b199741cf5 100644
--- a/src/test/test-progress-bar.c
+++ b/src/test/test-progress-bar.c
@@ -14,7 +14,7 @@ TEST(progress_bar) {
for (double d = 0; d <= 100; d += 0.5) {
usleep_safe(random_u64_range(20 * USEC_PER_MSEC));
- draw_progress_bar(PROGRESS_PREFIX, d);
+ draw_progress_barf(d, PROGRESS_PREFIX "[" PID_FMT "]", getpid_cached());
if (!paused && d >= 50) {
clear_progress_bar(PROGRESS_PREFIX);
@@ -25,9 +25,9 @@ TEST(progress_bar) {
}
}
- draw_progress_bar(PROGRESS_PREFIX, 100);
+ draw_progress_barf(100, PROGRESS_PREFIX "[" PID_FMT "]", getpid_cached());
usleep_safe(300 * MSEC_PER_SEC);
- clear_progress_bar(PROGRESS_PREFIX);
+ clear_progress_bar(PROGRESS_PREFIX "[0123456789]" );
fputs("Done.\n", stdout);
}