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: Jim Harris <james.r.harris@intel.com> Change-Id: I31acfb1d7e418f011acc9b48933032d8bf8a1c53 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15511 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
parent
327d1c988d
commit
0d3b54825e
@ -132,6 +132,8 @@ subsystem_sort(void)
|
|||||||
void
|
void
|
||||||
spdk_subsystem_init_next(int rc)
|
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 */
|
/* The initialization is interrupted by the spdk_subsystem_fini, so just return */
|
||||||
if (g_subsystems_init_interrupted) {
|
if (g_subsystems_init_interrupted) {
|
||||||
return;
|
return;
|
||||||
@ -167,6 +169,8 @@ spdk_subsystem_init(spdk_subsystem_init_fn cb_fn, void *cb_arg)
|
|||||||
{
|
{
|
||||||
struct spdk_subsystem_depend *dep;
|
struct spdk_subsystem_depend *dep;
|
||||||
|
|
||||||
|
assert(spdk_get_thread() == spdk_thread_get_app_thread());
|
||||||
|
|
||||||
g_subsystem_start_fn = cb_fn;
|
g_subsystem_start_fn = cb_fn;
|
||||||
g_subsystem_start_arg = cb_arg;
|
g_subsystem_start_arg = cb_arg;
|
||||||
|
|
||||||
|
@ -208,12 +208,17 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
CU_pSuite suite = NULL;
|
CU_pSuite suite = NULL;
|
||||||
unsigned int num_failures;
|
unsigned int num_failures;
|
||||||
|
struct spdk_thread *thread;
|
||||||
|
|
||||||
CU_set_error_action(CUEA_ABORT);
|
CU_set_error_action(CUEA_ABORT);
|
||||||
CU_initialize_registry();
|
CU_initialize_registry();
|
||||||
|
|
||||||
suite = CU_add_suite("subsystem_suite", NULL, NULL);
|
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_single);
|
||||||
CU_ADD_TEST(suite, subsystem_sort_test_depends_on_multiple);
|
CU_ADD_TEST(suite, subsystem_sort_test_depends_on_multiple);
|
||||||
CU_ADD_TEST(suite, subsystem_sort_test_missing_dependency);
|
CU_ADD_TEST(suite, subsystem_sort_test_missing_dependency);
|
||||||
|
Loading…
Reference in New Issue
Block a user