Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9bdce29e
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看板
未验证
提交
9bdce29e
编写于
4月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8525 适配fs 取消File自动close fd
Merge pull request !8525 from zhuhongtao666/fix_close
上级
32fea8f1
b110bf0c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
31 deletion
+2
-31
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
...ragefileiov9jstest/src/main/js/test/members/close.test.js
+2
-3
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
...eiov9jstest/src/main/js/test/members/fdopenStream.test.js
+0
-28
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/close.test.js
浏览文件 @
9bdce29e
...
...
@@ -37,10 +37,10 @@ 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
);
expect
(
false
).
assertTrue
();
}
});
...
...
@@ -64,6 +64,7 @@ describe('fileIO_fs_close', function () {
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_close_sync_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
...
...
@@ -183,7 +184,6 @@ 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
();
});
...
...
@@ -240,7 +240,6 @@ 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
)
{
...
...
storage/storagefileiov9jstest/src/main/js/test/members/fdopenStream.test.js
浏览文件 @
9bdce29e
...
...
@@ -44,7 +44,6 @@ 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
();
...
...
@@ -94,7 +93,6 @@ 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
);
...
...
@@ -201,7 +199,6 @@ 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
();
...
...
@@ -234,8 +231,6 @@ 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
);
...
...
@@ -265,7 +260,6 @@ 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
);
...
...
@@ -299,8 +293,6 @@ 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
);
...
...
@@ -332,7 +324,6 @@ 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
();
...
...
@@ -361,7 +352,6 @@ 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
);
...
...
@@ -393,7 +383,6 @@ 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
();
...
...
@@ -428,7 +417,6 @@ 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
+
'
}
'
...
...
@@ -513,7 +501,6 @@ 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
)
{
...
...
@@ -548,7 +535,6 @@ 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
();
});
...
...
@@ -578,7 +564,6 @@ 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
();
...
...
@@ -606,7 +591,6 @@ 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
();
...
...
@@ -638,7 +622,6 @@ 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
();
...
...
@@ -673,7 +656,6 @@ 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
+
'
}
'
...
...
@@ -716,8 +698,6 @@ 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
)
{
...
...
@@ -748,7 +728,6 @@ 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
)
{
...
...
@@ -783,7 +762,6 @@ 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
();
});
...
...
@@ -818,8 +796,6 @@ 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
)
{
...
...
@@ -852,7 +828,6 @@ 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
();
...
...
@@ -887,7 +862,6 @@ 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
+
'
}
'
...
...
@@ -927,7 +901,6 @@ 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
)
{
...
...
@@ -962,7 +935,6 @@ 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
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录