Skip to contentSkip to conversation

selftests: rds selftest

PATCH Applied [email protected] 2 participants 5 messages Aug 6, 2024 – Aug 9, 2024

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

v2 cover selftests: rds selftest

From: Allison Henderson <[email protected]>

Hi All,

This series is a new selftest that Vegard, Chuck and myself have been working on to provide some test coverage for rds. I've modified the scripts to include the feedback from the last version, but let me know if there's anything missed. Questions and comments appreciated.

Thanks everyone!

Allison

Changes in v2:
- Removed qemu vm creation and related code
- Updated README.txt with examples of running the test with virtme
- Removed init.sh. run.sh now directly calls test.py
- Some clean up done with the return code handling since there is no vm between the scripts anymore
- Imported ip python function in tools/testing/selftests/net/lib/py/utils.py into test.py
- Adapted test.py to use the imported ip function, and removed the local ip wrapper
- Some line wrap clean up
- Link to v1:
https://lore.kernel.org/netdev/[email protected]/T

Vegard Nossum (3):
.gitignore: add .gcda files
net: rds: add option for GCOV profiling
selftests: rds: add testing infrastructure

 .gitignore                                 |   1 +
 Documentation/dev-tools/gcov.rst           |  11 +
 MAINTAINERS                                |   1 +
 net/rds/Kconfig                            |   9 +
 net/rds/Makefile                           |   5 +
 tools/testing/selftests/Makefile           |   1 +
 tools/testing/selftests/net/rds/Makefile   |  12 +
 tools/testing/selftests/net/rds/README.txt |  41 ++++
 tools/testing/selftests/net/rds/config.sh  |  53 +++++
 tools/testing/selftests/net/rds/run.sh     | 224 ++++++++++++++++++
 tools/testing/selftests/net/rds/test.py    | 262 +++++++++++++++++++++
 11 files changed, 620 insertions(+)
 create mode 100644 tools/testing/selftests/net/rds/Makefile
 create mode 100644 tools/testing/selftests/net/rds/README.txt
 create mode 100755 tools/testing/selftests/net/rds/config.sh
 create mode 100755 tools/testing/selftests/net/rds/run.sh
 create mode 100644 tools/testing/selftests/net/rds/test.py
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/3 .gitignore: add .gcda files

From: Vegard Nossum <[email protected]>

These files contain the runtime coverage data generated by gcov.

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index 7902adf4f7f1..38b7ab9e7dc4 100644
@@ -24,6 +24,7 @@
 *.dwo
 *.elf
 *.gcno
+*.gcda
 *.gz
 *.i
 *.ko
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/3 net: rds: add option for GCOV profiling

In reply to [email protected]

From: Vegard Nossum <[email protected]>

To better our unit tests we need code coverage to be part of the kernel. This patch borrows heavily from how CONFIG_GCOV_PROFILE_FTRACE is implemented

---
 net/rds/Kconfig  | 9 +++++++++
 net/rds/Makefile | 5 +++++
 2 files changed, 14 insertions(+)
net/rds/Kconfig +9 -0
index 75cd696963b2..f007730aa2bb 100644
@@ -26,3 +26,12 @@ config RDS_DEBUG
 	bool "RDS debugging messages"
 	depends on RDS
 	default n
+
+config GCOV_PROFILE_RDS
+	bool "Enable GCOV profiling on RDS"
+	depends on GCOV_KERNEL
+	help
+	  Enable GCOV profiling on RDS for checking which functions/lines
+	  are executed.
+
+	  If unsure, say N.
net/rds/Makefile +5 -0
index 8fdc118e2927..3af1ca1d965c 100644
@@ -15,3 +15,8 @@ rds_tcp-y :=		tcp.o tcp_connect.o tcp_listen.o tcp_recv.o \
 			tcp_send.o tcp_stats.o
 
 ccflags-$(CONFIG_RDS_DEBUG)	:=	-DRDS_DEBUG
+
+# for GCOV coverage profiling
+ifdef CONFIG_GCOV_PROFILE_RDS
+GCOV_PROFILE := y
+endif
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/3 selftests: rds: add testing infrastructure

In reply to [email protected]

From: Vegard Nossum <[email protected]>

This adds some basic self-testing infrastructure for RDS-TCP.

---
 Documentation/dev-tools/gcov.rst           |  11 +
 MAINTAINERS                                |   1 +
 tools/testing/selftests/Makefile           |   1 +
 tools/testing/selftests/net/rds/Makefile   |  12 +
 tools/testing/selftests/net/rds/README.txt |  41 ++++
 tools/testing/selftests/net/rds/config.sh  |  53 +++++
 tools/testing/selftests/net/rds/run.sh     | 224 ++++++++++++++++++
 tools/testing/selftests/net/rds/test.py    | 262 +++++++++++++++++++++
 8 files changed, 605 insertions(+)
Documentation/dev-tools/gcov.rst +11 -0
index 5fce2b06f229..dbd26b02ff3c 100644
@@ -75,6 +75,17 @@ Only files which are linked to the main kernel image or are compiled as
 kernel modules are supported by this mechanism.
 
 
+Module specific configs
+-----------------------
+
+Gcov kernel configs for specific modules are described below:
+
+CONFIG_GCOV_PROFILE_RDS:
+        Enables GCOV profiling on RDS for checking which functions or
+        lines are executed. This config is used by the rds selftest to
+        generate coverage reports. If left unset the report is omitted.
+
+
 Files
 -----
 
MAINTAINERS +1 -0
index 8766f3e5e87e..8e0324b964f5 100644
@@ -19195,6 +19195,7 @@ S:	Supported
 W:	https://oss.oracle.com/projects/rds/
 F:	Documentation/networking/rds.rst
 F:	net/rds/
+F:	tools/testing/selftests/net/rds/
 
 RDT - RESOURCE ALLOCATION
 M:	Fenghua Yu <[email protected]>
tools/testing/selftests/Makefile +1 -0
index bc8fe9e8f7f2..a5f1c0c27dff 100644
@@ -68,6 +68,7 @@ TARGETS += net/mptcp
 TARGETS += net/openvswitch
 TARGETS += net/tcp_ao
 TARGETS += net/netfilter
+TARGETS += net/rds
 TARGETS += nsfs
 TARGETS += perf_events
 TARGETS += pidfd
tools/testing/selftests/net/rds/Makefile new file +12 -0
new file mode 100644
index 000000000000..da9714bc7aad
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+
+all:
+	@echo mk_build_dir="$(shell pwd)" > include.sh
+
+TEST_PROGS := run.sh \
+	include.sh \
+	test.py
+
+EXTRA_CLEAN := /tmp/rds_logs
+
+include ../../lib.mk
tools/testing/selftests/net/rds/README.txt new file +41 -0

41 lines not on this page · raw message

tools/testing/selftests/net/rds/config.sh new file +53 -0

53 lines not on this page · raw message

tools/testing/selftests/net/rds/run.sh new file +224 -0

224 lines not on this page · raw message

tools/testing/selftests/net/rds/test.py new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw
In reply to [email protected]
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 10 lines · On Tue, 6 Aug 2024 08:38:06 -0700 you wrote:

From: Allison Henderson <[email protected]>

Hi All,

This series is a new selftest that Vegard, Chuck and myself have been working on to provide some test coverage for rds. I've modified the scripts to include the feedback from the last version, but let me know if there's anything missed. Questions and comments appreciated.

[...]

Here is the summary with links:
- [net-next,v2,1/3] .gitignore: add .gcda files

    https://git.kernel.org/netdev/net-next/c/a0f6e5e9f1f8
  - [net-next,v2,2/3] net: rds: add option for GCOV profiling
    https://git.kernel.org/netdev/net-next/c/bc75dcc3cea7
  - [net-next,v2,3/3] selftests: rds: add testing infrastructure
    https://git.kernel.org/netdev/net-next/c/3ade6ce1255e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html