Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e942a662
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看板
提交
e942a662
编写于
2月 10, 2023
作者:
W
weiyufeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
song : add fileLock xts test
Signed-off-by:
N
caochuan
<
caochuan@huawei.com
>
上级
4d4e13b5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
575 addition
and
617 deletion
+575
-617
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
...efileiov9jstest/src/main/js/test/members/fileLock.test.js
+575
-617
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/members/fileLock.test.js
浏览文件 @
e942a662
...
...
@@ -22,7 +22,7 @@ export default function fileIOFileLock() {
describe
(
'
fileIO_fs_file_lock
'
,
function
()
{
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0000
* @tc.name fileIO_test_filelock_promise_0
000
* @tc.name fileIO_test_filelock_promise_
000
* @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 fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
000
'
);
it
(
'
fileIO_test_filelock_promise_
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -40,18 +40,17 @@ export default function fileIOFileLock() {
await
file
.
lock
();
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0001
* @tc.name fileIO_test_filelock_promise_0
001
* @tc.number FILE_TEST_FILELOCK_PROMISE_0100
* @tc.name fileIO_test_filelock_promise_
001
* @tc.desc Test lock() interfaces. argument is : true.
* Open the file, file lock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -59,8 +58,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
001
'
);
it
(
'
fileIO_test_filelock_promise_
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -69,18 +68,17 @@ export default function fileIOFileLock() {
await
file
.
lock
(
true
);
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0002
* @tc.name fileIO_test_filelock_promise_0
002
* @tc.number FILE_TEST_FILELOCK_PROMISE_0200
* @tc.name fileIO_test_filelock_promise_
002
* @tc.desc Test lock() interfaces. argument is : false.
* Open the file, file lock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -88,8 +86,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
002
'
);
it
(
'
fileIO_test_filelock_promise_
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -98,18 +96,17 @@ export default function fileIOFileLock() {
await
file
.
lock
(
false
);
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0003
* @tc.name fileIO_test_filelock_promise_0
003
* @tc.number FILE_TEST_FILELOCK_PROMISE_0300
* @tc.name fileIO_test_filelock_promise_
003
* @tc.desc Test tryLock() interfaces. argument is : default.
* Open the file, file lock() ,tryLock() and unlock()
* @tc.size MEDIUM
...
...
@@ -117,8 +114,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
003
'
);
it
(
'
fileIO_test_filelock_promise_
003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
003
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -128,18 +125,17 @@ export default function fileIOFileLock() {
file
.
tryLock
();
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0004
* @tc.name fileIO_test_filelock_promise_0
004
* @tc.number FILE_TEST_FILELOCK_PROMISE_0400
* @tc.name fileIO_test_filelock_promise_
004
* @tc.desc Test tryLock() interfaces. argument is : true.
* Open the file, file lock() ,tryLock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -147,8 +143,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
004
'
);
it
(
'
fileIO_test_filelock_promise_
004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
004
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -158,18 +154,17 @@ export default function fileIOFileLock() {
file
.
tryLock
(
true
);
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0005
* @tc.name fileIO_test_filelock_promise_0
005
* @tc.number FILE_TEST_FILELOCK_PROMISE_0500
* @tc.name fileIO_test_filelock_promise_
005
* @tc.desc Test tryLock() interfaces. argument is : false.
* Open the file, file lock() ,tryLock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -177,8 +172,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_0
005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
005
'
);
it
(
'
fileIO_test_filelock_promise_
005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
005
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -188,26 +183,25 @@ export default function fileIOFileLock() {
file
.
tryLock
(
false
);
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0006
* @tc.name fileIO_test_filelock_promise_0
006
* @tc.number FILE_TEST_FILELOCK_PROMISE_0600
* @tc.name fileIO_test_filelock_promise_
006
* @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_0
006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
006
'
);
it
(
'
fileIO_test_filelock_promise_
006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -216,26 +210,25 @@ export default function fileIOFileLock() {
file
.
tryLock
();
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_0007
* @tc.name fileIO_test_filelock_promise_0
007
* @tc.number FILE_TEST_FILELOCK_PROMISE_0700
* @tc.name fileIO_test_filelock_promise_
007
* @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_0
007
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_0
007
'
);
it
(
'
fileIO_test_filelock_promise_
007
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_
007
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -243,18 +236,17 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_0
007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_promise_
007 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_00
00
* @tc.name fileIO_test_filelock_promise_abnormal_0
000
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_08
00
* @tc.name fileIO_test_filelock_promise_abnormal_
000
* @tc.desc Test lock() interfaces. argument is : null.
* Open the file, file lock(null).
* @tc.size MEDIUM
...
...
@@ -262,8 +254,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
000
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -271,18 +263,17 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
null
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_000 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_0001
* @tc.name fileIO_test_filelock_promise_abnormal_0
001
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0100
* @tc.name fileIO_test_filelock_promise_abnormal_
001
* @tc.desc Test lock() interfaces. argument is : true, true.
* Open the file, file lock(true, true).
* @tc.size MEDIUM
...
...
@@ -290,8 +281,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
001
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -299,18 +290,17 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
true
,
true
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_001 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_0002
* @tc.name fileIO_test_filelock_promise_abnormal_0
002
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0200
* @tc.name fileIO_test_filelock_promise_abnormal_
002
* @tc.desc Test lock() interfaces. argument is : -1.
* Open the file, file lock(-1).
* @tc.size MEDIUM
...
...
@@ -318,8 +308,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
002
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -327,18 +317,17 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
await
file
.
lock
(
-
1
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_002 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_0003
* @tc.name fileIO_test_filelock_promise_abnormal_0
003
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0300
* @tc.name fileIO_test_filelock_promise_abnormal_
003
* @tc.desc Test tryLock() interfaces. argument is : null.
* Open the file, file lock(), tryLock(null).
* @tc.size MEDIUM
...
...
@@ -346,8 +335,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
003
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
003
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
003
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -356,18 +345,17 @@ export default function fileIOFileLock() {
await
file
.
lock
();
file
.
tryLock
(
null
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0003 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_003 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_0004
* @tc.name fileIO_test_filelock_promise_abnormal_0
004
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0400
* @tc.name fileIO_test_filelock_promise_abnormal_
004
* @tc.desc Test tryLock() interfaces. argument is : true, true.
* Open the file, file lock(), tryLock(true, true).
* @tc.size MEDIUM
...
...
@@ -375,8 +363,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
004
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
004
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
004
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -385,18 +373,17 @@ export default function fileIOFileLock() {
await
file
.
lock
();
file
.
tryLock
(
true
,
true
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0004 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_004 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_0005
* @tc.name fileIO_test_filelock_promise_abnormal_0
005
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0500
* @tc.name fileIO_test_filelock_promise_abnormal_
005
* @tc.desc Test tryLock() interfaces. argument is : -1.
* Open the file, file lock(), tryLock(-1).
* @tc.size MEDIUM
...
...
@@ -404,8 +391,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
005
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
005
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
005
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -414,18 +401,17 @@ export default function fileIOFileLock() {
await
file
.
lock
();
file
.
tryLock
(
-
1
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0005 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_005 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_0006
* @tc.name fileIO_test_filelock_promise_abnormal_0
006
* @tc.number FILE_TEST_FILELOCK_PROMISE_ABNORMAL_0600
* @tc.name fileIO_test_filelock_promise_abnormal_
006
* @tc.desc Test unlock() interfaces. argument is : true.
* Open the file, file lock(), tryLock(), unlock(true),
* @tc.size MEDIUM
...
...
@@ -433,8 +419,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_promise_abnormal_0
006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_0
006
'
);
it
(
'
fileIO_test_filelock_promise_abnormal_
006
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_promise_abnormal_
006
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -444,11 +430,10 @@ export default function fileIOFileLock() {
file
.
tryLock
();
file
.
unlock
(
true
);
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_0006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_promise_abnormal_006 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
...
...
@@ -456,7 +441,7 @@ export default function fileIOFileLock() {
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_0000
* @tc.name fileIO_test_filelock_callback_0
000
* @tc.name fileIO_test_filelock_callback_
000
* @tc.desc Test lock() interfaces. argument is : default.
* Open the file, file lock() and unlock()
* @tc.size MEDIUM
...
...
@@ -464,8 +449,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_0
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_0
000
'
);
it
(
'
fileIO_test_filelock_callback_
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_
000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -473,25 +458,23 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
((
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
000 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_
000 err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_
000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_0001
* @tc.name fileIO_test_filelock_callback_0
001
* @tc.number FILE_TEST_FILELOCK_CALLBACK_0100
* @tc.name fileIO_test_filelock_callback_
001
* @tc.desc Test lock() interfaces. argument is : true.
* Open the file, file lock(true) and unlock()
* @tc.size MEDIUM
...
...
@@ -499,8 +482,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_0
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_0
001
'
);
it
(
'
fileIO_test_filelock_callback_
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_
001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -508,25 +491,23 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
001 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_
001 err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_
001 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_0
002
* @tc.number FILE_TEST_FILELOCK_CALLBACK_0200
* @tc.name fileIO_test_filelock_callback_
002
* @tc.desc Test lock() interfaces. argument is : false.
* Open the file, file lock(false) and unlock()
* @tc.size MEDIUM
...
...
@@ -534,8 +515,8 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_0
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_0
002
'
);
it
(
'
fileIO_test_filelock_callback_
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_
002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
...
...
@@ -543,25 +524,23 @@ export default function fileIOFileLock() {
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
false
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
002 err
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
fileIO_test_filelock_callback_
002 err
'
+
JSON
.
stringify
(
err
));
expect
(
false
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
true
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_0
002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
console
.
log
(
'
fileIO_test_filelock_callback_
002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_0000
* @tc.name fileIO_test_filelock_callback_abnormal_0
000
* @tc.name fileIO_test_filelock_callback_abnormal_
000
* @tc.desc Test lock() interfaces. argument is : null.
* Open the file, file lock(null).
* @tc.size MEDIUM
...
...
@@ -569,34 +548,27 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_0
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_0
000
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_
000
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_
000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
null
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0000 err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0000 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_000 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_0001
* @tc.name fileIO_test_filelock_callback_abnormal_0
001
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_0100
* @tc.name fileIO_test_filelock_callback_abnormal_
001
* @tc.desc Test lock() interfaces. argument is : true, true.
* Open the file, file lock(true, true).
* @tc.size MEDIUM
...
...
@@ -604,34 +576,27 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_0
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_0
001
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_
001
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_
001
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
true
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0001 err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0001 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_001 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_0002
* @tc.name fileIO_test_filelock_callback_abnormal_0
002
* @tc.number FILE_TEST_FILELOCK_CALLBACK_ABNORMAL_0200
* @tc.name fileIO_test_filelock_callback_abnormal_
002
* @tc.desc Test lock() interfaces. argument is : -1.
* Open the file, file lock(-1).
* @tc.size MEDIUM
...
...
@@ -639,30 +604,23 @@ export default function fileIOFileLock() {
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_test_filelock_callback_abnormal_0
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_0
002
'
);
it
(
'
fileIO_test_filelock_callback_abnormal_
002
'
,
0
,
async
function
(
done
)
{
let
fpath
=
await
nextFileName
(
'
fileIO_test_filelock_callback_abnormal_
002
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
file
=
fileIO
.
openSync
(
fpath
,
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
isIntNum
(
file
.
fd
)).
assertTrue
();
file
.
lock
(
-
1
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0002 err
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
==
13900020
&&
err
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
file
.
unlock
();
expect
(
false
).
assertTrue
();
file
.
closeSync
(
file
.
fd
);
file
.
unlinkSync
(
fpath
);
done
();
});
}
catch
(
e
)
{
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_0002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
fileIO
.
closeSync
(
file
.
fd
);
fileIO
.
unlinkSync
(
fpath
);
console
.
log
(
'
fileIO_test_filelock_callback_abnormal_002 has failed for
'
+
e
.
message
+
'
, code:
'
+
e
.
code
);
expect
(
e
.
code
==
13900020
&&
e
.
message
==
'
Invalid argument
'
).
assertTrue
();
done
();
}
});
});
});
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录