<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-linux/lib/tests/errseq_kunit.c, branch stable</title>
<subtitle>WireGuard for the Linux kernel</subtitle>
<id>https://git.zx2c4.com/wireguard-linux/atom/lib/tests/errseq_kunit.c?h=stable</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-linux/atom/lib/tests/errseq_kunit.c?h=stable'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/'/>
<updated>2026-10-07T02:02:58Z</updated>
<entry>
<title>lib/tests: add KUnit tests for errseq</title>
<updated>2026-10-07T02:02:58Z</updated>
<author>
<name>Thomas Maarseveen</name>
<email>maarseveent@gmail.com</email>
</author>
<published>2026-08-12T18:55:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-linux/commit/?id=a4747846dfa6f09080d2252d9d442e7dbe333fb2'/>
<id>urn:sha1:a4747846dfa6f09080d2252d9d442e7dbe333fb2</id>
<content type='text'>
The errseq_t infrastructure (lib/errseq.c) underpins writeback error
reporting but has no regression tests.  Its semantics are subtle enough to
have needed fixing before: commit b4678df184b3 ("errseq: Always report a
writeback error once") changed how unseen errors reach new samplers.

Add a KUnit suite covering the documented single-threaded semantics:

 - a zeroed errseq_t is the "no error yet" epoch
 - errors are recorded, overwrite one another, and both ends of the
   valid errno range round-trip exactly
 - an error nobody has seen samples as zero, so a check against a
   fresh sample still reports it
 - errseq_check_and_advance() reports a given error exactly once per
   cursor and leaves the cursor in place when nothing has changed
 - once an error has been seen, a fresh sample is current and a check
   against it reports nothing
 - the same error recorded again after being seen is reported again,
   even to a cursor that consumed the first occurrence while another
   cursor marked the repeat as seen
 - independent cursors each observe each error

The lockless behaviour of errseq_t under concurrent updates and the WARN
path for invalid error values are deliberately out of scope.

Tested with ./tools/testing/kunit/kunit.py run, with a kunitconfig
enabling CONFIG_KUNIT=y and CONFIG_ERRSEQ_KUNIT_TEST=y; all 13 tests pass
under ARCH=um.

Link: https://lore.kernel.org/20260812-errseq-kunit-v1-1-312be4c3aa0d@gmail.com
Signed-off-by: Thomas Maarseveen &lt;maarseveent@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Acked-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Cc: David Gow &lt;david@davidgow.net&gt;
</content>
</entry>
</feed>
