From patchwork Thu Dec 7 19:16:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 10100899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 368B16056F for ; Thu, 7 Dec 2017 19:16:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2912A2860F for ; Thu, 7 Dec 2017 19:16:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E06128658; Thu, 7 Dec 2017 19:16:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9D712860F for ; Thu, 7 Dec 2017 19:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752470AbdLGTQN (ORCPT ); Thu, 7 Dec 2017 14:16:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbdLGTQM (ORCPT ); Thu, 7 Dec 2017 14:16:12 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E4E2D7E421; Thu, 7 Dec 2017 19:16:11 +0000 (UTC) Received: from astarta.redhat.com (ovpn-116-86.ams2.redhat.com [10.36.116.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 315C25C3F9; Thu, 7 Dec 2017 19:16:11 +0000 (UTC) From: Yauheni Kaliuta To: Lucas De Marchi Cc: linux-modules Subject: [PATCH 1/2] testsuite: depmod: add override test Date: Thu, 7 Dec 2017 21:16:07 +0200 Message-Id: <20171207191608.14293-2-yauheni.kaliuta@redhat.com> In-Reply-To: <20171207191608.14293-1-yauheni.kaliuta@redhat.com> References: <20171207191608.14293-1-yauheni.kaliuta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 07 Dec 2017 19:16:11 +0000 (UTC) Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Simple test to check if depmod honors override keyword. Uses mod-simple.ko for foo/ and override/ directories, search.conf to search in foo and built-in and simple override configuration: override mod-simple 4.4.4 override The resulting modules.dep should point to the override directory. Signed-off-by: Yauheni Kaliuta --- testsuite/populate-modules.sh | 2 ++ .../etc/depmod.d/override.conf | 1 + .../search-order-override/etc/depmod.d/search.conf | 1 + .../lib/modules/4.4.4/correct-modules.dep | 1 + testsuite/test-depmod.c | 26 ++++++++++++++++++++++ 5 files changed, 31 insertions(+) create mode 100644 testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf create mode 100644 testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf create mode 100644 testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh index 3ac92ee8030d..b77e71edf0a4 100755 --- a/testsuite/populate-modules.sh +++ b/testsuite/populate-modules.sh @@ -28,6 +28,8 @@ map=( ["test-depmod/search-order-external-last/lib/modules/4.4.4/foo/"]="mod-simple.ko" ["test-depmod/search-order-external-last/lib/modules/4.4.4/foobar/"]="mod-simple.ko" ["test-depmod/search-order-external-last/lib/modules/external/"]="mod-simple.ko" + ["test-depmod/search-order-override/lib/modules/4.4.4/foo/"]="mod-simple.ko" + ["test-depmod/search-order-override/lib/modules/4.4.4/override/"]="mod-simple.ko" ["test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko" ["test-dependencies/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko" ["test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko" diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf new file mode 100644 index 000000000000..fadf8112c26a --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/override.conf @@ -0,0 +1 @@ +override mod-simple 4.4.4 override diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf new file mode 100644 index 000000000000..289ddcdd4152 --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/etc/depmod.d/search.conf @@ -0,0 +1 @@ +search foo built-in diff --git a/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep b/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep new file mode 100644 index 000000000000..4c7ea8e08c8e --- /dev/null +++ b/testsuite/rootfs-pristine/test-depmod/search-order-override/lib/modules/4.4.4/correct-modules.dep @@ -0,0 +1 @@ +override/mod-simple.ko: diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index e249c61515dc..47dafb4dd618 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -183,4 +183,30 @@ DEFINE_TEST(depmod_search_order_external_last, }, }); +#define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override" +static noreturn int depmod_search_order_override(const struct test *t) +{ + const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; + const char *const args[] = { + progname, + NULL, + }; + + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +DEFINE_TEST(depmod_search_order_override, + .description = "check if depmod honor override keyword", + .config = { + [TC_UNAME_R] = "4.4.4", + [TC_ROOTFS] = SEARCH_ORDER_OVERRIDE_ROOTFS, + }, + .output = { + .files = (const struct keyval[]) { + { SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", + SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { } + }, + }); + TESTSUITE_MAIN();