Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b0fd3a30
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看板
提交
b0fd3a30
编写于
2月 09, 2023
作者:
W
weiyufeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
song : modify by comments
Signed-off-by:
N
caochuan
<
caochuan@huawei.com
>
上级
2ede253c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
153 addition
and
113 deletion
+153
-113
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
...efileiov9jstest/src/main/js/test/members/fileLock.test.js
+153
-113
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
浏览文件 @
b0fd3a30
...
...
@@ -18,11 +18,11 @@ import {
describe
,
it
,
expect
,
}
from
'
../Common
'
;
export
default
function
fileIO
Open
()
{
export
default
function
fileIO
FileLock
()
{
describe
(
'
fileIO_fs_file_lock
'
,
function
()
{
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_000
* @tc.name fileIO_test_filelock_promise_000
* @tc.number FILE_TEST_FILELOCK_PROMISE_000
0
* @tc.name fileIO_test_filelock_promise_000
0
* @tc.desc Test lock() interfaces. argument is : default.
* Open the file, file lock() and unlock()
* @tc.size MEDIUM
...
...
@@ -30,8 +30,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_000
'
);
it
(
'
fileIO_test_filelock_promise_000
0
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_000
0
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -39,17 +39,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_000
0
has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_001
* @tc.name fileIO_test_filelock_promise_001
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
1
* @tc.name fileIO_test_filelock_promise_00
0
1
* @tc.desc Test lock() interfaces. argument is : true.
* Open the file, file lock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -57,8 +59,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_001
'
);
it
(
'
fileIO_test_filelock_promise_00
0
1
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
1
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -66,17 +68,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
true
);
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
1 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_002
* @tc.name fileIO_test_filelock_promise_002
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
2
* @tc.name fileIO_test_filelock_promise_00
0
2
* @tc.desc Test lock() interfaces. argument is : false.
* Open the file, file lock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -84,8 +88,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_002
'
);
it
(
'
fileIO_test_filelock_promise_00
0
2
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
2
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -93,17 +97,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
false
);
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
2 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_003
* @tc.name fileIO_test_filelock_promise_003
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
3
* @tc.name fileIO_test_filelock_promise_00
0
3
* @tc.desc Test tryLock() interfaces. argument is : default.
* Open the file, file lock() ,tryLock() and unlock()
* @tc.size MEDIUM
...
...
@@ -111,8 +117,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_003
'
);
it
(
'
fileIO_test_filelock_promise_00
0
3
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
3
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -121,17 +127,19 @@ export default function fileIOOpen() {
await
file
.
lock
();
file
.
tryLock
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
3 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_004
* @tc.name fileIO_test_filelock_promise_004
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
4
* @tc.name fileIO_test_filelock_promise_00
0
4
* @tc.desc Test tryLock() interfaces. argument is : true.
* Open the file, file lock() ,tryLock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -139,8 +147,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_004
'
);
it
(
'
fileIO_test_filelock_promise_00
0
4
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
4
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -149,17 +157,19 @@ export default function fileIOOpen() {
await
file
.
lock
();
file
.
tryLock
(
true
);
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
4 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_005
* @tc.name fileIO_test_filelock_promise_005
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
5
* @tc.name fileIO_test_filelock_promise_00
0
5
* @tc.desc Test tryLock() interfaces. argument is : false.
* Open the file, file lock() ,tryLock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -167,8 +177,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_005
'
);
it
(
'
fileIO_test_filelock_promise_00
0
5
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
5
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -177,25 +187,27 @@ export default function fileIOOpen() {
await
file
.
lock
();
file
.
tryLock
(
false
);
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
5 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_006
* @tc.name fileIO_test_filelock_promise_006
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
6
* @tc.name fileIO_test_filelock_promise_00
0
6
* @tc.desc Open the file, no file lock(), tryLock(), unlock(),
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
abnormal_
006
'
);
it
(
'
fileIO_test_filelock_promise_00
0
6
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
0
006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -203,42 +215,46 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
tryLock
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
6 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_007
* @tc.name fileIO_test_filelock_promise_007
* @tc.number FILE_TEST_FILELOCK_PROMISE_00
0
7
* @tc.name fileIO_test_filelock_promise_00
0
7
* @tc.desc Open the file, no file lock(), no tryLock(), unlock(),
* @tc.size MEDIUM
* @tc.type Functoin
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_007
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_007
'
);
it
(
'
fileIO_test_filelock_promise_00
0
7
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_00
0
7
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_00
0
7 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_000
* @tc.name fileIO_test_filelock_promise_abnormal_000
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_000
0
* @tc.name fileIO_test_filelock_promise_abnormal_000
0
* @tc.desc Test lock() interfaces. argument is : null.
* Open the file, file lock(null).
* @tc.size MEDIUM
...
...
@@ -246,25 +262,27 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_000
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_000
0
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_000
0
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
null
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_000
0
has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_001
* @tc.name fileIO_test_filelock_promise_abnormal_001
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
1
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
1
* @tc.desc Test lock() interfaces. argument is : true, true.
* Open the file, file lock(true, true).
* @tc.size MEDIUM
...
...
@@ -272,25 +290,27 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_001
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
1
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
1
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
true
,
true
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
1 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_002
* @tc.name fileIO_test_filelock_promise_abnormal_002
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
2
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
2
* @tc.desc Test lock() interfaces. argument is : -1.
* Open the file, file lock(-1).
* @tc.size MEDIUM
...
...
@@ -298,25 +318,27 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_002
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
2
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
2
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
-
1
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
2 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_003
* @tc.name fileIO_test_filelock_promise_abnormal_003
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
3
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
3
* @tc.desc Test tryLock() interfaces. argument is : null.
* Open the file, file lock(), tryLock(null).
* @tc.size MEDIUM
...
...
@@ -324,8 +346,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_003
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
3
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
3
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -333,17 +355,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
();
file
.
tryLock
(
null
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
3 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_004
* @tc.name fileIO_test_filelock_promise_abnormal_004
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
4
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
4
* @tc.desc Test tryLock() interfaces. argument is : true, true.
* Open the file, file lock(), tryLock(true, true).
* @tc.size MEDIUM
...
...
@@ -351,8 +375,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_004
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
4
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
4
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -360,17 +384,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
();
file
.
tryLock
(
true
,
true
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
4 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_005
* @tc.name fileIO_test_filelock_promise_abnormal_005
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
5
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
5
* @tc.desc Test tryLock() interfaces. argument is : -1.
* Open the file, file lock(), tryLock(-1).
* @tc.size MEDIUM
...
...
@@ -378,8 +404,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_005
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
5
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
5
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -387,17 +413,19 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
();
file
.
tryLock
(
-
1
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
5 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_006
* @tc.name fileIO_test_filelock_promise_abnormal_006
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
0
6
* @tc.name fileIO_test_filelock_promise_abnormal_00
0
6
* @tc.desc Test unlock() interfaces. argument is : true.
* Open the file, file lock(), tryLock(), unlock(true),
* @tc.size MEDIUM
...
...
@@ -405,8 +433,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_006
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_00
0
6
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_00
0
6
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -415,18 +443,20 @@ export default function fileIOOpen() {
await
file
.
lock
();
file
.
tryLock
();
file
.
unlock
(
true
);
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_00
0
6 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_000
* @tc.name fileIO_test_filelock_callback_000
* @tc.number FILE_TEST_FILELOCK_CALLBACK_000
0
* @tc.name fileIO_test_filelock_callback_000
0
* @tc.desc Test lock() interfaces. argument is : default.
* Open the file, file lock() and unlock()
* @tc.size MEDIUM
...
...
@@ -434,8 +464,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_000
'
);
it
(
'
fileIO_test_filelock_callback_000
0
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_000
0
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -443,24 +473,25 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
((
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_000 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_000
0
err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
tryLock
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_000
0
has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_001
* @tc.name fileIO_test_filelock_callback_001
* @tc.number FILE_TEST_FILELOCK_CALLBACK_00
0
1
* @tc.name fileIO_test_filelock_callback_00
0
1
* @tc.desc Test lock() interfaces. argument is : true.
* Open the file, file lock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -468,8 +499,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_001
'
);
it
(
'
fileIO_test_filelock_callback_00
0
1
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_00
0
1
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -477,24 +508,25 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_001 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_00
0
1 err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
tryLock
();
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_00
0
1 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_002
* @tc.name fileIO_test_filelock_callback_002
* @tc.name fileIO_test_filelock_callback_00
0
2
* @tc.desc Test lock() interfaces. argument is : false.
* Open the file, file lock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -502,8 +534,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_002
'
);
it
(
'
fileIO_test_filelock_callback_00
0
2
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_00
0
2
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -511,23 +543,25 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
false
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_002 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_00
0
2 err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
true
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_00
0
2 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_000
* @tc.name fileIO_test_filelock_callback_abnormal_000
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_000
0
* @tc.name fileIO_test_filelock_callback_abnormal_000
0
* @tc.desc Test lock() interfaces. argument is : null.
* Open the file, file lock(null).
* @tc.size MEDIUM
...
...
@@ -535,8 +569,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_000
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_000
0
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_000
0
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -544,23 +578,25 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
null
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_000 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_000
0
err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_000
0
has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_001
* @tc.name fileIO_test_filelock_callback_abnormal_001
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_00
0
1
* @tc.name fileIO_test_filelock_callback_abnormal_00
0
1
* @tc.desc Test lock() interfaces. argument is : true, true.
* Open the file, file lock(true, true).
* @tc.size MEDIUM
...
...
@@ -568,8 +604,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_001
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_00
0
1
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_00
0
1
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -577,23 +613,25 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
true
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_001 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_00
0
1 err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_00
0
1 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_002
* @tc.name fileIO_test_filelock_callback_abnormal_002
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_00
0
2
* @tc.name fileIO_test_filelock_callback_abnormal_00
0
2
* @tc.desc Test lock() interfaces. argument is : -1.
* Open the file, file lock(-1).
* @tc.size MEDIUM
...
...
@@ -601,8 +639,8 @@ export default function fileIOOpen() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_002
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_00
0
2
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_00
0
2
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -610,16 +648,18 @@ export default function fileIOOpen() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
-
1
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_002 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_00
0
2 err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
expect
(
false
).
assertTrue
();
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_00
0
2 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录