test/blobfs: test long file name when opening file in async mode

Change-Id: If5ebe2fba160d0c215f638a80dbeece1440a7cb5
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/365108
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Liang Yan 2017-06-13 15:42:08 +08:00 committed by Jim Harris
parent e7a4813641
commit 097352282f

View File

@ -113,8 +113,10 @@ fs_open(void)
spdk_fs_iter iter;
struct spdk_bs_dev dev;
struct spdk_file *file;
char name[257] = {'\0'};
init_dev(&dev);
memset(name, 'a', sizeof(name) - 1);
spdk_allocate_thread(_fs_send_msg, NULL);
spdk_fs_init(&dev, NULL, fs_op_with_handle_complete, NULL);
@ -122,6 +124,11 @@ fs_open(void)
CU_ASSERT(g_fserrno == 0);
fs = g_fs;
g_fserrno = 0;
/* Open should fail, because the file name is too long. */
spdk_fs_open_file_async(fs, name, SPDK_BLOBFS_OPEN_CREATE, open_cb, NULL);
CU_ASSERT(g_fserrno == -ENAMETOOLONG);
g_fserrno = 0;
spdk_fs_open_file_async(fs, "file1", 0, open_cb, NULL);
CU_ASSERT(g_fserrno == -ENOENT);