]> git.droids-corp.org - dpdk.git/commitdiff
app/test: fix log check when default level is high
authorThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 4 May 2016 13:18:29 +0000 (15:18 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 24 May 2016 15:00:55 +0000 (17:00 +0200)
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
app/test/test_logs.c

index 0f012f6b75db144da775c3a52c0c21c144671935..adbd8c983a8ece6515179ec2f4cea3f1ab6b34fd 100644 (file)
@@ -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:
index 18a3b6aa386c8959aa8ae8c0343db75fe92c5eda..05aa862c7073cf3244737ff4b087c37baa349a2c 100644 (file)
@@ -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;