linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: 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>,
	Andra Paraschiv <andraprs@amazon.com>,
	Longpeng <longpeng2@huawei.com>
Cc: "David Gow" <davidgow@google.com>,
	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: [PATCH 3/5] thunderbolt: test: Use kunit_test_suite() macro
Date: Sat, 18 Jun 2022 17:03:08 +0800	[thread overview]
Message-ID: <20220618090310.1174932-4-davidgow@google.com> (raw)
In-Reply-To: <20220618090310.1174932-1-davidgow@google.com>

The new implementation of kunit_test_suite() for modules no longer
conflicts with module_init, so can now be used by the thunderbolt tests.

Also update the Kconfig entry to enable the test when KUNIT_ALL_TESTS is
enabled.

This means that kunit_tool can now successfully run and parse the test
results with, for example:
	./tools/testing/kunit/kunit.py run --arch=x86_64 \
	--kconfig_add CONFIG_PCI=y --kconfig_add CONFIG_USB4=y \
	'thunderbolt'

Signed-off-by: David Gow <davidgow@google.com>
---
 drivers/thunderbolt/domain.c |  3 ---
 drivers/thunderbolt/tb.h     |  8 --------
 drivers/thunderbolt/test.c   | 12 +-----------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index 2889a214dadc..99211f35a5cd 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -872,7 +872,6 @@ int tb_domain_init(void)
 {
 	int ret;
 
-	tb_test_init();
 	tb_debugfs_init();
 	tb_acpi_init();
 
@@ -890,7 +889,6 @@ int tb_domain_init(void)
 err_acpi:
 	tb_acpi_exit();
 	tb_debugfs_exit();
-	tb_test_exit();
 
 	return ret;
 }
@@ -903,5 +901,4 @@ void tb_domain_exit(void)
 	tb_xdomain_exit();
 	tb_acpi_exit();
 	tb_debugfs_exit();
-	tb_test_exit();
 }
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 4602c69913fa..a831faa50f65 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1271,12 +1271,4 @@ static inline void tb_service_debugfs_init(struct tb_service *svc) { }
 static inline void tb_service_debugfs_remove(struct tb_service *svc) { }
 #endif
 
-#ifdef CONFIG_USB4_KUNIT_TEST
-int tb_test_init(void);
-void tb_test_exit(void);
-#else
-static inline int tb_test_init(void) { return 0; }
-static inline void tb_test_exit(void) { }
-#endif
-
 #endif
diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c
index ee37f8b58f50..24c06e7354cd 100644
--- a/drivers/thunderbolt/test.c
+++ b/drivers/thunderbolt/test.c
@@ -2817,14 +2817,4 @@ static struct kunit_suite tb_test_suite = {
 	.test_cases = tb_test_cases,
 };
 
-static struct kunit_suite *tb_test_suites[] = { &tb_test_suite, NULL };
-
-int tb_test_init(void)
-{
-	return __kunit_test_suites_init(tb_test_suites);
-}
-
-void tb_test_exit(void)
-{
-	return __kunit_test_suites_exit(tb_test_suites);
-}
+kunit_test_suite(tb_test_suite);
-- 
2.36.1.476.g0c4daa206d-goog


  parent reply	other threads:[~2022-06-18  9:03 UTC|newest]

Thread overview: 14+ 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 ` [PATCH 1/5] kunit: unify module and builtin suite definitions David Gow
2022-06-18 11:36   ` 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 13:58   ` kernel test robot
2022-06-18 14:49   ` kernel test robot
2022-06-18  9:03 ` David Gow [this message]
2022-06-20  5:05   ` [PATCH 3/5] thunderbolt: test: Use kunit_test_suite() macro Mika Westerberg
2022-06-18  9:03 ` [PATCH 4/5] nitro_enclaves: " David Gow
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 17:11 ` [PATCH 0/5] Rework KUnit test execution in modules Maíra Canal
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=20220618090310.1174932-4-davidgow@google.com \
    --to=davidgow@google.com \
    --cc=andraprs@amazon.com \
    --cc=andrew@aj.id.au \
    --cc=brendanhiggins@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).