From patchwork Thu Jan 10 10:48:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 210974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id EFA4A2C032A for ; Thu, 10 Jan 2013 21:49:00 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TtFgx-0002wn-3q; Thu, 10 Jan 2013 10:48:59 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TtFgv-0002wi-Fo for fwts-devel@lists.ubuntu.com; Thu, 10 Jan 2013 10:48:57 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TtFgv-0004RG-DT for fwts-devel@lists.ubuntu.com; Thu, 10 Jan 2013 10:48:57 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] lib: framework: Increase precision of progress, add a spinner progress indicator Date: Thu, 10 Jan 2013 10:48:56 +0000 Message-Id: <1357814937-21979-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@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); }