All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mykola Lysenko" <nickolay.lysenko@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v2 2/3] selftests/bpf: move shared build definitions into Makefile.buildvars
Date: Tue, 21 Jul 2026 19:52:16 +0000	[thread overview]
Message-ID: <20260721195216.712FC1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721194111.334795-3-nickolay.lysenko@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The variables TEST_KMODS and BPF_GCC are duplicated in both Makefile and Makefile.buildvars, creating a brittle maintenance hazard.
--

--- Patch [2]: [RFC PATCH bpf-next v2 2/3] selftests/bpf: move shared build definitions into Makefile.buildvars ---
commit 609eb873658507425701a592c055f112cedbb6b8
Author: Mykola Lysenko <nickolay.lysenko@gmail.com>

selftests/bpf: move shared build definitions into Makefile.buildvars

This commit moves toolchain, path, flag, and probe definitions from the main
Makefile into a new Makefile.buildvars file. This allows these definitions
to be included by multiple makefiles for running test instances in sub-makes.

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 09e5be201afb5..2ddcb812dc85c 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> +# These probes gate the flavor list, which must be final before lib.mk is
> +# included; keep values consistent with Makefile.buildvars.
> +ifeq ($(origin BPF_GCC),undefined)
> +BPF_GCC := $(shell command -v bpf-gcc;)
>  endif
[ ... ]
> -TEST_KMODS := bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
> +TEST_KMODS ?= bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
>  	bpf_test_modorder_y.ko bpf_test_rqspinlock.ko
[ ... ]
> diff --git a/tools/testing/selftests/bpf/Makefile.buildvars b/tools/testing/selftests/bpf/Makefile.buildvars
> new file mode 100644
> index 0000000000000..2a7efe6d1c795
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/Makefile.buildvars
[ ... ]
> +# Immediate (with an override-preserving guard): a plain ?= stays
> +# recursively expanded and would re-run 'command -v' on every expansion.
> +ifeq ($(origin BPF_GCC),undefined)
> +BPF_GCC		:= $(shell command -v bpf-gcc;)
> +endif
[ ... ]
> +# Kernel test modules; TEST_KMODS= on the command line disables them.
> +TEST_KMODS ?= bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
> +	bpf_test_modorder_y.ko bpf_test_rqspinlock.ko

[Severity: Medium]
Does keeping duplicate definitions of TEST_KMODS and BPF_GCC in both Makefile
and Makefile.buildvars create a maintenance hazard?

Since Makefile defines TEST_KMODS with "?=" before including
Makefile.buildvars, if a developer adds a new test module to
Makefile.buildvars but forgets to update Makefile, the new module won't
be built because the Makefile definition takes precedence and ignores the
update.

Could these definitions be consolidated into a single location to prevent
silent build failures from desynchronized lists?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721194111.334795-1-nickolay.lysenko@gmail.com?part=2

  reply	other threads:[~2026-07-21 19:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 19:41 [RFC PATCH bpf-next v2 0/3] selftests/bpf: restructure the Makefile as a layered build Mykola Lysenko
2026-07-21 19:41 ` [RFC PATCH bpf-next v2 1/3] selftests/bpf: extract BPF skeleton generation into a helper script Mykola Lysenko
2026-07-21 19:41 ` [RFC PATCH bpf-next v2 2/3] selftests/bpf: move shared build definitions into Makefile.buildvars Mykola Lysenko
2026-07-21 19:52   ` sashiko-bot [this message]
2026-07-21 19:41 ` [RFC PATCH bpf-next v2 3/3] selftests/bpf: build each test runner instance in its own sub-make Mykola Lysenko
2026-07-21 19:51   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260721195216.712FC1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=nickolay.lysenko@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.