Commit c1fbefa1 authored by Ben Walker's avatar Ben Walker Committed by Darek Stojaczyk
Browse files

thread: Simplify two unit tests with nested poll calls



Now that spdk_thread_poll can be called from within
a thread, some of the unit tests can be a bit simpler.

Change-Id: Ib7b92c3f59862e5c128f5e0cc8a08f65e2b89e93
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/441160


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 13586cd8
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -779,11 +779,9 @@ blob_snapshot_freeze_io(void)
	 * Flag 'frozen_io' is set in _spdk_bs_snapshot_freeze_cpl callback.
	 * Four async I/O operations happen before that. */
	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	spdk_thread_poll(thread, 1);
	spdk_thread_poll(thread, 1);
	spdk_thread_poll(thread, 1);
	spdk_set_thread(thread);

	CU_ASSERT(TAILQ_EMPTY(&bs_channel->queued_io));

+0 −14
Original line number Diff line number Diff line
@@ -146,9 +146,7 @@ _fs_init(void *arg)
	dev = init_dev();
	spdk_fs_init(dev, NULL, send_request, fs_op_with_handle_complete, NULL);
	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);

	SPDK_CU_ASSERT_FATAL(g_fs != NULL);
	SPDK_CU_ASSERT_FATAL(g_fs->bdev == dev);
@@ -163,9 +161,7 @@ _fs_unload(void *arg)
	g_fserrno = -1;
	spdk_fs_unload(g_fs, fs_op_complete, NULL);
	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);
	CU_ASSERT(g_fserrno == 0);
	g_fs = NULL;
}
@@ -239,9 +235,7 @@ cache_write_null_buffer(void)
	spdk_fs_free_io_channel(channel);

	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);

	ut_send_request(_fs_unload, NULL);
}
@@ -271,9 +265,7 @@ fs_create_sync(void)
	spdk_fs_free_io_channel(channel);

	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);

	ut_send_request(_fs_unload, NULL);
}
@@ -314,9 +306,7 @@ cache_append_no_cache(void)
	spdk_fs_free_io_channel(channel);

	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);

	ut_send_request(_fs_unload, NULL);
}
@@ -353,9 +343,7 @@ fs_delete_file_without_close(void)
	spdk_fs_free_io_channel(channel);

	thread = spdk_get_thread();
	spdk_set_thread(NULL);
	while (spdk_thread_poll(thread, 0) > 0) {}
	spdk_set_thread(thread);

	ut_send_request(_fs_unload, NULL);

@@ -390,9 +378,7 @@ spdk_thread(void *arg)
		}
		pthread_mutex_unlock(&g_mutex);

		spdk_set_thread(NULL);
		spdk_thread_poll(thread, 0);
		spdk_set_thread(thread);
	}

	return NULL;