From patchwork Thu Jan 10 10:48:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: lib: framework: Increase precision of progress, add a spinner progress indicator Date: Thu, 10 Jan 2013 00:48:56 -0000 From: Colin King X-Patchwork-Id: 210974 Message-Id: <1357814937-21979-1-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King Some tests such as the cpufreq and cstates tests take rather a long time so it makes sense to increase the precision to the % progress output to indicate that something is actually happening. Also, add a progress spinner indicator to also provide some feedback that the test is actually active rather than hung. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/lib/src/fwts_framework.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 7290912..25ccc41 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -380,11 +380,13 @@ void fwts_framework_minor_test_progress(fwts_framework *fw, const int percent, c if (fw->show_progress) { char buf[1024]; char truncbuf[256]; + static int index; snprintf(buf, sizeof(buf), "%s %s",fw->current_minor_test_name, message); fwts_framework_strtrunc(truncbuf, buf, width-9); - fprintf(stderr, " %-*.*s: %3.0f%%\r", width-9, width-9, truncbuf, progress); + fprintf(stderr, " %-*.*s: %5.1f%% %c\r", + width-13, width-13, truncbuf, progress, "/-\\|"[index++ & 3]); fflush(stderr); }