test/blobfs: Test create sync file

Change-Id: I1f766502cf2d21698f01a05b755f15a7d346949a
Signed-off-by: Jing Xia <jingx.y.xia@intel.com>
Reviewed-on: https://review.gerrithub.io/361879
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Jing Xia 2017-05-17 02:38:12 +08:00 committed by Jim Harris
parent ecaf3fe140
commit 18bc3a5ef6

View File

@ -211,6 +211,34 @@ cache_write_null_buffer(void)
ut_send_request(_fs_unload, NULL);
}
static void
fs_create_sync(void)
{
int rc;
struct spdk_io_channel *channel;
ut_send_request(_fs_init, NULL);
spdk_allocate_thread();
channel = spdk_fs_alloc_io_channel_sync(g_fs, SPDK_IO_PRIORITY_DEFAULT);
CU_ASSERT(channel != NULL);
rc = spdk_fs_create_file(g_fs, channel, "testfile");
CU_ASSERT(rc == 0);
/* Create should fail, because the file already exists. */
rc = spdk_fs_create_file(g_fs, channel, "testfile");
CU_ASSERT(rc != 0);
rc = spdk_fs_delete_file(g_fs, channel, "testfile");
CU_ASSERT(rc == 0);
spdk_fs_free_io_channel(channel);
spdk_free_thread();
ut_send_request(_fs_unload, NULL);
}
static void
cache_append_no_cache(void)
{
@ -300,6 +328,7 @@ int main(int argc, char **argv)
if (
CU_add_test(suite, "write", cache_write) == NULL ||
CU_add_test(suite, "write_null_buffer", cache_write_null_buffer) == NULL ||
CU_add_test(suite, "create_sync", fs_create_sync) == NULL ||
CU_add_test(suite, "append_no_cache", cache_append_no_cache) == NULL
) {
CU_cleanup_registry();