From patchwork Mon Feb 6 14:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 13130000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69C1DC61DA4 for ; Mon, 6 Feb 2023 14:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231429AbjBFOH6 (ORCPT ); Mon, 6 Feb 2023 09:07:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbjBFOHi (ORCPT ); Mon, 6 Feb 2023 09:07:38 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 605772B2A9 for ; Mon, 6 Feb 2023 06:05:08 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso10869721wms.0 for ; Mon, 06 Feb 2023 06:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nGdWqnZSbKRssP5heC6adBvLX0QWY9/QH/+MlM4kKBY=; b=dSHXsCprBlKGORBc1atLAzXz28aWSf91dB1Fb8qU+vwIU4B/FdV+ufz9Ijnotp9Wag +DkPYdUYa+xR5M9pA8nmzhXU6Y1LclPti6GmwhoYvOA0KlWom6bNyI5qpwQG1Cz66+Ht dm25ODCDFe1m2jk43GPg7aPQJ1MdtO635jpeAn/veGiJKrlUotrSly6ImLSkkfUT9XMu 6iQ8WiKVnRRUymkC8eOBT84c41LFSFUIOZiJGuCr/Mgu3+SF4e6Nak1rakyp77mEeXfO ddIaGHjiBjsXptNObwJapCNpT2BAo8NPwHh/RLa7/g9xjJTakl5J42p2oeQfYSnm/AZi HA9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nGdWqnZSbKRssP5heC6adBvLX0QWY9/QH/+MlM4kKBY=; b=k1XB9Oq8vn9d6GZu+Ls0Dts0800dH8yIbYYvzFH/QDJoX4MLz0NbMdA4MU9k8UiZZC BFTB5QjgAz1/QGqS/WIo9EgSmHeym0I0JgEXYJQI8BfcJkqt1mIC31n2bvB6EIDMygqV NvlC/Y57JzmoweauGHJb0lL10CN0yvW8tjcNSvOH2y20Ymmkm0nZ8uN05zezs9aUlN0i g/ydedu0Y9zBNUi12ApYIjlBay/wlVLx6e2ZIznNC9sIyEBdwKY4oT5uoP1qVUjbV4Jh QI44TUD3eJepZgrBMg2CRlIl18PG1A8IyAuNFoY6htKgvXiJ8aKs15EZqFT063rThQim d+SA== X-Gm-Message-State: AO0yUKW+5oUWFJx8PDXbBeqSV2s0fm6qpvV9ZLcd3MpVwWSecuS4+I/o TRlK6n8drDA+/VymC9XenXrZS+ZA/2c= X-Google-Smtp-Source: AK7set8tMBq/Ec+B0fEL6py5UfBX7dlPk0ulG37gJAQ9OrkZmG+4tcVZWfcRANH3411xKaySwZv/cw== X-Received: by 2002:a05:600c:1d04:b0:3cf:85f7:bbc4 with SMTP id l4-20020a05600c1d0400b003cf85f7bbc4mr19564273wms.2.1675692291972; Mon, 06 Feb 2023 06:04:51 -0800 (PST) Received: from localhost ([2a00:5f00:102:0:9503:21c4:e16b:65c3]) by smtp.gmail.com with UTF8SMTPSA id x33-20020a05600c18a100b003dd7edcc960sm10718585wmp.45.2023.02.06.06.04.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 06:04:51 -0800 (PST) From: Emil Velikov To: linux-modules@vger.kernel.org Cc: emil.l.velikov@gmail.com Subject: [PATCH 1/4] treewide: add some static const notations Date: Mon, 6 Feb 2023 14:04:46 +0000 Message-Id: <20230206140449.574631-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206140449.574631-1-emil.l.velikov@gmail.com> References: <20230206140449.574631-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: From: Emil Velikov Signed-off-by: Emil Velikov --- libkmod/libkmod-module.c | 4 ++-- libkmod/libkmod.c | 4 ++-- testsuite/test-new-module.c | 8 ++++---- testsuite/test-util.c | 4 ++-- testsuite/testsuite.c | 2 +- tools/depmod.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index 12d8ed1..c7232e0 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -551,7 +551,7 @@ KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx, const char *given_alias, struct kmod_list **list) { - const lookup_func lookup[] = { + static const lookup_func lookup[] = { kmod_lookup_alias_from_config, kmod_lookup_alias_from_moddep_file, kmod_lookup_alias_from_symbols_file, @@ -619,7 +619,7 @@ KMOD_EXPORT int kmod_module_new_from_name_lookup(struct kmod_ctx *ctx, const char *modname, struct kmod_module **mod) { - const lookup_func lookup[] = { + static const lookup_func lookup[] = { kmod_lookup_alias_from_moddep_file, kmod_lookup_alias_from_builtin_file, kmod_lookup_alias_from_kernel_builtin_file, diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index 7c2b889..2670f9a 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -50,7 +50,7 @@ * and is passed to all library operations. */ -static struct _index_files { +static const struct { const char *fn; const char *prefix; } index_files[] = { @@ -61,7 +61,7 @@ static struct _index_files { [KMOD_INDEX_MODULES_BUILTIN] = { .fn = "modules.builtin", .prefix = ""}, }; -static const char *default_config_paths[] = { +static const char *const default_config_paths[] = { SYSCONFDIR "/modprobe.d", "/run/modprobe.d", "/usr/local/lib/modprobe.d", diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c index 360065c..9872b78 100644 --- a/testsuite/test-new-module.c +++ b/testsuite/test-new-module.c @@ -29,7 +29,7 @@ static int from_name(const struct test *t) { - static const char *modnames[] = { + static const char *const modnames[] = { "ext4", "balbalbalbbalbalbalbalbalbalbal", "snd-hda-intel", @@ -37,7 +37,7 @@ static int from_name(const struct test *t) "iTCO_wdt", NULL, }; - const char **p; + const char *const *p; struct kmod_ctx *ctx; struct kmod_module *mod; const char *null_config = NULL; @@ -72,11 +72,11 @@ DEFINE_TEST(from_name, static int from_alias(const struct test *t) { - static const char *modnames[] = { + static const char *const modnames[] = { "ext4.*", NULL, }; - const char **p; + const char *const *p; struct kmod_ctx *ctx; int err; diff --git a/testsuite/test-util.c b/testsuite/test-util.c index 5766584..e3243e8 100644 --- a/testsuite/test-util.c +++ b/testsuite/test-util.c @@ -31,7 +31,7 @@ static int alias_1(const struct test *t) { - static const char *input[] = { + static const char *const input[] = { "test1234", "test[abcfoobar]2211", "bar[aaa][bbbb]sss", @@ -42,7 +42,7 @@ static int alias_1(const struct test *t) char buf[PATH_MAX]; size_t len; - const char **alias; + const char *const *alias; for (alias = input; *alias != NULL; alias++) { int ret; diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index 6a2d296..318343a 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -53,7 +53,7 @@ static const struct option options[] = { #define OVERRIDE_LIBDIR ABS_TOP_BUILDDIR "/testsuite/.libs/" #define TEST_TIMEOUT_USEC 2 * USEC_PER_SEC -struct _env_config { +static const struct { const char *key; const char *ldpreload; } env_config[_TC_LAST] = { diff --git a/tools/depmod.c b/tools/depmod.c index 5536597..a2c39b3 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -50,7 +50,7 @@ static int verbose = DEFAULT_VERBOSE; static const char CFG_BUILTIN_KEY[] = "built-in"; static const char CFG_EXTERNAL_KEY[] = "external"; -static const char *default_cfg_paths[] = { +static const char *const default_cfg_paths[] = { SYSCONFDIR "/depmod.d", "/run/depmod.d", "/usr/local/lib/depmod.d", From patchwork Mon Feb 6 14:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 13130001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3490FC636D6 for ; Mon, 6 Feb 2023 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbjBFOH6 (ORCPT ); Mon, 6 Feb 2023 09:07:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbjBFOHi (ORCPT ); Mon, 6 Feb 2023 09:07:38 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309AD2B2BB for ; Mon, 6 Feb 2023 06:05:09 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id q8so8744579wmo.5 for ; Mon, 06 Feb 2023 06:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C5LBPPC6VJqJRGNnqIbBmTwVGauwH0wWFkN7euAdafw=; b=kY9Ard9iCQYfY5vM4vOfLX45sOo4rw1lsmEh0K/m/h9nWYLpatCPvWcs5gi2Shk7ty B20yJUYjAr6vQZAah2ouvmezGNGN0DniHOqyWR1l1Xe/Yl/5Jsd9dUP/D6SqmAZQy7pC FaHUIv2U0XNnX3fseCRMqPTsrYmuFDpYDBhxp9/MxKIts0kltR4sqQ4B9X93/Q/HdHkd br+EqLJ3AX1t8I3yf2JK7fX4uKChlrYaskiu8XGVkoiS4Xe5JWSxG4uqQ8PfDGjDwPJn x/k0EpJFn5OS7T8fgCJvp+bjCJ1z57aJTqxoYKVzX0C0Wjs/PaxtD7VHlvfwshsuHm+Y EBaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C5LBPPC6VJqJRGNnqIbBmTwVGauwH0wWFkN7euAdafw=; b=v0pKuBD0ANLfen+G1mPycLissOCEusq0Gib/2CXJqUAqK2Dd4Dgb0yhnrWDi39xTbY YN8efB8hmjNDBwzbbOtGbZisnvKkC5lXaaSzgMnnkSEznrFXOWPLPQuB7Hl1wce7eEeA R6KnFEyMlUI9/IZQEI74ddkTNff2oFxO06fU522ZpMSO4pjorv4BD3SeqrYOMwOPbAsd lH+/4vJUlI91OHgJtSHXypvI929MLOrQf8IMb4P1BMUpubj66KbgeJpoFaceNgQcocif g6neB1RH2ZmGlYacwt4D5LSSh2BR5U0ZyJblcrweqQjxNCXCy8A29j2eBUQIyXYmfUmg 1XTA== X-Gm-Message-State: AO0yUKWhZAA2r25Vw2VdvgvIl1wzfCGyttzT/z2SF8whPK15jGqhdfc+ Wek3HQ1eV7S7w4erxE9elNgzV007KH4= X-Google-Smtp-Source: AK7set+HVty+N9H/R+myPq4+Ae5oXSa4x8SI8kjZnCW8DrtkLLAW/lix7+E+/+CIUPcfwlGe2zBxxw== X-Received: by 2002:a05:600c:4f83:b0:3e0:11a:3849 with SMTP id n3-20020a05600c4f8300b003e0011a3849mr1346856wmq.39.1675692292947; Mon, 06 Feb 2023 06:04:52 -0800 (PST) Received: from localhost ([2a00:5f00:102:0:9503:21c4:e16b:65c3]) by smtp.gmail.com with UTF8SMTPSA id n10-20020a05600c4f8a00b003e0010a9f67sm3647969wmq.44.2023.02.06.06.04.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 06:04:52 -0800 (PST) From: Emil Velikov To: linux-modules@vger.kernel.org Cc: emil.l.velikov@gmail.com Subject: [PATCH 2/4] testsuite: add function declarations for __xstat family Date: Mon, 6 Feb 2023 14:04:47 +0000 Message-Id: <20230206140449.574631-3-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206140449.574631-1-emil.l.velikov@gmail.com> References: <20230206140449.574631-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: From: Emil Velikov As the inline comment says - the declarations have been dropped with glibc 2.32.9000, as a result the build throws a set of lovely warnings. Inspired by umockdev, which bears the same license as this project. https://github.com/martinpitt/umockdev/commit/f1b416400479d861deffb4c5a40422dcdf190e85 Signed-off-by: Emil Velikov Reviewed-by: Lucas De Marchi --- testsuite/path.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testsuite/path.c b/testsuite/path.c index c1ae498..5a291b1 100644 --- a/testsuite/path.c +++ b/testsuite/path.c @@ -163,8 +163,15 @@ TS_EXPORT int open ## suffix (const char *path, int flags, ...) \ return _fn(p, flags); \ } -/* wrapper template for __xstat family */ +/* + * wrapper template for __xstat family + * This family got deprecated/dropped in glibc 2.32.9000, but we still need + * to keep it for a while for programs that were built against previous versions + */ #define WRAP_VERSTAT(prefix, suffix) \ +TS_EXPORT int prefix ## stat ## suffix (int ver, \ + const char *path, \ + struct stat ## suffix *st); \ TS_EXPORT int prefix ## stat ## suffix (int ver, \ const char *path, \ struct stat ## suffix *st) \ From patchwork Mon Feb 6 14:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 13130002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDA2DC63797 for ; Mon, 6 Feb 2023 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231437AbjBFOH6 (ORCPT ); Mon, 6 Feb 2023 09:07:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231444AbjBFOHj (ORCPT ); Mon, 6 Feb 2023 09:07:39 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A617B2B2AD for ; Mon, 6 Feb 2023 06:05:10 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id n13so8745441wmr.4 for ; Mon, 06 Feb 2023 06:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ctRx9fT9L3vd/ciSZN+DpcKSqEvWjIAFf6OeQLFe/ts=; b=gYumNrmQWbVIW77Z/TDyXANqPNjvS77fsHxxSrX+OhwZQEjrZd42kAMKlehgBEQ/Ws WpQ4KioHVijrmD0z81srS4xEGGPDmhrmPEJNyOVxVLlpsIFqC4/ILBTj+vDvmUWmmb8x DmWftratePofCp6UBKCOuXK4eHyXNqadDYHJBqYs63bprIxudSuzQVvs9OvxwA1h60hK e1TwDhQZXA5EMzl0rs7H82FvbupiuOriufE0mbHEvBt70Ffq6Vlbjej5tB+878QR20Ad c1G/LSLocyChvtlqwRRBCLU8B8QCaq9t/037FfeGgqAS8UfRS52u/y22wNQo+d1RqGe2 UHxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ctRx9fT9L3vd/ciSZN+DpcKSqEvWjIAFf6OeQLFe/ts=; b=KcPPYJ8XmWm8XeKFvECtNzMdWTM1Z++h88noUfnNiy3lQgxP9Cu4d2iJb/yoRnlK5F xK2xyXJpZZPA74EBAZO6/8tShG+p/x7wEH2iKKzDof2aEZjK1KBj0+QLqTjaD9S1uVa2 xMgEO1XF9khLrQUylJ2xt98MmImM5tZbL2dJzIXUJtSa5DQqfw2rfnYJHsEMlsVZ+7oJ 9Xt/wA8EG0nlDXb7iskc3XUvLQycCMRH6C+VVsW+p8+A3f+DbN/CTwWOJptZ9S1raEaZ hfDqqNPtouCcjUmZlWlgZL7+suSoeusIU6I2SxhDbQBzqdP/dvQb1vUR4ohjAKN2jSMf Bf+Q== X-Gm-Message-State: AO0yUKX9xAKywEpOOWOUGqbL1dIiFTypC/2zYf5l0Sb/ZV2/Hje5TH5U vf8uxYqxRYJX7jttqbFOlkWISnk43G4= X-Google-Smtp-Source: AK7set9jZqLVpIFEKFBPQHBU0xMERSY22+XlJNtmDwlucrUkGaC4713QbtZwKSHMR9jwpi6aThn/ng== X-Received: by 2002:a05:600c:4f4d:b0:3dc:57e8:1d1c with SMTP id m13-20020a05600c4f4d00b003dc57e81d1cmr1343733wmq.9.1675692293975; Mon, 06 Feb 2023 06:04:53 -0800 (PST) Received: from localhost ([2a00:5f00:102:0:9503:21c4:e16b:65c3]) by smtp.gmail.com with UTF8SMTPSA id p17-20020a05600c205100b003dd1bd0b915sm13094689wmg.22.2023.02.06.06.04.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 06:04:53 -0800 (PST) From: Emil Velikov To: linux-modules@vger.kernel.org Cc: emil.l.velikov@gmail.com Subject: [PATCH 3/4] testsuite: fixup KMOD_SYSCONFDIR_NOT_ETC tests Date: Mon, 6 Feb 2023 14:04:48 +0000 Message-Id: <20230206140449.574631-4-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206140449.574631-1-emil.l.velikov@gmail.com> References: <20230206140449.574631-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: From: Emil Velikov Currently some tests lack a config segment in `.../etc`, yet they're skipped when KMOD_SYSCONFDIR_NOT_ETC is set. Inversely - some tests have a config snippet, yet are not skipped. Go through the lot and fix them all. While there make sure we use tab for code indentation, as per the style guide. Signed-off-by: Emil Velikov --- NOTE: this is based off my earlier patch adding outdir. If this patch is applied prior the depmod_modules_outdir hunk should be dropped. --- testsuite/test-blacklist.c | 2 +- testsuite/test-depmod.c | 22 +++++++++++----------- testsuite/test-modprobe.c | 7 +++++-- testsuite/test-new-module.c | 3 +++ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/testsuite/test-blacklist.c b/testsuite/test-blacklist.c index d03eedb..6531fa2 100644 --- a/testsuite/test-blacklist.c +++ b/testsuite/test-blacklist.c @@ -96,7 +96,7 @@ fail_lookup: DEFINE_TEST(blacklist_1, #if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, + .skip = true, #endif .description = "check if modules are correctly blacklisted", .config = { diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index 6465230..010f259 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -41,9 +41,6 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t) } DEFINE_TEST(depmod_modules_order_for_compressed, -#if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, -#endif .description = "check if depmod let aliases in right order when using compressed modules", .config = { [TC_UNAME_R] = MODULES_ORDER_UNAME, @@ -75,9 +72,6 @@ static noreturn int depmod_modules_outdir(const struct test *t) } DEFINE_TEST(depmod_modules_outdir, -#if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, -#endif .description = "check if depmod honours the outdir option", .config = { [TC_UNAME_R] = MODULES_OUTDIR_UNAME, @@ -104,6 +98,9 @@ static noreturn int depmod_search_order_simple(const struct test *t) exit(EXIT_FAILURE); } DEFINE_TEST(depmod_search_order_simple, +#if defined(KMOD_SYSCONFDIR_NOT_ETC) + .skip = true, +#endif .description = "check if depmod honor search order in config", .config = { [TC_UNAME_R] = "4.4.4", @@ -130,6 +127,9 @@ static noreturn int depmod_search_order_same_prefix(const struct test *t) exit(EXIT_FAILURE); } DEFINE_TEST(depmod_search_order_same_prefix, +#if defined(KMOD_SYSCONFDIR_NOT_ETC) + .skip = true, +#endif .description = "check if depmod honor search order in config with same prefix", .config = { [TC_UNAME_R] = "4.4.4", @@ -156,9 +156,6 @@ static noreturn int depmod_detect_loop(const struct test *t) exit(EXIT_FAILURE); } DEFINE_TEST(depmod_detect_loop, -#if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, -#endif .description = "check if depmod detects module loops correctly", .config = { [TC_UNAME_R] = "4.4.4", @@ -183,7 +180,7 @@ static noreturn int depmod_search_order_external_first(const struct test *t) } DEFINE_TEST(depmod_search_order_external_first, #if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, + .skip = true, #endif .description = "check if depmod honor external keyword with higher priority", .config = { @@ -211,6 +208,9 @@ static noreturn int depmod_search_order_external_last(const struct test *t) exit(EXIT_FAILURE); } DEFINE_TEST(depmod_search_order_external_last, +#if defined(KMOD_SYSCONFDIR_NOT_ETC) + .skip = true, +#endif .description = "check if depmod honor external keyword with lower priority", .config = { [TC_UNAME_R] = "4.4.4", @@ -238,7 +238,7 @@ static noreturn int depmod_search_order_override(const struct test *t) } DEFINE_TEST(depmod_search_order_override, #if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, + .skip = true, #endif .description = "check if depmod honor override keyword", .config = { diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c index 3ddb976..6b763d8 100644 --- a/testsuite/test-modprobe.c +++ b/testsuite/test-modprobe.c @@ -84,7 +84,7 @@ static noreturn int modprobe_show_alias_to_none(const struct test *t) } DEFINE_TEST(modprobe_show_alias_to_none, #if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, + .skip = true, #endif .description = "check if modprobe --show-depends doesn't explode with an alias to nothing", .config = { @@ -176,7 +176,7 @@ static noreturn int modprobe_softdep_loop(const struct test *t) } DEFINE_TEST(modprobe_softdep_loop, #if defined(KMOD_SYSCONFDIR_NOT_ETC) - .skip = true, + .skip = true, #endif .description = "check if modprobe breaks softdep loop", .config = { @@ -200,6 +200,9 @@ static noreturn int modprobe_install_cmd_loop(const struct test *t) exit(EXIT_FAILURE); } DEFINE_TEST(modprobe_install_cmd_loop, +#if defined(KMOD_SYSCONFDIR_NOT_ETC) + .skip = true, +#endif .description = "check if modprobe breaks install-commands loop", .config = { [TC_UNAME_R] = "4.4.4", diff --git a/testsuite/test-new-module.c b/testsuite/test-new-module.c index 9872b78..dcb9934 100644 --- a/testsuite/test-new-module.c +++ b/testsuite/test-new-module.c @@ -106,6 +106,9 @@ static int from_alias(const struct test *t) return EXIT_SUCCESS; } DEFINE_TEST(from_alias, +#if defined(KMOD_SYSCONFDIR_NOT_ETC) + .skip = true, +#endif .description = "check if aliases are parsed correctly", .config = { [TC_ROOTFS] = TESTSUITE_ROOTFS "test-new-module/from_alias/", From patchwork Mon Feb 6 14:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 13130003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5DBFC6379F for ; Mon, 6 Feb 2023 14:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbjBFOIA (ORCPT ); Mon, 6 Feb 2023 09:08:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbjBFOHl (ORCPT ); Mon, 6 Feb 2023 09:07:41 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C96A2B601 for ; Mon, 6 Feb 2023 06:05:11 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id q8so8744660wmo.5 for ; Mon, 06 Feb 2023 06:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lHamnqqe8JBTkyQJ0qbtdVhkEvR3h+VdbLtXBit5Lfk=; b=kxr8sZ6YpJyYkltbbrtODapduabkio8K1UtoJOkqiKGUaFCinHkDJdjX7NtKQeWUu6 yrR1F2mxvQwBdFi2ggmY6EVIlx6qDhayH/gbN4/WGXZibZqF5UZ9gUy6WRhQL3p4TfT0 wIFzvAp6tQ+LG93RAFUaKwdgcmxwQjeicERgrLSCw2iEqcYmSfyCtn7MyFptQlR7Bdw2 2iaqWAqVOROjmBXD+iYIx3Tq/8yECVk90xvcLkPN9L8LkqdBy5+21bV8VbgEOj4NHJ2H QOt2lRP64y56IpSWjMDaHAvbWiE9Qi6yPLmoMoGoId/p8RikDmzHHCk7nYktFCSiUCNA ss0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lHamnqqe8JBTkyQJ0qbtdVhkEvR3h+VdbLtXBit5Lfk=; b=ukzWvDpL9xh1Caw+2MDXjIW80p55WuBpLNm2GYRv0TPK+87241+DNlP0ikqQLDDBwi hp8xbVqni3W0Vwg1oy1KdRyUOGrGRTAS5u3oKTQYtZU8exfN4ECaOPvGhXcIgFUSVqEk UL1lq2euCfDLXG4/d4zXIvqzStRjYTMru6DJMgTzqkjQVRBHpM/2JUP+/KY/ynenKRed dcqQWQzr7WVYlqDpNFjbvUCZ0cm+AT1CToEI1ji4XTvXCRqOme3UNiaU7aSO5GblMm/p +9whF36qcWLr1K5iDbeSo9Xr4YyLEO3HJoZd7i/vy+FrH1CK8heoe7OLa/4aYcN5E8P/ WDvQ== X-Gm-Message-State: AO0yUKUwl3Z3E6IXrowT3B5UsafDQJJlULIGWKceC1Q+aAEq9yDYvrXU +oND7CcRojbxkCyT+Hw3ay4mPf0OTnY= X-Google-Smtp-Source: AK7set8RCGTmIGVjc7bpoOE5JUVNHQ8r0R5Z0jAHQWND1WDiVn0DpwKVq7QthiuMUpr0QpYuFo9j0Q== X-Received: by 2002:a05:600c:43c5:b0:3dc:5674:66e6 with SMTP id f5-20020a05600c43c500b003dc567466e6mr19570966wmn.25.1675692294943; Mon, 06 Feb 2023 06:04:54 -0800 (PST) Received: from localhost ([2a00:5f00:102:0:9503:21c4:e16b:65c3]) by smtp.gmail.com with UTF8SMTPSA id t8-20020a05600c198800b003dff870ce0esm5334759wmq.2.2023.02.06.06.04.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 06:04:54 -0800 (PST) From: Emil Velikov To: linux-modules@vger.kernel.org Cc: emil.l.velikov@gmail.com Subject: [PATCH 4/4] testsuite/depmod: use defines for the rootfs/lib_modules Date: Mon, 6 Feb 2023 14:04:49 +0000 Message-Id: <20230206140449.574631-5-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206140449.574631-1-emil.l.velikov@gmail.com> References: <20230206140449.574631-1-emil.l.velikov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: From: Emil Velikov The uname used across the tests is same, so drop "_ORDER" from the macro name and use it throughout. Similarly - add respective LIB_MODULES defines and use them in the tests. Signed-off-by: Emil Velikov --- testsuite/test-depmod.c | 50 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c index 010f259..b333e7b 100644 --- a/testsuite/test-depmod.c +++ b/testsuite/test-depmod.c @@ -25,9 +25,9 @@ #include "testsuite.h" -#define MODULES_ORDER_UNAME "4.4.4" +#define MODULES_UNAME "4.4.4" #define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed" -#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME +#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_modules_order_for_compressed(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -43,7 +43,7 @@ static noreturn int depmod_modules_order_for_compressed(const struct test *t) DEFINE_TEST(depmod_modules_order_for_compressed, .description = "check if depmod let aliases in right order when using compressed modules", .config = { - [TC_UNAME_R] = MODULES_ORDER_UNAME, + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = MODULES_ORDER_ROOTFS, }, .output = { @@ -54,10 +54,9 @@ DEFINE_TEST(depmod_modules_order_for_compressed, }, }); -#define MODULES_OUTDIR_UNAME "4.4.4" #define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir" -#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_OUTDIR_UNAME -#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_OUTDIR_UNAME +#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_UNAME +#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_modules_outdir(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -74,7 +73,7 @@ static noreturn int depmod_modules_outdir(const struct test *t) DEFINE_TEST(depmod_modules_outdir, .description = "check if depmod honours the outdir option", .config = { - [TC_UNAME_R] = MODULES_OUTDIR_UNAME, + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = MODULES_OUTDIR_ROOTFS, }, .output = { @@ -86,6 +85,7 @@ DEFINE_TEST(depmod_modules_outdir, }); #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple" +#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_search_order_simple(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -103,18 +103,19 @@ DEFINE_TEST(depmod_search_order_simple, #endif .description = "check if depmod honor search order in config", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = SEARCH_ORDER_SIMPLE_ROOTFS, }, .output = { .files = (const struct keyval[]) { - { SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", - SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { SEARCH_ORDER_SIMPLE_LIB_MODULES "/correct-modules.dep", + SEARCH_ORDER_SIMPLE_LIB_MODULES "/modules.dep" }, { } }, }); #define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix" +#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_search_order_same_prefix(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -132,13 +133,13 @@ DEFINE_TEST(depmod_search_order_same_prefix, #endif .description = "check if depmod honor search order in config with same prefix", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = SEARCH_ORDER_SAME_PREFIX_ROOTFS, }, .output = { .files = (const struct keyval[]) { - { SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", - SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/correct-modules.dep", + SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/modules.dep" }, { } }, }); @@ -158,7 +159,7 @@ static noreturn int depmod_detect_loop(const struct test *t) DEFINE_TEST(depmod_detect_loop, .description = "check if depmod detects module loops correctly", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = DETECT_LOOP_ROOTFS, }, .expected_fail = true, @@ -167,6 +168,7 @@ DEFINE_TEST(depmod_detect_loop, }); #define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first" +#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_search_order_external_first(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -184,18 +186,19 @@ DEFINE_TEST(depmod_search_order_external_first, #endif .description = "check if depmod honor external keyword with higher priority", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS, }, .output = { .files = (const struct keyval[]) { - { SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", - SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/correct-modules.dep", + SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/modules.dep" }, { } }, }); #define SEARCH_ORDER_EXTERNAL_LAST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-last" +#define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_search_order_external_last(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -213,18 +216,19 @@ DEFINE_TEST(depmod_search_order_external_last, #endif .description = "check if depmod honor external keyword with lower priority", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_LAST_ROOTFS, }, .output = { .files = (const struct keyval[]) { - { SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep", - SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/modules.dep" }, + { SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/correct-modules.dep", + SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/modules.dep" }, { } }, }); #define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override" +#define SEARCH_ORDER_OVERRIDE_LIB_MODULES SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/" MODULES_UNAME static noreturn int depmod_search_order_override(const struct test *t) { const char *progname = ABS_TOP_BUILDDIR "/tools/depmod"; @@ -242,13 +246,13 @@ DEFINE_TEST(depmod_search_order_override, #endif .description = "check if depmod honor override keyword", .config = { - [TC_UNAME_R] = "4.4.4", + [TC_UNAME_R] = MODULES_UNAME, [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" }, + { SEARCH_ORDER_OVERRIDE_LIB_MODULES "/correct-modules.dep", + SEARCH_ORDER_OVERRIDE_LIB_MODULES "/modules.dep" }, { } }, });