<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/lib.mk, branch v6.6.132</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-10-17T13:24:13+00:00</updated>
<entry>
<title>selftests: Introduce Makefile variable to list shared bash scripts</title>
<updated>2024-10-17T13:24:13+00:00</updated>
<author>
<name>Benjamin Poirier</name>
<email>bpoirier@nvidia.com</email>
</author>
<published>2024-01-26T23:21:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=66c43605be895a022386cb52322ac7f9ef1aafca'/>
<id>urn:sha1:66c43605be895a022386cb52322ac7f9ef1aafca</id>
<content type='text'>
[ Upstream commit 2a0683be5b4c9829e8335e494a21d1148e832822 ]

Some tests written in bash source other files in a parent directory. For
example, drivers/net/bonding/dev_addr_lists.sh sources
net/forwarding/lib.sh. If a subset of tests is exported and run outside the
source tree (for example by using `make -C tools/testing/selftests gen_tar
TARGETS="drivers/net/bonding"`), these other files must be made available
as well.

Commit ae108c48b5d2 ("selftests: net: Fix cross-tree inclusion of scripts")
addressed this problem by symlinking and copying the sourced files but this
only works for direct dependencies. Commit 25ae948b4478 ("selftests/net:
add lib.sh") changed net/forwarding/lib.sh to source net/lib.sh. As a
result, that latter file must be included as well when the former is
exported. This was not handled and was reverted in commit 2114e83381d3
("selftests: forwarding: Avoid failures to source net/lib.sh"). In order to
allow reinstating the inclusion of net/lib.sh from net/forwarding/lib.sh,
add a mechanism to list dependent files in a new Makefile variable and
export them. This allows sourcing those files using the same expression
whether tests are run in-tree or exported.

Dependencies are not resolved recursively so transitive dependencies must
be listed in TEST_INCLUDES. For example, if net/forwarding/lib.sh sources
net/lib.sh; the Makefile related to a test that sources
net/forwarding/lib.sh from a parent directory must list:
TEST_INCLUDES := \
	../../../net/forwarding/lib.sh \
	../../../net/lib.sh

v2:
Fix rst syntax in Documentation/dev-tools/kselftest.rst (Jakub Kicinski)

v1 (from RFC):
* changed TEST_INCLUDES to take relative paths, like other TEST_* variables
  (Vladimir Oltean)
* preserved common "$(MAKE) OUTPUT=... -C ... target" ordering in Makefile
  (Petr Machata)

Signed-off-by: Benjamin Poirier &lt;bpoirier@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: default to host arch for LLVM builds</title>
<updated>2024-06-12T09:11:49+00:00</updated>
<author>
<name>Valentin Obst</name>
<email>kernel@valentinobst.de</email>
</author>
<published>2024-03-29T10:49:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d43d30aafb875bbf51b5f3cdf07275151fe5f82'/>
<id>urn:sha1:2d43d30aafb875bbf51b5f3cdf07275151fe5f82</id>
<content type='text'>
[ Upstream commit d4e6fbd245c48b272cc591d1c5e7c07aedd7f071 ]

Align the behavior for gcc and clang builds by interpreting unset
`ARCH` and `CROSS_COMPILE` variables in `LLVM` builds as a sign that the
user wants to build for the host architecture.

This patch preserves the properties that setting the `ARCH` variable to an
unknown value will trigger an error that complains about insufficient
information, and that a set `CROSS_COMPILE` variable will override the
target triple that is determined based on presence/absence of `ARCH`.

When compiling with clang, i.e., `LLVM` is set, an unset `ARCH` variable in
combination with an unset `CROSS_COMPILE` variable, i.e., compiling for
the host architecture, leads to compilation failures since `lib.mk` can
not determine the clang target triple. In this case, the following error
message is displayed for each subsystem that does not set `ARCH` in its
own Makefile before including `lib.mk` (lines wrapped at 75 chrs):

  make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
   sysctl'
  ../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
   lib.mk.  Stop.
  make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
   sysctl'

In the same scenario a gcc build would default to the host architecture,
i.e., it would use plain `gcc`.

Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Valentin Obst &lt;kernel@valentinobst.de&gt;
Reviewed-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Revert "selftests: error out if kernel header files are not yet built"</title>
<updated>2023-12-20T16:02:01+00:00</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2023-12-09T02:01:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d228e98dfacb205d4e9ae181f5a8f467e28fc777'/>
<id>urn:sha1:d228e98dfacb205d4e9ae181f5a8f467e28fc777</id>
<content type='text'>
commit 43e8832fed08438e2a27afed9bac21acd0ceffe5 upstream.

This reverts commit 9fc96c7c19df ("selftests: error out if kernel header
files are not yet built").

It turns out that requiring the kernel headers to be built as a
prerequisite to building selftests, does not work in many cases. For
example, Peter Zijlstra writes:

"My biggest beef with the whole thing is that I simply do not want to use
'make headers', it doesn't work for me.

I have a ton of output directories and I don't care to build tools into
the output dirs, in fact some of them flat out refuse to work that way
(bpf comes to mind)." [1]

Therefore, stop erroring out on the selftests build. Additional patches
will be required in order to change over to not requiring the kernel
headers.

[1] https://lore.kernel.org/20231208221007.GO28727@noisy.programming.kicks-ass.net

Link: https://lkml.kernel.org/r/20231209020144.244759-1-jhubbard@nvidia.com
Fixes: 9fc96c7c19df ("selftests: error out if kernel header files are not yet built")
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Cc: Anders Roxell &lt;anders.roxell@linaro.org&gt;
Cc: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Cc: David Hildenbrand &lt;david@redhat.com&gt;
Cc: Peter Xu &lt;peterx@redhat.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Nathan Chancellor &lt;nathan@kernel.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Marcos Paulo de Souza &lt;mpdesouza@suse.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: Keep symlinks, when possible</title>
<updated>2023-09-08T16:06:56+00:00</updated>
<author>
<name>Björn Töpel</name>
<email>bjorn@rivosinc.com</email>
</author>
<published>2023-08-22T13:58:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f3f384139ed147c71e1d770accf610133d5309b'/>
<id>urn:sha1:3f3f384139ed147c71e1d770accf610133d5309b</id>
<content type='text'>
When kselftest is built/installed with the 'gen_tar' target, rsync is
used for the installation step to copy files. Extra care is needed for
tests that have symlinks. Commit ae108c48b5d2 ("selftests: net: Fix
cross-tree inclusion of scripts") added '-L' (transform symlink into
referent file/dir) to rsync, to fix dangling links. However, that
broke some tests where the symlink (being a symlink) is part of the
test (e.g. exec:execveat).

Use rsync's '--copy-unsafe-links' that does right thing.

Fixes: ae108c48b5d2 ("selftests: net: Fix cross-tree inclusion of scripts")
Signed-off-by: Björn Töpel &lt;bjorn@rivosinc.com&gt;
Reviewed-by: Benjamin Poirier &lt;bpoirier@nvidia.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: error out if kernel header files are not yet built</title>
<updated>2023-06-19T23:19:03+00:00</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2023-06-06T07:16:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9fc96c7c19dfab67bf81b25fbc4f49b7752d5060'/>
<id>urn:sha1:9fc96c7c19dfab67bf81b25fbc4f49b7752d5060</id>
<content type='text'>
As per a discussion with Muhammad Usama Anjum [1], the following is how
one is supposed to build selftests:

    make headers &amp;&amp; make -C tools/testing/selftests/mm

Change the selftest build system's lib.mk to fail out with a helpful
message if that prerequisite "make headers" has not been done yet.

[1] https://lore.kernel.org/all/bf910fa5-0c96-3707-cce4-5bcc656b6274@collabora.com/

[jhubbard@nvidia.com: abort the make process the first time headers aren't detected]
  Link: https://lkml.kernel.org/r/14573e7e-f2ad-ff34-dfbd-3efdebee51ed@nvidia.com
[anders.roxell@linaro.org: fix out-of-tree builds]
  Link: https://lkml.kernel.org/r/20230613074931.666966-1-anders.roxell@linaro.org
Link: https://lkml.kernel.org/r/20230606071637.267103-12-jhubbard@nvidia.com
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Signed-off-by: Anders Roxell &lt;anders.roxell@linaro.org&gt;
Reviewed-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Tested-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Cc: David Hildenbrand &lt;david@redhat.com&gt;
Cc: Peter Xu &lt;peterx@redhat.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Nathan Chancellor &lt;nathan@kernel.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: fix LLVM build for i386 and x86_64</title>
<updated>2023-03-10T20:41:10+00:00</updated>
<author>
<name>Guillaume Tucker</name>
<email>guillaume.tucker@collabora.com</email>
</author>
<published>2022-08-09T14:22:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=624c60f326c6e5a80b008e8a5c7feffe8c27dc72'/>
<id>urn:sha1:624c60f326c6e5a80b008e8a5c7feffe8c27dc72</id>
<content type='text'>
Add missing cases for the i386 and x86_64 architectures when
determining the LLVM target for building kselftest.

Fixes: 795285ef2425 ("selftests: Fix clang cross compilation")
Signed-off-by: Guillaume Tucker &lt;guillaume.tucker@collabora.com&gt;
Reviewed-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kselftest: Fix error message for unconfigured LLVM builds</title>
<updated>2023-01-12T20:38:04+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2023-01-11T22:33:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9fdaca2c1e157dc0a3c0faecf3a6a68e7d8d0c7b'/>
<id>urn:sha1:9fdaca2c1e157dc0a3c0faecf3a6a68e7d8d0c7b</id>
<content type='text'>
We are missing a ) when we attempt to complain about not having enough
configuration for clang, resulting in the rather inscrutable error:

../lib.mk:23: *** unterminated call to function 'error': missing ')'.  Stop.

Add the required ) so we print the message we were trying to print.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'linux-kselftest-next-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest</title>
<updated>2022-12-13T00:39:38+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-12-13T00:39:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=23a68d14def8247735b66a14b370b42d8fcedb47'/>
<id>urn:sha1:23a68d14def8247735b66a14b370b42d8fcedb47</id>
<content type='text'>
Pull Kselftest updates from Shuah Khan:
 "Several fixes and enhancements to existing tests and a few new tests:

   - add new amd-pstate tests and fix and enhance existing ones

   - add new watchdog tests and enhance existing ones to improve
     coverage

   - fixes to ftrace, splice_read, rtc, and efivars tests

   - fixes to handle egrep obsolescence in the latest grep release

   - miscellaneous spelling and SPDX fixes"

* tag 'linux-kselftest-next-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (24 commits)
  selftests/ftrace: Use long for synthetic event probe test
  selftests/tpm2: Split async tests call to separate shell script runner
  selftests: splice_read: Fix sysfs read cases
  selftests: ftrace: Use "grep -E" instead of "egrep"
  selftests: gpio: Use "grep -E" instead of "egrep"
  selftests: kselftest_deps: Use "grep -E" instead of "egrep"
  selftests/efivarfs: Add checking of the test return value
  cpufreq: amd-pstate: fix spdxcheck warnings for amd-pstate-ut.c
  selftests: rtc: skip when RTC is not present
  selftests/ftrace: event_triggers: wait longer for test_event_enable
  selftests/vDSO: Add riscv getcpu &amp; gettimeofday test
  Documentation: amd-pstate: Add tbench and gitsource test introduction
  selftests: amd-pstate: Trigger gitsource benchmark and test cpus
  selftests: amd-pstate: Trigger tbench benchmark and test cpus
  selftests: amd-pstate: Split basic.sh into run.sh and basic.sh.
  selftests: amd-pstate: Rename amd-pstate-ut.sh to basic.sh.
  selftests/ftrace: Convert tracer tests to use 'requires' to specify program dependency
  selftests/ftrace: Add check for ping command for trigger tests
  selftests/watchdog: Fix spelling mistake "Temeprature" -&gt; "Temperature"
  selftests/watchdog: add test for WDIOC_GETTEMP
  ...
</content>
</entry>
<entry>
<title>selftests: net: Fix cross-tree inclusion of scripts</title>
<updated>2022-10-21T04:09:22+00:00</updated>
<author>
<name>Benjamin Poirier</name>
<email>bpoirier@nvidia.com</email>
</author>
<published>2022-10-19T09:10:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ae108c48b5d2b34bcef3c4fb5076f42c922c426a'/>
<id>urn:sha1:ae108c48b5d2b34bcef3c4fb5076f42c922c426a</id>
<content type='text'>
When exporting and running a subset of selftests via kselftest, files from
parts of the source tree which were not exported are not available. A few
tests are trying to source such files. Address the problem by using
symlinks.

The problem can be reproduced by running:
make -C tools/testing/selftests gen_tar TARGETS="drivers/net/bonding"
[... extract archive ...]
./run_kselftest.sh

or:
make kselftest KBUILD_OUTPUT=/tmp/kselftests TARGETS="drivers/net/bonding"

Fixes: bbb774d921e2 ("net: Add tests for bonding and team address list management")
Fixes: eccd0a80dc7f ("selftests: net: dsa: add a stress test for unlocked FDB operations")
Link: https://lore.kernel.org/netdev/40f04ded-0c86-8669-24b1-9a313ca21076@redhat.com/
Reported-by: Jonathan Toppins &lt;jtoppins@redhat.com&gt;
Signed-off-by: Benjamin Poirier &lt;bpoirier@nvidia.com&gt;
Reviewed-by: Jonathan Toppins &lt;jtoppins@redhat.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: Use optional USERCFLAGS and USERLDFLAGS</title>
<updated>2022-10-20T14:55:40+00:00</updated>
<author>
<name>Mickaël Salaün</name>
<email>mic@digikod.net</email>
</author>
<published>2022-09-09T10:39:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=de3ee3f63400a23954e7c1ad1cb8c20f29ab6fe3'/>
<id>urn:sha1:de3ee3f63400a23954e7c1ad1cb8c20f29ab6fe3</id>
<content type='text'>
This change enables to extend CFLAGS and LDFLAGS from command line, e.g.
to extend compiler checks: make USERCFLAGS=-Werror USERLDFLAGS=-static

USERCFLAGS and USERLDFLAGS are documented in
Documentation/kbuild/makefiles.rst and Documentation/kbuild/kbuild.rst

This should be backported (down to 5.10) to improve previous kernel
versions testing as well.

Cc: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün &lt;mic@digikod.net&gt;
Link: https://lore.kernel.org/r/20220909103901.1503436-1-mic@digikod.net
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
