Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b6c33151
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看板
提交
b6c33151
编写于
4月 29, 2022
作者:
R
raoxian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update storagefileioerrorjstest
Signed-off-by:
N
raoxian
<
raoxian@huawei.com
>
上级
714752d1
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
49 addition
and
1404 deletion
+49
-1404
storage/storagefileioerrorjstest/Test.json
storage/storagefileioerrorjstest/Test.json
+2
-2
storage/storagefileioerrorjstest/src/main/config.json
storage/storagefileioerrorjstest/src/main/config.json
+3
-3
storage/storagefileioerrorjstest/src/main/js/default/test/Common.js
...oragefileioerrorjstest/src/main/js/default/test/Common.js
+7
-120
storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js
...eioerrorjstest/src/main/js/default/test/FileError.test.js
+0
-407
storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js
...oerrorjstest/src/main/js/default/test/FileIOError.test.js
+37
-209
storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js
...orjstest/src/main/js/default/test/FileVirtualPath.test.js
+0
-663
未找到文件。
storage/storagefileioerrorjstest/Test.json
浏览文件 @
b6c33151
{
{
"description"
:
"Configuration for storage file
and file
io Tests"
,
"description"
:
"Configuration for storage fileio Tests"
,
"driver"
:
{
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"60000"
,
"test-timeout"
:
"60000"
,
"package"
:
"ohos.acts.st
roage.fileio
"
,
"package"
:
"ohos.acts.st
orage.fileioerror
"
,
"shell-timeout"
:
"60000"
"shell-timeout"
:
"60000"
},
},
"kits"
:
[
"kits"
:
[
...
...
storage/storagefileioerrorjstest/src/main/config.json
浏览文件 @
b6c33151
{
{
"app"
:
{
"app"
:
{
"bundleName"
:
"ohos.acts.st
roage.fileio
"
,
"bundleName"
:
"ohos.acts.st
orage.fileioerror
"
,
"vendor"
:
"example"
,
"vendor"
:
"example"
,
"version"
:
{
"version"
:
{
"code"
:
1000000
,
"code"
:
1000000
,
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
},
},
"deviceConfig"
:
{},
"deviceConfig"
:
{},
"module"
:
{
"module"
:
{
"package"
:
"ohos.acts.st
roage.fileio
"
,
"package"
:
"ohos.acts.st
orage.fileioerror
"
,
"name"
:
".MyApplication"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"deviceType"
:
[
"phone"
"phone"
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
]
]
}
}
],
],
"name"
:
"ohos.acts.st
roage.fileio
.MainAbility"
,
"name"
:
"ohos.acts.st
orage.fileioerror
.MainAbility"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"label"
:
"$string:app_name"
,
...
...
storage/storagefileioerrorjstest/src/main/js/default/test/Common.js
浏览文件 @
b6c33151
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
fileio
from
'
@
system
.fileio
'
import
fileio
from
'
@
ohos
.fileio
'
export
const
FILE_CONTENT
=
'
hello world
'
export
const
FILE_CONTENT
=
'
hello world
'
...
@@ -31,133 +31,16 @@ export function prepareFile(fpath, content) {
...
@@ -31,133 +31,16 @@ export function prepareFile(fpath, content) {
return
false
return
false
}
}
}
}
export
function
prepareFile1
(
fpath
,
content
)
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
)
fileio
.
ftruncateSync
(
fd
)
fileio
.
writeSync
(
fd
,
content
)
fileio
.
fsyncSync
(
fd
)
fileio
.
closeSync
(
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to prepareFile for
'
+
e
)
return
false
}
}
export
function
prepareEmptyFile
(
fpath
)
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
)
fileio
.
closeSync
(
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to prepareFile for
'
+
e
)
return
false
}
}
export
function
fileToReadOnly
(
fpath
)
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o1
)
fileio
.
fchmodSync
(
fd
,
0o444
)
fileio
.
fsyncSync
(
fd
)
fileio
.
closeSync
(
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to fileToReadOnly for
'
+
e
);
return
false
}
}
export
function
fileToWriteOnly
(
fpath
)
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o2
)
fileio
.
fchmodSync
(
fd
,
0o222
)
fileio
.
fsyncSync
(
fd
)
fileio
.
closeSync
(
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to fileToWriteOnly
'
+
e
)
return
false
}
}
export
function
fileToReadAndWrite
(
fpath
)
{
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o1
)
fileio
.
fchmodSync
(
fd
,
0o777
)
fileio
.
fsyncSync
(
fd
)
fileio
.
closeSync
(
fd
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
Failed to fileToReadAndWrite
'
+
e
);
return
false
}
}
export
function
appName
(
testName
)
{
const
BASE_PATH
=
'
/data/storage/el2/base/haps/entry/
'
return
BASE_PATH
+
testName
}
export
function
nextFileName
(
testName
)
{
export
function
nextFileName
(
testName
)
{
const
BASE_PATH
=
'
/data/storage/el2/base/haps/entry/cache/
'
const
BASE_PATH
=
'
/data/storage/el2/base/haps/entry/cache/
'
return
BASE_PATH
+
testName
return
BASE_PATH
+
testName
+
'
_
'
+
randomString
(
testName
.
length
);
}
}
export
function
fileName
(
testName
)
{
export
function
fileName
(
testName
)
{
const
BASE_PATH
=
'
/data/storage/el2/base/haps/entry/files/
'
const
BASE_PATH
=
'
/data/storage/el2/base/haps/entry/files/
'
return
BASE_PATH
+
testName
return
BASE_PATH
+
testName
}
}
export
function
cacheFileName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/
'
return
BASE_PATH
+
testName
}
export
function
differentFileName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/
'
return
BASE_PATH
+
testName
}
export
function
differentCacheName
(
testName
)
{
const
BASE_PATH
=
'
/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/
'
return
BASE_PATH
+
testName
}
export
function
getFileTextLen
(
fpath
)
{
let
ss
try
{
ss
=
fileio
.
Stream
.
createStreamSync
(
fpath
,
'
r+
'
)
expect
(
ss
!==
null
).
assertTrue
()
let
len
=
ss
.
readSync
(
new
ArrayBuffer
(
4096
))
console
.
log
(
'
file:
'
+
fpath
)
console
.
log
(
'
file length:
'
+
len
)
expect
(
ss
.
closeSync
()
!==
null
).
assertTrue
()
return
len
}
catch
(
e
)
{
console
.
log
(
'
Failed to getFileTextLen
'
+
e
)
expect
(
ss
.
closeSync
()
!==
null
).
assertTrue
()
return
null
}
}
export
function
isFileExist
(
fpath
)
{
try
{
expect
(
fileio
.
accessSync
(
fpath
)
!==
null
).
assertTrue
()
console
.
log
(
'
file:
'
+
fpath
)
console
.
log
(
'
status:exist
'
)
return
true
}
catch
(
e
)
{
console
.
log
(
'
file:
'
+
fpath
)
console
.
log
(
'
status:non-existen
'
)
return
false
}
}
export
function
sleep
(
n
)
{
var
start
=
new
Date
().
getTime
();
while
(
true
)
{
if
(
new
Date
().
getTime
()
-
start
>
n
)
{
break
;
}
}
}
export
function
randomString
(
num
)
{
export
function
randomString
(
num
)
{
let
len
=
num
;
let
len
=
num
;
var
$chars
=
'
aaaabbbbcccc
'
;
var
$chars
=
'
aaaabbbbcccc
'
;
...
@@ -168,3 +51,7 @@ export function randomString(num) {
...
@@ -168,3 +51,7 @@ export function randomString(num) {
}
}
return
pwd
;
return
pwd
;
}
}
export
function
isIntNum
(
val
)
{
return
typeof
val
===
'
number
'
&&
val
%
1
===
0
;
}
\ No newline at end of file
storage/storagefileioerrorjstest/src/main/js/default/test/FileError.test.js
已删除
100644 → 0
浏览文件 @
714752d1
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
fileio
from
'
@system.fileio
'
import
file
from
'
@system.file
'
;
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
FILE_CONTENT
,
prepareFile
,
fileName
,
randomString
,
}
from
'
./Common
'
describe
(
'
FileError
'
,
function
()
{
/**
* @tc.number SUB_STORAGE_File_test_error_0000
* @tc.name File_test_error_000
* @tc.desc Function of API, Move files when disk space is full.
* Create the file (file_test_error) in advance and give 777 permission,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/file_test_error
*/
it
(
'
File_test_error_000
'
,
0
,
async
function
(
done
)
{
file
.
move
({
srcUri
:
'
internal://app/file_test_error
'
,
dstUri
:
'
internal://cache/file_test_error
'
,
success
:
function
(
uri
)
{
console
.
log
(
'
file_test_error_000 pass, uri:
'
+
uri
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_000 call move fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0100
* @tc.name File_test_error_001
* @tc.desc Function of API, Copy files when disk space is full.
* Create the file (file_test_error) in advance and give 777 permission,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/file_test_error
*/
it
(
'
File_test_error_001
'
,
0
,
async
function
(
done
)
{
file
.
copy
({
srcUri
:
'
internal://app/file_test_error
'
,
dstUri
:
'
internal://cache/file_test_error
'
,
success
:
function
(
uri
)
{
console
.
log
(
'
file_test_error_001 pass, uri:
'
+
uri
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_001 call copy fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0200
* @tc.name File_test_error_002
* @tc.desc Function of API, Write files when disk space is full.
*/
it
(
'
File_test_error_002
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app../file_test_error
'
,
text
:
FILE_CONTENT
,
success
:
function
()
{
console
.
log
(
'
file_test_error_002 call writeText success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_002 call writeText fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0300
* @tc.name File_test_error_003
* @tc.desc Function of API, Write files when disk space is full.
*/
it
(
'
File_test_error_003
'
,
0
,
async
function
(
done
)
{
let
buf
=
new
Uint8Array
([
48
,
49
,
50
,
51
,
65
,
66
,
67
,
68
,
32
,
33
]);
file
.
writeArrayBuffer
({
uri
:
'
internal://app/file_test_error
'
,
buffer
:
buf
,
success
:
function
()
{
console
.
log
(
'
file_test_error_003 call writeArrayBuffer success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_003 call writeArrayBuffer fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0400
* @tc.name File_test_error_004
* @tc.desc Function of API, When inode is full, verify the folder creation function
*/
it
(
'
File_test_error_004
'
,
0
,
async
function
(
done
)
{
file
.
mkdir
({
uri
:
'
internal://app/file_test_error004d
'
,
success
:
function
()
{
console
.
log
(
'
file_test_error_004 call mkdir success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_004 call mkdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0500
* @tc.name File_test_error_005
* @tc.desc Function of API, Prerequisites create file 200M,When ram is filled to
* the remaining 100m, verify the function of reading 200m files
*/
it
(
'
File_test_error_005
'
,
0
,
async
function
(
done
)
{
file
.
readText
({
uri
:
'
internal://app/file_test_error_005
'
,
success
:
function
(
data
)
{
console
.
log
(
'
file_test_error_005 pass, Content:
'
+
data
.
text
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_005 call readText fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0600
* @tc.name File_test_error_006
* @tc.desc Function of API, Prerequisites create file 200M,When ram is filled to
* the remaining 100m, verify the function of reading 200m files
*/
it
(
'
File_test_error_006
'
,
0
,
async
function
(
done
)
{
file
.
readArrayBuffer
({
uri
:
'
internal://app/file_test_error_006
'
,
success
:
function
(
data
)
{
console
.
log
(
'
file_test_error_006 pass, Content:
'
+
data
.
buffer
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_006 call readArrayBuffer fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0700
* @tc.name File_test_error_007
* @tc.desc Function of API, delete file
*/
it
(
'
File_test_error_007
'
,
0
,
async
function
(
done
)
{
let
fpath
=
fileName
(
'
file_test_error_007
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
file
.
rmdir
({
uri
:
'
internal://app/file_test_error_007
'
,
recursive
:
true
,
success
:
function
()
{
console
.
log
(
'
file_test_error_007 call rmdir success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_007 call rmdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0800
* @tc.name File_test_error_008
* @tc.desc Function of API, Try to delete the folder while the file in the folder is reading and writing
*/
it
(
'
File_test_error_008
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/file_test_error_008
'
,
text
:
randomString
(
4096
),
success
:
function
()
{
console
.
log
(
'
file_test_error_008 call mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_008 call mkdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
rmdir
({
uri
:
'
internal://app/file_test_error_008
'
,
success
:
function
()
{
console
.
log
(
'
file_test_error_008 call rmdir success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_008 call rmdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_0900
* @tc.name File_test_error_009
* @tc.desc Function of API, Delete non empty folder
*/
it
(
'
File_test_error_009
'
,
0
,
async
function
(
done
)
{
let
dpath
=
fileName
(
'
file_test_error_009
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/file_test_error_009
'
;
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
file
.
rmdir
({
uri
:
'
internal://app/file_test_error_009d
'
,
recursive
:
true
,
success
:
function
()
{
console
.
log
(
'
file_test_error_009 call rmdir success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_009 call rmdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_1000
* @tc.name File_test_error_010
* @tc.desc Function of API, Delete non empty folder
*/
it
(
'
File_test_error_010
'
,
0
,
async
function
(
done
)
{
let
dpath
=
fileName
(
'
file_test_error_010
'
)
+
'
d
'
;
let
fpath
=
dpath
+
'
/file_test_error_010
'
;
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
file
.
rmdir
({
uri
:
'
internal://app/file_test_error_010d
'
,
recursive
:
false
,
success
:
function
()
{
console
.
log
(
'
file_test_error_010 call rmdir success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_010 call rmdir fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_1100
* @tc.name File_test_error_011
* @tc.desc Function of API, Unsupported same encoding format
*/
it
(
'
File_test_error_011
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/file_test_error_011
'
,
text
:
'
hello
'
,
encoding
:
'
gbk
'
,
success
:
function
()
{
console
.
log
(
'
file_test_error_011 call writeText success.
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_011 call writeText fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_test_error_1200
* @tc.name File_test_error_012
* @tc.desc Function of API, Unsupported same encoding format
*/
it
(
'
File_test_error_012
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/file_test_error_012
'
,
text
:
'
Text that just for test.
'
,
encoding
:
'
Utf-8
'
,
success
:
function
()
{
console
.
log
(
'
file_test_error_012 call writeText success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_012 call writeText fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
readText
({
uri
:
'
internal://app/file_test_error_012
'
,
encoding
:
'
GBK
'
,
success
:
function
(
data
)
{
console
.
log
(
'
file_test_error_012 call readText success.
'
+
data
.
text
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_012 call readText fail, code:
'
+
code
+
'
, data:
'
+
data
);
file
.
delete
({
uri
:
'
internal://app/file_test_error_012
'
,
success
:
function
()
{
console
.
log
(
'
file_test_error_012 call delete success
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
file_test_error_012 call delete fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
});
storage/storagefileioerrorjstest/src/main/js/default/test/FileIOError.test.js
浏览文件 @
b6c33151
...
@@ -19,194 +19,19 @@ import {
...
@@ -19,194 +19,19 @@ import {
it
,
it
,
expect
expect
}
}
from
'
deccjsunit/index
'
from
'
deccjsunit/index
'
import
{
import
{
FILE_CONTENT
,
FILE_CONTENT
,
prepareFile
,
prepareFile
,
fileName
,
fileName
,
nextFileName
,
nextFileName
,
appName
,
randomString
,
randomString
,
isIntNum
}
}
from
'
./Common
'
from
'
./Common
'
describe
(
'
FileIOError
'
,
function
()
{
describe
(
'
FileIOError
'
,
function
()
{
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0000
* @tc.name FileIo_test_error_000
* @tc.desc Function of API, Copy files when disk space is full
* Create the file (fileio_test_error) in advance and give 777 permission,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error
*/
it
(
'
FileIo_test_error_000
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error
'
);
let
fpathTarget
=
appName
(
'
fileio_test_error
'
);
try
{
expect
(
fileio
.
copyFileSync
(
fpath
,
fpathTarget
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_000 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0100
* @tc.name FileIo_test_error_001
* @tc.desc Function of API, mkdir files when disk space is full
*/
it
(
'
FileIo_test_error_001
'
,
0
,
function
()
{
let
dpath
=
nextFileName
(
'
fileio_test_error_001d
'
);
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_001 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0200
* @tc.name FileIo_test_error_002
* @tc.desc Function of API, When inode is full, verify the folder creation function
*/
it
(
'
FileIo_test_error_002
'
,
0
,
function
()
{
let
dpath
=
fileName
(
'
fileio_test_error_002d
'
);
try
{
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_002 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0300
* @tc.name FileIo_test_error_003
* @tc.desc Function of API, When the disk space is full, verify the synchronous write file data function
*/
it
(
'
FileIo_test_error_003
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_003
'
);
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
expect
(
fd
!==
null
).
assertTrue
();
expect
(
fileio
.
writeSync
(
fd
,
FILE_CONTENT
)
!==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_003 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0400
* @tc.name FileIo_test_error_004
* @tc.desc Function of API, When the disk space is full,
* verify synchronization and write the buffer data back to the disk for data synchronization
*/
it
(
'
FileIo_test_error_004
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_004
'
);
try
{
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
expect
(
fd
!==
null
).
assertTrue
();
expect
(
fileio
.
fsyncSync
(
fd
)
!==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_004 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0500
* @tc.name FileIo_test_error_005
* @tc.desc Function of API, Open 200m file function when there is 100m left in RAM
* Create a 200m file (fileio_test_error_005) and grant 777 permissions,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error_005
*/
it
(
'
FileIo_test_error_005
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_005
'
);
try
{
let
fd
=
fileio
.
openSync
(
fpath
);
expect
(
fd
!==
null
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_005 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0600
* @tc.name FileIo_test_error_006
* @tc.desc Function of API, Read 200m file function when there is 100m left in RAM
* Create a 200m file (fileio_test_error_005) and grant 777 permissions,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error_005
*/
it
(
'
FileIo_test_error_006
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_005
'
);
try
{
let
fd
=
fileio
.
openSync
(
fpath
);
expect
(
fd
!==
null
).
assertTrue
();
let
rlen
=
fileio
.
readSync
(
fd
,
new
ArrayBuffer
(
209715200
));
expect
(
rlen
==
209715200
).
assertTrue
();
expect
(
fileio
.
closeSync
(
fd
)
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_006 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0700
* @tc.name FileIo_test_error_007
* @tc.desc Function of API, Verify the function of obtaining
* 200m file stream synchronously when 100m ram is left
* Create a 200m file (fileio_test_error_005) and grant 777 permissions,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error_005
*/
it
(
'
FileIo_test_error_007
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_005
'
);
try
{
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
expect
(
ss
.
closeSync
()
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_007 has failed for
'
+
e
);
}
});
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0800
* @tc.name FileIo_test_error_008
* @tc.desc Function of API, Read 200m file function when there is 100m left in RAM
* Create a 200m file (fileio_test_error_005) and grant 777 permissions,
* path:/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/fileio_test_error_005
*/
it
(
'
FileIo_test_error_008
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_005
'
);
try
{
let
ss
=
fileio
.
createStreamSync
(
fpath
,
'
r+
'
);
expect
(
ss
!==
null
).
assertTrue
();
let
rlen
=
ss
.
readSync
(
new
ArrayBuffer
(
209715200
));
expect
(
rlen
==
209715200
).
assertTrue
();
expect
(
ss
.
closeSync
()
!==
null
).
assertTrue
();
expect
(
null
).
assertFail
();
}
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_008 has failed for
'
+
e
);
}
});
/**
/**
* @tc.number SUB_STORAGE_FileIo_test_error_0900
* @tc.number SUB_STORAGE_FileIo_test_error_0900
* @tc.name FileIo_test_error_009
* @tc.name FileIo_test_error_009
...
@@ -218,8 +43,9 @@ describe('FileIOError', function () {
...
@@ -218,8 +43,9 @@ describe('FileIOError', function () {
fileio
.
mkdirSync
(
dpath
);
fileio
.
mkdirSync
(
dpath
);
expect
(
prepareFile
(
fpath
,
'
hello
'
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
'
hello
'
)).
assertTrue
();
try
{
try
{
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
();
let
fd
=
fileio
.
openSync
(
dpath
);
expect
(
null
).
assertFail
();
expect
(
isIntNum
(
fd
)).
assertTrue
();
fileio
.
rmdirSync
(
dpath
);
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_009 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_error_009 has failed for
'
+
e
);
...
@@ -229,7 +55,7 @@ describe('FileIOError', function () {
...
@@ -229,7 +55,7 @@ describe('FileIOError', function () {
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIo_test_error1000
* @tc.number SUB_STORAGE_FileIo_test_error
_
1000
* @tc.name FileIo_test_error_010
* @tc.name FileIo_test_error_010
* @tc.desc Function of API, delete file
* @tc.desc Function of API, delete file
*/
*/
...
@@ -237,7 +63,9 @@ describe('FileIOError', function () {
...
@@ -237,7 +63,9 @@ describe('FileIOError', function () {
let
fpath
=
fileName
(
'
fileio_test_error_010f
'
);
let
fpath
=
fileName
(
'
fileio_test_error_010f
'
);
expect
(
prepareFile
(
fpath
,
'
hello
'
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
'
hello
'
)).
assertTrue
();
try
{
try
{
expect
(
fileio
.
rmdirSync
(
fpath
)
!==
null
).
assertTrue
();
let
fd
=
fileio
.
openSync
(
fpath
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
fileio
.
rmdirSync
(
fpath
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -254,30 +82,30 @@ describe('FileIOError', function () {
...
@@ -254,30 +82,30 @@ describe('FileIOError', function () {
*/
*/
it
(
'
FileIo_test_error_011
'
,
0
,
function
()
{
it
(
'
FileIo_test_error_011
'
,
0
,
function
()
{
let
fpath
=
nextFileName
(
'
fileio_test_error_011
'
);
let
fpath
=
nextFileName
(
'
fileio_test_error_011
'
);
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
let
fd
=
fileio
.
openSync
(
fpath
,
0o102
,
0o777
);
expect
(
isIntNum
(
fd
)).
assertTrue
();
let
dpath
=
nextFileName
(
'
fileio_error_011d
'
);
let
dpath
=
nextFileName
(
'
fileio_error_011d
'
);
fileio
.
mkdirSync
(
dpath
);
fileio
.
mkdirSync
(
dpath
);
try
{
try
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
for
(
let
i
=
0
;
i
<
16
;
i
++
)
{
if
(
i
==
15
)
{
if
(
i
==
15
)
{
let
fpathTarget
=
dpath
+
'
/f
'
+
randomString
(
248
);
let
fpathTarget
=
dpath
+
'
/f
'
+
randomString
(
248
);
expect
(
fileio
.
copyFileSync
(
fpath
,
fpathTarget
)
!==
null
).
assertTrue
();
fileio
.
copyFileSync
(
fpath
,
fpathTarget
);
console
.
log
((
i
+
1
)
+
'
copy success
'
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
else
{
}
else
{
dpath
=
dpath
+
'
/d
'
+
randomString
(
248
);
dpath
=
dpath
+
'
/d
'
+
randomString
(
248
);
fileio
.
mkdirSync
(
dpath
);
fileio
.
mkdirSync
(
dpath
);
console
.
log
((
i
+
1
)
+
'
mkdir success
'
);
}
}
}
}
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
fileio_test_error_011 has failed for
'
+
e
);
console
.
log
(
'
fileio_test_error_011 has failed for
'
+
e
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIo_test_error_
012
0
* @tc.number SUB_STORAGE_FileIo_test_error_
120
0
* @tc.name FileIo_test_error_012
* @tc.name FileIo_test_error_012
* @tc.desc Function of API, flags=0o102. The test file is exist.
* @tc.desc Function of API, flags=0o102. The test file is exist.
*/
*/
...
@@ -290,12 +118,12 @@ describe('FileIOError', function () {
...
@@ -290,12 +118,12 @@ describe('FileIOError', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_012 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_012 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
013
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
130
0
* @tc.name FileIo_test_error_013
* @tc.name FileIo_test_error_013
* @tc.desc Function of API, flags=0o102
* @tc.desc Function of API, flags=0o102
*/
*/
...
@@ -311,7 +139,7 @@ describe('FileIOError', function () {
...
@@ -311,7 +139,7 @@ describe('FileIOError', function () {
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
014
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
140
0
* @tc.name FileIo_test_error_014
* @tc.name FileIo_test_error_014
* @tc.desc Function of API, flags=0o202. The test file is exist.
* @tc.desc Function of API, flags=0o202. The test file is exist.
*/
*/
...
@@ -324,12 +152,12 @@ describe('FileIOError', function () {
...
@@ -324,12 +152,12 @@ describe('FileIOError', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_014 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_014 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
015
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
150
0
* @tc.name FileIo_test_error_015
* @tc.name FileIo_test_error_015
* @tc.desc Function of API, flags=0o302. The test file is exist.
* @tc.desc Function of API, flags=0o302. The test file is exist.
*/
*/
...
@@ -337,17 +165,16 @@ describe('FileIOError', function () {
...
@@ -337,17 +165,16 @@ describe('FileIOError', function () {
let
fpath
=
nextFileName
(
'
FileIo_test_error_015
'
);
let
fpath
=
nextFileName
(
'
FileIo_test_error_015
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
try
{
fileio
.
openSync
(
fpath
,
0o302
);
fileio
.
openSync
(
fpath
,
0o302
,
0o666
);
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_015 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_015 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
016
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
160
0
* @tc.name FileIo_test_error_016
* @tc.name FileIo_test_error_016
* @tc.desc Function of API, flags=0o100002. The test file is exist.
* @tc.desc Function of API, flags=0o100002. The test file is exist.
*/
*/
...
@@ -360,30 +187,30 @@ describe('FileIOError', function () {
...
@@ -360,30 +187,30 @@ describe('FileIOError', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_016 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_016 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
017
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
170
0
* @tc.name FileIo_test_error_017
* @tc.name FileIo_test_error_017
* @tc.desc Function of API, flags=0o40002 The test file is exist.
* @tc.desc Function of API, flags=0o40002 The test file is exist.
*/
*/
it
(
'
FileIo_test_error_017
'
,
0
,
function
()
{
it
(
'
FileIo_test_error_017
'
,
0
,
function
()
{
let
dpath
=
nextFileName
(
'
FileIo_test_error_017
'
);
let
dpath
=
nextFileName
(
'
FileIo_test_error_017
'
);
expect
(
fileio
.
mkdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
mkdirSync
(
dpath
);
try
{
try
{
fileio
.
openSync
(
dpath
,
0o40002
);
fileio
.
openSync
(
dpath
,
0o40002
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_017 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_017 has failed for
'
+
e
);
expect
(
fileio
.
rmdirSync
(
dpath
)
!==
null
).
assertTrue
(
);
fileio
.
rmdirSync
(
dpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
018
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
180
0
* @tc.name FileIo_test_error_018
* @tc.name FileIo_test_error_018
* @tc.desc Function of API, flags=0o20040002. The test file is exist.
* @tc.desc Function of API, flags=0o20040002. The test file is exist.
*/
*/
...
@@ -399,7 +226,7 @@ describe('FileIOError', function () {
...
@@ -399,7 +226,7 @@ describe('FileIOError', function () {
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
019
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
190
0
* @tc.name FileIo_test_error_019
* @tc.name FileIo_test_error_019
* @tc.desc Function of API, flags=0o400002. The test file is exist.
* @tc.desc Function of API, flags=0o400002. The test file is exist.
*/
*/
...
@@ -413,12 +240,12 @@ describe('FileIOError', function () {
...
@@ -413,12 +240,12 @@ describe('FileIOError', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_019 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_019 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
02
00
* @tc.number SUB_STORAGE_FileIO_OpenSync_
20
00
* @tc.name FileIo_test_error_020
* @tc.name FileIo_test_error_020
* @tc.desc Function of API, flags=0o400002. The test file is exist.
* @tc.desc Function of API, flags=0o400002. The test file is exist.
*/
*/
...
@@ -432,12 +259,12 @@ describe('FileIOError', function () {
...
@@ -432,12 +259,12 @@ describe('FileIOError', function () {
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_020 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_020 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
(
);
fileio
.
unlinkSync
(
fpath
);
}
}
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
021
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
210
0
* @tc.name FileIo_test_error_021
* @tc.name FileIo_test_error_021
* @tc.desc Function of API, flags=0o10000102. The test file is exist.
* @tc.desc Function of API, flags=0o10000102. The test file is exist.
*/
*/
...
@@ -453,7 +280,7 @@ describe('FileIOError', function () {
...
@@ -453,7 +280,7 @@ describe('FileIOError', function () {
});
});
/**
/**
* @tc.number SUB_STORAGE_FileIO_OpenSync_
022
0
* @tc.number SUB_STORAGE_FileIO_OpenSync_
220
0
* @tc.name FileIo_test_error_022
* @tc.name FileIo_test_error_022
* @tc.desc Function of API,mode=1 The test file is exist.
* @tc.desc Function of API,mode=1 The test file is exist.
*/
*/
...
@@ -466,8 +293,9 @@ describe('FileIOError', function () {
...
@@ -466,8 +293,9 @@ describe('FileIOError', function () {
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
catch
(
e
)
{
catch
(
e
)
{
console
.
log
(
'
FileIo_test_error_021 has failed for
'
+
e
);
console
.
log
(
'
FileIo_test_error_022 has failed for
'
+
e
);
expect
(
fileio
.
unlinkSync
(
fpath
)
!==
null
).
assertTrue
();
fileio
.
unlinkSync
(
fpath
);
fileio
.
unlinkSync
(
fpathTarget
);
}
}
});
});
...
...
storage/storagefileioerrorjstest/src/main/js/default/test/FileVirtualPath.test.js
已删除
100644 → 0
浏览文件 @
714752d1
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
fileio
from
'
@system.fileio
'
;
import
file
from
'
@system.file
'
;
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
FILE_CONTENT
,
prepareFile
,
fileName
,
nextFileName
}
from
'
./Common
'
describe
(
'
fileVirtualPath
'
,
function
()
{
/**
* @tc.number SUB_STORAGE_File_Delete_0900
* @tc.name File_Delete_009
* @tc.desc Function of API, virtual path, Delete files from outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_Delete_009
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_Delete_009
'
,
text
:
'
sawyerwang
'
,
success
:
function
()
{
console
.
log
(
'
File_Delete_009 mkdir success
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_Delete_009 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_Delete_009
'
,
success
:
function
()
{
console
.
log
(
'
File_Delete_009 call delete success
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
code
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_Delete_1000
* @tc.name File_Delete_010
* @tc.desc Function of API, virtual path, Delete files from outside the package.
* Create files and maintain file permissions(755):/data/accounts/account_0/appdata/123456
*/
it
(
'
File_Delete_010
'
,
0
,
async
function
(
done
)
{
file
.
delete
({
uri
:
'
internal://app/../../123456
'
,
success
:
function
()
{
console
.
log
(
'
File_Delete_010 => pass
'
);
expect
(
null
).
assertFail
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_Delete_010 => fail ,code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
code
==
300
).
assertTrue
();
done
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_writeText_1200
* @tc.name File_writeText_012
* @tc.desc Function of API, virtual path, Write files from outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_writeText_012
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeText_012
'
,
text
:
'
sawyerwang
'
,
success
:
function
()
{
console
.
log
(
'
File_writeText_012 mkdir success
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_writeText_012 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
readText
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeText_012
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_writeText_012 => call readText pass,
'
+
data
.
text
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_writeText_012 call readText callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeText_012
'
,
success
:
function
()
{
console
.
log
(
'
File_writeText_012 delete success
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_writeText_012 call delete callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_writeArrayBuffer_1100
* @tc.name File_writeArrayBuffer_011
* @tc.desc Function of API, virtual path, Write files from outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_writeArrayBuffer_011
'
,
0
,
async
function
(
done
)
{
let
buf
=
new
Uint8Array
([
48
,
49
,
50
,
51
,
65
,
66
,
67
,
68
,
32
,
33
]);
file
.
writeArrayBuffer
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeArrayBuffer_011
'
,
buffer
:
buf
,
append
:
true
,
success
:
function
()
{
console
.
log
(
'
File_writeArrayBuffer_011 call writeArrayBuffer success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_writeArrayBuffer_011 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
readArrayBuffer
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeArrayBuffer_011
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_writeArrayBuffer_011 readArrayBuffer: call success
'
+
data
.
buffer
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_writeArrayBuffer_011 readArrayBuffer , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_writeArrayBuffer_011
'
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_readText_0800
* @tc.name File_readText_008
* @tc.desc Function of API, virtual path, Read files from outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_readText_008
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_readText_008
'
,
text
:
'
Text that just for test.
'
,
success
:
function
()
{
console
.
log
(
'
File_readText_008 call writeText success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_readText_008 call writeText callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
readText
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_readText_008
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_readText_008 call readText success. data.text:
'
+
data
.
text
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_readText_008 call readText callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_readText_008
'
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_readText_0900
* @tc.name File_readText_009
* @tc.desc Function of API, virtual path, Read files from outside the package.
* Create files and maintain file permissions(755):/data/accounts/account_0/appdata/123456
*/
it
(
'
File_readText_009
'
,
0
,
async
function
(
done
)
{
file
.
readText
({
uri
:
'
internal://app/../../123456
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_readText_009 => pass, data.text:
'
+
data
.
text
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_readText_009 call readText callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_read_array_buffer_1000
* @tc.name File_read_array_buffer_010
* @tc.desc Function of API, virtual path, Read files from outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_read_array_buffer_010
'
,
0
,
async
function
(
done
)
{
var
buffer
=
new
Uint8Array
([
48
,
49
,
50
,
51
,
65
,
66
,
67
,
68
,
32
,
33
]);
file
.
writeArrayBuffer
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_read_array_buffer_010
'
,
buffer
:
buffer
,
success
:
function
()
{
console
.
log
(
'
File_read_array_buffer_010 call writeArrayBuffer success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_read_array_buffer_010 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
readArrayBuffer
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_read_array_buffer_010
'
,
position
:
0
,
length
:
10
,
success
:
function
(
data
)
{
console
.
log
(
'
File_read_array_buffer_010 call readArrayBuffer success. data.buffer:
'
+
data
.
buffer
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_read_array_buffer_010 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_read_array_buffer_010
'
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_read_array_buffer_1100
* @tc.name File_read_array_buffer_011
* @tc.desc Function of API, virtual path, Read files from outside the package.
* Create files and maintain file permissions(755):/data/accounts/account_0/appdata/123456
*/
it
(
'
File_read_array_buffer_011
'
,
0
,
async
function
(
done
)
{
file
.
readArrayBuffer
({
uri
:
'
internal://cache/../../123456
'
,
position
:
0
,
length
:
10
,
success
:
function
(
data
)
{
console
.
log
(
'
File_read_array_buffer_011 => pass, data.buffer:
'
+
data
.
buffer
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_read_array_buffer_011 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_access_0900
* @tc.name File_access_009
* @tc.desc Function of API, virtual path, Determine whether files outside the package exist.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_access_009
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_access_009
'
,
text
:
'
Text that just for test.
'
,
success
:
function
()
{
console
.
log
(
'
File_access_009 mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_access_009 fail,code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
access
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_access_009
'
,
success
:
function
()
{
console
.
log
(
'
File_access_009 call access success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_access_009 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
delete
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_access_009
'
,
success
:
function
()
{
console
.
log
(
'
File_access_009 call delete success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_access_009 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_access_1000
* @tc.name File_access_010
* @tc.desc Function of API, virtual path, Determine whether files outside the package exist.
* Create files and maintain file permissions(755):
* /data/accounts/account_0/appdata/123456
*/
it
(
'
File_access_010
'
,
0
,
async
function
(
done
)
{
file
.
access
({
uri
:
'
internal://cache/../../123456
'
,
success
:
function
()
{
console
.
log
(
'
File_access_010 call access success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_access_010 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_mkdir_0900
* @tc.name File_mkdir_009
* @tc.desc Function of API, virtual path, Create directory outside package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_mkdir_009
'
,
0
,
async
function
(
done
)
{
file
.
mkdir
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_mkdir_009
'
,
success
:
function
()
{
console
.
log
(
'
File_mkdir_009 call mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_mkdir_009 call mkdir callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
rmdir
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_mkdir_009
'
,
success
:
function
()
{
console
.
log
(
'
File_mkdir_009 call rmdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_mkdir_009 call rmdir callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_rmdir_0900
* @tc.name File_rmdir_009
* @tc.desc Function of API, virtual path, Delete directory outside package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_rmdir_009
'
,
0
,
async
function
(
done
)
{
file
.
mkdir
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_rmdir_009
'
,
success
:
function
()
{
console
.
log
(
'
File_rmdir_009 call mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_rmdir_009 call mkdir callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
rmdir
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_rmdir_009
'
,
success
:
function
()
{
console
.
log
(
'
File_rmdir_009 call rmdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_rmdir_009 call rmdir callback fail, code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_Move_1300
* @tc.name File_Move_013
* @tc.desc Function of API, virtual path, Move files out of package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_Move_013
'
,
0
,
async
function
(
done
)
{
let
srcFpath
=
fileName
(
'
File_Move_013
'
);
expect
(
prepareFile
(
srcFpath
,
FILE_CONTENT
)).
assertTrue
();
file
.
move
({
srcUri
:
'
internal://app/../files/File_Move_013
'
,
dstUri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_Move_013
'
,
success
:
function
(
uri
)
{
console
.
log
(
'
File_Move_013 => pass,uri:
'
+
uri
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_Move_013 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_Copy_1300
* @tc.name File_Copy_013
* @tc.desc Function of API, virtual path, Copy files out of package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_Copy_013
'
,
0
,
async
function
(
done
)
{
let
srcFpath
=
fileName
(
'
File_Copy_013
'
);
expect
(
prepareFile
(
srcFpath
,
'
test
'
)).
assertTrue
();
file
.
copy
({
srcUri
:
'
internal://app/../files/File_Copy_013
'
,
dstUri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile/File_Copy_013
'
,
success
:
function
(
uri
)
{
console
.
log
(
'
File_Copy_013=> pass uri:
'
+
uri
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_Copy_013 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_List_1500
* @tc.name File_List_015
* @tc.desc Function of API, virtual path, Query the files in the directory outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_List_015
'
,
0
,
async
function
(
done
)
{
file
.
writeText
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_List_015
'
,
text
:
'
Text that just for test.
'
,
success
:
function
()
{
console
.
log
(
'
File_List_015 mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_List_015 fail,code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
writeText
({
uri
:
'
internal://cache/../../ohos.acts.distributeddatamgr.distributedfile/File_List_015_1
'
,
text
:
'
Text that just for test.
'
,
success
:
function
()
{
console
.
log
(
'
File_List_015_1 mkdir success.
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_List_015_1 fail,code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
file
.
list
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_List_015 => pass
'
+
JSON
.
stringify
(
data
.
fileList
));
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_List_015 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_File_List_1500
* @tc.name File_List_015
* @tc.desc Function of API, virtual path, Query the files in the directory outside the package.
* create directory and grant 777 permission:
* /data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile
*/
it
(
'
File_Get_017
'
,
0
,
async
function
(
done
)
{
file
.
get
({
uri
:
'
internal://app/../../ohos.acts.distributeddatamgr.distributedfile
'
,
success
:
function
(
data
)
{
console
.
log
(
'
File_Get_017 => pass
'
);
done
();
},
fail
:
function
(
data
,
code
)
{
console
.
log
(
'
File_Get_017 , code:
'
+
code
+
'
, data:
'
+
data
);
expect
(
null
).
assertFail
();
},
});
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_fileioPerformance_prop_copyFile
* @tc.name fileioPerformance_prop_copyFile
* @tc.desc 0.5G Synchronous opening performance test of test files
* The path needs to be manually placed in advance
* data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件)
*/
it
(
'
fileioPerformance_prop_copyFile
'
,
0
,
function
()
{
console
.
log
(
'
---fileioPerformance_prop_copyFile 0.5G---start---
'
);
let
fpath
=
nextFileName
(
'
p1
'
);
let
fpathTarget
=
nextFileName
(
'
p2
'
);
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
let
start2
=
new
Date
().
getTime
();
let
copyFileSync
=
fileio
.
copyFileSync
(
fpath
,
fpathTarget
);
let
end2
=
new
Date
().
getTime
();
let
time2
=
end2
-
start2
console
.
log
(
'
fileioPerformance_prop_copyFileSync,copyFileSync:
'
+
copyFileSync
+
'
, time2:
'
+
time2
+
'
,
'
+
i
);
fileio
.
unlinkSync
(
fpathTarget
);
}
fileio
.
closeSync
(
fd
);
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
/**
* @tc.number SUB_STORAGE_fileioPerformance_prop_openSync
* @tc.name fileioPerformance_prop_openSync
* @tc.desc 0.5G Synchronous opening performance test of test files
* The path needs to be manually placed in advance
* data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件)
*/
it
(
'
fileioPerformance_prop_openSync
'
,
0
,
function
()
{
console
.
log
(
'
---fileioPerformance_prop_openSync 0.5G---start---
'
);
let
fpath
=
nextFileName
(
'
p1
'
);
let
fd
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
let
start
=
new
Date
().
getTime
();
fd
=
fileio
.
openSync
(
fpath
,
0o2002
);
let
end
=
new
Date
().
getTime
();
let
time
=
end
-
start
console
.
log
(
'
fileioPerformance_prop_openSync,openSync:
'
+
fd
+
'
, time:
'
+
time
+
'
,
'
+
i
);
}
fileio
.
closeSync
(
fd
);
setTimeout
(
function
(){
expect
(
null
).
assertFail
();
done
();
},
30
)
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录