app/test-eventdev: fix terminal colour after control-c exit

Message ID 20211014095444.630505-1-harry.van.haaren@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series app/test-eventdev: fix terminal colour after control-c exit |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Van Haaren, Harry Oct. 14, 2021, 9:54 a.m. UTC
  Before this commit, a Control^C exit of the test-eventdev application
would print the worker packet percentages, and leave the terminal with
a green colour despite the colour reset being issued after the newline.
By moving the colour reset command before the \n the issue is fixed.

Fixes: 6b1a14a83a06 ("app/eventdev: add packet distribution logs")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Given this is an aesthetic only fix, I feel its not worth backporting.
Cc: pbhagavatula@marvell.com>

---
 app/test-eventdev/test_perf_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Pavan Nikhilesh Bhagavatula Oct. 18, 2021, 12:54 p.m. UTC | #1
>Before this commit, a Control^C exit of the test-eventdev application
>would print the worker packet percentages, and leave the terminal with
>a green colour despite the colour reset being issued after the newline.
>By moving the colour reset command before the \n the issue is fixed.
>
>Fixes: 6b1a14a83a06 ("app/eventdev: add packet distribution logs")
>
>Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

>---
>
>Given this is an aesthetic only fix, I feel its not worth backporting.
>Cc: pbhagavatula@marvell.com>
>
>---
> app/test-eventdev/test_perf_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/app/test-eventdev/test_perf_common.c b/app/test-
>eventdev/test_perf_common.c
>index e0d9f05ecd..a1b8dd72ee 100644
>--- a/app/test-eventdev/test_perf_common.c
>+++ b/app/test-eventdev/test_perf_common.c
>@@ -19,7 +19,7 @@ perf_test_result(struct evt_test *test, struct
>evt_options *opt)
> 		total += t->worker[i].processed_pkts;
> 	for (i = 0; i < t->nb_workers; i++)
> 		printf("Worker %d packets: "CLGRN"%"PRIx64"
>"CLNRM"percentage:"
>-				CLGRN" %3.2f\n"CLNRM, i,
>+				CLGRN" %3.2f"CLNRM"\n", i,
> 				t->worker[i].processed_pkts,
> 				(((double)t-
>>worker[i].processed_pkts)/total)
> 				* 100);
>--
>2.30.2
  
Jerin Jacob Oct. 20, 2021, 7:47 a.m. UTC | #2
On Mon, Oct 18, 2021 at 6:24 PM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
> >Before this commit, a Control^C exit of the test-eventdev application
> >would print the worker packet percentages, and leave the terminal with
> >a green colour despite the colour reset being issued after the newline.
> >By moving the colour reset command before the \n the issue is fixed.
> >
> >Fixes: 6b1a14a83a06 ("app/eventdev: add packet distribution logs")
> >
> >Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> >
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Applied to dpdk-next-eventdev/for-main. Thanks.



>
> >---
> >
> >Given this is an aesthetic only fix, I feel its not worth backporting.
> >Cc: pbhagavatula@marvell.com>
> >
> >---
> > app/test-eventdev/test_perf_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/app/test-eventdev/test_perf_common.c b/app/test-
> >eventdev/test_perf_common.c
> >index e0d9f05ecd..a1b8dd72ee 100644
> >--- a/app/test-eventdev/test_perf_common.c
> >+++ b/app/test-eventdev/test_perf_common.c
> >@@ -19,7 +19,7 @@ perf_test_result(struct evt_test *test, struct
> >evt_options *opt)
> >               total += t->worker[i].processed_pkts;
> >       for (i = 0; i < t->nb_workers; i++)
> >               printf("Worker %d packets: "CLGRN"%"PRIx64"
> >"CLNRM"percentage:"
> >-                              CLGRN" %3.2f\n"CLNRM, i,
> >+                              CLGRN" %3.2f"CLNRM"\n", i,
> >                               t->worker[i].processed_pkts,
> >                               (((double)t-
> >>worker[i].processed_pkts)/total)
> >                               * 100);
> >--
> >2.30.2
>
  

Patch

diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index e0d9f05ecd..a1b8dd72ee 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -19,7 +19,7 @@  perf_test_result(struct evt_test *test, struct evt_options *opt)
 		total += t->worker[i].processed_pkts;
 	for (i = 0; i < t->nb_workers; i++)
 		printf("Worker %d packets: "CLGRN"%"PRIx64" "CLNRM"percentage:"
-				CLGRN" %3.2f\n"CLNRM, i,
+				CLGRN" %3.2f"CLNRM"\n", i,
 				t->worker[i].processed_pkts,
 				(((double)t->worker[i].processed_pkts)/total)
 				* 100);