All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Abhinav Saxena <xandfury@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Kees Cook <kees@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	llvm@lists.linux.dev, linux-hardening@vger.kernel.org
Subject: Re: [RFC PATCH 0/5] tty: Add KUnit test framework for TTY drivers
Date: Sun, 31 Aug 2025 08:07:07 +0200	[thread overview]
Message-ID: <49070681-9111-404a-a965-ca2b2eb2988c@kernel.org> (raw)
In-Reply-To: <20250826-tty-tests-v1-0-e904a817df92@gmail.com>

On 27. 08. 25, 0:51, Abhinav Saxena wrote:
> This patch series introduces a KUnit testing framework for the TTY
> subsystem, enabling deterministic, automated testing of TTY drivers and
> core functionality without requiring hardware or userspace interaction.
> 
> On an x86_64 build with CONFIG_GCOV enabled, these tests increased
> TTY subsystem coverage to approximately 10.6% line coverage and
> 14.7% function coverage [1].
> 
> Problem Statement
> -----------------
> Testing TTY drivers today requires:
> - User-space interaction through device nodes
> - Complex setup with ptys or real hardware
> - Limited ability to test error paths reliably and deterministically
> 
> This series solves these issues by providing in-kernel KUnit tests that
> exercise real TTY core paths under controlled, deterministic conditions.
> 
> What This Series Provides
> -------------------------
> 1. Reusable test helpers (`tty_test_helpers.h`):
>     - Minimal (~150 LOC) infrastructure that any TTY driver should be
>     able to use
>     - Automatic resource management
>     - Integrated into core files under KUnit guard, with
>       `EXPORT_SYMBOL_IF_KUNIT()` to keep the production symbol table
>       clean
> 
> 2. Mock TTY driver:
>     - Demonstrates how drivers can leverage the helpers
>     - Enables deterministic scenarios without hardware
> 
> 3. Core TTY tests:
>     - Validate open/close/read/write/termios paths
>     - Exercise hangup, resize, and error handling
>     - Ensure real kernel paths are tested, not mocked stubs
> 
> 4. ttynull driver tests:
>     - Validate data sink behavior of the null driver
>     - Provide a minimal driver contract baseline
> 
> 5. Optional coverage support:
>     - GCOV integration for test coverage analysis
> 
> Future Work
> -----------
> With this foundation merged, follow-up work can:
> - Add more coverage of TTY core functions
> - Enable each TTY driver to maintain its own KUnit suite
> - Introduce stress tests and race detection
> - Extend to include more tests for other tty drivers:
>    - UART drivers: test interrupt handling without hardware
>    - USB serial: validate disconnect and reconnect sequences
>    - PTY drivers: test resize, flow control, and hangups
>    - Virtual consoles: test Unicode and input handling
>    
> Testing
> -------
> - All patches pass `checkpatch.pl`
> - Verified on x86_64 with:
>      ./tools/testing/kunit/kunit.py run \
>          --kunitconfig=.kunit/ \
>          --kunitconfig=drivers/tty/tests/.kunitconfig \
>          --arch=x86_64
> - All tests pass (working around tty_read wrapper in progress)
> 
> Feedback welcome! :)

Wow, looks good. Has it found something yet :)?


FWIW
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

thanks,
-- 
js
suse labs

  parent reply	other threads:[~2025-08-31  6:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 22:51 [RFC PATCH 0/5] tty: Add KUnit test framework for TTY drivers Abhinav Saxena
2025-08-26 22:51 ` [RFC PATCH 1/5] tty: Add KUnit test infrastructure configuration Abhinav Saxena
2025-08-26 22:51 ` [RFC PATCH 2/5] tty: Add KUnit test helper functions Abhinav Saxena
2025-08-26 22:51 ` [RFC PATCH 3/5] tty: Add mock TTY driver for KUnit testing Abhinav Saxena
2025-08-26 22:51 ` [RFC PATCH 4/5] tty: Add KUnit tests for core TTY functionality Abhinav Saxena
2025-08-26 22:51 ` [RFC PATCH 5/5] tty: Add KUnit tests for ttynull driver Abhinav Saxena
2025-08-31  6:07 ` Jiri Slaby [this message]
2025-09-03  0:56   ` [RFC PATCH 0/5] tty: Add KUnit test framework for TTY drivers Abhinav Saxena

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49070681-9111-404a-a965-ca2b2eb2988c@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=xandfury@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.