diff --git a/storage/BUILD.gn b/storage/BUILD.gn index 45416045aad59db3afed334936b1f4714e5e5996..8fa18b349b45b47e873f2316e1a516edee8bfd62 100644 --- a/storage/BUILD.gn +++ b/storage/BUILD.gn @@ -16,20 +16,10 @@ group("storage") { testonly = true if (is_standard_system) { deps = [ - #"storagedsmjstest:storagedsm_js_test", - # "storagedsmstabilityjstest:storagedsmstability_js_test", - #"storagefileconcurrentjstest:storagefileconcurrent_js_test", "storagefileioerrorjstest:storagefileioerror_js_test", "storagefileiojstest:storagefileio_js_test", + "storagefilejstest:storagefile_js_test", "storagestatfsjstest:storagestatfs_js_test", - - # "storagefmspublicjstest:storagefmspublic_js_test", - # "storagefmssharejstest:storagefmsshare_js_test", - - # "storagefileioperformancejstest:storagefileioperformance_js_test", - # "storagefileioreliabilityjstest:storagefileioreliability_js_test", - # "storagefileiostabilityjstest:storagefileiostability_js_test", - # "storagefilestabilityjstest:storagefilestability_js_test", ] } } diff --git a/storage/storagedsmjstest/Test.json b/storage/storagedsmjstest/Test.json deleted file mode 100644 index 910be0d9c5f262b48f47dbf970419f076b3214d7..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFmsPublicJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagedsmjstest/src/main/config.json b/storage/storagedsmjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagedsmjstest/src/main/js/default/pages/index/index.js b/storage/storagedsmjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index f7894a72230dd2356d1ce272896c9e0fd09e08cd..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagedsmjstest/src/main/js/default/test/Common.js b/storage/storagedsmjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c7b15f7ce870c57af41cbaadd146c05ba0b91c0d..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -export const FILE_CONTENT = 'hello world' -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function filePickerName(testName,deviceID) { - const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' - return BASE_PATH + testName -} -export function filePickerName1(testName,deviceID) { - const BASE_PATH = '/data/ss/'+ deviceID +'/fms_test/' - return BASE_PATH + testName -} -export function filePickerName2(testName,deviceID) { - const BASE_PATH = '/data/ss/'+ deviceID - return BASE_PATH + testName -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} -export function fmsFileName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" - return BASE_PATH + testName -} -export function fmsCacheName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" - return BASE_PATH + testName -} -export function fmsPublic(testName) { - const BASE_PATH = '/data/ss/files/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() == null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js b/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js deleted file mode 100644 index e6ec59b2f3a00021aecd0c045b3563daa07b1e19..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/js/default/test/Dsm.test.js +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Copyright (C) 2021 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 devicesmgr from '@system.devicesmgr'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' - -describe('dsmTest', function () { - let mid = 0; - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0000 - * @tc.name DSM_JS_Function_0000 - * @tc.desc Insert SD card to start up in shutdown state - */ - it('DSM_JS_Function_0000', 0, function () { - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0000 call getVolumes success. data:' + JSON.stringify(data)); - mid = data.volumeInfos[2].mId; - expect(data.volumeInfos[2].mId !== null).assertTrue(); - expect(data.volumeInfos[2].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0000 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0100 - * @tc.name DSM_JS_Function_0100 - * @tc.desc Insert SD card in power on state - */ - it('DSM_JS_Function_0100', 0, function () { - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0100 call getVolumes success. data:' + JSON.stringify(data)); - expect(data.volumeInfos[2].mId !== null).assertTrue(); - expect(data.volumeInfos[2].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0100 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0200 - * @tc.name DSM_JS_Function_0200 - * @tc.desc Unplug the SD card in the power on state - */ - it('DSM_JS_Function_0200', 0, function () { - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0200 call getVolumes success. data:' + JSON.stringify(data)); - for (let i = 0; i < data.volumeInfos.length; i++) { - expect(typeof(data.volumeInfos[i].mId) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mDiskId) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mPartGuid) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mFsUuid) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mType) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mMountFlags) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mMountUserId) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mState) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mPath) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mInternalPath) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mFsLabel) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].Description) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].IsVisibleForUser) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsEmulated) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsPrimaryEmulatedForUser) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsRemovable) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsPrimary) == 'boolean').assertTrue(); - } - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0200 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0300 - * @tc.name DSM_JS_Function_0300 - * @tc.desc Uninstall SD card. - */ - it('DSM_JS_Function_0300', 0, function () { - let mId = 0; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0300 call getVolumes success.' + JSON.stringify(data)); - mId = data.volumeInfos[2].mId; - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0300 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.unMount({ - volId: mId, - success: function () { - console.log('DSM_JS_Function_0300 call unMount success.'); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0300 call unMount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - } - }) - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0300 call getVolumes success.' + JSON.stringify(data)); - for (let i = 0; i < data.getDisks.length; i++) { - expect(data.volumeInfos[i].mId !== 'public:179,33').assertTrue(); - expect(data.volumeInfos[i].mState !== 2).assertTrue(); - } - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0300 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0400 - * @tc.name DSM_JS_Function_0400 - * @tc.desc Mount SD card. - */ - it('DSM_JS_Function_0400', 0, function () { - devicesmgr.mount({ - volId: mid, - success: function () { - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0400 call getVolumes success. data:' + JSON.stringify(data)); - expect(data.volumeInfos[2].mState == 2).assertTure() - expect(data.volumeInfos[2].mInternalPath !== null).assertTure() - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0400 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0800 - * @tc.name DSM_JS_Function_0800 - * @tc.desc Find the corresponding volume information through the volume ID - */ - it('DSM_JS_Function_0800', 0, function () { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0800 call getVolumes success' + JSON.stringify(data)); - mId = data.volumeInfos[2].mId; - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0800 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findVolumeById({ - volId: mId, - success: function (vol) { - console.log('DSM_JS_Function_0800 call findVolumeById success' + JSON.stringify(vol)) - expect(vol.volumeInfos[2].mId !== null).assertTrue(); - expect(vol.volumeInfos[2].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0800 call findVolumeById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_0900 - * @tc.name DSM_JS_Function_0900 - * @tc.desc Find the corresponding volume information through the volume ID - */ - it('DSM_JS_Function_0900', 0, function () { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0900 call getVolumes success' + JSON.stringify(data)); - mId = data.volumeInfos[0].mId; - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0900 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findVolumeById({ - volId: mId, - success: function (vol) { - console.log('DSM_JS_Function_0900 call findVolumeById success' + JSON.stringify(vol)) - expect(vol.volumeInfos[0].mId == 'emulated;0').assertTrue(); - expect(vol.volumeInfos[0].mInternalPath !== null).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0900 call findVolumeById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1000 - * @tc.name DSM_JS_Function_1000 - * @tc.desc Find the corresponding volume information through the volume ID - */ - it('DSM_JS_Function_1000', 0, function () { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_0900 call getVolumes success' + JSON.stringify(data)); - mId = data.volumeInfos[1].mId; - }, - fail: function (data, code) { - console.log('DSM_JS_Function_0900 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findVolumeById({ - volId: mId, - success: function (vol) { - console.log('DSM_JS_Function_1000 call findVolumeById success' + JSON.stringify(vol)) - expect(vol.volumeInfos[1].mId == 'private').assertTrue(); - expect(vol.volumeInfos[1].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1000 call findVolumeById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1100 - * @tc.name DSM_JS_Function_1100 - * @tc.desc Obtain the corresponding volume information through the UUID of the volume - */ - it('DSM_JS_Function_1100', 0, function () { - let mFsUuid; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1100 call getVolumes success' + JSON.stringify(data)); - mFsUuid = data.volumeInfos[2].mFsUuid; - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1100 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findVolumeByUuid({ - volumeUuid: mFsUuid, - success: function (vol) { - console.log('DSM_JS_Function_1100 call findVolumeByUuid success' + JSON.stringify(vol)) - expect(vol.volumeInfos[2].mId !== null).assertTrue(); - expect(vol.volumeInfos[2].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1100 call findVolumeByUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1200 - * @tc.name DSM_JS_Function_1200 - * @tc.desc Get information about writable volumes - */ - it('DSM_JS_Function_1200', 0, function () { - devicesmgr.getWritableVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1200 call getWritableVolumes success. data:' + JSON.stringify(data)); - for (let i = 0; i < data.volumeInfos.length; i++) { - expect(typeof(data.volumeInfos[i].mId) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mDiskId) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mPartGuid) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mFsUuid) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mType) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mMountFlags) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mMountUserId) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mState) == 'number').assertTrue(); - expect(typeof(data.volumeInfos[i].mPath) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mInternalPath) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].mFsLabel) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].Description) == 'string').assertTrue(); - expect(typeof(data.volumeInfos[i].IsVisibleForUser) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsEmulated) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsPrimaryEmulatedForUser) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsRemovable) == 'boolean').assertTrue(); - expect(typeof(data.volumeInfos[i].IsPrimary) == 'boolean').assertTrue(); - } - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1200 call getWritableVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1300 - * @tc.name DSM_JS_Function_1300 - * @tc.desc Obtain the corresponding disk information through the disk ID - */ - it('DSM_JS_Function_1300', 0, function () { - let mDiskId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1300 call getVolumes success' + data); - mDiskId = data.volumeInfos[2].mDiskId; - console.log('DSM_JS_Function_1300---' + data.volumeInfos[2].mDiskId); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1300 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findDiskById({ - diskId: mDiskId, - success: function (disk) { - console.log('DSM_JS_Function_1300 call findDiskById success' + JSON.stringify(disk)) - expect(disk.findDiskById[0].mId == mDiskId).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1300 call findDiskById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1400 - * @tc.name DSM_JS_Function_1400 - * @tc.desc Get UUID of primary storage - */ - it('DSM_JS_Function_1400', 0, function () { - devicesmgr.getPrimaryStorageUuid({ - success: function (primaryUuid) { - console.log('DSM_JS_Function_1400 call getPrimaryStorageUuid success.' + JSON.stringify(primaryUuid)); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1400 call getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1500 - * @tc.name DSM_JS_Function_1500 - * @tc.desc Find its corresponding private volume through simulate volume - */ - it('DSM_JS_Function_1500', 0, function () { - let emuVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1500 call getVolumes success' + data); - emuVol = data.volumeInfos[0] - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1500 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findPrivateForEmulate({ - emuVol: emuVol, - success: function (priVol) { - console.log('DSM_JS_Function_1500 call findPrivateForEmulate success' + JSON.stringify(priVol)) - expect(priVol.volumeInfos[1].mId == 'private').assertTrue(); - expect(priVol.volumeInfos[1].mState == 2).assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1500 call findPrivateForEmulate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1600 - * @tc.name DSM_JS_Function_1600 - * @tc.desc Find its corresponding emulated volume through private volume - */ - it('DSM_JS_Function_1600', 0, function () { - var priVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1600 call getVolumes success' + data); - priVol = data.volumeInfos[1] - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1600 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findEmulateForPrivate({ - priVol: priVol, - success: function (emuVol) { - console.log('DSM_JS_Function_1600 call findEmulateForPrivate success' + JSON.stringify(emuVol)) - expect(priVol.volumeInfos[0].mId == 'emulated;0').assertTrue(); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1600 call findEmulateForPrivate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1700 - * @tc.name DSM_JS_Function_1700 - * @tc.desc Get the name of the volume (SD card) - */ - it('DSM_JS_Function_1700', 0, function () { - var vol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1700 call getVolumes success' + data); - vol = data.volumeInfos[2] - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1700 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.getBestVolumeDescription({ - vol: vol, - success: function (desCription) { - console.log('DSM_JS_Function_1700 call getBestVolumeDescription success' +JSON.stringify(desCription)) - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1700 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1800 - * @tc.name DSM_JS_Function_1800 - * @tc.desc Get the name of the volume (Internal storage public) - */ - it('DSM_JS_Function_1800', 0, function () { - var vol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1800 call getVolumes success' + data); - vol = data.volumeInfos[0] - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1800 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.getBestVolumeDescription({ - vol: vol, - success: function (desCription) { - console.log('DSM_JS_Function_1800 call getBestVolumeDescription success' + JSON.stringify(desCription)) - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1800 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_Function_1900 - * @tc.name DSM_JS_Function_1900 - * @tc.desc Get the name of the volume (Internal storage private) - */ - it('DSM_JS_Function_1900', 0, function () { - var vol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_Function_1900 call getVolumes success' + data); - vol = data.volumeInfos[1] - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1900 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.getBestVolumeDescription({ - vol: vol, - success: function (desCription) { - console.log('DSM_JS_Function_1900 call getBestVolumeDescription success' + JSON.stringify(desCription)) - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1900 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - -}) diff --git a/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js b/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js deleted file mode 100644 index 69f810373d4a5213d6cb378bc46a97402af498a8..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/js/default/test/DsmError.test.js +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright (C) 2021 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 devicesmgr from '@system.devicesmgr'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' - -describe('dsmErrorTest', function () { - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0100 - * @tc.name DSM_JS_ERROR_0100 - * @tc.desc Verify that the mount volume ID is null successfully. - */ - it('DSM_JS_ERROR_0100', 0, function () { - devicesmgr.mount({ - volId: '', - success: function () { - console.log('DSM_JS_ERROR_0100 call mount success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0100 call mount pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0200 - * @tc.name DSM_JS_ERROR_0200 - * @tc.desc Verify that the mount does not exist and the volume ID is successful. - */ - it('DSM_JS_ERROR_0200', 0, function () { - devicesmgr.mount({ - volId: '123', - success: function () { - console.log('DSM_JS_ERROR_0200 call mount success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0200 call mount pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0300 - * @tc.name DSM_JS_ERROR_0300 - * @tc.desc Verify that the unmount does not exist and the volume ID is successful. - */ - it('DSM_JS_ERROR_0300', 0, function () { - devicesmgr.unMount({ - volId: '123', - success: function () { - console.log('DSM_JS_ERROR_0300 call unMount success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0300 call unMount pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0400 - * @tc.name DSM_JS_ERROR_0400 - * @tc.desc Verify that the unmount volume ID is null successfully. - */ - it('DSM_JS_ERROR_0400', 0, function () { - devicesmgr.unMount({ - volId: '', - success: function () { - console.log('DSM_JS_ERROR_0400 call unMount success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0400 call unMount pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0500 - * @tc.name DSM_JS_ERROR_0500 - * @tc.desc Verify that the format does not exist and whether the volume ID is successful. - */ - it('DSM_JS_ERROR_0500', 0, function () { - devicesmgr.format({ - volId: '123', - success: function () { - console.log('DSM_JS_ERROR_0500 call format success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0500 call format pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0600 - * @tc.name DSM_JS_ERROR_0600 - * @tc.desc Verify that the ID of the formatted volume is null successfully. - */ - it('DSM_JS_ERROR_0600', 0, function () { - devicesmgr.format({ - volId: '', - success: function () { - console.log('DSM_JS_ERROR_0600 call format success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0600 call format pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0700 - * @tc.name DSM_JS_ERROR_0700 - * @tc.desc Verify that the SD card is successfully copied and mounted.. - */ - it('DSM_JS_ERROR_0700', 0, function () { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_JS_ERROR_0900 call getVolumes success. data:' + JSON.stringify(data)); - for (let i = 0; i < data.volumeInfos.length; i++) { - if (data.volumeInfos[i].mState == 2 && data.volumeInfos[i].mId.indexOf('public:179') != -1) { - mId = data.volumeInfos[i].mId; - break; - } - } - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0700 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.mount({ - volId: mId, - success: function () { - console.log('DSM_JS_ERROR_0700 call mount success'); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0700 call mount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0800 - * @tc.name DSM_JS_ERROR_0800 - * @tc.desc Verify that volId is empty - */ - it('DSM_JS_ERROR_0800', 0, function () { - devicesmgr.findVolumeById({ - volId: '', - success: function () { - console.log('DSM_JS_ERROR_0800 call findVolumeById success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0800 call findVolumeById pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_0900 - * @tc.name DSM_JS_ERROR_0900 - * @tc.desc Invalid volId validation - */ - it('DSM_JS_ERROR_0900', 0, function () { - devicesmgr.findVolumeById({ - volId: '1234', - success: function () { - console.log('DSM_JS_ERROR_0900 call findVolumeById success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_0900 call findVolumeById pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1000 - * @tc.name DSM_JS_ERROR_1000 - * @tc.desc Verify that volumeUuid is null - */ - it('DSM_JS_ERROR_1000', 0, function () { - devicesmgr.findVolumeByUuid({ - volumeUuid: '', - success: function () { - console.log('DSM_JS_ERROR_1000 call findVolumeByUuid success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1000 call findVolumeByUuid pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1100 - * @tc.name DSM_JS_ERROR_1100 - * @tc.desc Invalid volumeUuid validation - */ - it('DSM_JS_ERROR_1100', 0, function () { - devicesmgr.findVolumeByUuid({ - volumeUuid: '321', - success: function () { - console.log('DSM_JS_ERROR_1100 call findVolumeByUuid success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1100 call findVolumeByUuid pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1200 - * @tc.name DSM_JS_ERROR_1200 - * @tc.desc Verify that diskId is empty - */ - it('DSM_JS_ERROR_1200', 0, function () { - devicesmgr.findDiskById({ - diskId: '', - success: function () { - console.log('DSM_JS_ERROR_1200 call findDiskById success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1200 call findDiskById pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1300 - * @tc.name DSM_JS_ERROR_1300 - * @tc.desc Invalid DiskID verified - */ - it('DSM_JS_ERROR_1300', 0, function () { - devicesmgr.findDiskById({ - diskId: '789', - success: function () { - console.log('DSM_JS_ERROR_1300 call findDiskById success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1300 call findDiskById pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1400 - * @tc.name DSM_JS_ERROR_1400 - * @tc.desc Verify that the value of the incoming simulate collection is null - */ - it('DSM_JS_ERROR_1400', 0, function () { - devicesmgr.findPrivateForEmulate({ - emuVol: { - mId: '', - mDiskId: '', - mPartGuid: '', - mFsUuid: '', - mType: '', - mMountFlags: '', - mMountUserId: '', - mState: '', - mPath: '', - mInternalPath: '', - mFsLabel: '', - Description: '', - IsVisibleForUser: '', - IsEmulated: '', - IsPrimaryEmulatedForUser: '', - IsRemovable: '', - IsPrimary: '' - }, - success: function () { - console.log('DSM_JS_ERROR_1400 call findPrivateForEmulate success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1400 call findPrivateForEmulate pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1500 - * @tc.name DSM_JS_ERROR_1500 - * @tc.desc Verify that an invalid simulate set value was passed in - */ - it('DSM_JS_ERROR_1500', 0, function () { - devicesmgr.findPrivateForEmulate({ - emuVol: { - mId: '1234', - mDiskId: '321', - mPartGuid: '1357', - mFsUuid: '7890', - mType: 2, - mMountFlags: 3, - mMountUserId: 0, - mState: 6, - mPath: '/storage/emulated', - mInternalPath: '/data/media', - mFsLabel: '123', - Description: true, - IsVisibleForUser: true, - IsEmulated: true, - IsPrimaryEmulatedForUser: true, - IsRemovable: true, - IsPrimary: true - }, - success: function () { - console.log('DSM_JS_ERROR_1500 call findPrivateForEmulate success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1500 call findPrivateForEmulate pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1600 - * @tc.name DSM_JS_ERROR_1600 - * @tc.desc Verify that the value of the incoming private collection is empty - */ - it('DSM_JS_ERROR_1600', 0, function () { - devicesmgr.findEmulateForPrivate({ - priVol: { - mId: '', - mDiskId: '', - mPartGuid: '', - mFsUuid: '', - mType: '', - mMountFlags: '', - mMountUserId: '', - mState: '', - mPath: '', - mInternalPath: '', - mFsLabel: '', - Description: '', - IsVisibleForUser: '', - IsEmulated: '', - IsPrimaryEmulatedForUser: '', - IsRemovable: '', - IsPrimary: '' - }, - success: function () { - console.log('DSM_JS_ERROR_1600 call findEmulateForPrivate success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1600 call findEmulateForPrivate pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1700 - * @tc.name DSM_JS_ERROR_1700 - * @tc.desc Verify that an invalid private collection value was passed in - */ - it('DSM_JS_ERROR_1700', 0, function () { - devicesmgr.findEmulateForPrivate({ - priVol: { - mId: '1234', - mDiskId: '321', - mPartGuid: '456', - mFsUuid: '789', - mType: 1, - mMountFlags: 0, - mMountUserId: 0, - mState: 2, - mPath: 'data', - mInternalPath: '', - mFsLabel: '', - Description: true, - IsVisibleForUser: true, - IsEmulated: true, - IsPrimaryEmulatedForUser: true, - IsRemovable: true, - IsPrimary: true - }, - success: function () { - console.log('DSM_JS_ERROR_1700 call findEmulateForPrivate success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1700 call findEmulateForPrivate pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1800 - * @tc.name DSM_JS_ERROR_1800 - * @tc.desc Verify that the vol set value is empty - */ - it('DSM_JS_ERROR_1800', 0, function () { - devicesmgr.getBestVolumeDescription({ - vol: { - mId: '', - mDiskId: '', - mPartGuid: '', - mFsUuid: '', - mType: '', - mMountFlags: '', - mMountUserId: '', - mState: '', - mPath: '', - mInternalPath: '', - mFsLabel: '', - Description: '', - IsVisibleForUser: '', - IsEmulated: '', - IsPrimaryEmulatedForUser: '', - IsRemovable: '', - IsPrimary: '' - }, - success: function () { - console.log('DSM_JS_ERROR_1800 call getBestVolumeDescription success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1800 call getBestVolumeDescription pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_DSM_JS_ERROR_1900 - * @tc.name DSM_JS_ERROR_1900 - * @tc.desc Validate invalid vol set value - */ - it('DSM_JS_ERROR_1900', 0, function () { - devicesmgr.getBestVolumeDescription({ - vol: { - mId: 'public:177,25', - mDiskId: 'disk:178,24', - mPartGuid: '', - mFsUuid: 'd87ba2fe-828f-4237-8006-c6dc6c2910e7', - mType: 0, - mMountFlags: 2, - mMountUserId: 0, - mState: 2, - mPath: '/storage/d87ba2fe-828f-4237-8006-c6dc6c2910e7', - mInternalPath: '/data/ss/d87ba2fe-828f-4237-8006-c6dc6c2910e7', - mFsLabel: '', - Description: true, - IsVisibleForUser: true, - IsEmulated: true, - IsPrimaryEmulatedForUser: true, - IsRemovable: true, - IsPrimary: true - }, - success: function () { - console.log('DSM_JS_ERROR_1900 call getBestVolumeDescription success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('DSM_JS_ERROR_1900 call getBestVolumeDescription pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }) - }) - -}) diff --git a/storage/storagedsmjstest/src/main/js/default/test/List.test.js b/storage/storagedsmjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index 8435a4c9960434a2d3a5ff6b59f9659871a1ec45..0000000000000000000000000000000000000000 --- a/storage/storagedsmjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./Dsm.test.js') -require('./DsmError.test.js') diff --git a/storage/storagedsmstabilityjstest/BUILD.gn b/storage/storagedsmstabilityjstest/BUILD.gn deleted file mode 100644 index 61dd14fc24975b0215070f3e61c527b0ba04ab84..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagedsmstability_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagedsmstability_js_assets", - ":storagedsmstability_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFmsPublicJsTest" -} -ohos_js_assets("storagedsmstability_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagedsmstability_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagedsmstabilityjstest/Test.json b/storage/storagedsmstabilityjstest/Test.json deleted file mode 100644 index 910be0d9c5f262b48f47dbf970419f076b3214d7..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFmsPublicJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/signature/openharmony_sx.p7b b/storage/storagedsmstabilityjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagedsmstabilityjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagedsmstabilityjstest/src/main/config.json b/storage/storagedsmstabilityjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/app.js b/storage/storagedsmstabilityjstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json b/storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js b/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index f7894a72230dd2356d1ce272896c9e0fd09e08cd..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js deleted file mode 100644 index e94e7f4049a3da8852e3fcba5be70a7100756bd4..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -export const FILE_CONTENT = 'hello world' -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function filePickerName(testName,deviceID) { - const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' - return BASE_PATH + testName -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} -export function fmsFileName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" - return BASE_PATH + testName -} -export function fmsCacheName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() == null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js deleted file mode 100644 index 1a5f4dfb9d5de0308278c788dc904d7839260eeb..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmPerformance.test.js +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (C) 2021 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 devicesmgr from '@system.devicesmgr'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' - -describe('dsmPerformanceTest', function () { - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0000 - * @tc.name DSM_Performance_0000 - * @tc.desc getVolumes Performance test - */ - it('DSM_Performance_0000', 0, function () { - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.getVolumes({ - success: function (data) { - var end = new Date().getTime(); - console.log('DSM_Performance_0000 call getVolumes success' + JSON.stringify(data)); - console.log('---DSM_Performance_0000---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0000 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - } - }); - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0100 - * @tc.name DSM_Performance_0100 - * @tc.desc unMount mount Performance test - */ - it('DSM_Performance_0100', 0, function () { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_0100 call getVolumes success' + data); - mId = data.volumeInfos[2].mId; - }, - fail: function (data, code) { - console.log('DSM_Performance_0100 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - if (mId != null) { - devicesmgr.unMount({ - volId: mId, - success: function () { - console.log('DSM_Performance_0100 call unMount success.'); - var end = new Date().getTime(); - console.log('---DSM_Performance_0100---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0100 call unMount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - } - }) - var start1 = new Date().getTime(); - devicesmgr.mount({ - volId: mId, - success: function () { - var end1 = new Date().getTime(); - console.log('---DSM_Performance_0200---time:-' + (end1 - start1) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0200 call mount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } else { - expect(null).assertFail(); - } - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0300 - * @tc.name DSM_Performance_0300 - * @tc.desc getDisks Performance test - */ - it('DSM_Performance_0300', 0, function () { - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.getDisks({ - success: function (data) { - console.log('DSM_Performance_0300 call getDisks success.' + JSON.stringify(data)); - var end = new Date().getTime(); - console.log('---DSM_Performance_0300---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0300 call getDisks fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0400 - * @tc.name DSM_Performance_0400 - * @tc.desc findVolumeById Performance test - */ - it('DSM_Performance_0400', 0, function () { - for (let i = 0; i < 1000; i++) { - let mId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_0400 call getVolumes success' + JSON.stringify(data)); - mId = data.volumeInfos[2].mId; - }, - fail: function (data, code) { - console.log('DSM_Performance_0400 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - var start = new Date().getTime(); - devicesmgr.findVolumeById({ - volId: mId, - success: function (data) { - console.log('DSM_Performance_0400 call findVolumeById success' + JSON.stringify(data)) - var end = new Date().getTime(); - console.log('---DSM_Performance_0400---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0400 call findVolumeById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0500 - * @tc.name DSM_Performance_0500 - * @tc.desc findVolumeByUuid Performance test - */ - it('DSM_Performance_0500', 0, function () { - let mFsUuid; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_0500 call getVolumes success' + JSON.stringify(data)); - mFsUuid = data.volumeInfos[2].mFsUuid; - }, - fail: function (data, code) { - console.log('DSM_Performance_0500 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.findVolumeByUuid({ - volumeUuid: mFsUuid, - success: function (vol) { - console.log('DSM_Performance_0500 call findVolumeByUuid success' + JSON.stringify(vol)); - var end = new Date().getTime(); - console.log('---DSM_Performance_0500---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0500 call findVolumeByUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0600 - * @tc.name DSM_Performance_0600 - * @tc.desc getWritableVolumes Performance test - */ - it('DSM_Performance_0600', 0, function () { - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.getWritableVolumes({ - success: function (data) { - console.log('DSM_Performance_0600 call getWritableVolumes success. data:' + JSON.stringify(data)); - var end = new Date().getTime(); - console.log('---DSM_Performance_0600---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0600 call getWritableVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0700 - * @tc.name DSM_Performance_0700 - * @tc.desc findDiskById Performance test - */ - it('DSM_Performance_0700', 0, function () { - let mDiskId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_0700 call getVolumes success' + JSON.stringify(data)); - mDiskId = data.volumeInfos[2].mDiskId; - }, - fail: function (data, code) { - console.log('DSM_Performance_0700 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.findDiskById({ - diskId: mDiskId, - success: function (disk) { - console.log('DSM_Performance_0700 call findDiskById success' + JSON.stringify(disk)) - var end = new Date().getTime(); - console.log('---DSM_Performance_0700---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0700 call findDiskById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0800 - * @tc.name DSM_Performance_0800 - * @tc.desc getPrimaryStorageUuid Performance test - */ - it('DSM_Performance_0800', 0, function () { - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.getPrimaryStorageUuid({ - success: function (primaryUuid) { - console.log('DSM_Performance_0800 call getPrimaryStorageUuid success.' + JSON.stringify(primaryUuid)); - var end = new Date().getTime(); - console.log('---DSM_Performance_0800---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0800 call getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_0900 - * @tc.name DSM_Performance_0900 - * @tc.desc findPrivateForEmulate Performance test - */ - it('DSM_Performance_0900', 0, function () { - let emuVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_0900 call getVolumes success' + JSON.stringify(data)); - emuVol = data.volumeInfos[0] - }, - fail: function (data, code) { - console.log('DSM_Performance_0900 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.findPrivateForEmulate({ - emuVol: emuVol, - success: function (priVol) { - console.log('DSM_Performance_0900 call findPrivateForEmulate success' + JSON.stringify(priVol)) - var end = new Date().getTime(); - console.log('---DSM_Performance_0900---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_0900 call findPrivateForEmulate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_1000 - * @tc.name DSM_Performance_1000 - * @tc.desc findPrivateForEmulate Performance test - */ - it('DSM_Performance_1000', 0, function () { - let emuVol ; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_1000 call getVolumes success' + JSON.stringify(data)); - emuVol = data.volumeInfos[1] - }, - fail: function (data, code) { - console.log('DSM_Performance_1000 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.findEmulateForPrivate({ - priVol: emuVol, - success: function (emuVol) { - console.log('DSM_Performance_1000 call findEmulateForPrivate success' + JSON.stringify(emuVol)) - var end = new Date().getTime(); - console.log('---DSM_Performance_1000---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_Performance_1000 call findEmulateForPrivate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Performance_1100 - * @tc.name DSM_Performance_1100 - * @tc.desc findPrivateForEmulate Performance test - */ - it('DSM_Performance_1100', 0, function () { - let emuVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Performance_1100 call getVolumes success' + JSON.stringify(data)); - emuVol = data.volumeInfos[2] - }, - fail: function (data, code) { - console.log('DSM_Performance_1100 call getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 1000; i++) { - var start = new Date().getTime(); - devicesmgr.getBestVolumeDescription({ - vol: emuVol, - success: function (desCription) { - console.log('DSM_JS_Function_1100 call getBestVolumeDescription success' + desCription) - var end = new Date().getTime(); - console.log('---DSM_Performance_1100---time:-' + (end - start) + '-----' + i); - }, - fail: function (data, code) { - console.log('DSM_JS_Function_1100 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - -}) diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js deleted file mode 100644 index aa6139bc7026e3b181f47bc6cee6ca2171a57342..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/test/DsmReliability.test.js +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (C) 2021 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 devicesmgr from '@system.devicesmgr'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' -describe('dsmReliabilityTest', function () { - - /** - * @tc.number SUB_STORAGE_DSM_Reliability_0000 - * @tc.name DSM_Reliability_0000 - * @tc.desc Reliability test - */ - it('DSM_Reliability_0000', 0, function () { - for (let i = 0; i < 100000; i++) { - let mId; - let mFsUuid; - let mDiskId; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Reliability_0000 getVolumes success' + JSON.stringify(data) + i); - mId = data.volumeInfos[2].mId; - mFsUuid = data.volumeInfos[2].mFsUuid; - mDiskId = data.volumeInfos[2].mDiskId; - }, - fail: function (data, code) { - console.log('DSM_Reliability_0000 getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - } - }); - devicesmgr.getDisks({ - success: function () { - console.log('DSM_Reliability_0300 getDisks success.' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0300 getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findVolumeById({ - volId: mId, - success: function () { - console.log('DSM_Reliability_0400 findVolumeById success' + i) - }, - fail: function (data, code) { - console.log('DSM_Reliability_0400 findVolumeById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - devicesmgr.findVolumeByUuid({ - volumeUuid: mFsUuid, - success: function () { - console.log('DSM_Reliability_0500 findVolumeByUuid success' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0500 findVolumeByUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - devicesmgr.getWritableVolumes({ - success: function () { - console.log('DSM_Reliability_0600 getWritableVolumes success. data:' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0600 getWritableVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.findDiskById({ - diskId: mDiskId, - success: function () { - console.log('DSM_Reliability_0700 findDiskById success' + i) - }, - fail: function (data, code) { - console.log('DSM_Reliability_0700 findDiskById fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - devicesmgr.getPrimaryStorageUuid({ - success: function () { - console.log('DSM_Reliability_0800 getPrimaryStorageUuid success.' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0800 getPrimaryStorageUuid fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - devicesmgr.unMount({ - volId: mId, - success: function () { - console.log('DSM_Reliability_0100 unMount success.' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0100 unMount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - } - }) - devicesmgr.mount({ - volId: mId, - success: function () { - console.log('DSM_Reliability_0200 mount success.' + i); - }, - fail: function (data, code) { - console.log('DSM_Reliability_0200 mount fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Reliability_0900 - * @tc.name DSM_Reliability_0900 - * @tc.desc Reliability test - */ - it('DSM_Reliability_0900', 0, function () { - let emuVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Reliability_0900 getVolumes success'); - emuVol = data.volumeInfos[0] - }, - fail: function (data, code) { - console.log('DSM_Reliability_0900 getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 100000; i++) { - devicesmgr.findPrivateForEmulate({ - emuVol: emuVol, - success: function () { - console.log('DSM_Reliability_0900 findPrivateForEmulate success' + i) - }, - fail: function (data, code) { - console.log('DSM_Reliability_0900 findPrivateForEmulate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Reliability_1000 - * @tc.name DSM_Reliability_1000 - * @tc.desc Reliability test - */ - it('DSM_Reliability_1000', 0, function () { - let emuVol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Reliability_1000 getVolumes success'); - emuVol = data.volumeInfos[1] - }, - fail: function (data, code) { - console.log('DSM_Reliability_1000 getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 100000; i++) { - devicesmgr.findEmulateForPrivate({ - emuVol: emuVol, - success: function () { - console.log('DSM_Reliability_1000 findPrivateForEmulate success' + i) - }, - fail: function (data, code) { - console.log('DSM_Reliability_1000 findPrivateForEmulate fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - - /** - * @tc.number SUB_STORAGE_DSM_Reliability_1100 - * @tc.name DSM_Reliability_1100 - * @tc.desc Reliability test - */ - it('DSM_Reliability_1100', 0, function () { - let vol; - devicesmgr.getVolumes({ - success: function (data) { - console.log('DSM_Reliability_1100 getVolumes success'); - vol = data.volumeInfos[0] - }, - fail: function (data, code) { - console.log('DSM_Reliability_1100 getVolumes fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 100000; i++) { - devicesmgr.getBestVolumeDescription({ - vol: vol, - success: function (desCription) { - console.log('DSM_Reliability_1100 call getBestVolumeDescription success' + desCription) - }, - fail: function (data, code) { - console.log('DSM_Reliability_1100 call getBestVolumeDescription fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - } - }) - -}) diff --git a/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js b/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index 79bcbec42023c802a5aeca4fc7239ca881f94b48..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./DsmPerformance.test.js') -require('./DsmReliability.test.js') diff --git a/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json b/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 4b5a8bbc02d07ca41a3c0f63834395a33e02152a..0000000000000000000000000000000000000000 --- a/storage/storagedsmstabilityjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefilestabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png b/storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagedsmstabilityjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefileconcurrentjstest/BUILD.gn b/storage/storagefileconcurrentjstest/BUILD.gn deleted file mode 100644 index b842aaa27358b5b48a79545f55192c6661ee1850..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefileconcurrent_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefileconcurrent_js_assets", - ":storagefileconcurrent_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFileConcurrentJsTest" -} -ohos_js_assets("storagefileconcurrent_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefileconcurrent_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefileconcurrentjstest/Test.json b/storage/storagefileconcurrentjstest/Test.json deleted file mode 100644 index ff40067a68481db0a046ce50def98e779b456171..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFileConcurrentJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefileconcurrentjstest/signature/openharmony_sx.p7b b/storage/storagefileconcurrentjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefileconcurrentjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/app.js b/storage/storagefileconcurrentjstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/i18n/en-US.json b/storage/storagefileconcurrentjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefileconcurrentjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.css b/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.hml b/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/test/Common.js b/storage/storagefileconcurrentjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c5bc08482173733896e49c8fab5239bef520ee7c..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' - -export const FILE_CONTENT = 'hello world' - -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() !== null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/test/FileConcurrent.test.js b/storage/storagefileconcurrentjstest/src/main/js/default/test/FileConcurrent.test.js deleted file mode 100644 index 4a9489e9d5d0e4b82bd496fa5501370a4d1c0e67..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/test/FileConcurrent.test.js +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import file from '@system.file'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} - from 'deccjsunit/index' - -describe('fileconcurrent', function () { - - /** - * @tc.number SUB_STORAGE_file_test_0000 - * @tc.name file_test_0000 Function of API, out of package, Virtual path(create and give 777 authority). - * @tc.desc Function of API, Simultaneous write. - */ - it('file_test_000', 0, async function (done) { - for (let i = 0; i < 10; i++) { - file.writeText({ - uri: 'internal://app/file_test_000', - text: 'Text', - success: function () { - console.log('file_test_000 => pass, call writeText success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_000 => call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.writeText({ - uri: 'internal://app/file_test_000', - text: 'Text1', - success: function () { - console.log('file_test_000 => pass, call writeText success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_000 => call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.writeText({ - uri: 'internal://app/file_test_000', - text: 'Text2', - success: function () { - console.log('file_test_000 => pass, call writeText success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_000 => call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_readText_0100 - * @tc.name file_test_001 - * @tc.desc Function of API Simultaneous reading. - */ - it('file_test_001', 0, async function (done) { - file.writeText({ - uri: 'internal://app/file_test_001', - text: 'Text', - success: function () { - console.log('file_test_001 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_001 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 10; i++) { - file.readText({ - uri: 'internal://app/file_test_001', - success: function () { - console.log('file_test_001 => pass, call readText success. data.text: ' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_001 => call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readText({ - uri: 'internal://app/file_test_001', - success: function () { - console.log('file_test_001 => pass, call readText success. data.text: ' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_001 => call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readText({ - uri: 'internal://app/file_test_001', - success: function () { - console.log('file_test_001 => pass, call readText success. data.text: ' ); - done(); - }, - fail: function (code, data) { - console.log('file_test_001 => call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0200 - * @tc.name file_test_002 - * @tc.desc Function of API Simultaneous copying. - */ - it('file_test_002', 0, async function (done) { - file.writeText({ - uri: 'internal://app/file_test_002', - text: 'Text', - append: true, - success: function () { - console.log('file_test_002 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_002 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 10; i++) { - file.copy({ - srcUri: 'internal://app/file_test_002', - dstUri: 'internal://app/file_test_002', - success: function () { - console.log('file_test_002 => pass,call copy success. uri:' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_002 => call copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.copy({ - srcUri: 'internal://app/file_test_002', - dstUri: 'internal://app/file_test_002' + '100', - success: function () { - console.log('file_test_002 => pass,call copy success. uri:' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_002 => call copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.copy({ - srcUri: 'internal://app/file_test_002', - dstUri: 'internal://app/file_test_002' + '200', - success: function () { - console.log('file_test_002 => pass,call copy success. uri:' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_002 => call copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0300 - * @tc.name file_test_003 - * @tc.desc Function of API, Move files while writing to them continuously - */ - it('file_test_003', 0, async function (done) { - for (let i = 0; i < 10; i++) { - file.writeText({ - uri: 'internal://app/file_test_003', - text: 'Text', - append: true, - success: function () { - console.log('file_test_003 => pass,call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_003 => call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.move({ - srcUri: 'internal://app/file_test_003', - dstUri: 'internal://file_test_003', - success: function () { - console.log('file_test_003 => pass,call move success. uri:' ); - done(); - }, - fail: function (data, code) { - console.log('file_test_003 =>call move fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0400 - * @tc.name file_test_004 - * @tc.desc Function of API,Continuous reading - */ - it('file_test_004', 0, async function (done) { - let buf = new Uint8Array([48, 49, 50, 51, 65, 66, 67, 68, 32, 33]); - file.writeArrayBuffer({ - uri: 'internal://app/file_test_004', - buffer: buf, - success: function () { - console.log('file_test_004 call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.error('file_test_004 call writeArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - for (let i = 0; i < 10; i++) { - file.readArrayBuffer({ - uri: 'internal://app/file_test_004', - success: function () { - console.log('file_test_004 => pass,call readArrayBuffer success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_004 => call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readArrayBuffer({ - uri: 'internal://app/file_test_004', - success: function () { - console.log('file_test_004 => pass,call readArrayBuffer success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_004 => call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readArrayBuffer({ - uri: 'internal://app/file_test_004', - success: function () { - console.log('file_test_004 => pass,call readArrayBuffer success. '); - done(); - }, - fail: function (data, code) { - console.log('file_test_004 => call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0500 - * @tc.name file_test_005 - * @tc.desc Function of API,Continuous writeing - */ - it('file_test_005', 0, async function (done) { - let buf = new Uint8Array([48, 49, 50, 51, 65, 66, 67, 68, 32, 33]); - for (let i = 0; i < 10; i++) { - file.writeArrayBuffer({ - uri: 'internal://app/file_test_005', - buffer: buf, - success: function () { - console.log('file_test_005 => pass,call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_005 => call writeArrayBuffer fail, code: ' + code); - expect(null).assertFail(); - }, - }); - file.writeArrayBuffer({ - uri: 'internal://app/file_test_005', - buffer: buf, - success: function () { - console.log('file_test_005 => pass,call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_005 => call writeArrayBuffer fail, code: ' + code); - expect(null).assertFail(); - }, - }); - file.writeArrayBuffer({ - uri: 'internal://app/file_test_005', - buffer: buf, - success: function () { - console.log('file_test_005 => pass,call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_005 => call writeArrayBuffer fail, code: ' + code); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0600 - * @tc.name file_test_006 - * @tc.desc Function of API,Write and read simultaneously for one file - */ - it('file_test_006', 0, async function (done) { - for (let i = 0; i < 10; i++) { - file.writeText({ - uri: 'internal://app/file_test_006', - text: 'Text', - success: function () { - console.log('file_test_006 => pass,call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_006 => call fail callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readText({ - uri: 'internal://app/file_test_006', - success: function () { - console.log('file_test_006 => pass,call readText success: '); - done(); - }, - fail: function (data, code) { - console.log('file_test_006 => call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0700 - * @tc.name file_test_007 - * @tc.desc Function of API,Write and read simultaneously for one file - */ - it('file_test_007', 0, async function (done) { - let buf = new Uint8Array([48, 49, 50, 51, 65, 66, 67, 68, 32, 33]); - for (let i = 0; i < 10; i++) { - file.writeArrayBuffer({ - uri: 'internal://app/file_test_007', - buffer: buf, - success: function () { - console.log('file_test_007 => pass,call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_007 => call writeArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.readArrayBuffer({ - uri: 'internal://app/file_test_007', - success: function () { - console.log('file_test_007 => pass,call readArrayBuffer success: '); - done(); - }, - fail: function (data, code) { - console.log('file_test_007 => call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_file_test_0800 - * @tc.name file_test_008 - * @tc.desc Function of API, Copy files while writing - */ - it('file_test_008', 0, async function (done) { - for (let i = 0; i < 10; i++) { - file.writeText({ - uri: 'internal://app/file_test_008', - text: 'Text', - success: function () { - console.log('file_test_008 => pass, call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log('file_test_008 => call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.copy({ - srcUri: 'internal://app/file_test_008', - dstUri: 'internal://app/file_test_008', - success: function () { - console.log('file_test_008 => pass,call copy success. uri:'); - done(); - }, - fail: function (data, code) { - console.log('file_test_008 => call copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); -}); diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/test/List.test.js b/storage/storagefileconcurrentjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index af95f8754b2cfa5d79a316eca6655a1d9837a9a7..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -// require('./FileConcurrent.test.js') diff --git a/storage/storagefileconcurrentjstest/src/main/resources/base/element/string.json b/storage/storagefileconcurrentjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 7c3790708107c4cc355743fb4dde94f5922c09f0..0000000000000000000000000000000000000000 --- a/storage/storagefileconcurrentjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefileconcurrentjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefileconcurrentjstest/src/main/resources/base/media/icon.png b/storage/storagefileconcurrentjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefileconcurrentjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefileiojstest/src/main/js/default/test/Common.js b/storage/storagefileiojstest/src/main/js/default/test/Common.js index d1b7f8f6b03a242b187ee3aab819182da08e6ac9..dbb562950172dd1d1b0d9b6c2e4375b7e8feb171 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/Common.js +++ b/storage/storagefileiojstest/src/main/js/default/test/Common.js @@ -14,6 +14,7 @@ */ import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility'; export const FILE_CONTENT = 'hello world'; @@ -73,27 +74,23 @@ export function fileToWriteOnly(fpath) { return false } } -export function nextFileName(testName) { +export function nextFileName1(testName) { const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/cache/' - return BASE_PATH + testName + return BASE_PATH + testName + '_' + randomString(testName.length); } -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/' - return BASE_PATH + testName +export async function nextFileName(testName) { + let context = featureAbility.getContext(); + let data = await context.getFilesDir(); + let BASE_PATH = data.substring(0, data.length - 5) + 'cache/'; + return BASE_PATH + testName + '_' + randomString(testName.length); } -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.storage.fileio/files/cache/' - return BASE_PATH + testName +export async function fileName(testName) { + let context = featureAbility.getContext(); + let data = await context.getFilesDir(); + let BASE_PATH = data + '/'; + return BASE_PATH + testName + '_' + randomString(testName.length); } -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} export function randomString(num) { let len= num; var $chars = 'aaaabbbbcccc'; 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 73b766d2440d5f8a191879282e3450200a668f67..48018ad95cb1bcf827440326b4be7ac27d8f18e0 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIO.test.js @@ -14,7 +14,6 @@ */ import fileio from '@ohos.fileio'; -import file from '@system.file'; import { describe, beforeAll, @@ -31,8 +30,7 @@ import { nextFileName, prepareEmptyFile, randomString, - fileName, - sleep + fileName } from './Common' describe('fileIOTest', function () { @@ -41,8 +39,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_close_sync_000 * @tc.desc Function of API, openSync. The test file is exist. */ - it('fileio_test_open_close_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_open_close_sync_000'); + it('fileio_test_open_close_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_open_close_sync_000'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(fd !== null).assertTrue(); @@ -60,8 +58,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_000 * @tc.desc Function of API, openSync(mode not for value). The test file is exist. */ - it('fileio_test_open_000', 0, function () { - let fpath = nextFileName('fileio_test_open_000'); + it('fileio_test_open_000', 0, async function () { + let fpath = await nextFileName('fileio_test_open_000'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o202); @@ -80,8 +78,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_001 * @tc.desc Function of API, flags=0o100. mode=0o001 */ - it('fileio_test_open_001', 0, function () { - let fpath = nextFileName('fileio_test_open_001'); + it('fileio_test_open_001', 0, async function () { + let fpath = await nextFileName('fileio_test_open_001'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o100, 0o01); @@ -100,8 +98,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_002 * @tc.desc Function of API, */ - it('fileio_test_open_002', 0, function () { - let fpath = nextFileName('fileio_test_open_002'); + it('fileio_test_open_002', 0, async function () { + let fpath = await nextFileName('fileio_test_open_002'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath); @@ -120,8 +118,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_003 * @tc.desc Function of API, flags=0o100. mode=0o004 */ - it('fileio_test_open_003', 0, function () { - let fpath = nextFileName('fileio_test_open_003'); + it('fileio_test_open_003', 0, async function () { + let fpath = await nextFileName('fileio_test_open_003'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o100, 0o004); @@ -144,8 +142,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_004 * @tc.desc Function of API, flags=0o101. mode=0o002 */ - it('fileio_test_open_004', 0, function () { - let fpath = nextFileName('fileio_test_open_004'); + it('fileio_test_open_004', 0, async function () { + let fpath = await nextFileName('fileio_test_open_004'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o101, 0o002); @@ -166,8 +164,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_005 * @tc.desc Function of API, flags=0o102. mode=0o001. */ - it('fileio_test_open_005', 0, function () { - let fpath = nextFileName('fileio_test_open_005'); + it('fileio_test_open_005', 0, async function () { + let fpath = await nextFileName('fileio_test_open_005'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o102, 0o001); @@ -196,8 +194,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_006 * @tc.desc Function of API, flags=0o200. mode=0o700 */ - it('fileio_test_open_006', 0, function () { - let fpath = nextFileName('fileio_test_open_006'); + it('fileio_test_open_006', 0, async function () { + let fpath = await nextFileName('fileio_test_open_006'); prepareFile(fpath, FILE_CONTENT); try { fileio.openSync(fpath, 0o200, 0o700); @@ -213,8 +211,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_007 * @tc.desc Function of API, flags=0o302. mode=0o700. */ - it('fileio_test_open_007', 0, function () { - let fpath = nextFileName('fileio_test_open_007'); + it('fileio_test_open_007', 0, async function () { + let fpath = await nextFileName('fileio_test_open_007'); try { let fd = fileio.openSync(fpath, 0o302, 0o700); expect(fd !== null).assertTrue(); @@ -242,8 +240,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_008 * @tc.desc Function of API, flags=0o102. mode=0o700 */ - it('fileio_test_open_008', 0, function () { - let fpath = nextFileName('fileio_test_open_008'); + it('fileio_test_open_008', 0, async function () { + let fpath = await nextFileName('fileio_test_open_008'); try { let fd = fileio.openSync(fpath, 0o102, 0o700); expect(fd !== null).assertTrue(); @@ -271,8 +269,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_009 * @tc.desc Function of API, flags=0o302. */ - it('fileio_test_open_009', 0, function () { - let fpath = nextFileName('fileio_test_open_009'); + it('fileio_test_open_009', 0, async function () { + let fpath = await nextFileName('fileio_test_open_009'); try { fileio.openSync(fpath, 0o302); expect(null).assertFail(); @@ -287,8 +285,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_010 * @tc.desc Function of API, flags=0o402. */ - it('fileio_test_open_010', 0, function () { - let fpath = nextFileName('fileio_test_open_010'); + it('fileio_test_open_010', 0, async function () { + let fpath = await nextFileName('fileio_test_open_010'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o402); @@ -317,8 +315,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_011 * @tc.desc Function of API, flags=0o1000. */ - it('fileio_test_open_011', 0, function () { - let fpath = nextFileName('fileio_test_open_011'); + it('fileio_test_open_011', 0, async function () { + let fpath = await nextFileName('fileio_test_open_011'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o1000); @@ -341,8 +339,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_012 * @tc.desc Function of API, flags=0o1001. */ - it('fileio_test_open_012', 0, function () { - let fpath = nextFileName('fileio_test_open_012'); + it('fileio_test_open_012', 0, async function () { + let fpath = await nextFileName('fileio_test_open_012'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o1001); @@ -363,8 +361,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_013 * @tc.desc Function of API, flags=0o2002. */ - it('fileio_test_open_013', 0, function () { - let fpath = nextFileName('fileio_test_open_013'); + it('fileio_test_open_013', 0, async function () { + let fpath = await nextFileName('fileio_test_open_013'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o2002); @@ -394,7 +392,7 @@ describe('fileIOTest', function () { * @tc.desc Function of API, flags=0o4002. */ it('fileio_test_open_014', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_014'); + let fpath = await nextFileName('fileio_test_open_014'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o4002); @@ -417,8 +415,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_015 * @tc.desc Function of API, flags=0o20002. */ - it('fileio_test_open_015', 0, function () { - let fpath = nextFileName('fileio_test_open_015'); + it('fileio_test_open_015', 0, async function () { + let fpath = await nextFileName('fileio_test_open_015'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o20002); @@ -437,8 +435,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_016 * @tc.desc Function of API, flags=0o10002. */ - it('fileio_test_open_016', 0, function () { - let fpath = nextFileName('fileio_test_open_016'); + it('fileio_test_open_016', 0, async function () { + let fpath = await nextFileName('fileio_test_open_016'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o10002); @@ -457,8 +455,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_017 * @tc.desc Function of API, flags=0o4010002. */ - it('fileio_test_open_017', 0, function () { - let fpath = nextFileName('fileio_test_open_017'); + it('fileio_test_open_017', 0, async function () { + let fpath = await nextFileName('fileio_test_open_017'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o4010002); @@ -477,8 +475,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_018 * @tc.desc Function of API, flags=0o100002. */ - it('fileio_test_open_018', 0, function () { - let fpath = nextFileName('fileio_test_open_018'); + it('fileio_test_open_018', 0, async function () { + let fpath = await nextFileName('fileio_test_open_018'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o100002); @@ -497,8 +495,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_019 * @tc.desc Function of API, flags=0o40002. mode=0o700 */ - it('fileio_test_open_019', 0, function () { - let fpath = nextFileName('fileio_test_open_019'); + it('fileio_test_open_019', 0, async function () { + let fpath = await nextFileName('fileio_test_open_019'); prepareFile(fpath, FILE_CONTENT); try { fileio.openSync(fpath, 0o40002, 0o700); @@ -515,8 +513,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_021 * @tc.desc Function of API, flags=0o2000002. */ - it('fileio_test_open_021', 0, function () { - let fpath = nextFileName('fileio_test_open_021'); + it('fileio_test_open_021', 0, async function () { + let fpath = await nextFileName('fileio_test_open_021'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o2000002); @@ -535,8 +533,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_022 * @tc.desc Function of API, flags=0o200002. */ - it('fileio_test_open_022', 0, function () { - let fpath = nextFileName('fileio_test_open_022'); + it('fileio_test_open_022', 0, async function () { + let fpath = await nextFileName('fileio_test_open_022'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o200002); @@ -555,8 +553,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_023 * @tc.desc Function of API, flags=0o400002. */ - it('fileio_test_open_023', 0, function () { - let fpath = nextFileName('fileio_test_open_023'); + it('fileio_test_open_023', 0, async function () { + let fpath = await nextFileName('fileio_test_open_023'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o400002); @@ -575,8 +573,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_024 * @tc.desc Function of API, flags=0o1000002.mode=0o700 */ - it('fileio_test_open_024', 0, function () { - let fpath = nextFileName('fileio_test_open_024'); + it('fileio_test_open_024', 0, async function () { + let fpath = await nextFileName('fileio_test_open_024'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o1000002, 0o700); @@ -595,8 +593,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_025 * @tc.desc Function of API, flags=0o10000002. */ - it('fileio_test_open_025', 0, function () { - let fpath = nextFileName('fileio_test_open_025'); + it('fileio_test_open_025', 0, async function () { + let fpath = await nextFileName('fileio_test_open_025'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o10000002); @@ -615,8 +613,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_026 * @tc.desc Function of API,flags=0o002.mode=0o700 */ - it('fileio_test_open_026', 0, function () { - let fpath = nextFileName('fileio_test_open_026'); + it('fileio_test_open_026', 0, async function () { + let fpath = await nextFileName('fileio_test_open_026'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o700); @@ -635,8 +633,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_027 * @tc.desc Function of API, flags=0o002.mode=0o400 */ - it('fileio_test_open_027', 0, function () { - let fpath = nextFileName('fileio_test_open_027'); + it('fileio_test_open_027', 0, async function () { + let fpath = await nextFileName('fileio_test_open_027'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o400); @@ -662,8 +660,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_028 * @tc.desc Function of API, flags=0o002.mode=0o200 */ - it('fileio_test_open_028', 0, function () { - let fpath = nextFileName('fileio_test_open_028'); + it('fileio_test_open_028', 0, async function () { + let fpath = await nextFileName('fileio_test_open_028'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o200); @@ -689,8 +687,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_029 * @tc.desc Function of API, flags=0o002.mode=0o100 */ - it('fileio_test_open_029', 0, function () { - let fpath = nextFileName('fileio_test_open_029'); + it('fileio_test_open_029', 0, async function () { + let fpath = await nextFileName('fileio_test_open_029'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o100); @@ -709,8 +707,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_030 * @tc.desc Function of API, flags=0o002.mode=0o070 */ - it('fileio_test_open_030', 0, function () { - let fpath = nextFileName('fileio_test_open_030'); + it('fileio_test_open_030', 0, async function () { + let fpath = await nextFileName('fileio_test_open_030'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o070); @@ -739,8 +737,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_031 * @tc.desc Function of API, flags=0o002.mode=0o040 */ - it('fileio_test_open_031', 0, function () { - let fpath = nextFileName('fileio_test_open_031'); + it('fileio_test_open_031', 0, async function () { + let fpath = await nextFileName('fileio_test_open_031'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o040); @@ -766,8 +764,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_032 * @tc.desc Function of API, flags=0o002.mode=0o020 */ - it('fileio_test_open_032', 0, function () { - let fpath = nextFileName('fileio_test_open_032'); + it('fileio_test_open_032', 0, async function () { + let fpath = await nextFileName('fileio_test_open_032'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o020); @@ -793,8 +791,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_033 * @tc.desc Function of API, flags=0o002.mode=0o010 */ - it('fileio_test_open_033', 0, function () { - let fpath = nextFileName('fileio_test_open_033'); + it('fileio_test_open_033', 0, async function () { + let fpath = await nextFileName('fileio_test_open_033'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o010); @@ -813,8 +811,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_034 * @tc.desc Function of API, flags=0o002.mode=0o007 */ - it('fileio_test_open_034', 0, function () { - let fpath = nextFileName('fileio_test_open_034'); + it('fileio_test_open_034', 0, async function () { + let fpath = await nextFileName('fileio_test_open_034'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o007); @@ -843,8 +841,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_035 * @tc.desc Function of API, flags=0o002.mode=0o004 */ - it('fileio_test_open_035', 0, function () { - let fpath = nextFileName('fileio_test_open_035'); + it('fileio_test_open_035', 0, async function () { + let fpath = await nextFileName('fileio_test_open_035'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o004); @@ -870,8 +868,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_036 * @tc.desc Function of API, flags=0o002.mode=0o002 */ - it('fileio_test_open_036', 0, function () { - let fpath = nextFileName('fileio_test_open_036'); + it('fileio_test_open_036', 0, async function () { + let fpath = await nextFileName('fileio_test_open_036'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o002); @@ -897,8 +895,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_037 * @tc.desc Function of API, flags=0o002.mode=0o001 */ - it('fileio_test_open_037', 0, function () { - let fpath = nextFileName('fileio_test_open_037'); + it('fileio_test_open_037', 0, async function () { + let fpath = await nextFileName('fileio_test_open_037'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o002, 0o001); @@ -916,9 +914,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_038 * @tc.desc Function of API, flags=0o102.mode=0o700 */ - it('fileio_test_open_038', 0, function () { + it('fileio_test_open_038', 0, async function () { let txt = randomString(4100); - let fpath = nextFileName(txt); + let fpath = await nextFileName(txt); try { let fd = fileio.openSync(fpath, 0o102, 0o700); expect(null).assertFail(); @@ -933,8 +931,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_001 * @tc.desc Function of API, openSync(flags=0o200). The test file is exist. */ - it('fileio_test_open_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_open_sync_001'); + it('fileio_test_open_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_open_sync_001'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o200); @@ -953,8 +951,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_002 * @tc.desc Function of API, openSync(flags=0o201). The test file is exist. */ - it('fileio_test_open_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_open_sync_002'); + it('fileio_test_open_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_open_sync_002'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o201); @@ -973,8 +971,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_003 * @tc.desc Function of API, openSync(flags=0o202). The test file is exist. */ - it('fileio_test_open_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_open_sync_003'); + it('fileio_test_open_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_open_sync_003'); prepareFile(fpath, FILE_CONTENT); try { let fd = fileio.openSync(fpath, 0o202); @@ -993,8 +991,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_004 * @tc.desc Function of API, openSync(flags=0o102, mode=0o777). The test file is not exist. */ - it('fileio_test_open_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_open_sync_004'); + it('fileio_test_open_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_open_sync_004'); try { let fd = fileio.openSync(fpath, 0o102, 0o777); expect(fd !== null).assertTrue(); @@ -1012,8 +1010,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_005 * @tc.desc Function of API, openSync(flags not for value, mode not for value). */ - it('fileio_test_open_sync_005', 0, function () { - let dpath = nextFileName('fileio_test_open_sync_005') + 'd' + it('fileio_test_open_sync_005', 0, async function () { + let dpath = await nextFileName('fileio_test_open_sync_005') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let fd = fileio.openSync(dpath); @@ -1032,8 +1030,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_006 * @tc.desc Function of API, openSync(flags=0o1, illegal parameter). */ - it('fileio_test_open_sync_006', 0, function () { - let dpath = nextFileName('fileio_test_open_sync_006') + 'd' + it('fileio_test_open_sync_006', 0, async function () { + let dpath = await nextFileName('fileio_test_open_sync_006') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); fileio.openSync(dpath, 0o1); @@ -1050,8 +1048,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_007 * @tc.desc Function of API, openSync(fpath too long). */ - it('fileio_test_open_sync_007', 0, function () { - let dpath = nextFileName('fileio_open1'); + it('fileio_test_open_sync_007', 0, async function () { + let dpath = await nextFileName('fileio_open1'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 16; i++) { @@ -1074,8 +1072,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_008 * @tc.desc Function of API, openSync(filename too long). */ - it('fileio_test_open_sync_008', 0, function () { - let fpath = nextFileName(randomString(256)); + it('fileio_test_open_sync_008', 0, async function () { + let fpath = await nextFileName(randomString(256)); try { fileio.openSync(fpath, 0o102, 0o777); expect(null).assertFail(); @@ -1090,8 +1088,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_009 * @tc.desc Function of API, openSync(dir layers too long). */ - it('fileio_test_open_sync_009', 0, function () { - let dpath = nextFileName('prop1'); + it('fileio_test_open_sync_009', 0, async function () { + let dpath = await nextFileName('prop1'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 113; i++) { @@ -1114,8 +1112,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_open_sync_010 * @tc.desc Function of API, openSync(filename has special characters). */ - it('fileio_test_open_sync_010', 0, function () { - let fpath = nextFileName('?*:<>/|'); + it('fileio_test_open_sync_010', 0, async function () { + let fpath = await nextFileName('?*:<>/|'); try { fileio.openSync(fpath, 0o102, 0o777); expect(null).assertFail(); @@ -1129,8 +1127,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_close_sync_000 * @tc.desc Function of API, close. The test file is not exist. */ - it('fileio_test_close_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_000'); + it('fileio_test_close_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_000'); try { fileio.closeSync(fpath); expect(null).assertFail(); @@ -1146,7 +1144,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_close_sync_001 * @tc.desc Function of API, close(fpath=vaild value). The test file is not exist. */ - it('fileio_test_close_sync_001', 0, function () { + it('fileio_test_close_sync_001', 0, async function () { try { fileio.closeSync(-1); expect(null).assertFail(); @@ -1161,8 +1159,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_000 * @tc.desc Function of API,access. The test file is exist. */ - it('fileio_test_access_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_000'); + it('fileio_test_access_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.accessSync(fpath) !== null).assertTrue(); @@ -1179,7 +1177,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_001 * @tc.desc Function of API, launch via fileio. The test file is not exist. */ - it('fileio_test_access_sync_001', 0, function () { + it('fileio_test_access_sync_001', 0, async function () { try { fileio.accessSync(1); expect(null).assertFail(); @@ -1194,8 +1192,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_002 * @tc.desc Function of API, access. The test file is not exist. */ - it('fileio_test_access_sync_002', 0, function () { - let fpath = nextFileName('fileIOTest'); + it('fileio_test_access_sync_002', 0, async function () { + let fpath = await nextFileName('fileIOTest'); try { fileio.accessSync(fpath); expect(null).assertFail(); @@ -1210,8 +1208,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_003 * @tc.desc Function of API, access(mode=1). The test file is exist and have the authority. */ - it('fileio_test_access_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_004'); + it('fileio_test_access_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_004'); expect(prepareEmptyFile(fpath)).assertTrue(); try { let fd = fileio.accessSync(fpath); @@ -1230,8 +1228,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_004 * @tc.desc Function of API, access(mode=2). The test file is exist and have the authority. */ - it('fileio_test_access_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_004'); + it('fileio_test_access_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.accessSync(fpath); @@ -1250,8 +1248,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_005 * @tc.desc Function of API, access(fpath=dir address). The test dir is exist. */ - it('fileio_test_access_sync_005', 0, function () { - let dpath = nextFileName('fileio_test_access_sync_005') + 'd' + it('fileio_test_access_sync_005', 0, async function () { + let dpath = await nextFileName('fileio_test_access_sync_005') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let fd = fileio.accessSync(dpath); @@ -1269,8 +1267,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_006 * @tc.desc Function of API, access(fpath=dir address). The test dir is not exist. */ - it('fileio_test_access_sync_006', 0, function () { - let dpath = nextFileName('fileio_test_access_sync_006') + 'd' + it('fileio_test_access_sync_006', 0, async function () { + let dpath = await nextFileName('fileio_test_access_sync_006') + 'd' try { fileio.accessSync(dpath); expect(null).assertFail(); @@ -1285,8 +1283,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_access_sync_007 * @tc.desc Function of API, access(mode=4). */ - it('fileio_test_access_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_007'); + it('fileio_test_access_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.accessSync(fpath); @@ -1305,8 +1303,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_unlink_sync_000 * @tc.desc Function of API,unlinkSync. The test file is exist. */ - it('fileio_test_unlink_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_unlink_sync_000'); + it('fileio_test_unlink_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_unlink_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.unlinkSync(fpath) !== null); @@ -1322,7 +1320,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_unlink_sync_001 * @tc.desc Function of API, no parameter. */ - it('fileio_test_unlink_sync_001', 0, function () { + it('fileio_test_unlink_sync_001', 0, async function () { try { fileio.unlinkSync(1); expect(null).assertFail(); @@ -1337,8 +1335,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_unlink_sync_002 * @tc.desc Function of API, invaild parameter */ - it('fileio_test_unlink_sync_002', 0, function () { - let fpath = nextFileName('fileIOTest'); + it('fileio_test_unlink_sync_002', 0, async function () { + let fpath = await nextFileName('fileIOTest'); try { fileio.unlinkSync(fpath); expect(null).assertFail(); @@ -1353,8 +1351,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_000 * @tc.desc Function of API, writeSync. */ - it('fileio_test_write_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_000'); + it('fileio_test_write_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_000'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let res = fileio.writeSync(fd, FILE_CONTENT); @@ -1373,8 +1371,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_001 * @tc.desc Function of API, encoding=UTF-8. */ - it('fileio_test_write_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_001'); + it('fileio_test_write_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_001'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let res = fileio.writeSync(fd, FILE_CONTENT, { @@ -1395,8 +1393,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_002 * @tc.desc Function of API, offset=1. */ - it('fileio_test_write_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_002'); + it('fileio_test_write_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_002'); let text = '0123456789abcdefg'; try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -1417,8 +1415,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_003 * @tc.desc Function of API, length = - 1. */ - it('fileio_test_write_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_003'); + it('fileio_test_write_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_003'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); expect(fileio.writeSync(fd, FILE_CONTENT, { @@ -1438,8 +1436,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_004 * @tc.desc Function of API, length = 1, offset = 1. */ - it('fileio_test_write_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_004'); + it('fileio_test_write_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_004'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let res = fileio.writeSync(fd, FILE_CONTENT, { @@ -1461,8 +1459,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_005 * @tc.desc Function of API, invaild offset. */ - it('fileio_test_write_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_005'); + it('fileio_test_write_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_005'); const invalidOffset = 999 let fd try { @@ -1484,8 +1482,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_006 * @tc.desc Function of API, invaild length. */ - it('fileio_test_write_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_006'); + it('fileio_test_write_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_006'); const invalidLength = 999 let fd try { @@ -1507,7 +1505,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_007 * @tc.desc Function of API, no parameter. */ - it('fileio_test_write_sync_007', 0, function () { + it('fileio_test_write_sync_007', 0, async function () { try { fileio.writeSync(1, 1); expect(null).assertFail(); @@ -1522,7 +1520,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_008 * @tc.desc Function of API, invaild parameter. */ - it('fileio_test_write_sync_008', 0, function () { + it('fileio_test_write_sync_008', 0, async function () { try { console.log(fileio.writeSync(-1, FILE_CONTENT)); expect(null).assertFail(); @@ -1537,8 +1535,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_009 * @tc.desc Function of API, Set all parameters. */ - it('fileio_test_write_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_009'); + it('fileio_test_write_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_009'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let res = fileio.writeSync(fd, FILE_CONTENT, { @@ -1562,8 +1560,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_write_sync_010 * @tc.desc Function of API, encoding=gb2312. */ - it('fileio_test_write_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_010'); + it('fileio_test_write_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_010'); let fd = fileio.openSync(fpath, 0o102, 0o666); try { fileio.writeSync(fd, FILE_CONTENT, { @@ -1578,49 +1576,15 @@ describe('fileIOTest', function () { } }); - /** - * @tc.number SUB_STORAGE_FileIO_ReadSync_0000 - * @tc.name fileio_test_read_sync_000 - * @tc.desc Function of API, readSync. - */ - it("fileio_test_read_sync_000", 0, async function (done) { - let fpath = nextFileName("fileio_test_read_sync_000"); - let text = "0123456789abcdefg"; - expect(prepareFile(fpath, text)).assertTrue(); - sleep(10); - try { - let fd = fileio.openSync(fpath, 0o2); - let len = fileio.readSync(fd, new ArrayBuffer(4096)); - expect(len == text.length).assertTrue(); - expect(fileio.closeSync(fd) !== null).assertTrue(); - file.readText({ - uri: "internal://cache/fileio_test_read_sync_000", - success: function (data) { - console.log("call readText success: " + data.text); - expect(text == data.text).assertTrue(); - expect(fileio.unlinkSync(fpath) !== null).assertTrue(); - done(); - }, - fail: function (data, code) { - console.error("call fail callback fail, code: " + code + ", data: " + data); - expect(null).assertFail(); - }, - }); - } catch (e) { - console.log("fileio_test_read_sync_000 has failed for " + e); - expect(null).assertFail(); - } - }); - /** * @tc.number SUB_STORAGE_FileIO_ReadSync_0100 * @tc.name fileio_test_read_sync_001 * @tc.desc Function of API, offset = 1. */ - it('fileio_test_read_sync_001', 0, function () { + it('fileio_test_read_sync_001', 0, async function () { let bufLen = 5 expect(FILE_CONTENT.length > bufLen).assertTrue(); - let fpath = nextFileName('fileio_test_read_sync_001'); + let fpath = await nextFileName('fileio_test_read_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1642,8 +1606,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_002 * @tc.desc Function of API, length = 1. */ - it('fileio_test_read_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_002'); + it('fileio_test_read_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1665,10 +1629,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_003 * @tc.desc Function of API, invaild offset */ - it('fileio_test_read_sync_003', 0, function () { + it('fileio_test_read_sync_003', 0, async function () { let fd const invalidOffset = 99999 - let fpath = nextFileName('fileio_test_read_sync_003'); + let fpath = await nextFileName('fileio_test_read_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fd = fileio.openSync(fpath, 0o2); @@ -1689,10 +1653,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_004 * @tc.desc Function of API, invaild length. */ - it('fileio_test_read_sync_004', 0, function () { + it('fileio_test_read_sync_004', 0, async function () { let fd const invalidLength = 9999 - let fpath = nextFileName('fileio_test_read_sync_004'); + let fpath = await nextFileName('fileio_test_read_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1714,7 +1678,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_005 * @tc.desc Function of API, fpatch = -1. */ - it('fileio_test_read_sync_005', 0, function () { + it('fileio_test_read_sync_005', 0, async function () { try { fileio.readSync(-1, new ArrayBuffer(4096)); expect(null).assertFail(); @@ -1729,8 +1693,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_006 * @tc.desc Function of API, offset & length & position = 1. */ - it('fileio_test_read_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_006'); + it('fileio_test_read_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1752,8 +1716,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_007 * @tc.desc Function of API, invaild position. */ - it('fileio_test_read_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_007'); + it('fileio_test_read_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1775,8 +1739,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_008 * @tc.desc Function of API, Enter all parameters correctly. */ - it('fileio_test_read_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_008'); + it('fileio_test_read_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_008'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1800,8 +1764,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_009 * @tc.desc Function of API, Set offset and length. */ - it('fileio_test_read_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_009'); + it('fileio_test_read_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_009'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1824,8 +1788,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_read_sync_010 * @tc.desc Function of API, Set error parameters (options). */ - it('fileio_test_read_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_010'); + it('fileio_test_read_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_010'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd; try { @@ -1849,8 +1813,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_000 * @tc.desc Function of API, mode=0o660 */ - it('fileio_test_chmod_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_000'); + it('fileio_test_chmod_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o660) !== null).assertTrue(); @@ -1868,8 +1832,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_001 * @tc.desc Function of API, mode=0o460 */ - it('fileio_test_chmod_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_001'); + it('fileio_test_chmod_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o460) !== null).assertTrue(); @@ -1887,8 +1851,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_002 * @tc.desc Function of API, mode=0o260. The test file is exist. */ - it('fileio_test_chmod_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_002'); + it('fileio_test_chmod_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o260) !== null).assertTrue(); @@ -1906,8 +1870,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_003 * @tc.desc Function of API, chmodSync. The test file is not exist. */ - it('fileio_test_chmod_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_003'); + it('fileio_test_chmod_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_003'); try { fileio.chmodSync(fpath, 0o260); expect(null).assertFail(); @@ -1922,8 +1886,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_004 * @tc.desc Function of API, fpatch=dir address. The test dir is exist. */ - it('fileio_test_chmod_sync_004', 0, function () { - let dpath = nextFileName('fileio_test_chmod_sync_004'); + it('fileio_test_chmod_sync_004', 0, async function () { + let dpath = await nextFileName('fileio_test_chmod_sync_004'); try { expect(fileio.mkdirSync(dpath, 0o777) !== null).assertTrue(); expect(fileio.chmodSync(dpath, 0o660) !== null).assertTrue(); @@ -1941,7 +1905,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_005 * @tc.desc Function of API, fpatch=dir address. The test dir is not exist. */ - it('fileio_test_chmod_sync_005', 0, function () { + it('fileio_test_chmod_sync_005', 0, async function () { let dpath; try { fileio.chmodSync(dpath, 0o660); @@ -1957,8 +1921,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_006 * @tc.desc Function of API, mode=0o700. The test file is exist. */ - it('fileio_test_chmod_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_006'); + it('fileio_test_chmod_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o700) !== null).assertTrue(); @@ -1976,8 +1940,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_007 * @tc.desc Function of API, mode=0o400. The test file is exist. */ - it('fileio_test_chmod_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_007'); + it('fileio_test_chmod_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o400) !== null).assertTrue(); @@ -1995,8 +1959,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_008 * @tc.desc Function of API, mode=0o200. The test file is exist. */ - it('fileio_test_chmod_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_008'); + it('fileio_test_chmod_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_008'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o200) !== null).assertTrue(); @@ -2014,8 +1978,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_009 * @tc.desc Function of API, mode=0o100. The test file is exist. */ - it('fileio_test_chmod_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_009'); + it('fileio_test_chmod_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_009'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o100) !== null).assertTrue(); @@ -2033,8 +1997,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_010 * @tc.desc Function of API, mode=0o070. The test file is exist. */ - it('fileio_test_chmod_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_010'); + it('fileio_test_chmod_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_010'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o070) !== null).assertTrue(); @@ -2052,8 +2016,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_011 * @tc.desc Function of API, mode=0o040. The test file is exist. */ - it('fileio_test_chmod_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_011'); + it('fileio_test_chmod_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_011'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o040) !== null).assertTrue(); @@ -2071,8 +2035,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_012 * @tc.desc Function of API, mode=0o020. The test file is exist. */ - it('fileio_test_chmod_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_012'); + it('fileio_test_chmod_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_012'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o020) !== null).assertTrue(); @@ -2090,8 +2054,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_013 * @tc.desc Function of API, mode=0o010. The test file is exist. */ - it('fileio_test_chmod_sync_013', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_013'); + it('fileio_test_chmod_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_013'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o010) !== null).assertTrue(); @@ -2109,8 +2073,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_014 * @tc.desc Function of API, mode=0o007. The test file is exist. */ - it('fileio_test_chmod_sync_014', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_014'); + it('fileio_test_chmod_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_014'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o007) !== null).assertTrue(); @@ -2128,8 +2092,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_015 * @tc.desc Function of API, mode=0o700. The test file is exist. */ - it('fileio_test_chmod_sync_015', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_015'); + it('fileio_test_chmod_sync_015', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_015'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o004) !== null).assertTrue(); @@ -2147,8 +2111,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_016 * @tc.desc Function of API, mode=0o002. The test file is exist. */ - it('fileio_test_chmod_sync_016', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_016'); + it('fileio_test_chmod_sync_016', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_016'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o002) !== null).assertTrue(); @@ -2166,8 +2130,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chmod_sync_017 * @tc.desc Function of API, mode=0o001. The test file is exist. */ - it('fileio_test_chmod_sync_017', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_017'); + it('fileio_test_chmod_sync_017', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_017'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chmodSync(fpath, 0o001) !== null).assertTrue(); @@ -2185,8 +2149,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_000 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is vaild, same path, file not same. */ - it('fileio_test_copy_file_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_000'); + it('fileio_test_copy_file_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_000'); let fpathTarget = fpath + 'tgt' expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -2205,8 +2169,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_001 * @tc.desc Function of API, copy. fpatch is invaild, fpathTarget is vaild, same path, file not same. */ - it('fileio_test_copy_file_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_001') + 'd' + it('fileio_test_copy_file_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_001') + 'd' let fpathTarget = fpath + 'tgt' try { fileio.copyFileSync(fpath, fpathTarget); @@ -2222,8 +2186,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_002 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is invaild. */ - it('fileio_test_copy_file_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_002'); + it('fileio_test_copy_file_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_002'); try { fileio.copyFileSync(fpath, 0); expect(null).assertFail(); @@ -2238,8 +2202,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_003 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is vaild, path not same, file not same. */ - it('fileio_test_copy_file_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_003'); + it('fileio_test_copy_file_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_003'); let fpathTarget = fpath + 'f1' expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -2258,9 +2222,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_004 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is vaild, path not same, file not same. */ - it('fileio_test_copy_file_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_004'); - let fpathTarget = fileName('fileio_test_copy_file_sync_004'); + it('fileio_test_copy_file_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_004'); + let fpathTarget = await fileName('fileio_test_copy_file_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.copyFileSync(fpath, fpathTarget) !== null).assertTrue(); @@ -2278,8 +2242,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_005 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is vaild, path not same, file not same. */ - it('fileio_test_copy_file_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_005'); + it('fileio_test_copy_file_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_005'); let fpathTarget = fpath expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -2297,8 +2261,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_006 * @tc.desc Function of API, copy. fpathTarget is invaild. */ - it('fileio_test_copy_file_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_006'); + it('fileio_test_copy_file_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_006'); let fpathTarget = fpath + 'tgt' try { fileio.copyFileSync(fpath, fpathTarget); @@ -2314,7 +2278,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_007 * @tc.desc Function of API, copy. fpatch is invaild, fpathTarget is invaild. */ - it('fileio_test_copy_file_sync_007', 0, function () { + it('fileio_test_copy_file_sync_007', 0, async function () { try { fileio.copyFileSync(1, 1); expect(null).assertFail(); @@ -2329,10 +2293,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_008 * @tc.desc Function of API, parameter more than 4096. */ - it('fileio_test_copy_file_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_008'); + it('fileio_test_copy_file_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_008'); fileio.openSync(fpath, 0o102, 0o777); - let dpath = nextFileName('fileio_copy1'); + let dpath = await nextFileName('fileio_copy1'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 16; i++) { @@ -2355,10 +2319,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_009 * @tc.desc Function of API, filename is too long. */ - it('fileio_test_copy_file_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_009'); + it('fileio_test_copy_file_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_009'); fileio.openSync(fpath, 0o102, 0o777); - let fpathTarget = nextFileName(randomString(256)); + let fpathTarget = await nextFileName(randomString(256)); try { fileio.copyFileSync(fpath, fpathTarget); expect(null).assertFail(); @@ -2374,10 +2338,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_010 * @tc.desc Function of API, dir layers too long */ - it('fileio_test_copy_file_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_010'); + it('fileio_test_copy_file_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_010'); fileio.openSync(fpath, 0o102, 0o777); - let dpath = nextFileName('prop'); + let dpath = await nextFileName('prop'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 113; i++) { @@ -2401,10 +2365,10 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_011 * @tc.desc Function of API, special parameter. */ - it('fileio_test_copy_file_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_011'); + it('fileio_test_copy_file_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_011'); fileio.openSync(fpath, 0o102, 0o777); - let fpathTarget = nextFileName('?*:<>/|'); + let fpathTarget = await nextFileName('?*:<>/|'); try { fileio.copyFileSync(fpath, fpathTarget); expect(null).assertFail(); @@ -2420,8 +2384,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_copy_file_sync_012 * @tc.desc Function of API, copy. fpatch is vaild, fpathTarget is vaild, same path, file not same, mode is 0. */ - it('fileio_test_copy_file_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_copy_file_sync_012'); + it('fileio_test_copy_file_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_copy_file_sync_012'); let fpathTarget = fpath + 'tgt' expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -2440,8 +2404,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_truncate_sync_000 * @tc.desc Function of API, truncateSync. */ - it('fileio_test_truncate_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_truncate_sync_000'); + it('fileio_test_truncate_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_truncate_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.truncateSync(fpath, 10) !== null).assertTrue(); @@ -2459,7 +2423,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_truncate_sync_001 * @tc.desc Function of API, no value for parameter. */ - it('fileio_test_truncate_sync_001', 0, function () { + it('fileio_test_truncate_sync_001', 0, async function () { try { fileio.truncateSync(); expect(null).assertFail(); @@ -2474,8 +2438,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_truncate_sync_002 * @tc.desc Function of API, no invaild parameter. */ - it('fileio_test_truncate_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_truncate_sync_001'); + it('fileio_test_truncate_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_truncate_sync_001'); try { fileio.truncateSync(fpath); expect(null).assertFail(); @@ -2490,8 +2454,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_truncate_sync_003 * @tc.desc Function of API, . */ - it('fileio_test_truncate_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_truncate_sync_003'); + it('fileio_test_truncate_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_truncate_sync_003'); try { fileio.truncateSync(fpath, -1); expect(null).assertFail(); @@ -2507,8 +2471,8 @@ describe('fileIOTest', function () { * @tc.desc Function of API, renameSync. The test file is exist, * fpathTarget is not same with fpatch, file name are same. */ - it('fileio_test_rename_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_rename_sync_000'); + it('fileio_test_rename_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_rename_sync_000'); let fpathTarget = fpath + 'tgt' expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -2528,8 +2492,8 @@ describe('fileIOTest', function () { * @tc.desc Function of API, renameSync. The test file is not exist, * fpathTarget is not same with fpatch, file name are same. */ - it('fileio_test_rename_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_rename_sync_001'); + it('fileio_test_rename_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_rename_sync_001'); let fpathTarget = fpath + 'tgt' try { fileio.renameSync(fpath, fpathTarget); @@ -2545,8 +2509,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_002 * @tc.desc Function of API, renameSync. The test file is exist, fpathTarget is invaild. */ - it('fileio_test_rename_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_rename_sync_002'); + it('fileio_test_rename_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_rename_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.renameSync(fpath, '/'); @@ -2563,8 +2527,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_003 * @tc.desc Function of API, renameSync. The test file is not exist, fpathTarget is same with fpatch, file name are same. */ - it('fileio_test_rename_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_rename_sync_003'); + it('fileio_test_rename_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_rename_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { console.log('fileio_test_rename_sync_003 Test start'); @@ -2581,7 +2545,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_004 * @tc.desc Function of API, no fpath parameter. */ - it('fileio_test_rename_sync_004', 0, function () { + it('fileio_test_rename_sync_004', 0, async function () { try { fileio.renameSync(1, 1); expect(null).assertFail(); @@ -2596,8 +2560,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_005 * @tc.desc Function of API, no fpathTarget parameter. */ - it('fileio_test_rename_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_rename_sync_005'); + it('fileio_test_rename_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_rename_sync_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.renameSync(fpath, 1); @@ -2614,9 +2578,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_006 * @tc.desc Function of API, rename dir. */ - it('fileio_test_rename_sync_006', 0, function () { - let dpath = nextFileName('fileio_test_rename_sync_006') + 'd' - let dpathTarget = nextFileName('fileio_test_rename_sync_006-1') + 'd' + it('fileio_test_rename_sync_006', 0, async function () { + let dpath = await nextFileName('fileio_test_rename_sync_006') + 'd' + let dpathTarget = await nextFileName('fileio_test_rename_sync_006-1') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); expect(fileio.renameSync(dpath, dpathTarget) == undefined).assertTrue(); @@ -2634,9 +2598,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_007 * @tc.desc Function of API, dir not exist. The test dir is not exist. */ - it('fileio_test_rename_sync_007', 0, function () { - let dpath = nextFileName('fileio_test_rename_sync_007') + 'd' - let dpathTarget = nextFileName('fileio_test_rename_sync_007-1') + 'd' + it('fileio_test_rename_sync_007', 0, async function () { + let dpath = await nextFileName('fileio_test_rename_sync_007') + 'd' + let dpathTarget = await nextFileName('fileio_test_rename_sync_007-1') + 'd' try { fileio.renameSync(dpath, dpathTarget); expect(null).assertFail(); @@ -2651,8 +2615,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_008 * @tc.desc Function of API, fpathTarget not exist. fpathTarget not exist. */ - it('fileio_test_rename_sync_008', 0, function () { - let dpath = nextFileName('fileio_test_rename_sync_008') + 'd' + it('fileio_test_rename_sync_008', 0, async function () { + let dpath = await nextFileName('fileio_test_rename_sync_008') + 'd' let dpathTarget = '/data/accounts/account_0/appdata/aaa/bbb/fileio_test_rename_sync_008-1d' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -2670,8 +2634,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_rename_sync_009 * @tc.desc Function of API, fpath is same with fpathTarget. fpath is same with fpathTarget. */ - it('fileio_test_rename_sync_009', 0, function () { - let dpath = nextFileName('fileio_test_rename_sync_009') + 'd' + it('fileio_test_rename_sync_009', 0, async function () { + let dpath = await nextFileName('fileio_test_rename_sync_009') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let result = fileio.renameSync(dpath, dpath); @@ -2690,8 +2654,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_000 * @tc.desc Function of API, fchmodSync(mode=0o660). The test file is exist. */ - it('fileio_test_fchmod_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_000'); + it('fileio_test_fchmod_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2710,8 +2674,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_001 * @tc.desc Function of API, fchmodSync(mode=0o460). The test file is exist. */ - it('fileio_test_fchmod_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_001'); + it('fileio_test_fchmod_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2730,8 +2694,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_002 * @tc.desc Function of API, fchmodSync(mode=0o260). The test file is exist. */ - it('fileio_test_fchmod_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_002'); + it('fileio_test_fchmod_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2750,8 +2714,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_003 * @tc.desc Function of API, file not exist. The test file is not exist. */ - it('fileio_test_fchmod_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_003'); + it('fileio_test_fchmod_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_003'); try { expect(fileio.fchmodSync(fpath, 0o660) !== null).assertTrue(); expect(null).assertFail(); @@ -2766,8 +2730,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_004 * @tc.desc Function of API, mode is invaild. The test file is exist. */ - it('fileio_test_fchmod_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_004'); + it('fileio_test_fchmod_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2785,8 +2749,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_005 * @tc.desc Function of API, fpath = dir. The test dir is exist. */ - it('fileio_test_fchmod_sync_005', 0, function () { - let dpath = nextFileName('fileio_test_fchmod_sync_005') + 'd' + it('fileio_test_fchmod_sync_005', 0, async function () { + let dpath = await nextFileName('fileio_test_fchmod_sync_005') + 'd' try { expect(fileio.mkdirSync(dpath, 0o777) !== null).assertTrue(); let fd = fileio.openSync(dpath); @@ -2805,7 +2769,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_006 * @tc.desc Function of API, fpatch = dir. The test dir is not exist. */ - it('fileio_test_fchmod_sync_006', 0, function () { + it('fileio_test_fchmod_sync_006', 0, async function () { let dpath; try { fileio.fchmodSync(dpath, 0o660); @@ -2821,8 +2785,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_007 * @tc.desc Function of API, fchmodSync(mode=0o460). The test file is exist. */ - it('fileio_test_fchmod_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_007'); + it('fileio_test_fchmod_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2841,8 +2805,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_008 * @tc.desc Function of API, fchmodSync(mode=0o400). The test file is exist. */ - it('fileio_test_fchmod_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_008'); + it('fileio_test_fchmod_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_008'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2861,8 +2825,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_009 * @tc.desc Function of API, fchmodSync(mode=0o200). The test file is exist. */ - it('fileio_test_fchmod_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_009'); + it('fileio_test_fchmod_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_009'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2881,8 +2845,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_010 * @tc.desc Function of API, fchmodSync(mode=0o100). The test file is exist. */ - it('fileio_test_fchmod_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_010'); + it('fileio_test_fchmod_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_010'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2901,8 +2865,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_011 * @tc.desc Function of API, fchmodSync(mode=0o070). The test file is exist. */ - it('fileio_test_fchmod_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_011'); + it('fileio_test_fchmod_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_011'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2921,8 +2885,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_012 * @tc.desc Function of API, fchmodSync(mode=0o040). The test file is exist. */ - it('fileio_test_fchmod_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_012'); + it('fileio_test_fchmod_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_012'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2941,8 +2905,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_013 * @tc.desc Function of API, fchmodSync(mode=0o020). The test file is exist. */ - it('fileio_test_fchmod_sync_013', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_013'); + it('fileio_test_fchmod_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_013'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2961,8 +2925,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_014 * @tc.desc Function of API, fchmodSync(mode=0o010). The test file is exist. */ - it('fileio_test_fchmod_sync_014', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_014'); + it('fileio_test_fchmod_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_014'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -2981,8 +2945,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_015 * @tc.desc Function of API, fchmodSync(mode=0o007). The test file is exist. */ - it('fileio_test_fchmod_sync_015', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_015'); + it('fileio_test_fchmod_sync_015', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_015'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -3001,8 +2965,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_016 * @tc.desc Function of API, fchmodSync(mode=0o004). The test file is exist. */ - it('fileio_test_fchmod_sync_016', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_016'); + it('fileio_test_fchmod_sync_016', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_016'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -3021,8 +2985,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_017 * @tc.desc Function of API, fchmodSync(mode=0o002). The test file is exist. */ - it('fileio_test_fchmod_sync_017', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_017'); + it('fileio_test_fchmod_sync_017', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_017'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -3041,8 +3005,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchmod_sync_018 * @tc.desc Function of API, fchmodSync(mode=0o001). The test file is exist. */ - it('fileio_test_fchmod_sync_018', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_018'); + it('fileio_test_fchmod_sync_018', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_018'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -3061,8 +3025,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_ftruncate_sync_000 * @tc.desc Function of API, ftruncateSync. The test file is exist. */ - it('fileio_test_ftruncate_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_000'); + it('fileio_test_ftruncate_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -3081,8 +3045,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_ftruncate_sync_001 * @tc.desc Function of API, len not for value. The test file is exist. */ - it('fileio_test_ftruncate_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_001'); + it('fileio_test_ftruncate_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -3101,7 +3065,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_ftruncate_sync_002 * @tc.desc Function of API, invaild parameter. The test file is not exist. */ - it('fileio_test_ftruncate_sync_002', 0, function () { + it('fileio_test_ftruncate_sync_002', 0, async function () { try { fileio.ftruncateSync(1); expect(null).assertFail(); @@ -3116,7 +3080,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_ftruncate_sync_003 * @tc.desc Function of API, invaild parameter. The test file is not exist. */ - it('fileio_test_ftruncate_sync_003', 0, function () { + it('fileio_test_ftruncate_sync_003', 0, async function () { try { fileio.ftruncateSync(-1); expect(null).assertFail(); @@ -3131,8 +3095,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_ftruncate_sync_004 * @tc.desc Function of API, Parameter exception(len = -1). */ - it('fileio_test_ftruncate_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_004'); + it('fileio_test_ftruncate_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -3149,8 +3113,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fsync_sync_000 * @tc.desc Function of API, fsyneSync. */ - it('fileio_test_fsync_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fsync_sync_000'); + it('fileio_test_fsync_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fsync_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -3169,7 +3133,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fsync_sync_001 * @tc.desc Function of API, no value of parameter. */ - it('fileio_test_fsync_sync_001', 0, function () { + it('fileio_test_fsync_sync_001', 0, async function () { try { fileio.fsyncSync(1); expect(null).assertFail(); @@ -3184,7 +3148,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fsync_sync_002 * @tc.desc Function of API, invaild parameter. */ - it('fileio_test_fsync_sync_002', 0, function () { + it('fileio_test_fsync_sync_002', 0, async function () { try { fileio.fsyncSync(-1); expect(null).assertFail(); @@ -3199,8 +3163,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_000 * @tc.desc Sync to mkdir and rmdir. */ - it('fileio_test_mkdir_sync_rmdir_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_fsync_sync_000') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_fsync_sync_000') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3216,8 +3180,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_001 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o660). */ - it('fileio_test_mkdir_sync_rmdir_sync_001', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_001') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_001', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_001') + 'd' try { expect(fileio.mkdirSync(dpath, 0o660) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3233,8 +3197,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_002 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o460). */ - it('fileio_test_mkdir_sync_rmdir_sync_002', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_002') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_002', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_002') + 'd' try { expect(fileio.mkdirSync(dpath, 0o460) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3250,8 +3214,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_003 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o260). */ - it('fileio_test_mkdir_sync_rmdir_sync_003', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_003') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_003', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_003') + 'd' try { expect(fileio.mkdirSync(dpath, 0o260) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3267,7 +3231,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_004 * @tc.desc Function of API, invaild parameter. The test file is not exist. */ - it('fileio_test_mkdir_sync_rmdir_sync_004', 0, function () { + it('fileio_test_mkdir_sync_rmdir_sync_004', 0, async function () { try { expect(fileio.mkdirSync(1) !== null); expect(null).assertFail(); @@ -3282,7 +3246,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_005 * @tc.desc Function of API, invaild parameter. The test file is not exist. */ - it('fileio_test_mkdir_sync_rmdir_sync_005', 0, function () { + it('fileio_test_mkdir_sync_rmdir_sync_005', 0, async function () { try { expect(fileio.mkdirSync('/', 1) !== null).assertTrue(); expect(null).assertFail(); @@ -3297,8 +3261,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_006 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o700). */ - it('fileio_test_mkdir_sync_rmdir_sync_006', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_006') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_006', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_006') + 'd' try { expect(fileio.mkdirSync(dpath, 0o700) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3314,8 +3278,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_007 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o400). */ - it('fileio_test_mkdir_sync_rmdir_sync_007', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_007') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_007', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_007') + 'd' try { expect(fileio.mkdirSync(dpath, 0o400) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3331,8 +3295,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_008 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o200). */ - it('fileio_test_mkdir_sync_rmdir_sync_008', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_008') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_008', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_008') + 'd' try { expect(fileio.mkdirSync(dpath, 0o200) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3348,8 +3312,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_009 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o100). */ - it('fileio_test_mkdir_sync_rmdir_sync_009', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_009') + 'd' + it('fileio_test_mkdir_sync_rmdir_sync_009', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_009') + 'd' try { expect(fileio.mkdirSync(dpath, 0o100) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3365,8 +3329,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_010 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o070). */ - it('fileio_test_mkdir_sync_rmdir_sync_010', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_010') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_010', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_010') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o070) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3382,8 +3346,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_011 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o040). */ - it('fileio_test_mkdir_sync_rmdir_sync_011', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_011') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_011', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_011') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o040) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3399,8 +3363,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_012 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o020). */ - it('fileio_test_mkdir_sync_rmdir_sync_012', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_012') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_012', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_012') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o020) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3416,8 +3380,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_013 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o010). */ - it('fileio_test_mkdir_sync_rmdir_sync_013', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_013') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_013', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_013') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o010) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3433,8 +3397,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_014 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o007). */ - it('fileio_test_mkdir_sync_rmdir_sync_014', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_014') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_014', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_014') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o007) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3450,8 +3414,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_015 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o004). */ - it('fileio_test_mkdir_sync_rmdir_sync_015', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_015') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_015', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_015') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o004) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3467,8 +3431,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_016 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o002). */ - it('fileio_test_mkdir_sync_rmdir_sync_016', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_016') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_016', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_016') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o002) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3484,8 +3448,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_mkdir_sync_rmdir_sync_017 * @tc.desc Sync to mkdir and rmdir. mkdirSync(mode=0o001). */ - it('fileio_test_mkdir_sync_rmdir_sync_017', 0, function () { - let dpath = nextFileName('fileio_test_mkdir_sync_rmdir_sync_017') + 'd'; + it('fileio_test_mkdir_sync_rmdir_sync_017', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdir_sync_rmdir_sync_017') + 'd'; try { expect(fileio.mkdirSync(dpath, 0o001) !== null).assertTrue(); expect(fileio.rmdirSync(dpath) !== null).assertTrue(); @@ -3501,8 +3465,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fstat_sync_000 * @tc.desc Function of API, fstatSync. The test file is exist. */ - it('fileio_test_fstat_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fstat_sync_000'); + it('fileio_test_fstat_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -3522,7 +3486,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fstat_sync_001 * @tc.desc Function of API, fstatSync, fd = -1. The test file is not exist. */ - it('fileio_test_fstat_sync_001', 0, function () { + it('fileio_test_fstat_sync_001', 0, async function () { try { expect(fileio.fstatSync(1) !== null).assertTrue(); expect(null).assertFail(); @@ -3536,7 +3500,7 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fstat_sync_002 * @tc.desc Function of API, fstatSync, fd = 1. The test file is not exist. */ - it('fileio_test_fstat_sync_002', 0, function () { + it('fileio_test_fstat_sync_002', 0, async function () { try { expect(fileio.fstatSync(1) !== null).assertTrue(); expect(null).assertFail(); @@ -3550,8 +3514,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fstat_sync_003 * @tc.desc Function of API, fstatSync, vaild fd. The test file is exist. */ - it('fileio_test_fstat_sync_003', 0, function () { - let dpath = nextFileName('fileio_test_fstat_sync_003') + 'd' + it('fileio_test_fstat_sync_003', 0, async function () { + let dpath = await nextFileName('fileio_test_fstat_sync_003') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let fd = fileio.openSync(dpath); @@ -3572,8 +3536,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chown_sync_000 * @tc.desc Function of API, chownSync. The test file is exist. */ - it('fileio_test_chown_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_chown_sync_000'); + it('fileio_test_chown_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_chown_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3593,9 +3557,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chown_sync_001 * @tc.desc Function of API, chownSync. The test file is not exist. */ - it('fileio_test_chown_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_chown_sync_001'); - let fpathc = nextFileName('fileio_test_chown_sync_001_1'); + it('fileio_test_chown_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_chown_sync_001'); + let fpathc = await nextFileName('fileio_test_chown_sync_001_1'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3615,8 +3579,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_chown_sync_002 * @tc.desc Function of API, invaild fd. The test file is not exist. */ - it('fileio_test_chown_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_chown_sync_002'); + it('fileio_test_chown_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_chown_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(fileio.chownSync(fpath, 0, 0)); @@ -3633,8 +3597,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_000 * @tc.desc Function of API, fchownSync. The test file is exist. */ - it('fileio_test_fchown_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_000'); + it('fileio_test_fchown_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3656,8 +3620,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_001 * @tc.desc Function of API, fchownSync. The test file is not exist. */ - it('fileio_test_fchown_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_001'); + it('fileio_test_fchown_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3678,8 +3642,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_002 * @tc.desc Function of API, fchownSync, wrong owner. The test file is exist. */ - it('fileio_test_fchown_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_002'); + it('fileio_test_fchown_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let fd; @@ -3700,8 +3664,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_003 * @tc.desc Function of API, fchownSync, wrong group. The test file is exist. */ - it('fileio_test_fchown_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_003'); + it('fileio_test_fchown_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid; @@ -3723,8 +3687,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_004 * @tc.desc Function of API, fchownSync, no value of fd. The test file is exist. */ - it('fileio_test_fchown_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_004'); + it('fileio_test_fchown_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3747,8 +3711,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_005 * @tc.desc Function of API, fchownSync, no value of owner. The test file is exist. */ - it('fileio_test_fchown_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_005'); + it('fileio_test_fchown_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = null @@ -3771,8 +3735,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_006 * @tc.desc Function of API, fchownSync, no value of group. The test file is exist. */ - it('fileio_test_fchown_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_006'); + it('fileio_test_fchown_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let stat = fileio.statSync(fpath); let UID = stat.uid @@ -3795,8 +3759,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_fchown_sync_007 * @tc.desc Function of API, fchownSync, no value of GID,UID. The test file is exist. */ - it('fileio_test_fchown_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_007'); + it('fileio_test_fchown_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd; let UID = null @@ -3818,8 +3782,8 @@ describe('fileIOTest', function () { * @tc.name fileio_test_prop_write_open_read_4k_sync * @tc.desc Sync to write & open & read 4K file. */ - it('fileio_test_prop_write_open_read_4k_sync', 0, function () { - let fpath = nextFileName('fileio_test_prop_write_open_read_4k_sync'); + it('fileio_test_prop_write_open_read_4k_sync', 0, async function () { + let fpath = await nextFileName('fileio_test_prop_write_open_read_4k_sync'); try { let fd = fileio.openSync(fpath, 0o102, 0o777); expect(fd !== null).assertTrue(); @@ -3842,9 +3806,9 @@ describe('fileIOTest', function () { * @tc.name fileio_test_prop_copyFile_4k_sync * @tc.desc Sync to copy 4K file. */ - it('fileio_test_prop_copyFile_4k_sync', 0, function () { - let fpath = nextFileName('fileio_test_prop_copyFile_4k_sync'); - let fpath1 = fileName('fileio_test_prop_copyFile_4k_1_sync'); + it('fileio_test_prop_copyFile_4k_sync', 0, async function () { + let fpath = await nextFileName('fileio_test_prop_copyFile_4k_sync'); + let fpath1 = await fileName('fileio_test_prop_copyFile_4k_1_sync'); try { let fd = fileio.openSync(fpath, 0o102, 0o777); expect(fd !== null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js index 5b0300240181d5f98f663d66e68828019aaa8e66..bc8ee0ed3a0bdb9e020472455709a64e3658bf8d 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIODir.test.js @@ -35,8 +35,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_000 * @tc.desc Function of API, opendirSync. */ - it('fileio_test_dir_open_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_dir_open_sync_000') + 'd' + it('fileio_test_dir_open_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_open_sync_000') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let dd = fileio.opendirSync(dpath); @@ -70,8 +70,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_002 * @tc.desc Function of API, dpath value is not exist. */ - it('fileio_test_dir_open_sync_002', 0, function () { - let dpath = nextFileName('fileio_test_dir_open_sync_003') + 'd' + it('fileio_test_dir_open_sync_002', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_open_sync_003') + 'd' try { fileio.opendirSync(dpath); expect(null).assertFail(); @@ -86,8 +86,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_003 * @tc.desc Function of API, dpath too long. */ - it('fileio_test_dir_open_sync_003', 0, function () { - let dpath = nextFileName('fileio_dir11'); + it('fileio_test_dir_open_sync_003', 0, async function () { + let dpath = await nextFileName('fileio_dir11'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 16; i++) { @@ -107,8 +107,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_004 * @tc.desc Function of API, filename too long. */ - it('fileio_test_dir_open_sync_004', 0, function () { - let dpath = nextFileName(randomString(256)); + it('fileio_test_dir_open_sync_004', 0, async function () { + let dpath = await nextFileName(randomString(256)); try { fileio.mkdirSync(dpath); expect(null).assertFail(); @@ -123,8 +123,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_005 * @tc.desc Function of API, uri dir too many layers. */ - it('fileio_test_dir_open_sync_005', 0, function () { - let dpath = nextFileName('dir'); + it('fileio_test_dir_open_sync_005', 0, async function () { + let dpath = await nextFileName('dir'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 1024; i++) { @@ -144,8 +144,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_open_sync_006 * @tc.desc Function of API, file name contain special character. */ - it('fileio_test_dir_open_sync_006', 0, function () { - let dpath = nextFileName('?*:<>/|'); + it('fileio_test_dir_open_sync_006', 0, async function () { + let dpath = await nextFileName('?*:<>/|'); try { fileio.mkdirSync(dpath); expect(null).assertFail(); @@ -160,8 +160,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_000 * @tc.desc Function of API, readSync. The dir contains 1 file. */ - it('fileio_test_dir_read_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_000') + 'd' + it('fileio_test_dir_read_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_000') + 'd' let fpath = dpath + '/f0' try { expect(typeof(fileio.mkdirSync(dpath)) == 'undefined').assertTrue(); @@ -184,8 +184,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_001 * @tc.desc Function of API, readSync. The dir contains more than 1 files. */ - it('fileio_test_dir_read_sync_001', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_001') + 'd' + it('fileio_test_dir_read_sync_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_001') + 'd' let fpathArray = new Array(dpath + '/f1', dpath + '/f2', dpath + '/d3'); try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -228,8 +228,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_002 * @tc.desc Function of API, repeat read. The dir contains more than 1 files. */ - it('fileio_test_dir_read_sync_002', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_002') + 'd' + it('fileio_test_dir_read_sync_002', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_002') + 'd' let fpathArray = new Array(dpath + '/f1', dpath + '/f2', dpath + '/d3'); try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -267,8 +267,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_003 * @tc.desc Function of API, readSync. The dir no any files. */ - it('fileio_test_dir_read_sync_003', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_003') + 'd' + it('fileio_test_dir_read_sync_003', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_003') + 'd' let dd; try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -289,8 +289,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_004 * @tc.desc Function of API, error parameter. */ - it('fileio_test_dir_read_sync_004', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_004') + 'd' + it('fileio_test_dir_read_sync_004', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_004') + 'd' let fpath = dpath + '/f1' let dd try { @@ -314,8 +314,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_read_sync_005 * @tc.desc Function of API, excess files. */ - it('fileio_test_dir_read_sync_005', 0, function () { - let dpath = nextFileName('fileio_test_dir_read_sync_005') + 'd' + it('fileio_test_dir_read_sync_005', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_read_sync_005') + 'd' let fpath = dpath + '/f' try { expect(typeof(fileio.mkdirSync(dpath)) == 'undefined').assertTrue(); @@ -342,8 +342,8 @@ describe('fileIOTestDir', function () { * @tc.name fileio_test_dir_close_sync_000 * @tc.desc Function of API, closeSync. */ - it('fileio_test_dir_close_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_dir_close_sync_000') + 'd' + it('fileio_test_dir_close_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dir_close_sync_000') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let dd = fileio.opendirSync(dpath); diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIODirent.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIODirent.test.js index 1091a34409bfeed5c19a50fe1c813f5c0cd78ad7..66a2c0f2c2c089d47f958c263b949af8e73f41ce 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIODirent.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIODirent.test.js @@ -34,8 +34,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_name_000 * @tc.desc Function of API, Get file name. */ - it('fileio_test_dirent_name_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_name_000') + 'd'; + it('fileio_test_dirent_name_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_name_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -59,8 +59,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_block_device_000 * @tc.desc Function of API, isBlockDevice. Determine whether it is a block device. */ - it('fileio_test_dirent_is_block_device_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_block_device_000') + 'd'; + it('fileio_test_dirent_is_block_device_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_block_device_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -86,8 +86,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_block_device_001 * @tc.desc Function of API, isBlockDevice. The parameter is - 1. */ - it('fileio_test_dirent_is_block_device_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_block_device_001') + 'd'; + it('fileio_test_dirent_is_block_device_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_block_device_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -113,8 +113,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_character_device_000 * @tc.desc Function of API, isCharacterDevice. Determine whether it is a character device. */ - it('fileio_test_dirent_is_character_device_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_character_device_000') + 'd'; + it('fileio_test_dirent_is_character_device_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_character_device_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -139,8 +139,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_character_device_001 * @tc.desc Function of API, isCharacterDevice. The parameter is - 1. */ - it('fileio_test_dirent_is_character_device_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_character_device_001') + 'd'; + it('fileio_test_dirent_is_character_device_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_character_device_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -166,8 +166,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_directory_000 * @tc.desc Function of API, isDirectory. Determine whether it is a directory. */ - it('fileio_test_dirent_is_directory_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_directory_000') + 'd'; + it('fileio_test_dirent_is_directory_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_directory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -192,8 +192,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_directory_001 * @tc.desc Function of API, isDirectory. The parameter is - 1 */ - it('fileio_test_dirent_is_directory_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_directory_001') + 'd'; + it('fileio_test_dirent_is_directory_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_directory_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -219,8 +219,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_fifo_000 * @tc.desc Function of API, isFIFO. Determine whether it is a fifo. */ - it('fileio_test_dirent_is_fifo_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_fifo_000') + 'd'; + it('fileio_test_dirent_is_fifo_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_fifo_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -245,8 +245,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_fifo_001 * @tc.desc Function of API, isFIFO. The parameter is - 1 */ - it('fileio_test_dirent_is_fifo_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_fifo_001') + 'd'; + it('fileio_test_dirent_is_fifo_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_fifo_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -272,8 +272,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_file_000 * @tc.desc Function of API, isFile. Determine whether it is a file. */ - it('fileio_test_dirent_is_file_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_file_000') + 'd'; + it('fileio_test_dirent_is_file_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_file_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -298,8 +298,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_file_001 * @tc.desc Function of API, isFile. The parameter is - 1 */ - it('fileio_test_dirent_is_file_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_file_001') + 'd'; + it('fileio_test_dirent_is_file_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_file_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -325,8 +325,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_socket_000 * @tc.desc Function of API, isSocket. Determine whether it is a socket. */ - it('fileio_test_dirent_is_socket_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_socket_000') + 'd'; + it('fileio_test_dirent_is_socket_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_socket_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -351,8 +351,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_socket_001 * @tc.desc Function of API, isSocket. The parameter is - 1 */ - it('fileio_test_dirent_is_socket_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_socket_001') + 'd'; + it('fileio_test_dirent_is_socket_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_socket_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { @@ -378,8 +378,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_symbolic_link_000 * @tc.desc Function of API, isSymbolicLink. Determine whether it is a symbolic link. */ - it('fileio_test_dirent_is_symbolic_link_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_000') + 'd'; + it('fileio_test_dirent_is_symbolic_link_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_symbolic_link_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) !== null); @@ -404,8 +404,8 @@ describe('fileIOTestDirent', function () { * @tc.name fileio_test_dirent_is_symbolic_link_001 * @tc.desc Function of API, isSymbolicLink. The parameter is - 1 */ - it('fileio_test_dirent_is_symbolic_link_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_001') + 'd'; + it('fileio_test_dirent_is_symbolic_link_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_symbolic_link_001') + 'd'; let fpath = dpath + '/f1'; let dd; try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js index ff923dc8133ea20a329e6f8d7df0009a81c2c415..ab0fcf26e12e20634f4b943d853c0c37709c9212 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIOStat.test.js @@ -35,8 +35,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_stat_sync_000 * @tc.desc Function of API, statSync. Gets information about the file in the specified path. */ - it('fileio_test_stat_stat_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_stat_sync_000'); + it('fileio_test_stat_stat_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_stat_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -54,8 +54,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_stat_sync_001 * @tc.desc Function of API, statSync. The specified file does not exist. */ - it('fileio_test_stat_stat_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_stat_sync_001'); + it('fileio_test_stat_stat_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_stat_sync_001'); try { fileio.statSync(fpath); expect(null).assertFail(); @@ -70,8 +70,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_stat_sync_002 * @tc.desc Function of API, statSync. The parameter is the directory path. */ - it('fileio_test_stat_stat_sync_002', 0, function () { - let dpath = nextFileName('fileio_test_stat_stat_sync_002') + 'd'; + it('fileio_test_stat_stat_sync_002', 0, async function () { + let dpath = await nextFileName('fileio_test_stat_stat_sync_002') + 'd'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); try { let stat = fileio.statSync(dpath); @@ -89,8 +89,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_stat_sync_003 * @tc.desc Function of API, statSync. The file path is greater than 4096. */ - it('fileio_test_stat_stat_sync_003', 0, function () { - let dpath = nextFileName('fileio_stat1'); + it('fileio_test_stat_stat_sync_003', 0, async function () { + let dpath = await nextFileName('fileio_stat1'); try { for (let i = 0; i < 16; i++) { if (i == 15) { @@ -112,8 +112,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_dev_000 * @tc.desc Function of API. Get the device number used by the file. */ - it('fileio_test_stat_dev_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_dev_000'); + it('fileio_test_stat_dev_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -131,8 +131,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_ino_000 * @tc.desc Function of API. Get inode number. */ - it('fileio_test_stat_ino_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_ino_000'); + it('fileio_test_stat_ino_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -150,8 +150,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_mode_000 * @tc.desc Function of API. Get file type and access rights. */ - it('fileio_test_stat_mode_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_mode_000'); + it('fileio_test_stat_mode_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -169,8 +169,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_nlink_000 * @tc.desc Function of API. Gets the number of hard connections to the file. */ - it('fileio_test_stat_nlink_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_nlink_000'); + it('fileio_test_stat_nlink_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -188,8 +188,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_uid_000 * @tc.desc Function of API. Get file owner user ID. */ - it('fileio_test_stat_uid_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_uid_000'); + it('fileio_test_stat_uid_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -207,8 +207,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_gid_000 * @tc.desc Function of API. Get group ID. */ - it('fileio_test_stat_gid_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_gid_000'); + it('fileio_test_stat_gid_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -226,8 +226,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_rdev_000 * @tc.desc Function of API. Get the device number of the device file. */ - it('fileio_test_stat_rdev_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_rdev_000'); + it('fileio_test_stat_rdev_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -245,8 +245,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_size_000 * @tc.desc Function of API. Gets the file capacity in bytes. */ - it('fileio_test_stat_size_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_size_000'); + it('fileio_test_stat_size_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -264,8 +264,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_blksize_000 * @tc.desc Function of API. Gets the size of the disk block containing the file. */ - it('fileio_test_stat_blksize_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_blksize_000'); + it('fileio_test_stat_blksize_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_blksize_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -283,8 +283,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_blocks_000 * @tc.desc Function of API. Gets the disk block occupied by the file. */ - it('fileio_test_stat_blocks_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_blocks_000'); + it('fileio_test_stat_blocks_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -302,8 +302,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_atime_000 * @tc.desc Function of API. Gets the time when a file was last accessed. */ - it('fileio_test_stat_atime_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_atime_000'); + it('fileio_test_stat_atime_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -321,8 +321,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_mtime_000 * @tc.desc Function of API. Gets the time when a file was last modified */ - it('fileio_test_stat_mtime_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_mtime_000'); + it('fileio_test_stat_mtime_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -340,8 +340,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_ctime_000 * @tc.desc Function of API. Gets the time when a file last changed state */ - it('fileio_test_stat_ctime_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_ctime_000'); + it('fileio_test_stat_ctime_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -359,8 +359,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_block_device_000 * @tc.desc Function of API, isBlockDevice. Determine whether it is a block device. The return value is Boolean. */ - it('fileio_test_stat_is_block_device_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_block_device_000'); + it('fileio_test_stat_is_block_device_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -378,8 +378,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_block_device_001 * @tc.desc Function of API, isBlockDevice. Determine whether it is a block device. The return value is false. */ - it('fileio_test_stat_is_block_device_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_block_device_001'); + it('fileio_test_stat_is_block_device_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -397,8 +397,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_block_device_002 * @tc.desc Function of API, isBlockDevice. The parameter is - 1 */ - it('fileio_test_stat_is_block_device_002', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_block_device_002'); + it('fileio_test_stat_is_block_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_block_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -416,8 +416,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_character_device_000 * @tc.desc Function of API, isCharacterDevice. Determine whether it is a character device. The return value is Boolean. */ - it('fileio_test_stat_is_character_device_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_character_device_000'); + it('fileio_test_stat_is_character_device_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -435,8 +435,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_character_device_001 * @tc.desc Function of API, isCharacterDevice. Determine whether it is a character device. The return value is false. */ - it('fileio_test_stat_is_character_device_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_character_device_001'); + it('fileio_test_stat_is_character_device_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -454,8 +454,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_character_device_002 * @tc.desc Function of API, isCharacterDevice. The parameter is - 1 */ - it('fileio_test_stat_is_character_device_002', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_character_device_002'); + it('fileio_test_stat_is_character_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_character_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -473,8 +473,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_directory_000 * @tc.desc Function of API, isDirectory. Determine whether it is a directory. The return value is Boolean. */ - it('fileio_test_stat_is_directory_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_directory_000'); + it('fileio_test_stat_is_directory_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -492,8 +492,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_directory_001 * @tc.desc Function of API, isDirectory. Determine whether it is a directory. The return value is false. */ - it('fileio_test_stat_is_directory_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_directory_001'); + it('fileio_test_stat_is_directory_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -511,8 +511,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_directory_002 * @tc.desc Function of API, isDirectory. Determine whether it is a directory. The return value is true. */ - it('fileio_test_stat_is_directory_002', 0, function () { - let dpath = nextFileName('fileio_test_stat_is_directory_002') + 'd' + it('fileio_test_stat_is_directory_002', 0, async function () { + let dpath = await nextFileName('fileio_test_stat_is_directory_002') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let stat = fileio.statSync(dpath); @@ -530,8 +530,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_directory_003 * @tc.desc Function of API, isDirectory. The parameter is - 1 */ - it('fileio_test_stat_is_directory_003', 0, function () { - let dpath = nextFileName('fileio_test_stat_is_directory_003') + 'd' + it('fileio_test_stat_is_directory_003', 0, async function () { + let dpath = await nextFileName('fileio_test_stat_is_directory_003') + 'd' try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let stat = fileio.statSync(dpath); @@ -549,8 +549,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_fifo_000 * @tc.desc Function of API, isFIFO. Determine whether it is a fifo. The return value is Boolean. */ - it('fileio_test_stat_is_fifo_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_fifo_000'); + it('fileio_test_stat_is_fifo_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -568,8 +568,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_fifo_001 * @tc.desc Function of API, isFIFO. Determine whether it is a fifo. The return value is false. */ - it('fileio_test_stat_is_fifo_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_fifo_001'); + it('fileio_test_stat_is_fifo_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -587,8 +587,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_fifo_002 * @tc.desc Function of API, isFIFO. The parameter is - 1 */ - it('fileio_test_stat_is_fifo_002', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_fifo_002'); + it('fileio_test_stat_is_fifo_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_fifo_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -606,8 +606,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_file_000 * @tc.desc Function of API, isFile. Determine whether it is a file. The return value is Boolean. */ - it('fileio_test_stat_is_file_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_file_000'); + it('fileio_test_stat_is_file_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_file_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -625,8 +625,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_file_001 * @tc.desc Function of API, isFile. Determine whether it is a file. The return value is true. */ - it('fileio_test_stat_is_file_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_file_001'); + it('fileio_test_stat_is_file_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_file_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -645,8 +645,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_file_002 * @tc.desc Function of API, isFile. Determine whether it is a file. The return value is false. */ - it('fileio_test_stat_is_file_002', 0, function () { - let dpath = nextFileName('fileio_test_stat_is_file_002'); + it('fileio_test_stat_is_file_002', 0, async function () { + let dpath = await nextFileName('fileio_test_stat_is_file_002'); try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let stat = fileio.statSync(dpath); @@ -664,8 +664,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_file_003 * @tc.desc Function of API, isFile. The parameter is - 1 */ - it('fileio_test_stat_is_file_003', 0, function () { - let dpath = nextFileName('fileio_test_stat_is_file_003'); + it('fileio_test_stat_is_file_003', 0, async function () { + let dpath = await nextFileName('fileio_test_stat_is_file_003'); try { expect(fileio.mkdirSync(dpath) !== null).assertTrue(); let stat = fileio.statSync(dpath); @@ -683,8 +683,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_socket_000 * @tc.desc Function of API, isSocket. Determine whether it is a socket. The return value is Boolean. */ - it('fileio_test_stat_is_socket_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_socket_000'); + it('fileio_test_stat_is_socket_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -702,8 +702,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_socket_001 * @tc.desc Function of API, isSocket. Determine whether it is a socket. The return value is false. */ - it('fileio_test_stat_is_socket_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_socket_001'); + it('fileio_test_stat_is_socket_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -721,8 +721,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_socket_002 * @tc.desc Function of API, isSocket. The parameter is - 1 */ - it('fileio_test_stat_is_socket_002', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_socket_002'); + it('fileio_test_stat_is_socket_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_socket_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -740,8 +740,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_symbolic_link_000 * @tc.desc Function of API, isSymbolicLink. Determine whether it is a symbolic link. The return value is Boolean. */ - it('fileio_test_stat_is_symbolic_link_000', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_symbolic_link_000'); + it('fileio_test_stat_is_symbolic_link_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -759,8 +759,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_symbolic_link_001 * @tc.desc Function of API, isSymbolicLink. Determine whether it is a symbolic link. The return value is false. */ - it('fileio_test_stat_is_symbolic_link_001', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_symbolic_link_001'); + it('fileio_test_stat_is_symbolic_link_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -778,8 +778,8 @@ describe('fileIOTestStat', function () { * @tc.name fileio_test_stat_is_symbolic_link_002 * @tc.desc Function of API, isSymbolicLink. The parameter is - 1 */ - it('fileio_test_stat_is_symbolic_link_002', 0, function () { - let fpath = nextFileName('fileio_test_stat_is_symbolic_link_002'); + it('fileio_test_stat_is_symbolic_link_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stat_is_symbolic_link_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); diff --git a/storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js b/storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js index 2d100094e7b4d36c1c9b86f24b3aab6e832a1a47..8f1760073d2ea7eae95c5062a0260022a94aab48 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/FileIOStream.test.js @@ -37,8 +37,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_000 * @tc.desc Function of API, mode = r. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_000'); + it('fileio_test_stream_create_stream_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_000'); expect(prepareFile(fpath, 'hello')).assertTrue(); expect(fileToReadOnly(fpath)).assertTrue(); try { @@ -59,8 +59,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_001 * @tc.desc Function of API, mode = r. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_001'); + it('fileio_test_stream_create_stream_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_001'); try { fileio.createStreamSync(fpath, 'r'); expect(null).assertFail(); @@ -75,8 +75,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_002 * @tc.desc Function of API, mode = w. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_002'); + it('fileio_test_stream_create_stream_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_002'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -104,8 +104,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_003 * @tc.desc Function of API, mode = w. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_003'); + it('fileio_test_stream_create_stream_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_003'); try { let ss = fileio.createStreamSync(fpath, 'w'); expect(ss !== null).assertTrue(); @@ -123,8 +123,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_004 * @tc.desc Function of API, mode = a. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_004'); + it('fileio_test_stream_create_stream_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_004'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -153,8 +153,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_005 * @tc.desc Function of API, mode = a. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_005'); + it('fileio_test_stream_create_stream_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_005'); try { let ss = fileio.createStreamSync(fpath, 'a'); expect(ss !== null).assertTrue(); @@ -172,8 +172,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_006 * @tc.desc Function of API, mode = r+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_006'); + it('fileio_test_stream_create_stream_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let ss = fileio.createStreamSync(fpath, 'r+'); @@ -192,8 +192,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_007 * @tc.desc Function of API, mode = r+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_007'); + it('fileio_test_stream_create_stream_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_007'); try { fileio.createStreamSync(fpath, 'r+'); expect(null).assertFail(); @@ -208,8 +208,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_008 * @tc.desc Function of API, mode = w+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_008'); + it('fileio_test_stream_create_stream_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_008'); expect(prepareFile(fpath, '')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -236,8 +236,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_009 * @tc.desc Function of API, mode = w+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_009'); + it('fileio_test_stream_create_stream_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_009'); try { let ss = fileio.createStreamSync(fpath, 'w+'); expect(ss !== null).assertTrue(); @@ -255,8 +255,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_010 * @tc.desc Function of API, mode = a+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_010'); + it('fileio_test_stream_create_stream_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_010'); expect(prepareFile(fpath, 'a')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -283,8 +283,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_011 * @tc.desc Function of API, mode = a+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_011'); + it('fileio_test_stream_create_stream_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_011'); try { let ss = fileio.createStreamSync(fpath, 'a+'); expect(ss !== null).assertTrue(); @@ -302,8 +302,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_012 * @tc.desc Function of API, mode = ab. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_012'); + it('fileio_test_stream_create_stream_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_012'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToReadOnly(fpath)).assertTrue(); try { @@ -323,8 +323,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_013 * @tc.desc Function of API, mode = ab. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_013', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_013'); + it('fileio_test_stream_create_stream_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_013'); try { fileio.createStreamSync(fpath, 'rb'); expect(null).assertFail(); @@ -339,8 +339,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_014 * @tc.desc Function of API, mode = wb. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_014', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_014'); + it('fileio_test_stream_create_stream_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_014'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -368,8 +368,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_015 * @tc.desc Function of API, mode = wb. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_015', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_015'); + it('fileio_test_stream_create_stream_sync_015', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_015'); try { let ss = fileio.createStreamSync(fpath, 'wb'); expect(ss !== null).assertTrue(); @@ -387,8 +387,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_016 * @tc.desc Function of API, mode = ab. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_016', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_016'); + it('fileio_test_stream_create_stream_sync_016', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_016'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -417,8 +417,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_017 * @tc.desc Function of API, mode = ab. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_017', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_017'); + it('fileio_test_stream_create_stream_sync_017', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_017'); try { let ss = fileio.createStreamSync(fpath, 'ab'); expect(ss !== null).assertTrue(); @@ -436,8 +436,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_018 * @tc.desc Function of API, mode = rb+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_018', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_018'); + it('fileio_test_stream_create_stream_sync_018', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_018'); expect(prepareFile(fpath, '')).assertTrue(); try { let ss = fileio.createStreamSync(fpath, 'rb+'); @@ -456,8 +456,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_019 * @tc.desc Function of API, mode = rb+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_019', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_019'); + it('fileio_test_stream_create_stream_sync_019', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_019'); try { fileio.createStreamSync(fpath, 'rb+'); expect(null).assertFail(); @@ -472,8 +472,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_020 * @tc.desc Function of API, mode = wb+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_020', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_020'); + it('fileio_test_stream_create_stream_sync_020', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_020'); expect(prepareFile(fpath, '')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -500,8 +500,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_021 * @tc.desc Function of API, mode = wb+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_021', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_021'); + it('fileio_test_stream_create_stream_sync_021', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_021'); try { let ss = fileio.createStreamSync(fpath, 'wb+'); expect(ss !== null).assertTrue(); @@ -519,8 +519,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_022 * @tc.desc Function of API, mode = ab+. The test file is exist. */ - it('fileio_test_stream_create_stream_sync_022', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_022'); + it('fileio_test_stream_create_stream_sync_022', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_022'); expect(prepareFile(fpath, 'a')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -547,8 +547,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_023 * @tc.desc Function of API, mode = ab+. The test file is not exist. */ - it('fileio_test_stream_create_stream_sync_023', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_023'); + it('fileio_test_stream_create_stream_sync_023', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_023'); try { let ss = fileio.createStreamSync(fpath, 'ab+'); expect(ss !== null).assertTrue(); @@ -581,8 +581,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_025 * @tc.desc Function of API, invaild mode. */ - it('fileio_test_stream_create_stream_sync_025', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_025'); + it('fileio_test_stream_create_stream_sync_025', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_025'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.createStreamSync(fpath, ''); @@ -599,8 +599,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_026 * @tc.desc Function of API, fpath too long. */ - it('fileio_test_stream_create_stream_sync_026', 0, function () { - let dpath = nextFileName('fileio_stream'); + it('fileio_test_stream_create_stream_sync_026', 0, async function () { + let dpath = await nextFileName('fileio_stream'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 16; i++) { @@ -624,8 +624,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_027 * @tc.desc Function of API, filename too long. */ - it('fileio_test_stream_create_stream_sync_027', 0, function () { - let fpath = nextFileName(randomString(256)); + it('fileio_test_stream_create_stream_sync_027', 0, async function () { + let fpath = await nextFileName(randomString(256)); try { fileio.createStreamSync(fpath, 'w+'); expect(null).assertFail(); @@ -640,8 +640,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_028 * @tc.desc Function of API, path too deep. */ - it('fileio_test_stream_create_stream_sync_028', 0, function () { - let dpath = nextFileName('stream'); + it('fileio_test_stream_create_stream_sync_028', 0, async function () { + let dpath = await nextFileName('stream'); fileio.mkdirSync(dpath); try { for (let i = 0; i < 113; i++) { @@ -665,8 +665,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_create_stream_sync_029 * @tc.desc Function of API, special character. */ - it('fileio_test_stream_create_stream_sync_029', 0, function () { - let fpath = nextFileName('?*:<>/|'); + it('fileio_test_stream_create_stream_sync_029', 0, async function () { + let fpath = await nextFileName('?*:<>/|'); try { fileio.createStreamSync(fpath, 'w+'); expect(null).assertFail(); @@ -681,8 +681,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_000 * @tc.desc Function of API, mode=r. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_000'); + it('fileio_test_stream_fdopen_stream_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_000'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToReadOnly(fpath)).assertTrue(); try { @@ -721,8 +721,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_002 * @tc.desc Function of API, mode=w. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_002'); + it('fileio_test_stream_fdopen_stream_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_002'); let fd; expect(prepareFile(fpath, '')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); @@ -754,8 +754,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_003 * @tc.desc Function of API, mode=w. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_003'); + it('fileio_test_stream_fdopen_stream_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_003'); try { let fd = fileio.openSync(fpath, 0o101, 0o222); let ss = fileio.fdopenStreamSync(fd, 'w'); @@ -775,8 +775,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_004 * @tc.desc Function of API, mode=a. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_004'); + it('fileio_test_stream_fdopen_stream_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_004'); expect(prepareFile(fpath, '1')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -807,8 +807,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_005 * @tc.desc Function of API, mode=a. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_005'); + it('fileio_test_stream_fdopen_stream_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_005'); try { let fd = fileio.openSync(fpath, 0o101, 0o222); let ss = fileio.fdopenStreamSync(fd, 'a'); @@ -828,8 +828,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_006 * @tc.desc Function of API, mode=r+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_006'); + it('fileio_test_stream_fdopen_stream_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_006'); expect(prepareFile(fpath, '')).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -850,7 +850,7 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_007 * @tc.desc Function of API, mode=r+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_007', 0, function () { + it('fileio_test_stream_fdopen_stream_sync_007', 0, async function () { try { fileio.fdopenStreamSync(-1, 'r+'); expect(null).assertFail(); @@ -865,8 +865,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_008 * @tc.desc Function of API, mode=w+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_008'); + it('fileio_test_stream_fdopen_stream_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_008'); expect(prepareFile(fpath, '')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -896,8 +896,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_009 * @tc.desc Function of API, mode=w+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_009'); + it('fileio_test_stream_fdopen_stream_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_009'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let ss = fileio.fdopenStreamSync(fd, 'w+'); @@ -917,8 +917,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_010 * @tc.desc Function of API, mode=a+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_010'); + it('fileio_test_stream_fdopen_stream_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_010'); expect(prepareFile(fpath, '1')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -948,8 +948,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_011 * @tc.desc Function of API, mode=a+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_011'); + it('fileio_test_stream_fdopen_stream_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_011'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let ss = fileio.fdopenStreamSync(fd, 'a+'); @@ -969,8 +969,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_012 * @tc.desc Function of API, mode=rb. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_012'); + it('fileio_test_stream_fdopen_stream_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_012'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToReadOnly(fpath)).assertTrue(); try { @@ -992,7 +992,7 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_013 * @tc.desc Function of API, mode=rb. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_013', 0, function () { + it('fileio_test_stream_fdopen_stream_sync_013', 0, async function () { try { fileio.fdopenStreamSync(-1, 'rb'); expect(null).assertFail(); @@ -1007,8 +1007,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_014 * @tc.desc Function of API, mode=wb. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_014', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_014'); + it('fileio_test_stream_fdopen_stream_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_014'); expect(prepareFile(fpath, '')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -1039,8 +1039,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_015 * @tc.desc Function of API, mode=wb. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_015', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_015'); + it('fileio_test_stream_fdopen_stream_sync_015', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_015'); try { let fd = fileio.openSync(fpath, 0o101, 0o222); let ss = fileio.fdopenStreamSync(fd, 'wb'); @@ -1060,8 +1060,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_016 * @tc.desc Function of API, mode=ab. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_016', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_016'); + it('fileio_test_stream_fdopen_stream_sync_016', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_016'); expect(prepareFile(fpath, '1')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); let text = '0123456789abcdefg'; @@ -1092,8 +1092,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_017 * @tc.desc Function of API, mode=ab. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_017', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_017'); + it('fileio_test_stream_fdopen_stream_sync_017', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_017'); try { let fd = fileio.openSync(fpath, 0o101, 0o222); let ss = fileio.fdopenStreamSync(fd, 'ab'); @@ -1113,8 +1113,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_018 * @tc.desc Function of API, mode=rb+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_018', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_018'); + it('fileio_test_stream_fdopen_stream_sync_018', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_018'); expect(prepareFile(fpath, '')).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1134,7 +1134,7 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_019 * @tc.desc Function of API, mode=rb+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_019', 0, function () { + it('fileio_test_stream_fdopen_stream_sync_019', 0, async function () { try { fileio.fdopenStreamSync(-1, 'rb+'); expect(null).assertFail(); @@ -1149,8 +1149,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_020 * @tc.desc Function of API, mode=wb+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_020', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_020'); + it('fileio_test_stream_fdopen_stream_sync_020', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_020'); expect(prepareFile(fpath, '')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1180,8 +1180,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_021 * @tc.desc Function of API, mode=wb+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_021', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_021'); + it('fileio_test_stream_fdopen_stream_sync_021', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_021'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let ss = fileio.fdopenStreamSync(fd, 'wb+'); @@ -1201,8 +1201,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_022 * @tc.desc Function of API, mode=ab+. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_022', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_022'); + it('fileio_test_stream_fdopen_stream_sync_022', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_022'); expect(prepareFile(fpath, '1')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1232,8 +1232,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_023 * @tc.desc Function of API, mode=ab+. The test file is not exist. */ - it('fileio_test_stream_fdopen_stream_sync_023', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_023'); + it('fileio_test_stream_fdopen_stream_sync_023', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_023'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); let ss = fileio.fdopenStreamSync(fd, 'ab+'); @@ -1253,7 +1253,7 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_024 * @tc.desc Function of API, invaild fildes. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_024', 0, function () { + it('fileio_test_stream_fdopen_stream_sync_024', 0, async function () { try { expect(fileio.fdopenStreamSync(null, 'r') == null).assertTrue(); expect(null).assertFail(); @@ -1268,8 +1268,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_fdopen_stream_sync_025 * @tc.desc Function of API, invaild mode. The test file is exist. */ - it('fileio_test_stream_fdopen_stream_sync_025', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_025'); + it('fileio_test_stream_fdopen_stream_sync_025', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_025'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -1287,8 +1287,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_000 * @tc.desc Function of API, not set options. */ - it('fileio_test_stream_read_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_000'); + it('fileio_test_stream_read_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_000'); let text = '0123456789abcdefg'; expect(prepareFile(fpath, text)).assertTrue(); try { @@ -1310,8 +1310,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_001 * @tc.desc Function of API, position. */ - it('fileio_test_stream_read_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_001'); + it('fileio_test_stream_read_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_001'); let text = '0123456789abcdefg'; expect(prepareFile(fpath, text)).assertTrue(); try { @@ -1335,8 +1335,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_002 * @tc.desc Function of API, offset. */ - it('fileio_test_stream_read_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_002'); + it('fileio_test_stream_read_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_002'); let text = '0123456789abcdefg'; expect(prepareFile(fpath, text)).assertTrue(); try { @@ -1360,8 +1360,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_003 * @tc.desc Function of API, length. */ - it('fileio_test_stream_read_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_003'); + it('fileio_test_stream_read_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let ss = fileio.createStreamSync(fpath, 'r+'); @@ -1384,8 +1384,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_004 * @tc.desc Function of API, readBuf. */ - it('fileio_test_stream_read_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_004'); + it('fileio_test_stream_read_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1406,8 +1406,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_005 * @tc.desc Function of API, position = -1. */ - it('fileio_test_stream_read_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_005'); + it('fileio_test_stream_read_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_005'); let text = '0123456789abcdefg'; expect(prepareFile(fpath, text)).assertTrue(); try { @@ -1431,8 +1431,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_read_sync_006 * @tc.desc Function of API, offset. */ - it('fileio_test_stream_read_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_006'); + it('fileio_test_stream_read_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1455,8 +1455,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_000 * @tc.desc Function of API, not set options. */ - it('fileio_test_stream_write_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_000'); + it('fileio_test_stream_write_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1478,8 +1478,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_001 * @tc.desc Function of API, invaild encoding. */ - it('fileio_test_stream_write_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_001'); + it('fileio_test_stream_write_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_001'); expect(prepareFile(fpath, '')).assertTrue(); let ss try { @@ -1502,8 +1502,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_002 * @tc.desc Function of API, position. */ - it('fileio_test_stream_write_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_002'); + it('fileio_test_stream_write_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_002'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); try { @@ -1532,8 +1532,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_003 * @tc.desc Function of API, offset. */ - it('fileio_test_stream_write_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_003'); + it('fileio_test_stream_write_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_003'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); try { @@ -1562,8 +1562,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_004 * @tc.desc Function of API, length. */ - it('fileio_test_stream_write_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_004'); + it('fileio_test_stream_write_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_004'); expect(prepareFile(fpath, 'a')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1589,8 +1589,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_005 * @tc.desc Function of API, encoding. */ - it('fileio_test_stream_write_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_005'); + it('fileio_test_stream_write_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_005'); expect(prepareFile(fpath, '')).assertTrue(); let writeStrArray = new Array('aaa', '123'); let encodingArray = new Array('utf-8', 'utf-16'); @@ -1621,8 +1621,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_006 * @tc.desc Function of API, position. */ - it('fileio_test_stream_write_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_006'); + it('fileio_test_stream_write_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_006'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); try { @@ -1653,8 +1653,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_007 * @tc.desc Function of API, offset. */ - it('fileio_test_stream_write_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_007'); + it('fileio_test_stream_write_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_007'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); try { @@ -1685,8 +1685,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_008 * @tc.desc Function of API, length. */ - it('fileio_test_stream_write_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_008'); + it('fileio_test_stream_write_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_008'); expect(prepareFile(fpath, '')).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1714,8 +1714,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_009 * @tc.desc Function of API, invaild fcontent. */ - it('fileio_test_stream_write_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_009'); + it('fileio_test_stream_write_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_009'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1734,8 +1734,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_010 * @tc.desc Function of API, invaild encoding. */ - it('fileio_test_stream_write_sync_010', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_010'); + it('fileio_test_stream_write_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_010'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1757,8 +1757,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_011 * @tc.desc Function of API, invaild position. */ - it('fileio_test_stream_write_sync_011', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_011'); + it('fileio_test_stream_write_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_011'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1780,8 +1780,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_012 * @tc.desc Function of API, invaild offset. */ - it('fileio_test_stream_write_sync_012', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_012'); + it('fileio_test_stream_write_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_012'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { var ss = fileio.createStreamSync(fpath, 'r+'); @@ -1803,8 +1803,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_013 * @tc.desc Function of API, Set all parameters. */ - it('fileio_test_stream_write_sync_013', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_013'); + it('fileio_test_stream_write_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_013'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1831,8 +1831,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_sync_014 * @tc.desc Function of API, Set all parameters. */ - it('fileio_test_stream_write_sync_014', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_014'); + it('fileio_test_stream_write_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_014'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1857,8 +1857,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_write_read_4k_sync * @tc.desc Function of API, read 4k file. */ - it('fileio_test_stream_write_read_4k_sync', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_read_4k_sync'); + it('fileio_test_stream_write_read_4k_sync', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_read_4k_sync'); expect(prepareFile(fpath, 'a')).assertTrue(); expect(fileToWriteOnly(fpath)).assertTrue(); try { @@ -1886,8 +1886,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_flush_sync_000 * @tc.desc Function of API, flushSync. */ - it('fileio_test_stream_flush_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_flush_sync_000'); + it('fileio_test_stream_flush_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_flush_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let text = '0123456789abcdefg'; try { @@ -1909,8 +1909,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_flush_sync_001 * @tc.desc Function of API, error. */ - it('fileio_test_stream_flush_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_flush_sync_001'); + it('fileio_test_stream_flush_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_flush_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let ss = fileio.createStreamSync(fpath, 'r+'); @@ -1930,8 +1930,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_close_sync_000 * @tc.desc Function of API, closeSync. */ - it('fileio_test_stream_close_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_close_sync_000'); + it('fileio_test_stream_close_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_close_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let ss = fileio.createStreamSync(fpath, 'r+'); @@ -1949,8 +1949,8 @@ describe('fileIOTestStream', function () { * @tc.name fileio_test_stream_close_sync_001 * @tc.desc Function of API, error. */ - it('fileio_test_stream_close_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_close_sync_001'); + it('fileio_test_stream_close_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_close_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let ss; try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/List.test.js b/storage/storagefileiojstest/src/main/js/default/test/List.test.js index 287193bdb89dbff0e87a92bc4859ec8ef2c24e2f..232e648ba9eebb7d789b38abc83a49fdb6043a6f 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/List.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/List.test.js @@ -13,7 +13,6 @@ * limitations under the License. */ -require('./File.test.js') require('./FileIO.test.js') require('./FileIODir.test.js') require('./FileIODirent.test.js') @@ -51,7 +50,7 @@ require('./module_fileio/members/rename.test.js'); require('./module_fileio/members/rmdir.test.js'); require('./module_fileio/members/stat.test.js'); require('./module_fileio/members/symlink.test.js'); -require("./module_fileio/members/truncate.test.js"); +require('./module_fileio/members/truncate.test.js'); require('./module_fileio/members/unlink.test.js'); require('./module_fileio/members/write.test.js'); require('./module_fileio/class_dir/read.test.js'); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_constants/constants.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_constants/constants.test.js index 36124d459eb6ffd4bd565b9957eeaee19446b5c7..a69abf694b783a750a1603859fa2562e79627a88 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_constants/constants.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_constants/constants.test.js @@ -21,9 +21,13 @@ import { describe('constants', function () { /** - * @tc.number SUB_DF_FileIO_constants + * @tc.number SUB_DF_FILEIO_CONSTANTS * @tc.name fileio_test_constants * @tc.desc Test constants() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_constants', 0, function () { try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js index 1ae5917b07a27627eb8f13e5ad8e3abfab6c50c9..eaae248f6b1be48a605d2df29a101beea1db5a3a 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/close.test.js @@ -29,12 +29,16 @@ import { describe('fileio_dir_close_read', function () { /** - * @tc.number SUB_DF_FileIO_Dir_close_Async_0000 + * @tc.number SUB_DF_FILEIO_DIR_CLOSE_ASYNC_0000 * @tc.name fileio_test_dir_close_async_000 * @tc.desc Test Dir.closeAsync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_dir_close_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_close_async_000') + 'd'; + let dpath = await nextFileName('fileio_test_dir_close_async_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -55,7 +59,7 @@ describe('fileio_dir_close_read', function () { * @tc.desc Test Dir.closeAsync() interface. */ it('fileio_test_dir_close_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_close_async_001') + 'd'; + let dpath = await nextFileName('fileio_test_dir_close_async_001') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js index 98afc228bb71a84d11948dacd4143501688cec88..013feb3313d4ee5b536f6011c8a2059198c3771e 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dir/read.test.js @@ -24,9 +24,13 @@ describe('fileio_dir_read', function () { * @tc.number SUB_DF_FileIO_ReadSync_0000 * @tc.name fileio_test_dir_read_file_sync_000 * @tc.desc Test Dir.readSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dir_read_file_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_dir_read_file_sync_000'); + it('fileio_test_dir_read_file_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_dir_read_file_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -50,7 +54,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_test_dir_open_close_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_open_close_async_000') + 'd'; + let dpath = await nextFileName('fileio_test_dir_open_close_async_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -71,7 +75,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_test_dir_open_close_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_open_close_async_001') + 'd'; + let dpath = await nextFileName('fileio_test_dir_open_close_async_001') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -93,7 +97,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_test_dir_read_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_read_async_000') + 'd'; + let dpath = await nextFileName('fileio_test_dir_read_async_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -119,7 +123,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_test_dir_read_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_dir_read_async_001') + 'd'; + let dpath = await nextFileName('fileio_test_dir_read_async_001') + 'd'; let fpath = dpath + '/f1'; try { @@ -144,8 +148,8 @@ describe('fileio_dir_read', function () { * @tc.name fileio_dir_read_sync_000 * @tc.desc Test Dir.readSync() interface. */ - it('fileio_dir_read_sync_000', 0, function () { - let dpath = nextFileName('fileio_dir_read_sync_000') + 'd'; + it('fileio_dir_read_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_dir_read_sync_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -168,8 +172,8 @@ describe('fileio_dir_read', function () { * @tc.name fileio_dir_read_sync_001 * @tc.desc Test Dir.readSync() interface. */ - it('fileio_dir_read_sync_001', 0, function () { - let dpath = nextFileName('fileio_dir_read_sync_001') + 'd'; + it('fileio_dir_read_sync_001', 0, async function () { + let dpath = await nextFileName('fileio_dir_read_sync_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -193,7 +197,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_name_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_name_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_name_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -218,7 +222,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_name_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_name_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_name_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -243,7 +247,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isBlockDevice_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isBlockDevice_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isBlockDevice_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -268,7 +272,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isBlockDevice_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isBlockDevice_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isBlockDevice_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -293,7 +297,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isCharacterDevice_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isCharacterDevice_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isCharacterDevice_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -317,7 +321,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isCharacterDevice_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isCharacterDevice_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isCharacterDevice_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -342,7 +346,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isDirectory_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isDirectory_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isDirectory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -367,7 +371,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isDirectory_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isDirectory_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isDirectory_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -392,7 +396,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isFIFO_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isFIFO_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isFIFO_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -417,7 +421,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isFIFO_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isFIFO_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isFIFO_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -442,7 +446,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isFile_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isFile_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isFile_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -467,7 +471,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isFile_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isFile_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isFile_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -492,7 +496,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isSocket_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isSocket_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isSocket_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -517,7 +521,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isSocket_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isSocket_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isSocket_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -542,7 +546,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isSymbolicLink_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isSymbolicLink_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isSymbolicLink_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -567,7 +571,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readSync() interface. */ it('fileio_dir_read_sync_isSymbolicLink_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_sync_isSymbolicLink_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_sync_isSymbolicLink_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -592,7 +596,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -617,7 +621,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_001') + 'd'; let fpath = dpath + '/f1'; try { @@ -643,7 +647,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_name_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_name_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_name_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -668,7 +672,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_name_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_name_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_name_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -693,7 +697,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isBlockDevice_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isBlockDevice_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isBlockDevice_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -718,7 +722,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isBlockDevice_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isBlockDevice_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isBlockDevice_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -744,7 +748,7 @@ describe('fileio_dir_read', function () { */ it('fileio_dir_read_async_isCharacterDevice_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isCharacterDevice_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isCharacterDevice_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -768,7 +772,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isCharacterDevice_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isCharacterDevice_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isCharacterDevice_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -792,7 +796,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -817,7 +821,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -842,7 +846,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isFIFO_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isFIFO_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isFIFO_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -867,7 +871,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isFIFO_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isFIFO_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isFIFO_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -892,7 +896,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -917,7 +921,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -942,7 +946,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -967,7 +971,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -992,7 +996,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1017,7 +1021,7 @@ describe('fileio_dir_read', function () { * @tc.desc Test Dir.readAsync() interface. */ it('fileio_dir_read_async_isDirectory_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; + let dpath = await nextFileName('fileio_dir_read_async_isDirectory_001') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dirent/all.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dirent/all.test.js index 9715da326cab36409a8b637d66c472287410fed5..acf4b065f72b28c758d8eb7d4f70ed82fb0d2500 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dirent/all.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_dirent/all.test.js @@ -21,12 +21,16 @@ import { describe('fileio_dirent', function () { /** - * @tc.number SUB_DF_FileIO_Dirent_Name_0010 + * @tc.number SUB_DF_FILEIO_DIRENT_NAME_0010 * @tc.name fileio_test_dirent_name_001 - * @tc.desc Test dirent interface. + * @tc.desc Test dirent interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_dirent_name_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_dirent_name_001') + 'd'; + let dpath = await nextFileName('fileio_test_dirent_name_001') + 'd'; let fpath = dpath + '/f2'; try { @@ -35,7 +39,6 @@ describe('fileio_dirent', function () { let dd = fileio.opendirSync(dpath); expect(dd !== null).assertTrue(); dd.read(function (err, dirent) { - expect(!err).assertTrue(); expect(dirent !== null).assertTrue(); expect(isString(dirent.name)).assertTrue(); expect(dd.closeSync() == null).assertTrue(); @@ -50,12 +53,16 @@ describe('fileio_dirent', function () { }); /** - * @tc.number SUB_DF_FileIO_Dirent_Name_0000 + * @tc.number SUB_DF_FILEIO_DIRENT_NAME_0000 * @tc.name fileio_test_dirent_name_000 - * @tc.desc Test dirent interface. + * @tc.desc Test dirent interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_dirent_name_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_dirent_name_000') + 'd'; + let dpath = await nextFileName('fileio_test_dirent_name_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -80,10 +87,14 @@ describe('fileio_dirent', function () { /** * @tc.number SUB_DF_FileIO_Dir_ReadSync_0000 * @tc.name fileio_test_dirent_name_000 - * @tc.desc Test readSync() interface. + * @tc.desc Test readSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_name_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_name_000') + 'd'; + it('fileio_test_dirent_name_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_name_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -104,12 +115,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISBLOCKDEVICE_0000 * @tc.name fileio_test_dirent_is_block_device_000 - * @tc.desc Test isBlockDevice() interface. + * @tc.desc Test isBlockDevice() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_block_device_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_block_device_000') + 'd'; + it('fileio_test_dirent_is_block_device_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_block_device_000') + 'd'; let fpath = dpath + '/f1'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -129,12 +144,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISBLOCKDEVICE_0010 * @tc.name fileio_test_dirent_is_block_device_001 - * @tc.desc Test isBlockDevice() interface. + * @tc.desc Test isBlockDevice() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_block_device_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_block_device_001') + 'd'; + it('fileio_test_dirent_is_block_device_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_block_device_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -155,12 +174,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISCHARACTERDEVICE_0000 * @tc.name fileio_test_dirent_is_character_device_000 - * @tc.desc Test isCharacterDevice() interface. + * @tc.desc Test isCharacterDevice() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_character_device_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_character_device_000') + 'd'; + it('fileio_test_dirent_is_character_device_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_character_device_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -181,12 +204,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISCHARACTERDEVICE_0010 * @tc.name fileio_test_dirent_is_character_device_001 - * @tc.desc Test isCharacterDevice() interface. + * @tc.desc Test isCharacterDevice() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_character_device_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_character_device_001') + 'd'; + it('fileio_test_dirent_is_character_device_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_character_device_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -207,12 +234,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISDIRECTORY_0000 * @tc.name fileio_test_dirent_is_directory_000 - * @tc.desc Test isDirectory() interface. + * @tc.desc Test isDirectory() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_directory_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_directory_000') + 'd'; + it('fileio_test_dirent_is_directory_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_directory_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -235,10 +266,14 @@ describe('fileio_dirent', function () { /** * @tc.number SUB_DF_FileIO_Dir_IsDirectory_0010 * @tc.name fileio_test_dirent_is_directory_001 - * @tc.desc Test isDirectory() interface. + * @tc.desc Test isDirectory() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_directory_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_directory_001') + 'd'; + it('fileio_test_dirent_is_directory_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_directory_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -259,12 +294,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISFIFO_0000 * @tc.name fileio_test_dirent_is_fifo_000 - * @tc.desc Test isFIFO() interface. + * @tc.desc Test isFIFO() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_fifo_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_fifo_000') + 'd'; + it('fileio_test_dirent_is_fifo_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_fifo_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -285,12 +324,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISFIFO_0010 * @tc.name fileio_test_dirent_is_fifo_001 - * @tc.desc Test isFIFO() interface. + * @tc.desc Test isFIFO() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_fifo_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_fifo_001') + 'd'; + it('fileio_test_dirent_is_fifo_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_fifo_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -311,12 +354,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISFILE_0000 * @tc.name fileio_test_dirent_is_file_000 - * @tc.desc Test isFILE() interface. + * @tc.desc Test isFILE() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_file_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_file_000') + 'd'; + it('fileio_test_dirent_is_file_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_file_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -337,12 +384,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISFILE_0010 * @tc.name fileio_test_dirent_is_file_001 - * @tc.desc Test isFILE() interface. + * @tc.desc Test isFILE() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_file_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_file_001') + 'd'; + it('fileio_test_dirent_is_file_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_file_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -363,12 +414,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_DIR_ISSOCKET_0000 * @tc.name fileio_test_dirent_is_socket_000 - * @tc.desc Test isSocket() interface. + * @tc.desc Test isSocket() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_socket_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_socket_000') + 'd'; + it('fileio_test_dirent_is_socket_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_socket_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -389,12 +444,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISSOCKET_0010 * @tc.name fileio_test_dirent_is_socket_001 - * @tc.desc Test isSocket() interface. + * @tc.desc Test isSocket() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_socket_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_socket_001') + 'd'; + it('fileio_test_dirent_is_socket_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_socket_001') + 'd'; let fpath = dpath + '/f1'; let dd; @@ -417,10 +476,14 @@ describe('fileio_dirent', function () { /** * @tc.number SUB_DF_FileIO_Dir_IsSymbolicLink_0000 * @tc.name fileio_test_dirent_is_symbolic_link_000 - * @tc.desc Test isSymbolicLink() interface. + * @tc.desc Test isSymbolicLink() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_symbolic_link_000', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_000') + 'd'; + it('fileio_test_dirent_is_symbolic_link_000', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_symbolic_link_000') + 'd'; let fpath = dpath + '/f1'; try { @@ -441,12 +504,16 @@ describe('fileio_dirent', function () { }) /** - * @tc.number SUB_DF_FileIO_Dir_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_DIR_ISSYMBOLICLINK_0010 * @tc.name fileio_test_dirent_is_symbolic_link_001 - * @tc.desc Test isSymbolicLink() interface. + * @tc.desc Test isSymbolicLink() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_dirent_is_symbolic_link_001', 0, function () { - let dpath = nextFileName('fileio_test_dirent_is_symbolic_link_001') + 'd'; + it('fileio_test_dirent_is_symbolic_link_001', 0, async function () { + let dpath = await nextFileName('fileio_test_dirent_is_symbolic_link_001') + 'd'; let fpath = dpath + '/f1'; let dd; 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 d075bb0ceb00afd3e4590b01010cd57663e98455..b2ecc1e1b297a674ffd434818985085a2f5a5275 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 @@ -21,12 +21,16 @@ import { describe('fileio_stream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_CREATESTREAMSYNC_0000 * @tc.name fileio_test_stream_create_stream_sync_000 * @tc.desc Test createStreamSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_create_stream_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_000'); + it('fileio_test_stream_create_stream_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -41,12 +45,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_CREATESTREAMSYNC_0010 * @tc.name fileio_test_stream_create_stream_sync_001 * @tc.desc Test createStreamSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_create_stream_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_001'); + it('fileio_test_stream_create_stream_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_001'); try { fileio.createStreamSync(fpath, 'r+'); @@ -56,12 +64,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamSync_0020 + * @tc.number SUB_DF_FILEIO_STREAM_CREATESTREAMSYNC_0020 * @tc.name fileio_test_stream_create_stream_sync_002 * @tc.desc Test createStreamSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_create_stream_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_create_stream_sync_002'); + it('fileio_test_stream_create_stream_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_create_stream_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -73,12 +85,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0000 * @tc.name fileio_test_stream_read_sync_000 * @tc.desc Test readSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_000'); + it('fileio_test_stream_read_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -95,14 +111,18 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0010 * @tc.name fileio_test_stream_read_sync_001 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_001', 0, function () { + it('fileio_test_stream_read_sync_001', 0, async function () { let bufLen = 5; expect(FILE_CONTENT.length > bufLen).assertTrue(); - let fpath = nextFileName('fileio_test_stream_read_sync_001'); + let fpath = await nextFileName('fileio_test_stream_read_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -120,12 +140,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0020 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0020 * @tc.name fileio_test_stream_read_sync_002 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_002'); + it('fileio_test_stream_read_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -143,12 +167,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0030 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0030 * @tc.name fileio_test_stream_read_sync_003 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_003'); + it('fileio_test_stream_read_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -166,14 +194,18 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0040 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0040 * @tc.name fileio_test_stream_read_sync_004 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_004', 0, function () { + it('fileio_test_stream_read_sync_004', 0, async function () { let ss; const invalidOffset = 99999; - let fpath = nextFileName('fileio_test_stream_read_sync_004'); + let fpath = await nextFileName('fileio_test_stream_read_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -189,14 +221,18 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0050 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0050 * @tc.name fileio_test_stream_read_sync_005 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_005', 0, function () { + it('fileio_test_stream_read_sync_005', 0, async function () { let ss; const invalidLength = 9999; - let fpath = nextFileName('fileio_test_stream_read_sync_005'); + let fpath = await nextFileName('fileio_test_stream_read_sync_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -212,12 +248,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadSync_0060 + * @tc.number SUB_DF_FILEIO_STREAM_READSYNC_0060 * @tc.name fileio_test_stream_read_sync_006 * @tc.desc Test the readSync method of class Stream. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_sync_006'); + it('fileio_test_stream_read_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_sync_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -236,12 +276,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_WriteSync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_WRITESYNC_0000 * @tc.name fileio_test_stream_write_sync_000 * @tc.desc Test writeSync() interface. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_write_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_write_sync_000'); + it('fileio_test_stream_write_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_write_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 9c72e4f2fc83c47cb8c9f88a11bdf3128f6e7bdc..2f39f1d18e026fee63349abeac91cb8c05ad20a4 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 @@ -21,12 +21,16 @@ import { describe('fileio_stream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_FdopenStreamSync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_FDOPENSTREAMSYNC_0000 * @tc.name fileio_test_stream_fdopen_stream_sync_000 - * @tc.desc Test fdopenStreamSync() interface. + * @tc.desc Test fdopenStreamSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_fdopen_stream_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_sync_000'); + it('fileio_test_stream_fdopen_stream_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -42,9 +46,13 @@ describe('fileio_stream', function () { }) /** - * @tc.number SUB_DF_FileIO_Stream_FdopenStreamSync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_FDOPENSTREAMSYNC_0010 * @tc.name fileio_test_stream_fdopen_stream_sync_001 - * @tc.desc Test fdopenStreamSync() interface. + * @tc.desc Test fdopenStreamSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_fdopen_stream_sync_001', 0, function () { @@ -56,12 +64,16 @@ describe('fileio_stream', function () { }) /** - * @tc.number SUB_DF_FileIO_Stream_FdopenStreamAsync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_FDOPENSTREAMASYNC_0000 * @tc.name fileio_test_stream_fdopen_stream_async_000 - * @tc.desc Test fdopenStreamSync() interface. + * @tc.desc Test fdopenStreamSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_fdopen_stream_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_async_000'); + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -79,12 +91,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_FdopenStreamAsync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_FDOPENSTREAMASYNC_0010 * @tc.name fileio_test_stream_fdopen_stream_async_001 - * @tc.desc Test fdopenStreamSync() interface. + * @tc.desc Test fdopenStreamSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_fdopen_stream_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_fdopen_stream_async_001'); + let fpath = await nextFileName('fileio_test_stream_fdopen_stream_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/flush.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/flush.test.js index bf7c0c0913bd8740f2023ef0d4926ed2ffe5f38a..db288c5fe6d57b6356eff2167eb18d8666c74f12 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/flush.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/flush.test.js @@ -21,12 +21,16 @@ import { describe('fileio_stream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_FlushSync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_FLUSHSYNC_0000 * @tc.name fileio_test_stream_flush_sync_000 - * @tc.desc Test flushSync() interface. + * @tc.desc Test flushSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_flush_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_stream_flush_sync_000'); + it('fileio_test_stream_flush_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_flush_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -43,12 +47,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_FlushAsync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_FLUSHASYNC_0000 * @tc.name fileio_test_stream_flush_async_000 - * @tc.desc Test flushSync() interface. + * @tc.desc Test flushSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_flush_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_flush_async_000'); + let fpath = await nextFileName('fileio_test_stream_flush_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -69,12 +77,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_FlushAsync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_FLUSHASYNC_0010 * @tc.name fileio_test_stream_flush_async_001 - * @tc.desc Test flushSync() interface. + * @tc.desc Test flushSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_flush_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_flush_async_001'); + let fpath = await nextFileName('fileio_test_stream_flush_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/read.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/read.test.js index 3541035d088c7d69befacc6d8b4b6464dbd19251..3ee5e9f7a69e67271f0ec590eedebda61ca80aae 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/read.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/read.test.js @@ -21,12 +21,16 @@ import { describe('fileio_stream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_ReadAsync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_READASYNC_0000 * @tc.name fileio_test_stream_read_async_000 - * @tc.desc Test readAsync() interface. + * @tc.desc Test readAsync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_read_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_read_async_000'); + let fpath = await nextFileName('fileio_test_stream_read_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -44,12 +48,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_ReadAsync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_READASYNC_0010 * @tc.name fileio_test_stream_read_async_001 - * @tc.desc Test readAsync() interface. + * @tc.desc Test readAsync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_read_async_001', 0, function () { - let fpath = nextFileName('fileio_test_stream_read_async_001'); + it('fileio_test_stream_read_async_001', 0, async function () { + let fpath = await nextFileName('fileio_test_stream_read_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js index 3e76a12cd06b553836a797b3f2784f6ce8a02f8d..f982f30204970c817cf18341f2cb34bd32dcc77b 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_stream/write.test.js @@ -14,19 +14,23 @@ */ import { - fileio, FILE_CONTENT, prepareFile, nextFileName, + fileio, FILE_CONTENT, prepareFile, nextFileName1, nextFileName, describe, it, expect, } from '../../Common'; describe('fileio_stream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_WriteASync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_WRITEASYNC_0000 * @tc.name fileio_test_stream_write_async_000 - * @tc.desc Test Stream.write() interface. + * @tc.desc Test Stream.write() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_write_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_write_async_000'); + let fpath = await nextFileName('fileio_test_stream_write_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -46,12 +50,16 @@ describe('fileio_stream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_WriteASync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_WRITEASYNC_0010 * @tc.name fileio_test_stream_write_async_001 - * @tc.desc Test Stream.write() interface. + * @tc.desc Test Stream.write() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_write_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_write_async_001'); + let fpath = nextFileName1('fileio_test_stream_write_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_watcher/createWatcher.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_watcher/createWatcher.test.js index a22da2a361ebcf7343e125464d1cb4bd1124d636..c9c41c0f61af267598d7d307760476cf3f5bd4d6 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_watcher/createWatcher.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/class_watcher/createWatcher.test.js @@ -21,12 +21,16 @@ import { describe('fileio_createWatcher', function () { /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_000 * @tc.desc Test createWatcher() interface. rename 1 times stopSync() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_000'); + let fpath = await nextFileName('fileio_test_createWatcher_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 1; @@ -51,12 +55,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_001 * @tc.desc Test createWatcher() interface. write 1 times stopSync() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_001'); + let fpath = await nextFileName('fileio_test_createWatcher_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 2; @@ -80,12 +88,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_002 * @tc.desc Test createWatcher() interface. rename 1 time ,stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_002'); + let fpath = await nextFileName('fileio_test_createWatcher_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 1; @@ -109,12 +121,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_003 * @tc.desc Test createWatcher() interface. rename 1 time ,stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_003'); + let fpath = await nextFileName('fileio_test_createWatcher_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 1; @@ -138,12 +154,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_004 * @tc.desc Test createWatcher() interface.write 1 time ,stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_004'); + let fpath = await nextFileName('fileio_test_createWatcher_async_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 2; @@ -169,12 +189,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_005 * @tc.desc Test createWatcher() interface. rename 3 times + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_005', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_005'); + let fpath = await nextFileName('fileio_test_createWatcher_async_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 1; @@ -201,12 +225,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_006 * @tc.desc Test createWatcher() interface.write 2 times, stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_006', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_006'); + let fpath = await nextFileName('fileio_test_createWatcher_async_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 2; @@ -232,12 +260,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_007 * @tc.desc Test createWatcher() interface.rename 1 times, write 1 times, stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_007', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_007'); + let fpath = await nextFileName('fileio_test_createWatcher_async_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 3; @@ -263,12 +295,16 @@ describe('fileio_createWatcher', function () { }); /** - * @tc.number SUB_DF_FileIO_createWatcher_000 + * @tc.number SUB_DF_FILEIO_CREATEWATCHER_000 * @tc.name fileio_test_createWatcher_008 * @tc.desc Test createWatcher() interface.rename 1 times, write 1 times, stop() + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_createWatcher_async_008', 0, async function (done) { - let fpath = nextFileName('fileio_test_createWatcher_async_007'); + let fpath = await nextFileName('fileio_test_createWatcher_async_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let event = 3; 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 7cdad1d56995ddb2609dc38f6abb466e7842fe48..3f25778c7280636e8f16c68fc0d5777a70142c51 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 @@ -21,13 +21,17 @@ import { describe('fileio_access', function () { /** - * @tc.number SUB_DF_FileIO_AccessSync_0000 + * @tc.number SUB_DF_FILEIO_ACCESSSYNC_0000 * @tc.name fileio_test_access_sync_000 * @tc.desc Test accessSync() interface. - * This interface shall work properly in normal case. + * This interface shall work properly in normal case + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_access_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_000'); + it('fileio_test_access_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -40,13 +44,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessSync_0010 + * @tc.number SUB_DF_FILEIO_ACCESSSYNC_0010 * @tc.name fileio_test_access_sync_001 * @tc.desc Test accessSync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_access_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_001'); + it('fileio_test_access_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -59,13 +67,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessSync_0020 + * @tc.number SUB_DF_FILEIO_ACCESSSYNC_0020 * @tc.name fileio_test_access_sync_002 * @tc.desc Test accessSync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_access_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_002'); + it('fileio_test_access_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -78,13 +90,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessSync_0030 + * @tc.number SUB_DF_FILEIO_ACCESSSYNC_0030 * @tc.name fileio_test_access_sync_003 * @tc.desc Test accessSync() interface. * This interface shall throw an exception when the fpath is not given. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_access_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_access_sync_003'); + it('fileio_test_access_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_access_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -97,13 +113,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessSync_0040 + * @tc.number SUB_DF_FILEIO_ACCESSSYNC_0040 * @tc.name fileio_test_access_sync_004 * @tc.desc Test accessSync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_access_sync_004', 0, function () { - let fpath = nextFileName('fileIOTest'); + it('fileio_test_access_sync_004', 0, async function () { + let fpath = await nextFileName('fileIOTest'); try { fileio.accessSync(fpath); @@ -113,13 +133,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessAsync_0000 + * @tc.number SUB_DF_FILEIO_ACCESSASYNC_0000 * @tc.name fileio_test_access_async_000 * @tc.desc Test accessAsync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_access_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_access_async_000'); + let fpath = await nextFileName('fileio_test_access_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -133,13 +157,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessAsync_0010 + * @tc.number SUB_DF_FILEIO_ACCESSASYNC_0010 * @tc.name fileio_test_access_async_001 * @tc.desc Test accessAsync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_access_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_access_async_001'); + let fpath = await nextFileName('fileio_test_access_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -159,13 +187,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessAsync_0020 + * @tc.number SUB_DF_FILEIO_ACCESSASYNC_0020 * @tc.name fileio_test_access_async_002 * @tc.desc Test accessAsync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_access_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_access_async_002'); + let fpath = await nextFileName('fileio_test_access_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -180,13 +212,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessAsync_0030 + * @tc.number SUB_DF_FILEIO_ACCESSASYNC_0030 * @tc.name fileio_test_access_async_003 * @tc.desc Test accessAsync() interface. - * This interface shall throw an exception when the fpath is not given. + * This interface shall throw an exception when the fpath is not given + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_access_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_access_async_003'); + let fpath = await nextFileName('fileio_test_access_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -207,13 +243,17 @@ describe('fileio_access', function () { }); /** - * @tc.number SUB_DF_FileIO_AccessAsync_0040 + * @tc.number SUB_DF_FILEIO_ACCESSASYNC_0040 * @tc.name fileio_test_access_async_004 * @tc.desc Test accessAsync() interface. * This interface shall throw an exception when the fpath is not given. + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_access_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_test_access_async_004'); + let fpath = await nextFileName('fileio_test_access_async_004'); try { fileio diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chmod.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chmod.test.js index a6e5508460738c424b67f049ae994bfaa162c385..7016e11d1dd020d6ff37292077556bf6d5a02bbc 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chmod.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chmod.test.js @@ -21,12 +21,16 @@ import { describe('fileio_chmod', function () { /** - * @tc.number SUB_DF_FileIO_ChmodSync_0000 + * @tc.number SUB_DF_FILEIO_CHMODSYNC_0000 * @tc.name fileio_test_chmod_sync_000 - * @tc.desc Test chmodSync() interfaces. + * @tc.desc Test chmodSync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_chmod_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_000'); + it('fileio_test_chmod_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -40,12 +44,16 @@ describe('fileio_chmod', function () { }); /** - * @tc.number SUB_DF_FileIO_ChmodSync_0010 + * @tc.number SUB_DF_FILEIO_CHMODSYNC_0010 * @tc.name fileio_test_chmod_sync_001 - * @tc.desc Test chmodSync() interfaces. + * @tc.desc Test chmodSync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_chmod_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_chmod_sync_001'); + it('fileio_test_chmod_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_chmod_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -59,12 +67,16 @@ describe('fileio_chmod', function () { }); /** - * @tc.number SUB_DF_FileIO_ChmodAsync_0000 + * @tc.number SUB_DF_FILEIO_CHMODASYNC_0000 * @tc.name fileio_test_chmod_async_000 - * @tc.desc Test chmodAsync() interfaces. + * @tc.desc Test chmodAsync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_chmod_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_chmod_async_001'); + let fpath = await nextFileName('fileio_test_chmod_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -87,12 +99,16 @@ describe('fileio_chmod', function () { }); /** - * @tc.number SUB_DF_FileIO_ChmodAsync_0010 + * @tc.number SUB_DF_FILEIO_CHMODASYNC_0010 * @tc.name fileio_test_chmod_async_001 - * @tc.desc Test chmodAsync() interfaces. + * @tc.desc Test chmodAsync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_chmod_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_chmod_async_001'); + let fpath = await nextFileName('fileio_test_chmod_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -115,16 +131,20 @@ describe('fileio_chmod', function () { }); /** - * @tc.number SUB_DF_FileIO_ChmodAsync_0020 + * @tc.number SUB_DF_FILEIO_CHMODASYNC_0020 * @tc.name fileio_test_chmod_async_002 - * @tc.desc Test chmodAsync() interfaces. + * @tc.desc Test chmodAsync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_chmod_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_chmod_async_000'); + let fpath = await nextFileName('fileio_test_chmod_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.chmod(fpath, 0o660, async function () { + await fileio.chmod(fpath, 0o660, function () { expect((fileio.statSync(fpath).mode & 0o777) == 0o660).assertTrue(); fileio.unlinkSync(fpath); done(); @@ -136,16 +156,20 @@ describe('fileio_chmod', function () { }); /** - * @tc.number SUB_DF_FileIO_ChmodAsync_0030 + * @tc.number SUB_DF_FILEIO_CHMODASYNC_0030 * @tc.name fileio_test_chmod_async_003 - * @tc.desc Test chmodAsync() interfaces. + * @tc.desc Test chmodAsync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_chmod_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_chmod_async_000'); + let fpath = await nextFileName('fileio_test_chmod_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { - await fileio.chmod(fpath, 0o0700, async function () { + await fileio.chmod(fpath, 0o0700, function () { expect((fileio.statSync(fpath).mode & 0o777) == 0o0700).assertTrue(); fileio.unlinkSync(fpath); done(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chown.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chown.test.js index 703cf38b61d3d7fe7cbfa6ffb2eda61e63e4585b..8c4f401a5fe09d54f838f4e51f10f6557df79f21 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chown.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/chown.test.js @@ -21,12 +21,16 @@ import { describe('fileio_chown', function () { /** - * @tc.number SUB_DF_FileIO_ChownSync_000 + * @tc.number SUB_DF_FILEIO_CHOWNSYNC_000 * @tc.name fileio_test_chown_sync_000 - * @tc.desc Test chownSync() interface. + * @tc.desc Test chownSync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_chown_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_chown_sync_000'); + it('fileio_test_chown_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_chown_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -38,12 +42,16 @@ describe('fileio_chown', function () { }); /** - * @tc.number SUB_DF_FileIO_ChownASync_000 + * @tc.number SUB_DF_FILEIO_CHOWNASYNC_000 * @tc.name fileio_test_chown_async_00 - * @tc.desc Test chownASync() interface. + * @tc.desc Test chownASync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_chown_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_chown_Async_000'); + let fpath = await nextFileName('fileio_chown_Async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -57,12 +65,16 @@ describe('fileio_chown', function () { }); /** - * @tc.number SUB_DF_FileIO_ChownASync_001 + * @tc.number SUB_DF_FILEIO_CHOWNASYNC_001 * @tc.name fileio_test_chown_async_00 - * @tc.desc Test chownASync() interface. + * @tc.desc Test chownASync() interface + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_chown_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_chown_Async_001'); + let fpath = await nextFileName('fileio_chown_Async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); 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 b94e1414c4f960f1697e0841bb18d15ebb00c219..3ff912bdd4fb3bd172476b067359c0cabb479b33 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 @@ -21,9 +21,13 @@ import { describe('fileio_close', function () { /** - * @tc.number SUB_DF_FileIO_CloseSync_0000 + * @tc.number SUB_DF_FILEIO_CLOSESYNC_0000 * @tc.name fileio_test_close_sync_000 - * @tc.desc Test closeSync() interfaces. + * @tc.desc Test closeSync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_close_sync_000', 0, function () { try { @@ -34,9 +38,13 @@ describe('fileio_close', function () { }) /** - * @tc.number SUB_DF_FileIO_CloseSync_0010 + * @tc.number SUB_DF_FILEIO_CLOSESYNC_0010 * @tc.name fileio_test_close_sync_001 - * @tc.desc Test closeSync() interfaces. + * @tc.desc Test closeSync() interfaces + * @tc.size MEDIUM(中型) + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_close_sync_001', 0, function () { try { 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 50b31c6f6b3d4e5da79489699f19adde381dbf89..84a6e53817c578ef045ed53fcbbcc9cc11f70eea 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 @@ -21,12 +21,16 @@ import { describe('fileio_copyfile', function () { /** - * @tc.number SUB_DF_FileIO_CopyFileSync_0000 + * @tc.number SUB_DF_FILEIO_COPY_FILE_SYNC_0000 * @tc.name fileio_copy_file_sync_000 * @tc.desc Test copyFileSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_copy_file_sync_000', 0, function () { - let fpath = nextFileName('fileio_copy_file_sync_000'); + it('fileio_copy_file_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_copy_file_sync_000'); let fpathTarget = fpath + 'tgt'; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -41,12 +45,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileSync_0010 + * @tc.number SUB_DF_FILEIO_COPY_FILE_SYNC_0010 * @tc.name fileio_copy_file_sync_001 * @tc.desc Test copyFileSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_copy_file_sync_001', 0, function () { - let fpath = nextFileName('fileio_copy_file_sync_001'); + it('fileio_copy_file_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_copy_file_sync_001'); let fpathTarget = fpath + 'tgt'; try { @@ -57,9 +65,13 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileSync_0020 + * @tc.number SUB_DF_FILEIO_COPY_FILE_SYNC_0020 * @tc.name fileio_copy_file_sync_002 * @tc.desc Test copyFileSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_sync_002', 0, function () { try { @@ -70,12 +82,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileAsync_0000 + * @tc.number SUB_DF_FILEIO_COPY_FILE_ASYNC_0000 * @tc.name fileio_copy_file_async_000 * @tc.desc Test copyFileAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_copy_file_async_000'); + let fpath = await nextFileName('fileio_copy_file_async_000'); let fpathTarget = fpath + 'tgt'; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -91,12 +107,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileAsync_0010 + * @tc.number SUB_DF_FILEIO_COPY_FILE_ASYNC_0010 * @tc.name fileio_copy_file_async_001 * @tc.desc Test copyFileAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_copy_file_async_000'); + let fpath = await nextFileName('fileio_copy_file_async_000'); let fpathTarget = fpath + 'tgt'; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -113,12 +133,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileAsync_0020 + * @tc.number SUB_DF_FILEIO_COPY_FILE_ASYNC_0020 * @tc.name fileio_copy_file_async_002 * @tc.desc Test copyFileAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_copy_file_async_002'); + let fpath = await nextFileName('fileio_copy_file_async_002'); let fpathTarget = fpath + 'tgt'; try { expect(await fileio.copyFile(fpath, fpathTarget).indexOf('') > -1).assertTrue(); @@ -129,12 +153,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileAsync_0030 + * @tc.number SUB_DF_FILEIO_COPY_FILE_ASYNC_0030 * @tc.name fileio_copy_file_async_003 * @tc.desc Test copyFileAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_copy_file_async_003'); + let fpath = await nextFileName('fileio_copy_file_async_003'); try { fileio .copyFile(1, fpath) @@ -151,12 +179,16 @@ describe('fileio_copyfile', function () { }); /** - * @tc.number SUB_DF_FileIO_CopyFileAsync_0040 + * @tc.number SUB_DF_FILEIO_COPY_FILE_ASYNC_0040 * @tc.name fileio_copy_file_async_004 * @tc.desc Test copyFileAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_copy_file_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_copy_file_async_004'); + let fpath = await nextFileName('fileio_copy_file_async_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { expect(await fileio.copyFile(fpath, 1) == null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js index 80670e175b3cf7baef38fa63e651032985bbd316..7a5ff724f3743d17910d403da91d34d7c80dbddc 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/createStream.test.js @@ -21,12 +21,16 @@ import { describe('fileio_createStream', function () { /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamAsync_0000 + * @tc.number SUB_DF_FILEIO_STREAM_CREATE_STREAM_ASYNC_0000 * @tc.name fileio_test_stream_create_stream_async_000 * @tc.desc Test createStreamAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_create_stream_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_create_stream_async_000'); + let fpath = await nextFileName('fileio_test_stream_create_stream_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -43,17 +47,20 @@ describe('fileio_createStream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamAsync_0010 + * @tc.number SUB_DF_FILEIO_STREAM_CREATE_STREAM_ASYNC_0010 * @tc.name fileio_test_stream_create_stream_async_001 * @tc.desc Test createStreamAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_create_stream_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_create_stream_async_001'); + let fpath = await nextFileName('fileio_test_stream_create_stream_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio.createStream(fpath, 'r+', function (err, stream) { - expect(!err).assertTrue(); expect(stream.closeSync() == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -65,17 +72,20 @@ describe('fileio_createStream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamAsync_0020 + * @tc.number SUB_DF_FILEIO_STREAM_CREATE_STREAM_ASYNC_0020 * @tc.name fileio_test_stream_create_stream_async_002 * @tc.desc Test createStreamAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_create_stream_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_create_stream_async_002'); + let fpath = await nextFileName('fileio_test_stream_create_stream_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio.createStream(fpath, 'r+', function (err, stream) { - expect(!err).assertTrue(); expect(stream.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(stream.closeSync() == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); @@ -88,12 +98,16 @@ describe('fileio_createStream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamAsync_0030 + * @tc.number SUB_DF_FILEIO_STREAM_CREATE_STREAM_ASYNC_0030 * @tc.name fileio_test_stream_create_stream_async_003 * @tc.desc Test createStreamAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stream_create_stream_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_stream_create_stream_async_003'); + let fpath = await nextFileName('fileio_test_stream_create_stream_async_003'); try { fileio.createStream(fpath, 'r+', function (err) { @@ -106,12 +120,16 @@ describe('fileio_createStream', function () { }); /** - * @tc.number SUB_DF_FileIO_Stream_CreateStreamAsync_0030 + * @tc.number SUB_DF_FILEIO_STREAM_CREATE_STREAM_ASYNC_0030 * @tc.name fileio_test_stream_create_stream_async_003 * @tc.desc Test createStreamSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_stream_create_stream_async_004', 0, function (done) { - let fpath = nextFileName('fileio_test_stream_create_stream_async_004'); + it('fileio_test_stream_create_stream_async_004', 0, async function (done) { + let fpath = await nextFileName('fileio_test_stream_create_stream_async_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 23c79188cf29a77f0c6e39e511dfac6f27bed852..7c6e61fcc2821b440f6de422fb917d49c75f2825 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 @@ -11,7 +11,7 @@ * 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, @@ -21,12 +21,16 @@ import { describe('fileio_fchmod', function () { /** - * @tc.number SUB_DF_FileIO_FchmodAsync_0000 + * @tc.number SUB_DF_FILEIO_FCHMOD_ASYNC_0000 * @tc.name fileio_test_fchmod_async_000 * @tc.desc Test fchmodAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fchmod_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_fchmod_async_000'); + let fpath = await nextFileName('fileio_test_fchmod_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -49,12 +53,16 @@ describe('fileio_fchmod', function () { }); /** - * @tc.number SUB_DF_FileIO_FchmodAsync_0010 + * @tc.number SUB_DF_FILEIO_FCHMOD_ASYNC_0010 * @tc.name fileio_test_fchmod_async_001 * @tc.desc Test fchmodAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fchmod_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_fchmod_async_001'); + let fpath = await nextFileName('fileio_test_fchmod_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio @@ -81,12 +89,16 @@ describe('fileio_fchmod', function () { }); /** - * @tc.number SUB_DF_FileIO_FchmodSync_0000 + * @tc.number SUB_DF_FILEIO_FCHMOD_SYNC_0000 * @tc.name fileio_test_fchmod_sync_000 * @tc.desc Test fchmodSync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fchmod_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fchmod_sync_000'); + it('fileio_test_fchmod_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fchmod_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -102,9 +114,13 @@ describe('fileio_fchmod', function () { }); /** - * @tc.number SUB_DF_FileIO_FchmodSync_0010 + * @tc.number SUB_DF_FILEIO_FCHMOD_SYNC_0010 * @tc.name fileio_test_fchmod_sync_001 * @tc.desc Test fchmodSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fchmod_sync_001', 0, function () { try { @@ -115,14 +131,17 @@ describe('fileio_fchmod', function () { }); /** - * @tc.number SUB_DF_FileIO_Fchmod_0020 + * @tc.number SUB_DF_FILEIO_FCHMOD_ASYNC_0020 * @tc.name fileio_test_fchmod_async_002 * @tc.desc Test fchmod() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fchmod_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_fchmod_async_002'); + let fpath = await nextFileName('fileio_test_fchmod_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - try { await fileio.open(fpath, 0o1, 0o020).then(function (fd) { fileio.fchmod(fd, 0o100, function (err) { @@ -138,14 +157,17 @@ describe('fileio_fchmod', function () { }); /** - * @tc.number SUB_DF_FileIO_Fchmod_0030 + * @tc.number SUB_DF_FILEIO_FCHMOD_ASYNC_0030 * @tc.name fileio_test_fchmod_async_003 * @tc.desc Test fchmod() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fchmod_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_fchmod_async_003'); + let fpath = await nextFileName('fileio_test_fchmod_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - try { let fd = await fileio.open(fpath, 0o1, 0o020); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchown.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchown.test.js index 47e065deb868754e607488705f04584161fb0de0..ea5aa0ebeb629d134db92fe211d3f28839cc3771 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchown.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/fchown.test.js @@ -18,15 +18,19 @@ import { describe, it, expect, } from '../../Common'; -describe('fileio_fchown', function () { +describe('fileio_fchown', async function () { /** - * @tc.number SUB_DF_FileIO_Fchown_0010 - * @tc.name fileio_test_fchown_001 + * @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0000 + * @tc.name fileio_test_fchown_async_000 * @tc.desc Test fchown() and open() and statSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fchown_001', 0, function (done) { - let fpath = nextFileName('fileio_test_fchown_001'); + it('fileio_test_fchown_async_000', 0, async function (done) { + let fpath = await nextFileName('fileio_test_fchown_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -43,12 +47,16 @@ describe('fileio_fchown', function () { }); /** - * @tc.number SUB_DF_FileFchown_Fchown_0020 - * @tc.name fileio_test_fchown_002 + * @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0010 + * @tc.name fileio_test_fchown_async_001 * @tc.desc Test fchown() and open() and statSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fchown_002', 0, function (done) { - let fpath = nextFileName('fileio_test_fchown_002'); + it('fileio_test_fchown_async_001', 0, async function (done) { + let fpath = await nextFileName('fileio_test_fchown_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -64,12 +72,16 @@ describe('fileio_fchown', function () { }); /** - * @tc.number SUB_DF_FileFchown_Fchown_0030 - * @tc.name fileio_test_fchown_003 + * @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0020 + * @tc.name fileio_test_fchown_async_002 * @tc.desc Test fchown() and open() and statSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fchown_003', 0, function (done) { - let fpath = nextFileName('fileio_test_fchown_003'); + it('fileio_test_fchown_async_002', 0, async function (done) { + let fpath = await nextFileName('fileio_test_fchown_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -86,12 +98,16 @@ describe('fileio_fchown', function () { }); /** - * @tc.number SUB_DF_FileIO_FchownSync_0030 - * @tc.name fileio_test_fchown_sync_003 + * @tc.number SUB_DF_FILEIO_FCHOWN_SYNC_0000 + * @tc.name fileio_test_fchown_sync_000 * @tc.desc Test fchownSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fchown_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_fchown_sync_003'); + it('fileio_test_fchown_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fchown_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); 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 26f0d309e43978ab08686653c1639df753b9e637..aa02762bf2e44bfb70694320b851305490a0a568 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 @@ -18,15 +18,19 @@ import { describe, it, expect, } from '../../Common'; -describe('fileio_fdatasync', function () { +describe('fileio_fdatasync', async function () { /** - * @tc.number SUB_DF_FileIO_FdatasyncSync_0000 - * @tc.name fileio_test_fdatasync_sync_000 + * @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0000 + * @tc.name fileio_test_fdatasync_async_000 * @tc.desc Test fdatasync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdatasync_000', 0, async function () { - let fpath = nextFileName('fileio_test_fdatasync_000'); + it('fileio_test_fdatasync_async_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fdatasync_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -36,18 +40,22 @@ describe('fileio_fdatasync', function () { expect(fileio.unlinkSync(fpath) == null).assertTrue(); }); } catch (e) { - console.log('fileio_test_fdatasync_000 has failed for ' + e); + console.log('fileio_test_fdatasync_async_000 has failed for ' + e); expect(null).assertFail(); } }); /** - * @tc.number SUB_DF_FileIO_FdatasyncSync_0010 - * @tc.name fileio_test_fdatasync_sync_001 + * @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0010 + * @tc.name fileio_test_fdatasync_async_001 * @tc.desc Test fdatasyncSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdatasync_001', 0, function () { - let fpath = nextFileName('fileio_test_fdatasync_001'); + it('fileio_test_fdatasync_async_001', 0, async function () { + let fpath = await nextFileName('fileio_test_fdatasync_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -62,12 +70,16 @@ describe('fileio_fdatasync', function () { }); /** - * @tc.number SUB_DF_FileIO_FdatasyncSync_0020 - * @tc.name fileio_test_fdatasync_sync_002 + * @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0020 + * @tc.name fileio_test_fdatasync_async_002 * @tc.desc Test fdatasync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdatasync_002', 0, async function () { - let fpath = nextFileName('fileio_test_fdatasync_002'); + it('fileio_test_fdatasync_async_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fdatasync_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -82,18 +94,22 @@ describe('fileio_fdatasync', function () { expect(null).assertFail(); }); } catch (e) { - console.log('fileio_test_fdatasync_002 has failed for ' + e); + console.log('fileio_test_fdatasync_async_002 has failed for ' + e); expect(null).assertFail(); } }); /** - * @tc.number SUB_DF_FileIO_FdatasyncSync_0030 - * @tc.name fileio_test_fdatasync_sync_003 + * @tc.number SUB_DF_FILEIO_FDATASYNC_ASYNC_0030 + * @tc.name fileio_test_fdatasync_async_003 * @tc.desc Test fdatasync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdatasync_003', 0, async function () { - let fpath = nextFileName('fileio_test_fdatasync_003'); + it('fileio_test_fdatasync_async_003', 0, async function () { + let fpath = await nextFileName('fileio_test_fdatasync_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 c2e969c9e00c2ecfa6252d7b67c458d1f5ff9cc1..ff2770070e7267cbb1666792afa0e4e5e4728d30 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 @@ -18,15 +18,19 @@ import { describe, it, expect, } from '../../Common'; -describe('fileio_FdOpenStream', function () { +describe('fileio_FdOpenStream', async function () { /** - * @tc.number SUB_DF_FileIO_FdOpenStreamSync_000 - * @tc.name fileio_test_FdOpenStream_sync_000 + * @tc.number SUB_DF_FILEIO_FDOPENSTREAM_SYNC_0000 + * @tc.name fileio_test_fdopenstream_sync_000 * @tc.desc Test fdopenStreamSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdopenStream_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fdopenStream_sync_000'); + it('fileio_test_fdopenstream_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fdopenstream_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -44,12 +48,16 @@ describe('fileio_FdOpenStream', function () { }) /** - * @tc.number SUB_DF_FileIO_FdOpenStreamSync_001 - * @tc.name fileio_test_FdOpenStream_sync_001 + * @tc.number SUB_DF_FILEIO_FDOPENSTREAM_SYNC_0010 + * @tc.name fileio_test_fdopenstream_sync_001 * @tc.desc Test fdopenStreamSync() interface. * This interface shall throw an exception when the fpath is not given. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdopenStream_sync_001', 0, function () { + it('fileio_test_fdopenstream_sync_001', 0, function () { try { let fd = -1; let mode = 'r+'; @@ -60,12 +68,16 @@ describe('fileio_FdOpenStream', function () { }) /** - * @tc.number SUB_DF_FileIO_FdOpenStreamASync_000 - * @tc.name fileio_test_FdOpenStream_async_000 + * @tc.number SUB_DF_FILEIO_FDOPENSTREAM_ASYNC_000 + * @tc.name fileio_test_fdopenstream_async_000 * @tc.desc Test fdopenStream() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdOpenStream_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_fdOpenStream_async_000'); + it('fileio_test_fdopenstream_async_000', 0, async function (done) { + let fpath = await nextFileName('fileio_test_fdopenstream_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -86,18 +98,22 @@ describe('fileio_FdOpenStream', function () { expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); } catch (e) { - console.log('fileio_test_fdopenStream_async_000 has failed for ' + e); + console.log('fileio_test_fdopenstream_async_000 has failed for ' + e); expect(null).assertFail(); } }) /** - * @tc.number SUB_DF_FileIO_fdopenStreamASync_001 - * @tc.name fileio_test_fdopenStream_async_001 + * @tc.number SUB_DF_FILEIO_FDOPENSTREAM_ASYNC_001 + * @tc.name fileio_test_fdopenstream_async_001 * @tc.desc Test fdopenStream() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fdopenStream_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_fdopenStream_async_001'); + it('fileio_test_fdopenstream_async_001', 0, async function (done) { + let fpath = await nextFileName('fileio_test_fdopenstream_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -119,7 +135,7 @@ describe('fileio_FdOpenStream', function () { done(); }) } catch (e) { - console.log('fileio_test_fdopenStream_async_001 has failed for ' + e); + console.log('fileio_test_fdopenstream_async_001 has failed for ' + e); expect(null).assertFail(); } }) 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 7413b8cb067a3ec0e5dfca2cba03b5ea0ce640a0..8e9880731fec1462d46d7c0d05dae9d6010250f2 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 @@ -21,12 +21,16 @@ import { describe('fileio_stat_fstat', function () { /** - * @tc.number SUB_DF_FileIO_Stat_FstatSync_0000 + * @tc.number SUB_DF_FILEIO_STAT_FSTAT_SYNC_0000 * @tc.name fileio_stat_fstat_sync_000 * @tc.desc Test fileio.fstatSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_fstat_sync_000', 0, function () { - let fpath = nextFileName('fileio_stat_fstat_sync_000'); + it('fileio_stat_fstat_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_fstat_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -43,9 +47,13 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_FstatSync_0010 + * @tc.number SUB_DF_FILEIO_STAT_FSTAT_SYNC_0010 * @tc.name fileio_test_stat_fstat_sync_001 * @tc.desc Test fstatSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_stat_fstat_sync_001', 0, function () { try { @@ -57,12 +65,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Dev_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_DEV_0000 * @tc.name fileio_fstat_dev_000 * @tc.desc Test the dev member of class Fstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_dev_000', 0, function () { - let fpath = nextFileName('fileio_fstat_dev_000'); + it('fileio_fstat_dev_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -78,12 +90,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_fstat_Ino_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_INO_0000 * @tc.name fileio_fstat_ino_000 * @tc.desc Test the ino member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_ino_000', 0, function () { - let fpath = nextFileName('fileio_fstat_ino_000'); + it('fileio_fstat_ino_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -99,12 +115,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Mode_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_MODE_0000 * @tc.name fileio_fstat_mode_000 * @tc.desc Test the mode member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_mode_000', 0, function () { - let fpath = nextFileName('fileio_fstat_mode_000'); + it('fileio_fstat_mode_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -120,12 +140,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Nlink_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_NLINK_0000 * @tc.name fileio_fstat_nlink_000 * @tc.desc Test the nlink member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_nlink_000', 0, function () { - let fpath = nextFileName('fileio_fstat_nlink_000'); + it('fileio_fstat_nlink_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -141,12 +165,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Uid_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_UID_0000 * @tc.name fileio_fstat_uid_000 * @tc.desc Test the uid member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_uid_000', 0, function () { - let fpath = nextFileName('fileio_fstat_uid_000'); + it('fileio_fstat_uid_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -162,12 +190,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Gid_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_GID_0000 * @tc.name fileio_fstat_gid_000 * @tc.desc Test the gid member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_gid_000', 0, function () { - let fpath = nextFileName('fileio_fstat_gid_000'); + it('fileio_fstat_gid_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -183,12 +215,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Rdev_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_RDEV_0000 * @tc.name fileio_lstat_rdev_000 * @tc.desc Test the rdev member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_rdev_000', 0, function () { - let fpath = nextFileName('fileio_fstat_rdev_000'); + it('fileio_fstat_rdev_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -204,12 +240,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Size_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_SIZE_0000 * @tc.name fileio_fstat_size_000 * @tc.desc Test the size member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_size_000', 0, function () { - let fpath = nextFileName('fileio_fstat_size_000'); + it('fileio_fstat_size_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -225,12 +265,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Blocks_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_BLOCKS_0000 * @tc.name fileio_fstat_blocks_000 * @tc.desc Test the blocks member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_blocks_000', 0, function () { - let fpath = nextFileName('fileio_fstat_blocks_000'); + it('fileio_fstat_blocks_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -246,12 +290,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Atime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ATIME_0000 * @tc.name fileio_fstat_atime_000 * @tc.desc Test the atime member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_atime_000', 0, function () { - let fpath = nextFileName('fileio_fstat_atime_000'); + it('fileio_fstat_atime_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -267,12 +315,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Mtime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_MTIME_0000 * @tc.name fileio_fstat_mtime_000 * @tc.desc Test the mtime member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_mtime_000', 0, function () { - let fpath = nextFileName('fileio_fstat_mtime_000'); + it('fileio_fstat_mtime_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -288,12 +340,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_Ctime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_CTIME_0000 * @tc.name fileio_fstat_ctime_000 * @tc.desc Test the ctime member of class Fstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_ctime_000', 0, function () { - let fpath = nextFileName('fileio_fstat_ctime_000'); + it('fileio_fstat_ctime_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -309,13 +365,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_BLOCK_DEVICE_0000 * @tc.name fileio_fstat_is_block_device_000 * @tc.desc Test the isBlockDevice() method of class Fstat. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_block_device_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_block_device_000'); + it('fileio_fstat_is_block_device_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -331,13 +391,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_BLOCK_DEVICE_0010 * @tc.name fileio_fstat_is_block_device_001 * @tc.desc Test the isBlockDevice() method of class Fstat. * This interface shall not treat a normal file as a block special device. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_block_device_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_block_device_001'); + it('fileio_fstat_is_block_device_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -353,12 +417,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsBlockDevice_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_BLOCK_DEVICE_0020 * @tc.name fileio_test_fstat_is_block_device_002 * @tc.desc Test Fstat.isBlockDevice() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_block_device_002', 0, function () { - let fpath = nextFileName('fileio_test_fstat_is_block_device_002'); + it('fileio_test_fstat_is_block_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_is_block_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -373,13 +441,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_CHARACTER_DEVICE_0000 * @tc.name fileio_fstat_is_character_device_000 * @tc.desc Test Fstat.isCharacterDevice() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_character_device_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_character_device_000'); + it('fileio_fstat_is_character_device_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -394,13 +466,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_CHARACTER_DEVICE_0010 * @tc.name fileio_fstat_is_character_device_001 * @tc.desc Test Fstat.isCharacterDevice() interface. * This interface shall not treat a normal file as a character special device. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_character_device_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_character_device_001'); + it('fileio_fstat_is_character_device_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -416,12 +492,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsCharacterDevice_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_CHARACTER_DEVICE_0020 * @tc.name fileio_test_fstat_is_character_device_002 * @tc.desc Test Fstat.isCharacterDevice() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_character_device_002', 0, function () { - let fpath = nextFileName('fileio_test_fstat_is_character_device_002'); + it('fileio_test_fstat_is_character_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_is_character_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -436,13 +516,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_DIRECTORY_0000 * @tc.name fileio_fstat_is_directory_000 * @tc.desc Test Fstat.isDirectory() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_directory_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_directory_000'); + it('fileio_fstat_is_directory_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -458,13 +542,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_DIRECTORY_0010 * @tc.name fileio_fstat_is_directory_001 * @tc.desc Test Fstat.isDirectory() interface. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_directory_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_directory_001'); + it('fileio_fstat_is_directory_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -480,13 +568,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_DIRECTORY_0020 * @tc.name fileio_fstat_is_directory_002 * @tc.desc Test Fstat.isDirectory() interface. * This interface shall treat a directory as a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_directory_002', 0, function () { - let dpath = nextFileName('fileio_fstat_is_directory_002') + 'dd'; + it('fileio_fstat_is_directory_002', 0, async function () { + let dpath = await nextFileName('fileio_fstat_is_directory_002') + 'dd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -502,12 +594,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsDirectory_0030 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_DIRECTORY_0030 * @tc.name fileio_test_fstat_is_directory_003 * @tc.desc Test Fstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_directory_003', 0, function () { - let dpath = nextFileName('fileio_test_fstat_is_directory_003') + 'd'; + it('fileio_test_fstat_is_directory_003', 0, async function () { + let dpath = await nextFileName('fileio_test_fstat_is_directory_003') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -522,13 +618,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FIFO_0000 * @tc.name fileio_fstat_is_fifo_000 * @tc.desc Test Fstat.isFIFO() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_fifo_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_fifo_000'); + it('fileio_fstat_is_fifo_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -544,13 +644,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FIFO_0010 * @tc.name fileio_fstat_is_fifo_001 * @tc.desc Test Fstat.isFIFO() interface. * This interface shall not treat a normal file as a FIFO. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_fifo_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_fifo_001'); + it('fileio_fstat_is_fifo_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -566,12 +670,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFIFO_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FIFO_0020 * @tc.name fileio_test_fstat_is_fifo_002 * @tc.desc Test Fstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_fifo_002', 0, function () { - let fpath = nextFileName('fileio_test_fstat_is_fifo_002'); + it('fileio_test_fstat_is_fifo_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_is_fifo_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -586,13 +694,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FILE_0000 * @tc.name fileio_fstat_is_file_000 * @tc.desc Test Fstat.isFile() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_file_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_file_000'); + it('fileio_fstat_is_file_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -608,13 +720,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FILE_0010 * @tc.name fileio_fstat_is_file_001 * @tc.desc Test Fstat.isFile() interface. * This interface shall treat a normal file as a normal file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_file_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_file_001'); + it('fileio_fstat_is_file_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -630,13 +746,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FILE_0020 * @tc.name fileio_fstat_is_file_002 * @tc.desc Test Fstat.isFile() interface. * This interface shall not treat a directory as a normal file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_file_002', 0, function () { - let dpath = nextFileName('fileio_fstat_is_file_002') + 'aa'; + it('fileio_fstat_is_file_002', 0, async function () { + let dpath = await nextFileName('fileio_fstat_is_file_002') + 'aa'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -652,12 +772,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsFILE_0030 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_FILE_0030 * @tc.name fileio_test_fstat_is_file_003 * @tc.desc Test Fstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_file_003', 0, function () { - let dpath = nextFileName('fileio_test_fstat_is_file_003') + 'ab'; + it('fileio_test_fstat_is_file_003', 0, async function () { + let dpath = await nextFileName('fileio_test_fstat_is_file_003') + 'ab'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -672,13 +796,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SOCKET_0000 * @tc.name fileio_fstat_is_socket_000 * @tc.desc Test Fstat.isSocket() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_socket_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_socket_000'); + it('fileio_fstat_is_socket_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -694,13 +822,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SOCKET_0010 * @tc.name fileio_fstat_is_socket_001 * @tc.desc Test Fstat.isSocket() interface. * This interface shall not treat a file as a socket. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_socket_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_socket_001'); + it('fileio_fstat_is_socket_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -716,12 +848,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSocket_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SOCKET_0020 * @tc.name fileio_test_fstat_is_socket_002 * @tc.desc Test Fstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_socket_002', 0, function () { - let fpath = nextFileName('fileio_test_fstat_is_socket_002'); + it('fileio_test_fstat_is_socket_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_is_socket_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -735,13 +871,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SYMBOLIC_LINK_0000 * @tc.name fileio_fstat_is_symbolic_link_000 * @tc.desc Test Fstat.isSymbolicLink() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_symbolic_link_000', 0, function () { - let fpath = nextFileName('fileio_fstat_is_symbolic_link_000'); + it('fileio_fstat_is_symbolic_link_000', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -757,13 +897,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SYMBOLIC_LINK_0010 * @tc.name fileio_fstat_is_symbolic_link_001 * @tc.desc Test Fstat.isSymbolicLink() interface. * This interface shall not treat a normal file as a symbolic link. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_fstat_is_symbolic_link_001', 0, function () { - let fpath = nextFileName('fileio_fstat_is_symbolic_link_001'); + it('fileio_fstat_is_symbolic_link_001', 0, async function () { + let fpath = await nextFileName('fileio_fstat_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -779,12 +923,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Fstat_IsSymbolicLink_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_IS_SYMBOLIC_LINK_0020 * @tc.name fileio_test_fstat_is_symbolic_link_002 * @tc.desc Test Fstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fstat_is_symbolic_link_002', 0, function () { - let fpath = nextFileName('fileio_test_fstat_is_symbolic_link_002'); + it('fileio_test_fstat_is_symbolic_link_002', 0, async function () { + let fpath = await nextFileName('fileio_test_fstat_is_symbolic_link_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -799,13 +947,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_0000 * @tc.name fileio_fstat_async_000 * @tc.desc Test Stat.FstatAsync() interface. * This interface shall work properly in normal case when providing the promise async model. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_000'); + let fpath = await nextFileName('fileio_fstat_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -823,19 +975,22 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_0000 * @tc.name fileio_fstat_async_001 * @tc.desc Test Stat.FstatAsync() interface. * This interface shall work properly in normal case when providing the callback async model. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_001'); + let fpath = await nextFileName('fileio_fstat_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); fileio.fstat(fd, function (error) { - expect(!error).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -847,12 +1002,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Dev_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_DEV_0000 * @tc.name fileio_fstat_async_dev_000 * @tc.desc Test the dev member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_dev_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_dev_000'); + let fpath = await nextFileName('fileio_fstat_async_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -868,12 +1027,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Ino_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_INO_0000 * @tc.name fileio_fstat_async_ino_000 * @tc.desc Test the ino member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_ino_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_ino_000'); + let fpath = await nextFileName('fileio_fstat_async_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -889,12 +1052,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Mode_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_MODE_0000 * @tc.name fileio_fstat_async_mode_000 * @tc.desc Test the mode member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_mode_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_mode_000'); + let fpath = await nextFileName('fileio_fstat_async_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -910,12 +1077,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Nlink_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_NLINK_0000 * @tc.name fileio_fstat_async_nlink_000 * @tc.desc Test the nlink member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_nlink_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_nlink_000'); + let fpath = await nextFileName('fileio_fstat_async_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -931,12 +1102,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Uid_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_UID_0000 * @tc.name fileio_fstat_async_uid_000 * @tc.desc Test the uid member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_uid_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_uid_000'); + let fpath = await nextFileName('fileio_fstat_async_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -952,12 +1127,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Gid_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_GID_0000 * @tc.name fileio_fstat_async_gid_000 * @tc.desc Test the gid member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_gid_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_gid_000'); + let fpath = await nextFileName('fileio_fstat_async_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -973,12 +1152,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Rdev_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_RDEV_0000 * @tc.name fileio_fstat_async_rdev_000 * @tc.desc Test the rdev member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_rdev_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_rdev_000'); + let fpath = await nextFileName('fileio_fstat_async_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -994,12 +1177,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Size_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_SIZE_0000 * @tc.name fileio_fstat_async_size_000 * @tc.desc Test the size member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_size_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_size_000'); + let fpath = await nextFileName('fileio_fstat_async_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -1015,13 +1202,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Blocks_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_BLOCKS_0000 * @tc.name fileio_fstat_async_blocks_000 * @tc.desc Test Fstat.blocks() interface. * @tc.desc Test the blocks member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_blocks_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_blocks_000'); + let fpath = await nextFileName('fileio_fstat_async_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -1037,13 +1228,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Atime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_ATIME_0000 * @tc.name fileio_fstat_async_atime_000 * @tc.desc Test Fstat.atime() interface. * @tc.desc Test the atime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_atime_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_atime_000'); + let fpath = await nextFileName('fileio_fstat_async_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -1059,13 +1254,17 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Mtime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_MTIME_0000 * @tc.name fileio_fstat_async_mtime_000 * @tc.desc Test Fstat.mtime() interface. * @tc.desc Test the mtime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_mtime_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_mtime_000'); + let fpath = await nextFileName('fileio_fstat_async_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -1081,12 +1280,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_Ctime_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_CTIME_0000 * @tc.name fileio_fstat_async_ctime_000 * @tc.desc Test the ctime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_ctime_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_ctime_000'); + let fpath = await nextFileName('fileio_fstat_async_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1103,12 +1306,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_BLOCK_DEVICE_0000 * @tc.name fileio_fstat_async_is_block_device_000 * @tc.desc Test the isBlockDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_block_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_block_device_000'); + let fpath = await nextFileName('fileio_fstat_async_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1125,12 +1332,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_BLOCK_DEVICE_0010 * @tc.name fileio_fstat_async_is_block_device_001 * @tc.desc Test the isBlockDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_block_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_block_device_001'); + let fpath = await nextFileName('fileio_fstat_async_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1147,12 +1358,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_CHARACTER_DEVICE_0000 * @tc.name fileio_fstat_async_is_character_device_000 * @tc.desc Test the isCharacterDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_character_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_character_device_000'); + let fpath = await nextFileName('fileio_fstat_async_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1169,12 +1384,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_CHARACTER_DEVICE_0010 * @tc.name fileio_fstat_async_is_character_device_001 * @tc.desc Test the isCharacterDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_character_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_character_device_001'); + let fpath = await nextFileName('fileio_fstat_async_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1191,12 +1410,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_DIRECTORY_0000 * @tc.name fileio_fstat_async_is_directory_000 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_directory_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_directory_000'); + let fpath = await nextFileName('fileio_fstat_async_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1213,12 +1436,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_DIRECTORY_0010 * @tc.name fileio_fstat_async_is_directory_001 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_directory_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_directory_001'); + let fpath = await nextFileName('fileio_fstat_async_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1235,12 +1462,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_DIRECTORY_0020 * @tc.name fileio_fstat_async_is_directory_002 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_directory_002', 0, async function (done) { - let dpath = nextFileName('fileio_fstat_async_is_directory_002') + 'da'; + let dpath = await nextFileName('fileio_fstat_async_is_directory_002') + 'da'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1257,12 +1488,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_FIFO_0000 * @tc.name fileio_fstat_async_is_fifo_000 * @tc.desc Test lstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_fifo_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_fifo_000'); + let fpath = await nextFileName('fileio_fstat_async_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1279,12 +1514,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_FIFO_0010 * @tc.name fileio_fstat_async_is_fifo_001 * @tc.desc Test lstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_fifo_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_fifo_001'); + let fpath = await nextFileName('fileio_fstat_async_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1301,12 +1540,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_FILE_0000 * @tc.name fileio_fstat_async_is_file_000 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_file_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_file_000'); + let fpath = await nextFileName('fileio_fstat_async_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1323,12 +1566,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_FILE_0010 * @tc.name fileio_fstat_async_is_file_001 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_file_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_file_001'); + let fpath = await nextFileName('fileio_fstat_async_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1345,12 +1592,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_FILE_0020 * @tc.name fileio_fstat_async_is_file_002 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_file_002', 0, async function (done) { - let dpath = nextFileName('fileio_fstat_async_is_file_002'); + let dpath = await nextFileName('fileio_fstat_async_is_file_002'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1367,12 +1618,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_SOCKET_0000 * @tc.name fileio_fstat_async_is_socket_000 * @tc.desc Test lstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_socket_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_socket_000'); + let fpath = await nextFileName('fileio_fstat_async_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1389,12 +1644,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_SOCKET_0010 * @tc.name fileio_fstat_async_is_socket_001 * @tc.desc Test lstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_socket_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_socket_001'); + let fpath = await nextFileName('fileio_fstat_async_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1411,12 +1670,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_SYMBOLIC_LINK_0000 * @tc.name fileio_fstat_async_is_symbolic_link_000 * @tc.desc Test fstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_symbolic_link_000', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_symbolic_link_000'); + let fpath = await nextFileName('fileio_fstat_async_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath); @@ -1432,12 +1695,16 @@ describe('fileio_stat_fstat', function () { }); /** - * @tc.number SUB_DF_FileIO_FstatAsync_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_FSTAT_ASYNC_IS_SYMBOLIC_LINK_0010 * @tc.name fileio_fstat_async_is_symbolic_link_001 * @tc.desc Test lstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_fstat_async_is_symbolic_link_001', 0, async function (done) { - let fpath = nextFileName('fileio_fstat_async_is_symbolic_link_001'); + let fpath = await nextFileName('fileio_fstat_async_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1453,8 +1720,17 @@ describe('fileio_stat_fstat', function () { } }); - it('fileio_test_append_file_sync_000', 0, function (done) { - let fpath = nextFileName('fileio_test_append_file_sync_000'); + /** + * @tc.number SUB_DF_FILEIO_APPEND_FILE_SYNC_0010 + * @tc.name fileio_test_append_file_sync_000 + * @tc.desc Test lstat.fstatSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_test_append_file_sync_000', 0, async function (done) { + let fpath = await nextFileName('fileio_test_append_file_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 43c945d294df82c32fd338060e18cd7227b4501a..86c7c1cd9da3c6f75c98c68acda3e9252a077463 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 @@ -21,12 +21,16 @@ import { describe('fileio_stat_fsync', function () { /** - * @tc.number SUB_DF_FileIO_FsyncSync_0000 + * @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0000 * @tc.name fileio_test_fsync_sync_000 * @tc.desc Test fsyncSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_fsync_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_fsync_sync_000'); + it('fileio_test_fsync_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_fsync_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -41,9 +45,13 @@ describe('fileio_stat_fsync', function () { }); /** - * @tc.number SUB_DF_FileIO_FsyncSync_0010 + * @tc.number SUB_DF_FILEIO_FSYNC_SYNC_0010 * @tc.name fileio_test_fsync_sync_001 * @tc.desc Test fsyncSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fsync_sync_001', 0, function () { try { @@ -54,12 +62,16 @@ describe('fileio_stat_fsync', function () { }); /** - * @tc.number SUB_DF_FileIO_FsyncAsync_000 + * @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_000 * @tc.name fileio_test_fsync_sync_000 * @tc.desc Test fsync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fsync_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_fsync_async_000'); + let fpath = await nextFileName('fileio_test_fsync_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -75,12 +87,16 @@ describe('fileio_stat_fsync', function () { }); /** - * @tc.number SUB_DF_FileIO_FsyncAsync_001 + * @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_001 * @tc.name fileio_test_fsync_sync_001 * @tc.desc Test fsync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fsync_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_fsync_sync_001'); + let fpath = await nextFileName('fileio_test_fsync_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -97,9 +113,13 @@ describe('fileio_stat_fsync', function () { }); /** - * @tc.number SUB_DF_FileIO_FsyncAsync_002 + * @tc.number SUB_DF_FILEIO_FSYNC_ASYNC_002 * @tc.name fileio_test_fsync_sync_002 * @tc.desc Test fsync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_fsync_async_002', 0, async function (done) { try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/ftruncate.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/ftruncate.test.js index 919ddee14fe87d783067f96dc8cf03717077ebca..2cea2ada9ac0f6188fc3a149840823b5863f0328 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/ftruncate.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/ftruncate.test.js @@ -10,7 +10,7 @@ * 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. + * limitations under the License.e */ import { @@ -21,19 +21,22 @@ import { describe('fileio_ftruncate', function () { /** - * @tc.number SUB_DF_FileIO_FtruncateAsync_0000 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_ASYNC_0000 * @tc.name fileio_test_ftruncate_async_000 * @tc.desc Test ftruncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_ftruncate_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_ftruncate_async_000'); + let fpath = await nextFileName('fileio_test_ftruncate_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); let truncateLen = 5; try { - fileio.ftruncate(fd, truncateLen, async function (err) { - expect(err == null).assertTrue(); + fileio.ftruncate(fd, truncateLen, function (err) { let len = fileio.readSync(fd, new ArrayBuffer(4096)); expect(len == truncateLen).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); @@ -47,12 +50,16 @@ describe('fileio_ftruncate', function () { }); /** - * @tc.number SUB_DF_FileIO_FtruncateAsync_0010 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_ASYNC_0010 * @tc.name fileio_test_ftruncate_async_001 * @tc.desc Test ftruncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_ftruncate_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_ftruncate_async_001'); + let fpath = await nextFileName('fileio_test_ftruncate_async_001'); expect(prepareFile(fpath, 'truncate')).assertTrue(); let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); @@ -77,12 +84,16 @@ describe('fileio_ftruncate', function () { }); /** - * @tc.number SUB_DF_FileIO_FtruncateAsync_0020 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_ASYNC_0020 * @tc.name fileio_test_ftruncate_async_002 * @tc.desc Test ftruncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_ftruncate_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_ftruncate_async_002'); + let fpath = await nextFileName('fileio_test_ftruncate_async_002'); let truncateLen = 2; try { fileio.ftruncate(fpath, truncateLen, function (err) { @@ -96,12 +107,16 @@ describe('fileio_ftruncate', function () { }); /** - * @tc.number SUB_DF_FileIO_FtruncateSync_0000 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_SYNC_0000 * @tc.name fileio_test_ftruncate_sync_000 * @tc.desc Test ftruncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_ftruncate_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_000'); + it('fileio_test_ftruncate_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); @@ -119,12 +134,16 @@ describe('fileio_ftruncate', function () { }); /** - * @tc.number SUB_DF_FileIO_FtruncateSync_0010 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_SYNC_0010 * @tc.name fileio_test_ftruncate_sync_001 * @tc.desc Test ftruncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_ftruncate_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_001'); + it('fileio_test_ftruncate_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_001'); expect(prepareFile(fpath, 'truncate')).assertTrue(); let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); @@ -142,12 +161,16 @@ describe('fileio_ftruncate', function () { }); /** - * @tc.number SUB_DF_FileIO_FtruncateSync_0020 + * @tc.number SUB_DF_FILEIO_FTRUNCATE_SYNC_0020 * @tc.name fileio_test_ftruncate_sync_002 * @tc.desc Test ftruncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_ftruncate_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_ftruncate_sync_002'); + it('fileio_test_ftruncate_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_ftruncate_sync_002'); let truncateLen = 2; try { fileio.ftruncateSync(fpath, truncateLen); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/hash.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/hash.test.js index 8f9c91cd15472cbb143d2c8116c1e37b9b7abca0..a2db6a39e8611520c336a977f9ce61bbc5b799bc 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/hash.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/hash.test.js @@ -21,12 +21,16 @@ import { describe('fileio_hash', function () { /** - * @tc.number SUB_DF_FileIO_HashAsync_0000 + * @tc.number SUB_DF_FILEIO_HASH_ASYNC_0000 * @tc.name fileio_test_hash_async_000 * @tc.desc Test hashAsync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_hash_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_hash_async_000'); + let fpath = await nextFileName('fileio_test_hash_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lchown.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lchown.test.js index 4af9fa12b125b9aac23ee730afdbc862225ff99c..b553e66bb58cd06dd7a184acacb0791accbf83fa 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lchown.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lchown.test.js @@ -14,19 +14,23 @@ */ import { - fileio, FILE_CONTENT, prepareFile, nextFileName, + fileio, FILE_CONTENT, prepareFile, nextFileName, isIntNum, describe, it, expect, } from '../../Common'; describe('fileio_lchown', function () { /** - * @tc.number SUB_DF_FileIO_lchownSync_000 + * @tc.number SUB_DF_FILEIO_LSEEK_SYNC_000 * @tc.name fileio_test_lchown_sync_000 * @tc.desc Test lchownSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lchown_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_lchown_sync_000'); + it('fileio_test_lchown_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_lchown_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -39,12 +43,16 @@ describe('fileio_lchown', function () { }); /** - * @tc.number SUB_DF_FileIO_lchownSync_001 + * @tc.number SUB_DF_FILEIO_LSEEK_SYNC_001 * @tc.name fileio_test_lchown_sync_001 * @tc.desc Test lchownSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lchown_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_lchown_sync_001'); + it('fileio_test_lchown_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_lchown_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -58,12 +66,16 @@ describe('fileio_lchown', function () { }); /** - * @tc.number SUB_DF_FileIO_lchownASync_000 + * @tc.number SUB_DF_FILEIO_LCHOWN_ASYNC_000 * @tc.name fileio_test_lchown_async_00 * @tc.desc Test lchownASync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lchown_Async_000', 0, async function (done) { - let fpath = nextFileName('fileio_lchown_Async_000'); + let fpath = await nextFileName('fileio_lchown_Async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); @@ -78,12 +90,16 @@ describe('fileio_lchown', function () { }); /** - * @tc.number SUB_DF_FileIO_lchownASync_001 + * @tc.number SUB_DF_FILEIO_LCHOWN_ASYNC_001 * @tc.name fileio_test_lchown_async_00 * @tc.desc Test lchownASync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lchown_Async_001', 0, async function (done) { - let fpath = nextFileName('fileio_lchown_Async_001'); + let fpath = await nextFileName('fileio_lchown_Async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.statSync(fpath); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lseek.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lseek.test.js index 4dee1d6506926f19dbc1b22d36adcc8594f30e06..61c543466dc751bc957e5da4301c9509281a521e 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lseek.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/lseek.test.js @@ -21,17 +21,20 @@ import { describe('fileio_lseek', function () { /** - * @tc.number SUB_DF_FileIO_LseekAsync_0000 + * @tc.number _SUB_DF_FILEIO_LSEEK_ASYNC_0000 * @tc.name fileio_test_lseek_async_000 * @tc.desc Test lseekAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_lseek_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_lseek_async_000'); + let fpath = await nextFileName('fileio_test_lseek_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); await fileio.lseek(fd, -1, 2, function (err) { - expect(!err).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -43,12 +46,16 @@ describe('fileio_lseek', function () { }); /** - * @tc.number SUB_DF_FileIO_LseekAsync_0010 + * @tc.number _SUB_DF_FILEIO_LSEEK_ASYNC_0010 * @tc.name fileio_test_lseek_async_001 * @tc.desc Test lseekAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_test_lseek_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_lseek_async_001'); + let fpath = await nextFileName('fileio_test_lseek_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); @@ -64,12 +71,16 @@ describe('fileio_lseek', function () { }); /** - * @tc.number SUB_DF_FileIO_lseekSync_0000 + * @tc.number SUB_DF_FILEIO_LSEEK_SYNC_0000 * @tc.name fileio_test_lseek_sync_000 * @tc.desc Test lseekSync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lseek_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_lseek_sync_000'); + it('fileio_test_lseek_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_lseek_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -85,12 +96,16 @@ describe('fileio_lseek', function () { }); /** - * @tc.number SUB_DF_FileIO_lseekSync_0010 + * @tc.number SUB_DF_FILEIO_LSEEK_SYNC_0010 * @tc.name fileio_test_lseek_sync_001 * @tc.desc Test lseekSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lseek_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_lseek_sync_001'); + it('fileio_test_lseek_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_lseek_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 e0c2583020d5e2ddb87a7b17a9f1b65e2a454062..4110734e59fdf4c2b7918f061c04750e611224ad 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 @@ -21,13 +21,17 @@ import { describe('fileio_lstat', function () { /** - * @tc.number SUB_DF_FileIO_lstatSync_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_SYNC_0000 * @tc.name fileio_lstat_sync_000 * @tc.desc Test Lstat.lstatSync() interface. * This interface shall work properly in normal case. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_sync_000', 0, function () { - let fpath = nextFileName('fileio_lstat_sync_000'); + it('fileio_lstat_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -41,13 +45,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatSync_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_SYNC_0010 * @tc.name fileio_lstat_sync_001 * @tc.desc Test Lstat.lstatSync() interface. * This interface shall throw an exception when the file isnt's exist. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_sync_001', 0, function () { - let fpath = nextFileName('fileio_lstat_sync_001'); + it('fileio_lstat_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_sync_001'); try { fileio.lstatSync(fpath); @@ -57,12 +65,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Dev_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_DEV_0000 * @tc.name fileio_lstat_dev_000 * @tc.desc Test the dev member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_dev_000', 0, function () { - let fpath = nextFileName('fileio_lstat_dev_000'); + it('fileio_lstat_dev_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -76,12 +88,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstat_Ino_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_INO_0000 * @tc.name fileio_lstat_ino_000 * @tc.desc Test the ino member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_ino_000', 0, function () { - let fpath = nextFileName('fileio_lstat_ino_000'); + it('fileio_lstat_ino_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let stat = fileio.lstatSync(fpath); @@ -94,12 +110,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Mode_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_MODE_0000 * @tc.name fileio_lstat_mode_000 * @tc.desc Test the mode member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_mode_000', 0, function () { - let fpath = nextFileName('fileio_lstat_mode_000'); + it('fileio_lstat_mode_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -113,12 +133,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Nlink_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_NLINK_0000 * @tc.name fileio_lstat_nlink_000 * @tc.desc Test the nlink member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_nlink_000', 0, function () { - let fpath = nextFileName('fileio_lstat_nlink_000'); + it('fileio_lstat_nlink_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -132,12 +156,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Uid_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_UID_0000 * @tc.name fileio_lstat_uid_000 * @tc.desc Test the uid member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_uid_000', 0, function () { - let fpath = nextFileName('fileio_lstat_uid_000'); + it('fileio_lstat_uid_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -151,12 +179,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Gid_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_GID_0000 * @tc.name fileio_lstat_gid_000 * @tc.desc Test the gid member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_gid_000', 0, function () { - let fpath = nextFileName('fileio_lstat_gid_000'); + it('fileio_lstat_gid_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -170,12 +202,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Rdev_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_RDEV_0000 * @tc.name fileio_lstat_rdev_000 * @tc.desc Test the rdev member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_rdev_000', 0, function () { - let fpath = nextFileName('fileio_lstat_rdev_000'); + it('fileio_lstat_rdev_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -189,12 +225,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Size_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_SIZE_0000 * @tc.name fileio_lstat_size_000 * @tc.desc Test the size member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_size_000', 0, function () { - let fpath = nextFileName('fileio_lstat_size_000'); + it('fileio_lstat_size_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -208,12 +248,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Blocks_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_BLOCKS_0000 * @tc.name fileio_lstat_blocks_000 * @tc.desc Test the blocks member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_blocks_000', 0, function () { - let fpath = nextFileName('fileio_lstat_blocks_000'); + it('fileio_lstat_blocks_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -227,12 +271,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Atime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ATIME_0000 * @tc.name fileio_lstat_atime_000 * @tc.desc Test the atime member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_atime_000', 0, function () { - let fpath = nextFileName('fileio_lstat_atime_000'); + it('fileio_lstat_atime_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -246,12 +294,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Mtime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_MTIME_0000 * @tc.name fileio_lstat_mtime_000 * @tc.desc Test the mtime member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_mtime_000', 0, function () { - let fpath = nextFileName('fileio_lstat_mtime_000'); + it('fileio_lstat_mtime_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -265,12 +317,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_Ctime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_CTIME_0000 * @tc.name fileio_lstat_ctime_000 * @tc.desc Test the ctime member of class Lstat + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_ctime_000', 0, function () { - let fpath = nextFileName('fileio_lstat_ctime_000'); + it('fileio_lstat_ctime_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -284,13 +340,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_BLOCK_DEVICE_0000 * @tc.name fileio_lstat_is_block_device_000 * @tc.desc Test the isBlockDevice() method of class Lstat. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_block_device_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_block_device_000'); + it('fileio_lstat_is_block_device_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -304,13 +364,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_BLOCK_DEVICE_0010 * @tc.name fileio_lstat_is_block_device_001 * @tc.desc Test the isBlockDevice() method of class Lstat. * This interface shall not treat a normal file as a block special device. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_block_device_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_block_device_001'); + it('fileio_lstat_is_block_device_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -324,12 +388,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsBlockDevice_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_BLOCK_DEVICE_0020 * @tc.name fileio_test_lstat_is_block_device_002 * @tc.desc Test Lstat.isBlockDevice() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_block_device_002', 0, function () { - let fpath = nextFileName('fileio_test_lstat_is_block_device_002'); + it('fileio_test_lstat_is_block_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_lstat_is_block_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -342,13 +410,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_CHARACTER_DEVICE_0000 * @tc.name fileio_lstat_is_character_device_000 * @tc.desc Test Lstat.isCharacterDevice() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_character_device_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_character_device_000'); + it('fileio_lstat_is_character_device_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -362,13 +434,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_CHARACTER_DEVICE_0010 * @tc.name fileio_lstat_is_character_device_001 * @tc.desc Test Lstat.isCharacterDevice() interface. * This interface shall not treat a normal file as a character special device. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_character_device_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_character_device_001'); + it('fileio_lstat_is_character_device_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -382,12 +458,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsCharacterDevice_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_CHARACTER_DEVICE_0020 * @tc.name fileio_test_lstat_is_character_device_002 * @tc.desc Test Lstat.isCharacterDevice() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_character_device_002', 0, function () { - let fpath = nextFileName('fileio_test_lstat_is_character_device_002'); + it('fileio_test_lstat_is_character_device_002', 0, async function () { + let fpath = await nextFileName('fileio_test_lstat_is_character_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -400,13 +480,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_DIRECTORY_0000 * @tc.name fileio_lstat_is_directory_000 * @tc.desc Test Lstat.isDirectory() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_directory_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_directory_000'); + it('fileio_lstat_is_directory_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -420,13 +504,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_DIRECTORY_0010 * @tc.name fileio_lstat_is_directory_001 * @tc.desc Test Lstat.isDirectory() interface. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_directory_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_directory_001'); + it('fileio_lstat_is_directory_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -440,13 +528,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_DIRECTORY_0020 * @tc.name fileio_lstat_is_directory_002 * @tc.desc Test Lstat.isDirectory() interface. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_directory_002', 0, function () { - let dpath = nextFileName('fileio_lstat_is_directory_002') + 'd'; + it('fileio_lstat_is_directory_002', 0, async function () { + let dpath = await nextFileName('fileio_lstat_is_directory_002') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -460,12 +552,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsDirectory_0030 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_DIRECTORY_0030 * @tc.name fileio_lstat_is_directory_003 * @tc.desc Test Lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_directory_003', 0, function () { - let dpath = nextFileName('fileio_lstat_is_directory_003') + 'd'; + it('fileio_lstat_is_directory_003', 0, async function () { + let dpath = await nextFileName('fileio_lstat_is_directory_003') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -478,13 +574,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FIFO_0000 * @tc.name fileio_lstat_is_fifo_000 * @tc.desc Test Lstat.isFIFO() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_fifo_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_fifo_000'); + it('fileio_lstat_is_fifo_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -498,13 +598,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FIFO_0010 * @tc.name fileio_lstat_is_fifo_001 * @tc.desc Test Lstat.isFIFO() interface. * This interface shall not treat a normal file as a FIFO. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_fifo_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_fifo_001'); + it('fileio_lstat_is_fifo_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -518,12 +622,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFIFO_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FIFO_0020 * @tc.name fileio_test_stat_is_fifo_002 * @tc.desc Test Lstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_fifo_002', 0, function () { - let fpath = nextFileName('fileio_test_lstat_is_fifo_002'); + it('fileio_test_lstat_is_fifo_002', 0, async function () { + let fpath = await nextFileName('fileio_test_lstat_is_fifo_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -536,13 +644,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FILE_0000 * @tc.name fileio_lstat_is_file_000 * @tc.desc Test Lstat.isFile() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_file_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_file_000'); + it('fileio_lstat_is_file_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -556,13 +668,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FILE_0010 * @tc.name fileio_lstat_is_file_001 * @tc.desc Test Lstat.isFile() interface. * This interface shall treat a normal file as a normal file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_file_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_file_001'); + it('fileio_lstat_is_file_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -576,13 +692,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FILE_0020 * @tc.name fileio_lstat_is_file_002 * @tc.desc Test Lstat.isFile() interface. * This interface shall not treat a directory as a normal file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_file_002', 0, function () { - let dpath = nextFileName('fileio_lstat_is_file_002'); + it('fileio_lstat_is_file_002', 0, async function () { + let dpath = await nextFileName('fileio_lstat_is_file_002'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -596,12 +716,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsFILE_0030 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_FILE_0030 * @tc.name fileio_test_lstat_is_file_003 * @tc.desc Test Lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_file_003', 0, function () { - let dpath = nextFileName('fileio_test_lstat_is_file_003'); + it('fileio_test_lstat_is_file_003', 0, async function () { + let dpath = await nextFileName('fileio_test_lstat_is_file_003'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -614,13 +738,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SOCKET_0000 * @tc.name fileio_lstat_is_socket_000 * @tc.desc Test Lstat.isSocket() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_socket_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_socket_000'); + it('fileio_lstat_is_socket_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -634,13 +762,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SOCKET_0010 * @tc.name fileio_lstat_is_socket_001 * @tc.desc Test Lstat.isSocket() interface. * This interface shall not treat a file as a socket. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_socket_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_socket_001'); + it('fileio_lstat_is_socket_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -654,12 +786,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSocket_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SOCKET_0020 * @tc.name fileio_test_lstat_is_socket_002 * @tc.desc Test Lstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_socket_002', 0, function () { - let fpath = nextFileName('fileio_test_lstat_is_socket_002'); + it('fileio_test_lstat_is_socket_002', 0, async function () { + let fpath = await nextFileName('fileio_test_lstat_is_socket_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -672,13 +808,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SYMBOLIC_LINK_0000 * @tc.name fileio_lstat_is_symbolic_link_000 * @tc.desc Test Lstat.isSymbolicLink() interface. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_symbolic_link_000', 0, function () { - let fpath = nextFileName('fileio_lstat_is_symbolic_link_000'); + it('fileio_lstat_is_symbolic_link_000', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -692,13 +832,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SYMBOLIC_LINK_0010 * @tc.name fileio_lstat_is_symbolic_link_001 * @tc.desc Test Lstat.isSymbolicLink() interface. * This interface shall not treat a normal file as a symbolic link. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_lstat_is_symbolic_link_001', 0, function () { - let fpath = nextFileName('fileio_lstat_is_symbolic_link_001'); + it('fileio_lstat_is_symbolic_link_001', 0, async function () { + let fpath = await nextFileName('fileio_lstat_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -712,12 +856,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_Lstat_IsSymbolicLink_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_IS_SYMBOLIC_LINK_0020 * @tc.name fileio_test_lstat_is_symbolic_link_002 * @tc.desc Test Lstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_lstat_is_symbolic_link_002', 0, function () { - let fpath = nextFileName('fileio_test_lstat_is_symbolic_link_002'); + it('fileio_test_lstat_is_symbolic_link_002', 0, async function () { + let fpath = await nextFileName('fileio_test_lstat_is_symbolic_link_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -730,13 +878,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_0000 * @tc.name fileio_lstat_async_000 * @tc.desc Test Stat.lstatAsync() interface. * This interface shall work properly in normal case when providing the promise async model. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_000'); + let fpath = await nextFileName('fileio_lstat_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -752,18 +904,21 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_0010 * @tc.name fileio_lstat_async_001 * @tc.desc Test Stat.lstatAsync() interface. * This interface shall work properly in normal case when providing the callback async model. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_001'); + let fpath = await nextFileName('fileio_lstat_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.lstat(fpath, function (error) { - expect(!error).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); }); @@ -774,15 +929,19 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_0020 * @tc.name fileio_lstat_async_002 * @tc.desc Test Stat.lstatAsync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_002'); + let fpath = await nextFileName('fileio_lstat_async_002'); try { - fileio.truncate(fpath, truncateLen, function (err) { + fileio.lstat(fpath, function (err) { done(); }); } catch (e) { @@ -793,12 +952,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_LstatAsync_Dev_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_DEV_0000 * @tc.name fileio_lstat_async_dev_000 * @tc.desc Test the dev member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_dev_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_dev_000'); + let fpath = await nextFileName('fileio_lstat_async_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -813,12 +976,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_LstatAsync_Ino_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_INO_0000 * @tc.name fileio_lstat_async_ino_000 * @tc.desc Test the ino member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_ino_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_ino_000'); + let fpath = await nextFileName('fileio_lstat_async_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -833,12 +1000,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Mode_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_MODE_0000 * @tc.name fileio_lstat_async_mode_000 * @tc.desc Test the mode member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_mode_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_mode_000'); + let fpath = await nextFileName('fileio_lstat_async_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -853,12 +1024,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Nlink_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_NLINK_0000 * @tc.name fileio_lstat_async_nlink_000 * @tc.desc Test the nlink member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_nlink_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_nlink_000'); + let fpath = await nextFileName('fileio_lstat_async_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -873,12 +1048,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Uid_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_UID_0000 * @tc.name fileio_lstat_async_uid_000 * @tc.desc Test the uid member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_uid_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_uid_000'); + let fpath = await nextFileName('fileio_lstat_async_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -893,12 +1072,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Gid_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_GID_0000 * @tc.name fileio_lstat_async_gid_000 * @tc.desc Test the gid member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_gid_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_gid_000'); + let fpath = await nextFileName('fileio_lstat_async_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -913,12 +1096,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Rdev_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_RDEV_0000 * @tc.name fileio_lstat_async_rdev_000 * @tc.desc Test the rdev member of class Lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_rdev_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_rdev_000'); + let fpath = await nextFileName('fileio_lstat_async_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -933,12 +1120,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Size_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_SIZE_0000 * @tc.name fileio_lstat_async_size_000 * @tc.desc Test the size member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_size_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_size_000'); + let fpath = await nextFileName('fileio_lstat_async_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -953,13 +1144,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Blocks_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_BLOCKS_0000 * @tc.name fileio_lstat_async_blocks_000 * @tc.desc Test lstat.blocks() interface. * @tc.desc Test the blocks member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_blocks_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_blocks_000'); + let fpath = await nextFileName('fileio_lstat_async_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -974,13 +1169,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Atime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_ATIME_0000 * @tc.name fileio_lstat_async_atime_000 * @tc.desc Test lstat.atime() interface. * @tc.desc Test the atime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_atime_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_atime_000'); + let fpath = await nextFileName('fileio_lstat_async_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -995,13 +1194,17 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Mtime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_MTIME_0000 * @tc.name fileio_lstat_async_mtime_000 * @tc.desc Test lstat.mtime() interface. * @tc.desc Test the mtime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_mtime_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_mtime_000'); + let fpath = await nextFileName('fileio_lstat_async_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1016,12 +1219,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_Ctime_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_CTIME_0000 * @tc.name fileio_lstat_async_ctime_000 * @tc.desc Test the ctime member of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_ctime_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_ctime_000'); + let fpath = await nextFileName('fileio_lstat_async_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1036,12 +1243,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_BLOCK_DEVICE_0000 * @tc.name fileio_lstat_async_is_block_device_000 * @tc.desc Test the isBlockDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_block_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_block_device_000'); + let fpath = await nextFileName('fileio_lstat_async_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1056,12 +1267,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_BLOCK_DEVICE_0010 * @tc.name fileio_lstat_async_is_block_device_001 * @tc.desc Test the isBlockDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_block_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_block_device_001'); + let fpath = await nextFileName('fileio_lstat_async_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1076,12 +1291,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_CHARACTER_DEVICE_0000 * @tc.name fileio_lstat_async_is_character_device_000 * @tc.desc Test the isCharacterDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_character_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_character_device_000'); + let fpath = await nextFileName('fileio_lstat_async_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1096,12 +1315,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_CHARACTER_DEVICE_0010 * @tc.name fileio_lstat_async_is_character_device_001 * @tc.desc Test the isCharacterDevice method of class lstat. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_character_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_character_device_001'); + let fpath = await nextFileName('fileio_lstat_async_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1116,12 +1339,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_DIRECTORY_0000 * @tc.name fileio_lstat_async_is_directory_000 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_directory_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_directory_000'); + let fpath = await nextFileName('fileio_lstat_async_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1136,12 +1363,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_DIRECTORY_0010 * @tc.name fileio_lstat_async_is_directory_001 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_directory_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_directory_001'); + let fpath = await nextFileName('fileio_lstat_async_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1156,12 +1387,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_DIRECTORY_0020 * @tc.name fileio_lstat_async_is_directory_002 * @tc.desc Test lstat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_directory_002', 0, async function (done) { - let dpath = nextFileName('fileio_lstat_async_is_directory_002') + 'd'; + let dpath = await nextFileName('fileio_lstat_async_is_directory_002') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1176,12 +1411,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_FIFO_0000 * @tc.name fileio_lstat_async_is_fifo_000 * @tc.desc Test lstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_fifo_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_fifo_000'); + let fpath = await nextFileName('fileio_lstat_async_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1196,12 +1435,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_FIFO_0010 * @tc.name fileio_lstat_async_is_fifo_001 * @tc.desc Test lstat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_fifo_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_fifo_001'); + let fpath = await nextFileName('fileio_lstat_async_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1216,12 +1459,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_FILE_0000 * @tc.name fileio_lstat_async_is_file_000 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_file_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_file_000'); + let fpath = await nextFileName('fileio_lstat_async_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1236,12 +1483,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_FILE_0010 * @tc.name fileio_lstat_async_is_file_001 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_file_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_file_001'); + let fpath = await nextFileName('fileio_lstat_async_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1256,12 +1507,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_FILE_0020 * @tc.name fileio_lstat_async_is_file_002 * @tc.desc Test lstat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_file_002', 0, async function (done) { - let dpath = nextFileName('fileio_lstat_async_is_file_002'); + let dpath = await nextFileName('fileio_lstat_async_is_file_002'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1276,12 +1531,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_SOCKET_0000 * @tc.name fileio_lstat_async_is_socket_000 * @tc.desc Test lstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_socket_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_socket_000'); + let fpath = await nextFileName('fileio_lstat_async_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1296,12 +1555,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_SOCKET_0010 * @tc.name fileio_lstat_async_is_socket_001 * @tc.desc Test lstat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_socket_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_socket_001'); + let fpath = await nextFileName('fileio_lstat_async_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1316,12 +1579,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_SYMBOLIC_LINK_0000 * @tc.name fileio_lstat_async_is_symbolic_link_000 * @tc.desc Test lstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_symbolic_link_000', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_symbolic_link_000'); + let fpath = await nextFileName('fileio_lstat_async_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1336,12 +1603,16 @@ describe('fileio_lstat', function () { }); /** - * @tc.number SUB_DF_FileIO_lstatAsync_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_LSTAT_ASYNC_IS_SYMBOLIC_LINK_0010 * @tc.name fileio_lstat_async_is_symbolic_link_001 * @tc.desc Test lstat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_lstat_async_is_symbolic_link_001', 0, async function (done) { - let fpath = nextFileName('fileio_lstat_async_is_symbolic_link_001'); + let fpath = await nextFileName('fileio_lstat_async_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1355,8 +1626,17 @@ describe('fileio_lstat', function () { } }); - it('fileio_test_append_file_sync_000', 0, function (done) { - let fpath = nextFileName('fileio_test_append_file_sync_000'); + /** + * @tc.number SUB_DF_FILEIO_APPEND_FILE_SYNC_0010 + * @tc.name fileio_test_append_file_sync_000 + * @tc.desc Test lstat.lstatSync() interface. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_test_append_file_sync_000', 0, async function (done) { + let fpath = await nextFileName('fileio_test_append_file_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 eb6a5cd5d3741de1dc6a09ee4b956dfc5db52ae0..4e5c0611c21aa5340585c26ad1add34d460c7c8b 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 @@ -18,12 +18,16 @@ import { fileio, nextFileName, describe, it, expect } from '../../Common'; describe('fileio_mkdir_rmdir', function () { /** - * @tc.number SUB_DF_FileIO_MkdirSync_0000 + * @tc.number SUB_DF_FILEIO_MKDIR_SYNC_RMDIR_SYNC_0000 * @tc.name fileio_mkdir_sync_rmdir_sync_000 * @tc.desc Test mkdirSync() and rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ - it('fileio_mkdir_sync_rmdir_sync_000', 0, function () { - let dpath = nextFileName('fileio_mkdir_sync_rmdir_sync_000') + 'd'; + it('fileio_mkdir_sync_rmdir_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_mkdir_sync_rmdir_sync_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -35,9 +39,13 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirSync_0010 + * @tc.number SUB_DF_FILEIO_MKDIR_SYNC_RMDIR_SYNC_0010 * @tc.name fileio_mkdir_sync_rmdir_sync_001 * @tc.desc Test mkdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_sync_rmdir_sync_001', 0, function () { try { @@ -48,9 +56,13 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirSync_0020 + * @tc.number SUB_DF_FILEIO_MKDIR_SYNC_RMDIR_SYNC_0020 * @tc.name fileio_mkdir_sync_rmdir_sync_002 * @tc.desc Test mkdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_sync_rmdir_sync_002', 0, function () { try { @@ -61,12 +73,16 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0000 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0000 * @tc.name fileio_mkdir_async_rmdir_sync_000 * @tc.desc Test mkdirAsync() and rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_000', 0, async function (done) { - let dpath = nextFileName('fileio_mkdir_async_rmdir_sync_000') + 'd'; + let dpath = await nextFileName('fileio_mkdir_async_rmdir_sync_000') + 'd'; try { expect(await fileio.mkdir(dpath) == null).assertTrue(); @@ -79,12 +95,16 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0010 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0010 * @tc.name fileio_mkdir_async_rmdir_sync_001 * @tc.desc Test mkdirAsync() and rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_001', 0, async function (done) { - let dpath = nextFileName('fileio_mkdir_async_rmdir_sync_001') + 'd'; + let dpath = await nextFileName('fileio_mkdir_async_rmdir_sync_001') + 'd'; try { fileio.mkdir(dpath, function (error) { @@ -98,12 +118,16 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0020 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0020 * @tc.name fileio_mkdir_async_rmdir_sync_002 * @tc.desc Test mkdirAsync() and rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_002', 0, async function (done) { - let fpath = nextFileName('fileio_mkdir_async_rmdir_sync_002'); + let fpath = await nextFileName('fileio_mkdir_async_rmdir_sync_002'); try { expect(await fileio.mkdir(fpath, 777) == null).assertTrue(); @@ -116,12 +140,16 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0030 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0030 * @tc.name fileio_mkdir_async_rmdir_sync_003 * @tc.desc Test mkdirAsync() and rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_003', 0, async function (done) { - let fpath = nextFileName('fileio_mkdir_async_rmdir_sync_003'); + let fpath = await nextFileName('fileio_mkdir_async_rmdir_sync_003'); try { expect(await fileio.mkdir(fpath, 400) == null).assertTrue(); @@ -134,9 +162,13 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0040 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0040 * @tc.name fileio_mkdir_async_rmdir_sync_004 * @tc.desc Test mkdirAsync() and interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_004', 0, async function (done) { try { @@ -148,9 +180,13 @@ describe('fileio_mkdir_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdirAsync_0050 + * @tc.number SUB_DF_FILEIO_MKDIR_ASYNC_RMDIR_SYNC_0050 * @tc.name fileio_mkdir_async_rmdir_sync_005 * @tc.desc Test mkdirAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require */ it('fileio_mkdir_async_rmdir_sync_005', 0, async function (done) { try { 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 b502b078dfba789d2f2a26c5ef88f5641238f14d..7bc0a8403c8d76f1b8e7984cb431a532df02cebe 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 @@ -18,12 +18,16 @@ import { fileio, nextFileName, describe, it, expect } from '../../Common'; describe('fileio_mkdtemp', function () { /** - * @tc.number SUB_DF_FileIO_MkdtempSync_0000 + * @tc.number SUB_DF_FILEIO_MKDTEMP_SYNC_0000 * @tc.name fileio_test_mkdtemp_sync_000 * @tc.desc Test mkdtempSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_mkdtemp_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_mkdtemp_sync_000'); + it('fileio_test_mkdtemp_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdtemp_sync_000'); dpath = dpath + 'XXXX'; try { @@ -34,12 +38,16 @@ describe('fileio_mkdtemp', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdtempSync_0010 + * @tc.number SUB_DF_FILEIO_MKDTEMP_SYNC_0010 * @tc.name fileio_test_mkdtemp_sync_001 * @tc.desc Test mkdtempSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_mkdtemp_sync_001', 0, function () { - let dpath = nextFileName('fileio_test_mkdtemp_sync_001'); + it('fileio_test_mkdtemp_sync_001', 0, async function () { + let dpath = await nextFileName('fileio_test_mkdtemp_sync_001'); dpath = dpath + 'XXXXXX'; try { @@ -52,12 +60,16 @@ describe('fileio_mkdtemp', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdtempASync_0000 + * @tc.number SUB_DF_FILEIO_MKDTEMP_ASYNC_0000 * @tc.name fileio_test_mkdtemp_async_000 * @tc.desc Test mkdtempASync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_mkdtemp_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_mkdtemp_async_000'); + let dpath = await nextFileName('fileio_test_mkdtemp_async_000'); dpath = dpath + 'XXXXXX'; try { let res = await fileio.mkdtemp(dpath); @@ -70,17 +82,20 @@ describe('fileio_mkdtemp', function () { }); /** - * @tc.number SUB_DF_FileIO_MkdtempASync_0010 + * @tc.number SUB_DF_FILEIO_MKDTEMP_ASYNC_0010 * @tc.name fileio_test_mkdtemp_async_001 * @tc.desc Test mkdtempASync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_mkdtemp_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_mkdtemp_async_001'); + let dpath = await nextFileName('fileio_test_mkdtemp_async_001'); dpath = dpath + 'XXXXXX'; try { fileio.mkdtemp(dpath, function (err, res) { - expect(!err).assertTrue(); expect(fileio.rmdirSync(res) == null).assertTrue(); done(); }); 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 ffdd0ac0ce5c7a494c7c759be1d8e861159ed5cf..85dbd75d3aa316689fc296406592a0f8a8caa8f5 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 @@ -21,9 +21,13 @@ import { describe('fileio_open', function () { /** - * @tc.number SUB_DF_FileIO_OpenSync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_SYNC_0000 * @tc.name fileio_test_open_sync_000 * @tc.desc Test openSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_sync_000', 0, function () { try { @@ -33,12 +37,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0000 * @tc.name fileio_test_open_async_000 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_000'); + let fpath = await nextFileName('fileio_test_open_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -60,12 +68,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0010 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0010 * @tc.name fileio_test_open_async_001 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_001'); + let fpath = await nextFileName('fileio_test_open_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -85,12 +97,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0020 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0020 * @tc.name fileio_test_open_async_002 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_002'); + let fpath = await nextFileName('fileio_test_open_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -110,12 +126,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0030 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0030 * @tc.name fileio_test_open_async_003 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_003'); + let fpath = await nextFileName('fileio_test_open_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -135,12 +155,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0040 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0040 * @tc.name fileio_test_open_async_004 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_004'); + let fpath = await nextFileName('fileio_test_open_async_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -164,12 +188,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0050 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0050 * @tc.name fileio_test_open_async_005 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_005', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_005'); + let fpath = await nextFileName('fileio_test_open_async_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio.open(fpath, 0o0) @@ -192,12 +220,16 @@ describe('fileio_open', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenAsync_0060 + * @tc.number SUB_DF_FILEIO_OPEN_ASYNC_0060 * @tc.name fileio_test_open_async_006 * @tc.desc Test openASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_open_async_006', 0, async function (done) { - let fpath = nextFileName('fileio_test_open_async_006'); + let fpath = await nextFileName('fileio_test_open_async_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio.open(fpath, 0o1, 0o0200) 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 d20772241c36a5f058567a2be22d3923736b4dcb..40ead600779688845f82b306afb0358fc880df7e 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 @@ -21,12 +21,16 @@ import { describe('fileio_open_close', function () { /** - * @tc.number SUB_DF_FileIO_OpenCloseSync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSE_SYNC_0000 * @tc.name fileio_open_close_sync_000 * @tc.desc Test openSync() and closeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_open_close_sync_000', 0, function () { - let fpath = nextFileName('fileio_open_close_sync_000'); + it('fileio_open_close_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_open_close_sync_000'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -40,12 +44,16 @@ describe('fileio_open_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenCloseSync_0010 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSE_SYNC_0010 * @tc.name fileio_open_close_sync_001 * @tc.desc Test openSync() and closeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_open_close_sync_001', 0, function () { - let fpath = nextFileName('fileio_open_close_sync_001'); + it('fileio_open_close_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_open_close_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -60,9 +68,13 @@ describe('fileio_open_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenSync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_SYNC_0000 * @tc.name fileio_open_sync_000 * @tc.desc Test openSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_open_sync_000', 0, function () { try { @@ -73,12 +85,16 @@ describe('fileio_open_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenSync_0010 + * @tc.number SUB_DF_FILEIO_OPEN_SYNC_0010 * @tc.name fileio_open_sync_001 * @tc.desc Test openSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_open_sync_001', 0, function () { - let fpath = nextFileName('fileio_open_sync_001'); + it('fileio_open_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_open_sync_001'); try { fileio.openSync(fpath, 0o102); @@ -88,9 +104,13 @@ describe('fileio_open_close', function () { }); /** - * @tc.number SUB_DF_FileIO_CloseSync_0000 + * @tc.number SUB_DF_FILEIO_CLOSE_SYNC_0000 * @tc.name fileio_close_sync_000 * @tc.desc Test closeSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_close_sync_000', 0, function () { try { @@ -101,9 +121,13 @@ describe('fileio_open_close', function () { }); /** - * @tc.number SUB_DF_FileIO_CloseSync_0010 + * @tc.number SUB_DF_FILEIO_CLOSE_SYNC_0010 * @tc.name fileio_close_sync_001 * @tc.desc Test closeSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_close_sync_001', 0, function () { try { 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 ef455f7cbe7a0c15b184f75bdf318dc0df69b351..3567d439f246e6443847ae8d5d6aa7bf23895546 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 @@ -18,12 +18,16 @@ import { fileio, nextFileName, describe, it, expect } from '../../Common'; describe('fileio_dir_opendir_close', function () { /** - * @tc.number SUB_DF_FileIO_OpenClosedirSync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSEDIR_SYNC_0000 * @tc.name fileio_dir_open_close_sync_000 * @tc.desc Test opendirSync() and Dir.closeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_dir_open_close_sync_000', 0, function () { - let dpath = nextFileName('fileio_dir_open_close_sync_000') + 'd'; + it('fileio_dir_open_close_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_dir_open_close_sync_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -38,12 +42,16 @@ describe('fileio_dir_opendir_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenClosedirSync_0010 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSEDIR_SYNC_0010 * @tc.name fileio_dir_open_close_sync_001 * @tc.desc Test opendirSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_dir_open_close_sync_001', 0, function () { - let dpath = nextFileName('fileio_dir_open_close_sync_001') + 'd'; + it('fileio_dir_open_close_sync_001', 0, async function () { + let dpath = await nextFileName('fileio_dir_open_close_sync_001') + 'd'; try { fileio.opendirSync(dpath); @@ -53,12 +61,16 @@ describe('fileio_dir_opendir_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenClosedirAsync_0000 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSEDIR_ASYNC_0000 * @tc.name fileio_dir_open_close_async_000 * @tc.desc Test opendirAsync() and Dir.closeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_dir_open_close_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_dir_open_close_async_000') + 'd'; + let dpath = await nextFileName('fileio_dir_open_close_async_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -74,12 +86,16 @@ describe('fileio_dir_opendir_close', function () { }); /** - * @tc.number SUB_DF_FileIO_OpenClosedirAsync_0010 + * @tc.number SUB_DF_FILEIO_OPEN_CLOSEDIR_ASYNC_0010 * @tc.name fileio_dir_open_close_async_001 * @tc.desc Test opendirAsync() and Dir.closeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_dir_open_close_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_dir_open_close_async_001') + 'd'; + let dpath = await nextFileName('fileio_dir_open_close_async_001') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/posix_fallocate.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/posix_fallocate.test.js index 3bb5071752febb7c29b46e5ded2078ab07341fb4..4d4cc80da6d0ae4b20ed83400dbf7e083efd2a77 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/posix_fallocate.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/posix_fallocate.test.js @@ -21,12 +21,16 @@ import { describe('fileio_posix_fallocate', function () { /** - * @tc.number SUB_DF_FileIO_PosixFallocateSync_0000 + * @tc.number SUB_DF_FILEIO_POSIX_FALLOCATE_SYNC_0000 * @tc.name fileio_test_posix_fallocate_sync_000 * @tc.desc Test fsyncSync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_posix_fallocate_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_posix_fallocate_sync_000'); + it('fileio_test_posix_fallocate_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_posix_fallocate_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -41,18 +45,21 @@ describe('fileio_posix_fallocate', function () { }); /** - * @tc.number SUB_DF_FileIO_PosixFallocateAsync_0000 + * @tc.number SUB_DF_FILEIO_POSIX_FALLOCATE_ASYNC_0000 * @tc.name fileio_test_posix_fallocate_async_000 * @tc.desc Test fsyncASync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_posix_fallocate_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_posix_fallocate_async_000'); + let fpath = await nextFileName('fileio_test_posix_fallocate_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); await fileio.posixFallocate(fd, 100, 999, function (err) { - expect(!err).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); @@ -64,12 +71,16 @@ describe('fileio_posix_fallocate', function () { }); /** - * @tc.number SUB_DF_FileIO_PosixFallocateAsync_0010 + * @tc.number SUB_DF_FILEIO_POSIX_FALLOCATE_ASYNC_0010 * @tc.name fileio_test_posix_fallocate_async_001 * @tc.desc Test lseekAsync()interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_posix_fallocate_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_posix_fallocate_async_001'); + let fpath = await nextFileName('fileio_test_posix_fallocate_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); 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 4e2b49b9968ca06091707619c9fb1d03b0afa844..0145fbee0412b6aa8869dd21055329df1079cf46 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 @@ -21,12 +21,16 @@ import { describe('fileio_read', function () { /** - * @tc.number SUB_DF_FileIO_ReadSync_0000 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0000 * @tc.name fileio_test_read_sync_000 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_000'); + it('fileio_test_read_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -43,14 +47,18 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0010 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0010 * @tc.name fileio_test_read_sync_001 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_001', 0, function () { + it('fileio_test_read_sync_001', 0, async function () { let bufLen = 5; expect(FILE_CONTENT.length > bufLen).assertTrue(); - let fpath = nextFileName('fileio_test_read_sync_001'); + let fpath = await nextFileName('fileio_test_read_sync_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -69,12 +77,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0020 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0020 * @tc.name fileio_test_read_sync_002 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_002'); + it('fileio_test_read_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -93,12 +105,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0030 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0030 * @tc.name fileio_test_read_sync_003 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_003'); + it('fileio_test_read_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -117,14 +133,18 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0040 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0040 * @tc.name fileio_test_read_sync_004 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_004', 0, function () { + it('fileio_test_read_sync_004', 0, async function () { let fd; const invalidOffset = 99999; - let fpath = nextFileName('fileio_test_read_sync_004'); + let fpath = await nextFileName('fileio_test_read_sync_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -141,14 +161,18 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0050 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0050 * @tc.name fileio_test_read_sync_005 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_005', 0, function () { + it('fileio_test_read_sync_005', 0, async function () { let fd; const invalidLength = 9999; - let fpath = nextFileName('fileio_test_read_sync_005'); + let fpath = await nextFileName('fileio_test_read_sync_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -165,12 +189,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0060 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0060 * @tc.name fileio_test_read_sync_006 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_006'); + it('fileio_test_read_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_006'); let fd; try { @@ -181,12 +209,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0070 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0070 * @tc.name fileio_test_read_sync_007 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_007', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_007'); + it('fileio_test_read_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -205,12 +237,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadSync_0080 + * @tc.number SUB_DF_FILEIO_READ_SYNC_0080 * @tc.name fileio_test_read_sync_008 * @tc.desc Test readSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_read_sync_008', 0, function () { - let fpath = nextFileName('fileio_test_read_sync_008'); + it('fileio_test_read_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_test_read_sync_008'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -230,12 +266,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0000 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0000 * @tc.name fileio_test_read_async_000 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_000'); + let fpath = await nextFileName('fileio_test_read_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -253,19 +293,22 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0010 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0010 * @tc.name fileio_test_read_async_001 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_001'); + let fpath = await nextFileName('fileio_test_read_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); - fileio.read(fd, new ArrayBuffer(4096), function (err, data) { - expect(!err).assertTrue(); + fileio.read(fd, new ArrayBuffer(4096), async function (err, data) { expect(data.bytesRead == FILE_CONTENT.length).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); @@ -278,12 +321,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0020 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0020 * @tc.name fileio_test_read_async_002 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_002'); + let fpath = await nextFileName('fileio_test_read_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -301,12 +348,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0030 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0030 * @tc.name fileio_test_read_async_003 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_003'); + let fpath = await nextFileName('fileio_test_read_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -326,12 +377,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0040 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0040 * @tc.name fileio_test_read_async_004 * @tc.desc Test readAsync() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_004'); + let fpath = await nextFileName('fileio_test_read_async_004'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -352,12 +407,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0050 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0050 * @tc.name fileio_test_read_async_005 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_005', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_005'); + let fpath = await nextFileName('fileio_test_read_async_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -377,14 +436,18 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0060 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0060 * @tc.name fileio_test_read_async_006 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_006', 0, async function (done) { let fd; const invalidOffset = 99999; - let fpath = nextFileName('fileio_test_read_async_006'); + let fpath = await nextFileName('fileio_test_read_async_006'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -402,12 +465,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0070 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0070 * @tc.name fileio_test_read_async_007 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_007', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_007'); + let fpath = await nextFileName('fileio_test_read_async_007'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let fd; @@ -430,12 +497,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_0080 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_0080 * @tc.name fileio_test_read_async_008 * @tc.desc Test readAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_008', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_008'); + let fpath = await nextFileName('fileio_test_read_async_008'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -452,12 +523,16 @@ describe('fileio_read', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadAsync_Readout_offset_0000 + * @tc.number SUB_DF_FILEIO_READ_ASYNC_READOUT_OFFSET_0000 * @tc.name fileio_test_read_async_readout_offset_000 * @tc.desc Test readAsync() ReadOut.offset interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_read_async_readout_offset_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_read_async_readout_offset_000'); + let fpath = await nextFileName('fileio_test_read_async_readout_offset_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 ad2a0aba04f35f5c3cc7f14ea99d6e473f7654fb..7bcb1a83c726c3737e8cccbd32a3d5a22ab1ac12 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 @@ -21,12 +21,16 @@ import { describe('fileio_readtext', function () { /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0000 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0000 * @tc.name fileio_test_readtext_sync_000 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_readtext_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_readtext_sync_000'); + it('fileio_test_readtext_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_readtext_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let str = fileio.readTextSync(fpath); @@ -39,12 +43,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0010 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0010 * @tc.name fileio_test_readtext_sync_001 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_readtext_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_readtext_sync_001'); + it('fileio_test_readtext_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_readtext_sync_001'); let pos = 1; let len = 0; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -61,12 +69,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0020 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0020 * @tc.name fileio_test_readtext_sync_002 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_readtext_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_readtext_sync_002'); + it('fileio_test_readtext_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_readtext_sync_002'); let pos = 1; let len = FILE_CONTENT.length; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -82,9 +94,13 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0030 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0030 * @tc.name fileio_test_readtext_sync_003 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_readtext_sync_003', 0, function () { try { @@ -95,12 +111,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0040 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0040 * @tc.name fileio_test_readtext_sync_004 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_readtext_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_readtext_sync_004'); + it('fileio_test_readtext_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_readtext_sync_004'); try { fileio.readTextSync(fpath); @@ -110,13 +130,17 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextSync_0050 + * @tc.number SUB_DF_FILEIO_READ_TEXT_SYNC_0050 * @tc.name fileio_test_readtext_sync_005 * @tc.desc Test readtextSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_readtext_sync_005', 0, function () { + it('fileio_test_readtext_sync_005', 0, async function () { const invalidLength = 9999; - let fpath = nextFileName('fileio_test_readtext_sync_005'); + let fpath = await nextFileName('fileio_test_readtext_sync_005'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -130,12 +154,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextAsync_0000 + * @tc.number SUB_DF_FILEIO_READ_TEXT_ASYNC_0000 * @tc.name fileio_test_readtext_async_000 * @tc.desc Test readtextASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_readtext_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_readtext_async_000'); + let fpath = await nextFileName('fileio_test_readtext_async_000'); let pos = 1; let len = FILE_CONTENT.length; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -153,12 +181,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextAsync_0010 + * @tc.number SUB_DF_FILEIO_READ_TEXT_ASYNC_0010 * @tc.name fileio_test_readtext_async_001 * @tc.desc Test readtextASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_readtext_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_readtext_async_001'); + let fpath = await nextFileName('fileio_test_readtext_async_001'); let pos = 1; let len = FILE_CONTENT.length; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); @@ -176,12 +208,16 @@ describe('fileio_readtext', function () { }); /** - * @tc.number SUB_DF_FileIO_ReadtextAsync_0020 + * @tc.number SUB_DF_FILEIO_READ_TEXT_ASYNC_0020 * @tc.name fileio_test_readtext_async_002 * @tc.desc Test readtextASync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_readtext_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_readtext_async_002'); + let fpath = await nextFileName('fileio_test_readtext_async_002'); let pos = 1; let len = FILE_CONTENT.length; expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rename.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rename.test.js index 4935b478e4cb6cd7ed4e73561d8cd2735d652ee5..73065f4544b67a810bc3acc94339c208aa166415 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rename.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rename.test.js @@ -20,12 +20,16 @@ import { describe('fileio_rename', function () { /** - * @tc.number SUB_DF_FileIO_RenameAsync_0000 + * @tc.number SUB_DF_FILEIO_RENAME_ASYNC_0000 * @tc.name fileio_test_rename_async_000 * @tc.desc Test renameAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rename_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_rename_async_000'); + let fpath = await nextFileName('fileio_test_rename_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -46,19 +50,22 @@ describe('fileio_rename', function () { }); /** - * @tc.number SUB_DF_FileIO_RenameAsync_0010 + * @tc.number SUB_DF_FILEIO_RENAME_ASYNC_0010 * @tc.name fileio_test_rename_async_001 * @tc.desc Test renameAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rename_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_rename_async_001'); + let fpath = await nextFileName('fileio_test_rename_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { let newf = fpath + 'aaa'; await fileio.rename(fpath, newf, function (err) { expect(fileio.accessSync(newf) == null).assertTrue(); - expect(err == null).assertTrue(); expect(fileio.unlinkSync(newf) == null).assertTrue(); done(); }) @@ -68,12 +75,16 @@ describe('fileio_rename', function () { }); /** - * @tc.number SUB_DF_FileIO_RenameAsync_0020 + * @tc.number SUB_DF_FILEIO_RENAME_ASYNC_0020 * @tc.name fileio_test_rename_async_002 * @tc.desc Test renameAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rename_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_rename_async_002'); + let fpath = await nextFileName('fileio_test_rename_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { diff --git a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rmdir.test.js b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rmdir.test.js index c92ba68a158ca2da178b6b04c2783ba528571b98..30107b8a44a57fae1ae109f1173854974fe09f17 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rmdir.test.js +++ b/storage/storagefileiojstest/src/main/js/default/test/module_fileio/members/rmdir.test.js @@ -21,12 +21,16 @@ import { describe('fileio_rmdir', function () { /** - * @tc.number SUB_DF_FileIO_RmdirAsync_0000 + * @tc.number SUB_DF_FILEIO_RMDIR_ASYNC_0000 * @tc.name fileio_test_rmdir_async_000 * @tc.desc Test rmdirAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rmdir_async_000', 0, async function (done) { - let dpath = nextFileName('fileio_test_rmdir_async_000') + 'd'; + let dpath = await nextFileName('fileio_test_rmdir_async_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -48,17 +52,20 @@ describe('fileio_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_RmdirAsync_0010 + * @tc.number SUB_DF_FILEIO_RMDIR_ASYNC_0010 * @tc.name fileio_test_rmdir_async_001 * @tc.desc Test rmdirAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rmdir_async_001', 0, async function (done) { - let dpath = nextFileName('fileio_test_rmdir_async_001') + 'd'; + let dpath = await nextFileName('fileio_test_rmdir_async_001') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); - fileio.rmdir(dpath, async function (err) { - expect(!err).assertTrue(); + fileio.rmdir(dpath, function (err) { fileio .access(dpath) .then(function () { @@ -77,12 +84,16 @@ describe('fileio_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_RmdirAsync_0020 + * @tc.number SUB_DF_FILEIO_RMDIR_ASYNC_0020 * @tc.name fileio_test_rmdir_async_002 * @tc.desc Test rmdirAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_rmdir_async_002', 0, async function (done) { - let dpath = nextFileName('fileio_test_rmdir_async_002') + 'd'; + let dpath = await nextFileName('fileio_test_rmdir_async_002') + 'd'; expect(prepareFile(dpath, FILE_CONTENT)).assertTrue(); try { @@ -99,13 +110,17 @@ describe('fileio_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_RmdirAsync_0030 + * @tc.number SUB_DF_FILEIO_RMDIR_ASYNC_0030 * @tc.name fileio_test_rmdir_async_003 * @tc.desc Test rmdirAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_rmdir_async_003', 0, async function (done) { + it('fileio_test_rmdir_async_003', 0, function (done) { try { - fileio.rmdir('1.js', async function (err) { + fileio.rmdir('1.js', function (err) { expect(!!err).assertTrue(); done(); }); @@ -116,12 +131,16 @@ describe('fileio_rmdir', function () { }); /** - * @tc.number SUB_DF_FileIO_RmdirSync_0000 + * @tc.number SUB_DF_FILEIO_RMDIR_SYNC_0000 * @tc.name fileio_test_rmdir_sync_000 * @tc.desc Test rmdirSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_rmdir_sync_000', 0, function () { - let dpath = nextFileName('fileio_test_rmdir_sync_000') + 'd'; + it('fileio_test_rmdir_sync_000', 0, async function () { + let dpath = await nextFileName('fileio_test_rmdir_sync_000') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); 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 9305e4d34e1669df098f331794a6335d950ed539..09473de82e1b3e925616b0fdfac08ece20f6741e 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 @@ -21,13 +21,17 @@ import { describe('fileio_stat', function () { /** - * @tc.number SUB_DF_FileIO_statSync_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_0000 * @tc.name fileio_stat_sync_000 * @tc.desc Test Stat.statSync() interfaces. * This interface shall work properly in normal case. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_000'); + it('fileio_stat_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -41,13 +45,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_statSync_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_0010 * @tc.name fileio_stat_sync_001 * @tc.desc Test Stat.statSync() interfaces. * This interface shall throw an exception when the file isnt's exist. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_001'); + it('fileio_stat_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_001'); try { fileio.statSync(fpath); @@ -57,13 +65,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_Sync_Dev_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_DEV_0000 * @tc.name fileio_stat_sync_dev_000 * @tc.desc Test Stat.statSync_Dev() interfaces. * @tc.desc Test the dev member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_dev_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_dev_000'); + it('fileio_stat_sync_dev_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -77,13 +89,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_Ino_0000 + * @tc.number SUB_DF_FILEIO_STAT_INO_0000 * @tc.name fileio_stat_sync_ino_000 * @tc.desc Test Stat.statSync_Ino() interfaces. * @tc.desc Test the ino member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_ino_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_ino_000'); + it('fileio_stat_sync_ino_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -97,13 +113,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_Mode_0000 + * @tc.number SUB_DF_FILEIO_STAT_MODE_0000 * @tc.name fileio_stat_sync_mode_000 * @tc.desc Test Stat.statSync_Mode() interfaces. * @tc.desc Test the mode member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_mode_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_mode_000'); + it('fileio_stat_sync_mode_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -117,13 +137,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_Nlink_0000 + * @tc.number SUB_DF_FILEIO_STAT_NLINK_0000 * @tc.name fileio_stat_sync_nlink_000 * @tc.desc Test Stat.statSync_Nlink() interfaces. * @tc.desc Test the nlink member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_nlink_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_nlink_000'); + it('fileio_stat_sync_nlink_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -137,13 +161,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_Stat_Uid_0000 + * @tc.number SUB_DF_FILEIO_STAT_UID_0000 * @tc.name fileio_stat_sync_uid_000 * @tc.desc Test Stat.statSync_Uid() interfaces. * @tc.desc Test the uid member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_uid_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_uid_000'); + it('fileio_stat_sync_uid_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -157,13 +185,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Gid_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_GID_0000 * @tc.name fileio_stat_sync_gid_000 * @tc.desc Test Stat.statSync_Gid() interfaces. * @tc.desc Test the gid member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_gid_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_gid_000'); + it('fileio_stat_sync_gid_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -177,13 +209,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Rdev_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_RDEV_0000 * @tc.name fileio_stat_sync_rdev_000 * @tc.desc Test Stat.statSync_Rdev() interfaces. * @tc.desc Test the rdev member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_rdev_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_rdev_000'); + it('fileio_stat_sync_rdev_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -197,13 +233,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Size_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_SIZE_0000 * @tc.name fileio_stat_sync_size_000 * @tc.desc Test Stat.statSync_Size() interfaces. * @tc.desc Test the size member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_size_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_size_000'); + it('fileio_stat_sync_size_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -217,13 +257,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Blocks_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_BLOCKS_0000 * @tc.name fileio_stat_sync_blocks_000 * @tc.desc Test Stat.statSync_Block() interfaces. * @tc.desc Test the blocks member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_blocks_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_blocks_000'); + it('fileio_stat_sync_blocks_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -237,13 +281,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Atime_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ATIME_0000 * @tc.name fileio_stat_sync_atime_000 * @tc.desc Test Stat.statSync_Atime() interfaces. * @tc.desc Test the atime member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_atime_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_atime_000'); + it('fileio_stat_sync_atime_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -257,13 +305,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Mtime_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_MTIME_0000 * @tc.name fileio_stat_sync_mtime_000 * @tc.desc Test Stat.statSync_Mtime() interfaces. * @tc.desc Test the mtime member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_mtime_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_mtime_000'); + it('fileio_stat_sync_mtime_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -277,13 +329,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_Ctime_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_CTIME_0000 * @tc.name fileio_stat_sync_ctime_000 * @tc.desc Test Stat.statSync_Ctime() interfaces. * @tc.desc Test the ctime member of class Stat + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_ctime_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_ctime_000'); + it('fileio_stat_sync_ctime_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -297,14 +353,18 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISBLOCKDEVICE_0000 * @tc.name fileio_stat_sync_is_block_device_000 * @tc.desc Test Stat.statSync_IsBlockDevice() interfaces. * @tc.desc Test the isBlockDevice() method of class Stat. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_block_device_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_block_device_000'); + it('fileio_stat_sync_is_block_device_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -318,14 +378,18 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISBLOCKDEVICE_0010 * @tc.name fileio_stat_sync_is_block_device_001 * @tc.desc Test Stat.statSync_IsBlockDevice() interfaces. * @tc.desc Test the isBlockDevice() method of class Stat. * This interface shall not treat a normal file as a block special device. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_block_device_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_block_device_001'); + it('fileio_stat_sync_is_block_device_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -339,13 +403,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsBlockDevice_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISBLOCKDEVICE_0020 * @tc.name fileio_stat_sync_is_block_device_002 * @tc.desc Test Stat.statSync_IsBlockDevice() interfaces. * @tc.desc Test the isBlockDevice() method of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_block_device_002', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_block_device_002'); + it('fileio_stat_sync_is_block_device_002', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_block_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -358,13 +426,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISCHARACTER_DEVICE_0000 * @tc.name fileio_stat_sync_is_character_device_000 * @tc.desc Test Stat.statsync_IsCharacterDevice() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_character_device_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_character_device_000'); + it('fileio_stat_sync_is_character_device_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -378,13 +450,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISCHARACTER_DEVICE_0010 * @tc.name fileio_stat_sync_is_character_device_001 * @tc.desc Test Stat.statsync_IsCharacterDevice() interfaces. * This interface shall not treat a normal file as a character special device. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_character_device_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_character_device_001'); + it('fileio_stat_sync_is_character_device_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -398,12 +474,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsCharacterDevice_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISCHARACTER_DEVICE_0020 * @tc.name fileio_stat_sync_is_character_device_002 * @tc.desc Test Stat.statsync_IsCharacterDevice() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_character_device_002', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_character_device_002'); + it('fileio_stat_sync_is_character_device_002', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_character_device_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -416,13 +496,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISDIRECTORY_0000 * @tc.name fileio_stat_sync_is_directory_000 * @tc.desc Test Stat.statsync_isDirectory() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_directory_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_directory_000'); + it('fileio_stat_sync_is_directory_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -436,13 +520,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISDIRECTORY_0010 * @tc.name fileio_stat_sync_is_directory_001 * @tc.desc Test Stat.statsync_isDirectory() interfaces. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_directory_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_directory_001'); + it('fileio_stat_sync_is_directory_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -456,13 +544,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISDIRECTORY_0020 * @tc.name fileio_stat_sync_is_directory_002 * @tc.desc Test Stat.statsync_isDirectory() interfaces. * This interface shall treat a directory as a directory. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_directory_002', 0, function () { - let dpath = nextFileName('fileio_stat_sync_is_directory_002') + 'd'; + it('fileio_stat_sync_is_directory_002', 0, async function () { + let dpath = await nextFileName('fileio_stat_sync_is_directory_002') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -476,12 +568,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsDirectory_0030 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISDIRECTORY_0030 * @tc.name fileio_stat_sync_is_directory_003 * @tc.desc Test Stat.statsync_isDirectory() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_directory_003', 0, function () { - let dpath = nextFileName('fileio_stat_sync_is_directory_003') + 'd'; + it('fileio_stat_sync_is_directory_003', 0, async function () { + let dpath = await nextFileName('fileio_stat_sync_is_directory_003') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -494,13 +590,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFIFO_0000 * @tc.name fileio_stat_sync_is_fifo_000 * @tc.desc Test Stat.statsync_isFIFO() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_fifo_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_fifo_000'); + it('fileio_stat_sync_is_fifo_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -514,13 +614,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFIFO_0010 * @tc.name fileio_stat_sync_is_fifo_001 * @tc.desc Test Stat.statsync_isFIFO() interfaces. * This interface shall not treat a normal file as a FIFO. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_fifo_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_fifo_001'); + it('fileio_stat_sync_is_fifo_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -534,12 +638,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFIFO_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFIFO_0020 * @tc.name fileio_stat_sync_is_fifo_002 * @tc.desc Test Stat.statsync_isFIFO() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_fifo_002', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_fifo_002'); + it('fileio_stat_sync_is_fifo_002', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_fifo_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -552,13 +660,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFILE_0000 * @tc.name fileio_stat_sync_is_file_000 * @tc.desc Test Stat.statsync_isFile() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_file_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_file_000'); + it('fileio_stat_sync_is_file_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -572,13 +684,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFILE_0010 * @tc.name fileio_stat_sync_is_file_001 * @tc.desc Test Stat.statsync_isFile() interfaces. * This interface shall treat a normal file as a normal file. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_file_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_file_001'); + it('fileio_stat_sync_is_file_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -592,13 +708,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFILE_0020 * @tc.name fileio_stat_sync_is_file_002 * @tc.desc Test Stat.statsync_isFile() interfaces. * This interface shall not treat a directory as a normal file. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_file_002', 0, function () { - let dpath = nextFileName('fileio_stat_sync_is_file_002'); + it('fileio_stat_sync_is_file_002', 0, async function () { + let dpath = await nextFileName('fileio_stat_sync_is_file_002'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -612,12 +732,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsFILE_0030 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISFILE_0030 * @tc.name fileio_stat_sync_is_file_003 * @tc.desc Test Stat.statsync_isFile() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_file_003', 0, function () { - let dpath = nextFileName('fileio_stat_sync_is_file_003'); + it('fileio_stat_sync_is_file_003', 0, async function () { + let dpath = await nextFileName('fileio_stat_sync_is_file_003'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -630,13 +754,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSOCKET_0000 * @tc.name fileio_stat_sync_is_socket_000 * @tc.desc Test Stat.statsync_isSocket() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_socket_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_socket_000'); + it('fileio_stat_sync_is_socket_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -650,13 +778,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSOCKET_0010 * @tc.name fileio_stat_sync_is_socket_001 * @tc.desc Test Stat.statsync_isSocket() interfaces. * This interface shall not treat a file as a socket. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_socket_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_socket_001'); + it('fileio_stat_sync_is_socket_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -670,12 +802,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSocket_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSOCKET_0020 * @tc.name fileio_stat_sync_is_socket_002 * @tc.desc Test Stat.statsync_isSocket() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_socket_002', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_socket_002'); + it('fileio_stat_sync_is_socket_002', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_socket_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -688,13 +824,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSYMBOLICLINK_0000 * @tc.name fileio_stat_sync_is_symbolic_link_000 * @tc.desc Test Stat.statasync_isSymbolicLink() interfaces. * This interface shall return a boolean variable. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_symbolic_link_000', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_symbolic_link_000'); + it('fileio_stat_sync_is_symbolic_link_000', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -708,13 +848,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSYMBOLICLINK_0010 * @tc.name fileio_stat_sync_is_symbolic_link_001 * @tc.desc Test Stat.statasync_isSymbolicLink() interfaces. * This interface shall not treat a normal file as a symbolic link. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_symbolic_link_001', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_symbolic_link_001'); + it('fileio_stat_sync_is_symbolic_link_001', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -728,12 +872,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatSync_IsSymbolicLink_0020 + * @tc.number SUB_DF_FILEIO_STAT_SYNC_ISSYMBOLICLINK_0020 * @tc.name fileio_stat_sync_is_symbolic_link_002 * @tc.desc Test Stat.isSymbolicLink() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_stat_sync_is_symbolic_link_002', 0, function () { - let fpath = nextFileName('fileio_stat_sync_is_symbolic_link_002'); + it('fileio_stat_sync_is_symbolic_link_002', 0, async function () { + let fpath = await nextFileName('fileio_stat_sync_is_symbolic_link_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -746,13 +894,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_statAsync_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_0000 * @tc.name fileio_stat_async_000 * @tc.desc Test Stat.statAsync() interface. * This interface shall work properly in normal case when providing the promise async model. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_000'); + let fpath = await nextFileName('fileio_stat_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -768,18 +920,21 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_statAsync_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_0000 * @tc.name fileio_stat_async_001 * @tc.desc Test Stat.statAsync() interface. * This interface shall work properly in normal case when providing the callback async model. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_001'); + let fpath = await nextFileName('fileio_stat_async_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.stat(fpath, function (error) { - expect(!error).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); done(); }); @@ -790,12 +945,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Dev_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_DEV_0000 * @tc.name fileio_stat_async_dev_000 * @tc.desc Test the dev member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_dev_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_dev_000'); + let fpath = await nextFileName('fileio_stat_async_dev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -810,12 +969,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Ino_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_INO_0000 * @tc.name fileio_stat_async_ino_000 * @tc.desc Test the ino member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_ino_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_ino_000'); + let fpath = await nextFileName('fileio_stat_async_ino_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -830,12 +993,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Mode_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_MODE_0000 * @tc.name fileio_stat_async_mode_000 * @tc.desc Test the mode member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_mode_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_mode_000'); + let fpath = await nextFileName('fileio_stat_async_mode_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -850,12 +1017,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Nlink_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_NLINK_0000 * @tc.name fileio_stat_async_nlink_000 * @tc.desc Test the nlink member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_nlink_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_nlink_000'); + let fpath = await nextFileName('fileio_stat_async_nlink_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -870,12 +1041,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Uid_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_UID_0000 * @tc.name fileio_stat_async_uid_000 * @tc.desc Test the uid member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_uid_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_uid_000'); + let fpath = await nextFileName('fileio_stat_async_uid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -890,12 +1065,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Gid_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_GID_0000 * @tc.name fileio_stat_async_gid_000 * @tc.desc Test the gid member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_gid_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_gid_000'); + let fpath = await nextFileName('fileio_stat_async_gid_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -910,12 +1089,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Rdev_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_RDEV_0000 * @tc.name fileio_stat_async_rdev_000 * @tc.desc Test the rdev member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_rdev_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_rdev_000'); + let fpath = await nextFileName('fileio_stat_async_rdev_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -930,12 +1113,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Size_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_SIZE_0000 * @tc.name fileio_stat_async_size_000 * @tc.desc Test the size member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_size_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_size_000'); + let fpath = await nextFileName('fileio_stat_async_size_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -950,13 +1137,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Blocks_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_BLOCKS_0000 * @tc.name fileio_stat_async_blocks_000 * @tc.desc Test Stat.blocks() interface. * @tc.desc Test the blocks member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_blocks_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_blocks_000'); + let fpath = await nextFileName('fileio_stat_async_blocks_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -971,13 +1162,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Atime_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ATIME_0000 * @tc.name fileio_stat_async_atime_000 * @tc.desc Test Stat.atime() interface. * @tc.desc Test the atime member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_atime_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_atime_000'); + let fpath = await nextFileName('fileio_stat_async_atime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -992,13 +1187,17 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Mtime_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_MTIME_0000 * @tc.name fileio_stat_async_mtime_000 * @tc.desc Test Stat.mtime() interface. * @tc.desc Test the mtime member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_mtime_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_mtime_000'); + let fpath = await nextFileName('fileio_stat_async_mtime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1013,12 +1212,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_Ctime_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_CTIME_0000 * @tc.name fileio_stat_async_ctime_000 * @tc.desc Test the ctime member of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_ctime_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_ctime_000'); + let fpath = await nextFileName('fileio_stat_async_ctime_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1033,12 +1236,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsBlockDevice_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISBLOCKDEVICE_0000 * @tc.name fileio_stat_async_is_block_device_000 * @tc.desc Test the isBlockDevice method of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_block_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_block_device_000'); + let fpath = await nextFileName('fileio_stat_async_is_block_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1053,12 +1260,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsBlockDevice_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISBLOCKDEVICE_0010 * @tc.name fileio_stat_async_is_block_device_001 * @tc.desc Test the isBlockDevice method of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_block_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_block_device_001'); + let fpath = await nextFileName('fileio_stat_async_is_block_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1073,12 +1284,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsCharacterDevice_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISCHARACTERDEVICE_0000 * @tc.name fileio_stat_async_is_character_device_000 * @tc.desc Test the isCharacterDevice method of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_character_device_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_character_device_000'); + let fpath = await nextFileName('fileio_stat_async_is_character_device_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1093,12 +1308,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsCharacterDevice_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISCHARACTERDEVICE_0010 * @tc.name fileio_stat_async_is_character_device_001 * @tc.desc Test the isCharacterDevice method of class Stat. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_character_device_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_character_device_001'); + let fpath = await nextFileName('fileio_stat_async_is_character_device_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1113,12 +1332,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsDirectory_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISDIRECTORY_0000 * @tc.name fileio_stat_async_is_directory_000 * @tc.desc Test Stat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_directory_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_directory_000'); + let fpath = await nextFileName('fileio_stat_async_is_directory_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1133,12 +1356,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsDirectory_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISDIRECTORY_0010 * @tc.name fileio_stat_async_is_directory_001 * @tc.desc Test Stat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_directory_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_directory_001'); + let fpath = await nextFileName('fileio_stat_async_is_directory_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1153,12 +1380,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsDirectory_0020 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISDIRECTORY_0020 * @tc.name fileio_stat_async_is_directory_002 * @tc.desc Test Stat.isDirectory() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_directory_002', 0, async function (done) { - let dpath = nextFileName('fileio_stat_async_is_directory_002') + 'd'; + let dpath = await nextFileName('fileio_stat_async_is_directory_002') + 'd'; try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1173,12 +1404,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsFIFO_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISFIFO_0000 * @tc.name fileio_stat_async_is_fifo_000 * @tc.desc Test Stat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_fifo_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_fifo_000'); + let fpath = await nextFileName('fileio_stat_async_is_fifo_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1193,12 +1428,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsFIFO_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISFIFO_0010 * @tc.name fileio_stat_async_is_fifo_001 * @tc.desc Test Stat.isFIFO() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_fifo_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_fifo_001'); + let fpath = await nextFileName('fileio_stat_async_is_fifo_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1213,12 +1452,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsFILE_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISFILE_0000 * @tc.name fileio_stat_async_is_file_000 * @tc.desc Test Stat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_file_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_file_000'); + let fpath = await nextFileName('fileio_stat_async_is_file_000'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1233,12 +1476,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsFILE_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISFILE_0010 * @tc.name fileio_stat_async_is_file_001 * @tc.desc Test Stat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_file_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_file_001'); + let fpath = await nextFileName('fileio_stat_async_is_file_001'); expect(isBoolean(prepareFile(fpath, FILE_CONTENT))).assertTrue(); try { @@ -1253,12 +1500,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsFILE_0020 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISFILE_0020 * @tc.name fileio_stat_async_is_file_002 * @tc.desc Test Stat.isFile() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_file_002', 0, async function (done) { - let dpath = nextFileName('fileio_stat_async_is_file_002'); + let dpath = await nextFileName('fileio_stat_async_is_file_002'); try { expect(fileio.mkdirSync(dpath) == null).assertTrue(); @@ -1273,12 +1524,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsSocket_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISSOCKET_0000 * @tc.name fileio_stat_async_is_socket_000 * @tc.desc Test Stat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_socket_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_socket_000'); + let fpath = await nextFileName('fileio_stat_async_is_socket_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1293,12 +1548,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsSocket_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISSOCKET_0010 * @tc.name fileio_stat_async_is_socket_001 * @tc.desc Test Stat.isSocket() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_socket_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_socket_001'); + let fpath = await nextFileName('fileio_stat_async_is_socket_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1313,12 +1572,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsSymbolicLink_0000 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISSYMBOLICLINK_0000 * @tc.name fileio_stat_async_is_symbolic_link_000 * @tc.desc Test Stat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_symbolic_link_000', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_symbolic_link_000'); + let fpath = await nextFileName('fileio_stat_async_is_symbolic_link_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1333,12 +1596,16 @@ describe('fileio_stat', function () { }); /** - * @tc.number SUB_DF_FileIO_StatAsync_IsSymbolicLink_0010 + * @tc.number SUB_DF_FILEIO_STAT_ASYNC_ISSYMBOLICLINK_0010 * @tc.name fileio_stat_async_is_symbolic_link_001 * @tc.desc Test Stat.isSymbolicLink() interface. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_stat_async_is_symbolic_link_001', 0, async function (done) { - let fpath = nextFileName('fileio_stat_async_is_symbolic_link_001'); + let fpath = await nextFileName('fileio_stat_async_is_symbolic_link_001'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -1352,8 +1619,8 @@ describe('fileio_stat', function () { } }); - it('fileio_test_append_file_sync_000', 0, function (done) { - let fpath = nextFileName('fileio_test_append_file_sync_000'); + it('fileio_test_append_file_sync_000', 0, async function (done) { + let fpath = await nextFileName('fileio_test_append_file_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 6e590a5af2ade897f25d7998ac5de2e62147dc41..0e70b78fc5bddc3f86174c38bcd7659744e016b9 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 @@ -21,13 +21,17 @@ import { describe('fileio_symlink', function () { /** - * @tc.number SUB_DF_FileIO_Fdatasync_SymlinkSync_0000 + * @tc.number SUB_DF_FILEIO_SYMLINK_SYNC_0000 * @tc.name fileio_test_symlink_sync_000 * @tc.desc Test SymlinkSync interfaces. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_symlink_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_symlink_sync_000'); + it('fileio_test_symlink_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_symlink_sync_000'); try { fileio.symlinkSync(fpath, fpath + 'aaaa'); @@ -39,13 +43,17 @@ describe('fileio_symlink', function () { }); /** - * @tc.number SUB_DF_FileIO_Fdatasync_SymlinkAsync_0000 + * @tc.number SUB_DF_FILEIO_SYMLINK_ASYNC_0000 * @tc.name fileio_test_symlink_async_000 * @tc.desc Test SymlinkAsync interfaces. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_symlink_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_test_symlink_async_000'); + let fpath = await nextFileName('fileio_test_symlink_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -66,20 +74,23 @@ describe('fileio_symlink', function () { }); /** - * @tc.number SUB_DF_FileIO_Fdatasync_SymlinkAsync_0010 + * @tc.number SUB_DF_FILEIO_SYMLINK_ASYNC_0010 * @tc.name fileio_test_symlink_async_001 * @tc.desc Test SymlinkAsync interfaces. * This interface shall not treat a normal file as a directory. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_symlink_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_symlink_async_010'); + let fpath = await nextFileName('fileio_test_symlink_async_010'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { await fileio.symlink(fpath, fpath + 'pass2', function (err) { expect(fileio.accessSync(fpath + 'pass2') == null).assertTrue(); fileio.unlinkSync(fpath + 'pass2'); - expect(err == null).assertTrue(); done(); }); } catch (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 3f33980a9698a6ce820a82c171dc5e87f4951165..8ff53209b9dc7d6181222cc28103a0a1262a00a7 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 @@ -21,18 +21,21 @@ import { describe('fileio_truncate', function () { /** - * @tc.number SUB_DF_FileIO_TruncateAsync_0000 + * @tc.number SUB_DF_FILEIO_TRUNCATE_ASYNC_0000 * @tc.name fileio_truncate_async_000 * @tc.desc Test truncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_truncate_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_truncate_async_000'); + let fpath = await nextFileName('fileio_truncate_async_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); let truncateLen = 5; try { fileio.truncate(fpath, truncateLen, function (err) { - expect(err == null).assertTrue(); let fd = fileio.openSync(fpath, 0o2); expect(isIntNum(fd)).assertTrue(); let len = fileio.readSync(fd, new ArrayBuffer(4096)); @@ -48,12 +51,16 @@ describe('fileio_truncate', function () { }); /** - * @tc.number SUB_DF_FileIO_TruncateAsync_0010 + * @tc.number SUB_DF_FILEIO_TRUNCATE_ASYNC_0010 * @tc.name fileio_truncate_async_001 * @tc.desc Test truncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_truncate_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_truncate_async_001'); + let fpath = await nextFileName('fileio_truncate_async_001'); expect(prepareFile(fpath, 'truncate')).assertTrue(); let truncateLen = 2; @@ -80,12 +87,16 @@ describe('fileio_truncate', function () { }); /** - * @tc.number SUB_DF_FileIO_TruncateAsync_0020 + * @tc.number SUB_DF_FILEIO_TRUNCATE_ASYNC_0020 * @tc.name fileio_truncate_async_002 * @tc.desc Test truncateAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_truncate_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_truncate_async_002'); + let fpath = await nextFileName('fileio_truncate_async_002'); let truncateLen = 2; try { @@ -99,12 +110,16 @@ describe('fileio_truncate', function () { }); /** - * @tc.number SUB_DF_FileIO_TruncateSync_0000 + * @tc.number SUB_DF_FILEIO_TRUNCATE_SYNC_0000 * @tc.name fileio_test_truncate_sync_000 * @tc.desc Test truncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_truncate_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_truncate_sync_000'); + it('fileio_test_truncate_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_truncate_sync_000'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -118,12 +133,16 @@ describe('fileio_truncate', function () { }); /** - * @tc.number SUB_DF_FileIO_TruncateSync_0010 + * @tc.number SUB_DF_FILEIO_TRUNCATE_SYNC_0010 * @tc.name fileio_test_truncate_sync_001 * @tc.desc Test truncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_truncate_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_truncate_sync_001'); + it('fileio_test_truncate_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_truncate_sync_001'); try { fileio.truncateSync(fpath); @@ -132,9 +151,13 @@ describe('fileio_truncate', function () { }); /** - * @tc.number SUB_DF_FileIO_TruncateSync_0020 + * @tc.number SUB_DF_FILEIO_TRUNCATE_SYNC_0020 * @tc.name fileio_test_truncate_sync_002 * @tc.desc Test truncateSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_truncate_sync_002', 0, function () { try { 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 7ee250a89bbff7567fca1e38237df514821e53ae..d53672d6f4ff201fc14fa5a2811ca129145b8d02 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 @@ -21,9 +21,13 @@ import { describe('fileio_unlink', function () { /** - * @tc.number SUB_DF_FileIO_UnlinkSync_0000 + * @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0000 * @tc.name fileio_test_unlink_sync_000 * @tc.desc Test unlinkSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_unlink_sync_000', 0, function () { try { @@ -34,12 +38,16 @@ describe('fileio_unlink', function () { }); /** - * @tc.number SUB_DF_FileIO_UnlinkSync_0010 + * @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0010 * @tc.name fileio_test_unlink_sync_001 * @tc.desc Test unlinkSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_unlink_sync_001', 0, function () { - let fpath = nextFileName('fileIOTest'); + it('fileio_test_unlink_sync_001', 0, async function () { + let fpath = await nextFileName('fileIOTest'); try { fileio.unlinkSync(fpath); @@ -49,12 +57,16 @@ describe('fileio_unlink', function () { }); /** - * @tc.number SUB_DF_FileIO_UnlinkSync_0020 + * @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0020 * @tc.name fileio_test_unlink_sync_002 * @tc.desc Test unlinkSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_unlink_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_unlink_sync_002'); + it('fileio_test_unlink_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_unlink_sync_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -70,9 +82,13 @@ describe('fileio_unlink', function () { * @tc.number SUB_DF_FileIO_UnlinkAync_0000 * @tc.name fileio_test_unlink_async_000 * @tc.desc Test unlinkAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_unlink_async_000', 0, async function (done) { - let fpath = nextFileName('fileIOTest'); + let fpath = await nextFileName('fileIOTest'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -88,9 +104,13 @@ describe('fileio_unlink', function () { * @tc.number SUB_DF_FileIO_UnlinkAync_0010 * @tc.name fileio_test_unlink_async_001 * @tc.desc Test unlinkAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_unlink_async_001', 0, async function (done) { - let fpath = nextFileName('fileIOTest'); + let fpath = await nextFileName('fileIOTest'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { @@ -104,19 +124,21 @@ describe('fileio_unlink', function () { }); /** - * @tc.number SUB_DF_FileIO_UnlinkSync_0020 + * @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0020 * @tc.name fileio_test_unlink_sync_002 * @tc.desc Test unlink() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_unlink_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_unlink_async_002'); + let fpath = await nextFileName('fileio_test_unlink_async_002'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { fileio.unlink(fpath, function (err) { - if (!err) { - done(); - } + done(); }); } catch (e) { console.log('fileio_test_unlink_async_002 has failed for ' + e); @@ -125,12 +147,16 @@ describe('fileio_unlink', function () { }); /** - * @tc.number SUB_DF_FileIO_UnlinkSync_0030 + * @tc.number SUB_DF_FILEIO_UNLINK_SYNC_0030 * @tc.name fileio_test_unlink_sync_003 * @tc.desc Test unlink() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_unlink_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_unlink_async_003'); + let fpath = await nextFileName('fileio_test_unlink_async_003'); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); try { 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 6b0677b2c8ed94cb5a482acdf43dc17b3d044b7c..aba06c2c345abefd9a737927371222f0928d1b66 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 @@ -21,12 +21,16 @@ import { describe('fileio_write', function () { /** - * @tc.number SUB_DF_FileIO_WriteSync_0000 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0000 * @tc.name fileio_test_write_sync_000 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_000', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_000'); + it('fileio_test_write_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_000'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -41,12 +45,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0010 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0010 * @tc.name fileio_test_write_sync_001 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_001', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_001'); + it('fileio_test_write_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_001'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -65,12 +73,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0020 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0020 * @tc.name fileio_test_write_sync_002 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_002', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_002'); + it('fileio_test_write_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_002'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -89,12 +101,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0030 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0030 * @tc.name fileio_test_write_sync_003 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_003', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_003'); + it('fileio_test_write_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_003'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -113,12 +129,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0040 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0040 * @tc.name fileio_test_write_sync_004 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_004', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_004'); + it('fileio_test_write_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_004'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -138,12 +158,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0050 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0050 * @tc.name fileio_test_write_sync_005 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_005', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_005'); + it('fileio_test_write_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_005'); const invalidOffset = 999; let fd; @@ -163,12 +187,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0060 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0060 * @tc.name fileio_test_write_sync_006 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_006', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_006'); + it('fileio_test_write_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_006'); const invalidLength = 999; let fd; @@ -188,9 +216,13 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0070 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0070 * @tc.name fileio_test_write_sync_007 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_sync_007', 0, function () { try { @@ -201,9 +233,13 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0080 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0080 * @tc.name fileio_test_write_sync_008 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_sync_008', 0, function () { try { @@ -214,12 +250,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteSync_0090 + * @tc.number SUB_DF_FILEIO_WRITE_SYNC_0090 * @tc.name fileio_test_write_sync_009 * @tc.desc Test writeSync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ - it('fileio_test_write_sync_009', 0, function () { - let fpath = nextFileName('fileio_test_write_sync_009'); + it('fileio_test_write_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_test_write_sync_009'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -235,12 +275,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0000 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0000 * @tc.name fileio_test_write_async_000 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_write_async_000', 0, async function (done) { - let fpath = nextFileName('fileio_write_async_000'); + let fpath = await nextFileName('fileio_write_async_000'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -256,12 +300,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0010 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0010 * @tc.name fileio_test_write_async_001 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_001', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_001'); + let fpath = await nextFileName('fileio_test_write_async_001'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -280,12 +328,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0020 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0020 * @tc.name fileio_test_write_async_002 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_002', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_002'); + let fpath = await nextFileName('fileio_test_write_async_002'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -305,12 +357,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0030 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0030 * @tc.name fileio_test_write_async_003 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_003', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_003'); + let fpath = await nextFileName('fileio_test_write_async_003'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -331,12 +387,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0040 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0040 * @tc.name fileio_test_write_async_004 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_004', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_004'); + let fpath = await nextFileName('fileio_test_write_async_004'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -358,12 +418,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0050 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0050 * @tc.name fileio_test_write_async_005 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_005', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_005'); + let fpath = await nextFileName('fileio_test_write_async_005'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -384,12 +448,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0060 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0060 * @tc.name fileio_test_write_async_006 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_006', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_006'); + let fpath = await nextFileName('fileio_test_write_async_006'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -399,8 +467,7 @@ describe('fileio_write', function () { FILE_CONTENT, { offset: 1, - }, - function (error, bytesWritten) { + }, function (error, bytesWritten) { expect(bytesWritten == FILE_CONTENT.length - 1).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); @@ -414,12 +481,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0070 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0070 * @tc.name fileio_test_write_async_007 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_007', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_007'); + let fpath = await nextFileName('fileio_test_write_async_007'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -430,8 +501,7 @@ describe('fileio_write', function () { { offset: 1, length: 5, - }, - function (error, bytesWritten) { + }, function (error, bytesWritten) { expect(bytesWritten == 5).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); @@ -445,12 +515,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0080 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0080 * @tc.name fileio_test_write_async_008 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_008', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_008'); + let fpath = await nextFileName('fileio_test_write_async_008'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -462,8 +536,7 @@ describe('fileio_write', function () { offset: 1, length: 5, position: 5, - }, - function (error, bytesWritten) { + }, function (error, bytesWritten) { expect(bytesWritten == 5).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); @@ -477,12 +550,16 @@ describe('fileio_write', function () { }); /** - * @tc.number SUB_DF_FileIO_WriteAsync_0090 + * @tc.number SUB_DF_FILEIO_WRITE_ASYNC_0090 * @tc.name fileio_test_write_async_009 * @tc.desc Test writeAsync() interfaces. + * @tc.size MEDIUM + * @tc.type Functoin + * @tc.level Level 0 + * @tc.require */ it('fileio_test_write_async_009', 0, async function (done) { - let fpath = nextFileName('fileio_test_write_async_009'); + let fpath = await nextFileName('fileio_test_write_async_009'); try { let fd = fileio.openSync(fpath, 0o102, 0o666); @@ -495,8 +572,7 @@ describe('fileio_write', function () { length: 5, position: 5, encoding: 'utf-8', - }, - function (error, bytesWritten) { + }, function (error, bytesWritten) { expect(bytesWritten == 5).assertTrue(); expect(fileio.closeSync(fd) == null).assertTrue(); expect(fileio.unlinkSync(fpath) == null).assertTrue(); diff --git a/storage/storagefileioperformancejstest/BUILD.gn b/storage/storagefileioperformancejstest/BUILD.gn deleted file mode 100644 index c9b2a9aebec04d136ba5f50e986c8be3aad6f6cd..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefileioperformance_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefileioperformance_js_assets", - ":storagefileioperformance_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFileIoPerformanceJsTest" -} -ohos_js_assets("storagefileioperformance_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefileioperformance_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefileioperformancejstest/Test.json b/storage/storagefileioperformancejstest/Test.json deleted file mode 100644 index 5316a23e0736267575e35dbaa1f9823f999320e2..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFileIoPerformanceJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/signature/openharmony_sx.p7b b/storage/storagefileioperformancejstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefileioperformancejstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefileioperformancejstest/src/main/config.json b/storage/storagefileioperformancejstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/src/main/js/default/app.js b/storage/storagefileioperformancejstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefileioperformancejstest/src/main/js/default/i18n/en-US.json b/storage/storagefileioperformancejstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefileioperformancejstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.css b/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.hml b/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.js b/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index 61921cf3ba7d0a16a9c2edb9b9f04c1fb69a6333..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/Common.js b/storage/storagefileioperformancejstest/src/main/js/default/test/Common.js deleted file mode 100644 index c5bc08482173733896e49c8fab5239bef520ee7c..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' - -export const FILE_CONTENT = 'hello world' - -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() !== null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js b/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js deleted file mode 100644 index 46903945c74dc5f606efbbe5b0a67798a6fee1f7..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/FileIOPerformance.js +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import { - describe, - it, -} - from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - nextFileName, - sleep, - randomString -} - from './Common' - -describe('fileTest', function () { - - /** - * @tc.number SUB_STORAGE_fileioPerformance_Dir_Dirent - * @tc.name fileioPerformance_Dir_Dirent - * @tc.desc Dirent Perform 1000 performance tests - */ - it('fileioPerformance_Dir_Dirent', 0, function () { - for (let i = 0; i < 1000; i++) { - let dpath = nextFileName('fileioPerformance_Dir') + 'd' - let fpath = dpath + '/f0' - fileio.mkdirSync(dpath); - prepareFile(fpath, FILE_CONTENT); - let start = new Date().getTime(); - let dd = fileio.opendirSync(dpath); - let end = new Date().getTime(); - let time = end - start; - console.log('fileioPerformance_Dir,opendirSync:' + dd + ', time:' + time + ',' + i); - let start1 = new Date().getTime(); - let dirent = dd.readSync(); - let end1 = new Date().getTime(); - let time1 = end1 - start1; - console.log('fileioPerformance_Dir,readSync:' + dirent + ', time1:' + time1 + ',' + i); - let start5 = new Date().getTime(); - let isBlockDevice = dirent.isBlockDevice(); - let end5 = new Date().getTime(); - let time5 = end5 - start5; - console.log('fileioPerformance_Dirent,isBlockDevice:' + isBlockDevice + ', time5:' + time5 + ',' + i); - let start6 = new Date().getTime(); - let isCharacterDevice = dirent.isCharacterDevice(); - let end6 = new Date().getTime(); - let time6 = end6 - start6; - console.log('fileioPerformance_Dirent,isCharacterDevice:' + isCharacterDevice + ', time6:' + time6 + ',' + i); - let start7 = new Date().getTime(); - let isDirectory = dirent.isDirectory(); - let end7 = new Date().getTime(); - let time7 = end7 - start7; - console.log('fileioPerformance_Dirent,isDirectory:' + isDirectory + ', time7:' + time7 + ',' + i); - let start8 = new Date().getTime(); - let isFIFO = dirent.isFIFO(); - let end8 = new Date().getTime(); - let time8 = end8 - start8; - console.log('fileioPerformance_Dirent,isFIFO:' + isFIFO + ', time8:' + time8 + ',' + i); - let start9 = new Date().getTime(); - let isFile = dirent.isFile(); - let end9 = new Date().getTime(); - let time9 = end9 - start9; - console.log('fileioPerformance_Dirent,isFile:' + isFile + ', time9:' + time9 + ',' + i); - let start1000 = new Date().getTime(); - let isSocket = dirent.isSocket(); - let end1000 = new Date().getTime(); - let time1000 = end1000 - start1000; - console.log('fileioPerformance_Dirent,isSocket:' + isSocket + ', time1000:' + time1000 + ',' + i); - let start12 = new Date().getTime(); - let isSymbolicLink = dirent.isSymbolicLink(); - let end12 = new Date().getTime(); - let time12 = end12 - start12; - console.log('fileioPerformance_Dirent,isSymbolicLink:' + isSymbolicLink + ', time12:' + time12 + ',' + i); - let start2 = new Date().getTime(); - let result = dd.closeSync(); - let end2 = new Date().getTime(); - let time2 = end2 - start2; - console.log('fileioPerformance_Dir,closeSync:' + result + ', time2:' + time2 + ',' + i); - let start3 = new Date().getTime(); - let unlinkSync = fileio.unlinkSync(fpath); - let end3 = new Date().getTime(); - let time3 = end3 - start3; - console.log('fileioPerformance_prop,unlinkSync:' + unlinkSync + ', time3:' + time3 + ',' + i); - let start4 = new Date().getTime(); - let rmdirSync = fileio.rmdirSync(dpath); - let end4 = new Date().getTime(); - let time4 = end4 - start4 - console.log('fileioPerformance_prop,rmdirSync:' + rmdirSync + ', time4:' + time4 + ',' + i); - } - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_stat - * @tc.name fileioPerformance_stat - * @tc.desc Stat Perform 1000 performance tests - */ - it('fileioPerformance_stat', 0, function () { - for (let i = 0; i < 1000; i++) { - let fpath = nextFileName('fileioPerformance_stat-4k'); - let txt = randomString(4096); - prepareFile(fpath, txt); - let start0 = new Date().getTime(); - let stat = fileio.statSync(fpath); - let end0 = new Date().getTime(); - let time0 = end0 - start0; - console.log('stat,statSync:' + stat + ', time0:' + time0 + ',' + i); - let start = new Date().getTime(); - let isBlockDevice = stat.isBlockDevice(); - let end = new Date().getTime(); - let time = end - start; - console.log('stat,isBlockDevice:' + isBlockDevice + ', time:' + time + ',' + i); - let start1 = new Date().getTime(); - let isCharacterDevice = stat.isCharacterDevice(); - let end1 = new Date().getTime(); - let time1 = end1 - start1; - console.log('stat,isCharacterDevice:' + isCharacterDevice + ', time1:' + time1 + ',' + i); - let start2 = new Date().getTime(); - let isDirectory = stat.isDirectory(); - let end2 = new Date().getTime(); - let time2 = end2 - start2; - console.log('stat,isDirectory:' + isDirectory + ', time2:' + time2 + ',' + i); - let start3 = new Date().getTime(); - let isFIFO = stat.isFIFO(); - let end3 = new Date().getTime(); - let time3 = end3 - start3; - console.log('stat,isFIFO:' + isFIFO + ', time3:' + time3 + ',' + i); - let start4 = new Date().getTime(); - let isFile = stat.isFile(); - let end4 = new Date().getTime(); - let time4 = end4 - start4; - console.log('stat,isFile:' + isFile + ', time4:' + time4 + ',' + i); - let start5 = new Date().getTime(); - let isSocket = stat.isSocket(); - let end5 = new Date().getTime(); - let time5 = end5 - start5; - console.log('stat,isSocket:' + isSocket + ', time5:' + time5 + ',' + i); - let start6 = new Date().getTime(); - let isSymbolicLink = stat.isSymbolicLink(); - let end6 = new Date().getTime(); - let time6 = end6 - start6; - console.log('stat,isSymbolicLink:' + isSymbolicLink + ', time6:' + time6 + ',' + i); - } - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_prop - * @tc.name fileioPerformance_prop - * @tc.desc Prop Perform 1000 performance tests - */ - it('fileioPerformance_prop', 0, function () { - let dpath = nextFileName('fileioPerformance_Dir') + 'd' - for (let i = 0; i < 1000; i++) { - let start0 = new Date().getTime(); - let mkdirSync = fileio.mkdirSync(dpath + i); - let end0 = new Date().getTime(); - let time0 = end0 - start0; - console.log('fileioPerformance_prop_mkdirSync,mkdirSync:' + mkdirSync + ', time0:' + time0 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - prepareFile(dpath + '999/f0' + i, randomString(4096)); - } - let fd; - for (let i = 0; i < 1000; i++) { - let start = new Date().getTime(); - fd = fileio.openSync(dpath + '999/f0' + i, 0o102, 0o666); - let end = new Date().getTime(); - let time = end - start - console.log('fileioPerformance_prop_openSync,openSync:' + fd + ', time:' + time + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let accessSync; - let start1 = new Date().getTime(); - accessSync = fileio.accessSync(dpath + '999/f0' + i); - let end1 = new Date().getTime(); - let time1 = end1 - start1; - console.log('fileioPerformance_prop_accessSync,accessSync:' + accessSync + ', time1:' + time1 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let chmodSync; - let start5 = new Date().getTime(); - chmodSync = fileio.chmodSync(dpath + '999/f0' + i, 0o660); - let end5 = new Date().getTime(); - let time5 = end5 - start5; - console.log('fileioPerformance_prop_chmodSync,chmodSync:' + chmodSync + ', time5:' + time5 + ',' + i); - } - let stat = fileio.Stat.statSync(dpath + '999/f0999'); - for (let i = 0; i < 1000; i++) { - let chownSync; - let start6 = new Date().getTime(); - chownSync = fileio.chownSync(dpath + '999/f0' + i, stat.uid, stat.gid); - let end6 = new Date().getTime(); - let time6 = end6 - start6; - console.log('fileioPerformance_prop_chownSync,chownSync:' + chownSync + ', time6:' + time6 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let copyFileSync; - let start7 = new Date().getTime(); - copyFileSync = fileio.copyFileSync(dpath + '999/f0' + i, dpath + '998/f0' + i); - let end7 = new Date().getTime(); - let time7 = end7 - start7; - console.log('fileioPerformance_prop_copyFileSync,copyFileSync:' + copyFileSync + ', time7:' + time7 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let fchmodSync; - let start8 = new Date().getTime(); - fchmodSync = fileio.fchmodSync(fd, 0o660); - let end8 = new Date().getTime(); - let time8 = end8 - start8; - console.log('fileioPerformance_prop_fchmodSync,fchmodSync:' + fchmodSync + ', time8:' + time8 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let fchownSync; - let start9 = new Date().getTime(); - fchownSync = fileio.fchownSync(fd, stat.uid, stat.gid); - let end9 = new Date().getTime(); - let time9 = end9 - start9; - console.log('fileioPerformance_prop_fchownSync,fchownSync:' + fchownSync + ', time9:' + time9 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let fstatSync; - let start1000 = new Date().getTime(); - fstatSync = fileio.fstatSync(fd); - let end1000 = new Date().getTime(); - let time1000 = end1000 - start1000; - console.log('fileioPerformance_prop_fstatSync,fstatSync:' + fstatSync + ', time1000:' + time1000 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let ftruncateSync; - let start12 = new Date().getTime(); - ftruncateSync = fileio.ftruncateSync(fd); - let end12 = new Date().getTime(); - let time12 = end12 - start12; - console.log('fileioPerformance_prop_ftruncateSync,:' + ftruncateSync + ', time12:' + time12 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let renameSync; - let start13 = new Date().getTime(); - renameSync = fileio.renameSync(dpath + '998/f0' + i, dpath + '998/f0' + i + 'a'); - let end13 = new Date().getTime(); - let time13 = end13 - start13; - console.log('fileioPerformance_prop_renameSync,renameSync:' + renameSync + ', time13:' + time13 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let truncateSync; - let start14 = new Date().getTime(); - truncateSync = fileio.truncateSync(dpath + '998/f0' + i + 'a', 1000); - let end14 = new Date().getTime(); - let time14 = end14 - start14; - console.log('fileioPerformance_prop_truncateSync,truncateSync:' + truncateSync + ', time14:' + time14 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let fsyncSync; - let start16 = new Date().getTime(); - fsyncSync = fileio.fsyncSync(fd); - let end16 = new Date().getTime(); - let time16 = end16 - start16; - console.log('fileioPerformance_prop_fsyncSync,fsyncSync:' + fsyncSync + ', time16:' + time16 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let closeSync; - let start2 = new Date().getTime(); - let fd1 = fileio.openSync(dpath + '999/f0' + i, 0o102, 0o666); - closeSync = fileio.closeSync(fd1); - let end2 = new Date().getTime(); - let time2 = end2 - start2; - console.log('fileioPerformance_prop_closeSync,closeSync:' + closeSync + ', time2:' + time2 + ',' + i); - } - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_prop_write_read - * @tc.name fileioPerformance_prop_write_read - * @tc.desc Prop_write_read Perform 1000 performance tests - */ - it('fileioPerformance_prop_write_read', 0, function () { - for (let i = 0; i < 1000; i++) { - let dpath = nextFileName('prop_write_read') + 'd'; - let fpath = dpath + '/prop_write_read'; - fileio.mkdirSync(dpath); - prepareFile(fpath, 'a'); - let fd = fileio.openSync(fpath, 0o102, 0o666); - let data = randomString(4096); - let start17 = new Date().getTime(); - let writeSync = fileio.writeSync(fd, data); - let end17 = new Date().getTime(); - let time17 = end17 - start17; - console.log('fileioPerformance_prop_write,4K_prop_writeSync:' + writeSync + ', time17:' + time17 + ',' + i); - let readSync; - let start18 = new Date().getTime(); - writeSync = fileio.readSync(fd, new ArrayBuffer(4096)); - let end18 = new Date().getTime(); - let time18 = end18 - start18; - console.log('fileioPerformance_prop_readSync,4K_prop_readSync:' + readSync + ', time18:' + time18 + ',' + i); - fileio.closeSync(fd); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - } - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_stream - * @tc.name fileioPerformance_stream - * @tc.desc Stream Perform 1000 performance tests - */ - it('fileioPerformance_stream', 0, function () { - let fpath = nextFileName('fileioPerformance_stream4K'); - let txt = randomString(4096); - prepareFile(fpath, txt); - for (let i = 0; i < 1000; i++) { - let fd = fileio.openSync(fpath, 0o2); - let start = new Date().getTime(); - let ss = fileio.fdopenStreamSync(fd, 'r+'); - let end = new Date().getTime(); - let time = end - start; - console.log('fileioPerformance_stream,fdopenStreamSync(r+):' + ss + ', time:' + time + ',' + i); - fileio.closeSync(fd); - ss.closeSync(); - } - for (let i = 0; i < 1000; i++) { - let fd0 = fileio.openSync(fpath, 0o2); - let start0 = new Date().getTime(); - let ss0 = fileio.fdopenStreamSync(fd0, 'rb+'); - let end0 = new Date().getTime(); - let time0 = end0 - start0; - console.log('fileioPerformance_stream,fdopenStreamSync(rb+):' + ss0 + ', time0:' + time0 + ',' + i); - fileio.closeSync(fd0); - ss0.closeSync(); - } - for (let i = 0; i < 1000; i++) { - let start1 = new Date().getTime(); - let createFlag0 = fileio.createStreamSync(fpath, 'r+'); - let end1 = new Date().getTime(); - let time1 = end1 - start1; - console.log('fileioPerformance_stream,createStreamSync(r+):' + createFlag0 + ', time1:' + time1 + ',' + i); - createFlag0.closeSync(); - } - for (let i = 0; i < 1000; i++) { - let start2 = new Date().getTime(); - let createFlag = fileio.createStreamSync(fpath, 'rb+'); - let end2 = new Date().getTime(); - let time2 = end2 - start2; - console.log('fileioPerformance_stream,createStreamSync(rb+):' + createFlag + ', time2:' + time2 + ',' + i); - } - for (let i = 0; i < 1000; i++) { - let createFlag = fileio.createStreamSync(fpath, 'r+'); - let start3 = new Date().getTime(); - let readSync = createFlag.readSync(new ArrayBuffer(4096)); - let end3 = new Date().getTime(); - let time3 = end3 - start3 - console.log('fileioPerformance_stream,readSync:' + readSync + ', time3:' + time3 + ',' + i); - createFlag.closeSync(); - } - for (let i = 0; i < 1000; i++) { - let createFlag = fileio.createStreamSync(fpath, 'r+'); - let start4 = new Date().getTime(); - let flushSync = createFlag.flushSync(); - let end4 = new Date().getTime(); - let time4 = end4 - start4 - console.log('fileioPerformance_stream,flushSync:' + flushSync + ', time4:' + time4 + ',' + i); - createFlag.closeSync(); - } - for (let i = 0; i < 1000; i++) { - let createFlag = fileio.createStreamSync(fpath, 'r+'); - let start5 = new Date().getTime(); - let closeSync = createFlag.closeSync(); - let end5 = new Date().getTime(); - let time5 = end5 - start5 - console.log('fileioPerformance_stream,closeSync:' + closeSync + ', time5:' + time5 + ',' + i); - } - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_stream_write_read - * @tc.name fileioPerformance_stream_write_read - * @tc.desc Stream_write_read Perform 1000 performance tests - */ - it('fileioPerformance_stream_write_read_4K', 0, function () { - let fpath = nextFileName('stream_write_read'); - for (let i = 0; i < 1000; i++) { - let ws = fileio.createStreamSync(fpath, 'w'); - let data = randomString(4096); - let start1 = new Date().getTime(); - let writeSync = ws.writeSync(data); - let end1 = new Date().getTime(); - let time1 = end1 - start1 - console.log('fileioPerformance_stream_write,4K_stream_writeSync:' + writeSync + ', time1:' + time1 + ',' + i); - ws.closeSync(); - } - sleep(3000); - for (let i = 0; i < 1000; i++) { - let rs = fileio.createStreamSync(fpath, 'r'); - let start2 = new Date().getTime(); - let readSync = rs.readSync(new ArrayBuffer(4096)); - let end2 = new Date().getTime(); - let time2 = end2 - start2 - console.log('fileioPerformance_stream_readSync,4K_stream_readSync:' + readSync + ', time2:' + time2 + ',' + i); - rs.closeSync(); - } - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_stream_write_read - * @tc.name fileioPerformance_stream_write_read - * @tc.desc Stream_write_read Perform ROM remaining less than 10% of the total - */ - it('fileioPerformance_stream_write_read', 0, function () { - let fpath = nextFileName('stream_write_read'); - let data; - for (let i = 0; i < 1024; i++) { - data = data + randomString(1024); - } - for (let i = 0; i < 1000; i++) { - let ws = fileio.createStreamSync(fpath, 'w'); - let start1 = new Date().getTime(); - let writeSync = ws.writeSync(data); - let end1 = new Date().getTime(); - let time1 = end1 - start1; - console.log('fileioPerformance_stream_write,1M_stream_writeSync:' + writeSync + ', time1:' + time1 + ',' + i); - let rs = fileio.createStreamSync(fpath, 'r'); - let start2 = new Date().getTime(); - let readSync = rs.readSync(new ArrayBuffer(1048576)); - let end2 = new Date().getTime(); - let time2 = end2 - start2 - console.log('fileioPerformance_stream_readSync,1M_stream_readSync:' + readSync + ', time2:' + time2 + ',' + i); - ws.closeSync(); - fileio.unlinkSync(fpath); - } - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_prop_copyFile - * @tc.name fileioPerformance_prop_copyFile - * @tc.desc 0.5G Synchronous opening performance test of test files - * The path needs to be manually placed in advance - * data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件) - */ - it('fileioPerformance_prop_copyFile', 0, function () { - console.log('---fileioPerformance_prop_copyFile 0.5G---start---'); - let fpath = nextFileName('p1'); - let fpathTarget = nextFileName('p2'); - for (let i = 0; i < 1000; i++) { - let start2 = new Date().getTime(); - let copyFileSync = fileio.copyFileSync(fpath, fpathTarget); - let end2 = new Date().getTime(); - let time2 = end2 - start2 - console.log('fileioPerformance_prop_copyFileSync,copyFileSync:' + copyFileSync + ', time2:' + time2 + ',' + i); - fileio.unlinkSync(fpathTarget); - sleep(300); - } - fileio.closeSync(fd); - sleep(3000); - }); - - /** - * @tc.number SUB_STORAGE_fileioPerformance_prop_openSync - * @tc.name fileioPerformance_prop_openSync - * @tc.desc 0.5G Synchronous opening performance test of test files - * The path needs to be manually placed in advance - * data/accounts/account_0/appdata/ohos.acts.distributeddatamgr.distributedfile/cache/p1'的0.5g文件) - */ - it('fileioPerformance_prop_openSync', 0, function () { - console.log('---fileioPerformance_prop_openSync 0.5G---start---'); - let fpath = nextFileName('p1'); - let fd - for (let i = 0; i < 1000; i++) { - let start = new Date().getTime(); - fd = fileio.openSync(fpath, 0o2002); - let end = new Date().getTime(); - let time = end - start - console.log('fileioPerformance_prop_openSync,openSync:' + fd + ', time:' + time + ',' + i); - } - fileio.closeSync(fd); - sleep(3000); - }); -}); diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js b/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js deleted file mode 100644 index 21db7a37acdf6c28a1f07023544cb95d0ce854b9..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/FilePerformance.js +++ /dev/null @@ -1,505 +0,0 @@ -/* - * Copyright (C) 2021 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 file from '@system.file'; -import fileio from '@ohos.fileio'; -import { - describe, - it, - expect -} - from 'deccjsunit/index' -import { - randomString -} - from './Common' - -describe('fileTest', function () { - - /** - * @tc.number SUB_STORAGE_File_mkdir_1100 - * @tc.name File_mkdir_011 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_mkdir_011', 0, async function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++) { - file.mkdir({ - uri: 'internal://app/File_mkdir_011' + i, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------File_mkdir_011 call mkdir success, time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('-------File_mkdir_011 call mkdir fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_access_1100 - * @tc.name File_access_011 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_access_011', 0, async function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++) { - file.access({ - uri: 'internal://app/File_mkdir_011' + i, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------File_access_011 call access success, time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('-------File_access_011 call access fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_rmdir_1100 - * @tc.name File_rmdir_011 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_rmdir_011', 0, async function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++) { - file.rmdir({ - uri: 'internal://app/File_mkdir_011' + i, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------File_rmdir_011 call rmdir success, time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('-------File_rmdir_011 call rmdir fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_Copy_1500 - * @tc.name File_Copy_015 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_Copy_015', 0, function (done) { - file.writeText({ - uri: 'internal://app/File_Copy_015', - text: 'hello', - success: function () { - console.log('File_Copy_015 call writeText success'); - done(); - }, - fail: function (data, code) { - console.log('File_Copy_015 call writeText fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++) { - file.copy({ - srcUri: 'internal://app/File_Copy_015', - dstUri: 'internal://app/File_Copy_015_1' + i, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------File_Copy_015 call copy success, time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('-------File_Copy_015 call copy fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - } - file.delete({ - uri: 'internal://app/File_Copy_015', - success: function () { - console.log('-------File_Copy_015 call delete success.'); - done(); - }, - fail: function (data, code) { - console.log('-------File_Copy_015 call delete fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_Delete_1100 - * @tc.name File_Delete_011 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_Delete_011', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++) { - file.delete({ - uri: 'internal://app/File_Copy_015_1' + i, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------File_Delete_011 call delete success, time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('-------File_Delete_011 call delete fail! code:' + code + ', data' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_List_1300 - * @tc.name File_List_013 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_List_013', 0, async function (done) { - file.writeText({ - uri: 'internal://app/File_List_013', - text: 'Text that just for test.', - success: function () { - console.log('File_List_013 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.error('File_List_013 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.list({ - uri: 'internal://app/', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_List_013 Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_List_013 call list fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_List_1400 - * @tc.name File_List_014 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_List_014', 0, async function (done) { - for (let i = 0; i < 1000; i++) { - file.writeText({ - uri: 'internal://app/File_List_014' + i, - text: 'Text that just for test.', - success: function () { - console.log('File_List_014 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.error('File_List_014 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.list({ - uri: 'internal://app/', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_List_014 Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_List_014 call list fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_Get_1500 - * @tc.name File_Get_015 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_Get_015', 0, async function (done) { - file.writeText({ - uri: 'internal://app/File_Get_015', - text: 'Text that just for test.', - success: function () { - console.log('File_Get_015 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.error('File_Get_015 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.get({ - uri: 'internal://app/File_Get_015', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_Get_015 Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_Get_015 call get fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_Get_1600 - * @tc.name File_Get_016 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_Get_016', 0, async function (done) { - for (let i = 0; i < 1000; i++) { - file.writeText({ - uri: 'internal://app/File_Get_016' + i, - text: 'Text that just for test.', - success: function () { - console.log('File_Get_016 call writeText success.'); - done(); - }, - fail: function (data, code) { - console.error('File_Get_016 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.get({ - uri: 'internal://app/File_Get_016' + i, - success: function (data) { - console.log(data.uri); - let end = new Date().getTime(); - let time = end - start; - console.log('File_Get_016 Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_Get_016 call get fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_writeText_1400 - * @tc.name File_writeText_014 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_writeText_014', 0, async function (done) { - let text = randomString(4096); - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.writeText({ - uri: 'internal://app/File_writeText_014', - text: text, - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_writeText_014 4K Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_writeText_014 call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_readText_1000 - * @tc.name File_readText_010 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_readText_010', 0, async function (done) { - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.readText({ - uri: 'internal://app/File_writeText_014', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_readText_010 4K Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.log('File_readText_010 call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_writeArrayBuffer_1300 - * @tc.name File_writeArrayBuffer_013 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_writeArrayBuffer_013', 0, async function (done) { - let buf = new Uint8Array(4096); - for (let i = 0; i < 4096; i++) { - buf[i] = 100 - } - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.writeArrayBuffer({ - uri: 'internal://app/File_writeArrayBuffer_013', - buffer: buf, - success: function () { - console.log('call writeArrayBuffer success.'); - let end = new Date().getTime(); - let time = end - start; - console.log('File_writeArrayBuffer_013 4K Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_writeArrayBuffer_013 call writeArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); - - /** - * @tc.number SUB_STORAGE_File_readArrayBuffer_1200 - * @tc.name File_readArrayBuffer_012 - * @tc.desc Function of API, Run 1000 times to obtain each running time. - */ - it('File_readArrayBuffer_012', 0, async function (done) { - let start = new Date().getTime(); - for (let i = 0; i <= 1000; i++) { - file.readArrayBuffer({ - uri: 'internal://app/File_writeArrayBuffer_013', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('File_readArrayBuffer_012 4K Difference time:' + time + ',' + i); - start = new Date().getTime(); - done(); - }, - fail: function (data, code) { - console.error('File_readArrayBuffer_012 call readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - } - setTimeout( - function(){ - expect(null).assertFail(); - done(); - },30) - }); -}); diff --git a/storage/storagefileioperformancejstest/src/main/js/default/test/List.test.js b/storage/storagefileioperformancejstest/src/main/js/default/test/List.test.js deleted file mode 100644 index 2d7e8c31e676076e65642e01dac568bcda53e2f7..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./FileIOPerformance.js') -require('./FilePerformance.js') diff --git a/storage/storagefileioperformancejstest/src/main/resources/base/element/string.json b/storage/storagefileioperformancejstest/src/main/resources/base/element/string.json deleted file mode 100644 index 925ea00eda6f3def6a1cd37f45e52d3feb319635..0000000000000000000000000000000000000000 --- a/storage/storagefileioperformancejstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefileioperformancejstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefileioperformancejstest/src/main/resources/base/media/icon.png b/storage/storagefileioperformancejstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefileioperformancejstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefileioreliabilityjstest/BUILD.gn b/storage/storagefileioreliabilityjstest/BUILD.gn deleted file mode 100644 index d5e278abee6115f0d4932940a8b804188f3c0955..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefileioreliability_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefileioreliability_js_assets", - ":storagefileioreliability_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFileIoreLiabilityJsTest" -} -ohos_js_assets("storagefileioreliability_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefileioreliability_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefileioreliabilityjstest/Test.json b/storage/storagefileioreliabilityjstest/Test.json deleted file mode 100644 index 3b8d4ae382f53b878a31f2d0a0012f4917eb61f2..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFileIoreLiabilityJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/signature/openharmony_sx.p7b b/storage/storagefileioreliabilityjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefileioreliabilityjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefileioreliabilityjstest/src/main/config.json b/storage/storagefileioreliabilityjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/app.js b/storage/storagefileioreliabilityjstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/en-US.json b/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.css b/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.hml b/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.js b/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index 36886d2e9943155582084f4222205a7e1686aad2..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/test/Common.js b/storage/storagefileioreliabilityjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c5bc08482173733896e49c8fab5239bef520ee7c..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' - -export const FILE_CONTENT = 'hello world' - -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() !== null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js b/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js deleted file mode 100644 index 73fd508a5444f4e8d8dec06eef87712dd80ca3d1..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/test/FileIOReliability.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import { - describe, - it, - expect -} - from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - nextFileName, - sleep -} - from './Common' - -describe('fileIOReliability', function () { - - /** - * @tc.number SUB_STORAGE_fileIOReliability_dir - * @tc.name fileIOReliability_dir - * @tc.desc Dir Reliability Test - */ - it('fileIOReliability_dir', 0, function () { - for (let i = 0; i < 100000; i++) { - try { - let dpath = nextFileName('fileIOReliability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let dd = fileio.opendirSync(dpath); - dd.readSync(); - dd.closeSync(); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - sleep(300); - } - catch (e) { - console.log('fileIOReliability_dir has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOReliability_dirent - * @tc.name fileIOReliability_dirent - * @tc.desc Dirent Reliability Test - */ - it('fileIOReliability_dirent', 0, function () { - for (let i = 0; i < 100000; i++) { - try { - let dpath = nextFileName('fileIOReliability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let dd = fileio.opendirSync(dpath); - let dirent = dd.readSync(); - dirent.isBlockDevice(); - dirent.isCharacterDevice(); - dirent.isDirectory(); - dirent.isFIFO(); - dirent.isSocket(); - dirent.isSymbolicLink(); - dd.closeSync(); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - sleep(300); - } - catch (e) { - console.log('fileIOReliability_dirent has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOReliability_stat - * @tc.name fileIOReliability_stat - * @tc.desc Stat Reliability Test - */ - it('fileIOReliability_stat', 0, function () { - for (let i = 0; i < 100000; i++) { - try { - let dpath = nextFileName('fileIOReliability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let stat = fileio.statSync(fpath); - stat.isBlockDevice(); - stat.isCharacterDevice(); - stat.isDirectory(); - stat.isFIFO(); - stat.isSocket(); - stat.isSymbolicLink(); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - sleep(300); - } - catch (e) { - console.log('fileIOReliability_stat has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOReliability_stream - * @tc.name fileIOReliability_stream - * @tc.desc Stream Reliability Test - */ - it('fileIOReliability_stream', 0, function () { - for (let i = 0; i < 100000; i++) { - let fpath = nextFileName('fileIOReliability_stream'); - expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - let ss; - try { - let fd = fileio.openSync(fpath, 0o2); - ss = fileio.fdopenStreamSync(fd, 'r+'); - ss.writeSync(FILE_CONTENT); - ss.flushSync(); - ss.closeSync(); - ss = fileio.createStreamSync(fpath, 'r+'); - ss.readSync(new ArrayBuffer(4096)); - ss.closeSync(); - fileio.unlinkSync(fpath); - sleep(300); - } - catch (e) { - console.log('fileIOReliability_stream has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOReliability_prop - * @tc.name fileIOReliability_prop - * @tc.desc Prop Reliability Test - */ - it('fileIOReliability_prop', 0, function () { - for (let i = 0; i < 100000; i++) { - try { - let dpath = nextFileName('fileIOReliability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = nextFileName('fileIOReliability'); - let fpathTarget = fpath + 'tgt'; - let fpathTarget1 = fpath + 'tgtt'; - let ff = fileio.openSync(fpath, 0o102, 0o666); - fileio.accessSync(fpath); - fileio.chmodSync(fpath, 0o660); - let stat = fileio.statSync(fpath); - fileio.chownSync(fpath, stat.uid, stat.gid); - fileio.copyFileSync(fpath, fpathTarget); - fileio.fchmodSync(ff, 0o660); - fileio.fchownSync(ff, stat.uid, stat.gid); - fileio.fstatSync(ff); - fileio.ftruncateSync(ff); - fileio.renameSync(fpath, fpathTarget1); - fileio.fsyncSync(ff); - fileio.truncateSync(fpathTarget1); - fileio.writeSync(ff, FILE_CONTENT); - fileio.closeSync(ff); - fileio.unlinkSync(fpathTarget1); - fileio.unlinkSync(fpathTarget); - fileio.rmdirSync(dpath); - sleep(300); - } - catch (e) { - console.log('fileIOReliability_prop has failed for ' + e); - expect(null).assertFail(); - } - } - }); -}); diff --git a/storage/storagefileioreliabilityjstest/src/main/js/default/test/List.test.js b/storage/storagefileioreliabilityjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index c04e4626b2c11fa9e346fc26395700aec41ae83a..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./FileIOReliability.js') diff --git a/storage/storagefileioreliabilityjstest/src/main/resources/base/element/string.json b/storage/storagefileioreliabilityjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 7184b78931e474a3e1d89bec58d6343bd33e8985..0000000000000000000000000000000000000000 --- a/storage/storagefileioreliabilityjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefileioreliabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefileioreliabilityjstest/src/main/resources/base/media/icon.png b/storage/storagefileioreliabilityjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefileioreliabilityjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefileiostabilityjstest/BUILD.gn b/storage/storagefileiostabilityjstest/BUILD.gn deleted file mode 100644 index 5ade4aafb8598cb9277862c39e2f7a1f0f657468..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefileiostability_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefileiostability_js_assets", - ":storagefileiostability_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFileIoStabilityJsTest" -} -ohos_js_assets("storagefileiostability_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefileiostability_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefileiostabilityjstest/Test.json b/storage/storagefileiostabilityjstest/Test.json deleted file mode 100644 index de692195af5d81f65d3444f71a0570759dddabb4..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFileIoStabilityJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/signature/openharmony_sx.p7b b/storage/storagefileiostabilityjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefileiostabilityjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefileiostabilityjstest/src/main/config.json b/storage/storagefileiostabilityjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/app.js b/storage/storagefileiostabilityjstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/i18n/en-US.json b/storage/storagefileiostabilityjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefileiostabilityjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.css b/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.hml b/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.js b/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index 36886d2e9943155582084f4222205a7e1686aad2..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/test/Common.js b/storage/storagefileiostabilityjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c5bc08482173733896e49c8fab5239bef520ee7c..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' - -export const FILE_CONTENT = 'hello world' - -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() !== null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js b/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js deleted file mode 100644 index 003c0351c9b456122fc6fa628774e87e98c6c314..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/test/FileIOStability.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import { - describe, - it, - expect -} - from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - nextFileName, - sleep -} - from './Common' - -describe('fileIOStability', function () { - - /** - * @tc.number SUB_STORAGE_fileIOStability_dir - * @tc.name fileIOStability_dir - * @tc.desc Function of API, 7*24 - */ - it('fileIOStability_dir', 0, function () { - for (let i = 0; i <= 100000; i++) { - try { - let dpath = nextFileName('fileIOStability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let dd = fileio.opendirSync(dpath); - dd.readSync(); - dd.closeSync(); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - } - catch (e) { - console.log('fileIOStability_dir has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOStability_dirent - * @tc.name fileIOStability_dirent - * @tc.desc Function of API, 7*24 - */ - it('fileIOStability_dirent', 0, function () { - for (let i = 0; i <= 100000; i++) { - try { - let dpath = nextFileName('fileIOStability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let dd = fileio.opendirSync(dpath); - let dirent = dd.readSync(); - dirent.isBlockDevice(); - dirent.isCharacterDevice(); - dirent.isDirectory(); - dirent.isFIFO(); - dirent.isSocket(); - dirent.isSymbolicLink(); - dd.closeSync(); - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - } - catch (e) { - console.log('fileIOStability_dirent has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOStability_stat - * @tc.name fileIOStability_stat - * @tc.desc Function of API, 7*24 - */ - it('fileIOStability_stat', 0, function () { - for (let i = 0; i <= 100000; i++) { - try { - let dpath = nextFileName('fileIOStability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = dpath + '/f1'; - prepareFile(fpath, FILE_CONTENT); - let stat = fileio.statSync(fpath); - stat.isBlockDevice(); - stat.isCharacterDevice(); - stat.isDirectory(); - stat.isFIFO(); - stat.isSocket(); - stat.isSymbolicLink(); - stat.dev; - stat.uid; - stat.ino; - stat.mode; - stat.nlink; - stat.gid; - stat.rdev; - stat.size; - stat.blocks; - stat.atime; - stat.mtime; - stat.ctime; - fileio.unlinkSync(fpath); - fileio.rmdirSync(dpath); - } - catch (e) { - console.log('fileIOStability_stat has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOStability_stream - * @tc.name fileIOStability_stream - * @tc.desc Function of API, 7*24 - */ - it('fileIOStability_stream', 0, function () { - for (let i = 0; i <= 100000; i++) { - let fpath = nextFileName('fileIOStability_stream'); - expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - let ss; - try { - let fd = fileio.openSync(fpath, 0o2); - ss = fileio.fdopenStreamSync(fd, 'r+'); - ss.writeSync(FILE_CONTENT); - ss.flushSync(); - ss.closeSync(); - ss = fileio.createStreamSync(fpath, 'r+'); - ss.readSync(new ArrayBuffer(4096)); - ss.closeSync(); - fileio.unlinkSync(fpath); - } - catch (e) { - console.log('fileIOStability_stream has failed for ' + e); - expect(null).assertFail(); - } - } - }); - - /** - * @tc.number SUB_STORAGE_fileIOStability_prop - * @tc.name fileIOStability_prop - * @tc.desc Function of API, 7*24 - */ - it('fileIOStability_prop', 0, function () { - for (let i = 0; i <= 100000; i++) { - try { - let dpath = nextFileName('fileIOStability') + 'd'; - fileio.mkdirSync(dpath); - let fpath = nextFileName('fileIOStability'); - let fpathTarget = fpath + 'tgt'; - let fpathTarget1 = fpath + 'tgtt'; - let ff = fileio.openSync(fpath, 0o102, 0o666); - fileio.accessSync(fpath); - fileio.chmodSync(fpath, 0o660); - let stat = fileio.statSync(fpath); - fileio.chownSync(fpath, stat.uid, stat.gid); - fileio.copyFileSync(fpath, fpathTarget); - fileio.fchmodSync(ff, 0o660); - fileio.fchownSync(ff, stat.uid, stat.gid); - fileio.fstatSync(ff); - fileio.ftruncateSync(ff); - fileio.renameSync(fpath, fpathTarget1); - fileio.fsyncSync(ff); - fileio.truncateSync(fpathTarget1); - fileio.writeSync(ff, FILE_CONTENT); - fileio.closeSync(ff); - fileio.unlinkSync(fpathTarget1); - fileio.unlinkSync(fpathTarget); - fileio.rmdirSync(dpath); - sleep(4000); - } - catch (e) { - console.log('fileIOStability_pop has failed for ' + e); - expect(null).assertFail(); - } - } - }); - -}); diff --git a/storage/storagefileiostabilityjstest/src/main/js/default/test/List.test.js b/storage/storagefileiostabilityjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index 1e7de3ab003b2cb29cf3c944c23229176c756cc6..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./FileIOStability.js') diff --git a/storage/storagefileiostabilityjstest/src/main/resources/base/element/string.json b/storage/storagefileiostabilityjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 8bb43fe55c80d98278152a1bb88b004035aa620f..0000000000000000000000000000000000000000 --- a/storage/storagefileiostabilityjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefileiostabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefileiostabilityjstest/src/main/resources/base/media/icon.png b/storage/storagefileiostabilityjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefileiostabilityjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagedsmjstest/BUILD.gn b/storage/storagefilejstest/BUILD.gn similarity index 79% rename from storage/storagedsmjstest/BUILD.gn rename to storage/storagefilejstest/BUILD.gn index 4275032b42c77ea2f28729ce3e4bb85f18f64e25..016564b537864c084f1906323bd0c086c15c5cba 100644 --- a/storage/storagedsmjstest/BUILD.gn +++ b/storage/storagefilejstest/BUILD.gn @@ -13,19 +13,19 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("storagedsm_js_test") { +ohos_js_hap_suite("storagefile_js_test") { hap_profile = "./src/main/config.json" deps = [ - ":storagedsm_js_assets", - ":storagedsm_js_resources", + ":storagefile_js_assets", + ":storagefile_js_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFmsPublicJsTest" + hap_name = "ActsStorageFileJSTest" } -ohos_js_assets("storagedsm_js_assets") { +ohos_js_assets("storagefile_js_assets") { source_dir = "./src/main/js/default" } -ohos_resources("storagedsm_js_resources") { +ohos_resources("storagefile_js_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" } diff --git a/storage/storagefmssharejstest/Test.json b/storage/storagefilejstest/Test.json similarity index 64% rename from storage/storagefmssharejstest/Test.json rename to storage/storagefilejstest/Test.json index 24d1006e155f5ce3a9645e9c21445bd0b8f6934d..a92c9b8198b965bedc60978fe68fbb1e7d949c96 100644 --- a/storage/storagefmssharejstest/Test.json +++ b/storage/storagefilejstest/Test.json @@ -1,15 +1,15 @@ { - "description": "Configuration for storage file and fileio Tests", + "description": "Configuration for storage file Tests", "driver": { "type": "JSUnitTest", "test-timeout": "60000", - "package": "ohos.acys.test", + "package": "ohos.acts.storage.file", "shell-timeout": "60000" }, "kits": [ { "test-file-name": [ - "ActsStorageFmsShareJsTest.hap" + "ActsStorageFileJSTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/storage/storagedsmjstest/signature/openharmony_sx.p7b b/storage/storagefilejstest/signature/openharmony_sx.p7b similarity index 100% rename from storage/storagedsmjstest/signature/openharmony_sx.p7b rename to storage/storagefilejstest/signature/openharmony_sx.p7b diff --git a/storage/storagefileconcurrentjstest/src/main/config.json b/storage/storagefilejstest/src/main/config.json similarity index 88% rename from storage/storagefileconcurrentjstest/src/main/config.json rename to storage/storagefilejstest/src/main/config.json index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..3ec429b58232870071c1eb6d46419b09fe132c65 100644 --- a/storage/storagefileconcurrentjstest/src/main/config.json +++ b/storage/storagefilejstest/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "ohos.acts.stroage.fileio", + "bundleName": "ohos.acts.storage.file", "vendor": "example", "version": { "code": 1000000, @@ -13,7 +13,7 @@ }, "deviceConfig": {}, "module": { - "package": "ohos.acts.stroage.fileio", + "package": "ohos.acts.storage.file", "name": ".MyApplication", "deviceType": [ "phone" @@ -36,7 +36,7 @@ ] } ], - "name": "ohos.acts.stroage.fileio.MainAbility", + "name": "ohos.acts.storage.file.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", diff --git a/storage/storagedsmjstest/src/main/js/default/app.js b/storage/storagefilejstest/src/main/js/default/app.js similarity index 100% rename from storage/storagedsmjstest/src/main/js/default/app.js rename to storage/storagefilejstest/src/main/js/default/app.js diff --git a/storage/storagedsmjstest/src/main/js/default/i18n/en-US.json b/storage/storagefilejstest/src/main/js/default/i18n/en-US.json similarity index 100% rename from storage/storagedsmjstest/src/main/js/default/i18n/en-US.json rename to storage/storagefilejstest/src/main/js/default/i18n/en-US.json diff --git a/storage/storagedsmjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefilejstest/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from storage/storagedsmjstest/src/main/js/default/i18n/zh-CN.json rename to storage/storagefilejstest/src/main/js/default/i18n/zh-CN.json diff --git a/storage/storagedsmjstest/src/main/js/default/pages/index/index.css b/storage/storagefilejstest/src/main/js/default/pages/index/index.css similarity index 100% rename from storage/storagedsmjstest/src/main/js/default/pages/index/index.css rename to storage/storagefilejstest/src/main/js/default/pages/index/index.css diff --git a/storage/storagedsmjstest/src/main/js/default/pages/index/index.hml b/storage/storagefilejstest/src/main/js/default/pages/index/index.hml similarity index 100% rename from storage/storagedsmjstest/src/main/js/default/pages/index/index.hml rename to storage/storagefilejstest/src/main/js/default/pages/index/index.hml diff --git a/storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.js b/storage/storagefilejstest/src/main/js/default/pages/index/index.js similarity index 100% rename from storage/storagefileconcurrentjstest/src/main/js/default/pages/index/index.js rename to storage/storagefilejstest/src/main/js/default/pages/index/index.js diff --git a/storage/storagefilejstest/src/main/js/default/test/Common.js b/storage/storagefilejstest/src/main/js/default/test/Common.js new file mode 100644 index 0000000000000000000000000000000000000000..7c61d3f763983576594a68db06d835721a765bea --- /dev/null +++ b/storage/storagefilejstest/src/main/js/default/test/Common.js @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2021 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 from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility'; + +export const FILE_CONTENT = 'hello world'; + +import { + describe, beforeAll, beforeEach, afterEach, afterAll, it, expect +} +from 'deccjsunit/index' + +export function prepareFile(fpath, content) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o666) + fileio.ftruncateSync(fd) + fileio.writeSync(fd, content) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function prepareEmptyFile(fpath) { + try { + let fd = fileio.openSync(fpath, 0o102, 0o777) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to prepareFile for ' + e) + return false + } +} +export function fileToReadOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o1) + fileio.fchmodSync(fd, 0o444) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToReadOnly for ' + e); + return false + } +} +export function fileToWriteOnly(fpath) { + try { + let fd = fileio.openSync(fpath, 0o2) + fileio.fchmodSync(fd, 0o222) + fileio.fsyncSync(fd) + fileio.closeSync(fd) + return true + } + catch (e) { + console.log('Failed to fileToWriteOnly ' + e) + return false + } +} +export async function nextFileName(testName) { + let context = featureAbility.getContext(); + let data = await context.getFilesDir(); + let BASE_PATH = data.substring(0, data.length - 5) + 'cache/'; + return BASE_PATH + testName +} +export async function fileName(testName) { + let context = featureAbility.getContext(); + let data = await context.getFilesDir(); + let BASE_PATH = data + '/'; + return BASE_PATH + testName +} +export async function cacheFileName(testName) { + let context = featureAbility.getContext(); + let data = await context.getFilesDir(); + let BASE_PATH = data + '/cache/'; + return BASE_PATH + testName +} + +export function sleep(n) { + var start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > n) { + break; + } + } +} +export function randomString(num) { + let len= num; + var $chars = 'aaaabbbbcccc'; + var maxPos = $chars.length; + var pwd = ''; + for (var i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} + +function isIntNum(val) { + return typeof val === 'number' && val % 1 === 0; +} + +function isString(str) { + return (typeof str == 'string') && str.constructor == String; +} + +function isBoolean(val) { + return typeof val == 'boolean'; +} + +export { + fileio, + isIntNum, + isString, + isBoolean, + describe, + beforeAll, + beforeEach, + afterEach, + afterAll, + it, + expect +}; \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/default/test/File.test.js b/storage/storagefilejstest/src/main/js/default/test/File.test.js similarity index 96% rename from storage/storagefileiojstest/src/main/js/default/test/File.test.js rename to storage/storagefilejstest/src/main/js/default/test/File.test.js index b5c18b5f9192e45feaf99e286f790c56a423b2d4..09b61474a5e2306ce6aeade1510d05b5b7e2ab85 100644 --- a/storage/storagefileiojstest/src/main/js/default/test/File.test.js +++ b/storage/storagefilejstest/src/main/js/default/test/File.test.js @@ -32,7 +32,8 @@ import { randomString, cacheFileName, prepareEmptyFile, - nextFileName + nextFileName, + sleep } from './Common' @@ -44,7 +45,7 @@ describe('fileTest', function () { * @tc.desc Function of API, delete file.The test file is exist. */ it('File_Delete_001', 0, async function (done) { - let fpath = fileName('File_Delete_001'); + let fpath = await fileName('File_Delete_001'); prepareFile(fpath, 'hello'); file.delete({ uri: 'internal://cache/../files/File_Delete_001', @@ -117,7 +118,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 300 The dir is exist with files. */ it('File_Delete_004', 0, async function (done) { - let dpath = fileName('File_Delete_004'); + let dpath = await fileName('File_Delete_004'); let fpath = dpath + '/File_Delete_004'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); @@ -162,7 +163,7 @@ describe('fileTest', function () { */ it('File_Delete_006', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://cache/' + firstPath; fileio.mkdirSync(dpath); for (let i = 0; i < 16; i++) { @@ -554,7 +555,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 300 The uri path is dir path. */ it('File_writeText_008', 0, async function (done) { - let dpath = fileName('File_writeText_008d'); + let dpath = await fileName('File_writeText_008d'); expect(fileio.mkdirSync(dpath) !== null).assertTrue(); file.writeText({ uri: 'internal://cache/File_writeText_008d/', @@ -1297,6 +1298,38 @@ describe('fileTest', function () { }); }); + /** + * @tc.number SUB_STORAGE_File_readText_0800 + * @tc.name File_readText_008 + * @tc.desc Function of API, virtual path.Test whether the files returned are equal. + */ + it("File_readText_008", 0, async function (done) { + let fpath = await nextFileName("File_readText_008"); + let text = "0123456789abcdefg"; + expect(prepareFile(fpath, text)).assertTrue(); + sleep(10); + try { + file.readText({ + uri: "internal://cache/File_readText_008", + success: function (data) { + console.log("call readText success: " + data.text); + expect(text == data.text).assertTrue(); + expect(fileio.unlinkSync(fpath) !== null).assertTrue(); + done(); + }, + fail: function (data, code) { + console.error( + "call fail callback fail, code: " + code + ", data: " + data + ); + expect(null).assertFail(); + }, + }); + } catch (e) { + console.log("File_readText_008 has failed for " + e); + expect(null).assertFail(); + } + }); + /** * @tc.number SUB_STORAGE_File_read_array_buffer_0100 * @tc.name File_read_array_buffer_001 @@ -1392,7 +1425,7 @@ describe('fileTest', function () { * @tc.desc Function of API, readArrayBuffer, wrong position. */ it('File_read_array_buffer_004', 0, async function (done) { - let fpath = fileName('File_read_array_buffer_004'); + let fpath = await fileName('File_read_array_buffer_004'); prepareFile(fpath, FILE_CONTENT); file.readArrayBuffer({ uri: fpath, @@ -1415,7 +1448,7 @@ describe('fileTest', function () { * @tc.desc Function of API, readArrayBuffer, wrong length. */ it('File_read_array_buffer_005', 0, async function (done) { - let fpath = fileName('File_read_array_buffer_005'); + let fpath = await fileName('File_read_array_buffer_005'); prepareFile(fpath, FILE_CONTENT); file.readArrayBuffer({ uri: fpath, @@ -1641,7 +1674,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 202 The test file and dir are exist. */ it('File_access_003', 0, async function (done) { - let fpath = fileName('File_access_003'); + let fpath = await fileName('File_access_003'); file.access({ uri: fpath, success: function () { @@ -1703,7 +1736,7 @@ describe('fileTest', function () { */ it('File_access_006', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://cache/' + firstPath; fileio.mkdirSync(dpath); for (let i = 0; i < 16; i++) { @@ -2332,11 +2365,11 @@ describe('fileTest', function () { */ it('File_Move_002', 0, async function (done) { let typeArray = new Array('.txt', '.ppt', '.flac', '.mp4', '.so', '.zip'); - let dpath = fileName('cache'); + let dpath = await fileName('cache'); fileio.mkdirSync(dpath); for (let i = 0; i < typeArray.length; i++) { - let srcFpath = fileName('File_Move_002') + typeArray[i]; - let dstFpath = cacheFileName('File_Move_002') + typeArray[i]; + let srcFpath = await fileName('File_Move_002') + typeArray[i]; + let dstFpath = await cacheFileName('File_Move_002') + typeArray[i]; expect(prepareEmptyFile(srcFpath) !== null).assertTrue(); file.move({ srcUri: 'internal://cache/../files/File_Move_002' + typeArray[i], @@ -2359,9 +2392,9 @@ describe('fileTest', function () { * @tc.desc Function of API, different size file.The test file is exist. */ it('File_Move_003', 0, async function (done) { - let srcFpath = fileName('File_Move_003'); + let srcFpath = await fileName('File_Move_003'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); - let dstFpath = cacheFileName('File_Move_003'); + let dstFpath = await cacheFileName('File_Move_003'); let srcUri = 'internal://cache/../files/File_Move_003'; let dstUri = 'internal://app/cache/File_Move_003'; file.move({ @@ -2384,7 +2417,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 202.The test file is exist. */ it('File_Move_004', 0, async function (done) { - let srcFpath = fileName('File_Move_004'); + let srcFpath = await fileName('File_Move_004'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.move({ srcUri: 'internal://app/File_Move_004', @@ -2407,7 +2440,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 300.The test file is exist. */ it('File_Move_005', 0, async function (done) { - let srcDpath = fileName('File_Move_005d'); + let srcDpath = await fileName('File_Move_005d'); expect(fileio.mkdirSync(srcDpath) !== null).assertTrue(); file.move({ srcUri: 'internal://cache/../files/File_Move_005d', @@ -2430,7 +2463,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 301.The test file is not exist. */ it('File_Move_006', 0, async function (done) { - let dstUri = fileName('File_Move_006'); + let dstUri = await fileName('File_Move_006'); expect(prepareFile(dstUri, FILE_CONTENT) !== null).assertTrue(); file.move({ srcUri: 'internal://app/File_Move', @@ -2454,7 +2487,7 @@ describe('fileTest', function () { */ it('File_Move_007', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://app/' + firstPath; fileio.mkdirSync(dpath); for (let i = 0; i < 16; i++) { @@ -2527,7 +2560,7 @@ describe('fileTest', function () { * @tc.desc Function of API, same path. */ it('File_Move_009', 0, async function (done) { - let srcFpath = fileName('File_Move_009'); + let srcFpath = await fileName('File_Move_009'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.move({ srcUri: 'internal://app/File_Move_009', @@ -2550,8 +2583,8 @@ describe('fileTest', function () { * @tc.desc Function of API, dstFpath has same file. */ it('File_Move_010', 0, async function (done) { - let srcFpath = fileName('File_Move_010'); - let dstFpath = cacheFileName('File_Move_010'); + let srcFpath = await fileName('File_Move_010'); + let dstFpath = await cacheFileName('File_Move_010'); expect(prepareFile(srcFpath, 'aaa') !== null).assertTrue(); expect(prepareFile(dstFpath, 'bbb') !== null).assertTrue(); file.move({ @@ -2575,7 +2608,7 @@ describe('fileTest', function () { * @tc.desc Function of API, move app path file to cache path. */ it('File_Move_011', 0, async function (done) { - let srcFpath = fileName('File_Move_011'); + let srcFpath = await fileName('File_Move_011'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.move({ srcUri: 'internal://cache/../files/File_Move_011', @@ -2597,7 +2630,7 @@ describe('fileTest', function () { * @tc.desc Function of API, out of package, Virtual path(create and give 777 authority). */ it('File_Move_012', 0, async function (done) { - let srcFpath = fileName('File_Move_012'); + let srcFpath = await fileName('File_Move_012'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.move({ srcUri: 'internal://app/../files/File_Move_012', @@ -2620,8 +2653,8 @@ describe('fileTest', function () { * @tc.desc Function of API, check back value. */ it('File_Move_014', 0, async function (done) { - let srcFpath = fileName('File_Move_014'); - let dstFpath = cacheFileName('File_Move_014'); + let srcFpath = await fileName('File_Move_014'); + let dstFpath = await cacheFileName('File_Move_014'); expect(prepareFile(srcFpath, 'test') !== null).assertTrue(); let dstUri = 'internal://cache/File_Move_014'; file.move({ @@ -2644,8 +2677,8 @@ describe('fileTest', function () { * @tc.desc Function of API, copy, app path.The test file is exist. */ it('File_Copy_001', 0, async function (done) { - let srcFpath = fileName('File_Copy_001'); - let dstFpath = cacheFileName('File_Copy_001'); + let srcFpath = await fileName('File_Copy_001'); + let dstFpath = await cacheFileName('File_Copy_001'); expect(prepareFile(srcFpath, 'test.') !== null).assertTrue(); file.copy({ srcUri: 'internal://cache/../files/File_Copy_001', @@ -2682,8 +2715,8 @@ describe('fileTest', function () { it('File_Copy_002', 0, async function (done) { let typeArray = new Array('.txt', '.ppt', '.flac', '.mp4', '.so', '.zip'); for (let i = 0; i < typeArray.length; i++) { - let srcFpath = fileName('File_Copy_002') + typeArray[i]; - let dstFpath = cacheFileName('File_Copy_002') + typeArray[i]; + let srcFpath = await fileName('File_Copy_002') + typeArray[i]; + let dstFpath = await cacheFileName('File_Copy_002') + typeArray[i]; expect(prepareEmptyFile(srcFpath) !== null).assertTrue(); file.copy({ srcUri: 'internal://cache/../files/File_Copy_002' + typeArray[i], @@ -2708,9 +2741,9 @@ describe('fileTest', function () { * @tc.desc Function of API, different size of files. The test file is exist. */ it('File_Copy_003', 0, async function (done) { - let srcFpath = fileName('File_Copy_003'); + let srcFpath = await fileName('File_Copy_003'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); - let dstFpath = cacheFileName('File_Copy_003'); + let dstFpath = await cacheFileName('File_Copy_003'); file.copy({ srcUri: 'internal://cache/../files/File_Copy_003', dstUri: 'internal://cache/../files/cache/File_Copy_003', @@ -2745,7 +2778,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code: 202 The test file is exist. */ it('File_Copy_004', 0, async function (done) { - let srcFpath = fileName('File_Copy_004'); + let srcFpath = await fileName('File_Copy_004'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.copy({ srcUri: 'internal://app/File_Copy_004', @@ -2790,7 +2823,7 @@ describe('fileTest', function () { }, fail: function (data, code) { console.log('File_Copy_005 , code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); + expect(code == 301).assertTrue(); done(); }, }); @@ -2811,6 +2844,7 @@ describe('fileTest', function () { }, fail: function (data, code) { console.log('File_Copy_006 , code: ' + code + ', data: ' + data); + console.log("code: " + (typeof code)); expect(code == 301).assertTrue(); done(); }, @@ -2824,7 +2858,7 @@ describe('fileTest', function () { */ it('File_Copy_007', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://cache/' + firstPath; fileio.mkdirSync(dpath); for (let i = 0; i < 16; i++) { @@ -2908,7 +2942,7 @@ describe('fileTest', function () { * @tc.desc Function of API, same path. */ it('File_Copy_009', 0, async function (done) { - let srcFpath = fileName('File_Copy_009'); + let srcFpath = await fileName('File_Copy_009'); expect(prepareFile(srcFpath, FILE_CONTENT) !== null).assertTrue(); file.copy({ srcUri: 'internal://app/File_Copy_009', @@ -2932,8 +2966,8 @@ describe('fileTest', function () { * @tc.desc Function of API, dstFpath path has same file. */ it('File_Copy_010', 0, async function (done) { - let srcFpath = fileName('File_Copy_010'); - let dstFpath = cacheFileName('File_Copy_010'); + let srcFpath = await fileName('File_Copy_010'); + let dstFpath = await cacheFileName('File_Copy_010'); expect(prepareFile(srcFpath, 'aaa') !== null).assertTrue(); expect(prepareFile(dstFpath, 'bbb') !== null).assertTrue(); file.copy({ @@ -2960,7 +2994,7 @@ describe('fileTest', function () { * @tc.desc Function of API, copy file to cache path.The test file is exist. */ it('File_Copy_011', 0, async function (done) { - let srcFpath = fileName('File_Copy_011'); + let srcFpath = await fileName('File_Copy_011'); expect(prepareFile(srcFpath, 'test.') !== null).assertTrue(); file.copy({ srcUri: 'internal://cache/../files/File_Copy_011', @@ -2993,7 +3027,7 @@ describe('fileTest', function () { * @tc.desc Function of API, out of package, Virtual path(create and give 777 authority).The test file is exist. */ it('File_Copy_012', 0, async function (done) { - let srcFpath = fileName('File_Copy_012'); + let srcFpath = await fileName('File_Copy_012'); expect(prepareFile(srcFpath, 'test') !== null).assertTrue(); file.copy({ srcUri: 'internal://app/../files/File_Copy_012', @@ -3018,8 +3052,8 @@ describe('fileTest', function () { */ it('File_Copy_014', 0, async function (done) { - let srcFpath = fileName('File_Copy_014'); - let dstFpath = cacheFileName('File_Copy_014'); + let srcFpath = await fileName('File_Copy_014'); + let dstFpath = await cacheFileName('File_Copy_014'); expect(prepareFile(srcFpath, 'test') !== null).assertTrue(); let dstUri = 'internal://cache/File_Copy_014'; file.copy({ @@ -3042,7 +3076,7 @@ describe('fileTest', function () { * @tc.desc Function of API, list.The test file and dir are exist. */ it('File_List_001', 0, async function (done) { - let dpath = fileName('File_List_001') + 'd'; + let dpath = await fileName('File_List_001') + 'd'; let fpath = dpath + '/File_List_001'; let ddpath = dpath + '/File_List_001_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3070,7 +3104,7 @@ describe('fileTest', function () { * @tc.desc Function of API, set value of uri.The test file and dir are exist. */ it('File_List_002', 0, async function (done) { - let dpath = fileName('File_List_002') + 'd'; + let dpath = await fileName('File_List_002') + 'd'; let fpath = dpath + '/File_List_002'; let ddpath = dpath + '/File_List_002_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3098,7 +3132,7 @@ describe('fileTest', function () { * @tc.desc Function of API, check lastModifiedTime.The test file and dir are exist. */ it('File_List_003', 0, async function (done) { - let dpath = fileName('File_List_003') + 'd'; + let dpath = await fileName('File_List_003') + 'd'; let fpath = dpath + '/File_List_003'; let ddpath = dpath + '/File_List_003_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3145,7 +3179,7 @@ describe('fileTest', function () { * @tc.desc Function of API, check length.The test file and dir are exist. */ it('File_List_004', 0, async function (done) { - let dpath = fileName('File_List_004') + 'd'; + let dpath = await fileName('File_List_004') + 'd'; let fpath = dpath + '/File_List_004'; let ddpath = dpath + '/File_List_004_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3170,7 +3204,7 @@ describe('fileTest', function () { * @tc.desc Function of API, check type.The test file and dir are exist. */ it('File_List_005', 0, async function (done) { - let dpath = fileName('File_List_005') + 'd'; + let dpath = await fileName('File_List_005') + 'd'; let fpath = dpath + '/File_List_005'; let ddpath = dpath + '/File_List_005_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3195,7 +3229,7 @@ describe('fileTest', function () { * @tc.desc Function of API, error code:202 */ it('File_List_006', 0, async function (done) { - let dpath = fileName('File_List_006') + 'd' + let dpath = await fileName('File_List_006') + 'd' file.list({ uri: dpath, success: function (data) { @@ -3216,7 +3250,7 @@ describe('fileTest', function () { * @tc.desc Function of API, uri set value of file. */ it('File_List_007', 0, async function (done) { - let fpath = fileName('File_List_007'); + let fpath = await fileName('File_List_007'); expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); file.list({ uri: 'internal://cache/../files/File_List_007', @@ -3259,7 +3293,7 @@ describe('fileTest', function () { */ it('File_List_009', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://app/' + firstPath; fileio.mkdirSync(dpath); for (let i = 0; i < 16; i++) { @@ -3288,7 +3322,7 @@ describe('fileTest', function () { * @tc.desc Function of API, cache path.The test file and dir are exist. */ it('File_List_010', 0, async function (done) { - let dpath = nextFileName('File_List_010d'); + let dpath = await nextFileName('File_List_010d'); let fpath = dpath + '/File_List_010'; let ffpath = dpath + '/File_List_010_1'; let ddpath = dpath + '/File_List_010_1d'; @@ -3328,7 +3362,7 @@ describe('fileTest', function () { * @tc.desc Function of API, virtual path.The test dir are exist. */ it('File_List_011', 0, async function (done) { - let dpath = fileName('File_List_011') + 'd'; + let dpath = await fileName('File_List_011') + 'd'; let fpath = dpath + '/File_List_011'; let ddpath = dpath + '/File_List_011_1d'; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); @@ -3375,7 +3409,7 @@ describe('fileTest', function () { * @tc.desc Function of API, Get.The test file is exist. */ it('File_Get_001', 0, async function (done) { - let fpath = fileName('File_Get_001'); + let fpath = await fileName('File_Get_001'); expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); file.get({ uri: 'internal://cache/../files/File_Get_001', @@ -3398,7 +3432,7 @@ describe('fileTest', function () { * @tc.desc Function of API, recursive = false.The test file is exist. */ it('File_Get_002', 0, async function (done) { - let fpath = fileName('File_Get_002'); + let fpath = await fileName('File_Get_002'); expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); file.get({ uri: 'internal://cache/../files/File_Get_002', @@ -3426,7 +3460,7 @@ describe('fileTest', function () { * @tc.desc Function of API, not input recursive.The test file is exist. */ it('File_Get_003', 0, async function (done) { - let fpath = fileName('File_Get_003'); + let fpath = await fileName('File_Get_003'); expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); file.get({ uri: 'internal://cache/../files/File_Get_003', @@ -3454,7 +3488,7 @@ describe('fileTest', function () { * @tc.desc Function of API, recursive = ture.The test file is exist. */ it('File_Get_004', 0, async function (done) { - let dpath = fileName('File_Get_004d'); + let dpath = await fileName('File_Get_004d'); let ddpath = dpath + '/File_Get_004dd' let fpath = dpath + '/File_Get_004f' let ffpath = ddpath + '/File_Get_004ff' @@ -3492,7 +3526,7 @@ describe('fileTest', function () { * @tc.desc Function of API, recursive = false.The test file is exist. */ it('File_Get_005', 0, async function (done) { - let dpath = fileName('File_Get_005d'); + let dpath = await fileName('File_Get_005d'); let ddpath = dpath + '/File_Get_005dd'; let fpath = dpath + '/File_Get_005f'; let ffpath = ddpath + '/File_Get_005ff'; @@ -3530,7 +3564,7 @@ describe('fileTest', function () { * @tc.desc Function of API, not input recursive.The test file is exist. */ it('File_Get_006', 0, async function (done) { - let dpath = fileName('File_Get_006d'); + let dpath = await fileName('File_Get_006d'); let ddpath = dpath + '/File_Get_006dd'; let fpath = dpath + '/File_Get_006f'; let ffpath = ddpath + '/File_Get_006ff'; @@ -3695,7 +3729,7 @@ describe('fileTest', function () { */ it('File_Get_012', 0, async function (done) { let firstPath = randomString(32); - let dpath = fileName(firstPath); + let dpath = await fileName(firstPath); let uri = 'internal://cache/' + firstPath; expect(fileio.mkdirSync(dpath) !== null).assertTrue(); for (let i = 0; i < 16; i++) { @@ -3730,7 +3764,7 @@ describe('fileTest', function () { * @tc.desc Function of API, virtual path. */ it('File_Get_013', 0, async function (done) { - let dpath = fileName('File_Get_013d'); + let dpath = await fileName('File_Get_013d'); let ddpath = dpath + '/File_Get_013dd'; let fpath = dpath + '/File_Get_013f'; let ffpath = ddpath + '/File_Get_013ff'; diff --git a/storage/storagefmssharejstest/src/main/js/default/test/List.test.js b/storage/storagefilejstest/src/main/js/default/test/List.test.js similarity index 95% rename from storage/storagefmssharejstest/src/main/js/default/test/List.test.js rename to storage/storagefilejstest/src/main/js/default/test/List.test.js index 971a7603a3f978bf95eb7cee03b59c7aaef42ac1..c2671eb8018479b176ad42c417e1686f945c0d81 100644 --- a/storage/storagefmssharejstest/src/main/js/default/test/List.test.js +++ b/storage/storagefilejstest/src/main/js/default/test/List.test.js @@ -13,4 +13,4 @@ * limitations under the License. */ -require('./FmsShare.test.js') +require('./File.test.js') diff --git a/storage/storagedsmjstest/src/main/resources/base/element/string.json b/storage/storagefilejstest/src/main/resources/base/element/string.json similarity index 78% rename from storage/storagedsmjstest/src/main/resources/base/element/string.json rename to storage/storagefilejstest/src/main/resources/base/element/string.json index 4b5a8bbc02d07ca41a3c0f63834395a33e02152a..2f1b420896d5575a11941c0bc2fcec8765ccd561 100644 --- a/storage/storagedsmjstest/src/main/resources/base/element/string.json +++ b/storage/storagefilejstest/src/main/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "storagefilestabilityjstest" + "value": "Storagefilejstest" }, { "name": "mainability_description", diff --git a/storage/storagedsmjstest/src/main/resources/base/media/icon.png b/storage/storagefilejstest/src/main/resources/base/media/icon.png similarity index 100% rename from storage/storagedsmjstest/src/main/resources/base/media/icon.png rename to storage/storagefilejstest/src/main/resources/base/media/icon.png diff --git a/storage/storagefilestabilityjstest/BUILD.gn b/storage/storagefilestabilityjstest/BUILD.gn deleted file mode 100644 index 31cb6153457b03c2fe1bb573b0a4e9ebf190c8cf..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefilestability_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefilestability_js_assets", - ":storagefilestability_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFileStabilityJsTest" -} -ohos_js_assets("storagefilestability_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefilestability_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefilestabilityjstest/Test.json b/storage/storagefilestabilityjstest/Test.json deleted file mode 100644 index 3bd63df567e9c9d740a580e8820756ca8630d7fd..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFileStabilityJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/signature/openharmony_sx.p7b b/storage/storagefilestabilityjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefilestabilityjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefilestabilityjstest/src/main/config.json b/storage/storagefilestabilityjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/src/main/js/default/app.js b/storage/storagefilestabilityjstest/src/main/js/default/app.js deleted file mode 100644 index 2d73ffa8281a6d4e7a6ca7dff5458c692a72327d..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefilestabilityjstest/src/main/js/default/i18n/en-US.json b/storage/storagefilestabilityjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefilestabilityjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.css b/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.hml b/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.js b/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index f7894a72230dd2356d1ce272896c9e0fd09e08cd..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/Common.js b/storage/storagefilestabilityjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c5bc08482173733896e49c8fab5239bef520ee7c..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' - -export const FILE_CONTENT = 'hello world' - -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() !== null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js b/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js deleted file mode 100644 index db2cfa80a22e85d4aac6a301e6c09cc3ea4c15f8..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/FileReliability.js +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import file from '@system.file'; -import { - describe, - it, - expect -} - from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - nextFileName, - differentFileName -} - from './Common' - -describe('FileReliability', function () { - - /** - * @tc.number SUB_STORAGE_FileReliability - * @tc.name FileReliability - * @tc.desc Function of API, Reliability test 7*24. - */ - it('FileReliability', 0, async function (done) { - for (let i = 0; i < 100000; i++) { - let promiseMkdir = new Promise(function (resolve, reject) { - file.mkdir({ - uri: 'internal://app/fileStability' + i, - success: function () { - console.log(i + 'call mkdir success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call mkdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('mkdir success!'); - }, 10); - }); - promiseMkdir.then(function () { - console.log('mkdir success'); - }); - let promiseWriteText = new Promise(function (resolve, reject) { - file.writeText({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - text: 'Text that just for test.', - success: function () { - console.log(i + 'call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('writeText success!'); - }, 15); - }); - promiseWriteText.then(function () { - console.log('writeText success'); - }); - let promiseReadText = new Promise(function (resolve, reject) { - file.readText({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.text); - done(); - }, - fail: function (data, code) { - console.log(i + 'call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('readText success!'); - }, 15); - }); - promiseReadText.then(function () { - console.log('readText success'); - }); - let promiseAccess = new Promise(function (resolve, reject) { - file.access({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function () { - console.log(i + 'call access success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call access fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('access success!'); - }, 15); - }); - promiseAccess.then(function () { - console.log('access success'); - }); - let promiseGet = new Promise(function (resolve, reject) { - file.get({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('get success!'); - }, 15); - }); - promiseGet.then(function () { - console.log('get success'); - }); - let promiseList = new Promise(function (resolve, reject) { - file.list({ - uri: 'internal://app/fileStability' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.fileList); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('list success!'); - }, 15); - }); - promiseList.then(function () { - console.log('list success'); - }); - let promiseCopy = new Promise(function (resolve, reject) { - file.copy({ - srcUri: 'internal://app/fileStability' + i + '/fileStability01' + i, - dstUri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function (uri) { - console.log(i + 'call success copy success uri: ' + uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('copy success!'); - }, 15); - }); - promiseCopy.then(function () { - console.log('copy success'); - }); - let promiseMove = new Promise(function (resolve, reject) { - file.move({ - srcUri: 'internal://app/fileStability' + i + '/fileStability01' + i, - dstUri: 'internal://app/fileStability01' + i, - success: function (uri) { - console.log(i + 'call success move success. uri: ' + uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail move fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('move success!'); - }, 15); - }); - promiseMove.then(function () { - console.log('move success'); - }); - file.delete({ - uri: 'internal://app/fileStability01' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.delete({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let promiseWriteArrayBuffer = new Promise(function (resolve, reject) { - let buf = new Uint8Array([48, 49, 50, 51, 65, 66, 67, 68, 32, 33]); - file.writeArrayBuffer({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - buffer: buf, - success: function () { - console.log(i + 'call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail writeArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('writeArrayBuffer success!'); - }, 15); - }); - promiseWriteArrayBuffer.then(function () { - console.log('writeArrayBuffer success'); - }); - let promiseReadArrayBuffer = new Promise(function (resolve, reject) { - file.readArrayBuffer({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function (data) { - console.log(i + 'call readArrayBuffer success: ' + data.buffer); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('readArrayBuffer success!'); - }, 15); - }); - promiseReadArrayBuffer.then(function () { - console.log('readArrayBuffer success'); - }); - file.delete({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let promiseRmdir = new Promise(function (resolve, reject) { - file.rmdir({ - uri: 'internal://app/fileStability' + i, - recursive: true, - success: function () { - console.log(i + 'call rmdir success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail rmdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('rmdir success!'); - }, 15); - }); - promiseReadArrayBuffer.then(function () { - console.log('rmdir success'); - }); - - } - }); -}); diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js b/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js deleted file mode 100644 index ad451d79aadfeac9874d6ff08f1515a0640bdb3a..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/FileStability.js +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -import file from '@system.file'; -import { - describe, - it, - expect -} - from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - nextFileName, - differentFileName -} - from './Common' - -describe('FileReliability', function () { - - /** - * @tc.number SUB_STORAGE_FileReliability - * @tc.name FileReliability - * @tc.desc Function of API, Reliability test 7*24. - */ - it('FileReliability', 0, async function (done) { - for (let i = 0; i < 100000; i++) { - let promiseMkdir = new Promise(function (resolve, reject) { - file.mkdir({ - uri: 'internal://app/fileStability' + i, - success: function () { - console.log(i + 'call mkdir success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call mkdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('mkdir success!'); - done() - }, 250); - }); - promiseMkdir.then(function () { - console.log('mkdir success'); - }); - let promiseWriteText = new Promise(function (resolve, reject) { - file.writeText({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - text: 'Text that just for test.', - success: function () { - console.log(i + 'call writeText success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call writeText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('writeText success!'); - }, 250); - }); - promiseWriteText.then(function () { - console.log('writeText success'); - done(); - }); - let promiseReadText = new Promise(function (resolve, reject) { - file.readText({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.text); - done(); - }, - fail: function (data, code) { - console.log(i + 'call readText fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('readText success!'); - }, 250); - }); - promiseReadText.then(function () { - console.log('readText success'); - done(); - }); - let promiseAccess = new Promise(function (resolve, reject) { - file.access({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function () { - console.log(i + 'call access success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call access fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('access success!'); - }, 250); - }); - promiseAccess.then(function () { - console.log('access success'); - done(); - }); - let promiseGet = new Promise(function (resolve, reject) { - file.get({ - uri: 'internal://app/fileStability' + i + '/fileStability01' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('get success!'); - }, 250); - }); - promiseGet.then(function () { - console.log('get success'); - done(); - }); - let promiseList = new Promise(function (resolve, reject) { - file.list({ - uri: 'internal://app/fileStability' + i, - success: function (data) { - console.log(i + 'call readText success: ' + data.fileList); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('list success!'); - }, 250); - }); - promiseList.then(function () { - console.log('list success'); - done(); - }); - let promiseCopy = new Promise(function (resolve, reject) { - file.copy({ - srcUri: 'internal://app/fileStability' + i + '/fileStability01' + i, - dstUri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function (uri) { - console.log(i + 'call success copy success uri: ' + uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail copy fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('copy success!'); - }, 250); - }); - promiseCopy.then(function () { - console.log('copy success'); - done(); - }); - let promiseMove = new Promise(function (resolve, reject) { - file.move({ - srcUri: 'internal://app/fileStability' + i + '/fileStability01' + i, - dstUri: 'internal://app/fileStability01' + i, - success: function (uri) { - console.log(i + 'call success move success. uri: ' + uri); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail move fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('move success!'); - }, 250); - }); - promiseMove.then(function () { - console.log('move success'); - done(); - }); - file.delete({ - uri: 'internal://app/fileStability01' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - file.delete({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let promiseWriteArrayBuffer = new Promise(function (resolve, reject) { - let buf = new Uint8Array([48, 49, 50, 51, 65, 66, 67, 68, 32, 33]); - file.writeArrayBuffer({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - buffer: buf, - success: function () { - console.log(i + 'call writeArrayBuffer success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail writeArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('writeArrayBuffer success!'); - }, 250); - }); - promiseWriteArrayBuffer.then(function () { - console.log('writeArrayBuffer success'); - done(); - }); - let promiseReadArrayBuffer = new Promise(function (resolve, reject) { - file.readArrayBuffer({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function (data) { - console.log(i + 'call readArrayBuffer success: ' + data.buffer); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail readArrayBuffer fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('readArrayBuffer success!'); - }, 250); - }); - promiseReadArrayBuffer.then(function () { - done(); - console.log('readArrayBuffer success'); - }); - file.delete({ - uri: 'internal://app/fileStability' + i + '/fileStability02' + i, - success: function () { - console.log(i + 'call delete success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail delete fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - let promiseRmdir = new Promise(function (resolve, reject) { - file.rmdir({ - uri: 'internal://app/fileStability' + i, - recursive: true, - success: function () { - console.log(i + 'call rmdir success.'); - done(); - }, - fail: function (data, code) { - console.log(i + 'call fail rmdir fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('rmdir success!'); - }, 250); - }); - promiseRmdir.then(function () { - console.log('rmdir success'); - done(); - }); - - } - }); -}); diff --git a/storage/storagefilestabilityjstest/src/main/js/default/test/List.test.js b/storage/storagefilestabilityjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index 177b4adfc06e7511c583c9d152d22254c603bb32..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./FileReliability.js') -require('./FileStability.js') diff --git a/storage/storagefilestabilityjstest/src/main/resources/base/element/string.json b/storage/storagefilestabilityjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 4b5a8bbc02d07ca41a3c0f63834395a33e02152a..0000000000000000000000000000000000000000 --- a/storage/storagefilestabilityjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefilestabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefilestabilityjstest/src/main/resources/base/media/icon.png b/storage/storagefilestabilityjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefilestabilityjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefmspublicjstest/BUILD.gn b/storage/storagefmspublicjstest/BUILD.gn deleted file mode 100644 index 897f3e313b94982d0c0e82b13ac5aeda09b067da..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefmspublic_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefmspublic_js_assets", - ":storagefmspublic_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFmsPublicJsTest" -} -ohos_js_assets("storagefmspublic_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefmspublic_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefmspublicjstest/Test.json b/storage/storagefmspublicjstest/Test.json deleted file mode 100644 index 910be0d9c5f262b48f47dbf970419f076b3214d7..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for storage file and fileio Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "60000", - "package": "ohos.acts.stroage.fileio", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsStorageFmsPublicJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/signature/openharmony_sx.p7b b/storage/storagefmspublicjstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefmspublicjstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefmspublicjstest/src/main/config.json b/storage/storagefmspublicjstest/src/main/config.json deleted file mode 100644 index 9b7cfe5d04d1f2f807e5c7dc8ceff403cde6a9df..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.stroage.fileio", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.stroage.fileio", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.stroage.fileio.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/app.js b/storage/storagefmspublicjstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json b/storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.css b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js b/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index f7894a72230dd2356d1ce272896c9e0fd09e08cd..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/Common.js b/storage/storagefmspublicjstest/src/main/js/default/test/Common.js deleted file mode 100644 index c7b15f7ce870c57af41cbaadd146c05ba0b91c0d..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -export const FILE_CONTENT = 'hello world' -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function filePickerName(testName,deviceID) { - const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' - return BASE_PATH + testName -} -export function filePickerName1(testName,deviceID) { - const BASE_PATH = '/data/ss/'+ deviceID +'/fms_test/' - return BASE_PATH + testName -} -export function filePickerName2(testName,deviceID) { - const BASE_PATH = '/data/ss/'+ deviceID - return BASE_PATH + testName -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} -export function fmsFileName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" - return BASE_PATH + testName -} -export function fmsCacheName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" - return BASE_PATH + testName -} -export function fmsPublic(testName) { - const BASE_PATH = '/data/ss/files/' - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() == null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPerformance.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPerformance.test.js deleted file mode 100644 index 4ed454112028d840d570e9f665cfcc5fe743ae3f..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPerformance.test.js +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@ohos.fileio'; -import filepicker from '@ohos.filepicker' -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - fileName, - filePickerName, - filePickerName2, - sleep, - randomString, - cacheFileName, - prepareEmptyFile, - nextFileName -} -from './Common' -describe('FmsPerformanceTest', function () { - let deviceID = 0; - /** - * @tc.number SUB_STORAGE_FMS_Stability_0000 - * @tc.name FMS_Stability_0000 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0000', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let progetDeviceInfo = new Promise(function (resolve, reject) { - for (let i = 0; i < 1000; i++){} - filepicker.getDeviceInfo({ - success: function (data) { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0000 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Function_0000 success.' + JSON.stringify(data)); - deviceID = data.deviceList[0].deviceID; - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0000 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - progetDeviceInfo.then(function () { - console.log('FMS_Function_0000 success'); - }); - } - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0100 - * @tc.name FMS_Performance_0100 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0100', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0100 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Performance_0100 success.'); - done() - }, - fail: function (data, code) { - console.log('FMS_Performance_0100 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.catch(function () { - console.log('FMS_Performance_0100 success'); - }); - } - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0200 - * @tc.name FMS_Performance_0200 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0200', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/c/leaf', - success: function () { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0200 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Performance_0200 success.'); - done() - }, - fail: function (data, code) { - console.log('FMS_Performance_0200 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.catch(function () { - console.log('FMS_Performance_0200 success'); - }); - } - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0300 - * @tc.name FMS_Performance_0300 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0300', 0, function (done) { - let fpath = filePickerName("a.txt", deviceID); - prepareFile(fpath, FILE_CONTENT) - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let proMkdir = new Promise(function (resolve, reject) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root', - success: function (data) { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0300 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Performance_0300 success.' + data.saveFileList[0].status); - done() - }, - fail: function (data, code) { - console.log('FMS_Performance_0300 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - setTimeout(function () { - resolve('mkdir success!'); - done() - }, 250); - }) - proMkdir.then(function () { - console.log('FMS_Performance_0300 success'); - }); - } - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0400 - * @tc.name FMS_Performance_0400 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0400', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let proMkdir = new Promise(function (resolve, reject) { - filepicker.searchFile({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - name: 'a.txt', - success: function (data) { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0400 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Performance_0400 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Performance_0400 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Performance_0400 success'); - }); - } - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0500 - * @tc.name FMS_Performance_0500 - * @tc.desc Function of API,Performance Test - */ - it('FMS_Performance_0500', 0, function (done) { - let start = new Date().getTime(); - for (let i = 0; i < 1000; i++){ - let proMkdir = new Promise(function (resolve, reject) { - filepicker.list({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - success: function (data) { - let end = new Date().getTime(); - let time = end - start; - console.log('-------FMS_Performance_0500 success, time:' + time + ',' + i); - start = new Date().getTime(); - console.log('FMS_Performance_0500 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Performance_0500 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Performance_0500 success'); - }); - } - }) - -}) \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js deleted file mode 100644 index 222eaadbaf55e2cb4a42c7aecadfc72405911d9b..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublic.test.js +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@ohos.fileio'; -import filepicker from '@ohos.filepicker' -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} -from 'deccjsunit/index' -import { - FILE_CONTENT, - prepareFile, - fileName, - filePickerName, - randomString, - cacheFileName, - prepareEmptyFile, - nextFileName -} -from './Common' -describe('FmsTest', function () { - let deviceID = 0; - - /** - * @tc.number SUB_STORAGE_FMS_Function_0000 - * @tc.name FMS_Function_0000 - * @tc.desc Function of API,Get current device information - */ - it('FMS_Function_0000', 0, async function (done) { - let progetDeviceInfo = new Promise(function (resolve, reject) { - filepicker.getDeviceInfo({ - success: function (data) { - console.log('FMS_Function_0000 success.' + JSON.stringify(data)); - if (data.deviceList.length == 0) { - console.log('FMS_Function_0000 fail'); - expect(null).assertFail(); - } else { - deviceID = data.deviceList[0].deviceID; - console.log("---FMS_Function_0000------" + deviceID); - done(); - } - }, - fail: function (data, code) { - console.log('FMS_Function_0000 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - progetDeviceInfo.then(function () { - console.log('FMS_Function_0000 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0100 - * @tc.name FMS_Function_0100 - * @tc.desc Function of API, Creates the specified directory recursively - */ - it('FMS_Function_0100', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - success: function () { - console.log('FMS_Function_0100 mkdir success.'); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0100 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.then(function () { - console.log('FMS_Function_0100 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0200 - * @tc.name FMS_Function_0200 - * @tc.desc Function of API, Creates the specified directory recursively - */ - it('FMS_Function_0200', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/你好/leaf', - success: function () { - console.log('FMS_Function_0200 mkdir success.'); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0200 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.then(function () { - console.log('FMS_Function_0200 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0300 - * @tc.name FMS_Function_0300 - * @tc.desc Function of API, Creates the specified directory recursively - */ - it('FMS_Function_0300', 0,async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/a/b/c/leaf', - success: function () { - console.log('FMS_Function_0300 mkdir success.'); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0300 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.then(function () { - console.log('FMS_Function_0300 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0400 - * @tc.name FMS_Function_0400 - * @tc.desc Function of API, - */ - it('FMS_Function_0400', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', - success: function () { - console.log('FMS_Function_0400 success.'); - done() - }, - fail: function (data, code) { - console.log('call fail callback fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - proMkdir.then(function () { - console.log('FMS_Function_0400 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0500 - * @tc.name FMS_Function_0500 - * @tc.desc Function of API, save file.The test file is exist. - */ - it('FMS_Function_0500', 0, async function (done) { - let fpath = filePickerName("a.txt", deviceID); - expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); - let proMkdir = new Promise(function (resolve, reject) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root', - success: function (data) { - console.log('FMS_Function_0500 success.' + data.saveFileList[0].status); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0500 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_0500 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0600 - * @tc.name FMS_Function_0600 - * @tc.desc Function of API, save file.The test file is exist. - */ - it('FMS_Function_0600', 0, async function (done) { - let fpath = filePickerName("b.txt", deviceID); - expect(prepareFile(fpath, FILE_CONTENT) !== null).assertTrue(); - let proMkdir = new Promise(function (resolve, reject) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf', - 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/b.txt/leaf'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root', - success: function (data) { - console.log('FMS_Function_0600 success.' + data.saveFileList[0].status); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0600 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_0600 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0700 - * @tc.name FMS_Function_0700 - * @tc.desc Function of API, save file.The test file is exist. - */ - it('FMS_Function_0700', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', - success: function (data) { - console.log('FMS_Function_0700 success.' + data.saveFileList[0].status); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0700 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_0700 success'); - }); - - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0800 - * @tc.name FMS_Function_0800 - * @tc.desc Function of API, save file.The test file is exist. - */ - it('FMS_Function_0800', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/' + deviceID + '/document/fms_test/a.txt/leaf', - 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/b.txt/leaf'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', - success: function (data) { - console.log('FMS_Function_0800 success.' + data.saveFileList[0].status); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0800 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_0800 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_0900 - * @tc.name FMS_Function_0900 - * @tc.desc Function of API, search file.The test file is exist. - */ - it('FMS_Function_0900', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.searchFile({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - name: 'a.txt', - success: function (data) { - console.log('FMS_Function_0900 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_0900 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_0900 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_1000 - * @tc.name FMS_Function_1000 - * @tc.desc Function of API, search file.The test file is exist. - */ - it('FMS_Function_1000', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.searchFile({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - name: 'b.txt', - success: function (data) { - console.log('FMS_Function_1000 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_1000 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_1000 success'); - }); - - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_1100 - * @tc.name FMS_Function_1100 - * @tc.desc Function of API, search file.The test file is exist. - */ - it('FMS_Function_1100', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.searchFile({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/root/files', - name: 'a.txt', - success: function (data) { - console.log('FMS_Function_1100 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_1100 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_1100 success'); - }); - - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_1200 - * @tc.name FMS_Function_1200 - * @tc.desc Function of API, Get all file information in the specified directory - */ - it('FMS_Function_1200', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.list({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/fms_test/leaf', - success: function (data) { - console.log('FMS_Function_1200 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_1200 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_1200 success'); - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Function_1300 - * @tc.name FMS_Function_1300 - * @tc.desc Function of API, Get all file information in the specified directory - */ - it('FMS_Function_1300', 0, async function (done) { - let proMkdir = new Promise(function (resolve, reject) { - filepicker.list({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/root', - success: function (data) { - console.log('FMS_Function_1300 success.' + data.fileList[0].uri); - done() - }, - fail: function (data, code) { - console.log('FMS_Function_1300 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }); - }) - proMkdir.then(function () { - console.log('FMS_Function_1300 success'); - }); - }) - -}) diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js deleted file mode 100644 index 23c2e7b8368cf72f0b956126e83d1c6aca16154b..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/test/FmsPublicError.test.js +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (C) 2021 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 filepicker from '@ohos.filepicker'; -import { - describe, - it, - expect -} -from 'deccjsunit/index' -import { - prepareFile, - fmsPublic, -} -from './Common' - -describe('FilepickerTest', function () { - - let deviceID = 0; - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0000 - * @tc.name File_Test_Error_0000 - * @tc.desc Error of API, . - */ - it('File_Test_Error_0000', 0, async function (done) { - filepicker.getDeviceInfo({ - success: function (data) { - console.log('File_Test_Error_0000_start call mkdir success.' + data.deviceList[0].deviceID); - deviceID = data.deviceList[0].deviceID; - done() - }, - fail: function (data, code) { - console.error('File_Test_Error_0000_start call fail callback fail, code: ' + code + ', data: ' + data); - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0100 - * @tc.name File_Test_Error_0100 - * @tc.desc Error of API, mkdir code = 202. - */ - it('File_Test_Error_0100', 0, async function (done) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/udocument/files/leaf', - success: function () { - console.log('File_Test_Error_0100 call mkdir success.'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_0100 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /* - * @tc.number SUB_STORAGE_File_Test_Error_0200 - * @tc.name File_Test_Error_0200 - * @tc.desc Error of API, mkdir code = 302 - */ - it('File_Test_Error_0200', 0, async function (done) { - filepicker.mkdir({ - uri: 'data123ability:///public.storage.ability/' + deviceID + '/document/files/leaf', - success: function () { - console.log('File_Test_Error_0200 call mkdir success.'); - expect(null).assertFail(); - done() - }, - fail: function (data, code) { - console.error('File_Test_Error_0200 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0300 - * @tc.name File_Test_Error_0300 - * @tc.desc Error of API, mkdir code = 202 - */ - it('File_Test_Error_0300', 0, async function (done) { - filepicker.mkdir({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/lea', - success: function () { - console.log('File_Test_Error_0300 call mkdir success.'); - expect(null).assertFail(); - done() - }, - fail: function (data, code) { - console.error('File_Test_Error_0300 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0400 - * @tc.name File_Test_Error_0400 - * @tc.desc Error of API, mkdir code = 202 - */ - it('File_Test_Error_0400', 0, async function (done) { - filepicker.mkdir({ - uri: '/data/ss/files' - }); - let fpath = fmsPublic('File_Test_Error_0400'); - prepareFile(fpath, 'hello'); - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/files/File_Test_Error_0400'], - dstUri: 'dataability:///public.storage.ability/‘’/document/files/leaf', - success: function (data) { - console.log('File_Test_Error_0400 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - done() - }, - fail: function (data, code) { - console.error('File_Test_Error_0400 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0500 - * @tc.name File_Test_Error_0500 - * @tc.desc Error of API,saveFile code = 202 - */ - it('File_Test_Error_0500', 0, async function (done) { - let fpath = fmsPublic('File_Test_Error_0500'); - prepareFile(fpath, 'hello'); - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/file/File_Test_Error_0500'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', - success: function (data) { - console.log('File_Test_Error_0500 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - done() - }, - fail: function (data, code) { - console.error('File_Test_Error_0500 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0600 - * @tc.name File_Test_Error_0600 - * @tc.desc Error of API, saveFile code = 202 - */ - it('File_Test_Error_0600', 0, function (done) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/file/A.txt'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', - success: function (data) { - console.log('File_Test_Error_0600 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_0600 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0700 - * @tc.name File_Test_Error_0700 - * @tc.desc Error of API,saveFile code = 202 - */ - it('File_Test_Error_0700', 0, function (done) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/lea', - success: function (data) { - console.log('File_Test_Error_0700 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_0700 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0800 - * @tc.name File_Test_Error_0800 - * @tc.desc Error of API,saveFile code = 202 - */ - it('File_Test_Error_0800', 0, function (done) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/bb/aa/files/leaf', - success: function (data) { - console.log('File_Test_Error_0800 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_0800 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_0900 - * @tc.name File_Test_Error_0900 - * @tc.desc Error of API, saveFile code = 302 - */ - it('File_Test_Error_0900', 0, function (done) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], - dstUri: 'data123ability:///public.storage.ability/' + deviceID + '/document/files/leaf', - success: function (data) { - console.log('File_Test_Error_0900 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_0900 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_1000 - * @tc.name File_Test_Error_1000 - * @tc.desc Error of API, saveFile code = 202 - */ - it('File_Test_Error_1000', 0, function (done) { - filepicker.saveFile({ - srcUri: ['dataability:///public.storage.ability/data/ss/files/a.txt'], - srcUri1: ['dataability:///public.storage.ability/data/ss/files/a.txt'], - dstUri: 'dataability:///public.storage.ability/' + deviceID + '/document/files/leaf', - success: function (data) { - console.log('File_Test_Error_1000 call mkdir success.' + data.saveFileList[0].status); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_1000 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_1400 - * @tc.name File_Test_Error_1400 - * @tc.desc Error of API, list code = 202 - */ - it('File_Test_Error_1400', 0, function (done) { - filepicker.list({ - uri: 'dataability:///public.storage.ability/device_id/udocument/files/leaf', - success: function (data) { - console.log('File_Test_Error_1400 call mkdir success.' + data.fileList[0].uri); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_1400 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_1500 - * @tc.name File_Test_Error_1500 - * @tc.desc Error of API, list code = 302 - * path:'' - */ - it('File_Test_Error_1500', 0, function (done) { - filepicker.list({ - uri: '', - success: function (data) { - console.log('File_Test_Error_1500 call mkdir success.' + data.fileList[0].uri); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_1500 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_1600 - * @tc.name File_Test_Error_1600 - * @tc.desc Error of API, list code = 300 - */ - it('File_Test_Error_1600', 0, function (done) { - filepicker.list({ - uri: 'dataability:///public.storage.ability/' + deviceID + '/document/file/leaf', - success: function (data) { - console.log('File_Test_Error_1600 call mkdir success.' + data.fileList[0].uri); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_1600 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); - - /** - * @tc.number SUB_STORAGE_File_Test_Error_1700 - * @tc.name File_Test_Error_1700 - * @tc.desc Error of API, list code = 302 - */ - it('File_Test_Error_1700', 0, function (done) { - filepicker.list({ - uri: 'data123ability:///public.storage.ability/' + deviceID + '/document/file/leaf', - success: function (data) { - console.log('File_Test_Error_1700 call mkdir success.' + data.fileList[0].uri); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.error('File_Test_Error_1700 call fail callback fail, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue() - done() - }, - }); - setTimeout( - function () { - expect(null).assertFail(); - done(); - }, 30) - }); -}); \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js b/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js deleted file mode 100644 index f82e7452627e88f97e68dddaa441e45a0b772cc2..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -require('./FmsPublic.test.js') - diff --git a/storage/storagefmspublicjstest/src/main/resources/base/element/string.json b/storage/storagefmspublicjstest/src/main/resources/base/element/string.json deleted file mode 100644 index 4b5a8bbc02d07ca41a3c0f63834395a33e02152a..0000000000000000000000000000000000000000 --- a/storage/storagefmspublicjstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefilestabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefmspublicjstest/src/main/resources/base/media/icon.png b/storage/storagefmspublicjstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefmspublicjstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/storage/storagefmssharejstest/BUILD.gn b/storage/storagefmssharejstest/BUILD.gn deleted file mode 100644 index 13891fb68e619c3e35065bba0281132c96de1c11..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2021 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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("storagefmsshare_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":storagefmsshare_js_assets", - ":storagefmsshare_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStorageFmsShareJsTest" -} -ohos_js_assets("storagefmsshare_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("storagefmsshare_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/storage/storagefmssharejstest/signature/openharmony_sx.p7b b/storage/storagefmssharejstest/signature/openharmony_sx.p7b deleted file mode 100644 index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..0000000000000000000000000000000000000000 Binary files a/storage/storagefmssharejstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/storage/storagefmssharejstest/src/main/config.json b/storage/storagefmssharejstest/src/main/config.json deleted file mode 100644 index 3b243aeb37087a1c304361bb1b52f4bbadaabfc0..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/config.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.test", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Release" - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.test", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "installationFree": true, - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.test.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "visible": true, - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": "default2", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/js/default/app.js b/storage/storagefmssharejstest/src/main/js/default/app.js deleted file mode 100644 index 60ee141c8dbd251c763b7b74552b5a133a774d6a..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/app.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -export default { - onCreate() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - }, - onDestroy() { - console.info('ohos.acts.distributeddatamgr.distributedfile onCreate'); - } -}; diff --git a/storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json b/storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json deleted file mode 100644 index ead52ed2e09ec82aaf7aa9f4e714ed39ea88308e..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "Test" - } -} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json b/storage/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index 3f48f2585b24a8fe4a745e8ee2972a9e991a7803..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "测试" - } -} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.css b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js b/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js deleted file mode 100644 index f7894a72230dd2356d1ce272896c9e0fd09e08cd..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 app from '@system.app' - -import {Core} from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/js/default/test/Common.js b/storage/storagefmssharejstest/src/main/js/default/test/Common.js deleted file mode 100644 index e94e7f4049a3da8852e3fcba5be70a7100756bd4..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/test/Common.js +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio' -export const FILE_CONTENT = 'hello world' -export function prepareFile(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o666) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareFile1(fpath, content) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.ftruncateSync(fd) - fileio.writeSync(fd, content) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function prepareEmptyFile(fpath) { - try { - let fd = fileio.openSync(fpath, 0o102, 0o777) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to prepareFile for ' + e) - return false - } -} -export function fileToReadOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o444) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadOnly for ' + e); - return false - } -} -export function fileToWriteOnly(fpath) { - try { - let fd = fileio.openSync(fpath, 0o2) - fileio.fchmodSync(fd, 0o222) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToWriteOnly ' + e) - return false - } -} -export function fileToReadAndWrite(fpath) { - try { - let fd = fileio.openSync(fpath, 0o1) - fileio.fchmodSync(fd, 0o777) - fileio.fsyncSync(fd) - fileio.closeSync(fd) - return true - } - catch (e) { - console.log('Failed to fileToReadAndWrite ' + e); - return false - } -} -export function filePickerName(testName,deviceID) { - const BASE_PATH = '/data/ss/'+deviceID+'/fms_test/' - return BASE_PATH + testName -} -export function appName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/' - return BASE_PATH + testName -} -export function nextFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/cache/' - return BASE_PATH + testName -} -export function fileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/' - return BASE_PATH + testName -} -export function cacheFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/appdata/ohos.acts.stroage.fileio/files/cache/' - return BASE_PATH + testName -} -export function differentFileName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/' - return BASE_PATH + testName -} -export function differentCacheName(testName) { - const BASE_PATH = '/data/accounts/account_0/ohos.acts.distributeddatamgr.distributedfile/cache/' - return BASE_PATH + testName -} -export function fmsFileName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/files/" - return BASE_PATH + testName -} -export function fmsCacheName(testName) { - const BASE_PATH = "/data/accounts/account_0/appdata/ohos.acts.test/cache/" - return BASE_PATH + testName -} - -export function getFileTextLen(fpath) { - let ss - try { - ss = fileio.Stream.createStreamSync(fpath, 'r+') - expect(ss !== null).assertTrue() - let len = ss.readSync(new ArrayBuffer(4096)) - console.log('file:' + fpath) - console.log('file lenth:' + len) - expect(ss.closeSync() !== null).assertTrue() - return len - } - catch (e) { - console.log('Failed to getFileTextLen ' + e) - expect(ss.closeSync() == null).assertTrue() - return null - } -} -export function isFileExist(fpath) { - try { - expect(fileio.accessSync(fpath) !== null).assertTrue() - console.log('file:' + fpath) - console.log('status:exist') - return true - } - catch (e) { - console.log('file:' + fpath) - console.log('status:non-existen') - return false - } -} -export function sleep(n) { - var start = new Date().getTime(); - while (true) { - if (new Date().getTime() - start > n) { - break; - } - } -} -export function randomString(num) { - let len= num; - var $chars = 'aaaabbbbcccc'; - var maxPos = $chars.length; - var pwd = ''; - for (var i = 0; i < len; i++) { - pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); - } - return pwd; -} diff --git a/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js b/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js deleted file mode 100644 index 212178f22cb32ac474fcb4c313133e225f6e73c3..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/test/FmsShare.test.js +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio'; -import fileShareAbility from '@ohos.fileshare'; -import { - describe, - beforeAll, - it, - expect -} -from 'deccjsunit/index' -import { - prepareFile, - fmsFileName, - fmsCacheName -} -from './Common' - -describe('fmsShareTest', function () { - beforeAll(() => { - prepareFile(fmsFileName('music.mp3'), 'content'); - prepareFile(fmsFileName('f0.txt'), 'content'); - prepareFile(fmsFileName('picture.jpg'), 'content'); - prepareFile(fmsFileName('picture2.jpg'), 'content'); - prepareFile(fmsFileName('文件.doc'), 'content'); - prepareFile(fmsFileName('cross Fire.txt'), 'content'); - prepareFile(fmsCacheName('video.mp4'), 'content'); - prepareFile(fmsFileName('file.xlsx'), 'content'); - prepareFile(fmsFileName('f2.ppt'), 'content'); - prepareFile(fmsFileName('f3.doc'), 'content'); - fileio.mkdirSync(fmsFileName('folder')); - let text = '[{"type": "files-path", "name": "primary_leaf", "path": "/music.mp3"},' + - '{"type": "files-path", "name": "primary_leaf2", "path": "/f0.txt"},' + - '{"type": "files-path", "name": "primary_leaf3", "path": "/picture.jpg"},' + - '{"type": "files-path", "name": "primary_leaf4", "path": "/picture2.jpg"},' + - '{"type": "files-path", "name": "primary_leaf5", "path": "/文件.doc"},' + - '{"type": "files-path", "name": "primary_leaf6", "path": "/cross Fire.txt"},' + - '{"type": "cache-path", "name": "cacheprimary_leaf", "path": "/video.mp4"},' + - '{"type": "files-path", "name": "primary_leaf7", "path": "/file.xlsx"},' + - '{"type": "files-path", "name": "primary_leaf8", "path": "/f3.doc"},' + - '{"type": "files-path", "name": "primary_leaf9", "path": "/folder"' + - '}]'; - prepareFile(fmsFileName('test.json'), text); - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_100 - * @tc.name FMS_fuzzyFileToUri_100 - * @tc.desc Verify device ID,Call fuzzyfiletouri to - * judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_100', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/f0.txt', - displayName: 'f1.txt', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf2/f0.txt/leaf?displayName=f1.txt#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - complete: function () { - console.log('FMS_fuzzyFileToUri_100 call fuzzyFileToUri in complete'); - } - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_200 - * @tc.name FMS_fuzzyFileToUri_200 - * @tc.desc Verify app path,Call fuzzyfiletouri to - * judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_200', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/picture.jpg', - displayName: 'picture.png', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_200 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf3/picture.jpg/leaf?displayName=picture.png#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_200 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_300 - * @tc.name FMS_fuzzyFileToUri_300 - * @tc.desc Verify that the app path virtual path is an in package file,Call fuzzyfiletouri - * to judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_300', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/../files/picture2.jpg', - displayName: 'picture2.png', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_300 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf4/picture2.jpg/leaf?displayName=picture2.png#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_300 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_400 - * @tc.name FMS_fuzzyFileToUri_400 - * @tc.desc Verify the Chinese file name under the app path,Call fuzzyfiletouri - * to judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_400', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/文件.doc', - displayName: 'file', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_400 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf5/文件.doc/leaf?displayName=file#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_400 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_500 - * @tc.name FMS_fuzzyFileToUri_500 - * @tc.desc Verify the blurred Chinese file name,Call fuzzyfiletouri - * to judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_500', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/cross Fire.txt', - displayName: '你好,世界', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_500 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf6/cross Fire.txt/leaf?displayName=你好,世界#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_500 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_600 - * @tc.name FMS_fuzzyFileToUri_600 - * @tc.desc Verify cache path,Call fuzzyfiletouri - * to judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_600', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://cache/video.mp4', - displayName: 'v1.mp4', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_600 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/cache' - +'/cacheprimary_leaf/video.mp4/leaf?displayName=v1.mp4#').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_600 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_700 - * @tc.name FMS_fuzzyFileToUri_700 - * @tc.desc Verify that displayName does not exist,Call fuzzyfiletouri - * to judge whether the return value is correct. - */ - it('FMS_fuzzyFileToUri_700', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/file.xlsx', - success: function (uri) { - console.log('FMS_fuzzyFileToUri_700 call fuzzyFileToUri success. uri:' + uri); - expect(uri == 'dataability://440E-0906/ohos.acts.test.ability/primary/document/files' - +'/primary_leaf7/file.xlsx/leaf').assertTrue(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_700 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_800 - * @tc.name FMS_fuzzyFileToUri_800 - * @tc.desc Verify that authority = null,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_800', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: '', - uri: 'internal://app/f2.ppt', - success: function () { - console.log('FMS_fuzzyFileToUri_800 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_800 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_900 - * @tc.name FMS_fuzzyFileToUri_900 - * @tc.desc Verify that authority is a different value,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_900', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'com.abc.test.ability', - uri: 'internal://app/f3.doc', - success: function () { - console.log('FMS_fuzzyFileToUri_900 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_900 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1000 - * @tc.name FMS_fuzzyFileToUri_1000 - * @tc.desc Verify that uri = null,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_1000', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: '', - success: function () { - console.log('FMS_fuzzyFileToUri_1000 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1000 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue(); - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1100 - * @tc.name FMS_fuzzyFileToUri_1100 - * @tc.desc Verify that there is no file under the app path,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_1100', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/f4', - success: function () { - console.log('FMS_fuzzyFileToUri_1100 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1100 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 301).assertTrue(); - - }, - }) - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1200 - * @tc.name FMS_fuzzyFileToUri_1200 - * @tc.desc Verify device ID=null,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_1200', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/music.mp3', - displayName: 'helloworld', - success: function () { - console.log('FMS_fuzzyFileToUri_1200 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1200 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 202).assertTrue(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1300 - * @tc.name FMS_fuzzyFileToUri_1300 - * @tc.desc Verify the virtual path to an out of package file,Call the interface fuzzyfiletouri - * to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_1300', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/../../../applications/com.ohos.settings/com.ohos.settings/config.json', - displayName: 'helloworld', - success: function () { - console.log('FMS_fuzzyFileToUri_1300 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1300 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 302).assertTrue(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1400 - * @tc.name FMS_fuzzyFileToUri_1400 - * @tc.desc Verify that the folder exists under the app path,Call the interface - * fuzzyfiletouri to check whether the interface call fails. - */ - it('FMS_fuzzyFileToUri_1400', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/folder', - displayName: 'helloworld', - success: function () { - console.log('FMS_fuzzyFileToUri_1400 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1400 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }); - }) - - /** - * @tc.number SUB_STORAGE_FMS_fuzzyFileToUri_1500 - * @tc.name FMS_fuzzyFileToUri_1500 - * @tc.desc The shared file is not configured in JSON - */ - it('FMS_fuzzyFileToUri_1500', 0, function () { - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/f2.ppt', - success: function () { - console.log('FMS_fuzzyFileToUri_1500 call fuzzyFileToUri success, fail!'); - expect(null).assertFail(); - }, - fail: function (data, code) { - console.log('FMS_fuzzyFileToUri_1500 call fuzzyFileToUri pass, code: ' + code + ', data: ' + data); - expect(code == 300).assertTrue(); - }, - }); - }) - -}) diff --git a/storage/storagefmssharejstest/src/main/js/default/test/FmsSharePerformance.test.js b/storage/storagefmssharejstest/src/main/js/default/test/FmsSharePerformance.test.js deleted file mode 100644 index 140a44c9cfaddb3ae09f5a2f4fbc3984e306e623..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/test/FmsSharePerformance.test.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio'; -import fileShareAbility from '@ohos.fileshare'; -import { - describe, - beforeAll, - it, - expect -} -from 'deccjsunit/index' -import { - prepareFile, - fmsFileName, - fmsCacheName -} -from './Common' - -describe('fmsPerformanceTest', function () { - beforeAll(() => { - prepareFile(fmsFileName('music.mp3'), 'content'); - prepareFile(fmsFileName('f0.txt'), 'content'); - prepareFile(fmsFileName('picture.jpg'), 'content'); - prepareFile(fmsFileName('picture2.jpg'), 'content'); - prepareFile(fmsFileName('文件.doc'), 'content'); - prepareFile(fmsFileName('cross Fire.txt'), 'content'); - prepareFile(fmsCacheName('video.mp4'), 'content'); - prepareFile(fmsFileName('file.xlsx'), 'content'); - prepareFile(fmsFileName('f2.ppt'), 'content'); - prepareFile(fmsFileName('f3.doc'), 'content'); - fileio.mkdirSync(fmsFileName('folder')); - let text = '[{"type": "files-path", "name": "primary_leaf", "path": "/music.mp3"},' + - '{"type": "files-path", "name": "primary_leaf2", "path": "/f0.txt"},' + - '{"type": "files-path", "name": "primary_leaf3", "path": "/picture.jpg"},' + - '{"type": "files-path", "name": "primary_leaf4", "path": "/picture2.jpg"},' + - '{"type": "files-path", "name": "primary_leaf5", "path": "/文件.doc"},' + - '{"type": "files-path", "name": "primary_leaf6", "path": "/cross Fire.txt"},' + - '{"type": "cache-path", "name": "cacheprimary_leaf", "path": "/video.mp4"},' + - '{"type": "files-path", "name": "primary_leaf7", "path": "/file.xlsx"},' + - '{"type": "files-path", "name": "primary_leaf8", "path": "/f3.doc"},' + - '{"type": "files-path", "name": "primary_leaf9", "path": "/folder"' + - '}]'; - prepareFile(fmsFileName('test.json'), text); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0000 - * @tc.name FMS_Performance_0000 - * @tc.desc Performance test - */ - it('FMS_Performance_0000', 0, function () { - let start = new Date().getTime(); - for(let i = 0; i < 1000;i++){ - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/f0.txt', - displayName: 'f1.txt', - success: function () { - let end = new Date().getTime(); - let time = end - start ; - start = new Date().getTime() - console.log('FMS_Performance_0000 call fuzzyFileToUri success. time:' +time+','+i); - }, - fail: function (data, code) { - console.log('FMS_Performance_0000 call fuzzyFileToUri fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - complete: function () { - console.log('FMS_Performance_0000 call fuzzyFileToUri in complete'); - } - }); - } - }) - - -}) diff --git a/storage/storagefmssharejstest/src/main/js/default/test/FmsShareStability.test.js b/storage/storagefmssharejstest/src/main/js/default/test/FmsShareStability.test.js deleted file mode 100644 index 56e197fe017a3cb50b33e34f78a70d65359478bf..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/js/default/test/FmsShareStability.test.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2021 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 from '@system.fileio'; -import fileShareAbility from '@ohos.fileshare'; -import { - describe, - beforeAll, - it, - expect -} -from 'deccjsunit/index' -import { - prepareFile, - fmsFileName, - fmsCacheName -} -from './Common' - -describe('fmsStabilityTest', function () { - beforeAll(() => { - prepareFile(fmsFileName('music.mp3'), 'content'); - prepareFile(fmsFileName('f0.txt'), 'content'); - prepareFile(fmsFileName('picture.jpg'), 'content'); - prepareFile(fmsFileName('picture2.jpg'), 'content'); - prepareFile(fmsFileName('文件.doc'), 'content'); - prepareFile(fmsFileName('cross Fire.txt'), 'content'); - prepareFile(fmsCacheName('video.mp4'), 'content'); - prepareFile(fmsFileName('file.xlsx'), 'content'); - prepareFile(fmsFileName('f2.ppt'), 'content'); - prepareFile(fmsFileName('f3.doc'), 'content'); - fileio.mkdirSync(fmsFileName('folder')); - let text = '[{"type": "files-path", "name": "primary_leaf", "path": "/music.mp3"},' + - '{"type": "files-path", "name": "primary_leaf2", "path": "/f0.txt"},' + - '{"type": "files-path", "name": "primary_leaf3", "path": "/picture.jpg"},' + - '{"type": "files-path", "name": "primary_leaf4", "path": "/picture2.jpg"},' + - '{"type": "files-path", "name": "primary_leaf5", "path": "/文件.doc"},' + - '{"type": "files-path", "name": "primary_leaf6", "path": "/cross Fire.txt"},' + - '{"type": "cache-path", "name": "cacheprimary_leaf", "path": "/video.mp4"},' + - '{"type": "files-path", "name": "primary_leaf7", "path": "/file.xlsx"},' + - '{"type": "files-path", "name": "primary_leaf8", "path": "/f3.doc"},' + - '{"type": "files-path", "name": "primary_leaf9", "path": "/folder"' + - '}]'; - prepareFile(fmsFileName('test.json'), text); - }) - - /** - * @tc.number SUB_STORAGE_FMS_Performance_0000 - * @tc.name FMS_Performance_0000 - * @tc.desc stability test - */ - it('FMS_stability_0000', 0, function () { - for(let i = 0; i < 100000;i++){ - fileShareAbility.fuzzyFileToUri({ - deviceId: '440E-0906', - authority: 'ohos.acts.test.ability', - uri: 'internal://app/f0.txt', - displayName: 'f1.txt', - success: function () { - console.log('FMS_stability_0000 success. '+i); - }, - fail: function (data, code) { - console.log('FMS_stability_0000 fail, code: ' + code + ', data: ' + data); - expect(null).assertFail(); - }, - complete: function () { - console.log('FMS_stability_0000 call fuzzyFileToUri in complete'); - } - }); - } - }) - -}) diff --git a/storage/storagefmssharejstest/src/main/resources/base/element/string.json b/storage/storagefmssharejstest/src/main/resources/base/element/string.json deleted file mode 100644 index 4b5a8bbc02d07ca41a3c0f63834395a33e02152a..0000000000000000000000000000000000000000 --- a/storage/storagefmssharejstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "storagefilestabilityjstest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/storage/storagefmssharejstest/src/main/resources/base/media/icon.png b/storage/storagefmssharejstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/storage/storagefmssharejstest/src/main/resources/base/media/icon.png and /dev/null differ