Commit 0d3b5482 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

subsystem: assert all subsystems initialized on app thread



This requires creating and setting SPDK threads in the
subsystem unit tests as well.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I31acfb1d7e418f011acc9b48933032d8bf8a1c53
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15511


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 327d1c98
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ subsystem_sort(void)
void
spdk_subsystem_init_next(int rc)
{
	assert(spdk_get_thread() == spdk_thread_get_app_thread());

	/* The initialization is interrupted by the spdk_subsystem_fini, so just return */
	if (g_subsystems_init_interrupted) {
		return;
@@ -167,6 +169,8 @@ spdk_subsystem_init(spdk_subsystem_init_fn cb_fn, void *cb_arg)
{
	struct spdk_subsystem_depend *dep;

	assert(spdk_get_thread() == spdk_thread_get_app_thread());

	g_subsystem_start_fn = cb_fn;
	g_subsystem_start_arg = cb_arg;

+5 −0
Original line number Diff line number Diff line
@@ -208,12 +208,17 @@ main(int argc, char **argv)
{
	CU_pSuite	suite = NULL;
	unsigned int	num_failures;
	struct spdk_thread *thread;

	CU_set_error_action(CUEA_ABORT);
	CU_initialize_registry();

	suite = CU_add_suite("subsystem_suite", NULL, NULL);

	spdk_thread_lib_init(NULL, 0);
	thread = spdk_thread_create(NULL, NULL);
	spdk_set_thread(thread);

	CU_ADD_TEST(suite, subsystem_sort_test_depends_on_single);
	CU_ADD_TEST(suite, subsystem_sort_test_depends_on_multiple);
	CU_ADD_TEST(suite, subsystem_sort_test_missing_dependency);