From patchwork Thu Dec 19 13:18:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Xu X-Patchwork-Id: 1213369 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dsjt2JRnz9sQp for ; Fri, 20 Dec 2019 00:12:34 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 50F863C2384 for ; Thu, 19 Dec 2019 14:12:31 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id 991563C2284 for ; Thu, 19 Dec 2019 14:12:29 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 82F3B14012C9 for ; Thu, 19 Dec 2019 14:12:27 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 05:12:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,332,1571727600"; d="scan'208";a="390529908" Received: from xpf-desktop.sh.intel.com ([10.239.13.102]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2019 05:12:23 -0800 From: Pengfei Xu To: ltp , Pengfei Xu , Neri Ricardo , Su Heng , Cyril Hrubis Date: Thu, 19 Dec 2019 21:18:52 +0800 Message-Id: <20191219131855.28799-1-pengfei.xu@intel.com> X-Mailer: git-send-email 2.14.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v4 1/4] lib/tst_kconfig.c: Add any kconfig to match the expected value function X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Example: CONFIG_X86_INTEL_UMIP=y for umip kconfig before and v5.4 mainline kernel. CONFIG_X86_UMIP=y for umip kconfig after v5.5 mainline kernel. Format: CONFIG_X86_INTEL_UMIP|CONFIG_X86_UMIP=y Signed-off-by: Pengfei Xu Reviewed-by: Yang Xu --- lib/tst_kconfig.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c index 4b51413e5..74c46ebec 100644 --- a/lib/tst_kconfig.c +++ b/lib/tst_kconfig.c @@ -167,7 +167,8 @@ void tst_kconfig_read(const char *const *kconfigs, struct match matches[cnt]; FILE *fp; unsigned int i, j; - char buf[1024]; + char buf[1024], kconfig_multi[100]; + char *kconfig_token = NULL, *p_left = NULL; for (i = 0; i < cnt; i++) { const char *val = strchr(kconfigs[i], '='); @@ -176,12 +177,9 @@ void tst_kconfig_read(const char *const *kconfigs, tst_brk(TBROK, "Invalid config string '%s'", kconfigs[i]); matches[i].match = 0; - matches[i].len = strlen(kconfigs[i]); - if (val) { + if (val) matches[i].val = val + 1; - matches[i].len -= strlen(val); - } results[i].match = 0; results[i].value = NULL; @@ -193,17 +191,29 @@ void tst_kconfig_read(const char *const *kconfigs, while (fgets(buf, sizeof(buf), fp)) { for (i = 0; i < cnt; i++) { - if (match(&matches[i], kconfigs[i], &results[i], buf)) { - for (j = 0; j < cnt; j++) { - if (matches[j].match) - break; + memset(kconfig_multi, 0, sizeof(kconfig_multi)); + /* strtok_r will split kconfigs[i] to multi string, so copy it */ + memcpy(kconfig_multi, kconfigs[i], strlen(kconfigs[i])); + kconfig_token = strtok_r(kconfig_multi, "|=", &p_left); + + while (kconfig_token != NULL) { + if (strncmp("CONFIG_", kconfig_token, 7)) + tst_brk(TBROK, "Invalid config string '%s'", kconfig_token); + matches[i].len = strlen(kconfig_token); + if (match(&matches[i], kconfig_token, &results[i], buf)) { + for (j = 0; j < cnt; j++) { + if (matches[j].match) + break; + } } - - if (j == cnt) - goto exit; + kconfig_token = strtok_r(NULL, "|=", &p_left); + /* avoid to use after "=" string */ + if (strlen(p_left) == 0) + break; } + if (j == cnt) + goto exit; } - } exit: From patchwork Thu Dec 19 13:18:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Xu X-Patchwork-Id: 1213370 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dsk4258Fz9sQp for ; Fri, 20 Dec 2019 00:12:43 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A87CC3C2386 for ; Thu, 19 Dec 2019 14:12:40 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 6E6723C237D for ; Thu, 19 Dec 2019 14:12:30 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 8050A60067C for ; Thu, 19 Dec 2019 14:12:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 05:12:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,332,1571727600"; d="scan'208,223";a="390529912" Received: from xpf-desktop.sh.intel.com ([10.239.13.102]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2019 05:12:24 -0800 From: Pengfei Xu To: ltp , Pengfei Xu , Neri Ricardo , Su Heng , Cyril Hrubis Date: Thu, 19 Dec 2019 21:18:53 +0800 Message-Id: <20191219131855.28799-2-pengfei.xu@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20191219131855.28799-1-pengfei.xu@intel.com> References: <20191219131855.28799-1-pengfei.xu@intel.com> X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH v4 2/4] umip_basic_test.c: improve kconfig check to avoid umip wrong abort case X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From v5.5 main line, umip kconfig changed from "CONFIG_X86_INTEL_UMIP=y" to "CONFIG_X86_UMIP=y". We could use "CONFIG_X86_INTEL_UMIP|CONFIG_X86_UMIP=y" to check kconfig CONFIG_X86_INTEL_UMIP=y(old kernel) or CONFIG_X86_UMIP=y(new kernel) for umip. Signed-off-by: Pengfei Xu --- testcases/kernel/security/umip/umip_basic_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/kernel/security/umip/umip_basic_test.c b/testcases/kernel/security/umip/umip_basic_test.c index 1baa26c52..24eca8890 100644 --- a/testcases/kernel/security/umip/umip_basic_test.c +++ b/testcases/kernel/security/umip/umip_basic_test.c @@ -171,7 +171,7 @@ static struct tst_test test = { .forks_child = 1, .test = verify_umip_instruction, .needs_kconfigs = (const char *[]){ - "CONFIG_X86_INTEL_UMIP=y", + "CONFIG_X86_INTEL_UMIP|CONFIG_X86_UMIP=y", NULL }, .needs_root = 1, From patchwork Thu Dec 19 13:18:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Xu X-Patchwork-Id: 1213371 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dskF4Kx7z9sP3 for ; Fri, 20 Dec 2019 00:12:53 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8AC133C2382 for ; Thu, 19 Dec 2019 14:12:50 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id AB6A23C2385 for ; Thu, 19 Dec 2019 14:12:30 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 62BFC14016A6 for ; Thu, 19 Dec 2019 14:12:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 05:12:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,332,1571727600"; d="scan'208";a="390529917" Received: from xpf-desktop.sh.intel.com ([10.239.13.102]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2019 05:12:26 -0800 From: Pengfei Xu To: ltp , Pengfei Xu , Neri Ricardo , Su Heng , Cyril Hrubis Date: Thu, 19 Dec 2019 21:18:54 +0800 Message-Id: <20191219131855.28799-3-pengfei.xu@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20191219131855.28799-1-pengfei.xu@intel.com> References: <20191219131855.28799-1-pengfei.xu@intel.com> X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH v4 3/4] lib: add any kconfig to match the expected value function into kconfig test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" config01/02/03/04 should be passed for UMIP kconfig All cases in config05 should be failed. Signed-off-by: Pengfei Xu --- lib/newlib_tests/config01 | 1 + lib/newlib_tests/config02 | 1 + lib/newlib_tests/config03 | 1 + lib/newlib_tests/config04 | 1 + lib/newlib_tests/config05 | 2 ++ lib/newlib_tests/test_kconfig.c | 1 + 6 files changed, 7 insertions(+) diff --git a/lib/newlib_tests/config01 b/lib/newlib_tests/config01 index 96d68d836..085c9368c 100644 --- a/lib/newlib_tests/config01 +++ b/lib/newlib_tests/config01 @@ -2,3 +2,4 @@ CONFIG_MMU=y CONFIG_EXT4_FS=m CONFIG_PGTABLE_LEVELS=4 +CONFIG_X86_UMIP=y diff --git a/lib/newlib_tests/config02 b/lib/newlib_tests/config02 index 2de45cff8..ca71d26c1 100644 --- a/lib/newlib_tests/config02 +++ b/lib/newlib_tests/config02 @@ -2,3 +2,4 @@ # CONFIG_MMU is not set CONFIG_EXT4_FS=m CONFIG_PGTABLE_LEVELS=4 +CONFIG_X86_INTEL_UMIP=y diff --git a/lib/newlib_tests/config03 b/lib/newlib_tests/config03 index 1a3b9e648..8a92def74 100644 --- a/lib/newlib_tests/config03 +++ b/lib/newlib_tests/config03 @@ -2,3 +2,4 @@ CONFIG_MMU=y CONFIG_EXT4_FS=m CONFIG_PGTABLE_LEVELS=44 +CONFIG_X86_UMIP=y diff --git a/lib/newlib_tests/config04 b/lib/newlib_tests/config04 index cce7051ae..424157fec 100644 --- a/lib/newlib_tests/config04 +++ b/lib/newlib_tests/config04 @@ -1,4 +1,5 @@ # Unexpected CONFIG_EXT4_FS compiled in CONFIG_MMU=y CONFIG_EXT4_FS=y +CONFIG_X86_INTEL_UMIP=y CONFIG_PGTABLE_LEVELS=4 diff --git a/lib/newlib_tests/config05 b/lib/newlib_tests/config05 index a9d7bab4d..e68fa8913 100644 --- a/lib/newlib_tests/config05 +++ b/lib/newlib_tests/config05 @@ -1,3 +1,5 @@ # Everything is wrong CONFIG_EXT4_FS=y CONFIG_PGTABLE_LEVELS=44 +CONFIG_X86_UMI=y +CONFIG_X86_INT_UMIP=y diff --git a/lib/newlib_tests/test_kconfig.c b/lib/newlib_tests/test_kconfig.c index d9c662fc5..9515b60e2 100644 --- a/lib/newlib_tests/test_kconfig.c +++ b/lib/newlib_tests/test_kconfig.c @@ -14,6 +14,7 @@ static const char *kconfigs[] = { "CONFIG_MMU", "CONFIG_EXT4_FS=m", "CONFIG_PGTABLE_LEVELS=4", + "CONFIG_X86_INTEL_UMIP|CONFIG_X86_UMIP=y", NULL }; From patchwork Thu Dec 19 13:18:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Xu X-Patchwork-Id: 1213372 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dskR05fNz9sR4 for ; Fri, 20 Dec 2019 00:13:02 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id BC8693C23DE for ; Thu, 19 Dec 2019 14:12:59 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 45AF73C2382 for ; Thu, 19 Dec 2019 14:12:31 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 67451600F5B for ; Thu, 19 Dec 2019 14:12:30 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 05:12:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,332,1571727600"; d="scan'208";a="390529923" Received: from xpf-desktop.sh.intel.com ([10.239.13.102]) by orsmga005.jf.intel.com with ESMTP; 19 Dec 2019 05:12:27 -0800 From: Pengfei Xu To: ltp , Pengfei Xu , Neri Ricardo , Su Heng , Cyril Hrubis Date: Thu, 19 Dec 2019 21:18:55 +0800 Message-Id: <20191219131855.28799-4-pengfei.xu@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20191219131855.28799-1-pengfei.xu@intel.com> References: <20191219131855.28799-1-pengfei.xu@intel.com> X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH v4 4/4] lib: add any kconfig to match the expected value function document X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Pengfei Xu --- doc/test-writing-guidelines.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index 79d857fea..e64ff8716 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -1590,7 +1590,9 @@ aborted with 'TCONF' if any of the required options were not set. #include "tst_test.h" static const char *kconfigs[] = { - "CONFIG_X86_INTEL_UMIP", + "CONFIG_EXT4_FS=y", + "CONFIG_MMU", + "CONFIG_X86_INTEL_UMIP|CONFIG_X86_UMIP=y", NULL };