Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f8903f8a
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看板
未验证
提交
f8903f8a
编写于
7月 14, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 14, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9229 randomAccessFile XTS 修改
Merge pull request !9229 from yangjingbo/xts_random_new
上级
69256a7b
1500c855
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
2694 addition
and
2 deletion
+2694
-2
storage/storagefileiov9jstest/src/main/js/test/Common.js
storage/storagefileiov9jstest/src/main/js/test/Common.js
+2
-2
storage/storagefileiov9jstest/src/main/js/test/List.test.js
storage/storagefileiov9jstest/src/main/js/test/List.test.js
+10
-0
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/close.test.js
...est/src/main/js/test/class_randomAccessFile/close.test.js
+70
-0
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/read.test.js
...test/src/main/js/test/class_randomAccessFile/read.test.js
+852
-0
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/setFilePointer.test.js
...ain/js/test/class_randomAccessFile/setFilePointer.test.js
+101
-0
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/write.test.js
...est/src/main/js/test/class_randomAccessFile/write.test.js
+722
-0
storage/storagefileiov9jstest/src/main/js/test/members/createRandomAccessFile.test.js
...t/src/main/js/test/members/createRandomAccessFile.test.js
+937
-0
未找到文件。
storage/storagefileiov9jstest/src/main/js/test/Common.js
浏览文件 @
f8903f8a
...
@@ -45,8 +45,8 @@ export function prepare200MFile(fpath) {
...
@@ -45,8 +45,8 @@ export function prepare200MFile(fpath) {
fileIO
.
truncateSync
(
file
.
fd
)
fileIO
.
truncateSync
(
file
.
fd
)
let
bf
=
new
ArrayBuffer
(
1024
*
1024
*
20
);
let
bf
=
new
ArrayBuffer
(
1024
*
1024
*
20
);
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
let
position
=
bf
.
byteLength
*
i
;
let
offset
=
bf
.
byteLength
*
i
;
let
writeLen
=
fileIO
.
writeSync
(
file
.
fd
,
bf
,
{
offset
:
0
,
length
:
bf
.
byteLength
,
position
:
position
,
encoding
:
'
utf-8
'
});
let
writeLen
=
fileIO
.
writeSync
(
file
.
fd
,
bf
,
{
offset
:
offset
,
length
:
bf
.
byteLength
,
encoding
:
'
utf-8
'
});
}
}
fileIO
.
fsyncSync
(
file
.
fd
)
fileIO
.
fsyncSync
(
file
.
fd
)
fileIO
.
closeSync
(
file
)
fileIO
.
closeSync
(
file
)
...
...
storage/storagefileiov9jstest/src/main/js/test/List.test.js
浏览文件 @
f8903f8a
...
@@ -17,6 +17,7 @@ import fileIOAccess from './members/access.test.js'
...
@@ -17,6 +17,7 @@ import fileIOAccess from './members/access.test.js'
import
fileIOClose
from
'
./members/close.test.js
'
import
fileIOClose
from
'
./members/close.test.js
'
import
fileIOCopyDir
from
'
./members/copyDir.test
'
import
fileIOCopyDir
from
'
./members/copyDir.test
'
import
fileIOCopyfile
from
'
./members/copyFile.test.js
'
import
fileIOCopyfile
from
'
./members/copyFile.test.js
'
import
fileIOCreateRandomAccessFile
from
'
./members/createRandomAccessFile.test.js
'
import
fileIOCreateStream
from
'
./members/createStream.test.js
'
import
fileIOCreateStream
from
'
./members/createStream.test.js
'
import
fileIOFdatasync
from
'
./members/fdatasync.test.js
'
import
fileIOFdatasync
from
'
./members/fdatasync.test.js
'
import
fileIOFdOpenStream
from
'
./members/fdopenStream.test.js
'
import
fileIOFdOpenStream
from
'
./members/fdopenStream.test.js
'
...
@@ -30,6 +31,10 @@ import fileIOMkdtemp from './members/mkdtemp.test.js'
...
@@ -30,6 +31,10 @@ import fileIOMkdtemp from './members/mkdtemp.test.js'
import
fileIOMoveDir
from
'
./members/moveDir.test.js
'
import
fileIOMoveDir
from
'
./members/moveDir.test.js
'
import
fileIOMoveFile
from
'
./members/moveFile.test.js
'
import
fileIOMoveFile
from
'
./members/moveFile.test.js
'
import
fileIOOpen
from
'
./members/open.test.js
'
import
fileIOOpen
from
'
./members/open.test.js
'
import
fileIORandomAccessFileClose
from
'
./class_randomAccessFile/close.test.js
'
import
fileIORandomAccessFileRead
from
'
./class_randomAccessFile/read.test.js
'
import
fileIORandomAccessFileSetFilePointer
from
'
./class_randomAccessFile/setFilePointer.test.js
'
import
fileIORandomAccessFileWrite
from
'
./class_randomAccessFile/write.test.js
'
import
fileIORead
from
'
./members/read.test.js
'
import
fileIORead
from
'
./members/read.test.js
'
import
fileIOReadtext
from
'
./members/readtext.test.js
'
import
fileIOReadtext
from
'
./members/readtext.test.js
'
import
fileIORename
from
'
./members/rename.test.js
'
import
fileIORename
from
'
./members/rename.test.js
'
...
@@ -49,6 +54,7 @@ export default function testsuite() {
...
@@ -49,6 +54,7 @@ export default function testsuite() {
fileIOClose
()
fileIOClose
()
fileIOCopyDir
()
fileIOCopyDir
()
fileIOCopyfile
()
fileIOCopyfile
()
fileIOCreateRandomAccessFile
()
fileIOCreateStream
()
fileIOCreateStream
()
fileIOFdatasync
()
fileIOFdatasync
()
fileIOFdOpenStream
()
fileIOFdOpenStream
()
...
@@ -62,6 +68,10 @@ export default function testsuite() {
...
@@ -62,6 +68,10 @@ export default function testsuite() {
fileIOMoveDir
()
fileIOMoveDir
()
fileIOMoveFile
()
fileIOMoveFile
()
fileIOOpen
()
fileIOOpen
()
fileIORandomAccessFileClose
()
fileIORandomAccessFileRead
()
fileIORandomAccessFileSetFilePointer
()
fileIORandomAccessFileWrite
()
fileIORead
()
fileIORead
()
fileIOReadtext
()
fileIOReadtext
()
fileIORename
()
fileIORename
()
...
...
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/close.test.js
0 → 100644
浏览文件 @
f8903f8a
/*
* Copyright (C) 2023 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
,
nextFileName
,
describe
,
it
,
expect
}
from
'
../Common
'
;
export
default
function
fileIORandomAccessFileClose
()
{
describe
(
'
fileIO_randomAccessFile_close
'
,
function
()
{
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0000
* @tc.name fileIO_randomaccessfile_close_sync_000
* @tc.desc Test close() interface. Close the RandomAccessFile object.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_randomaccessfile_close_sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_randomaccessfile_close_sync_000
'
);
try
{
let
randomaccessfile
=
fileIO
.
createRandomAccessFileSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
);
randomaccessfile
.
close
();
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
err
)
{
console
.
info
(
'
fileIO_randomaccessfile_close_sync_000 has failed for
'
+
err
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0100
* @tc.name fileIO_randomaccessfile_close_sync_001
* @tc.desc Test close() interface. Parameter mismatch.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_randomaccessfile_close_sync_001
'
,
3
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_randomaccessfile_close_sync_001
'
);
let
randomaccessfile
=
fileIO
.
createRandomAccessFileSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
);
try
{
randomaccessfile
.
close
(
1
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
fileIO_randomaccessfile_close_sync_001 has failed for
'
+
err
);
randomaccessfile
.
close
();
fileIO
.
unlinkSync
(
fpath
);
expect
(
err
.
code
==
13900020
&&
err
.
message
==
"
Invalid argument
"
).
assertTrue
();
}
});
})
}
\ No newline at end of file
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/read.test.js
0 → 100644
浏览文件 @
f8903f8a
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/setFilePointer.test.js
0 → 100644
浏览文件 @
f8903f8a
/*
* Copyright (C) 2023 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
,
FILE_CONTENT
,
prepareFile
,
nextFileName
,
describe
,
it
,
expect
}
from
'
../Common
'
;
export
default
function
fileIORandomAccessFileSetFilePointer
()
{
describe
(
'
fileIO_randomAccessFile_setFilePointer
'
,
function
()
{
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0000
* @tc.name fileIO_randomaccessfile_set_file_pointer_sync_000
* @tc.desc Test setFilePointer() interface. Set file offset pointer position and read will start from filePointer + offset
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
fileIO_randomaccessfile_set_file_pointer_sync_000
'
,
0
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_randomaccessfile_set_file_pointer_sync_000
'
);
expect
(
prepareFile
(
fpath
,
FILE_CONTENT
)).
assertTrue
();
try
{
let
randomaccessfile
=
fileIO
.
createRandomAccessFileSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
);
expect
(
randomaccessfile
.
filePointer
==
0
).
assertTrue
();
let
initFilePointer
=
5
;
randomaccessfile
.
setFilePointer
(
initFilePointer
);
expect
(
randomaccessfile
.
filePointer
==
initFilePointer
).
assertTrue
();
let
initOffset
=
5
;
let
readLen
=
randomaccessfile
.
readSync
(
new
ArrayBuffer
(
4096
),
{
offset
:
initOffset
});
expect
(
readLen
==
FILE_CONTENT
.
length
-
initFilePointer
-
initOffset
).
assertTrue
();
randomaccessfile
.
close
();
fileIO
.
unlinkSync
(
fpath
);
}
catch
(
err
)
{
console
.
info
(
'
fileIO_randomaccessfile_set_file_pointer_sync_000 has failed for
'
+
err
);
expect
(
false
).
assertTrue
();
}
});
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0100
* @tc.name fileIO_randomaccessfile_set_file_pointer_sync_001
* @tc.desc Test setFilePointer() interface. Invalid fpointer.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_randomaccessfile_set_file_pointer_sync_001
'
,
3
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_randomaccessfile_set_file_pointer_sync_001
'
);
let
randomaccessfile
=
fileIO
.
createRandomAccessFileSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
);
try
{
randomaccessfile
.
setFilePointer
(
'
5
'
);
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
fileIO_randomaccessfile_set_file_pointer_sync_001 has failed for
'
+
err
);
randomaccessfile
.
close
();
fileIO
.
unlinkSync
(
fpath
);
expect
(
err
.
code
==
13900020
&&
err
.
message
==
"
Invalid argument
"
).
assertTrue
();
}
});
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0200
* @tc.name fileIO_randomaccessfile_set_file_pointer_sync_002
* @tc.desc Test setFilePointer() interface. Missing Parameter.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 3
* @tc.require
*/
it
(
'
fileIO_randomaccessfile_set_file_pointer_sync_002
'
,
3
,
async
function
()
{
let
fpath
=
await
nextFileName
(
'
fileIO_randomaccessfile_set_file_pointer_sync_002
'
);
let
randomaccessfile
=
fileIO
.
createRandomAccessFileSync
(
fpath
,
fileIO
.
OpenMode
.
CREATE
|
fileIO
.
OpenMode
.
READ_WRITE
);
try
{
randomaccessfile
.
setFilePointer
();
expect
(
false
).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
fileIO_randomaccessfile_set_file_pointer_sync_002 has failed for
'
+
err
);
randomaccessfile
.
close
();
fileIO
.
unlinkSync
(
fpath
);
expect
(
err
.
code
==
13900020
&&
err
.
message
==
"
Invalid argument
"
).
assertTrue
();
}
});
})
}
\ No newline at end of file
storage/storagefileiov9jstest/src/main/js/test/class_randomAccessFile/write.test.js
0 → 100644
浏览文件 @
f8903f8a
此差异已折叠。
点击以展开。
storage/storagefileiov9jstest/src/main/js/test/members/createRandomAccessFile.test.js
0 → 100644
浏览文件 @
f8903f8a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录