From d976b9cdd90a92c4f631a9c8d9771dc94dd1b145 Mon Sep 17 00:00:00 2001 From: Storage sandboxing Date: Fri, 7 Jan 2022 14:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Storage sandboxing --- .../src/main/js/default/test/FileIO.test.js | 8 +++++++- .../default/test/module_fileio/class_stream/all.test.js | 1 + .../default/test/module_fileio/class_stream/close.test.js | 1 + .../js/default/test/module_fileio/members/access.test.js | 1 + .../js/default/test/module_fileio/members/close.test.js | 2 ++ .../default/test/module_fileio/members/copyFile.test.js | 2 ++ .../js/default/test/module_fileio/members/fchmod.test.js | 1 + .../default/test/module_fileio/members/fdatasync.test.js | 1 + .../test/module_fileio/members/fdopenStream.test.js | 1 + .../js/default/test/module_fileio/members/fstat.test.js | 1 + .../js/default/test/module_fileio/members/fsync.test.js | 1 + .../js/default/test/module_fileio/members/lstat.test.js | 1 + .../test/module_fileio/members/mkdir_rmdir.test.js | 2 ++ .../js/default/test/module_fileio/members/mkdtemp.test.js | 1 + .../js/default/test/module_fileio/members/open.test.js | 4 +++- .../default/test/module_fileio/members/open_close.test.js | 4 ++++ .../test/module_fileio/members/opendir_close.test.js | 1 + .../js/default/test/module_fileio/members/read.test.js | 7 ++++--- .../default/test/module_fileio/members/readtext.test.js | 2 ++ .../js/default/test/module_fileio/members/stat.test.js | 1 + .../js/default/test/module_fileio/members/symlink.test.js | 1 + .../default/test/module_fileio/members/truncate.test.js | 8 ++++++-- .../js/default/test/module_fileio/members/unlink.test.js | 2 ++ .../js/default/test/module_fileio/members/write.test.js | 2 ++ 24 files changed, 49 insertions(+), 7 deletions(-) diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js index 48018ad95..a8aa3726c 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js @@ -1064,6 +1064,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_open_sync_007 has failed for ' + e); } }); @@ -1104,6 +1105,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_open_sync_009 has failed for ' + e); } }); @@ -1119,6 +1121,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_open_sync_010 has failed for ' + e); } }); @@ -2311,6 +2314,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_copy_file_sync_008 has failed for ' + e); } }); @@ -2329,7 +2333,7 @@ describe('fileIOTest', function () { } catch (e) { fileio.unlinkSync(fpath); - console.log('fileio_test_open_sync_008 has failed for ' + e); + console.log('fileio_test_copy_file_sync_009 has failed for ' + e); } }); @@ -3492,6 +3496,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fstat_sync_001 has failed for ' + e); } }); @@ -3506,6 +3511,7 @@ describe('fileIOTest', function () { expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fstat_sync_002 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/all.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/all.test.js index b2ecc1e1b..724855ae1 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/all.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/all.test.js @@ -60,6 +60,7 @@ describe('fileio_stream', function () { fileio.createStreamSync(fpath, 'r+'); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_stream_create_stream_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/close.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/close.test.js index 2f39f1d18..9c7fe1918 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/close.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/close.test.js @@ -60,6 +60,7 @@ describe('fileio_stream', function () { let ss = fileio.fdopenStreamSync(-1, 'r+'); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_stream_fdopen_stream_sync_001 has failed for ' + e); } }) diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/access.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/access.test.js index 3f25778c7..b1c95e93f 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/access.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/access.test.js @@ -129,6 +129,7 @@ describe('fileio_access', function () { fileio.accessSync(fpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_access_sync_004' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js index 3ff912bdd..08e52bd48 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/close.test.js @@ -34,6 +34,7 @@ describe('fileio_close', function () { fileio.closeSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_close_sync_000 has failed for ' + e); } }) @@ -51,6 +52,7 @@ describe('fileio_close', function () { fileio.closeSync(-1); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_close_sync_001 has failed for ' + e); } }) }) diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js index 84a6e5381..b08051a8e 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/copyFile.test.js @@ -61,6 +61,7 @@ describe('fileio_copyfile', function () { fileio.copyFileSync(fpath, fpathTarget); expect(null).assertFail(); } catch (e) { + console.log('fileio_copy_file_sync_001 has failed for ' + e); } }); @@ -78,6 +79,7 @@ describe('fileio_copyfile', function () { fileio.copyFileSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_copy_file_sync_002 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchmod.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchmod.test.js index 7c6e61fcc..97540ff36 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchmod.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchmod.test.js @@ -127,6 +127,7 @@ describe('fileio_fchmod', function () { expect(fileio.fchmodSync(-1, 0o660) == null).assertTrue(); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fchmod_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js index aa02762bf..417b22bfd 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdatasync.test.js @@ -117,6 +117,7 @@ describe('fileio_fdatasync', async function () { await fileio.fdatasync(fd); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fdatasync_async_003 has failed for ' + e); } }); }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdopenStream.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdopenStream.test.js index ff2770070..f36c7f863 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdopenStream.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fdopenStream.test.js @@ -64,6 +64,7 @@ describe('fileio_FdOpenStream', async function () { let fp = fileio.fdopenStreamSync(fd, mode); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fdopenstream_sync_001 has failed for ' + e); } }) diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fstat.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fstat.test.js index 8e9880731..af9f3927f 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fstat.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fstat.test.js @@ -61,6 +61,7 @@ describe('fileio_stat_fstat', function () { fileio.fstatSync(invalidFD); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_stat_fstat_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fsync.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fsync.test.js index 86c7c1cd9..7f6777b3f 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fsync.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fsync.test.js @@ -58,6 +58,7 @@ describe('fileio_stat_fsync', function () { fileio.fsyncSync(-1); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_fsync_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lstat.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lstat.test.js index 4110734e5..ebc895cc6 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lstat.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lstat.test.js @@ -61,6 +61,7 @@ describe('fileio_lstat', function () { fileio.lstatSync(fpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_lstat_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdir_rmdir.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdir_rmdir.test.js index 4e5c0611c..6fbbbf024 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdir_rmdir.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdir_rmdir.test.js @@ -52,6 +52,7 @@ describe('fileio_mkdir_rmdir', function () { expect(fileio.mkdirSync('/') == null).assertTrue(); expect(null).assertFail(); } catch (e) { + console.log('fileio_mkdir_sync_rmdir_sync_001 has failed for ' + e); } }); @@ -69,6 +70,7 @@ describe('fileio_mkdir_rmdir', function () { expect(fileio.mkdirSync(12) == null).assertTrue(); expect(null).assertFail(); } catch (e) { + console.log('fileio_mkdir_sync_rmdir_sync_002 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdtemp.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdtemp.test.js index 7bc0a8403..78ec9a44c 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdtemp.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/mkdtemp.test.js @@ -34,6 +34,7 @@ describe('fileio_mkdtemp', function () { let res = fileio.mkdtempSync(dpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_mkdtemp_sync_000 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open.test.js index 85dbd75d3..e27744d42 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open.test.js @@ -33,7 +33,9 @@ describe('fileio_open', function () { try { fileio.openSync('/', 0o102, 0o666); expect(null).assertFail(); - } catch (e) {} + } catch (e) { + console.log('fileio_test_open_sync_000 has failed for ' + e); + } }); /** diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open_close.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open_close.test.js index 40ead6007..9e9c02d1e 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open_close.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/open_close.test.js @@ -81,6 +81,7 @@ describe('fileio_open_close', function () { fileio.openSync('/', 0o102, 0o666); expect(null).assertFail(); } catch (e) { + console.log('fileio_open_sync_000 has failed for ' + e); } }); @@ -100,6 +101,7 @@ describe('fileio_open_close', function () { fileio.openSync(fpath, 0o102); expect(null).assertFail(); } catch (e) { + console.log('fileio_open_sync_001 has failed for ' + e); } }); @@ -117,6 +119,7 @@ describe('fileio_open_close', function () { fileio.closeSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_close_sync_000 has failed for ' + e); } }); @@ -134,6 +137,7 @@ describe('fileio_open_close', function () { fileio.closeSync(-1); expect(null).assertFail(); } catch (e) { + console.log('fileio_close_sync_001 has failed for ' + e); } }); }); \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/opendir_close.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/opendir_close.test.js index 3567d439f..ca6b2b2ab 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/opendir_close.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/opendir_close.test.js @@ -57,6 +57,7 @@ describe('fileio_dir_opendir_close', function () { fileio.opendirSync(dpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_dir_open_close_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js index 0145fbee0..6fe33a8e2 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/read.test.js @@ -205,6 +205,7 @@ describe('fileio_read', function () { fileio.readSync(-1, new ArrayBuffer(4096)); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_read_sync_006 has failed for ' + e); } }); @@ -458,10 +459,10 @@ describe('fileio_read', function () { }); expect(null).assertFail(); } catch (e) { + expect(fileio.closeSync(fd) == null).assertTrue(); + expect(fileio.unlinkSync(fpath) == null).assertTrue(); + done(); } - expect(fileio.closeSync(fd) == null).assertTrue(); - expect(fileio.unlinkSync(fpath) == null).assertTrue(); - done(); }); /** diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/readtext.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/readtext.test.js index 7bcb1a83c..27a889c37 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/readtext.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/readtext.test.js @@ -107,6 +107,7 @@ describe('fileio_readtext', function () { fileio.readTextSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_readtext_sync_003 has failed for ' + e); } }); @@ -126,6 +127,7 @@ describe('fileio_readtext', function () { fileio.readTextSync(fpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_readtext_sync_004 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/stat.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/stat.test.js index 09473de82..a3ad1fce4 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/stat.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/stat.test.js @@ -61,6 +61,7 @@ describe('fileio_stat', function () { fileio.statSync(fpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_stat_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js index 0e70b78fc..f2d3dfb43 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/symlink.test.js @@ -39,6 +39,7 @@ describe('fileio_symlink', function () { fileio.unlinkSync(fpath + 'aaaa'); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_symlink_sync_000 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/truncate.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/truncate.test.js index 8ff53209b..d14750f49 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/truncate.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/truncate.test.js @@ -147,7 +147,9 @@ describe('fileio_truncate', function () { try { fileio.truncateSync(fpath); expect(null).assertFail(); - } catch (e) {} + } catch (e) { + console.log('fileio_test_truncate_sync_001 has failed for ' + e); + } }); /** @@ -163,6 +165,8 @@ describe('fileio_truncate', function () { try { fileio.truncateSync(); expect(null).assertFail(); - } catch (e) {} + } catch (e) { + console.log('fileio_test_truncate_sync_002 has failed for ' + e); + } }); }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/unlink.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/unlink.test.js index d53672d6f..095747905 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/unlink.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/unlink.test.js @@ -34,6 +34,7 @@ describe('fileio_unlink', function () { fileio.unlinkSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_unlink_sync_000 has failed for ' + e); } }); @@ -53,6 +54,7 @@ describe('fileio_unlink', function () { fileio.unlinkSync(fpath); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_unlink_sync_001 has failed for ' + e); } }); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/write.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/write.test.js index aba06c2c3..5ddbc7884 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/write.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/write.test.js @@ -229,6 +229,7 @@ describe('fileio_write', function () { fileio.writeSync(); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_write_sync_007 has failed for ' + e); } }); @@ -246,6 +247,7 @@ describe('fileio_write', function () { fileio.writeSync(-1, FILE_CONTENT); expect(null).assertFail(); } catch (e) { + console.log('fileio_test_write_sync_008 has failed for ' + e); } }); -- GitLab