The idea of this RFC is to introduce a way to catalogue and document any tests
that should be executed for changes to a subsystem, as well as to make
checkpatch.pl require a tag in commit messages certifying they were, plus
hopefully make it easier to discover and run them.
This is following a discussion Veronika Kabatova started with a few
(addressed) people at the LPC last year (IIRC), where there was a good deal of
interest for something like this.
Apart from implementing basic support (surely to be improved), two sample
changes are added on top, adding a few test suites (roughly) based on what the
maintainers described earlier. I'm definitely not qualified for describing
them adequately, and don't have the time to dig deeper, but hopefully they
could serve as illustrations, and shouldn't be merged as is.
I would defer to maintainers of the corresponding subsystems and tests to
describe their tests and requirements better. Although I would accept
amendments too, if they prefer it that way.
One bug I know that's definitely there is handling removed files. The
scripts/get_maintainer.pl chokes on non-existing files, failing to output the
required test suites (I'm sure there's a good reason, but I couldn't see it).
My first idea is to only check for required tests upon encountering the '+++
<file>' line, and ignore the '/dev/null' file, but I hope the checkpatch.pl
maintainers could recommend a better way.
Anyway, tell me what you think, and I'll work on polishing this.
Thank you!
Nick
---
Nikolai Kondrashov (3):
MAINTAINERS: Introduce V: field for required tests
MAINTAINERS: Require kvm-xfstests smoke for ext4
MAINTAINERS: Require kunit core tests for framework changes
Documentation/process/submitting-patches.rst | 19 +++++
Documentation/process/tests.rst | 80 ++++++++++++++++++
MAINTAINERS | 8 ++
scripts/checkpatch.pl | 118 ++++++++++++++++++++++++++-
scripts/get_maintainer.pl | 17 +++-
scripts/parse-maintainers.pl | 3 +-
6 files changed, 241 insertions(+), 4 deletions(-)
---
From: Willem de Bruijn <willemb(a)google.com>
This test validates per-band packet limits in FQ. Packets are dropped
rather than enqueued if the limit for their band is reached.
This test is timing sensitive. It queues packets in FQ with a future
delivery time to fill the qdisc.
The test failed in a virtual environment (vng). Increase the delays
to make it more tolerant to environments with timing variance.
Signed-off-by: Willem de Bruijn <willemb(a)google.com>
---
tools/testing/selftests/net/fq_band_pktlimit.sh | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/net/fq_band_pktlimit.sh b/tools/testing/selftests/net/fq_band_pktlimit.sh
index 24b77bdf41ff..977070ed42b3 100755
--- a/tools/testing/selftests/net/fq_band_pktlimit.sh
+++ b/tools/testing/selftests/net/fq_band_pktlimit.sh
@@ -8,7 +8,7 @@
# 3. send 20 pkts on band A: verify that 0 are queued, 20 dropped
# 4. send 20 pkts on band B: verify that 10 are queued, 10 dropped
#
-# Send packets with a 100ms delay to ensure that previously sent
+# Send packets with a delay to ensure that previously sent
# packets are still queued when later ones are sent.
# Use SO_TXTIME for this.
@@ -29,19 +29,21 @@ ip -6 addr add fdaa::1/128 dev dummy0
ip -6 route add fdaa::/64 dev dummy0
tc qdisc replace dev dummy0 root handle 1: fq quantum 1514 initial_quantum 1514 limit 10
-./cmsg_sender -6 -p u -d 100000 -n 20 fdaa::2 8000
+DELAY=400000
+
+./cmsg_sender -6 -p u -d "${DELAY}" -n 20 fdaa::2 8000
OUT1="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
-./cmsg_sender -6 -p u -d 100000 -n 20 fdaa::2 8000
+./cmsg_sender -6 -p u -d "${DELAY}" -n 20 fdaa::2 8000
OUT2="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
-./cmsg_sender -6 -p u -d 100000 -n 20 -P 7 fdaa::2 8000
+./cmsg_sender -6 -p u -d "${DELAY}" -n 20 -P 7 fdaa::2 8000
OUT3="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
# Initial stats will report zero sent, as all packets are still
-# queued in FQ. Sleep for the delay period (100ms) and see that
+# queued in FQ. Sleep for at least the delay period and see that
# twenty are now sent.
-sleep 0.1
+sleep 0.6
OUT4="$(tc -s qdisc show dev dummy0 | grep '^\ Sent')"
# Log the output after the test
--
2.43.0.429.g432eaa2c6b-goog
After commit 25ae948b4478 ("selftests/net: add lib.sh") but before commit
2114e83381d3 ("selftests: forwarding: Avoid failures to source
net/lib.sh"), some net selftests encountered errors when they were being
exported and run. This was because the new net/lib.sh was not exported
along with the tests. The errors were crudely avoided by duplicating some
content between net/lib.sh and net/forwarding/lib.sh in 2114e83381d3.
In order to restore the sourcing of net/lib.sh from net/forwarding/lib.sh
and remove the duplicated content, this series introduces a new selftests
Makefile variable to list extra files to export from other directories and
makes use of it to avoid reintroducing the errors mentioned above.
v2:
* "selftests: Introduce Makefile variable to list shared bash scripts"
Fix rst syntax in Documentation/dev-tools/kselftest.rst (Jakub Kicinski)
v1:
* "selftests: Introduce Makefile variable to list shared bash scripts"
Changed TEST_INCLUDES to take relative paths, like other TEST_* variables.
Paths are adjusted accordingly in the subsequent patches. (Vladimir Oltean)
* selftests: bonding: Change script interpreter
selftests: forwarding: Remove executable bits from lib.sh
Removed from this series, submitted separately.
Since commit 2114e83381d3 ("selftests: forwarding: Avoid failures to source
net/lib.sh") resolved the test errors, this version of the series is
focused on removing the duplication that was added in that commit. Directly
rebasing the series would reintroduce the problems that 2114e83381d3
avoided before fixing them again. In order to prevent such breakage partway
through the series, patches are reordered and content changed slightly but
there is no diff at the end compared with the simple rebasing approach. I
have dropped most review tags on account of this reordering.
RFC:
https://lore.kernel.org/netdev/20231222135836.992841-1-bpoirier@nvidia.com/
Link: https://lore.kernel.org/netdev/ZXu7dGj7F9Ng8iIX@Laptop-X1/
Benjamin Poirier (5):
selftests: Introduce Makefile variable to list shared bash scripts
selftests: bonding: Add net/forwarding/lib.sh to TEST_INCLUDES
selftests: team: Add shared library scripts to TEST_INCLUDES
selftests: dsa: Replace test symlinks by wrapper script
selftests: forwarding: Redefine relative_path variable
Petr Machata (1):
selftests: forwarding: Remove duplicated lib.sh content
Documentation/dev-tools/kselftest.rst | 12 ++++++
tools/testing/selftests/Makefile | 7 +++-
.../selftests/drivers/net/bonding/Makefile | 7 +++-
.../net/bonding/bond-eth-type-change.sh | 2 +-
.../drivers/net/bonding/bond_topo_2d1c.sh | 2 +-
.../drivers/net/bonding/dev_addr_lists.sh | 2 +-
.../net/bonding/mode-1-recovery-updelay.sh | 2 +-
.../net/bonding/mode-2-recovery-updelay.sh | 2 +-
.../drivers/net/bonding/net_forwarding_lib.sh | 1 -
.../selftests/drivers/net/dsa/Makefile | 18 ++++++++-
.../drivers/net/dsa/bridge_locked_port.sh | 2 +-
.../selftests/drivers/net/dsa/bridge_mdb.sh | 2 +-
.../selftests/drivers/net/dsa/bridge_mld.sh | 2 +-
.../drivers/net/dsa/bridge_vlan_aware.sh | 2 +-
.../drivers/net/dsa/bridge_vlan_mcast.sh | 2 +-
.../drivers/net/dsa/bridge_vlan_unaware.sh | 2 +-
.../testing/selftests/drivers/net/dsa/lib.sh | 1 -
.../drivers/net/dsa/local_termination.sh | 2 +-
.../drivers/net/dsa/no_forwarding.sh | 2 +-
.../net/dsa/run_net_forwarding_test.sh | 9 +++++
.../selftests/drivers/net/dsa/tc_actions.sh | 2 +-
.../selftests/drivers/net/dsa/tc_common.sh | 1 -
.../drivers/net/dsa/test_bridge_fdb_stress.sh | 2 +-
.../selftests/drivers/net/team/Makefile | 7 ++--
.../drivers/net/team/dev_addr_lists.sh | 4 +-
.../selftests/drivers/net/team/lag_lib.sh | 1 -
.../drivers/net/team/net_forwarding_lib.sh | 1 -
tools/testing/selftests/lib.mk | 19 ++++++++++
.../testing/selftests/net/forwarding/Makefile | 3 ++
tools/testing/selftests/net/forwarding/lib.sh | 37 +++----------------
.../net/forwarding/mirror_gre_lib.sh | 2 +-
.../net/forwarding/mirror_gre_topo_lib.sh | 2 +-
32 files changed, 98 insertions(+), 64 deletions(-)
delete mode 120000 tools/testing/selftests/drivers/net/bonding/net_forwarding_lib.sh
delete mode 120000 tools/testing/selftests/drivers/net/dsa/lib.sh
create mode 100755 tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
delete mode 120000 tools/testing/selftests/drivers/net/dsa/tc_common.sh
delete mode 120000 tools/testing/selftests/drivers/net/team/lag_lib.sh
delete mode 120000 tools/testing/selftests/drivers/net/team/net_forwarding_lib.sh
--
2.43.0
The test is inspired by the pmu_event_filter_test which implemented by x86. On
the arm64 platform, there is the same ability to set the pmu_event_filter
through the KVM_ARM_VCPU_PMU_V3_FILTER attribute. So add the test for arm64.
The series first move some pmu common code from vpmu_counter_access to
lib/aarch64/vpmu.c and include/aarch64/vpmu.h, which can be used by
pmu_event_filter_test. Then fix a bug related to the [enable|disable]_counter,
and at last, implement the test itself.
Changelog:
----------
v2->v3:
- Check the pmceid in guest code instead of pmu event count since different
hardware may have different event count result, check pmceid makes it stable
on different platform. [Eric]
- Some typo fixed and commit message improved.
v1->v2:
- Improve the commit message. [Eric]
- Fix the bug in [enable|disable]_counter. [Raghavendra & Marc]
- Add the check if kvm has attr KVM_ARM_VCPU_PMU_V3_FILTER.
- Add if host pmu support the test event throught pmceid0.
- Split the test_invalid_filter() to another patch. [Eric]
v1: https://lore.kernel.org/all/20231123063750.2176250-1-shahuang@redhat.com/
v2: https://lore.kernel.org/all/20231129072712.2667337-1-shahuang@redhat.com/
Shaoqin Huang (5):
KVM: selftests: aarch64: Make the [create|destroy]_vpmu_vm() public
KVM: selftests: aarch64: Move pmu helper functions into vpmu.h
KVM: selftests: aarch64: Fix the buggy [enable|disable]_counter
KVM: selftests: aarch64: Introduce pmu_event_filter_test
KVM: selftests: aarch64: Add invalid filter test in
pmu_event_filter_test
tools/testing/selftests/kvm/Makefile | 2 +
.../kvm/aarch64/pmu_event_filter_test.c | 255 ++++++++++++++++++
.../kvm/aarch64/vpmu_counter_access.c | 218 ++-------------
.../selftests/kvm/include/aarch64/vpmu.h | 135 ++++++++++
.../testing/selftests/kvm/lib/aarch64/vpmu.c | 74 +++++
5 files changed, 490 insertions(+), 194 deletions(-)
create mode 100644 tools/testing/selftests/kvm/aarch64/pmu_event_filter_test.c
create mode 100644 tools/testing/selftests/kvm/include/aarch64/vpmu.h
create mode 100644 tools/testing/selftests/kvm/lib/aarch64/vpmu.c
--
2.40.1
One of the test cases in the test_bridge_backup_port.sh selftest relies
on a matchall classifier to drop unrelated traffic so that the Tx drop
counter on the VXLAN device will only be incremented as a result of
traffic generated by the test.
However, the configuration option for the matchall classifier is
missing from the configuration file which might explain the failures we
see in the netdev CI [1].
Fix by adding CONFIG_NET_CLS_MATCHALL to the configuration file.
[1]
# Backup nexthop ID - invalid IDs
# -------------------------------
[...]
# TEST: Forwarding out of vx0 [ OK ]
# TEST: No forwarding using backup nexthop ID [ OK ]
# TEST: Tx drop increased [FAIL]
# TEST: IPv6 address family nexthop as backup nexthop [ OK ]
# TEST: No forwarding out of swp1 [ OK ]
# TEST: Forwarding out of vx0 [ OK ]
# TEST: No forwarding using backup nexthop ID [ OK ]
# TEST: Tx drop increased [FAIL]
[...]
Fixes: b408453053fb ("selftests: net: Add bridge backup port and backup nexthop ID test")
Signed-off-by: Ido Schimmel <idosch(a)nvidia.com>
---
Jakub, you can apply to net if you want to, but I'm sending this to
net-next since I want to see if it helps the CI. I'm unable to reproduce
this locally.
---
tools/testing/selftests/net/config | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
index 19ff75051660..2bd5f9033ade 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -68,6 +68,7 @@ CONFIG_MPLS_ROUTING=m
CONFIG_MPLS_IPTUNNEL=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_CLS_MATCHALL=m
CONFIG_NET_ACT_TUNNEL_KEY=m
CONFIG_NET_ACT_MIRRED=m
CONFIG_BAREUDP=m
--
2.43.0
Hi Linus,
Please pull the following kselftest fixes update for Linux 6.8-rc3.
This kselftest fixes update for Linux 6.8-rc3 consists of three
fixes to livepatch, rseq, and seccomp tests.
diff is attached
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-fixes-6.8-rc3
for you to fetch changes up to b54761f6e9773350c0d1fb8e1e5aacaba7769d0f:
kselftest/seccomp: Report each expectation we assert as a KTAP test (2024-01-30 08:55:42 -0700)
----------------------------------------------------------------
linux_kselftest-fixes-6.8-rc3
This kselftest fixes update for Linux 6.8-rc3 consists of three
fixes to livepatch, rseq, and seccomp tests.
----------------------------------------------------------------
Joe Lawrence (1):
selftests/livepatch: fix and refactor new dmesg message code
Mark Brown (2):
kselftest/seccomp: Use kselftest output functions for benchmark
kselftest/seccomp: Report each expectation we assert as a KTAP test
Mathieu Desnoyers (1):
selftests/rseq: Do not skip !allowed_cpus for mm_cid
tools/testing/selftests/livepatch/functions.sh | 37 ++++----
.../testing/selftests/rseq/basic_percpu_ops_test.c | 14 ++-
tools/testing/selftests/rseq/param_test.c | 22 +++--
.../testing/selftests/seccomp/seccomp_benchmark.c | 104 +++++++++++++--------
4 files changed, 109 insertions(+), 68 deletions(-)
----------------------------------------------------------------
Hi Linus,
Please pull the following KUnit fixes update for Linux 6.8-rc3.
This kunit fixes update for Linux 6.8-rc3 consists of NULL vs IS_ERR()
bug fixes, documentation update, MAINTAINERS file update to add
Rae Moar as a reviewer, and a fix to run test suites only after module
initialization completes.
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-kunit-fixes-6.8-rc3
for you to fetch changes up to 1a9f2c776d1416c4ea6cb0d0b9917778c41a1a7d:
Documentation: KUnit: Update the instructions on how to test static functions (2024-01-22 07:59:03 -0700)
----------------------------------------------------------------
linux_kselftest-kunit-fixes-6.8-rc3
This kunit fixes update for Linux 6.8-rc3 consists of NULL vs IS_ERR()
bug fixes, documentation update, MAINTAINERS file update to add
Rae Moar as a reviewer, and a fix to run test suites only after module
initialization completes.
----------------------------------------------------------------
Arthur Grillo (1):
Documentation: KUnit: Update the instructions on how to test static functions
Dan Carpenter (2):
kunit: Fix a NULL vs IS_ERR() bug
kunit: device: Fix a NULL vs IS_ERR() check in init()
David Gow (1):
MAINTAINERS: kunit: Add Rae Moar as a reviewer
Marco Pagani (1):
kunit: run test suites only after module initialization completes
Documentation/dev-tools/kunit/usage.rst | 19 +++++++++++++++++--
MAINTAINERS | 1 +
lib/kunit/device.c | 4 ++--
lib/kunit/executor.c | 4 ++++
lib/kunit/kunit-test.c | 2 +-
lib/kunit/test.c | 14 +++++++++++---
6 files changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------
On riscv, mmap currently returns an address from the largest address
space that can fit entirely inside of the hint address. This makes it
such that the hint address is almost never returned. This patch raises
the mappable area up to and including the hint address. This allows mmap
to often return the hint address, which allows a performance improvement
over searching for a valid address as well as making the behavior more
similar to other architectures.
Signed-off-by: Charlie Jenkins <charlie(a)rivosinc.com>
---
Charlie Jenkins (3):
riscv: mm: Use hint address in mmap if available
selftests: riscv: Generalize mm selftests
docs: riscv: Define behavior of mmap
Documentation/arch/riscv/vm-layout.rst | 16 ++--
arch/riscv/include/asm/processor.h | 21 ++----
tools/testing/selftests/riscv/mm/mmap_bottomup.c | 20 +----
tools/testing/selftests/riscv/mm/mmap_default.c | 20 +----
tools/testing/selftests/riscv/mm/mmap_test.h | 93 +++++++++++++-----------
5 files changed, 66 insertions(+), 104 deletions(-)
---
base-commit: 556e2d17cae620d549c5474b1ece053430cd50bc
change-id: 20240119-use_mmap_hint_address-f9f4b1b6f5f1
--
- Charlie