public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christophe Leroy <christophe.leroy@c-s.fr>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	nnac123@linux.ibm.com, horms@kernel.org
Subject: Re: [PATCH next 2/8] test_hexdump: Create test output data from the binary input data buffer
Date: Thu, 13 Mar 2025 09:17:14 +0000	[thread overview]
Message-ID: <20250313091714.115978b6@pumpkin> (raw)
In-Reply-To: <Z9HiJM8VrXcglC5H@smile.fi.intel.com>

On Wed, 12 Mar 2025 21:36:04 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Wed, Mar 12, 2025 at 07:28:11PM +0000, David Laight wrote:
> > On Mon, 10 Mar 2025 10:31:10 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:  
> > > On Sat, Mar 08, 2025 at 09:34:46AM +0000, David Laight wrote:  
> > > > Using the same data that is passed to hex_dump_to_buffer() lets
> > > > the tests be expanded to test different input data bytes.    
> > > 
> > > Do we really need to kill the static test cases?
> > > Are they anyhow harmful?  
> > 
> > I was asked to add some extra tests for other byte values.  
> 
> Right and thanks for doing that!
> 
> > The static result buffers just get in the way.
> > 
> > They are also not necessary since the tests are comparing the output
> > of two (hopefully) different implementations and checking they are
> > the same.  
> 
> Not necessary doesn't mean harmful or working wrong. I would leave them as is
> and just add a dynamic test cases on top. Static data is kinda randomised, but
> at the same time it's always the same through the test runs. IIRC your dynamic
> case generates the expected output and hence uses the code that also needs to
> be tested strictly speaking.
> 

The old data wasn't really randomised at all.
It tended to run a selected tests lots of times.
As an example there is no point randomly selecting between running the
'rowsize == 16' and 'rowsize == 32' tests several times when you can just
run each test once.

While that can make sense for some kinds of tests it is pointless here.
Much better to always run the same tests and to always cover the 'interesting'
cases - there are lots of very boring cases that all go through the same code
paths pretty much regardless of the implementation.
It is the corner cases that matter.

At one point I was testing all 'bufsize * len * rowsize * groupsize' tests.
Doesn't actually take long even though there are a lot of tests.
But there is just no point testing all the cases where the buffer is long
enough for the data. The boundary conditions are enough - and there are
actually under a dozen of them. The proposed tests do about 1000 just to
save working out which ones matter.

	David


  reply	other threads:[~2025-03-13  9:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08  9:34 [PATCH next 0/8] test_hexdump: Improve test coverage David Laight
2025-03-08  9:34 ` [PATCH next 1/8] test_hexdump: Change rowsize and groupsize to size_t David Laight
2025-03-10  8:28   ` Andy Shevchenko
2025-03-08  9:34 ` [PATCH next 2/8] test_hexdump: Create test output data from the binary input data buffer David Laight
2025-03-10  8:31   ` Andy Shevchenko
2025-03-12 19:28     ` David Laight
2025-03-12 19:36       ` Andy Shevchenko
2025-03-13  9:17         ` David Laight [this message]
2025-03-08  9:34 ` [PATCH next 3/8] test_hexdump: Use longer variable names David Laight
2025-03-08  9:34 ` [PATCH next 4/8] test_hexdump: Check for buffer overrun of sample output buffer David Laight
2025-03-10  9:01   ` Andy Shevchenko
2025-03-12 19:37     ` David Laight
2025-03-08  9:34 ` [PATCH next 5/8] test_hexdump: Fix sample output if zero bytes requested David Laight
2025-03-10  9:03   ` Andy Shevchenko
2025-03-12 19:40     ` David Laight
2025-03-08  9:34 ` [PATCH next 6/8] test_hexdump: If a test fails print all the parameters David Laight
2025-03-08  9:34 ` [PATCH next 7/8] test_hexdump: Run fixed not random tests David Laight
2025-03-08  9:34 ` [PATCH next 8/8] test_hexdump: Test all 256 byte values David Laight

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=20250313091714.115978b6@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@c-s.fr \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=nnac123@linux.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox