<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/next/linux-next.git/lib/tests/errseq_kunit.c, branch master</title>
<subtitle>The linux-next integration testing tree</subtitle>
<id>https://git.landau.one/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master</id>
<link rel='self' href='https://git.landau.one/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.landau.one/pub/scm/linux/kernel/git/next/linux-next.git/'/>
<updated>2026-09-06T03:23:24+00:00</updated>
<entry>
<title>lib/tests: add KUnit tests for errseq</title>
<updated>2026-09-06T03:23:24+00:00</updated>
<author>
<name>Thomas Maarseveen</name>
<email>maarseveent@gmail.com</email>
</author>
<published>2026-08-12T18:55:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.landau.one/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=0f10b110fb9d14d609c12dcbb9abd87ead2b73d2'/>
<id>urn:sha1:0f10b110fb9d14d609c12dcbb9abd87ead2b73d2</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;
Acked-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Cc: David Gow &lt;david@davidgow.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
