提交 8d1b49cd 编写于 作者: F futurezhou

bugfix for xts

Signed-off-by: Nfuturezhou <zhouweilai@huawei.com>
上级 646aba9f
......@@ -4054,7 +4054,7 @@ export default function fileIOTest() {
let fpath = await nextFileName('fileio_test_stat_promise_011');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
fileio.chmodSync(fpath, 0o640);
await fileio.stat(fpath).then((stat)=> {
fileio.stat(fpath).then((stat)=> {
expect((stat.mode & 0o777) == 0o640).assertTrue();
fileio.unlinkSync(fpath);
console.info('file stat Success');
......@@ -4314,7 +4314,7 @@ export default function fileIOTest() {
let fpath = await nextFileName('fileio_test_close_async_001');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
let fd = fileio.openSync(fpath);
await fileio.close(fd, function (err) {
fileio.close(fd, function (err) {
fileio.unlinkSync(fpath);
});
});
......
......@@ -84,8 +84,8 @@ describe('fileio_stream_close', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let fd = await fileio.openSync(fpath, 0o2);
let ss = await fileio.fdopenStreamSync(fd, 'r+');
let fd = fileio.openSync(fpath, 0o2);
let ss = fileio.fdopenStreamSync(fd, 'r+');
expect(ss !== null).assertTrue();
await ss.close();
fileio.unlinkSync(fpath);
......@@ -110,8 +110,8 @@ describe('fileio_stream_close', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let fd = await fileio.openSync(fpath, 0o2);
let ss = await fileio.fdopenStreamSync(fd, 'r+');
let fd = fileio.openSync(fpath, 0o2);
let ss = fileio.fdopenStreamSync(fd, 'r+');
expect(ss !== null).assertTrue();
ss.close(function (err) {
fileio.unlinkSync(fpath);
......
......@@ -87,7 +87,7 @@ describe('fileio_stream_flush', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let ss = await fileio.createStreamSync(fpath, 'r+');
let ss = fileio.createStreamSync(fpath, 'r+');
expect(ss !== null).assertTrue();
expect(ss.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
ss.flush().then(
......@@ -116,7 +116,7 @@ describe('fileio_stream_flush', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
let ss = await fileio.createStreamSync(fpath, 'r+');
let ss = fileio.createStreamSync(fpath, 'r+');
expect(ss !== null).assertTrue();
expect(ss.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
ss.flush(function (err) {
......
......@@ -61,7 +61,7 @@ describe('fileio_createStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.createStream(fpath, 'r+', function (err, stream) {
fileio.createStream(fpath, 'r+', function (err, stream) {
expect(stream.closeSync() == null).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue();
done();
......@@ -86,7 +86,7 @@ describe('fileio_createStream', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.createStream(fpath, 'r+', function (err, stream) {
fileio.createStream(fpath, 'r+', function (err, stream) {
expect(stream.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(stream.closeSync() == null).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue();
......
......@@ -57,7 +57,6 @@ describe('fileio_open', function () {
fileio.open(fpath, 0, 0o0400, function (err, fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -87,7 +86,6 @@ describe('fileio_open', function () {
await fileio.open(fpath, 0, 0o0400, function (err, fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -116,7 +114,6 @@ describe('fileio_open', function () {
await fileio.open(fpath, 0, function (err, fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -145,7 +142,6 @@ describe('fileio_open', function () {
fileio.open(fpath, 0o2, function (err, fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -175,7 +171,6 @@ describe('fileio_open', function () {
.then(function (fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -207,7 +202,6 @@ describe('fileio_open', function () {
.then(function (fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......@@ -239,7 +233,6 @@ describe('fileio_open', function () {
.then(function (fd) {
fileio.read(fd, new ArrayBuffer(4096))
.then(function (res) {
expect((String.fromCharCode.apply(null, new Uint8Array(res.buffer))) == FILE_CONTENT).assertTrue;
expect(res.bytesRead == FILE_CONTENT.length).assertTrue();
fileio.closeSync(fd);
fileio.unlinkSync(fpath);
......
......@@ -171,7 +171,7 @@ describe('fileio_readtext', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.readText(fpath, { position: pos, length: len, encoding: 'UTF-8' }, function (err, str) {
fileio.readText(fpath, { position: pos, length: len, encoding: 'UTF-8' }, function (err, str) {
expect(str == FILE_CONTENT.substr(pos, len)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue();
done();
......@@ -198,7 +198,7 @@ describe('fileio_readtext', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.readText(fpath, { position: 1 }, function (err, str) {
fileio.readText(fpath, { position: 1 }, function (err, str) {
expect(str == FILE_CONTENT.substr(pos, len)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue();
done();
......@@ -225,7 +225,7 @@ describe('fileio_readtext', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.readText(fpath, { position: 1 }, function (err, str) {
fileio.readText(fpath, { position: 1 }, function (err, str) {
expect(str == FILE_CONTENT.substr(pos, len)).assertTrue();
expect(fileio.unlinkSync(fpath) == null).assertTrue();
});
......
......@@ -35,7 +35,7 @@ describe('fileio_rename', function () {
try {
let newf = fpath + '123';
await fileio.rename(fpath, newf)
fileio.rename(fpath, newf)
.then(function (err) {
expect(fileio.accessSync(newf) == null).assertTrue();
expect(err == null).assertTrue();
......@@ -65,7 +65,7 @@ describe('fileio_rename', function () {
try {
let newf = fpath + 'aaa';
await fileio.rename(fpath, newf, function (err) {
fileio.rename(fpath, newf, function (err) {
expect(fileio.accessSync(newf) == null).assertTrue();
expect(fileio.unlinkSync(newf) == null).assertTrue();
done();
......@@ -89,7 +89,7 @@ describe('fileio_rename', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.access(fpath).then(function (err) {
fileio.access(fpath).then(function (err) {
let newf = fpath + '123';
fileio.rename(fpath, newf)
.then(function (err) {
......
......@@ -86,7 +86,7 @@ describe('fileio_symlink', function () {
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
try {
await fileio.symlink(fpath, fpath + 'pass2', function (err) {
fileio.symlink(fpath, fpath + 'pass2', function (err) {
fileio.accessSync(fpath + 'pass2');
fileio.unlinkSync(fpath);
fileio.unlinkSync(fpath + 'pass2');
......
......@@ -435,7 +435,7 @@ describe('fileio_write', function () {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666);
expect(isIntNum(fd)).assertTrue();
await fileio.write(fd, new ArrayBuffer(4096), function (
fileio.write(fd, new ArrayBuffer(4096), function (
error,
bytesWritten
) {
......@@ -465,7 +465,7 @@ describe('fileio_write', function () {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666);
expect(isIntNum(fd)).assertTrue();
await fileio.write(
fileio.write(
fd,
FILE_CONTENT,
{
......@@ -498,7 +498,7 @@ describe('fileio_write', function () {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666);
expect(isIntNum(fd)).assertTrue();
await fileio.write(
fileio.write(
fd,
FILE_CONTENT,
{
......@@ -532,7 +532,7 @@ describe('fileio_write', function () {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666);
expect(isIntNum(fd)).assertTrue();
await fileio.write(
fileio.write(
fd,
FILE_CONTENT,
{
......@@ -567,7 +567,7 @@ describe('fileio_write', function () {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666);
expect(isIntNum(fd)).assertTrue();
await fileio.write(
fileio.write(
fd,
FILE_CONTENT,
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册