From patchwork Tue Nov 13 18:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 10681355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 779DB14D6 for ; Tue, 13 Nov 2018 18:46:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 699362B2E8 for ; Tue, 13 Nov 2018 18:46:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64BF72B376; Tue, 13 Nov 2018 18:46:50 +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 EF1AF2B30F for ; Tue, 13 Nov 2018 18:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726883AbeKNEqL (ORCPT ); Tue, 13 Nov 2018 23:46:11 -0500 Received: from mga07.intel.com ([134.134.136.100]:33605 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbeKNEqL (ORCPT ); Tue, 13 Nov 2018 23:46:11 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 10:46:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,229,1539673200"; d="scan'208";a="89013170" Received: from ldmartin-desk.jf.intel.com ([10.24.10.170]) by orsmga007.jf.intel.com with ESMTP; 13 Nov 2018 10:46:48 -0800 From: Lucas De Marchi To: linux-modules@vger.kernel.org Cc: ykaliuta@redhat.com Subject: [PATCH] testsuite: add simple test for --show-exports Date: Tue, 13 Nov 2018 10:46:40 -0800 Message-Id: <20181113184640.3671-1-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.19.1.1.g56c4683e68 MIME-Version: 1.0 Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP --- testsuite/populate-modules.sh | 1 + .../test-modprobe/show-exports/correct.txt | 1 + testsuite/test-modprobe.c | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh index b77e71e..ba68a69 100755 --- a/testsuite/populate-modules.sh +++ b/testsuite/populate-modules.sh @@ -39,6 +39,7 @@ map=( ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko" ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko" ["test-modprobe/show-depends/lib/modules/4.4.4/kernel/mod-simple.ko"]="mod-simple.ko" + ["test-modprobe/show-exports/mod-loop-a.ko"]="mod-loop-a.ko" ["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko" ["test-modprobe/softdep-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko" ["test-modprobe/install-cmd-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko" diff --git a/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt b/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt new file mode 100644 index 0000000..bc2d045 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modprobe/show-exports/correct.txt @@ -0,0 +1 @@ +0x00000000 printA diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index ee9d82d..52a6621 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -95,6 +95,28 @@ DEFINE_TEST(modprobe_show_alias_to_none, ); +static noreturn int modprobe_show_exports(const struct test *t) +{ + const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe"; + const char *const args[] = { + progname, + "--show-exports", "--quiet", "/mod-loop-a.ko", + NULL, + }; + + test_spawn_prog(progname, args); + exit(EXIT_FAILURE); +} +DEFINE_TEST(modprobe_show_exports, + .description = "check if modprobe --show-depends doesn't explode with an alias to nothing", + .config = { + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-exports", + }, + .output = { + .out = TESTSUITE_ROOTFS "test-modprobe/show-exports/correct.txt", + }); + + static noreturn int modprobe_builtin(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";