Skip to contentSkip to conversation

selftests: harness: Support KCOV.

PATCH In review Kuniyuki Iwashima 3 participants 4 messages Oct 28, 2025 – Nov 7, 2025

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

PATCH v2 1/1 selftests: harness: Support KCOV.

While writing a selftest with kselftest_harness.h, I often want to check which paths are actually exercised.

Let's support generating KCOV coverage data.

We can specify the output directory via the KCOV_OUTPUT environment variable, and the number of instructions to collect via the KCOV_SLOTS environment variable.

# KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 2)) \
./tools/testing/selftests/net/af_unix/scm_inq

Both variables can also be specified as the make variable.

  # make -C tools/testing/selftests/ \
    KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 4)) \
    kselftest_override_timeout=60 TARGETS=net/af_unix run_tests

The coverage data can be simply decoded with addr2line:

  $ cat kcov/* | sort | uniq | addr2line -e vmlinux | grep unix
  net/unix/af_unix.c:1056
  net/unix/af_unix.c:3138
  net/unix/af_unix.c:3834
  net/unix/af_unix.c:3838
  net/unix/af_unix.c:311 (discriminator 2)
  ...

or more nicely with a script embedded in vock [0]:

  $ cat kcov/* | sort | uniq > local.log
  $ python3 ~/kernel/tools/vock/report.py \
    --kernel-src ./ --vmlinux ./vmlinux \
    --mode local --local-log local.log --filter unix
  ...
  ------------------------------- Coverage Report --------------------------------
  📄 net/unix/af_unix.c (276 lines)
   ...
  942 | static int unix_setsockopt(struct socket *sock, int level, int optname,
  943 | 			   sockptr_t optval, unsigned int optlen)
  944 | {
   ...
  961 | 	switch (optname) {
  962 | 	case SO_INQ:
  963 > 		if (sk->sk_type != SOCK_STREAM)
  964 | 			return -EINVAL;
  965 |
  966 > 		if (val > 1 || val < 0)
  967 | 			return -EINVAL;
  968 |
  969 > 		WRITE_ONCE(u->recvmsg_inq, val);
  970 | 		break;

---
v2: Support TEST()
v1: https://lore.kernel.org/linux-kselftest/[email protected]/

---
 Documentation/dev-tools/kselftest.rst       |  41 ++++++
 tools/testing/selftests/Makefile            |  14 ++-
 tools/testing/selftests/kselftest_harness.h | 133 +++++++++++++++++++-
 3 files changed, 178 insertions(+), 10 deletions(-)
Documentation/dev-tools/kselftest.rst +41 -0
index 18c2da67fae4..5c2b92ac4a30 100644
@@ -200,6 +200,47 @@ You can look at the TAP output to see if you ran into the timeout. Test
 runners which know a test must run under a specific time can then optionally
 treat these timeouts then as fatal.
 
+KCOV for selftests
+==================
+
+Selftests built with `kselftest_harness.h` natively support generating
+KCOV coverage data.  See :doc:`KCOV: code coverage for fuzzing </dev-tools/kcov>`
+for prerequisites.
+
+You can specify the output directory with the `KCOV_OUTPUT` environment
+variable.  Additionally, you can specify the number of instructions to
+collect with the `KCOV_SLOTS` environment variable ::
+
+  # KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 2)) \
+        ./tools/testing/selftests/net/af_unix/scm_inq
+
+In the output directory, a coverage file is generated for each test
+case in the selftest ::
+
+  $ ls kcov/
+  scm_inq.dgram.basic  scm_inq.seqpacket.basic  scm_inq.stream.basic
+
+The default value of `KCOV_SLOTS` is `4096`, and `KCOV_SLOTS` multiplied
+by `sizeof(unsigned long)` must be multiple of `4096`, so the smallest
+value is `512`.
+
+Both `KCOV_OUTPUT` and `KCOV_SLOTS` can be specified as the variables
+on the `make` command line ::
+
+  # make -C tools/testing/selftests/ \
+        kselftest_override_timeout=60 \
+        KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 4)) \
+        TARGETS=net/af_unix run_tests
+
+The collected data can be decoded with `addr2line` ::
+
+  $ cat kcov/* | sort | uniq | addr2line -e vmlinux | grep unix
+  net/unix/af_unix.c:1056
+  net/unix/af_unix.c:3138
+  net/unix/af_unix.c:3834
+  net/unix/af_unix.c:3838
+  ...
+
 Packaging selftests
 ===================
 
tools/testing/selftests/Makefile +8 -6
index c46ebdb9b8ef..40e70fb1a347 100644
@@ -218,12 +218,14 @@ all:
 	done; exit $$ret;
 
 run_tests: all
-	@for TARGET in $(TARGETS); do \
-		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \
-				SRC_PATH=$(shell readlink -e $$(pwd)) \
-				OBJ_PATH=$(BUILD)                   \
-				O=$(abs_objtree);		    \
+	@for TARGET in $(TARGETS); do				\
+		BUILD_TARGET=$$BUILD/$$TARGET;			\
+		$(MAKE) OUTPUT=$$BUILD_TARGET			\
+			KCOV_OUTPUT=$(abspath $(KCOV_OUTPUT))	\
+			-C $$TARGET run_tests			\
+			SRC_PATH=$(shell readlink -e $$(pwd))	\
+			OBJ_PATH=$(BUILD)			\
+			O=$(abs_objtree);			\
 	done;
 
 hotplug:
tools/testing/selftests/kselftest_harness.h +129 -4

197 lines not on this page · raw message

Signature · 1 line
2.51.1.838.g19442a804e-goog
#1 lore raw
kernel test robot noticed "segfault_at_ip_sp_error" on:

Hello,

kernel test robot noticed "segfault_at_ip_sp_error" on:

commit: c849d8e404a7b145b33c184042234e903ce72c7c ("[PATCH v2] selftests: harness: Support KCOV.")
url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/selftests-harness-Support-KCOV/20251028-104538
base: https://git.kernel.org/cgit/linux/kernel/git/shuah/linux-kselftest.git next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH v2] selftests: harness: Support KCOV.

in testcase: kernel-selftests
version: kernel-selftests-x86_64-8bb886cb8f3a-1_20251104 with following parameters:

group: syscall_user_dispatch

config: x86_64-rhel-9.4-kselftests
compiler: gcc-14
test machine: 36 threads 1 sockets Intel(R) Core(TM) i9-9980XE CPU @ 3.00GHz (Skylake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

kern  :info  : [   72.507647] [   T2520] sud_test[2520]: segfault at 0 ip 0000558da6f1242c sp 00007fffd6f2faf0 error 4 in sud_test[342c,558da6f11000+5000] likely on CPU 23 (core 8, socket 0)
kern  :info  : [   72.508965] [   T2520] Code: 48 89 e5 48 83 ec 70 48 89 7d 98 48 89 75 90 48 8b 45 98 8b 40 70 83 f8 ff 0f 84 36 02 00 00 48 8b 45 98 48 8b 80 80 00 00 00 <48> 8b 00 89 45 f4 48 8b 45 98 8b 40 74 83 e8 01 39 45 f4 75 1d 48
All code
========
   0:	48 89 e5             	mov    %rsp,%rbp
   3:	48 83 ec 70          	sub    $0x70,%rsp
   7:	48 89 7d 98          	mov    %rdi,-0x68(%rbp)
   b:	48 89 75 90          	mov    %rsi,-0x70(%rbp)
   f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  13:	8b 40 70             	mov    0x70(%rax),%eax
  16:	83 f8 ff             	cmp    $0xffffffff,%eax
  19:	0f 84 36 02 00 00    	je     0x255
  1f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  23:	48 8b 80 80 00 00 00 	mov    0x80(%rax),%rax
  2a:*	48 8b 00             	mov    (%rax),%rax		<-- trapping instruction
  2d:	89 45 f4             	mov    %eax,-0xc(%rbp)
  30:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  34:	8b 40 74             	mov    0x74(%rax),%eax
  37:	83 e8 01             	sub    $0x1,%eax
  3a:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  3d:	75 1d                	jne    0x5c
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================

   0:	48 8b 00             	mov    (%rax),%rax
   3:	89 45 f4             	mov    %eax,-0xc(%rbp)
   6:	48 8b 45 98          	mov    -0x68(%rbp),%rax
   a:	8b 40 74             	mov    0x74(%rax),%eax
   d:	83 e8 01             	sub    $0x1,%eax
  10:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  13:	75 1d                	jne    0x32
  15:	48                   	rex.W
kern  :info  : [   72.511780] [   T2521] sud_test[2521]: segfault at 0 ip 0000558da6f1242c sp 00007fffd6f2faf0 error 4 in sud_test[342c,558da6f11000+5000] likely on CPU 23 (core 8, socket 0)
kern  :info  : [   72.513080] [   T2521] Code: 48 89 e5 48 83 ec 70 48 89 7d 98 48 89 75 90 48 8b 45 98 8b 40 70 83 f8 ff 0f 84 36 02 00 00 48 8b 45 98 48 8b 80 80 00 00 00 <48> 8b 00 89 45 f4 48 8b 45 98 8b 40 74 83 e8 01 39 45 f4 75 1d 48
All code
========
   0:	48 89 e5             	mov    %rsp,%rbp
   3:	48 83 ec 70          	sub    $0x70,%rsp
   7:	48 89 7d 98          	mov    %rdi,-0x68(%rbp)
   b:	48 89 75 90          	mov    %rsi,-0x70(%rbp)
   f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  13:	8b 40 70             	mov    0x70(%rax),%eax
  16:	83 f8 ff             	cmp    $0xffffffff,%eax
  19:	0f 84 36 02 00 00    	je     0x255
  1f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  23:	48 8b 80 80 00 00 00 	mov    0x80(%rax),%rax
  2a:*	48 8b 00             	mov    (%rax),%rax		<-- trapping instruction
  2d:	89 45 f4             	mov    %eax,-0xc(%rbp)
  30:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  34:	8b 40 74             	mov    0x74(%rax),%eax
  37:	83 e8 01             	sub    $0x1,%eax
  3a:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  3d:	75 1d                	jne    0x5c
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================

   0:	48 8b 00             	mov    (%rax),%rax
   3:	89 45 f4             	mov    %eax,-0xc(%rbp)
   6:	48 8b 45 98          	mov    -0x68(%rbp),%rax
   a:	8b 40 74             	mov    0x74(%rax),%eax
   d:	83 e8 01             	sub    $0x1,%eax
  10:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  13:	75 1d                	jne    0x32
  15:	48                   	rex.W

user :notice: [ 72.516773] [ T622] update-alternatives: warning: skip creation of /usr/share/man/man1/traceroute6.1.gz because associated file /usr/share/man/man1/traceroute6.db.1.gz (of link group traceroute6) doesn't exist

kern  :info  : [   72.517057] [   T2523] sud_test[2523]: segfault at 0 ip 0000558da6f1242c sp 00007fffd6f2faf0 error 4 in sud_test[342c,558da6f11000+5000] likely on CPU 27 (core 16, socket 0)
kern  :info  : [   72.519874] [   T2523] Code: 48 89 e5 48 83 ec 70 48 89 7d 98 48 89 75 90 48 8b 45 98 8b 40 70 83 f8 ff 0f 84 36 02 00 00 48 8b 45 98 48 8b 80 80 00 00 00 <48> 8b 00 89 45 f4 48 8b 45 98 8b 40 74 83 e8 01 39 45 f4 75 1d 48
All code
========
   0:	48 89 e5             	mov    %rsp,%rbp
   3:	48 83 ec 70          	sub    $0x70,%rsp
   7:	48 89 7d 98          	mov    %rdi,-0x68(%rbp)
   b:	48 89 75 90          	mov    %rsi,-0x70(%rbp)
   f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  13:	8b 40 70             	mov    0x70(%rax),%eax
  16:	83 f8 ff             	cmp    $0xffffffff,%eax
  19:	0f 84 36 02 00 00    	je     0x255
  1f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  23:	48 8b 80 80 00 00 00 	mov    0x80(%rax),%rax
  2a:*	48 8b 00             	mov    (%rax),%rax		<-- trapping instruction
  2d:	89 45 f4             	mov    %eax,-0xc(%rbp)
  30:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  34:	8b 40 74             	mov    0x74(%rax),%eax
  37:	83 e8 01             	sub    $0x1,%eax
  3a:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  3d:	75 1d                	jne    0x5c
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================

   0:	48 8b 00             	mov    (%rax),%rax
   3:	89 45 f4             	mov    %eax,-0xc(%rbp)
   6:	48 8b 45 98          	mov    -0x68(%rbp),%rax
   a:	8b 40 74             	mov    0x74(%rax),%eax
   d:	83 e8 01             	sub    $0x1,%eax
  10:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  13:	75 1d                	jne    0x32
  15:	48                   	rex.W

user :notice: [ 72.521352] [ T622] update-alternatives: warning: skip creation of /usr/share/man/man1/lft.1.gz because associated file /usr/share/man/man1/lft.db.1.gz (of link group lft) doesn't exist

kern  :info  : [   72.522679] [   T2524] sud_test[2524]: segfault at 0 ip 0000558da6f1242c sp 00007fffd6f2faf0 error 4 in sud_test[342c,558da6f11000+5000] likely on CPU 23 (core 8, socket 0)
kern  :info  : [   72.524467] [   T2524] Code: 48 89 e5 48 83 ec 70 48 89 7d 98 48 89 75 90 48 8b 45 98 8b 40 70 83 f8 ff 0f 84 36 02 00 00 48 8b 45 98 48 8b 80 80 00 00 00 <48> 8b 00 89 45 f4 48 8b 45 98 8b 40 74 83 e8 01 39 45 f4 75 1d 48
All code
========
   0:	48 89 e5             	mov    %rsp,%rbp
   3:	48 83 ec 70          	sub    $0x70,%rsp
   7:	48 89 7d 98          	mov    %rdi,-0x68(%rbp)
   b:	48 89 75 90          	mov    %rsi,-0x70(%rbp)
   f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  13:	8b 40 70             	mov    0x70(%rax),%eax
  16:	83 f8 ff             	cmp    $0xffffffff,%eax
  19:	0f 84 36 02 00 00    	je     0x255
  1f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  23:	48 8b 80 80 00 00 00 	mov    0x80(%rax),%rax
  2a:*	48 8b 00             	mov    (%rax),%rax		<-- trapping instruction
  2d:	89 45 f4             	mov    %eax,-0xc(%rbp)
  30:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  34:	8b 40 74             	mov    0x74(%rax),%eax
  37:	83 e8 01             	sub    $0x1,%eax
  3a:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  3d:	75 1d                	jne    0x5c
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================

   0:	48 8b 00             	mov    (%rax),%rax
   3:	89 45 f4             	mov    %eax,-0xc(%rbp)
   6:	48 8b 45 98          	mov    -0x68(%rbp),%rax
   a:	8b 40 74             	mov    0x74(%rax),%eax
   d:	83 e8 01             	sub    $0x1,%eax
  10:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  13:	75 1d                	jne    0x32
  15:	48                   	rex.W

user :notice: [ 72.526246] [ T622] update-alternatives: warning: skip creation of /usr/share/man/man1/traceproto.1.gz because associated file /usr/share/man/man1/traceproto.db.1.gz (of link group traceproto) doesn't exist

kern  :info  : [   72.529475] [   T2525] sud_test[2525]: segfault at 0 ip 0000558da6f1242c sp 00007fffd6f2faf0 error 4 in sud_test[342c,558da6f11000+5000] likely on CPU 16 (core 26, socket 0)
kern  :info  : [   72.530789] [   T2525] Code: 48 89 e5 48 83 ec 70 48 89 7d 98 48 89 75 90 48 8b 45 98 8b 40 70 83 f8 ff 0f 84 36 02 00 00 48 8b 45 98 48 8b 80 80 00 00 00 <48> 8b 00 89 45 f4 48 8b 45 98 8b 40 74 83 e8 01 39 45 f4 75 1d 48
All code
========
   0:	48 89 e5             	mov    %rsp,%rbp
   3:	48 83 ec 70          	sub    $0x70,%rsp
   7:	48 89 7d 98          	mov    %rdi,-0x68(%rbp)
   b:	48 89 75 90          	mov    %rsi,-0x70(%rbp)
   f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  13:	8b 40 70             	mov    0x70(%rax),%eax
  16:	83 f8 ff             	cmp    $0xffffffff,%eax
  19:	0f 84 36 02 00 00    	je     0x255
  1f:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  23:	48 8b 80 80 00 00 00 	mov    0x80(%rax),%rax
  2a:*	48 8b 00             	mov    (%rax),%rax		<-- trapping instruction
  2d:	89 45 f4             	mov    %eax,-0xc(%rbp)
  30:	48 8b 45 98          	mov    -0x68(%rbp),%rax
  34:	8b 40 74             	mov    0x74(%rax),%eax
  37:	83 e8 01             	sub    $0x1,%eax
  3a:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  3d:	75 1d                	jne    0x5c
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================

   0:	48 8b 00             	mov    (%rax),%rax
   3:	89 45 f4             	mov    %eax,-0xc(%rbp)
   6:	48 8b 45 98          	mov    -0x68(%rbp),%rax
   a:	8b 40 74             	mov    0x74(%rax),%eax
   d:	83 e8 01             	sub    $0x1,%eax
  10:	39 45 f4             	cmp    %eax,-0xc(%rbp)
  13:	75 1d                	jne    0x32
  15:	48                   	rex.W

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20251106/[email protected]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#2 lore raw
In reply to Kuniyuki Iwashima
Quoted 55 lines · Kuniyuki Iwashima

While writing a selftest with kselftest_harness.h, I often want to check which paths are actually exercised.

Let's support generating KCOV coverage data.

We can specify the output directory via the KCOV_OUTPUT environment variable, and the number of instructions to collect via the KCOV_SLOTS environment variable.

   # KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 2)) \
     ./tools/testing/selftests/net/af_unix/scm_inq

Both variables can also be specified as the make variable.

   # make -C tools/testing/selftests/ \
     KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 4)) \
     kselftest_override_timeout=60 TARGETS=net/af_unix run_tests

The coverage data can be simply decoded with addr2line:

   $ cat kcov/* | sort | uniq | addr2line -e vmlinux | grep unix
   net/unix/af_unix.c:1056
   net/unix/af_unix.c:3138
   net/unix/af_unix.c:3834
   net/unix/af_unix.c:3838
   net/unix/af_unix.c:311 (discriminator 2)
   ...

or more nicely with a script embedded in vock [0]:

   $ cat kcov/* | sort | uniq > local.log
   $ python3 ~/kernel/tools/vock/report.py \
     --kernel-src ./ --vmlinux ./vmlinux \
     --mode local --local-log local.log --filter unix
   ...
   ------------------------------- Coverage Report --------------------------------
   📄 net/unix/af_unix.c (276 lines)
    ...
   942 | static int unix_setsockopt(struct socket *sock, int level, int optname,
   943 | 			   sockptr_t optval, unsigned int optlen)
   944 | {
    ...
   961 | 	switch (optname) {
   962 | 	case SO_INQ:
   963 > 		if (sk->sk_type != SOCK_STREAM)
   964 | 			return -EINVAL;
   965 |
   966 > 		if (val > 1 || val < 0)
   967 | 			return -EINVAL;
   968 |
   969 > 		WRITE_ONCE(u->recvmsg_inq, val);
   970 | 		break;
Quoted 9 lines

---
v2: Support TEST()
v1: https://lore.kernel.org/linux-kselftest/[email protected]/

---
  Documentation/dev-tools/kselftest.rst       |  41 ++++++
  tools/testing/selftests/Makefile            |  14 ++-
  tools/testing/selftests/kselftest_harness.h | 133 +++++++++++++++++++-
  3 files changed, 178 insertions(+), 10 deletions(-)

I am okay with kcov support being added. You probably have to fix a few things. kernel test robot is still complaining on v2.

thanks,
-- Shuah

#3 lore raw
Quoted 67 lines · Shuah Khan
Quoted 55 lines · Kuniyuki Iwashima

While writing a selftest with kselftest_harness.h, I often want to check which paths are actually exercised.

Let's support generating KCOV coverage data.

We can specify the output directory via the KCOV_OUTPUT environment variable, and the number of instructions to collect via the KCOV_SLOTS environment variable.

   # KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 2)) \
     ./tools/testing/selftests/net/af_unix/scm_inq

Both variables can also be specified as the make variable.

   # make -C tools/testing/selftests/ \
     KCOV_OUTPUT=$PWD/kcov KCOV_SLOTS=$((4096 * 4)) \
     kselftest_override_timeout=60 TARGETS=net/af_unix run_tests

The coverage data can be simply decoded with addr2line:

   $ cat kcov/* | sort | uniq | addr2line -e vmlinux | grep unix
   net/unix/af_unix.c:1056
   net/unix/af_unix.c:3138
   net/unix/af_unix.c:3834
   net/unix/af_unix.c:3838
   net/unix/af_unix.c:311 (discriminator 2)
   ...

or more nicely with a script embedded in vock [0]:

   $ cat kcov/* | sort | uniq > local.log
   $ python3 ~/kernel/tools/vock/report.py \
     --kernel-src ./ --vmlinux ./vmlinux \
     --mode local --local-log local.log --filter unix
   ...
   ------------------------------- Coverage Report --------------------------------
   📄 net/unix/af_unix.c (276 lines)
    ...
   942 | static int unix_setsockopt(struct socket *sock, int level, int optname,
   943 |                         sockptr_t optval, unsigned int optlen)
   944 | {
    ...
   961 |      switch (optname) {
   962 |      case SO_INQ:
   963 >              if (sk->sk_type != SOCK_STREAM)
   964 |                      return -EINVAL;
   965 |
   966 >              if (val > 1 || val < 0)
   967 |                      return -EINVAL;
   968 |
   969 >              WRITE_ONCE(u->recvmsg_inq, val);
   970 |              break;
Quoted 9 lines

---
v2: Support TEST()
v1: https://lore.kernel.org/linux-kselftest/[email protected]/

---
  Documentation/dev-tools/kselftest.rst       |  41 ++++++
  tools/testing/selftests/Makefile            |  14 ++-
  tools/testing/selftests/kselftest_harness.h | 133 +++++++++++++++++++-
  3 files changed, 178 insertions(+), 10 deletions(-)
Quoted 2 lines

I am okay with kcov support being added. You probably have to fix a few things. kernel test robot is still complaining on v2.

Thank you, Shuah!
Will fix the issue in v3.