mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mike Christie <michael.christie@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: core: Make scsi_lib KUnit tests modular for real
Date: Tue, 19 Mar 2024 10:01:11 -0700	[thread overview]
Message-ID: <0d41ae1a-f6aa-4377-b8a3-7fcf067f99ac@acm.org> (raw)
In-Reply-To: <CAMuHMdWzD1OR8qj8oHfUgQ9GMtrD8y69G+A+ONdVm0vTCvYe=w@mail.gmail.com>

On 3/19/24 09:10, Geert Uytterhoeven wrote:
> On Tue, Mar 19, 2024 at 5:03 PM Bart Van Assche <bvanassche@acm.org> wrote:
>> On 3/19/24 05:02, Geert Uytterhoeven wrote:
>> kernel module? What are the advantages compared to the current approach?
>> That information is missing from the patch description.
> 
> SCSI_LIB_KUNIT_TEST is already tristate, so the original author must
> have meant it to be modular.  Or perhaps he just copied it from
> (most/all) other tests ;-)
> 
> Anyway, I find it very useful to be able to do "modprobe kunit" and
> "modprobe <test>" to run a test when I feel the need to do so.

Hi Geert,

Why to run hardware-independent kunit tests on the target system instead
of on the host? Isn't it much more convenient when developing embedded
software to run kunit tests on the host using UML? The script I use to
run SCSI kunit tests is available below. And if there is a desire to run
SCSI tests on the target system, how about adding triggers in sysfs for
running kunit tests? The (GPL v2) Samsung smartphone kernel supports
this but I have not yet checked whether their implementation is
appropriate for the upstream kernel.

Thanks,

Bart.


#!/bin/sh

set -e

mkdir -p .kunit
if [ -e .config ]; then
     rm -f .config
     make ARCH=um mrproper
fi
if [ ! -e .kunit/.kunitconfig ] || [ "$0" -nt .kunit/.kunitconfig ]; then
     echo "Regenerating .kunit/.kunitconfig"
     cat <<EOF >.kunit/.kunitconfig
CONFIG_BLK_DEV_SD=y
CONFIG_BLK_DEV_ZONED=y
CONFIG_MQ_IOSCHED_DEADLINE=y
CONFIG_BLOCK=y
CONFIG_EISA=n
CONFIG_KUNIT=y
CONFIG_SCSI_PROCFS=n
#CONFIG_PROVE_LOCKING=y
CONFIG_SCSI=y
#CONFIG_SYSFS=y
CONFIG_UBSAN=y
CONFIG_KASAN=y
CONFIG_RUNTIME_TESTING_MENU=n
CONFIG_WERROR=y
EOF
     syms=(
	CONFIG_SCSI_ERROR_TEST
	CONFIG_SCSI_PROTO_TEST
	CONFIG_SCSI_SD_TEST
     )
     for s in "${syms[@]}"; do
     if git grep -qw "${s#CONFIG_}" block/Kconfig* drivers/scsi/Kconfig; 
then
	echo "$s=y" >> .kunit/.kunitconfig
     fi
     done
     cp .kunit/.kunitconfig .kunit/.config
fi
./tools/testing/kunit/kunit.py run

  reply	other threads:[~2024-03-19 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 12:02 Geert Uytterhoeven
2024-03-19 16:03 ` Bart Van Assche
2024-03-19 16:10   ` Geert Uytterhoeven
2024-03-19 17:01     ` Bart Van Assche [this message]
2024-03-20  8:08       ` Geert Uytterhoeven
2024-03-20 15:07         ` Bart Van Assche

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=0d41ae1a-f6aa-4377-b8a3-7fcf067f99ac@acm.org \
    --to=bvanassche@acm.org \
    --cc=geert@linux-m68k.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=martin.petersen@oracle.com \
    --cc=michael.christie@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®