eal: change the log level for test assert macro

Message ID 20200715202006.19781-1-honnappa.nagarahalli@arm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series eal: change the log level for test assert macro |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Honnappa Nagarahalli July 15, 2020, 8:20 p.m. UTC
  Change the log level for RTE_TEST_ASSERT macro to error to help
log errors while running test cases.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 lib/librte_eal/include/rte_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Aaron Conole July 16, 2020, 1 p.m. UTC | #1
Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:

> Change the log level for RTE_TEST_ASSERT macro to error to help
> log errors while running test cases.
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---

Is the default to always have ERROR log level on?  If so:

Acked-by: Aaron Conole <aconole@redhat.com>

:-)
  
David Marchand July 16, 2020, 3:06 p.m. UTC | #2
On Wed, Jul 15, 2020 at 10:20 PM Honnappa Nagarahalli
<honnappa.nagarahalli@arm.com> wrote:
>
> Change the log level for RTE_TEST_ASSERT macro to error to help
> log errors while running test cases.
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
>  lib/librte_eal/include/rte_test.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/include/rte_test.h b/lib/librte_eal/include/rte_test.h
> index 89e47f47a..62c8f165a 100644
> --- a/lib/librte_eal/include/rte_test.h
> +++ b/lib/librte_eal/include/rte_test.h
> @@ -18,7 +18,7 @@
>
>  #define RTE_TEST_ASSERT(cond, msg, ...) do {                                  \
>         if (!(cond)) {                                                        \
> -               RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: "         \
> +               RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
>                                 msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
>                 RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);         \
>                 return -1;                                                    \
> --
> 2.17.1
>

I proposed it, so I can't disagree :-)

RTE_TEST_ASSERT* are used in eventdev driver selftests.
I don't see why more output in error cases would be detrimental.
Any objection?

Thanks.
  
Lukasz Wojciechowski July 16, 2020, 3:16 p.m. UTC | #3
W dniu 15.07.2020 o 22:20, Honnappa Nagarahalli pisze:
> Change the log level for RTE_TEST_ASSERT macro to error to help
> log errors while running test cases.
>
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
>   lib/librte_eal/include/rte_test.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/include/rte_test.h b/lib/librte_eal/include/rte_test.h
> index 89e47f47a..62c8f165a 100644
> --- a/lib/librte_eal/include/rte_test.h
> +++ b/lib/librte_eal/include/rte_test.h
> @@ -18,7 +18,7 @@
>   
>   #define RTE_TEST_ASSERT(cond, msg, ...) do {                                  \
>   	if (!(cond)) {                                                        \
> -		RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: "         \
> +		RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
>   				msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
>   		RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);         \
>   		return -1;                                                    \
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
  
Honnappa Nagarahalli July 16, 2020, 6:40 p.m. UTC | #4
<snip>

> Subject: Re: [PATCH] eal: change the log level for test assert macro
> 
> Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> writes:
> 
> > Change the log level for RTE_TEST_ASSERT macro to error to help log
> > errors while running test cases.
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> > ---
> 
> Is the default to always have ERROR log level on?  If so:
It is on currently

> 
> Acked-by: Aaron Conole <aconole@redhat.com>
> 
> :-)
  
Honnappa Nagarahalli July 16, 2020, 6:41 p.m. UTC | #5
<snip>

> Subject: Re: [PATCH] eal: change the log level for test assert macro
> 
> On Wed, Jul 15, 2020 at 10:20 PM Honnappa Nagarahalli
> <honnappa.nagarahalli@arm.com> wrote:
> >
> > Change the log level for RTE_TEST_ASSERT macro to error to help log
> > errors while running test cases.
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> > ---
> >  lib/librte_eal/include/rte_test.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/include/rte_test.h
> > b/lib/librte_eal/include/rte_test.h
> > index 89e47f47a..62c8f165a 100644
> > --- a/lib/librte_eal/include/rte_test.h
> > +++ b/lib/librte_eal/include/rte_test.h
> > @@ -18,7 +18,7 @@
> >
> >  #define RTE_TEST_ASSERT(cond, msg, ...) do {                                  \
> >         if (!(cond)) {                                                        \
> > -               RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: "         \
> > +               RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
> >                                 msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
> >                 RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);         \
> >                 return -1;                                                    \
> > --
> > 2.17.1
> >
> 
> I proposed it, so I can't disagree :-)
Forgot to add you to suggested-by. Fixed it in v2 😊

> 
> RTE_TEST_ASSERT* are used in eventdev driver selftests.
> I don't see why more output in error cases would be detrimental.
> Any objection?
> 
> Thanks.
> 
> --
> David Marchand
  

Patch

diff --git a/lib/librte_eal/include/rte_test.h b/lib/librte_eal/include/rte_test.h
index 89e47f47a..62c8f165a 100644
--- a/lib/librte_eal/include/rte_test.h
+++ b/lib/librte_eal/include/rte_test.h
@@ -18,7 +18,7 @@ 
 
 #define RTE_TEST_ASSERT(cond, msg, ...) do {                                  \
 	if (!(cond)) {                                                        \
-		RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: "         \
+		RTE_LOG(ERR, EAL, "Test assert %s line %d failed: "           \
 				msg "\n", __func__, __LINE__, ##__VA_ARGS__); \
 		RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);         \
 		return -1;                                                    \