All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paraschiv, Andra-Irina" <andraprs@amazon.com>
To: David Gow <davidgow@google.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	Daniel Latypov <dlatypov@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Andrew Jeffery <andrew@aj.id.au>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Longpeng <longpeng2@huawei.com>
Cc: kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Maíra Canal" <maira.canal@usp.br>,
	linux-mmc@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
	openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org,
	linux-modules@vger.kernel.org,
	"Matt Johnston" <matt@codeconstruct.com.au>
Subject: Re: [PATCH 4/5] nitro_enclaves: test: Use kunit_test_suite() macro
Date: Mon, 20 Jun 2022 12:26:14 +0300	[thread overview]
Message-ID: <d6f031fa-f287-75e6-dee0-b94bd22bd32d@amazon.com> (raw)
In-Reply-To: <20220618090310.1174932-5-davidgow@google.com>



On 18.06.2022 12:03, David Gow wrote:
> 
> The kunit_test_suite() macro previously conflicted with module_init,
> making it unsuitable for use in the nitro_enclaves test. Now that it's
> fixed, we can use it instead of a custom call into internal KUnit
> functions to run the test.
> 
> As a side-effect, this means that the test results are properly included
> with other suites when built-in. To celebrate, enable the test by
> default when KUNIT_ALL_TESTS is set (and NITRO_ENCLAVES enabled).
> 
> The nitro_enclave tests can now be run via kunit_tool with:
>          ./tools/testing/kunit/kunit.py run --arch=x86_64 \
>          --kconfig_add CONFIG_PCI=y --kconfig_add CONFIG_SMP=y \
>          --kconfig_add CONFIG_HOTPLUG_CPU=y \
>          --kconfig_add CONFIG_VIRT_DRIVERS=y \
>          --kconfig_add CONFIG_NITRO_ENCLAVES=y \
>          'ne_misc_dev_test'
> 
> (This is a pretty long command, so it may be worth adding a .kunitconfig
> file at some point, instead.)
> 
> Signed-off-by: David Gow <davidgow@google.com>

Thank you, David, for the KUnit update and for this patch.

> ---
>   drivers/thunderbolt/Kconfig                   |  5 ++--
>   drivers/virt/nitro_enclaves/Kconfig           |  5 ++--
>   drivers/virt/nitro_enclaves/ne_misc_dev.c     | 27 -------------------
>   .../virt/nitro_enclaves/ne_misc_dev_test.c    |  5 +---
>   4 files changed, 7 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/thunderbolt/Kconfig b/drivers/thunderbolt/Kconfig
> index 4bfec8a28064..2a063d344b94 100644
> --- a/drivers/thunderbolt/Kconfig
> +++ b/drivers/thunderbolt/Kconfig
> @@ -28,8 +28,9 @@ config USB4_DEBUGFS_WRITE
>            this for production systems or distro kernels.
> 
>   config USB4_KUNIT_TEST
> -       bool "KUnit tests"
> -       depends on KUNIT=y
> +       bool "KUnit tests" if !KUNIT_ALL_TESTS
> +       depends on KUNIT
> +       default KUNIT_ALL_TESTS
> 
>   config USB4_DMA_TEST
>          tristate "DMA traffic test driver"

This needs to be included in the previous patch instead (patch 3/5, for 
thunderbolt).

> diff --git a/drivers/virt/nitro_enclaves/Kconfig b/drivers/virt/nitro_enclaves/Kconfig
> index 2d3d98158121..ce91add81401 100644
> --- a/drivers/virt/nitro_enclaves/Kconfig
> +++ b/drivers/virt/nitro_enclaves/Kconfig
> @@ -16,8 +16,9 @@ config NITRO_ENCLAVES
>            The module will be called nitro_enclaves.
> 
>   config NITRO_ENCLAVES_MISC_DEV_TEST
> -       bool "Tests for the misc device functionality of the Nitro Enclaves"
> -       depends on NITRO_ENCLAVES && KUNIT=y
> +       bool "Tests for the misc device functionality of the Nitro Enclaves" if !KUNIT_ALL_TESTS
> +       depends on NITRO_ENCLAVES && KUNIT
> +       default KUNIT_ALL_TESTS
>          help
>            Enable KUnit tests for the misc device functionality of the Nitro
>            Enclaves. Select this option only if you will boot the kernel for
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> index 20c881b6a4b6..241b94f62e56 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> @@ -1759,35 +1759,10 @@ static long ne_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> 
>   #if defined(CONFIG_NITRO_ENCLAVES_MISC_DEV_TEST)
>   #include "ne_misc_dev_test.c"
> -
> -static inline int ne_misc_dev_test_init(void)
> -{
> -       return __kunit_test_suites_init(ne_misc_dev_test_suites);
> -}
> -
> -static inline void ne_misc_dev_test_exit(void)
> -{
> -       __kunit_test_suites_exit(ne_misc_dev_test_suites);
> -}
> -#else
> -static inline int ne_misc_dev_test_init(void)
> -{
> -       return 0;
> -}
> -
> -static inline void ne_misc_dev_test_exit(void)
> -{
> -}
>   #endif
> 
>   static int __init ne_init(void)
>   {
> -       int rc = 0;
> -
> -       rc = ne_misc_dev_test_init();
> -       if (rc < 0)
> -               return rc;
> -
>          mutex_init(&ne_cpu_pool.mutex);
> 
>          return pci_register_driver(&ne_pci_driver);
> @@ -1798,8 +1773,6 @@ static void __exit ne_exit(void)
>          pci_unregister_driver(&ne_pci_driver);
> 
>          ne_teardown_cpu_pool();
> -
> -       ne_misc_dev_test_exit();
>   }
> 
>   module_init(ne_init);
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev_test.c b/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> index 265797bed0ea..74df43b925be 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> @@ -151,7 +151,4 @@ static struct kunit_suite ne_misc_dev_test_suite = {
>          .test_cases = ne_misc_dev_test_cases,
>   };
> 
> -static struct kunit_suite *ne_misc_dev_test_suites[] = {
> -       &ne_misc_dev_test_suite,
> -       NULL
> -};
> +kunit_test_suite(ne_misc_dev_test_suite);
> --
> 2.36.1.476.g0c4daa206d-goog
> 

Other than that, looks good to me.

Thank you.

Andra



Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.

WARNING: multiple messages have this Message-ID (diff)
From: "Paraschiv, Andra-Irina" <andraprs@amazon.com>
To: David Gow <davidgow@google.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	Daniel Latypov <dlatypov@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Andrew Jeffery <andrew@aj.id.au>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Longpeng <longpeng2@huawei.com>
Cc: linux-aspeed@lists.ozlabs.org, "Maíra Canal" <maira.canal@usp.br>,
	openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	"Matt Johnston" <matt@codeconstruct.com.au>,
	linux-modules@vger.kernel.org, kunit-dev@googlegroups.com
Subject: Re: [PATCH 4/5] nitro_enclaves: test: Use kunit_test_suite() macro
Date: Mon, 20 Jun 2022 12:26:14 +0300	[thread overview]
Message-ID: <d6f031fa-f287-75e6-dee0-b94bd22bd32d@amazon.com> (raw)
In-Reply-To: <20220618090310.1174932-5-davidgow@google.com>



On 18.06.2022 12:03, David Gow wrote:
> 
> The kunit_test_suite() macro previously conflicted with module_init,
> making it unsuitable for use in the nitro_enclaves test. Now that it's
> fixed, we can use it instead of a custom call into internal KUnit
> functions to run the test.
> 
> As a side-effect, this means that the test results are properly included
> with other suites when built-in. To celebrate, enable the test by
> default when KUNIT_ALL_TESTS is set (and NITRO_ENCLAVES enabled).
> 
> The nitro_enclave tests can now be run via kunit_tool with:
>          ./tools/testing/kunit/kunit.py run --arch=x86_64 \
>          --kconfig_add CONFIG_PCI=y --kconfig_add CONFIG_SMP=y \
>          --kconfig_add CONFIG_HOTPLUG_CPU=y \
>          --kconfig_add CONFIG_VIRT_DRIVERS=y \
>          --kconfig_add CONFIG_NITRO_ENCLAVES=y \
>          'ne_misc_dev_test'
> 
> (This is a pretty long command, so it may be worth adding a .kunitconfig
> file at some point, instead.)
> 
> Signed-off-by: David Gow <davidgow@google.com>

Thank you, David, for the KUnit update and for this patch.

> ---
>   drivers/thunderbolt/Kconfig                   |  5 ++--
>   drivers/virt/nitro_enclaves/Kconfig           |  5 ++--
>   drivers/virt/nitro_enclaves/ne_misc_dev.c     | 27 -------------------
>   .../virt/nitro_enclaves/ne_misc_dev_test.c    |  5 +---
>   4 files changed, 7 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/thunderbolt/Kconfig b/drivers/thunderbolt/Kconfig
> index 4bfec8a28064..2a063d344b94 100644
> --- a/drivers/thunderbolt/Kconfig
> +++ b/drivers/thunderbolt/Kconfig
> @@ -28,8 +28,9 @@ config USB4_DEBUGFS_WRITE
>            this for production systems or distro kernels.
> 
>   config USB4_KUNIT_TEST
> -       bool "KUnit tests"
> -       depends on KUNIT=y
> +       bool "KUnit tests" if !KUNIT_ALL_TESTS
> +       depends on KUNIT
> +       default KUNIT_ALL_TESTS
> 
>   config USB4_DMA_TEST
>          tristate "DMA traffic test driver"

This needs to be included in the previous patch instead (patch 3/5, for 
thunderbolt).

> diff --git a/drivers/virt/nitro_enclaves/Kconfig b/drivers/virt/nitro_enclaves/Kconfig
> index 2d3d98158121..ce91add81401 100644
> --- a/drivers/virt/nitro_enclaves/Kconfig
> +++ b/drivers/virt/nitro_enclaves/Kconfig
> @@ -16,8 +16,9 @@ config NITRO_ENCLAVES
>            The module will be called nitro_enclaves.
> 
>   config NITRO_ENCLAVES_MISC_DEV_TEST
> -       bool "Tests for the misc device functionality of the Nitro Enclaves"
> -       depends on NITRO_ENCLAVES && KUNIT=y
> +       bool "Tests for the misc device functionality of the Nitro Enclaves" if !KUNIT_ALL_TESTS
> +       depends on NITRO_ENCLAVES && KUNIT
> +       default KUNIT_ALL_TESTS
>          help
>            Enable KUnit tests for the misc device functionality of the Nitro
>            Enclaves. Select this option only if you will boot the kernel for
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> index 20c881b6a4b6..241b94f62e56 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> @@ -1759,35 +1759,10 @@ static long ne_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> 
>   #if defined(CONFIG_NITRO_ENCLAVES_MISC_DEV_TEST)
>   #include "ne_misc_dev_test.c"
> -
> -static inline int ne_misc_dev_test_init(void)
> -{
> -       return __kunit_test_suites_init(ne_misc_dev_test_suites);
> -}
> -
> -static inline void ne_misc_dev_test_exit(void)
> -{
> -       __kunit_test_suites_exit(ne_misc_dev_test_suites);
> -}
> -#else
> -static inline int ne_misc_dev_test_init(void)
> -{
> -       return 0;
> -}
> -
> -static inline void ne_misc_dev_test_exit(void)
> -{
> -}
>   #endif
> 
>   static int __init ne_init(void)
>   {
> -       int rc = 0;
> -
> -       rc = ne_misc_dev_test_init();
> -       if (rc < 0)
> -               return rc;
> -
>          mutex_init(&ne_cpu_pool.mutex);
> 
>          return pci_register_driver(&ne_pci_driver);
> @@ -1798,8 +1773,6 @@ static void __exit ne_exit(void)
>          pci_unregister_driver(&ne_pci_driver);
> 
>          ne_teardown_cpu_pool();
> -
> -       ne_misc_dev_test_exit();
>   }
> 
>   module_init(ne_init);
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev_test.c b/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> index 265797bed0ea..74df43b925be 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev_test.c
> @@ -151,7 +151,4 @@ static struct kunit_suite ne_misc_dev_test_suite = {
>          .test_cases = ne_misc_dev_test_cases,
>   };
> 
> -static struct kunit_suite *ne_misc_dev_test_suites[] = {
> -       &ne_misc_dev_test_suite,
> -       NULL
> -};
> +kunit_test_suite(ne_misc_dev_test_suite);
> --
> 2.36.1.476.g0c4daa206d-goog
> 

Other than that, looks good to me.

Thank you.

Andra



Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.

  reply	other threads:[~2022-06-20  9:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-18  9:03 [PATCH 0/5] Rework KUnit test execution in modules David Gow
2022-06-18  9:03 ` David Gow
2022-06-18  9:03 ` [PATCH 1/5] kunit: unify module and builtin suite definitions David Gow
2022-06-18  9:03   ` David Gow
2022-06-18 11:36   ` kernel test robot
2022-06-18 11:36     ` kernel test robot
2022-06-18 12:47   ` kernel test robot
2022-06-18 12:47     ` kernel test robot
2022-06-18  9:03 ` [PATCH 2/5] kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites David Gow
2022-06-18  9:03   ` David Gow
2022-06-18 13:58   ` kernel test robot
2022-06-18 13:58     ` kernel test robot
2022-06-18 14:49   ` kernel test robot
2022-06-18 14:49     ` kernel test robot
2022-06-18  9:03 ` [PATCH 3/5] thunderbolt: test: Use kunit_test_suite() macro David Gow
2022-06-18  9:03   ` David Gow
2022-06-20  5:05   ` Mika Westerberg
2022-06-18  9:03 ` [PATCH 4/5] nitro_enclaves: " David Gow
2022-06-18  9:03   ` David Gow
2022-06-20  9:26   ` Paraschiv, Andra-Irina [this message]
2022-06-20  9:26     ` Paraschiv, Andra-Irina
2022-06-18  9:03 ` [PATCH 5/5] mmc: sdhci-of-aspeed: " David Gow
2022-06-18  9:03   ` David Gow
2022-06-18 17:11 ` [PATCH 0/5] Rework KUnit test execution in modules Maíra Canal
2022-06-18 17:11   ` Maíra Canal
2022-06-18 17:41 ` Christophe Leroy
2022-06-18 17:41   ` Christophe Leroy

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=d6f031fa-f287-75e6-dee0-b94bd22bd32d@amazon.com \
    --to=andraprs@amazon.com \
    --cc=andrew@aj.id.au \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=jk@codeconstruct.com.au \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=maira.canal@usp.br \
    --cc=matt@codeconstruct.com.au \
    --cc=mcgrof@kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=skhan@linuxfoundation.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 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.