lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8f3bb4a8-80cd-547e-df65-2d17827362f0@nvidia.com>
Date:   Wed, 14 Jun 2023 16:27:18 -0700
From:   John Hubbard <jhubbard@...dia.com>
To:     Anders Roxell <anders.roxell@...aro.org>
CC:     <shuah@...nel.org>, <linux-kselftest@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <usama.anjum@...labora.com>
Subject: Re: [PATCH] selftests: lib.mk: fix out-of-tree builds

On 6/14/23 14:16, Anders Roxell wrote:
>> (It's too bad that we have all this duplication between the Makefile
>> and lib.mk.)
> 
> I agree, also the duplication of get_sys_includes in bpf, hid and net Makefile's
> Do you have any idea how we can remove the duplication?
> 

Well, since you asked... :)

Yes. Given that the goal is to support two similar, related activities:
	a) make -C tools/testing/selftests
	b) make -C tools/testing/selftests/<subtest>

, we could move common functionality into common_vars.mk and
common_targets.mk, and include those from both the top level
tools/testing/selftests/Makefile, and the subtest Makefiles.

This allows deduplication in a fairly safe sort of way, because it also
simultaneously moves everything to a non-recursive Make design. That's
especially nice, because then dependencies work reliably, and you also
don't have to worry about propagating Make variables (via Make's export
directive).

I haven't done this, because a few years ago I somehow got the vague
impression that it would not be well-received. But maybe that's
pessimistic and/or obsolete--times change, after all!

***************************************************************
Contents of tools/testing/selftests/Makefile:

include common_vars.mk

include alsa/alsa.mk
include amd-pstate/amd-pstate.mk
include arm64/arm64.mk
...etc, there are 100+ subdirs

include common_targets.mk

(This is instead of doing "TARGETS += xxx" in the Makefile. Including
the subtest *.mk fragments allows each subtest to add features and
quirks as necessary, while also enabling full dependency checking via a
true non-recursive Make.)

***************************************************************
Contents of tools/testing/selftests/common_targets.mk:

all: kernel_headers
     ...

Other rules/targets here.

***************************************************************
Contents of tools/testing/selftests/common_vars.mk:

Common variables, some of which may be overridden by a Makefile.

***************************************************************

Using alsa as an example of a subtest:

***************************************************************
Contents of tools/testing/selftests/alsa/alsa.mk:
TARGETS += alsa

TEST* items

Plus: alsa-specific items, such as:
CFLAGS += $(shell pkg-config --cflags alsa)

***************************************************************
Contents of tools/testing/selftests/alsa/Makefile:

include ../common_vars.mk
include alsa.mk

...maybe very little else needs to go here.

include ../common_targets.mk


thanks,
-- 
John Hubbard
NVIDIA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ