Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b06d3da7
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看板
未验证
提交
b06d3da7
编写于
4月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8321 Add XTS for Errno
Merge pull request !8321 from 冯俊青/Errno_add
上级
830f1334
68a99c2f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
371 addition
and
5 deletion
+371
-5
storage/storagefileiov9jstest/src/main/js/test/members/open.test.js
...oragefileiov9jstest/src/main/js/test/members/open.test.js
+79
-2
storage/storagefileiov9jstest/src/main/js/test/members/rename.test.js
...agefileiov9jstest/src/main/js/test/members/rename.test.js
+129
-3
storage/storagefileiov9jstest/src/main/js/test/members/symlink.test.js
...gefileiov9jstest/src/main/js/test/members/symlink.test.js
+82
-0
storage/storagefileiov9jstest/src/main/js/test/members/unlink.test.js
...agefileiov9jstest/src/main/js/test/members/unlink.test.js
+81
-0
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/open.test.js
浏览文件 @
b06d3da7
...
...
@@ -363,7 +363,7 @@ export default function fileIOOpen() {
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_open_sync_013
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_open_sync_013
'
,
0
,
async
function
()
{
try
{
fileIO
.
openSync
(
-
1
,
fileIO
.
OpenMode
.
READ_WRITE
);
...
...
@@ -371,7 +371,30 @@ export default function fileIOOpen() {
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_open_sync_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_OPEN_SYNC_1400
* @tc.name fileIO_test_open_sync_014
* @tc.desc Test openSync() interfaces. mode=0o200000.
* The path refers to a directory, not a file.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_open_sync_014
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_open_sync_012
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
fileIO
.
openSync
(
dpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_open_sync_014 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900019
&&
e
.
message
==
'
Is a directory
'
).
assertTrue
();
}
});
...
...
@@ -1218,5 +1241,59 @@ export default function fileIOOpen() {
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_FILEIO_OPEN_ASYNC_2900
* @tc.name fileIO_test_open_async_029
* @tc.desc Test open() interfaces. Promise.
* The path refers to a file, not a directory.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_open_async_029
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_open_async_029
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
await
fileIO
.
open
(
dpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_open_async_029 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900019
&&
e
.
message
==
'
Is a directory
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_OPEN_ASYNC_3000
* @tc.name fileIO_test_open_async_030
* @tc.desc Test open() interfaces. Callback.
* The path refers to a file, not a directory.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_open_async_030
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_open_async_030
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
fileIO
.
open
(
dpath
,
fileIO
.
OpenMode
.
READ_WRITE
,
(
err
,
file
)
=>
{
if
(
err
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_open_async_030 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900019
&&
err
.
message
==
'
Is a directory
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_open_async_030 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
});
}
storage/storagefileiov9jstest/src/main/js/test/members/rename.test.js
浏览文件 @
b06d3da7
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
describe
,
it
,
expect
,
randomString
}
from
'
../Common
'
;
...
...
@@ -176,18 +177,64 @@ describe('fileIO_fs_rename', function () {
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_sync_006
'
,
0
,
async
function
(
done
)
{
it
(
'
fileIO_test_rename_sync_006
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_rename_sync_006
'
);
let
fpathTarget
=
fpath
+
randomString
(
250
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileIO
.
rename
(
fpath
,
fpathTarget
);
fileIO
.
renameSync
(
fpath
,
fpathTarget
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_rename_sync_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900030
&&
e
.
message
==
'
File name too long
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_RENAME_SYNC_0700
* @tc.name fileIO_test_rename_sync_007
* @tc.desc Test rename() interfaces.
* Don't have permission to operate on the root directory.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_sync_007
'
,
0
,
async
function
()
{
try
{
fileIO
.
renameSync
(
'
/data
'
,
'
/data_new
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_rename_sync_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900012
&&
e
.
message
==
'
Permission denied
'
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_FILEIO_RENAME_SYNC_0800
* @tc.name fileIO_test_rename_sync_008
* @tc.desc Test rename() interfaces.
* Can't modify file names across devices.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_sync_008
'
,
0
,
async
function
()
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_rename_sync_008
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
fileIO
.
renameSync
(
fpath
,
dstDir
+
'
/data_new
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_rename_sync_008 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900016
&&
e
.
message
==
'
Cross-device link
'
).
assertTrue
();
}
});
...
...
@@ -453,6 +500,7 @@ describe('fileIO_fs_rename', function () {
await
fileIO
.
rename
(
fpath
,
fpathTarget
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_rename_async_009 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900030
&&
e
.
message
==
'
File name too long
'
).
assertTrue
();
done
();
...
...
@@ -488,5 +536,83 @@ describe('fileIO_fs_rename', function () {
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_FILEIO_RENAME_ASYNC_1100
* @tc.name fileIO_test_rename_async_011
* @tc.desc Test rename() interfaces. Promise.
* Don't have permission to operate on the root directory.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_async_011
'
,
0
,
async
function
(
done
)
{
try
{
await
fileIO
.
rename
(
'
/data
'
,
'
/data_new
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_rename_async_011 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900012
&&
e
.
message
==
'
Permission denied
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_RENAME_ASYNC_1200
* @tc.name fileIO_test_rename_async_012
* @tc.desc Test rename() interfaces.
* Can't modify file names across devices.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_async_012
'
,
0
,
async
function
(
done
)
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_rename_async_012
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileIO
.
rename
(
fpath
,
dstDir
+
'
/data_new
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_rename_async_012 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900016
&&
e
.
message
==
'
Cross-device link
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_RENAME_ASYNC_1300
* @tc.name fileIO_test_rename_async_013
* @tc.desc Test rename() interfaces.
* Can't modify file names across devices.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_rename_async_013
'
,
0
,
async
function
(
done
)
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_rename_async_013
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
fileIO
.
rename
(
fpath
,
dstDir
+
'
/data_new
'
,
(
err
)
=>
{
if
(
err
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_symlink_async_005 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900016
&&
err
.
message
==
'
Cross-device link
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_rename_async_013 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
});
}
storage/storagefileiov9jstest/src/main/js/test/members/symlink.test.js
浏览文件 @
b06d3da7
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
fileIO
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
describe
,
it
,
expect
,
}
from
'
../Common
'
;
...
...
@@ -69,6 +70,31 @@ describe('fileIO_fs_symlink', function () {
}
});
/**
* @tc.number SUB_DF_FILEIO_SYMLINK_SYNC_0200
* @tc.name fileIO_test_symlink_sync_002
* @tc.desc Test symlinkSync() interfaces.
* Can't create a symbolic links in distributed directories.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_symlink_sync_002
'
,
0
,
async
function
()
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_symlink_sync_002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
fileIO
.
symlinkSync
(
fpath
,
dstDir
+
'
/link_000
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_symlink_sync_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900001
&&
e
.
message
==
'
Operation not permitted
'
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_FILEIO_SYMLINK_ASYNC_0000
* @tc.name fileIO_test_symlink_async_000
...
...
@@ -180,5 +206,61 @@ describe('fileIO_fs_symlink', function () {
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_SYMLINK_ASYNC_0400
* @tc.name fileIO_test_symlink_async_004
* @tc.desc Test symlink() interfaces.
* Can't create a symbolic links in distributed directories.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_symlink_async_004
'
,
0
,
async
function
(
done
)
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_symlink_async_004
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
await
fileIO
.
symlink
(
fpath
,
dstDir
+
'
/link_001
'
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_symlink_async_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900001
&&
e
.
message
==
'
Operation not permitted
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_SYMLINK_ASYNC_0500
* @tc.name fileIO_test_symlink_async_005
* @tc.desc Test symlink() interfaces.
* Can't create a symbolic links in distributed directories.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_symlink_async_005
'
,
0
,
async
function
(
done
)
{
let
dstDir
=
await
featureAbility
.
getContext
().
getOrCreateDistributedDir
();
let
fpath
=
await
nextFileName
(
'
fileIO_test_symlink_async_005
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
fileIO
.
symlink
(
fpath
,
dstDir
+
'
/link_002
'
,
(
err
)
=>
{
if
(
err
)
{
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_symlink_async_005 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900001
&&
err
.
message
==
'
Operation not permitted
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_symlink_async_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
});
}
storage/storagefileiov9jstest/src/main/js/test/members/unlink.test.js
浏览文件 @
b06d3da7
...
...
@@ -86,6 +86,31 @@ describe('fileIO_fs_unlink', function () {
}
});
/**
* @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0300
* @tc.name fileIO_test_unlink_sync_003
* @tc.desc Test unlinkSync() interfaces.
* The path refers to a directory, not a file.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_unlink_sync_003
'
,
0
,
async
function
()
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_unlink_sync_003
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
expect
(
fileIO
.
accessSync
(
dpath
)).
assertTrue
();
fileIO
.
unlinkSync
(
dpath
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_unlink_sync_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900019
&&
e
.
message
==
'
Is a directory
'
).
assertTrue
();
}
});
/**
* @tc.number SUB_DF_FileIO_UNLINK_ASYNC_0000
* @tc.name fileIO_test_unlink_async_000
...
...
@@ -212,5 +237,61 @@ describe('fileIO_fs_unlink', function () {
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_UNLINK_ASYNC_0500
* @tc.name fileIO_test_unlink_async_005
* @tc.desc Test unlink() interfaces. Promise.
* The path refers to a directory, not a file.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_unlink_async_005
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_unlink_async_005
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
expect
(
fileIO
.
accessSync
(
dpath
)).
assertTrue
();
await
fileIO
.
unlink
(
dpath
);
expect
(
false
).
assertTrue
();
}
catch
(
e
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_unlink_async_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900019
&&
e
.
message
==
'
Is a directory
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_FILEIO_UNLINK_ASYNC_0600
* @tc.name fileIO_test_unlink_async_006
* @tc.desc Test unlink() interfaces. Callback.
* The path refers to a directory, not a file.
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_test_unlink_async_006
'
,
0
,
async
function
(
done
)
{
let
dpath
=
await
nextFileName
(
'
fileIO_test_unlink_async_006
'
);
fileIO
.
mkdirSync
(
dpath
);
try
{
expect
(
fileIO
.
accessSync
(
dpath
)).
assertTrue
();
fileIO
.
unlink
(
dpath
,
(
err
)
=>
{
if
(
err
)
{
fileIO
.
rmdirSync
(
dpath
);
console
.
log
(
'
fileIO_test_unlink_async_006 error: {message:
'
+
err
.
message
+
'
, code:
'
+
err
.
code
+
'
}
'
);
expect
(
err
.
code
==
13900019
&&
err
.
message
==
'
Is a directory
'
).
assertTrue
();
done
();
}
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_unlink_async_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
}
});
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录