diff mbox

[4/4] lib: fwts_summary: HTML summary should not be in verbatum

Message ID 1338468129-5491-5-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King May 31, 2012, 12:42 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_summary.c |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

Comments

Keng-Yu Lin June 4, 2012, 8:35 a.m. UTC | #1
On Thu, May 31, 2012 at 8:42 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_summary.c |   29 ++++++++++++++++++++++-------
>  1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index f6f449a..19371ea 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -224,12 +224,26 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>                        fwts_list_foreach(item, fwts_summaries[i]) {
>                                fwts_summary_item *summary_item = fwts_list_data(fwts_summary_item *,item);
>                                char *lines = fwts_summary_lines(&summary_item->log_lines);
> -                               fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> -                                       summary_item->test,
> -                                       fwts_list_len(&summary_item->log_lines),
> -                                       fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> -                                       lines,
> -                                       summary_item->text);
> +
> +                               /*
> +                                *  This is not pleasant, we really don't want very wide lines
> +                                *  logged in the HTML format, where we don't mind for other formats.
> +                                */
> +                               if (fw->log_type == LOG_TYPE_HTML)
> +                                       fwts_log_summary(fw, " %s test, at %d log line%s: %s: %s",
> +                                               summary_item->test,
> +                                               fwts_list_len(&summary_item->log_lines),
> +                                               fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> +                                               lines,
> +                                               summary_item->text);
> +                               else
> +                                       fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> +                                               summary_item->test,
> +                                               fwts_list_len(&summary_item->log_lines),
> +                                               fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> +                                               lines,
> +                                               summary_item->text);
> +
>                                free(lines);
>                        }
>                        fwts_log_section_end(fw->results);
> @@ -241,7 +255,8 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>                fwts_log_nl(fw);
>        }
>
> -       if (fw->log_type == LOG_TYPE_PLAINTEXT && fw->total_run > 0) {
> +       if ((fw->log_type == LOG_TYPE_PLAINTEXT ||
> +            fw->log_type == LOG_TYPE_HTML) && fw->total_run > 0) {
>                sorted = fwts_list_new();
>                fwts_list_foreach(item, test_list)
>                        fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);
> --
> 1.7.9.5
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
ivanhu June 6, 2012, 4:12 a.m. UTC | #2
On 05/31/2012 08:42 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/lib/src/fwts_summary.c |   29 ++++++++++++++++++++++-------
>   1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index f6f449a..19371ea 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -224,12 +224,26 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>   			fwts_list_foreach(item, fwts_summaries[i]) {
>   				fwts_summary_item *summary_item = fwts_list_data(fwts_summary_item *,item);
>   				char *lines = fwts_summary_lines(&summary_item->log_lines);
> -				fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> -					summary_item->test,
> -					fwts_list_len(&summary_item->log_lines),
> -					fwts_list_len(&summary_item->log_lines)>  1 ? "s" : "",
> -					lines,
> -					summary_item->text);
> +			
> +				/*
> +				 *  This is not pleasant, we really don't want very wide lines
> +				 *  logged in the HTML format, where we don't mind for other formats.
> +				 */
> +				if (fw->log_type == LOG_TYPE_HTML)
> +					fwts_log_summary(fw, " %s test, at %d log line%s: %s: %s",
> +						summary_item->test,
> +						fwts_list_len(&summary_item->log_lines),
> +						fwts_list_len(&summary_item->log_lines)>  1 ? "s" : "",
> +						lines,
> +						summary_item->text);
> +				else
> +					fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> +						summary_item->test,
> +						fwts_list_len(&summary_item->log_lines),
> +						fwts_list_len(&summary_item->log_lines)>  1 ? "s" : "",
> +						lines,
> +						summary_item->text);
> +
>   				free(lines);
>   			}
>   			fwts_log_section_end(fw->results);
> @@ -241,7 +255,8 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>   		fwts_log_nl(fw);
>   	}
>
> -	if (fw->log_type == LOG_TYPE_PLAINTEXT&&  fw->total_run>  0) {		
> +	if ((fw->log_type == LOG_TYPE_PLAINTEXT ||
> +	     fw->log_type == LOG_TYPE_HTML)&&  fw->total_run>  0) {		
>   		sorted = fwts_list_new();
>   		fwts_list_foreach(item, test_list)
>   			fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);
Acked-by: Ivan Hu<ivan.hu@canonical.com>
Chris Van Hoof June 11, 2012, 4 p.m. UTC | #3
On 05/31/2012 08:42 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_summary.c |   29 ++++++++++++++++++++++-------
>  1 file changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
> index f6f449a..19371ea 100644
> --- a/src/lib/src/fwts_summary.c
> +++ b/src/lib/src/fwts_summary.c
> @@ -224,12 +224,26 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>  			fwts_list_foreach(item, fwts_summaries[i]) {
>  				fwts_summary_item *summary_item = fwts_list_data(fwts_summary_item *,item);
>  				char *lines = fwts_summary_lines(&summary_item->log_lines);
> -				fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> -					summary_item->test,
> -					fwts_list_len(&summary_item->log_lines),
> -					fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> -					lines,
> -					summary_item->text);
> +			
> +				/*
> +				 *  This is not pleasant, we really don't want very wide lines
> +				 *  logged in the HTML format, where we don't mind for other formats.
> +				 */
> +				if (fw->log_type == LOG_TYPE_HTML)
> +					fwts_log_summary(fw, " %s test, at %d log line%s: %s: %s",
> +						summary_item->test,
> +						fwts_list_len(&summary_item->log_lines),
> +						fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> +						lines,
> +						summary_item->text);
> +				else
> +					fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
> +						summary_item->test,
> +						fwts_list_len(&summary_item->log_lines),
> +						fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
> +						lines,
> +						summary_item->text);
> +
>  				free(lines);
>  			}
>  			fwts_log_section_end(fw->results);
> @@ -241,7 +255,8 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
>  		fwts_log_nl(fw);
>  	}
>  
> -	if (fw->log_type == LOG_TYPE_PLAINTEXT && fw->total_run > 0) {		
> +	if ((fw->log_type == LOG_TYPE_PLAINTEXT || 
> +	     fw->log_type == LOG_TYPE_HTML) && fw->total_run > 0) {		
>  		sorted = fwts_list_new();
>  		fwts_list_foreach(item, test_list)
>  			fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);

Tested-by: Chris Van Hoof <vanhoof@canonical.com>
diff mbox

Patch

diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
index f6f449a..19371ea 100644
--- a/src/lib/src/fwts_summary.c
+++ b/src/lib/src/fwts_summary.c
@@ -224,12 +224,26 @@  int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
 			fwts_list_foreach(item, fwts_summaries[i]) {
 				fwts_summary_item *summary_item = fwts_list_data(fwts_summary_item *,item);
 				char *lines = fwts_summary_lines(&summary_item->log_lines);
-				fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
-					summary_item->test,
-					fwts_list_len(&summary_item->log_lines),
-					fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
-					lines,
-					summary_item->text);
+			
+				/*
+				 *  This is not pleasant, we really don't want very wide lines
+				 *  logged in the HTML format, where we don't mind for other formats.
+				 */
+				if (fw->log_type == LOG_TYPE_HTML)
+					fwts_log_summary(fw, " %s test, at %d log line%s: %s: %s",
+						summary_item->test,
+						fwts_list_len(&summary_item->log_lines),
+						fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
+						lines,
+						summary_item->text);
+				else
+					fwts_log_summary_verbatum(fw, " %s test, at %d log line%s: %s: %s",
+						summary_item->test,
+						fwts_list_len(&summary_item->log_lines),
+						fwts_list_len(&summary_item->log_lines) > 1 ? "s" : "",
+						lines,
+						summary_item->text);
+
 				free(lines);
 			}
 			fwts_log_section_end(fw->results);
@@ -241,7 +255,8 @@  int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
 		fwts_log_nl(fw);
 	}
 
-	if (fw->log_type == LOG_TYPE_PLAINTEXT && fw->total_run > 0) {		
+	if ((fw->log_type == LOG_TYPE_PLAINTEXT || 
+	     fw->log_type == LOG_TYPE_HTML) && fw->total_run > 0) {		
 		sorted = fwts_list_new();
 		fwts_list_foreach(item, test_list)
 			fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);