The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Vinicius Peixoto <vpeixoto@lkcamp.dev>
To: "André Almeida" <andrealmeid@riseup.net>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
	~lkcamp/patches@lists.sr.ht, Rae Moar <rmoar@google.com>,
	David Gow <davidgow@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 0/1] Add KUnit tests for lib/crc16.c
Date: Tue, 24 Sep 2024 20:00:09 -0300	[thread overview]
Message-ID: <6d3025ed-e00d-4f8a-bab7-256cf78774af@lkcamp.dev> (raw)
In-Reply-To: <8291c6eb-750a-4ab2-8904-65d723d034dd@riseup.net>

Hi André,

On 9/24/24 6:33 PM, André Almeida wrote:
> Hey!
> 
> On 9/23/24 01:26, Vinicius Peixoto wrote:
>> Hi all,
>>
>> This patch was developed during a hackathon organized by LKCAMP [1],
>> with the objective of writing KUnit tests, both to introduce people to
>> the kernel development process and to learn about different subsystems
>> (with the positive side effect of improving the kernel test coverage, of
>> course).
>>
>> We noticed there were tests for CRC32 in lib/crc32test.c and thought it
>> would be nice to have something similar for CRC16, since it seems to be
>> widely used in network drivers (as well as in some ext4 code).
>>
>> Although this patch turned out quite big, most of the LOCs come from
>> tables containing randomly-generated test data that we use to validate
>> the kernel's implementation of CRC-16.
> Can you share how you created the tables? Given that is impossible to 
> review the table itself, at least people will be able to see how they 
> got created at least.

Yes, of course, that was an oversight on my part. I'll make sure to add 
a more detailed explanation in the cover letter/commit message for the 
next revisions. Thanks for the suggestion!

This test follows lib/crc32test.c very closely; the data table is filled 
with 4096 random bytes, and the idea is to calculate several checksums 
within it by randomly choosing a i) start offset within the data buffer, 
ii) number of bytes after the start offset and iii) input CRC.

The checksums for the randomly-generated test cases were calculated 
using a reference implementation [1] and this test compares them against 
the values yielded by the kernel's implementation.

Thanks,
Vinicius

[1] https://github.com/lammertb/libcrc/blob/master/src/crc16.c

>> We would really appreciate any feedback/suggestions on how to improve
>> this. Thanks! :-)
>>
>> Vinicius Peixoto (1):
>>    lib/crc16_kunit.c: add KUnit tests for crc16
>>
>>   lib/Kconfig.debug |   8 +
>>   lib/Makefile      |   1 +
>>   lib/crc16_kunit.c | 715 ++++++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 724 insertions(+)
>>   create mode 100644 lib/crc16_kunit.c
>>


  reply	other threads:[~2024-09-24 23:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-22 23:26 [PATCH 0/1] Add KUnit tests for lib/crc16.c Vinicius Peixoto
2024-09-22 23:26 ` [PATCH 1/1] lib/crc16_kunit.c: add KUnit tests for crc16 Vinicius Peixoto
2024-09-24 21:33 ` [PATCH 0/1] Add KUnit tests for lib/crc16.c André Almeida
2024-09-24 23:00   ` Vinicius Peixoto [this message]
2024-09-26 16:21     ` David Laight
2024-09-30  0:57       ` Vinicius Peixoto
2024-09-25 11:26 ` David Laight
2024-09-30  1:18   ` Vinicius Peixoto

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=6d3025ed-e00d-4f8a-bab7-256cf78774af@lkcamp.dev \
    --to=vpeixoto@lkcamp.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andrealmeid@riseup.net \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=~lkcamp/patches@lists.sr.ht \
    /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