Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
72e286c9
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看板
提交
72e286c9
编写于
3月 28, 2023
作者:
1
18721213663
提交者:
zhuhongtao66
3月 29, 2023
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix_fs_fdopenstream_close
Signed-off-by:
N
18721213663
<
zhuhongtao12@huawei.com
>
上级
f0a08c3a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
49 addition
and
9 deletion
+49
-9
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
...ragefileiov9jstest/src/main/js/test/members/close.test.js
+14
-8
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
...eiov9jstest/src/main/js/test/members/fdopenStream.test.js
+34
-0
storage/storagefileiov9jstest/src/main/js/test/members/stat.test.js
...oragefileiov9jstest/src/main/js/test/members/stat.test.js
+1
-1
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
浏览文件 @
72e286c9
...
...
@@ -37,6 +37,7 @@ describe('fileIO_fs_close', function () {
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_close_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -82,8 +83,9 @@ describe('fileIO_fs_close', function () {
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
closeSync
(
file
.
fd
);
let
fd
=
file
.
fd
;
fileIO
.
closeSync
(
file
);
fileIO
.
closeSync
(
fd
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
...
...
@@ -156,7 +158,7 @@ describe('fileIO_fs_close', function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_close_sync_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
139000
08
&&
e
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
e
.
code
==
139000
20
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
}
});
...
...
@@ -181,6 +183,7 @@ describe('fileIO_fs_close', function () {
console
.
log
(
'
fileIO_test_close_async_000 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
...
...
@@ -207,7 +210,7 @@ describe('fileIO_fs_close', function () {
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
fileIO
.
close
(
file
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_close_async_001 error package:
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
}
...
...
@@ -237,6 +240,7 @@ describe('fileIO_fs_close', function () {
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
fileIO
.
close
(
file
.
fd
);
await
fileIO
.
close
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -286,8 +290,9 @@ describe('fileIO_fs_close', function () {
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
fileIO
.
close
(
file
.
fd
);
await
fileIO
.
close
(
file
.
fd
);
let
fd
=
file
.
fd
;
await
fileIO
.
close
(
file
);
await
fileIO
.
close
(
fd
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
...
...
@@ -337,12 +342,13 @@ describe('fileIO_fs_close', function () {
it
(
'
fileIO_test_close_async_006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_close_async_006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
await
fileIO
.
close
(
file
.
fd
,
2
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_close_async_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
...
...
@@ -367,7 +373,7 @@ describe('fileIO_fs_close', function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_close_async_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
139000
08
&&
e
.
message
==
'
Bad file descriptor
'
).
assertTrue
();
expect
(
e
.
code
==
139000
20
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
...
...
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
浏览文件 @
72e286c9
...
...
@@ -44,6 +44,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -93,6 +94,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpr
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -141,6 +143,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
fileIO
.
fdopenStreamSync
(
file
.
fd
,
'
ohos
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
}
...
...
@@ -166,6 +170,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
fileIO
.
fdopenStreamSync
(
file
.
fd
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
}
...
...
@@ -195,6 +201,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -227,6 +234,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let
fpr
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file1
);
fileIO
.
closeSync
(
file2
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -256,6 +265,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpw
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpw
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_008 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -289,6 +299,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let
fpr
=
fileIO
.
fdopenStreamSync
(
file2
.
fd
,
'
r
'
);
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file1
);
fileIO
.
closeSync
(
file2
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -320,6 +332,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_sync_010 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -348,6 +361,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpa
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpa
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_fdopenstream_sync_011 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
...
...
@@ -379,6 +393,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -413,6 +428,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpr
.
write
(
FILE_CONTENT
,
(
err
)
=>
{
if
(
err
)
{
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_001 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
...
@@ -497,6 +513,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpr
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -531,6 +548,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpr
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
...
...
@@ -560,6 +578,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
await
fileIO
.
fdopenStream
(
file
.
fd
,
'
ohos
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
...
...
@@ -586,6 +606,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
await
fileIO
.
fdopenStream
(
file
.
fd
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
...
...
@@ -616,6 +638,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_008 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -650,6 +673,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpw
.
read
(
new
ArrayBuffer
(
4096
),
(
err
)
=>
{
if
(
err
)
{
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_009 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
...
@@ -692,6 +716,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let
fpr
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file1
);
fileIO
.
closeSync
(
file2
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -722,6 +748,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpw
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpw
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -756,6 +783,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpw
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpw
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
).
assertTrue
();
fpw
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
...
...
@@ -790,6 +818,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let
fpr
=
await
fileIO
.
fdopenStream
(
file2
.
fd
,
'
r
'
);
expect
(
fpr
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fpr
.
closeSync
();
fileIO
.
closeSync
(
file1
);
fileIO
.
closeSync
(
file2
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -822,6 +852,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900005
&&
e
.
message
==
'
I/O error
'
).
assertTrue
();
...
...
@@ -856,6 +887,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpa
.
read
(
new
ArrayBuffer
(
4096
),
(
err
)
=>
{
if
(
err
)
{
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_fdopenstream_async_015 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
...
...
@@ -895,6 +927,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpa
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpa
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
@@ -929,6 +962,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect
(
fpa
.
writeSync
(
FILE_CONTENT
)
==
FILE_CONTENT
.
length
).
assertTrue
();
expect
(
fpa
.
readSync
(
new
ArrayBuffer
(
4096
))
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fpa
.
closeSync
();
fileIO
.
closeSync
(
file
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
...
...
storage/storagefileiov9jstest/src/main/js/test/members/stat.test.js
浏览文件 @
72e286c9
...
...
@@ -2304,7 +2304,7 @@ describe('fileIO_fs_stat', function () {
let
file2
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
stat
=
fileIO
.
statSync
(
file2
.
fd
);
expect
(
stat
.
size
==
FILE_CONTENT
.
length
*
2
).
assertTrue
();
fileIO
.
closeSync
(
file2
.
fd
);
fileIO
.
closeSync
(
file2
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
384753eb
·
3月 31, 2023
mentioned in commit
384753eb
mentioned in commit 384753ebf895bc08475a1d3d3995330d69faf68d
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录