未验证 提交 73964880 编写于 作者: O openharmony_ci 提交者: Gitee

!9007 [xts-acts][storage][master]fileio读写速率测试用例代码优化

Merge pull request !9007 from yueye/master
...@@ -40,15 +40,15 @@ export default function FileIOFilerw_test() { ...@@ -40,15 +40,15 @@ export default function FileIOFilerw_test() {
if (promise) { if (promise) {
if (read) { if (read) {
fileIO.read(file.fd, array, { length: bf, offset: offset }).then((readLen) => { fileIO.read(file.fd, array, { length: bf, offset: offset }).then((readLen) => {
console.log('fileIO_test_read_promise succeed' + readLen);
}).catch((e) => { }).catch((e) => {
console.log('fileIO_test_read_promise has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_read_promise has failed for ' + e.message + ', code: ' + e.code);
return -1;
}); });
} else { } else {
fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }).then((writeLen) => { fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }).then((writeLen) => {
console.log('fileIO_test_write_promise succeed' + writeLen);
}).catch((e) => { }).catch((e) => {
console.log('fileIO_test_write_promise has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_write_promise has failed for ' + e.message + ', code: ' + e.code);
return -1;
}); });
} }
} else { } else {
...@@ -56,12 +56,14 @@ export default function FileIOFilerw_test() { ...@@ -56,12 +56,14 @@ export default function FileIOFilerw_test() {
fileIO.read(file.fd, array, { length: bf, offset: offset }, (err, readLen) => { fileIO.read(file.fd, array, { length: bf, offset: offset }, (err, readLen) => {
if (err) { if (err) {
console.log('fileIO_test_read_callback has failed for ' + err.message + ', code: ' + err.code); console.log('fileIO_test_read_callback has failed for ' + err.message + ', code: ' + err.code);
return -1;
} }
}); });
} else { } else {
fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }, (err, writeLen) => { fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }, (err, writeLen) => {
if (err) { if (err) {
console.log('fileIO_test_write_callback has failed for ' + err.message + ', code: ' + err.code); console.log('fileIO_test_write_callback has failed for ' + err.message + ', code: ' + err.code);
return -1;
} }
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册