未验证 提交 e90c580c 编写于 作者: Y yueye 提交者: Gitee

fileio读写速率测试用例代码优化

Signed-off-by: Nyueye <yueye2@huawei.com>
上级 432e2016
......@@ -40,15 +40,15 @@ export default function FileIOFilerw_test() {
if (promise) {
if (read) {
fileIO.read(file.fd, array, { length: bf, offset: offset }).then((readLen) => {
console.log('fileIO_test_read_promise succeed' + readLen);
}).catch((e) => {
console.log('fileIO_test_read_promise has failed for ' + e.message + ', code: ' + e.code);
return -1;
});
} else {
fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }).then((writeLen) => {
console.log('fileIO_test_write_promise succeed' + writeLen);
}).catch((e) => {
console.log('fileIO_test_write_promise has failed for ' + e.message + ', code: ' + e.code);
return -1;
});
}
} else {
......@@ -56,12 +56,14 @@ export default function FileIOFilerw_test() {
fileIO.read(file.fd, array, { length: bf, offset: offset }, (err, readLen) => {
if (err) {
console.log('fileIO_test_read_callback has failed for ' + err.message + ', code: ' + err.code);
return -1;
}
});
} else {
fileIO.write(file.fd, array, { length: bf, offset: offset, encoding: 'utf-8' }, (err, writeLen) => {
if (err) {
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.
先完成此消息的编辑!
想要评论请 注册