From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id C3FD85AAB for ; Tue, 17 May 2016 09:06:07 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id n129so127102700wmn.1 for ; Tue, 17 May 2016 00:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=x98lmwe5uZTpKxJUjAnaOjX0unXhHtzkFLhDkFb9bxk=; b=ehzaFJtU55GK8dqBtRBvvqY9BpoPSUvx5lpCrhynBpJ/4c3wWIf0//gXv0dYi/uar2 NHhnCHA69RLk2//0hzW+SQo88f0vAjoYMBuEfaMlrPQpSbpMltnxwN0YOVC7SSWG4HBF Ak5I4cPVfYdpHO4PsnqGUSm/q+JB9Nw2R8FD/y116TvKZ8YEO0JxelJzo5slv/Ex7iCc 2Ix6/o2BWxpQesWFvUtBA11NBkX4GT6HQdgEQp9pengnngWRGO3zSfAwhzwY+lugB0VE +OAkRhBu+pRFxg3oe+nsHdPwTMP+zIgaGbbVkTYbfc4sVb89N+JSsaYXZQC2evcHola5 SNoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=x98lmwe5uZTpKxJUjAnaOjX0unXhHtzkFLhDkFb9bxk=; b=BOB3EbVZR/eYNOcH+8ujIBHEpPoVvMvSxkgAZy5IvWwmzY56ZH09ttbq+QgBqEeilg C8o59WILNExpCdFhZ4FI2hiQhGBUCYfls60v29XkijpDtowkl6yxkw84/rcAxQMe36Ck Qf8hjjKbZpOO1JcF42m9NG+6scniLNCR61Dli3EMnK1yZ9N69KnsQbHY76U4bBOirdFL /8PUYD3w4u3bn4nErBtJ/peFNjuRnRd/l3fxj6cuEQB7pXwPJUvPuzLps45NplY0Eg+8 rpFjdSQEGVPpwiketaSgZ0zPFu2cBcRin9bAOeW4HWSdbezC8WS3dDRnLjWm9seOp6Jg KQVA== X-Gm-Message-State: AOPr4FWadomaOP1aR8ef5r3a6+JPXCljX6XMAP8Vf9iFC9RXOHtXvUI8oXAcpUw6oDDl+gib X-Received: by 10.28.194.69 with SMTP id s66mr22906359wmf.88.1463468767602; Tue, 17 May 2016 00:06:07 -0700 (PDT) Received: from XPS13.localdomain ([37.160.16.188]) by smtp.gmail.com with ESMTPSA id b12sm22284056wmb.0.2016.05.17.00.06.05 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 May 2016 00:06:06 -0700 (PDT) From: Thomas Monjalon To: dev@dpdk.org Date: Tue, 17 May 2016 09:05:49 +0200 Message-Id: <1463468749-22097-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2] app/test: fix log check when default level is high X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2016 07:06:07 -0000 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 --- 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