* [dpdk-dev] [PATCH] app/test: fix log check when default level is high
@ 2016-05-04 13:34 Thomas Monjalon
2016-05-17 6:54 ` David Marchand
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2016-05-04 13:34 UTC (permalink / raw)
To: dev
The log unit test was checking display of low priority messages.
It was not working if RTE_LOG_LEVEL is not RTE_LOG_DEBUG.
It is even easier to see since the default level is INFO (9b9d7ca).
Now the test use ERR and CRIT levels which should be always enabled
while not trigerring syslog output on the console.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
app/test/autotest_test_funcs.py | 20 ++++++++------------
app/test/test_logs.c | 20 +++++++++-----------
2 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/app/test/autotest_test_funcs.py b/app/test/autotest_test_funcs.py
index 0f012f6..f04909d 100644
--- a/app/test/autotest_test_funcs.py
+++ b/app/test/autotest_test_funcs.py
@@ -145,18 +145,14 @@ def logs_autotest(child, test_name):
child.sendline(test_name)
log_list = [
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a info level message",
- "TESTAPP1: this is a warning level message",
- "TESTAPP2: this is a info level message",
- "TESTAPP2: this is a warning level message",
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a info level message",
- "TESTAPP1: this is a warning level message",
- "TESTAPP2: this is a info level message",
- "TESTAPP2: this is a warning level message",
- "TESTAPP1: this is a debug level message",
+ "TESTAPP1: error message",
+ "TESTAPP1: critical message",
+ "TESTAPP2: critical message",
+ "TESTAPP1: error message",
+ "TESTAPP1: error message",
+ "TESTAPP1: critical message",
+ "TESTAPP2: critical message",
+ "TESTAPP1: error message",
]
for log_msg in log_list:
diff --git a/app/test/test_logs.c b/app/test/test_logs.c
index 18a3b6a..861cdff 100644
--- a/app/test/test_logs.c
+++ b/app/test/test_logs.c
@@ -66,24 +66,22 @@ test_logs(void)
rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 1);
/* log in debug level */
- rte_set_log_level(RTE_LOG_DEBUG);
- RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
- RTE_LOG(INFO, TESTAPP1, "this is a info level message\n");
- RTE_LOG(WARNING, TESTAPP1, "this is a warning level message\n");
+ rte_set_log_level(RTE_LOG_ERR);
+ RTE_LOG(ERR, TESTAPP1, "error message\n");
+ RTE_LOG(CRIT, TESTAPP1, "critical message\n");
/* log in info level */
- rte_set_log_level(RTE_LOG_INFO);
- RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
- RTE_LOG(INFO, TESTAPP2, "this is a info level message\n");
- RTE_LOG(WARNING, TESTAPP2, "this is a warning level message\n");
+ rte_set_log_level(RTE_LOG_CRIT);
+ RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
+ RTE_LOG(CRIT, TESTAPP2, "critical message\n");
/* disable one log type */
rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 0);
/* log in debug level */
- rte_set_log_level(RTE_LOG_DEBUG);
- RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
- RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
+ rte_set_log_level(RTE_LOG_ERR);
+ RTE_LOG(ERR, TESTAPP1, "error message\n");
+ RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
rte_log_dump_history(stdout);
--
2.7.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] app/test: fix log check when default level is high
2016-05-04 13:34 [dpdk-dev] [PATCH] app/test: fix log check when default level is high Thomas Monjalon
@ 2016-05-17 6:54 ` David Marchand
2016-05-17 7:05 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: David Marchand @ 2016-05-17 6:54 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
Hello Thomas,
On Wed, May 4, 2016 at 3:34 PM, Thomas Monjalon
<thomas.monjalon@6wind.com> wrote:
> The log unit test was checking display of low priority messages.
> It was not working if RTE_LOG_LEVEL is not RTE_LOG_DEBUG.
> It is even easier to see since the default level is INFO (9b9d7ca).
>
> Now the test use ERR and CRIT levels which should be always enabled
> while not trigerring syslog output on the console.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
> app/test/autotest_test_funcs.py | 20 ++++++++------------
> app/test/test_logs.c | 20 +++++++++-----------
> 2 files changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/app/test/autotest_test_funcs.py b/app/test/autotest_test_funcs.py
> index 0f012f6..f04909d 100644
> --- a/app/test/autotest_test_funcs.py
> +++ b/app/test/autotest_test_funcs.py
> @@ -145,18 +145,14 @@ def logs_autotest(child, test_name):
> child.sendline(test_name)
>
> log_list = [
> - "TESTAPP1: this is a debug level message",
> - "TESTAPP1: this is a info level message",
> - "TESTAPP1: this is a warning level message",
> - "TESTAPP2: this is a info level message",
> - "TESTAPP2: this is a warning level message",
> - "TESTAPP1: this is a debug level message",
> - "TESTAPP1: this is a debug level message",
> - "TESTAPP1: this is a info level message",
> - "TESTAPP1: this is a warning level message",
> - "TESTAPP2: this is a info level message",
> - "TESTAPP2: this is a warning level message",
> - "TESTAPP1: this is a debug level message",
> + "TESTAPP1: error message",
> + "TESTAPP1: critical message",
> + "TESTAPP2: critical message",
> + "TESTAPP1: error message",
> + "TESTAPP1: error message",
> + "TESTAPP1: critical message",
> + "TESTAPP2: critical message",
> + "TESTAPP1: error message",
Since this list is tighly coupled to test_logs.c, a little comment on
why the messages are declared twice in this list would help.
> ]
>
> for log_msg in log_list:
> diff --git a/app/test/test_logs.c b/app/test/test_logs.c
> index 18a3b6a..861cdff 100644
> --- a/app/test/test_logs.c
> +++ b/app/test/test_logs.c
> @@ -66,24 +66,22 @@ test_logs(void)
> rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 1);
>
> /* log in debug level */
> - rte_set_log_level(RTE_LOG_DEBUG);
> - RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
> - RTE_LOG(INFO, TESTAPP1, "this is a info level message\n");
> - RTE_LOG(WARNING, TESTAPP1, "this is a warning level message\n");
> + rte_set_log_level(RTE_LOG_ERR);
> + RTE_LOG(ERR, TESTAPP1, "error message\n");
> + RTE_LOG(CRIT, TESTAPP1, "critical message\n");
Comment is wrong, should be about error level.
>
> /* log in info level */
> - rte_set_log_level(RTE_LOG_INFO);
> - RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
> - RTE_LOG(INFO, TESTAPP2, "this is a info level message\n");
> - RTE_LOG(WARNING, TESTAPP2, "this is a warning level message\n");
> + rte_set_log_level(RTE_LOG_CRIT);
> + RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
> + RTE_LOG(CRIT, TESTAPP2, "critical message\n");
Idem.
>
> /* disable one log type */
> rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 0);
>
> /* log in debug level */
> - rte_set_log_level(RTE_LOG_DEBUG);
> - RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
> - RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
> + rte_set_log_level(RTE_LOG_ERR);
> + RTE_LOG(ERR, TESTAPP1, "error message\n");
> + RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
Idem.
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] app/test: fix log check when default level is high
2016-05-17 6:54 ` David Marchand
@ 2016-05-17 7:05 ` Thomas Monjalon
2016-05-24 15:15 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2016-05-17 7:05 UTC (permalink / raw)
To: dev
The log unit test was checking display of low priority messages.
It was not working if RTE_LOG_LEVEL is not RTE_LOG_DEBUG.
It is even easier to see since the default level is INFO (9b9d7ca).
Now the test use ERR and CRIT levels which should be always enabled
while not trigerring syslog output on the console.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
v2:
- fix comments for the log levels
- add comments to explain the test
app/test/autotest_test_funcs.py | 21 +++++++++------------
app/test/test_logs.c | 27 +++++++++++++--------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/app/test/autotest_test_funcs.py b/app/test/autotest_test_funcs.py
index 0f012f6..adbd8c9 100644
--- a/app/test/autotest_test_funcs.py
+++ b/app/test/autotest_test_funcs.py
@@ -144,19 +144,16 @@ def logs_autotest(child, test_name):
i = 0
child.sendline(test_name)
+ # logs sequence is printed twice because of history dump
log_list = [
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a info level message",
- "TESTAPP1: this is a warning level message",
- "TESTAPP2: this is a info level message",
- "TESTAPP2: this is a warning level message",
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a debug level message",
- "TESTAPP1: this is a info level message",
- "TESTAPP1: this is a warning level message",
- "TESTAPP2: this is a info level message",
- "TESTAPP2: this is a warning level message",
- "TESTAPP1: this is a debug level message",
+ "TESTAPP1: error message",
+ "TESTAPP1: critical message",
+ "TESTAPP2: critical message",
+ "TESTAPP1: error message",
+ "TESTAPP1: error message",
+ "TESTAPP1: critical message",
+ "TESTAPP2: critical message",
+ "TESTAPP1: error message",
]
for log_msg in log_list:
diff --git a/app/test/test_logs.c b/app/test/test_logs.c
index 18a3b6a..05aa862 100644
--- a/app/test/test_logs.c
+++ b/app/test/test_logs.c
@@ -65,26 +65,25 @@ test_logs(void)
rte_set_log_type(RTE_LOGTYPE_TESTAPP1, 1);
rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 1);
- /* log in debug level */
- rte_set_log_level(RTE_LOG_DEBUG);
- RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
- RTE_LOG(INFO, TESTAPP1, "this is a info level message\n");
- RTE_LOG(WARNING, TESTAPP1, "this is a warning level message\n");
+ /* log in error level */
+ rte_set_log_level(RTE_LOG_ERR);
+ RTE_LOG(ERR, TESTAPP1, "error message\n");
+ RTE_LOG(CRIT, TESTAPP1, "critical message\n");
- /* log in info level */
- rte_set_log_level(RTE_LOG_INFO);
- RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
- RTE_LOG(INFO, TESTAPP2, "this is a info level message\n");
- RTE_LOG(WARNING, TESTAPP2, "this is a warning level message\n");
+ /* log in critical level */
+ rte_set_log_level(RTE_LOG_CRIT);
+ RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
+ RTE_LOG(CRIT, TESTAPP2, "critical message\n");
/* disable one log type */
rte_set_log_type(RTE_LOGTYPE_TESTAPP2, 0);
- /* log in debug level */
- rte_set_log_level(RTE_LOG_DEBUG);
- RTE_LOG(DEBUG, TESTAPP1, "this is a debug level message\n");
- RTE_LOG(DEBUG, TESTAPP2, "debug level message (not displayed)\n");
+ /* log in error level */
+ rte_set_log_level(RTE_LOG_ERR);
+ RTE_LOG(ERR, TESTAPP1, "error message\n");
+ RTE_LOG(ERR, TESTAPP2, "error message (not displayed)\n");
+ /* print again the previous logs */
rte_log_dump_history(stdout);
return 0;
--
2.7.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] app/test: fix log check when default level is high
2016-05-17 7:05 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2016-05-24 15:15 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-05-24 15:15 UTC (permalink / raw)
To: dev
2016-05-17 09:05, Thomas Monjalon:
> The log unit test was checking display of low priority messages.
> It was not working if RTE_LOG_LEVEL is not RTE_LOG_DEBUG.
> It is even easier to see since the default level is INFO (9b9d7ca).
>
> Now the test use ERR and CRIT levels which should be always enabled
> while not trigerring syslog output on the console.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
> v2:
> - fix comments for the log levels
> - add comments to explain the test
Applied
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-24 15:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 13:34 [dpdk-dev] [PATCH] app/test: fix log check when default level is high Thomas Monjalon
2016-05-17 6:54 ` David Marchand
2016-05-17 7:05 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2016-05-24 15:15 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).