Commit 635dcd16 authored by David Gow's avatar David Gow Committed by Shuah Khan
Browse files

thunderbolt: test: Use kunit_test_suite() macro



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'

Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarDaniel Latypov <dlatypov@google.com>
Acked-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Signed-off-by: default avatarDavid Gow <davidgow@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent e5857d39
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -28,8 +28,10 @@ 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 (USB4=m || KUNIT=y)
	depends on KUNIT
	default KUNIT_ALL_TESTS

config USB4_DMA_TEST
	tristate "DMA traffic test driver"
+0 −3
Original line number Diff line number Diff line
@@ -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();
}
+0 −8
Original line number Diff line number Diff line
@@ -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
+1 −11
Original line number Diff line number Diff line
@@ -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);