Re: [PATCH v4 3/3] configfs: Add unit tests

From: Brendan Higgins
Date: Tue Aug 10 2021 - 18:01:11 EST


On Mon, Aug 9, 2021 at 7:59 AM Christoph Hellwig <hch@xxxxxx> wrote:
>
> > text and binary attribute support. This is how I run these tests:
> >
> > set -e
> > if [ -e .config ]; then
> > make ARCH=um mrproper
> > fi
> > if [ ! -e .kunit/.kunitconfig ]; then
> > cat <<EOF >.kunit/.kunitconfig
> > CONFIG_CONFIGFS_FS=y
> > CONFIG_CONFIGFS_KUNIT_TEST=y
> > CONFIG_KUNIT=y
> > CONFIG_PROVE_LOCKING=y
> > CONFIG_SYSFS=y
> > CONFIG_UBSAN=y
> > EOF
> > cp .kunit/.kunitconfig .kunit/.config
> > fi
> > ./tools/testing/kunit/kunit.py run
>
> This is very useful documentation, but shouldn't it go into a README.kunit
> or similar instead of a commit message?

You could also put this in a .kunitconfig specific to your subsystem
like we did for ext4:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ext4/.kunitconfig

You can then build using this .kunitconfig with something like:

./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig

> > +config CONFIGFS_KUNIT_TEST
> > + bool "Configfs Kunit test" if !KUNIT_ALL_TESTS
> > + depends on CONFIGFS_FS && KUNIT=y
> > + default KUNIT_ALL_TESTS

Cheers!