ACK: [PATCH 1/3] lib: fwts_framework: change fwts-live progress feedback (LP: #1321664)

Alex Hung alex.hung at canonical.com
Fri May 23 04:02:52 UTC 2014


On 05/21/2014 07:55 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Make fwts-live progress feedback more informative. Add % covered,
> total tests to run and make progress bar related to the current test
> being run rather than the total progress. This provides the user
> more feedback when running lengthy tests such as the cpufreq tests.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_framework.c | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index cd239ba..3609301 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -25,6 +25,7 @@
>   #include <time.h>
>   #include <getopt.h>
>   #include <sys/utsname.h>
> +#include <sys/time.h>
>
>   #include "fwts.h"
>
> @@ -392,16 +393,27 @@ void fwts_framework_minor_test_progress(fwts_framework *fw, const int percent, c
>   	/* Output for the dialog tool, dialog --title "fwts" --gauge "" 12 80 0 */
>   	if (fw->flags & FWTS_FLAG_SHOW_PROGRESS_DIALOG) {
>   		char buffer[128];
> +		static struct timeval start_time;
> +		struct timeval now_time;
> +		int duration;
> +
> +		gettimeofday(&now_time, NULL);
> +		if (!start_time.tv_sec)
> +			start_time = now_time;
> +		duration = (int)(now_time.tv_sec - start_time.tv_sec);
>
>   		fwts_framework_format_results(buffer, sizeof(buffer), &fw->total, true);
>
>   		fprintf(stdout, "XXX\n");
> -		fprintf(stdout, "%d\n", (int)progress);
> -		fprintf(stdout, "So far: %s\n\n", buffer);
> +		fprintf(stdout, "%d\n", percent);
> +		fprintf(stdout, "%s.\n", buffer);
> +		fprintf(stdout, "%5.2f%% total run complete (%d seconds).\n",
> +			progress, duration);
>   		fprintf(stdout, "%s\n\n", fw->current_major_test->ops->description ?
>   			fw->current_major_test->ops->description : "");
> -		fprintf(stdout, "Running test #%d: %s\n",
> +		fprintf(stdout, "Running test #%d of %d: %s\n",
>   			fw->current_major_test_num,
> +			fw->major_tests_total,
>   			fw->current_minor_test_name);
>   		fprintf(stdout, "XXX\n");
>   		fflush(stdout);
>

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list