Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
89219cf5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
89219cf5
编写于
1月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1647 fileio新增close,fdatasyncSync测试用例
Merge pull request !1647 from raoxian/master
上级
23f43bd0
5a4cd7d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
117 addition
and
26 deletion
+117
-26
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
.../main/js/default/test/module_fileio/members/close.test.js
+71
-1
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
...n/js/default/test/module_fileio/members/fdatasync.test.js
+46
-25
未找到文件。
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js
浏览文件 @
89219cf5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
{
import
{
fileio
,
fileio
,
describe
,
it
,
expect
,
describe
,
it
,
expect
,
nextFileName
,
prepareFile
,
FILE_CONTENT
}
from
'
../../Common
'
;
}
from
'
../../Common
'
;
describe
(
'
fileio_close
'
,
function
()
{
describe
(
'
fileio_close
'
,
function
()
{
...
@@ -55,4 +55,74 @@ describe('fileio_close', function () {
...
@@ -55,4 +55,74 @@ describe('fileio_close', function () {
console
.
log
(
'
fileio_test_close_sync_001 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_close_sync_001 has failed for
'
+
e
);
}
}
})
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0000
* @tc.name fileio_test_close_async_000
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
.
close
(
fd
,
function
(
err
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0010
* @tc.name fileio_test_close_async_001
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_close_async_001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
expect
(
await
fileio
.
close
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_close_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
})
/**
* @tc.number SUB_DF_FILEIO_CLOSE_ASYNC_0020
* @tc.name fileio_test_close_async_002
* @tc.desc Test close() interfaces
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_close_async_002
'
,
0
,
async
function
(
done
)
{
try
{
await
fileio
.
close
(
-
1
);
expect
(
null
).
assertFail
();
done
();
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_close_async_002 has failed for
'
+
e
);
done
();
}
})
})
})
storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js
浏览文件 @
89219cf5
...
@@ -48,7 +48,7 @@ describe('fileio_fdatasync', async function () {
...
@@ -48,7 +48,7 @@ describe('fileio_fdatasync', async function () {
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0010
* @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0010
* @tc.name fileio_test_fdatasync_async_001
* @tc.name fileio_test_fdatasync_async_001
* @tc.desc Test fdatasync
Sync
() interfaces.
* @tc.desc Test fdatasync() interfaces.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
...
@@ -60,11 +60,17 @@ describe('fileio_fdatasync', async function () {
...
@@ -60,11 +60,17 @@ describe('fileio_fdatasync', async function () {
try
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
fileio
fileio
.
write
(
fd
,
FILE_CONTENT
);
.
fdatasync
(
fd
)
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
.
then
(
function
(
err
)
{
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
})
.
catch
(
function
(
err
)
{
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
});
});
...
@@ -78,46 +84,61 @@ describe('fileio_fdatasync', async function () {
...
@@ -78,46 +84,61 @@ describe('fileio_fdatasync', async function () {
* @tc.level Level 0
* @tc.level Level 0
* @tc.require
* @tc.require
*/
*/
it
(
'
fileio_test_fdatasync_async_002
'
,
0
,
async
function
(
)
{
it
(
'
fileio_test_fdatasync_async_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_async_002
'
);
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_async_002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
let
fd
=
-
1
;
fileio
await
fileio
.
fdatasync
(
fd
);
.
fdatasync
(
fd
)
expect
(
null
).
assertFail
();
.
then
(
function
(
err
)
{
done
()
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
})
.
catch
(
function
(
err
)
{
expect
(
null
).
assertFail
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!
e
).
assertTrue
();
console
.
log
(
'
fileio_test_fdatasync_async_002 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_fdatasync_async_002 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
done
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_
ASYNC_003
0
* @tc.number SUB_DF_FILEIO_FDATASYNC_
SYNC_000
0
* @tc.name fileio_test_fdatasync_
async_003
* @tc.name fileio_test_fdatasync_
sync_000
* @tc.desc Test fdatasync() interfaces.
* @tc.desc Test fdatasync
Sync
() interfaces.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 0
* @tc.level Level 0
* @tc.require
* @tc.require
*/
*/
it
(
'
fileio_test_fdatasync_
async_003
'
,
0
,
async
function
()
{
it
(
'
fileio_test_fdatasync_
sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_
async_003
'
);
let
fpath
=
await
nextFileName
(
'
fileio_test_fdatasync_
sync_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
let
fd
=
-
1
;
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o666
);
await
fileio
.
fdatasync
(
fd
);
expect
(
fileio
.
fdatasyncSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
==
null
).
assertTrue
();
expect
(
fileio
.
unlinkSync
(
fpath
)
==
null
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_sync_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
});
/**
* @tc.number SUB_DF_FILEIO_FDATASYNC_SYNC_0010
* @tc.name fileio_test_fdatasync_sync_001
* @tc.desc Test fdatasyncSync() interfaces.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileio_test_fdatasync_sync_001
'
,
0
,
async
function
()
{
try
{
fileio
.
fdatasyncSync
(
-
1
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_fdatasync_
async_003
has failed for
'
+
e
);
console
.
log
(
'
fileio_test_fdatasync_
sync_001
has failed for
'
+
e
);
}
}
});
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录