[PATCH] lib: framework: Increase precision of progress, add a spinner progress indicator

Keng-Yu Lin kengyu at canonical.com
Tue Jan 29 05:34:31 UTC 2013


On Thu, Jan 10, 2013 at 6:48 PM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> 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 <colin.king at canonical.com>
> ---
>  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);
>         }
>
> --
> 1.8.0
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list