1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import rpc from "@ohos.rpc"; 17import fileio from '@ohos.fileio'; 18import featureAbility from "@ohos.ability.featureAbility"; 19import securityLabel from '@ohos.file.securityLabel'; 20import TestService from "./testService" 21import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; 22import {UiDriver, BY} from '@ohos.UiTest'; 23 24let gIRemoteObject = null; 25var testservice = null; 26 27export default function FileioDistributedTest(){ 28 describe('FileioDistributedTest', function(){ 29 console.info("----------SUB_Storage_Fileio_Distributed JS Test is starting----------"); 30 const DISTRIBUTED_FILE_CONTENT = 'content'; 31 const SERVER_CHECK_SUCCESS = 'SUCCESS'; 32 33 const CODE_MK_DIR = 1; 34 const CODE_RM_DIR = 2; 35 const CODE_CREATE_FILE = 3; 36 const CODE_DELETE_FILE = 4; 37 const CODE_GET_FILE_CONTENT = 5; 38 const CODE_GET_FILE_STAT = 6; 39 const CODE_FSYNC_FILE = 7; 40 41 /** 42 * get app distributed file Path 43 * @param testName 44 * @returns 45 */ 46 async function getDistributedFilePath(testName) { 47 let basePath; 48 try { 49 let context = featureAbility.getContext(); 50 basePath = await context.getOrCreateDistributedDir(); 51 } catch (e) { 52 console.log("-------- getDistributedFilePath() failed for : " + e); 53 } 54 return basePath + "/" + testName; 55 } 56 57 /** 58 * Send rpc request to get server-side verification result without done 59 * @param tcNumber 60 * @param path 61 * @param codeNumber 62 * @param callback 63 */ 64 async function getServerFileInfoFirst(tcNumber, path, codeNumber, callback) { 65 try { 66 var data = rpc.MessageParcel.create(); 67 var reply = rpc.MessageParcel.create(); 68 var option = new rpc.MessageOption(); 69 70 var writeResult = data.writeString(path); 71 console.info(tcNumber + " : client writeString success, data is " + data.readString()); 72 expect(writeResult == true).assertTrue(); 73 74 if (gIRemoteObject == undefined) { 75 console.info(tcNumber + " : gIRemoteObject undefined"); 76 } 77 78 await gIRemoteObject.sendRequest(codeNumber, data, reply, option).then((result) => { 79 console.info(tcNumber + " : sendRequest success, result is " + result.errCode); 80 expect(result.errCode == 0).assertTrue(); 81 82 var resultToken = result.reply.readString(); 83 console.info(tcNumber + " : run readString success, result is " + resultToken); 84 callback(resultToken); 85 }).catch((err) => { 86 console.info(tcNumber + " sendRequest has failed for : " + err); 87 callback("client sendRequest failed"); 88 }).finally(() => { 89 data.reclaim(); 90 reply.reclaim(); 91 }) 92 } catch (e) { 93 console.info(tcNumber + " has failed for : " + e); 94 callback("client sendRequest failed"); 95 } 96 } 97 98 /** 99 * Send rpc request to get server-side verification result 100 * @param tcNumber 101 * @param path 102 * @param codeNumber 103 * @param done 104 * @param callback 105 */ 106 async function getServerFileInfo(tcNumber, path, codeNumber, done, callback) { 107 try { 108 var data = rpc.MessageParcel.create(); 109 var reply = rpc.MessageParcel.create(); 110 var option = new rpc.MessageOption(); 111 112 var writeResult = data.writeString(path); 113 console.info(tcNumber + " : client writeString success, data is " + data.readString()); 114 expect(writeResult == true).assertTrue(); 115 116 if (gIRemoteObject == undefined) { 117 console.info(tcNumber + " : gIRemoteObject undefined"); 118 } 119 120 await gIRemoteObject.sendRequest(codeNumber, data, reply, option).then((result) => { 121 console.info(tcNumber + " : sendRequest success, result is " + result.errCode); 122 expect(result.errCode == 0).assertTrue(); 123 124 var resultToken = result.reply.readString(); 125 console.info(tcNumber + " : run readString success, result is " + resultToken); 126 callback(resultToken); 127 }).catch((err) => { 128 console.info(tcNumber + " sendRequest has failed for : " + err); 129 callback("client sendRequest failed"); 130 }).finally(() => { 131 data.reclaim(); 132 reply.reclaim(); 133 done(); 134 }) 135 } catch (e) { 136 console.info(tcNumber + " has failed for : " + e); 137 callback("client sendRequest failed"); 138 } 139 } 140 141 function sleep(ms) { 142 return new Promise(resolve => setTimeout(resolve, ms)); 143 } 144 145 async function getPermission() { 146 console.info(`getPermission is start`); 147 let permissions = ['ohos.permission.DISTRIBUTED_DATASYNC']; 148 let context = featureAbility.getContext() 149 context.requestPermissionsFromUser(permissions, 666, (data) => { 150 console.info("request success" + JSON.stringify(data)); 151 }) 152 } 153 154 async function driveFn() { 155 try { 156 let driver = await UiDriver.create() 157 console.info(` come in driveFn`) 158 console.info(`driver is ${JSON.stringify(driver)}`) 159 sleep(2000); 160 let button = await driver.findComponent(BY.text('允许')); 161 console.info(`button is ${JSON.stringify(button)}`); 162 sleep(6000); 163 await button.click(); 164 } catch (err) { 165 console.info('err is ' + err); 166 return; 167 } 168 } 169 170 beforeAll(async function(done) { 171 console.info('beforeAll called fileio server'); 172 await getPermission(); 173 sleep(5000); 174 await driveFn(); 175 sleep(3000); 176 177 testservice = new TestService; 178 await testservice.toConnectAbility().then(data => { 179 gIRemoteObject = data; 180 console.info("fileioClient: toConnectAbility data is: " + data); 181 }) 182 done(); 183 console.info("beforeAll done"); 184 }) 185 beforeEach(function () { 186 console.info(('beforeEach called')); 187 sleep(1500); 188 }) 189 afterEach(function () { 190 console.info('afterEach called'); 191 }) 192 afterAll(function () { 193 console.info('afterAll called'); 194 }) 195 196 /** 197 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0000 198 * @tc.name test_fileio_create_dir_sync_000 199 * @tc.desc Test the distributed file mkdirSync interface without the mode parameter 200 * @tc.level 0 201 */ 202 it('test_fileio_create_dir_sync_000', 0, async function (done) { 203 console.info("--------start test_fileio_create_dir_sync_000--------"); 204 let tcNumber = 'test_fileio_create_dir_sync_000'; 205 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 206 try { 207 fileio.mkdirSync(dpath); 208 let dir = fileio.opendirSync(dpath); 209 expect(dir !== null).assertTrue(); 210 console.info('------ client mkdirSync success.'); 211 212 console.info('------ start check server... '); 213 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 214 console.info("test_fileio_create_dir_sync_000 : getServerFileInfo serverDirCreate: " + serverDirCreate); 215 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 216 }); 217 218 dir.closeSync(); 219 fileio.rmdirSync(dpath); 220 } catch (error) { 221 console.info('test_fileio_create_dir_sync_000 has failed for : ' + error); 222 expect(false).assertTrue(); 223 } 224 console.info("--------end test_fileio_create_dir_sync_000--------"); 225 }); 226 227 /** 228 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0100 229 * @tc.name test_fileio_create_dir_sync_001 230 * @tc.desc Test the distributed file mkdirSync interface with mode=0o700 231 * @tc.level 3 232 */ 233 it('test_fileio_create_dir_sync_001', 3, async function (done) { 234 console.info("--------start test_fileio_create_dir_sync_001--------"); 235 let tcNumber = 'test_fileio_create_dir_sync_001'; 236 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 237 238 try { 239 fileio.mkdirSync(dpath, 0o700); 240 let dir = fileio.opendirSync(dpath); 241 expect(dir !== null).assertTrue(); 242 console.info('------ client mkdirSync success.'); 243 244 console.info('------ start check server... '); 245 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 246 console.info("test_fileio_create_dir_sync_001 : getServerFileInfo serverDirCreate: " + serverDirCreate); 247 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 248 }); 249 250 dir.closeSync(); 251 fileio.rmdirSync(dpath); 252 } catch (error) { 253 console.info('test_fileio_create_dir_sync_001 has failed for : ' + error); 254 expect(false).assertTrue(); 255 } 256 console.info("--------end test_fileio_create_dir_sync_001--------"); 257 }); 258 259 /** 260 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0200 261 * @tc.name test_fileio_create_dir_sync_002 262 * @tc.desc Test the distributed file mkdirSync interface with mode=0o600 263 * @tc.level 3 264 */ 265 it('test_fileio_create_dir_sync_002', 3, async function (done) { 266 console.info("--------start test_fileio_create_dir_sync_002--------"); 267 let tcNumber = 'test_fileio_create_dir_sync_002'; 268 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 269 270 try { 271 fileio.mkdirSync(dpath, 0o600); 272 let dir = fileio.opendirSync(dpath); 273 expect(dir !== null).assertTrue(); 274 console.info('------ client mkdirSync success.'); 275 276 console.info('------ start check server... '); 277 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 278 console.info("test_fileio_create_dir_sync_002 : getServerFileInfo serverDirCreate: " + serverDirCreate); 279 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 280 }); 281 282 dir.closeSync(); 283 fileio.rmdirSync(dpath); 284 } catch (error) { 285 console.info('test_fileio_create_dir_sync_002 has failed for : ' + error); 286 expect(false).assertTrue(); 287 } 288 console.info("--------end test_fileio_create_dir_sync_002--------"); 289 }); 290 291 /** 292 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0300 293 * @tc.name test_fileio_create_dir_sync_003 294 * @tc.desc Test the distributed file mkdirSync interface with mode=0o500 295 * @tc.level 3 296 */ 297 it('test_fileio_create_dir_sync_003', 3, async function (done) { 298 console.info("--------start test_fileio_create_dir_sync_003--------"); 299 let tcNumber = 'test_fileio_create_dir_sync_003'; 300 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 301 302 try { 303 fileio.mkdirSync(dpath, 0o500); 304 let dir = fileio.opendirSync(dpath); 305 expect(dir !== null).assertTrue(); 306 console.info('------ client mkdirSync success.'); 307 308 console.info('------ start check server... '); 309 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 310 console.info("test_fileio_create_dir_sync_003 : getServerFileInfo serverDirCreate: " + serverDirCreate); 311 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 312 }); 313 314 dir.closeSync(); 315 fileio.rmdirSync(dpath); 316 } catch (error) { 317 console.info('test_fileio_create_dir_sync_003 has failed for : ' + error); 318 expect(false).assertTrue(); 319 } 320 console.info("--------end test_fileio_create_dir_sync_003--------"); 321 }); 322 323 /** 324 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0400 325 * @tc.name test_fileio_create_dir_sync_004 326 * @tc.desc Test the distributed file mkdirSync interface with mode=0o400 327 * @tc.level 3 328 */ 329 it('test_fileio_create_dir_sync_004', 3, async function (done) { 330 console.info("--------start test_fileio_create_dir_sync_004--------"); 331 let tcNumber = 'test_fileio_create_dir_sync_004'; 332 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 333 334 try { 335 fileio.mkdirSync(dpath, 0o400); 336 let dir = fileio.opendirSync(dpath); 337 expect(dir !== null).assertTrue(); 338 console.info('------ client mkdirSync success.'); 339 340 console.info('------ start check server... '); 341 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 342 console.info("test_fileio_create_dir_sync_004 : getServerFileInfo serverDirCreate: " + serverDirCreate); 343 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 344 }); 345 dir.closeSync(); 346 fileio.rmdirSync(dpath); 347 } catch (error) { 348 console.info('test_fileio_create_dir_sync_004 has failed for : ' + error); 349 expect(false).assertTrue(); 350 } 351 console.info("--------end test_fileio_create_dir_sync_004--------"); 352 }); 353 354 /** 355 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0500 356 * @tc.name test_fileio_create_dir_sync_005 357 * @tc.desc Test the distributed file mkdirSync interface with mode=0o300 358 * @tc.level 3 359 */ 360 it('test_fileio_create_dir_sync_005', 3, async function (done) { 361 console.info("--------start test_fileio_create_dir_sync_005--------"); 362 let tcNumber = 'test_fileio_create_dir_sync_005'; 363 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 364 365 try { 366 fileio.mkdirSync(dpath, 0o300); 367 let dir = fileio.opendirSync(dpath); 368 expect(dir !== null).assertTrue(); 369 console.info('------ client mkdirSync success.'); 370 371 console.info('------ start check server... '); 372 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 373 console.info("test_fileio_create_dir_sync_005 : getServerFileInfo serverDirCreate: " + serverDirCreate); 374 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 375 }); 376 377 dir.closeSync(); 378 fileio.rmdirSync(dpath); 379 } catch (error) { 380 console.info('test_fileio_create_dir_sync_005 has failed for : ' + error); 381 expect(false).assertTrue(); 382 } 383 console.info("--------end test_fileio_create_dir_sync_005--------"); 384 }); 385 386 /** 387 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0600 388 * @tc.name test_fileio_create_dir_sync_006 389 * @tc.desc Test the distributed file mkdirSync interface with mode=0o200 390 * @tc.level 3 391 */ 392 it('test_fileio_create_dir_sync_006', 3, async function (done) { 393 console.info("--------start test_fileio_create_dir_sync_006--------"); 394 let tcNumber = 'test_fileio_create_dir_sync_006'; 395 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 396 397 try { 398 fileio.mkdirSync(dpath, 0o200); 399 let dir = fileio.opendirSync(dpath); 400 expect(dir !== null).assertTrue(); 401 console.info('------ client mkdirSync success.'); 402 403 console.info('------ start check server... '); 404 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 405 console.info("test_fileio_create_dir_sync_006 : getServerFileInfo serverDirCreate: " + serverDirCreate); 406 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 407 }); 408 dir.closeSync(); 409 fileio.rmdirSync(dpath); 410 } catch (error) { 411 console.info('test_fileio_create_dir_sync_006 has failed for : ' + error); 412 expect(false).assertTrue(); 413 } 414 console.info("--------end test_fileio_create_dir_sync_006--------"); 415 }); 416 417 /** 418 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0700 419 * @tc.name test_fileio_create_dir_sync_007 420 * @tc.desc Test the distributed file mkdirSync interface with mode=0o100 421 * @tc.level 3 422 */ 423 it('test_fileio_create_dir_sync_007', 3, async function (done) { 424 console.info("--------start test_fileio_create_dir_sync_007--------"); 425 let tcNumber = 'test_fileio_create_dir_sync_007'; 426 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 427 428 try { 429 fileio.mkdirSync(dpath, 0o100); 430 let dir = fileio.opendirSync(dpath); 431 expect(dir !== null).assertTrue(); 432 console.info('------ client mkdirSync success.'); 433 434 console.info('------ start check server... '); 435 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 436 console.info("test_fileio_create_dir_sync_007 : getServerFileInfo serverDirCreate: " + serverDirCreate); 437 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 438 }); 439 440 dir.closeSync(); 441 fileio.rmdirSync(dpath); 442 } catch (error) { 443 console.info('test_fileio_create_dir_sync_007 has failed for : ' + error); 444 expect(false).assertTrue(); 445 } 446 console.info("--------end test_fileio_create_dir_sync_007--------"); 447 }); 448 449 /** 450 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0800 451 * @tc.name test_fileio_create_dir_sync_008 452 * @tc.desc Test the distributed file mkdirSync interface with mode=0o070 453 * @tc.level 3 454 */ 455 it('test_fileio_create_dir_sync_008', 3, async function (done) { 456 console.info("--------start test_fileio_create_dir_sync_008--------"); 457 let tcNumber = 'test_fileio_create_dir_sync_008'; 458 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 459 460 try { 461 fileio.mkdirSync(dpath, 0o070); 462 let dir = fileio.opendirSync(dpath); 463 expect(dir !== null).assertTrue(); 464 console.info('------ client mkdirSync success.'); 465 466 console.info('------ start check server... '); 467 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 468 console.info("test_fileio_create_dir_sync_008 : getServerFileInfo serverDirCreate: " + serverDirCreate); 469 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 470 }); 471 dir.closeSync(); 472 fileio.rmdirSync(dpath); 473 } catch (error) { 474 console.info('test_fileio_create_dir_sync_008 has failed for : ' + error); 475 expect(false).assertTrue(); 476 } 477 console.info("--------end test_fileio_create_dir_sync_008--------"); 478 }); 479 480 /** 481 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_0900 482 * @tc.name test_fileio_create_dir_sync_009 483 * @tc.desc Test the distributed file mkdirSync interface with mode=0o060 484 * @tc.level 3 485 */ 486 it('test_fileio_create_dir_sync_009', 3, async function (done) { 487 console.info("--------start test_fileio_create_dir_sync_009--------"); 488 let tcNumber = 'test_fileio_create_dir_sync_009'; 489 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 490 491 try { 492 fileio.mkdirSync(dpath, 0o060); 493 let dir = fileio.opendirSync(dpath); 494 expect(dir !== null).assertTrue(); 495 console.info('------ client mkdirSync success.'); 496 497 console.info('------ start check server... '); 498 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 499 console.info("test_fileio_create_dir_sync_009 : getServerFileInfo serverDirCreate: " + serverDirCreate); 500 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 501 }); 502 dir.closeSync(); 503 fileio.rmdirSync(dpath); 504 } catch (error) { 505 console.info('test_fileio_create_dir_sync_009 has failed for : ' + error); 506 expect(false).assertTrue(); 507 } 508 console.info("--------end test_fileio_create_dir_sync_009--------"); 509 }); 510 511 /** 512 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1000 513 * @tc.name test_fileio_create_dir_sync_010 514 * @tc.desc Test the distributed file mkdirSync interface with mode=0o050 515 * @tc.level 3 516 */ 517 it('test_fileio_create_dir_sync_010', 3, async function (done) { 518 console.info("--------start test_fileio_create_dir_sync_010--------"); 519 let tcNumber = 'test_fileio_create_dir_sync_010'; 520 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 521 522 try { 523 fileio.mkdirSync(dpath, 0o050); 524 let dir = fileio.opendirSync(dpath); 525 expect(dir !== null).assertTrue(); 526 console.info('------ client mkdirSync success.'); 527 528 console.info('------ start check server... '); 529 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 530 console.info("test_fileio_create_dir_sync_010 : getServerFileInfo serverDirCreate: " + serverDirCreate); 531 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 532 }); 533 dir.closeSync(); 534 fileio.rmdirSync(dpath); 535 } catch (error) { 536 console.info('test_fileio_create_dir_sync_010 has failed for : ' + error); 537 expect(false).assertTrue(); 538 } 539 console.info("--------end test_fileio_create_dir_sync_010--------"); 540 }); 541 542 /** 543 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1100 544 * @tc.name test_fileio_create_dir_sync_011 545 * @tc.desc Test the distributed file mkdirSync interface with mode=0o040 546 * @tc.level 3 547 */ 548 it('test_fileio_create_dir_sync_011', 3, async function (done) { 549 console.info("--------start test_fileio_create_dir_sync_011--------"); 550 let tcNumber = 'test_fileio_create_dir_sync_011'; 551 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 552 553 try { 554 fileio.mkdirSync(dpath, 0o040); 555 let dir = fileio.opendirSync(dpath); 556 expect(dir !== null).assertTrue(); 557 console.info('------ client mkdirSync success.'); 558 559 console.info('------ start check server... '); 560 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 561 console.info("test_fileio_create_dir_sync_011 : getServerFileInfo serverDirCreate: " + serverDirCreate); 562 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 563 }); 564 dir.closeSync(); 565 fileio.rmdirSync(dpath); 566 } catch (error) { 567 console.info('test_fileio_create_dir_sync_011 has failed for : ' + error); 568 expect(false).assertTrue(); 569 } 570 console.info("--------end test_fileio_create_dir_sync_011--------"); 571 }); 572 573 /** 574 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1200 575 * @tc.name test_fileio_create_dir_sync_012 576 * @tc.desc Test the distributed file mkdirSync interface with mode=0o030 577 * @tc.level 3 578 */ 579 it('test_fileio_create_dir_sync_012', 3, async function (done) { 580 console.info("--------start test_fileio_create_dir_sync_012--------"); 581 let tcNumber = 'test_fileio_create_dir_sync_012'; 582 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 583 584 try { 585 fileio.mkdirSync(dpath, 0o030); 586 let dir = fileio.opendirSync(dpath); 587 expect(dir !== null).assertTrue(); 588 console.info('------ client mkdirSync success.'); 589 590 console.info('------ start check server... '); 591 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 592 console.info("test_fileio_create_dir_sync_012 : getServerFileInfo serverDirCreate: " + serverDirCreate); 593 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 594 }); 595 dir.closeSync(); 596 fileio.rmdirSync(dpath); 597 } catch (error) { 598 console.info('test_fileio_create_dir_sync_012 has failed for : ' + error); 599 expect(false).assertTrue(); 600 } 601 console.info("--------end test_fileio_create_dir_sync_012--------"); 602 }); 603 604 /** 605 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1300 606 * @tc.name test_fileio_create_dir_sync_013 607 * @tc.desc Test the distributed file mkdirSync interface with mode=0o020 608 * @tc.level 3 609 */ 610 it('test_fileio_create_dir_sync_013', 3, async function (done) { 611 console.info("--------start test_fileio_create_dir_sync_013--------"); 612 let tcNumber = 'test_fileio_create_dir_sync_013'; 613 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 614 615 try { 616 fileio.mkdirSync(dpath, 0o020); 617 let dir = fileio.opendirSync(dpath); 618 expect(dir !== null).assertTrue(); 619 console.info('------ client mkdirSync success.'); 620 621 console.info('------ start check server... '); 622 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 623 console.info("test_fileio_create_dir_sync_013 : getServerFileInfo serverDirCreate: " + serverDirCreate); 624 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 625 }); 626 dir.closeSync(); 627 fileio.rmdirSync(dpath); 628 } catch (error) { 629 console.info('test_fileio_create_dir_sync_013 has failed for : ' + error); 630 expect(false).assertTrue(); 631 } 632 console.info("--------end test_fileio_create_dir_sync_013--------"); 633 }); 634 635 /** 636 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1400 637 * @tc.name test_fileio_create_dir_sync_014 638 * @tc.desc Test the distributed file mkdirSync interface with mode=0o010 639 * @tc.level 3 640 */ 641 it('test_fileio_create_dir_sync_014', 3, async function (done) { 642 console.info("--------start test_fileio_create_dir_sync_014--------"); 643 let tcNumber = 'test_fileio_create_dir_sync_014'; 644 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 645 646 try { 647 fileio.mkdirSync(dpath, 0o010); 648 let dir = fileio.opendirSync(dpath); 649 expect(dir !== null).assertTrue(); 650 console.info('------ client mkdirSync success.'); 651 652 console.info('------ start check server... '); 653 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 654 console.info("test_fileio_create_dir_sync_014 : getServerFileInfo serverDirCreate: " + serverDirCreate); 655 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 656 }); 657 dir.closeSync(); 658 fileio.rmdirSync(dpath); 659 } catch (error) { 660 console.info('test_fileio_create_dir_sync_014 has failed for : ' + error); 661 expect(false).assertTrue(); 662 } 663 console.info("--------end test_fileio_create_dir_sync_014--------"); 664 }); 665 666 /** 667 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1500 668 * @tc.name test_fileio_create_dir_sync_015 669 * @tc.desc Test the distributed file mkdirSync interface with mode=0o007 670 * @tc.level 3 671 */ 672 it('test_fileio_create_dir_sync_015', 3, async function (done) { 673 console.info("--------start test_fileio_create_dir_sync_015--------"); 674 let tcNumber = 'test_fileio_create_dir_sync_015'; 675 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 676 677 try { 678 fileio.mkdirSync(dpath, 0o007); 679 let dir = fileio.opendirSync(dpath); 680 expect(dir !== null).assertTrue(); 681 console.info('------ client mkdirSync success.'); 682 683 console.info('------ start check server... '); 684 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 685 console.info("test_fileio_create_dir_sync_015 : getServerFileInfo serverDirCreate: " + serverDirCreate); 686 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 687 }); 688 dir.closeSync(); 689 fileio.rmdirSync(dpath); 690 } catch (error) { 691 console.info('test_fileio_create_dir_sync_015 has failed for : ' + error); 692 expect(false).assertTrue(); 693 } 694 console.info("--------end test_fileio_create_dir_sync_015--------"); 695 }); 696 697 /** 698 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1600 699 * @tc.name test_fileio_create_dir_sync_016 700 * @tc.desc Test the distributed file mkdirSync interface with mode=0o006 701 * @tc.level 3 702 */ 703 it('test_fileio_create_dir_sync_016', 3, async function (done) { 704 console.info("--------start test_fileio_create_dir_sync_016--------"); 705 let tcNumber = 'test_fileio_create_dir_sync_016'; 706 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 707 708 try { 709 fileio.mkdirSync(dpath, 0o006); 710 let dir = fileio.opendirSync(dpath); 711 expect(dir !== null).assertTrue(); 712 console.info('------ client mkdirSync success.'); 713 714 console.info('------ start check server... '); 715 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 716 console.info("test_fileio_create_dir_sync_016 : getServerFileInfo serverDirCreate: " + serverDirCreate); 717 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 718 }); 719 dir.closeSync(); 720 fileio.rmdirSync(dpath); 721 } catch (error) { 722 console.info('test_fileio_create_dir_sync_016 has failed for : ' + error); 723 expect(false).assertTrue(); 724 } 725 console.info("--------end test_fileio_create_dir_sync_016--------"); 726 }); 727 728 /** 729 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1700 730 * @tc.name test_fileio_create_dir_sync_017 731 * @tc.desc Test the distributed file mkdirSync interface with mode=0o005 732 * @tc.level 3 733 */ 734 it('test_fileio_create_dir_sync_017', 3, async function (done) { 735 console.info("--------start test_fileio_create_dir_sync_017--------"); 736 let tcNumber = 'test_fileio_create_dir_sync_017'; 737 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 738 739 try { 740 fileio.mkdirSync(dpath, 0o005); 741 let dir = fileio.opendirSync(dpath); 742 expect(dir !== null).assertTrue(); 743 console.info('------ client mkdirSync success.'); 744 745 console.info('------ start check server... '); 746 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 747 console.info("test_fileio_create_dir_sync_017 : getServerFileInfo serverDirCreate: " + serverDirCreate); 748 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 749 }); 750 dir.closeSync(); 751 fileio.rmdirSync(dpath); 752 } catch (error) { 753 console.info('test_fileio_create_dir_sync_017 has failed for : ' + error); 754 expect(false).assertTrue(); 755 } 756 console.info("--------end test_fileio_create_dir_sync_017--------"); 757 }); 758 759 /** 760 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1800 761 * @tc.name test_fileio_create_dir_sync_018 762 * @tc.desc Test the distributed file mkdirSync interface with mode=0o004 763 * @tc.level 3 764 */ 765 it('test_fileio_create_dir_sync_018', 3, async function (done) { 766 console.info("--------start test_fileio_create_dir_sync_018--------"); 767 let tcNumber = 'test_fileio_create_dir_sync_018'; 768 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 769 770 try { 771 fileio.mkdirSync(dpath, 0o004); 772 let dir = fileio.opendirSync(dpath); 773 expect(dir !== null).assertTrue(); 774 console.info('------ client mkdirSync success.'); 775 776 console.info('------ start check server... '); 777 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 778 console.info("test_fileio_create_dir_sync_018 : getServerFileInfo serverDirCreate: " + serverDirCreate); 779 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 780 }); 781 dir.closeSync(); 782 fileio.rmdirSync(dpath); 783 } catch (error) { 784 console.info('test_fileio_create_dir_sync_018 has failed for : ' + error); 785 expect(false).assertTrue(); 786 } 787 console.info("--------end test_fileio_create_dir_sync_018--------"); 788 }); 789 790 /** 791 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_1900 792 * @tc.name test_fileio_create_dir_sync_019 793 * @tc.desc Test the distributed file mkdirSync interface with mode=0o003 794 * @tc.level 3 795 */ 796 it('test_fileio_create_dir_sync_019', 3, async function (done) { 797 console.info("--------start test_fileio_create_dir_sync_019--------"); 798 let tcNumber = 'test_fileio_create_dir_sync_019'; 799 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 800 801 try { 802 fileio.mkdirSync(dpath, 0o003); 803 let dir = fileio.opendirSync(dpath); 804 expect(dir !== null).assertTrue(); 805 console.info('------ client mkdirSync success.'); 806 807 console.info('------ start check server... '); 808 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 809 console.info("test_fileio_create_dir_sync_019 : getServerFileInfo serverDirCreate: " + serverDirCreate); 810 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 811 }); 812 dir.closeSync(); 813 fileio.rmdirSync(dpath); 814 } catch (error) { 815 console.info('test_fileio_create_dir_sync_019 has failed for : ' + error); 816 expect(false).assertTrue(); 817 } 818 console.info("--------end test_fileio_create_dir_sync_019--------"); 819 }); 820 821 /** 822 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2000 823 * @tc.name test_fileio_create_dir_sync_020 824 * @tc.desc Test the distributed file mkdirSync interface with mode=0o002 825 * @tc.level 3 826 */ 827 it('test_fileio_create_dir_sync_020', 3, async function (done) { 828 console.info("--------start test_fileio_create_dir_sync_020--------"); 829 let tcNumber = 'test_fileio_create_dir_sync_020'; 830 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 831 832 try { 833 fileio.mkdirSync(dpath, 0o002); 834 let dir = fileio.opendirSync(dpath); 835 expect(dir !== null).assertTrue(); 836 console.info('------ client mkdirSync success.'); 837 838 console.info('------ start check server... '); 839 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 840 console.info("test_fileio_create_dir_sync_020 : getServerFileInfo serverDirCreate: " + serverDirCreate); 841 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 842 }); 843 dir.closeSync(); 844 fileio.rmdirSync(dpath); 845 } catch (error) { 846 console.info('test_fileio_create_dir_sync_020 has failed for : ' + error); 847 expect(false).assertTrue(); 848 } 849 console.info("--------end test_fileio_create_dir_sync_020--------"); 850 }); 851 852 /** 853 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2100 854 * @tc.name test_fileio_create_dir_sync_021 855 * @tc.desc Test the distributed file mkdirSync interface with mode=0o001 856 * @tc.level 3 857 */ 858 it('test_fileio_create_dir_sync_021', 3, async function (done) { 859 console.info("--------start test_fileio_create_dir_sync_021--------"); 860 let tcNumber = 'test_fileio_create_dir_sync_021'; 861 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 862 863 try { 864 fileio.mkdirSync(dpath, 0o001); 865 let dir = fileio.opendirSync(dpath); 866 expect(dir !== null).assertTrue(); 867 console.info('------ client mkdirSync success.'); 868 869 console.info('------ start check server... '); 870 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 871 console.info("test_fileio_create_dir_sync_021 : getServerFileInfo serverDirCreate: " + serverDirCreate); 872 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 873 }); 874 dir.closeSync(); 875 fileio.rmdirSync(dpath); 876 } catch (error) { 877 console.info('test_fileio_create_dir_sync_021 has failed for : ' + error); 878 expect(false).assertTrue(); 879 } 880 console.info("--------end test_fileio_create_dir_sync_021--------"); 881 }); 882 883 /** 884 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2200 885 * @tc.name test_fileio_create_dir_sync_022 886 * @tc.desc Test the distributed file mkdirSync interface with mode=0o777 887 * @tc.level 3 888 */ 889 it('test_fileio_create_dir_sync_022', 3, async function (done) { 890 console.info("--------start test_fileio_create_dir_sync_022--------"); 891 let tcNumber = 'test_fileio_create_dir_sync_022'; 892 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 893 894 try { 895 fileio.mkdirSync(dpath, 0o777); 896 let dir = fileio.opendirSync(dpath); 897 expect(dir !== null).assertTrue(); 898 console.info('------ client mkdirSync success.'); 899 900 console.info('------ start check server... '); 901 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 902 console.info("test_fileio_create_dir_sync_022 : getServerFileInfo serverDirCreate: " + serverDirCreate); 903 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 904 }); 905 dir.closeSync(); 906 fileio.rmdirSync(dpath); 907 } catch (error) { 908 console.info('test_fileio_create_dir_sync_022 has failed for : ' + error); 909 expect(false).assertTrue(); 910 } 911 console.info("--------end test_fileio_create_dir_sync_022--------"); 912 }); 913 914 /** 915 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2300 916 * @tc.name test_fileio_create_dir_sync_023 917 * @tc.desc Test the distributed file mkdirSync interface with mode=0o766 918 * @tc.level 3 919 */ 920 it('test_fileio_create_dir_sync_023', 3, async function (done) { 921 console.info("--------start test_fileio_create_dir_sync_023--------"); 922 let tcNumber = 'test_fileio_create_dir_sync_023'; 923 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 924 925 try { 926 fileio.mkdirSync(dpath, 0o766); 927 let dir = fileio.opendirSync(dpath); 928 expect(dir !== null).assertTrue(); 929 console.info('------ client mkdirSync success.'); 930 931 console.info('------ start check server... '); 932 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 933 console.info("test_fileio_create_dir_sync_023 : getServerFileInfo serverDirCreate: " + serverDirCreate); 934 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 935 }); 936 dir.closeSync(); 937 fileio.rmdirSync(dpath); 938 } catch (error) { 939 console.info('test_fileio_create_dir_sync_023 has failed for : ' + error); 940 expect(false).assertTrue(); 941 } 942 console.info("--------end test_fileio_create_dir_sync_023--------"); 943 }); 944 945 /** 946 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2400 947 * @tc.name test_fileio_create_dir_sync_024 948 * @tc.desc Test the distributed file mkdirSync interface with mode=0o755 949 * @tc.level 3 950 */ 951 it('test_fileio_create_dir_sync_024', 3, async function (done) { 952 console.info("--------start test_fileio_create_dir_sync_024--------"); 953 let tcNumber = 'test_fileio_create_dir_sync_024'; 954 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 955 956 try { 957 fileio.mkdirSync(dpath, 0o755); 958 let dir = fileio.opendirSync(dpath); 959 expect(dir !== null).assertTrue(); 960 console.info('------ client mkdirSync success.'); 961 962 console.info('------ start check server... '); 963 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 964 console.info("test_fileio_create_dir_sync_024 : getServerFileInfo serverDirCreate: " + serverDirCreate); 965 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 966 }); 967 dir.closeSync(); 968 fileio.rmdirSync(dpath); 969 } catch (error) { 970 console.info('test_fileio_create_dir_sync_024 has failed for : ' + error); 971 expect(false).assertTrue(); 972 } 973 console.info("--------end test_fileio_create_dir_sync_024--------"); 974 }); 975 976 /** 977 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2500 978 * @tc.name test_fileio_create_dir_sync_025 979 * @tc.desc Test the distributed file mkdirSync interface with mode=0o744 980 * @tc.level 3 981 */ 982 it('test_fileio_create_dir_sync_025', 3, async function (done) { 983 console.info("--------start test_fileio_create_dir_sync_025--------"); 984 let tcNumber = 'test_fileio_create_dir_sync_025'; 985 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 986 987 try { 988 fileio.mkdirSync(dpath, 0o744); 989 let dir = fileio.opendirSync(dpath); 990 expect(dir !== null).assertTrue(); 991 console.info('------ client mkdirSync success.'); 992 993 console.info('------ start check server... '); 994 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 995 console.info("test_fileio_create_dir_sync_025 : getServerFileInfo serverDirCreate: " + serverDirCreate); 996 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 997 }); 998 dir.closeSync(); 999 fileio.rmdirSync(dpath); 1000 } catch (error) { 1001 console.info('test_fileio_create_dir_sync_025 has failed for : ' + error); 1002 expect(false).assertTrue(); 1003 } 1004 console.info("--------end test_fileio_create_dir_sync_025--------"); 1005 }); 1006 1007 /** 1008 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2600 1009 * @tc.name test_fileio_create_dir_sync_026 1010 * @tc.desc Test the distributed file mkdirSync interface with mode=0o733 1011 * @tc.level 3 1012 */ 1013 it('test_fileio_create_dir_sync_026', 3, async function (done) { 1014 console.info("--------start test_fileio_create_dir_sync_026--------"); 1015 let tcNumber = 'test_fileio_create_dir_sync_026'; 1016 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1017 1018 try { 1019 fileio.mkdirSync(dpath, 0o733); 1020 let dir = fileio.opendirSync(dpath); 1021 expect(dir !== null).assertTrue(); 1022 console.info('------ client mkdirSync success.'); 1023 1024 console.info('------ start check server... '); 1025 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1026 console.info("test_fileio_create_dir_sync_026 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1027 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1028 }); 1029 dir.closeSync(); 1030 fileio.rmdirSync(dpath); 1031 } catch (error) { 1032 console.info('test_fileio_create_dir_sync_026 has failed for : ' + error); 1033 expect(false).assertTrue(); 1034 } 1035 console.info("--------end test_fileio_create_dir_sync_026--------"); 1036 }); 1037 1038 /** 1039 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2700 1040 * @tc.name test_fileio_create_dir_sync_027 1041 * @tc.desc Test the distributed file mkdirSync interface with mode=0o722 1042 * @tc.level 3 1043 */ 1044 it('test_fileio_create_dir_sync_027', 3, async function (done) { 1045 console.info("--------start test_fileio_create_dir_sync_027--------"); 1046 let tcNumber = 'test_fileio_create_dir_sync_027'; 1047 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1048 1049 try { 1050 fileio.mkdirSync(dpath, 0o722); 1051 let dir = fileio.opendirSync(dpath); 1052 expect(dir !== null).assertTrue(); 1053 console.info('------ client mkdirSync success.'); 1054 1055 console.info('------ start check server... '); 1056 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1057 console.info("test_fileio_create_dir_sync_027 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1058 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1059 }); 1060 dir.closeSync(); 1061 fileio.rmdirSync(dpath); 1062 } catch (error) { 1063 console.info('test_fileio_create_dir_sync_027 has failed for : ' + error); 1064 expect(false).assertTrue(); 1065 } 1066 console.info("--------end test_fileio_create_dir_sync_027--------"); 1067 }); 1068 1069 /** 1070 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2800 1071 * @tc.name test_fileio_create_dir_sync_028 1072 * @tc.desc Test the distributed file mkdirSync interface with mode=0o711 1073 * @tc.level 3 1074 */ 1075 it('test_fileio_create_dir_sync_028', 3, async function (done) { 1076 console.info("--------start test_fileio_create_dir_sync_028--------"); 1077 let tcNumber = 'test_fileio_create_dir_sync_028'; 1078 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1079 1080 try { 1081 fileio.mkdirSync(dpath, 0o001); 1082 let dir = fileio.opendirSync(dpath); 1083 expect(dir !== null).assertTrue(); 1084 console.info('------ client mkdirSync success.'); 1085 1086 console.info('------ start check server... '); 1087 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1088 console.info("test_fileio_create_dir_sync_028 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1089 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1090 }); 1091 dir.closeSync(); 1092 fileio.rmdirSync(dpath); 1093 } catch (error) { 1094 console.info('test_fileio_create_dir_sync_028 has failed for : ' + error); 1095 expect(false).assertTrue(); 1096 } 1097 console.info("--------end test_fileio_create_dir_sync_028--------"); 1098 }); 1099 1100 1101 /** 1102 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_2900 1103 * @tc.name test_fileio_create_dir_sync_029 1104 * @tc.desc Test the distributed file mkdirSync interface with mode=0o676 1105 * @tc.level 3 1106 */ 1107 it('test_fileio_create_dir_sync_029', 3, async function (done) { 1108 console.info("--------start test_fileio_create_dir_sync_029--------"); 1109 let tcNumber = 'test_fileio_create_dir_sync_029'; 1110 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1111 1112 try { 1113 fileio.mkdirSync(dpath, 0o676); 1114 let dir = fileio.opendirSync(dpath); 1115 expect(dir !== null).assertTrue(); 1116 console.info('------ client mkdirSync success.'); 1117 1118 console.info('------ start check server... '); 1119 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1120 console.info("test_fileio_create_dir_sync_029 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1121 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1122 }); 1123 dir.closeSync(); 1124 fileio.rmdirSync(dpath); 1125 } catch (error) { 1126 console.info('test_fileio_create_dir_sync_029 has failed for : ' + error); 1127 expect(false).assertTrue(); 1128 } 1129 console.info("--------end test_fileio_create_dir_sync_029--------"); 1130 }); 1131 1132 /** 1133 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3000 1134 * @tc.name test_fileio_create_dir_sync_030 1135 * @tc.desc Test the distributed file mkdirSync interface with mode=0o667 1136 * @tc.level 3 1137 */ 1138 it('test_fileio_create_dir_sync_030', 3, async function (done) { 1139 console.info("--------start test_fileio_create_dir_sync_030--------"); 1140 let tcNumber = 'test_fileio_create_dir_sync_030'; 1141 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1142 1143 try { 1144 fileio.mkdirSync(dpath, 0o667); 1145 let dir = fileio.opendirSync(dpath); 1146 expect(dir !== null).assertTrue(); 1147 console.info('------ client mkdirSync success.'); 1148 1149 console.info('------ start check server... '); 1150 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1151 console.info("test_fileio_create_dir_sync_030 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1152 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1153 }); 1154 dir.closeSync(); 1155 fileio.rmdirSync(dpath); 1156 } catch (error) { 1157 console.info('test_fileio_create_dir_sync_030 has failed for : ' + error); 1158 expect(false).assertTrue(); 1159 } 1160 console.info("--------end test_fileio_create_dir_sync_030--------"); 1161 }); 1162 1163 /** 1164 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3100 1165 * @tc.name test_fileio_create_dir_sync_031 1166 * @tc.desc Test the distributed file mkdirSync interface with mode=0o654 1167 * @tc.level 3 1168 */ 1169 it('test_fileio_create_dir_sync_031', 3, async function (done) { 1170 console.info("--------start test_fileio_create_dir_sync_031--------"); 1171 let tcNumber = 'test_fileio_create_dir_sync_031'; 1172 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1173 1174 try { 1175 fileio.mkdirSync(dpath, 0o654); 1176 let dir = fileio.opendirSync(dpath); 1177 expect(dir !== null).assertTrue(); 1178 console.info('------ client mkdirSync success.'); 1179 1180 console.info('------ start check server... '); 1181 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1182 console.info("test_fileio_create_dir_sync_031 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1183 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1184 }); 1185 dir.closeSync(); 1186 fileio.rmdirSync(dpath); 1187 } catch (error) { 1188 console.info('test_fileio_create_dir_sync_031 has failed for : ' + error); 1189 expect(false).assertTrue(); 1190 } 1191 console.info("--------end test_fileio_create_dir_sync_031--------"); 1192 }); 1193 1194 /** 1195 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3200 1196 * @tc.name test_fileio_create_dir_sync_032 1197 * @tc.desc Test the distributed file mkdirSync interface with mode=0o645 1198 * @tc.level 3 1199 */ 1200 it('test_fileio_create_dir_sync_032', 3, async function (done) { 1201 console.info("--------start test_fileio_create_dir_sync_032--------"); 1202 let tcNumber = 'test_fileio_create_dir_sync_032'; 1203 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1204 1205 try { 1206 fileio.mkdirSync(dpath, 0o645); 1207 let dir = fileio.opendirSync(dpath); 1208 expect(dir !== null).assertTrue(); 1209 console.info('------ client mkdirSync success.'); 1210 1211 console.info('------ start check server... '); 1212 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1213 console.info("test_fileio_create_dir_sync_032 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1214 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1215 }); 1216 dir.closeSync(); 1217 fileio.rmdirSync(dpath); 1218 } catch (error) { 1219 console.info('test_fileio_create_dir_sync_032 has failed for : ' + error); 1220 expect(false).assertTrue(); 1221 } 1222 console.info("--------end test_fileio_create_dir_sync_032--------"); 1223 }); 1224 1225 /** 1226 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3300 1227 * @tc.name test_fileio_create_dir_sync_033 1228 * @tc.desc Test the distributed file mkdirSync interface with mode=0o632 1229 * @tc.level 3 1230 */ 1231 it('test_fileio_create_dir_sync_033', 3, async function (done) { 1232 console.info("--------start test_fileio_create_dir_sync_033--------"); 1233 let tcNumber = 'test_fileio_create_dir_sync_033'; 1234 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1235 1236 try { 1237 fileio.mkdirSync(dpath, 0o632); 1238 let dir = fileio.opendirSync(dpath); 1239 expect(dir !== null).assertTrue(); 1240 console.info('------ client mkdirSync success.'); 1241 1242 console.info('------ start check server... '); 1243 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1244 console.info("test_fileio_create_dir_sync_033 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1245 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1246 }); 1247 dir.closeSync(); 1248 fileio.rmdirSync(dpath); 1249 } catch (error) { 1250 console.info('test_fileio_create_dir_sync_033 has failed for : ' + error); 1251 expect(false).assertTrue(); 1252 } 1253 console.info("--------end test_fileio_create_dir_sync_033--------"); 1254 }); 1255 1256 /** 1257 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3400 1258 * @tc.name test_fileio_create_dir_sync_034 1259 * @tc.desc Test the distributed file mkdirSync interface with mode=0o623 1260 * @tc.level 3 1261 */ 1262 it('test_fileio_create_dir_sync_034', 3, async function (done) { 1263 console.info("--------start test_fileio_create_dir_sync_034--------"); 1264 let tcNumber = 'test_fileio_create_dir_sync_034'; 1265 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1266 1267 try { 1268 fileio.mkdirSync(dpath, 0o623); 1269 let dir = fileio.opendirSync(dpath); 1270 expect(dir !== null).assertTrue(); 1271 console.info('------ client mkdirSync success.'); 1272 1273 console.info('------ start check server... '); 1274 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1275 console.info("test_fileio_create_dir_sync_034 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1276 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1277 }); 1278 dir.closeSync(); 1279 fileio.rmdirSync(dpath); 1280 } catch (error) { 1281 console.info('test_fileio_create_dir_sync_034 has failed for : ' + error); 1282 expect(false).assertTrue(); 1283 } 1284 console.info("--------end test_fileio_create_dir_sync_034--------"); 1285 }); 1286 1287 /** 1288 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3500 1289 * @tc.name test_fileio_create_dir_sync_035 1290 * @tc.desc Test the distributed file mkdirSync interface with mode=0o617 1291 * @tc.level 3 1292 */ 1293 it('test_fileio_create_dir_sync_035', 3, async function (done) { 1294 console.info("--------start test_fileio_create_dir_sync_035--------"); 1295 let tcNumber = 'test_fileio_create_dir_sync_035'; 1296 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1297 1298 try { 1299 fileio.mkdirSync(dpath, 0o617); 1300 let dir = fileio.opendirSync(dpath); 1301 expect(dir !== null).assertTrue(); 1302 console.info('------ client mkdirSync success.'); 1303 1304 console.info('------ start check server... '); 1305 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1306 console.info("test_fileio_create_dir_sync_035 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1307 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1308 }); 1309 dir.closeSync(); 1310 fileio.rmdirSync(dpath); 1311 } catch (error) { 1312 console.info('test_fileio_create_dir_sync_035 has failed for : ' + error); 1313 expect(false).assertTrue(); 1314 } 1315 console.info("--------end test_fileio_create_dir_sync_035--------"); 1316 }); 1317 1318 1319 /** 1320 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3600 1321 * @tc.name test_fileio_create_dir_sync_036 1322 * @tc.desc Test the distributed file mkdirSync interface with mode=0o575 1323 * @tc.level 3 1324 */ 1325 it('test_fileio_create_dir_sync_036', 3, async function (done) { 1326 console.info("--------start test_fileio_create_dir_sync_036--------"); 1327 let tcNumber = 'test_fileio_create_dir_sync_036'; 1328 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1329 1330 try { 1331 fileio.mkdirSync(dpath, 0o575); 1332 let dir = fileio.opendirSync(dpath); 1333 expect(dir !== null).assertTrue(); 1334 console.info('------ client mkdirSync success.'); 1335 1336 console.info('------ start check server... '); 1337 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1338 console.info("test_fileio_create_dir_sync_036 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1339 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1340 }); 1341 dir.closeSync(); 1342 fileio.rmdirSync(dpath); 1343 } catch (error) { 1344 console.info('test_fileio_create_dir_sync_036 has failed for : ' + error); 1345 expect(false).assertTrue(); 1346 } 1347 console.info("--------end test_fileio_create_dir_sync_036--------"); 1348 }); 1349 1350 /** 1351 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3700 1352 * @tc.name test_fileio_create_dir_sync_037 1353 * @tc.desc Test the distributed file mkdirSync interface with mode=0o564 1354 * @tc.level 3 1355 */ 1356 it('test_fileio_create_dir_sync_037', 3, async function (done) { 1357 console.info("--------start test_fileio_create_dir_sync_037--------"); 1358 let tcNumber = 'test_fileio_create_dir_sync_037'; 1359 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1360 1361 try { 1362 fileio.mkdirSync(dpath, 0o564); 1363 let dir = fileio.opendirSync(dpath); 1364 expect(dir !== null).assertTrue(); 1365 console.info('------ client mkdirSync success.'); 1366 1367 console.info('------ start check server... '); 1368 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1369 console.info("test_fileio_create_dir_sync_037 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1370 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1371 }); 1372 dir.closeSync(); 1373 fileio.rmdirSync(dpath); 1374 } catch (error) { 1375 console.info('test_fileio_create_dir_sync_037 has failed for : ' + error); 1376 expect(false).assertTrue(); 1377 } 1378 console.info("--------end test_fileio_create_dir_sync_037--------"); 1379 }); 1380 1381 /** 1382 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3800 1383 * @tc.name test_fileio_create_dir_sync_038 1384 * @tc.desc Test the distributed file mkdirSync interface with mode=0o557 1385 * @tc.level 3 1386 */ 1387 it('test_fileio_create_dir_sync_038', 3, async function (done) { 1388 console.info("--------start test_fileio_create_dir_sync_038--------"); 1389 let tcNumber = 'test_fileio_create_dir_sync_038'; 1390 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1391 1392 try { 1393 fileio.mkdirSync(dpath, 0o557); 1394 let dir = fileio.opendirSync(dpath); 1395 expect(dir !== null).assertTrue(); 1396 console.info('------ client mkdirSync success.'); 1397 1398 console.info('------ start check server... '); 1399 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1400 console.info("test_fileio_create_dir_sync_038 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1401 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1402 }); 1403 dir.closeSync(); 1404 fileio.rmdirSync(dpath); 1405 } catch (error) { 1406 console.info('test_fileio_create_dir_sync_038 has failed for : ' + error); 1407 expect(false).assertTrue(); 1408 } 1409 console.info("--------end test_fileio_create_dir_sync_038--------"); 1410 }); 1411 1412 /** 1413 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_3900 1414 * @tc.name test_fileio_create_dir_sync_039 1415 * @tc.desc Test the distributed file mkdirSync interface with mode=0o546 1416 * @tc.level 3 1417 */ 1418 it('test_fileio_create_dir_sync_039', 3, async function (done) { 1419 console.info("--------start test_fileio_create_dir_sync_039--------"); 1420 let tcNumber = 'test_fileio_create_dir_sync_039'; 1421 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1422 1423 try { 1424 fileio.mkdirSync(dpath, 0o546); 1425 let dir = fileio.opendirSync(dpath); 1426 expect(dir !== null).assertTrue(); 1427 console.info('------ client mkdirSync success.'); 1428 1429 console.info('------ start check server... '); 1430 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1431 console.info("test_fileio_create_dir_sync_039 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1432 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1433 }); 1434 dir.closeSync(); 1435 fileio.rmdirSync(dpath); 1436 } catch (error) { 1437 console.info('test_fileio_create_dir_sync_039 has failed for : ' + error); 1438 expect(false).assertTrue(); 1439 } 1440 console.info("--------end test_fileio_create_dir_sync_039--------"); 1441 }); 1442 1443 /** 1444 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4000 1445 * @tc.name test_fileio_create_dir_sync_040 1446 * @tc.desc Test the distributed file mkdirSync interface with mode=0o531 1447 * @tc.level 3 1448 */ 1449 it('test_fileio_create_dir_sync_040', 3, async function (done) { 1450 console.info("--------start test_fileio_create_dir_sync_040--------"); 1451 let tcNumber = 'test_fileio_create_dir_sync_040'; 1452 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1453 1454 try { 1455 fileio.mkdirSync(dpath, 0o531); 1456 let dir = fileio.opendirSync(dpath); 1457 expect(dir !== null).assertTrue(); 1458 console.info('------ client mkdirSync success.'); 1459 1460 console.info('------ start check server... '); 1461 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1462 console.info("test_fileio_create_dir_sync_040 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1463 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1464 }); 1465 dir.closeSync(); 1466 fileio.rmdirSync(dpath); 1467 } catch (error) { 1468 console.info('test_fileio_create_dir_sync_040 has failed for : ' + error); 1469 expect(false).assertTrue(); 1470 } 1471 console.info("--------end test_fileio_create_dir_sync_040--------"); 1472 }); 1473 1474 /** 1475 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4100 1476 * @tc.name test_fileio_create_dir_sync_041 1477 * @tc.desc Test the distributed file mkdirSync interface with mode=0o527 1478 * @tc.level 3 1479 */ 1480 it('test_fileio_create_dir_sync_041', 3, async function (done) { 1481 console.info("--------start test_fileio_create_dir_sync_041--------"); 1482 let tcNumber = 'test_fileio_create_dir_sync_041'; 1483 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1484 1485 try { 1486 fileio.mkdirSync(dpath, 0o527); 1487 let dir = fileio.opendirSync(dpath); 1488 expect(dir !== null).assertTrue(); 1489 console.info('------ client mkdirSync success.'); 1490 1491 console.info('------ start check server... '); 1492 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1493 console.info("test_fileio_create_dir_sync_041 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1494 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1495 }); 1496 dir.closeSync(); 1497 fileio.rmdirSync(dpath); 1498 } catch (error) { 1499 console.info('test_fileio_create_dir_sync_041 has failed for : ' + error); 1500 expect(false).assertTrue(); 1501 } 1502 console.info("--------end test_fileio_create_dir_sync_041--------"); 1503 }); 1504 1505 /** 1506 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4200 1507 * @tc.name test_fileio_create_dir_sync_042 1508 * @tc.desc Test the distributed file mkdirSync interface with mode=0o513 1509 * @tc.level 3 1510 */ 1511 it('test_fileio_create_dir_sync_042', 3, async function (done) { 1512 console.info("--------start test_fileio_create_dir_sync_042--------"); 1513 let tcNumber = 'test_fileio_create_dir_sync_042'; 1514 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1515 1516 try { 1517 fileio.mkdirSync(dpath, 0o513); 1518 let dir = fileio.opendirSync(dpath); 1519 expect(dir !== null).assertTrue(); 1520 console.info('------ client mkdirSync success.'); 1521 1522 console.info('------ start check server... '); 1523 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1524 console.info("test_fileio_create_dir_sync_042 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1525 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1526 }); 1527 dir.closeSync(); 1528 fileio.rmdirSync(dpath); 1529 } catch (error) { 1530 console.info('test_fileio_create_dir_sync_042 has failed for : ' + error); 1531 expect(false).assertTrue(); 1532 } 1533 console.info("--------end test_fileio_create_dir_sync_042--------"); 1534 }); 1535 1536 /** 1537 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4300 1538 * @tc.name test_fileio_create_dir_sync_043 1539 * @tc.desc Test the distributed file mkdirSync interface with mode=0o474 1540 * @tc.level 3 1541 */ 1542 it('test_fileio_create_dir_sync_043', 3, async function (done) { 1543 console.info("--------start test_fileio_create_dir_sync_043--------"); 1544 let tcNumber = 'test_fileio_create_dir_sync_043'; 1545 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1546 1547 try { 1548 fileio.mkdirSync(dpath, 0o474); 1549 let dir = fileio.opendirSync(dpath); 1550 expect(dir !== null).assertTrue(); 1551 console.info('------ client mkdirSync success.'); 1552 1553 console.info('------ start check server... '); 1554 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1555 console.info("test_fileio_create_dir_sync_043 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1556 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1557 }); 1558 dir.closeSync(); 1559 fileio.rmdirSync(dpath); 1560 } catch (error) { 1561 console.info('test_fileio_create_dir_sync_043 has failed for : ' + error); 1562 expect(false).assertTrue(); 1563 } 1564 console.info("--------end test_fileio_create_dir_sync_043--------"); 1565 }); 1566 1567 /** 1568 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4400 1569 * @tc.name test_fileio_create_dir_sync_044 1570 * @tc.desc Test the distributed file mkdirSync interface with mode=0o465 1571 * @tc.level 3 1572 */ 1573 it('test_fileio_create_dir_sync_044', 3, async function (done) { 1574 console.info("--------start test_fileio_create_dir_sync_044--------"); 1575 let tcNumber = 'test_fileio_create_dir_sync_044'; 1576 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1577 1578 try { 1579 fileio.mkdirSync(dpath, 0o465); 1580 let dir = fileio.opendirSync(dpath); 1581 expect(dir !== null).assertTrue(); 1582 console.info('------ client mkdirSync success.'); 1583 1584 console.info('------ start check server... '); 1585 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1586 console.info("test_fileio_create_dir_sync_044 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1587 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1588 }); 1589 dir.closeSync(); 1590 fileio.rmdirSync(dpath); 1591 } catch (error) { 1592 console.info('test_fileio_create_dir_sync_044 has failed for : ' + error); 1593 expect(false).assertTrue(); 1594 } 1595 console.info("--------end test_fileio_create_dir_sync_044--------"); 1596 }); 1597 1598 /** 1599 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4500 1600 * @tc.name test_fileio_create_dir_sync_045 1601 * @tc.desc Test the distributed file mkdirSync interface with mode=0o456 1602 * @tc.level 3 1603 */ 1604 it('test_fileio_create_dir_sync_045', 3, async function (done) { 1605 console.info("--------start test_fileio_create_dir_sync_045--------"); 1606 let tcNumber = 'test_fileio_create_dir_sync_045'; 1607 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1608 1609 try { 1610 fileio.mkdirSync(dpath, 0o456); 1611 let dir = fileio.opendirSync(dpath); 1612 expect(dir !== null).assertTrue(); 1613 console.info('------ client mkdirSync success.'); 1614 1615 console.info('------ start check server... '); 1616 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1617 console.info("test_fileio_create_dir_sync_045 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1618 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1619 }); 1620 dir.closeSync(); 1621 fileio.rmdirSync(dpath); 1622 } catch (error) { 1623 console.info('test_fileio_create_dir_sync_045 has failed for : ' + error); 1624 expect(false).assertTrue(); 1625 } 1626 console.info("--------end test_fileio_create_dir_sync_045--------"); 1627 }); 1628 1629 /** 1630 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4600 1631 * @tc.name test_fileio_create_dir_sync_046 1632 * @tc.desc Test the distributed file mkdirSync interface with mode=0o447 1633 * @tc.level 3 1634 */ 1635 it('test_fileio_create_dir_sync_046', 3, async function (done) { 1636 console.info("--------start test_fileio_create_dir_sync_046--------"); 1637 let tcNumber = 'test_fileio_create_dir_sync_046'; 1638 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1639 1640 try { 1641 fileio.mkdirSync(dpath, 0o447); 1642 let dir = fileio.opendirSync(dpath); 1643 expect(dir !== null).assertTrue(); 1644 console.info('------ client mkdirSync success.'); 1645 1646 console.info('------ start check server... '); 1647 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1648 console.info("test_fileio_create_dir_sync_046 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1649 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1650 }); 1651 dir.closeSync(); 1652 fileio.rmdirSync(dpath); 1653 } catch (error) { 1654 console.info('test_fileio_create_dir_sync_046 has failed for : ' + error); 1655 expect(false).assertTrue(); 1656 } 1657 console.info("--------end test_fileio_create_dir_sync_046--------"); 1658 }); 1659 1660 /** 1661 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4700 1662 * @tc.name test_fileio_create_dir_sync_047 1663 * @tc.desc Test the distributed file mkdirSync interface with mode=0o437 1664 * @tc.level 3 1665 */ 1666 it('test_fileio_create_dir_sync_047', 3, async function (done) { 1667 console.info("--------start test_fileio_create_dir_sync_047--------"); 1668 let tcNumber = 'test_fileio_create_dir_sync_047'; 1669 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1670 1671 try { 1672 fileio.mkdirSync(dpath, 0o437); 1673 let dir = fileio.opendirSync(dpath); 1674 expect(dir !== null).assertTrue(); 1675 console.info('------ client mkdirSync success.'); 1676 1677 console.info('------ start check server... '); 1678 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1679 console.info("test_fileio_create_dir_sync_047 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1680 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1681 }); 1682 dir.closeSync(); 1683 fileio.rmdirSync(dpath); 1684 } catch (error) { 1685 console.info('test_fileio_create_dir_sync_047 has failed for : ' + error); 1686 expect(false).assertTrue(); 1687 } 1688 console.info("--------end test_fileio_create_dir_sync_047--------"); 1689 }); 1690 1691 /** 1692 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4800 1693 * @tc.name test_fileio_create_dir_sync_048 1694 * @tc.desc Test the distributed file mkdirSync interface with mode=0o421 1695 * @tc.level 3 1696 */ 1697 it('test_fileio_create_dir_sync_048', 3, async function (done) { 1698 console.info("--------start test_fileio_create_dir_sync_048--------"); 1699 let tcNumber = 'test_fileio_create_dir_sync_048'; 1700 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1701 1702 try { 1703 fileio.mkdirSync(dpath, 0o421); 1704 let dir = fileio.opendirSync(dpath); 1705 expect(dir !== null).assertTrue(); 1706 console.info('------ client mkdirSync success.'); 1707 1708 console.info('------ start check server... '); 1709 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1710 console.info("test_fileio_create_dir_sync_048 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1711 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1712 }); 1713 dir.closeSync(); 1714 fileio.rmdirSync(dpath); 1715 } catch (error) { 1716 console.info('test_fileio_create_dir_sync_048 has failed for : ' + error); 1717 expect(false).assertTrue(); 1718 } 1719 console.info("--------end test_fileio_create_dir_sync_048--------"); 1720 }); 1721 1722 /** 1723 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_4900 1724 * @tc.name test_fileio_create_dir_sync_049 1725 * @tc.desc Test the distributed file mkdirSync interface with mode=0o412 1726 * @tc.level 3 1727 */ 1728 it('test_fileio_create_dir_sync_049', 3, async function (done) { 1729 console.info("--------start test_fileio_create_dir_sync_049--------"); 1730 let tcNumber = 'test_fileio_create_dir_sync_049'; 1731 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1732 1733 try { 1734 fileio.mkdirSync(dpath, 0o412); 1735 let dir = fileio.opendirSync(dpath); 1736 expect(dir !== null).assertTrue(); 1737 console.info('------ client mkdirSync success.'); 1738 1739 console.info('------ start check server... '); 1740 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1741 console.info("test_fileio_create_dir_sync_049 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1742 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1743 }); 1744 dir.closeSync(); 1745 fileio.rmdirSync(dpath); 1746 } catch (error) { 1747 console.info('test_fileio_create_dir_sync_049 has failed for : ' + error); 1748 expect(false).assertTrue(); 1749 } 1750 console.info("--------end test_fileio_create_dir_sync_049--------"); 1751 }); 1752 1753 /** 1754 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5000 1755 * @tc.name test_fileio_create_dir_sync_050 1756 * @tc.desc Test the distributed file mkdirSync interface with mode=0o373 1757 * @tc.level 3 1758 */ 1759 it('test_fileio_create_dir_sync_050', 3, async function (done) { 1760 console.info("--------start test_fileio_create_dir_sync_050--------"); 1761 let tcNumber = 'test_fileio_create_dir_sync_050'; 1762 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1763 1764 try { 1765 fileio.mkdirSync(dpath, 0o373); 1766 let dir = fileio.opendirSync(dpath); 1767 expect(dir !== null).assertTrue(); 1768 console.info('------ client mkdirSync success.'); 1769 1770 console.info('------ start check server... '); 1771 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1772 console.info("test_fileio_create_dir_sync_050 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1773 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1774 }); 1775 dir.closeSync(); 1776 fileio.rmdirSync(dpath); 1777 } catch (error) { 1778 console.info('test_fileio_create_dir_sync_050 has failed for : ' + error); 1779 expect(false).assertTrue(); 1780 } 1781 console.info("--------end test_fileio_create_dir_sync_050--------"); 1782 }); 1783 1784 /** 1785 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5100 1786 * @tc.name test_fileio_create_dir_sync_051 1787 * @tc.desc Test the distributed file mkdirSync interface with mode=0o362 1788 * @tc.level 3 1789 */ 1790 it('test_fileio_create_dir_sync_051', 3, async function (done) { 1791 console.info("--------start test_fileio_create_dir_sync_051--------"); 1792 let tcNumber = 'test_fileio_create_dir_sync_051'; 1793 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1794 1795 try { 1796 fileio.mkdirSync(dpath, 0o362); 1797 let dir = fileio.opendirSync(dpath); 1798 expect(dir !== null).assertTrue(); 1799 console.info('------ client mkdirSync success.'); 1800 1801 console.info('------ start check server... '); 1802 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1803 console.info("test_fileio_create_dir_sync_051 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1804 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1805 }); 1806 dir.closeSync(); 1807 fileio.rmdirSync(dpath); 1808 } catch (error) { 1809 console.info('test_fileio_create_dir_sync_051 has failed for : ' + error); 1810 expect(false).assertTrue(); 1811 } 1812 console.info("--------end test_fileio_create_dir_sync_051--------"); 1813 }); 1814 1815 /** 1816 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5200 1817 * @tc.name test_fileio_create_dir_sync_052 1818 * @tc.desc Test the distributed file mkdirSync interface with mode=0o351 1819 * @tc.level 3 1820 */ 1821 it('test_fileio_create_dir_sync_052', 3, async function (done) { 1822 console.info("--------start test_fileio_create_dir_sync_052--------"); 1823 let tcNumber = 'test_fileio_create_dir_sync_052'; 1824 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1825 1826 try { 1827 fileio.mkdirSync(dpath, 0o351); 1828 let dir = fileio.opendirSync(dpath); 1829 expect(dir !== null).assertTrue(); 1830 console.info('------ client mkdirSync success.'); 1831 1832 console.info('------ start check server... '); 1833 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1834 console.info("test_fileio_create_dir_sync_052 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1835 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1836 }); 1837 dir.closeSync(); 1838 fileio.rmdirSync(dpath); 1839 } catch (error) { 1840 console.info('test_fileio_create_dir_sync_052 has failed for : ' + error); 1841 expect(false).assertTrue(); 1842 } 1843 console.info("--------end test_fileio_create_dir_sync_052--------"); 1844 }); 1845 1846 /** 1847 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5300 1848 * @tc.name test_fileio_create_dir_sync_053 1849 * @tc.desc Test the distributed file mkdirSync interface with mode=0o347 1850 * @tc.level 3 1851 */ 1852 it('test_fileio_create_dir_sync_053', 3, async function (done) { 1853 console.info("--------start test_fileio_create_dir_sync_053--------"); 1854 let tcNumber = 'test_fileio_create_dir_sync_053'; 1855 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1856 1857 try { 1858 fileio.mkdirSync(dpath, 0o347); 1859 let dir = fileio.opendirSync(dpath); 1860 expect(dir !== null).assertTrue(); 1861 console.info('------ client mkdirSync success.'); 1862 1863 console.info('------ start check server... '); 1864 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1865 console.info("test_fileio_create_dir_sync_053 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1866 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1867 }); 1868 dir.closeSync(); 1869 fileio.rmdirSync(dpath); 1870 } catch (error) { 1871 console.info('test_fileio_create_dir_sync_053 has failed for : ' + error); 1872 expect(false).assertTrue(); 1873 } 1874 console.info("--------end test_fileio_create_dir_sync_053--------"); 1875 }); 1876 1877 /** 1878 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5400 1879 * @tc.name test_fileio_create_dir_sync_054 1880 * @tc.desc Test the distributed file mkdirSync interface with mode=0o336 1881 * @tc.level 3 1882 */ 1883 it('test_fileio_create_dir_sync_054', 3, async function (done) { 1884 console.info("--------start test_fileio_create_dir_sync_054--------"); 1885 let tcNumber = 'test_fileio_create_dir_sync_054'; 1886 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1887 1888 try { 1889 fileio.mkdirSync(dpath, 0o336); 1890 let dir = fileio.opendirSync(dpath); 1891 expect(dir !== null).assertTrue(); 1892 console.info('------ client mkdirSync success.'); 1893 1894 console.info('------ start check server... '); 1895 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1896 console.info("test_fileio_create_dir_sync_054 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1897 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1898 }); 1899 dir.closeSync(); 1900 fileio.rmdirSync(dpath); 1901 } catch (error) { 1902 console.info('test_fileio_create_dir_sync_054 has failed for : ' + error); 1903 expect(false).assertTrue(); 1904 } 1905 console.info("--------end test_fileio_create_dir_sync_054--------"); 1906 }); 1907 1908 /** 1909 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5500 1910 * @tc.name test_fileio_create_dir_sync_055 1911 * @tc.desc Test the distributed file mkdirSync interface with mode=0o325 1912 * @tc.level 3 1913 */ 1914 it('test_fileio_create_dir_sync_055', 3, async function (done) { 1915 console.info("--------start test_fileio_create_dir_sync_055--------"); 1916 let tcNumber = 'test_fileio_create_dir_sync_055'; 1917 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1918 1919 try { 1920 fileio.mkdirSync(dpath, 0o325); 1921 let dir = fileio.opendirSync(dpath); 1922 expect(dir !== null).assertTrue(); 1923 console.info('------ client mkdirSync success.'); 1924 1925 console.info('------ start check server... '); 1926 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1927 console.info("test_fileio_create_dir_sync_055 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1928 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1929 }); 1930 dir.closeSync(); 1931 fileio.rmdirSync(dpath); 1932 } catch (error) { 1933 console.info('test_fileio_create_dir_sync_055 has failed for : ' + error); 1934 expect(false).assertTrue(); 1935 } 1936 console.info("--------end test_fileio_create_dir_sync_055--------"); 1937 }); 1938 1939 /** 1940 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5600 1941 * @tc.name test_fileio_create_dir_sync_056 1942 * @tc.desc Test the distributed file mkdirSync interface with mode=0o314 1943 * @tc.level 3 1944 */ 1945 it('test_fileio_create_dir_sync_056', 3, async function (done) { 1946 console.info("--------start test_fileio_create_dir_sync_056--------"); 1947 let tcNumber = 'test_fileio_create_dir_sync_056'; 1948 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1949 1950 try { 1951 fileio.mkdirSync(dpath, 0o314); 1952 let dir = fileio.opendirSync(dpath); 1953 expect(dir !== null).assertTrue(); 1954 console.info('------ client mkdirSync success.'); 1955 1956 console.info('------ start check server... '); 1957 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1958 console.info("test_fileio_create_dir_sync_056 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1959 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1960 }); 1961 dir.closeSync(); 1962 fileio.rmdirSync(dpath); 1963 } catch (error) { 1964 console.info('test_fileio_create_dir_sync_056 has failed for : ' + error); 1965 expect(false).assertTrue(); 1966 } 1967 console.info("--------end test_fileio_create_dir_sync_056--------"); 1968 }); 1969 1970 /** 1971 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5700 1972 * @tc.name test_fileio_create_dir_sync_057 1973 * @tc.desc Test the distributed file mkdirSync interface with mode=0o272 1974 * @tc.level 3 1975 */ 1976 it('test_fileio_create_dir_sync_057', 3, async function (done) { 1977 console.info("--------start test_fileio_create_dir_sync_057--------"); 1978 let tcNumber = 'test_fileio_create_dir_sync_057'; 1979 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 1980 1981 try { 1982 fileio.mkdirSync(dpath, 0o272); 1983 let dir = fileio.opendirSync(dpath); 1984 expect(dir !== null).assertTrue(); 1985 console.info('------ client mkdirSync success.'); 1986 1987 console.info('------ start check server... '); 1988 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 1989 console.info("test_fileio_create_dir_sync_057 : getServerFileInfo serverDirCreate: " + serverDirCreate); 1990 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 1991 }); 1992 dir.closeSync(); 1993 fileio.rmdirSync(dpath); 1994 } catch (error) { 1995 console.info('test_fileio_create_dir_sync_057 has failed for : ' + error); 1996 expect(false).assertTrue(); 1997 } 1998 console.info("--------end test_fileio_create_dir_sync_057--------"); 1999 }); 2000 2001 /** 2002 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5800 2003 * @tc.name test_fileio_create_dir_sync_058 2004 * @tc.desc Test the distributed file mkdirSync interface with mode=0o263 2005 * @tc.level 3 2006 */ 2007 it('test_fileio_create_dir_sync_058', 3, async function (done) { 2008 console.info("--------start test_fileio_create_dir_sync_058--------"); 2009 let tcNumber = 'test_fileio_create_dir_sync_058'; 2010 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2011 2012 try { 2013 fileio.mkdirSync(dpath, 0o263); 2014 let dir = fileio.opendirSync(dpath); 2015 expect(dir !== null).assertTrue(); 2016 console.info('------ client mkdirSync success.'); 2017 2018 console.info('------ start check server... '); 2019 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2020 console.info("test_fileio_create_dir_sync_058 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2021 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2022 }); 2023 dir.closeSync(); 2024 fileio.rmdirSync(dpath); 2025 } catch (error) { 2026 console.info('test_fileio_create_dir_sync_058 has failed for : ' + error); 2027 expect(false).assertTrue(); 2028 } 2029 console.info("--------end test_fileio_create_dir_sync_058--------"); 2030 }); 2031 2032 /** 2033 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_5900 2034 * @tc.name test_fileio_create_dir_sync_059 2035 * @tc.desc Test the distributed file mkdirSync interface with mode=0o257 2036 * @tc.level 3 2037 */ 2038 it('test_fileio_create_dir_sync_059', 3, async function (done) { 2039 console.info("--------start test_fileio_create_dir_sync_059--------"); 2040 let tcNumber = 'test_fileio_create_dir_sync_059'; 2041 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2042 2043 try { 2044 fileio.mkdirSync(dpath, 0o257); 2045 let dir = fileio.opendirSync(dpath); 2046 expect(dir !== null).assertTrue(); 2047 console.info('------ client mkdirSync success.'); 2048 2049 console.info('------ start check server... '); 2050 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2051 console.info("test_fileio_create_dir_sync_059 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2052 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2053 }); 2054 dir.closeSync(); 2055 fileio.rmdirSync(dpath); 2056 } catch (error) { 2057 console.info('test_fileio_create_dir_sync_059 has failed for : ' + error); 2058 expect(false).assertTrue(); 2059 } 2060 console.info("--------end test_fileio_create_dir_sync_059--------"); 2061 }); 2062 2063 /** 2064 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6000 2065 * @tc.name test_fileio_create_dir_sync_060 2066 * @tc.desc Test the distributed file mkdirSync interface with mode=0o241 2067 * @tc.level 3 2068 */ 2069 it('test_fileio_create_dir_sync_060', 3, async function (done) { 2070 console.info("--------start test_fileio_create_dir_sync_060--------"); 2071 let tcNumber = 'test_fileio_create_dir_sync_060'; 2072 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2073 2074 try { 2075 fileio.mkdirSync(dpath, 0o241); 2076 let dir = fileio.opendirSync(dpath); 2077 expect(dir !== null).assertTrue(); 2078 console.info('------ client mkdirSync success.'); 2079 2080 console.info('------ start check server... '); 2081 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2082 console.info("test_fileio_create_dir_sync_060 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2083 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2084 }); 2085 dir.closeSync(); 2086 fileio.rmdirSync(dpath); 2087 } catch (error) { 2088 console.info('test_fileio_create_dir_sync_060 has failed for : ' + error); 2089 expect(false).assertTrue(); 2090 } 2091 console.info("--------end test_fileio_create_dir_sync_060--------"); 2092 }); 2093 2094 /** 2095 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6100 2096 * @tc.name test_fileio_create_dir_sync_061 2097 * @tc.desc Test the distributed file mkdirSync interface with mode=0o235 2098 * @tc.level 3 2099 */ 2100 it('test_fileio_create_dir_sync_061', 3, async function (done) { 2101 console.info("--------start test_fileio_create_dir_sync_061--------"); 2102 let tcNumber = 'test_fileio_create_dir_sync_061'; 2103 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2104 2105 try { 2106 fileio.mkdirSync(dpath, 0o235); 2107 let dir = fileio.opendirSync(dpath); 2108 expect(dir !== null).assertTrue(); 2109 console.info('------ client mkdirSync success.'); 2110 2111 console.info('------ start check server... '); 2112 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2113 console.info("test_fileio_create_dir_sync_061 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2114 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2115 }); 2116 dir.closeSync(); 2117 fileio.rmdirSync(dpath); 2118 } catch (error) { 2119 console.info('test_fileio_create_dir_sync_061 has failed for : ' + error); 2120 expect(false).assertTrue(); 2121 } 2122 console.info("--------end test_fileio_create_dir_sync_061--------"); 2123 }); 2124 2125 /** 2126 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6200 2127 * @tc.name test_fileio_create_dir_sync_062 2128 * @tc.desc Test the distributed file mkdirSync interface with mode=0o226 2129 * @tc.level 3 2130 */ 2131 it('test_fileio_create_dir_sync_062', 3, async function (done) { 2132 console.info("--------start test_fileio_create_dir_sync_062--------"); 2133 let tcNumber = 'test_fileio_create_dir_sync_062'; 2134 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2135 2136 try { 2137 fileio.mkdirSync(dpath, 0o226); 2138 let dir = fileio.opendirSync(dpath); 2139 expect(dir !== null).assertTrue(); 2140 console.info('------ client mkdirSync success.'); 2141 2142 console.info('------ start check server... '); 2143 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2144 console.info("test_fileio_create_dir_sync_062 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2145 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2146 }); 2147 dir.closeSync(); 2148 fileio.rmdirSync(dpath); 2149 } catch (error) { 2150 console.info('test_fileio_create_dir_sync_062 has failed for : ' + error); 2151 expect(false).assertTrue(); 2152 } 2153 console.info("--------end test_fileio_create_dir_sync_062--------"); 2154 }); 2155 2156 /** 2157 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6300 2158 * @tc.name test_fileio_create_dir_sync_063 2159 * @tc.desc Test the distributed file mkdirSync interface with mode=0o216 2160 * @tc.level 3 2161 */ 2162 it('test_fileio_create_dir_sync_063', 3, async function (done) { 2163 console.info("--------start test_fileio_create_dir_sync_063--------"); 2164 let tcNumber = 'test_fileio_create_dir_sync_063'; 2165 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2166 2167 try { 2168 fileio.mkdirSync(dpath, 0o216); 2169 let dir = fileio.opendirSync(dpath); 2170 expect(dir !== null).assertTrue(); 2171 console.info('------ client mkdirSync success.'); 2172 2173 console.info('------ start check server... '); 2174 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2175 console.info("test_fileio_create_dir_sync_063 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2176 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2177 }); 2178 dir.closeSync(); 2179 fileio.rmdirSync(dpath); 2180 } catch (error) { 2181 console.info('test_fileio_create_dir_sync_063 has failed for : ' + error); 2182 expect(false).assertTrue(); 2183 } 2184 console.info("--------end test_fileio_create_dir_sync_063--------"); 2185 }); 2186 2187 /** 2188 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6400 2189 * @tc.name test_fileio_create_dir_sync_064 2190 * @tc.desc Test the distributed file mkdirSync interface with mode=0o171 2191 * @tc.level 3 2192 */ 2193 it('test_fileio_create_dir_sync_064', 3, async function (done) { 2194 console.info("--------start test_fileio_create_dir_sync_064--------"); 2195 let tcNumber = 'test_fileio_create_dir_sync_064'; 2196 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2197 2198 try { 2199 fileio.mkdirSync(dpath, 0o171); 2200 let dir = fileio.opendirSync(dpath); 2201 expect(dir !== null).assertTrue(); 2202 console.info('------ client mkdirSync success.'); 2203 2204 console.info('------ start check server... '); 2205 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2206 console.info("test_fileio_create_dir_sync_064 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2207 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2208 }); 2209 dir.closeSync(); 2210 fileio.rmdirSync(dpath); 2211 } catch (error) { 2212 console.info('test_fileio_create_dir_sync_064 has failed for : ' + error); 2213 expect(false).assertTrue(); 2214 } 2215 console.info("--------end test_fileio_create_dir_sync_064--------"); 2216 }); 2217 2218 /** 2219 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6500 2220 * @tc.name test_fileio_create_dir_sync_065 2221 * @tc.desc Test the distributed file mkdirSync interface with mode=0o167 2222 * @tc.level 3 2223 */ 2224 it('test_fileio_create_dir_sync_065', 3, async function (done) { 2225 console.info("--------start test_fileio_create_dir_sync_065--------"); 2226 let tcNumber = 'test_fileio_create_dir_sync_065'; 2227 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2228 2229 try { 2230 fileio.mkdirSync(dpath, 0o167); 2231 let dir = fileio.opendirSync(dpath); 2232 expect(dir !== null).assertTrue(); 2233 console.info('------ client mkdirSync success.'); 2234 2235 console.info('------ start check server... '); 2236 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2237 console.info("test_fileio_create_dir_sync_065 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2238 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2239 }); 2240 dir.closeSync(); 2241 fileio.rmdirSync(dpath); 2242 } catch (error) { 2243 console.info('test_fileio_create_dir_sync_065 has failed for : ' + error); 2244 expect(false).assertTrue(); 2245 } 2246 console.info("--------end test_fileio_create_dir_sync_065--------"); 2247 }); 2248 2249 /** 2250 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6600 2251 * @tc.name test_fileio_create_dir_sync_066 2252 * @tc.desc Test the distributed file mkdirSync interface with mode=0o153 2253 * @tc.level 3 2254 */ 2255 it('test_fileio_create_dir_sync_066', 3, async function (done) { 2256 console.info("--------start test_fileio_create_dir_sync_066--------"); 2257 let tcNumber = 'test_fileio_create_dir_sync_066'; 2258 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2259 2260 try { 2261 fileio.mkdirSync(dpath, 0o153); 2262 let dir = fileio.opendirSync(dpath); 2263 expect(dir !== null).assertTrue(); 2264 console.info('------ client mkdirSync success.'); 2265 2266 console.info('------ start check server... '); 2267 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2268 console.info("test_fileio_create_dir_sync_066 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2269 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2270 }); 2271 dir.closeSync(); 2272 fileio.rmdirSync(dpath); 2273 } catch (error) { 2274 console.info('test_fileio_create_dir_sync_066 has failed for : ' + error); 2275 expect(false).assertTrue(); 2276 } 2277 console.info("--------end test_fileio_create_dir_sync_066--------"); 2278 }); 2279 2280 /** 2281 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6700 2282 * @tc.name test_fileio_create_dir_sync_067 2283 * @tc.desc Test the distributed file mkdirSync interface with mode=0o142 2284 * @tc.level 3 2285 */ 2286 it('test_fileio_create_dir_sync_067', 3, async function (done) { 2287 console.info("--------start test_fileio_create_dir_sync_067--------"); 2288 let tcNumber = 'test_fileio_create_dir_sync_067'; 2289 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2290 2291 try { 2292 fileio.mkdirSync(dpath, 0o142); 2293 let dir = fileio.opendirSync(dpath); 2294 expect(dir !== null).assertTrue(); 2295 console.info('------ client mkdirSync success.'); 2296 2297 console.info('------ start check server... '); 2298 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2299 console.info("test_fileio_create_dir_sync_067 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2300 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2301 }); 2302 dir.closeSync(); 2303 fileio.rmdirSync(dpath); 2304 } catch (error) { 2305 console.info('test_fileio_create_dir_sync_067 has failed for : ' + error); 2306 expect(false).assertTrue(); 2307 } 2308 console.info("--------end test_fileio_create_dir_sync_067--------"); 2309 }); 2310 2311 /** 2312 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6800 2313 * @tc.name test_fileio_create_dir_sync_068 2314 * @tc.desc Test the distributed file mkdirSync interface with mode=0o134 2315 * @tc.level 3 2316 */ 2317 it('test_fileio_create_dir_sync_068', 3, async function (done) { 2318 console.info("--------start test_fileio_create_dir_sync_068--------"); 2319 let tcNumber = 'test_fileio_create_dir_sync_068'; 2320 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2321 2322 try { 2323 fileio.mkdirSync(dpath, 0o134); 2324 let dir = fileio.opendirSync(dpath); 2325 expect(dir !== null).assertTrue(); 2326 console.info('------ client mkdirSync success.'); 2327 2328 console.info('------ start check server... '); 2329 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2330 console.info("test_fileio_create_dir_sync_068 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2331 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2332 }); 2333 dir.closeSync(); 2334 fileio.rmdirSync(dpath); 2335 } catch (error) { 2336 console.info('test_fileio_create_dir_sync_068 has failed for : ' + error); 2337 expect(false).assertTrue(); 2338 } 2339 console.info("--------end test_fileio_create_dir_sync_068--------"); 2340 }); 2341 2342 /** 2343 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_6900 2344 * @tc.name test_fileio_create_dir_sync_069 2345 * @tc.desc Test the distributed file mkdirSync interface with mode=0o126 2346 * @tc.level 3 2347 */ 2348 it('test_fileio_create_dir_sync_069', 3, async function (done) { 2349 console.info("--------start test_fileio_create_dir_sync_069--------"); 2350 let tcNumber = 'test_fileio_create_dir_sync_069'; 2351 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2352 2353 try { 2354 fileio.mkdirSync(dpath, 0o126); 2355 let dir = fileio.opendirSync(dpath); 2356 expect(dir !== null).assertTrue(); 2357 console.info('------ client mkdirSync success.'); 2358 2359 console.info('------ start check server... '); 2360 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2361 console.info("test_fileio_create_dir_sync_069 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2362 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2363 }); 2364 dir.closeSync(); 2365 fileio.rmdirSync(dpath); 2366 } catch (error) { 2367 console.info('test_fileio_create_dir_sync_069 has failed for : ' + error); 2368 expect(false).assertTrue(); 2369 } 2370 console.info("--------end test_fileio_create_dir_sync_069--------"); 2371 }); 2372 2373 /** 2374 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_7000 2375 * @tc.name test_fileio_create_dir_sync_070 2376 * @tc.desc Test the distributed file mkdirSync interface with mode=0o115 2377 * @tc.level 3 2378 */ 2379 it('test_fileio_create_dir_sync_070', 3, async function (done) { 2380 console.info("--------start test_fileio_create_dir_sync_070--------"); 2381 let tcNumber = 'test_fileio_create_dir_sync_070'; 2382 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2383 2384 try { 2385 fileio.mkdirSync(dpath, 0o115); 2386 let dir = fileio.opendirSync(dpath); 2387 expect(dir !== null).assertTrue(); 2388 console.info('------ client mkdirSync success.'); 2389 2390 console.info('------ start check server... '); 2391 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2392 console.info("test_fileio_create_dir_sync_070 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2393 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2394 }); 2395 dir.closeSync(); 2396 fileio.rmdirSync(dpath); 2397 } catch (error) { 2398 console.info('test_fileio_create_dir_sync_070 has failed for : ' + error); 2399 expect(false).assertTrue(); 2400 } 2401 console.info("--------end test_fileio_create_dir_sync_070--------"); 2402 }); 2403 2404 /** 2405 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_7100 2406 * @tc.name test_fileio_create_dir_sync_071 2407 * @tc.desc Test the distributed file mkdirSync interface with mode=0o661 2408 * @tc.level 3 2409 */ 2410 it('test_fileio_create_dir_sync_071', 3, async function (done) { 2411 console.info("--------start test_fileio_create_dir_sync_071--------"); 2412 let tcNumber = 'test_fileio_create_dir_sync_071'; 2413 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2414 2415 try { 2416 fileio.mkdirSync(dpath, 0o661); 2417 let dir = fileio.opendirSync(dpath); 2418 expect(dir !== null).assertTrue(); 2419 console.info('------ client mkdirSync success.'); 2420 2421 console.info('------ start check server... '); 2422 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2423 console.info("test_fileio_create_dir_sync_071 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2424 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2425 }); 2426 dir.closeSync(); 2427 fileio.rmdirSync(dpath); 2428 } catch (error) { 2429 console.info('test_fileio_create_dir_sync_071 has failed for : ' + error); 2430 expect(false).assertTrue(); 2431 } 2432 console.info("--------end test_fileio_create_dir_sync_071--------"); 2433 }); 2434 2435 /** 2436 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_7200 2437 * @tc.name test_fileio_create_dir_sync_072 2438 * @tc.desc Test the distributed file mkdirSync interface with mode=0o552 2439 * @tc.level 3 2440 */ 2441 it('test_fileio_create_dir_sync_072', 3, async function (done) { 2442 console.info("--------start test_fileio_create_dir_sync_072--------"); 2443 let tcNumber = 'test_fileio_create_dir_sync_072'; 2444 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2445 2446 try { 2447 fileio.mkdirSync(dpath, 0o552); 2448 let dir = fileio.opendirSync(dpath); 2449 expect(dir !== null).assertTrue(); 2450 console.info('------ client mkdirSync success.'); 2451 2452 console.info('------ start check server... '); 2453 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2454 console.info("test_fileio_create_dir_sync_072 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2455 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2456 }); 2457 dir.closeSync(); 2458 fileio.rmdirSync(dpath); 2459 } catch (error) { 2460 console.info('test_fileio_create_dir_sync_072 has failed for : ' + error); 2461 expect(false).assertTrue(); 2462 } 2463 console.info("--------end test_fileio_create_dir_sync_072--------"); 2464 }); 2465 2466 /** 2467 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_7300 2468 * @tc.name test_fileio_create_dir_sync_073 2469 * @tc.desc Test the distributed file mkdirSync interface with mode=0o443 2470 * @tc.level 3 2471 */ 2472 it('test_fileio_create_dir_sync_073', 3, async function (done) { 2473 console.info("--------start test_fileio_create_dir_sync_073--------"); 2474 let tcNumber = 'test_fileio_create_dir_sync_073'; 2475 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2476 2477 try { 2478 fileio.mkdirSync(dpath, 0o443); 2479 let dir = fileio.opendirSync(dpath); 2480 expect(dir !== null).assertTrue(); 2481 console.info('------ client mkdirSync success.'); 2482 2483 console.info('------ start check server... '); 2484 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2485 console.info("test_fileio_create_dir_sync_073 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2486 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2487 }); 2488 dir.closeSync(); 2489 fileio.rmdirSync(dpath); 2490 } catch (error) { 2491 console.info('test_fileio_create_dir_sync_073 has failed for : ' + error); 2492 expect(false).assertTrue(); 2493 } 2494 console.info("--------end test_fileio_create_dir_sync_073--------"); 2495 }); 2496 2497 /** 2498 * @tc.number SUB_STORAGE_Distributed_FileIO_mkdirSync_7400 2499 * @tc.name test_fileio_create_dir_sync_074 2500 * @tc.desc Test the distributed file mkdirSync interface with mode=0o224 2501 * @tc.level 3 2502 */ 2503 it('test_fileio_create_dir_sync_074', 3, async function (done) { 2504 console.info("--------start test_fileio_create_dir_sync_074--------"); 2505 let tcNumber = 'test_fileio_create_dir_sync_074'; 2506 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2507 2508 try { 2509 fileio.mkdirSync(dpath, 0o224); 2510 let dir = fileio.opendirSync(dpath); 2511 expect(dir !== null).assertTrue(); 2512 console.info('------ client mkdirSync success.'); 2513 2514 console.info('------ start check server... '); 2515 await getServerFileInfo(tcNumber, dpath, CODE_MK_DIR, done, function (serverDirCreate) { 2516 console.info("test_fileio_create_dir_sync_074 : getServerFileInfo serverDirCreate: " + serverDirCreate); 2517 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2518 }); 2519 dir.closeSync(); 2520 fileio.rmdirSync(dpath); 2521 } catch (error) { 2522 console.info('test_fileio_create_dir_sync_074 has failed for : ' + error); 2523 expect(false).assertTrue(); 2524 } 2525 console.info("--------end test_fileio_create_dir_sync_074--------"); 2526 }); 2527 2528 /** 2529 * @tc.number SUB_STORAGE_Distributed_FileIO_rmdirSync_0000 2530 * @tc.name test_fileio_delete_dir_sync_000 2531 * @tc.desc Function of API, test the rmdirSync() interface. 2532 * @tc.level 0 2533 */ 2534 it('test_fileio_delete_dir_sync_000', 0, async function (done) { 2535 console.info("--------start test_fileio_delete_dir_sync_000--------"); 2536 let tcNumber = 'test_fileio_delete_dir_sync_000'; 2537 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 2538 try { 2539 fileio.mkdirSync(dpath); 2540 let dir = fileio.opendirSync(dpath); 2541 expect(dir !== null).assertTrue(); 2542 dir.closeSync(); 2543 console.info('------------- test_fileio_delete_dir_sync_000 : client mkdirSync success.'); 2544 2545 console.info('------ start check server first ... '); 2546 await getServerFileInfoFirst(tcNumber, dpath, CODE_MK_DIR, function (serverDirCreate) { 2547 console.info("test_fileio_delete_dir_sync_000 : getServerFileInfoFirst serverDirCreate: " + serverDirCreate); 2548 expect(serverDirCreate).assertEqual(SERVER_CHECK_SUCCESS); 2549 }); 2550 2551 fileio.rmdirSync(dpath); 2552 try { 2553 fileio.opendirSync(dpath); 2554 console.info('------------- test_fileio_delete_dir_sync_000 : client rmdirSync failed.'); 2555 expect(false).assertTrue(); 2556 } catch (e) { 2557 console.info('------------- test_fileio_delete_dir_sync_000 : check client rmdirSync success.'); 2558 } 2559 2560 console.info('------ start check server second ... '); 2561 await getServerFileInfo(tcNumber, dpath, CODE_RM_DIR, done, function (serverDirRemove) { 2562 console.info("test_fileio_delete_dir_sync_000 : getServerFileInfo serverDirRemove: " + serverDirRemove); 2563 expect(serverDirRemove).assertEqual(SERVER_CHECK_SUCCESS); 2564 }); 2565 } catch (error) { 2566 console.info('test_fileio_delete_dir_sync_000 has failed for : ' + error); 2567 expect(false).assertTrue(); 2568 } 2569 console.info("--------end test_fileio_delete_dir_sync_000--------"); 2570 }); 2571 2572 /** 2573 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0000 2574 * @tc.name test_fileio_create_file_sync_000 2575 * @tc.desc Function of API, flags=0o100. mode=0o777 2576 * @tc.level 0 2577 */ 2578 it('test_fileio_create_file_sync_000', 0, async function (done) { 2579 console.info("--------start test_fileio_create_file_sync_000--------"); 2580 let tcNumber = 'test_fileio_create_file_sync_000'; 2581 let fpath = await getDistributedFilePath(tcNumber); 2582 console.info('fpath == ' + fpath); 2583 try { 2584 let fd = fileio.openSync(fpath, 0o100, 0o777); 2585 console.info('------------- create file success.'); 2586 fileio.accessSync(fpath, 0); 2587 2588 console.info('------ start check server... '); 2589 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2590 console.info("test_fileio_create_file_sync_000 getServerFileInfo serverFileCreate: " + serverFileCreate); 2591 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2592 }) 2593 2594 console.info('------------ start clean test environment.'); 2595 fileio.closeSync(fd); 2596 fileio.unlinkSync(fpath); 2597 } catch (e) { 2598 console.info('test_fileio_create_file_sync_000 has failed for : ' + e); 2599 expect(false).assertTrue(); 2600 } 2601 console.info("--------end test_fileio_create_file_sync_000--------"); 2602 }); 2603 2604 /** 2605 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0100 2606 * @tc.name test_fileio_create_file_sync_001 2607 * @tc.desc Function of API, flags=0o101. mode=0o777 2608 * @tc.level 0 2609 */ 2610 it('test_fileio_create_file_sync_001', 0, async function (done) { 2611 console.info("--------start test_fileio_create_file_sync_001--------"); 2612 let tcNumber = 'test_fileio_create_file_sync_001'; 2613 let fpath = await getDistributedFilePath(tcNumber); 2614 console.info('fpath == ' + fpath); 2615 try { 2616 let fd = fileio.openSync(fpath, 0o101, 0o777); 2617 console.info('------------- create file success.'); 2618 fileio.accessSync(fpath, 0); 2619 2620 console.info('------ start check server... '); 2621 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2622 console.info("test_fileio_create_file_sync_001 getServerFileInfo serverFileCreate: " + serverFileCreate); 2623 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2624 }) 2625 2626 console.info('------------ start clean test environment.'); 2627 fileio.closeSync(fd); 2628 fileio.unlinkSync(fpath); 2629 } catch (e) { 2630 console.info('test_fileio_create_file_sync_001 has failed for : ' + e); 2631 expect(false).assertTrue(); 2632 } 2633 console.info("--------end test_fileio_create_file_sync_001--------"); 2634 }); 2635 2636 /** 2637 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0200 2638 * @tc.name test_fileio_create_file_sync_002 2639 * @tc.desc Function of API, flags=0o102. mode=0o777 2640 * @tc.level 0 2641 */ 2642 it('test_fileio_create_file_sync_002', 0, async function (done) { 2643 console.info("--------start test_fileio_create_file_sync_002--------"); 2644 let tcNumber = 'test_fileio_create_file_sync_002'; 2645 let fpath = await getDistributedFilePath(tcNumber); 2646 console.info('fpath == ' + fpath); 2647 try { 2648 let fd = fileio.openSync(fpath, 0o102, 0o777); 2649 console.info('------------- create file success.'); 2650 fileio.accessSync(fpath, 0); 2651 2652 console.info('------ start check server... '); 2653 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2654 console.info("test_fileio_create_file_sync_002 getServerFileInfo serverFileCreate: " + serverFileCreate); 2655 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2656 }) 2657 2658 console.info('------------ start clean test environment.'); 2659 fileio.closeSync(fd); 2660 fileio.unlinkSync(fpath); 2661 } catch (e) { 2662 console.info('test_fileio_create_file_sync_002 has failed for : ' + e); 2663 expect(false).assertTrue(); 2664 } 2665 console.info("--------end test_fileio_create_file_sync_002--------"); 2666 }); 2667 2668 /** 2669 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0300 2670 * @tc.name test_fileio_create_file_sync_003 2671 * @tc.desc Function of API, flags=0o100. mode=0o744 2672 * @tc.level 3 2673 */ 2674 it('test_fileio_create_file_sync_003', 0, async function (done) { 2675 console.info("--------start test_fileio_create_file_sync_003--------"); 2676 let tcNumber = 'test_fileio_create_file_sync_003'; 2677 let fpath = await getDistributedFilePath(tcNumber); 2678 console.info('fpath == ' + fpath); 2679 try { 2680 let fd = fileio.openSync(fpath, 0o100, 0o744); 2681 console.info('------------- create file success.'); 2682 fileio.accessSync(fpath, 0); 2683 2684 console.info('------ start check server... '); 2685 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2686 console.info("test_fileio_create_file_sync_003 getServerFileInfo serverFileCreate: " + serverFileCreate); 2687 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2688 }) 2689 2690 console.info('------------ start clean test environment.'); 2691 fileio.closeSync(fd); 2692 fileio.unlinkSync(fpath); 2693 } catch (e) { 2694 console.info('test_fileio_create_file_sync_003 has failed for : ' + e); 2695 expect(false).assertTrue(); 2696 } 2697 console.info("--------end test_fileio_create_file_sync_003--------"); 2698 }); 2699 2700 /** 2701 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0400 2702 * @tc.name test_fileio_create_file_sync_004 2703 * @tc.desc Function of API, flags=0o100. mode=0o722 2704 * @tc.level 3 2705 */ 2706 it('test_fileio_create_file_sync_004', 0, async function (done) { 2707 console.info("--------start test_fileio_create_file_sync_004--------"); 2708 let tcNumber = 'test_fileio_create_file_sync_004'; 2709 let fpath = await getDistributedFilePath(tcNumber); 2710 console.info('fpath == ' + fpath); 2711 try { 2712 let fd = fileio.openSync(fpath, 0o100, 0o722); 2713 console.info('------------- create file success.'); 2714 fileio.accessSync(fpath, 0); 2715 2716 console.info('------ start check server... '); 2717 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2718 console.info("test_fileio_create_file_sync_004 getServerFileInfo serverFileCreate: " + serverFileCreate); 2719 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2720 }) 2721 2722 console.info('------------ start clean test environment.'); 2723 fileio.closeSync(fd); 2724 fileio.unlinkSync(fpath); 2725 } catch (e) { 2726 console.info('test_fileio_create_file_sync_004 has failed for : ' + e); 2727 expect(false).assertTrue(); 2728 } 2729 console.info("--------end test_fileio_create_file_sync_004--------"); 2730 }); 2731 2732 /** 2733 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0500 2734 * @tc.name test_fileio_create_file_sync_005 2735 * @tc.desc Function of API, flags=0o100. mode=0o711 2736 * @tc.level 3 2737 */ 2738 it('test_fileio_create_file_sync_005', 0, async function (done) { 2739 console.info("--------start test_fileio_create_file_sync_005--------"); 2740 let tcNumber = 'test_fileio_create_file_sync_005'; 2741 let fpath = await getDistributedFilePath(tcNumber); 2742 console.info('fpath == ' + fpath); 2743 try { 2744 let fd = fileio.openSync(fpath, 0o100, 0o711); 2745 console.info('------------- create file success.'); 2746 fileio.accessSync(fpath, 0); 2747 2748 console.info('------ start check server... '); 2749 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2750 console.info("test_fileio_create_file_sync_005 getServerFileInfo serverFileCreate: " + serverFileCreate); 2751 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2752 }) 2753 2754 console.info('------------ start clean test environment.'); 2755 fileio.closeSync(fd); 2756 fileio.unlinkSync(fpath); 2757 } catch (e) { 2758 console.info('test_fileio_create_file_sync_005 has failed for : ' + e); 2759 expect(false).assertTrue(); 2760 } 2761 console.info("--------end test_fileio_create_file_sync_005--------"); 2762 }); 2763 2764 /** 2765 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0600 2766 * @tc.name test_fileio_create_file_sync_006 2767 * @tc.desc Function of API, flags=0o100. mode=0o474 2768 * @tc.level 3 2769 */ 2770 it('test_fileio_create_file_sync_006', 0, async function (done) { 2771 console.info("--------start test_fileio_create_file_sync_006--------"); 2772 let tcNumber = 'test_fileio_create_file_sync_006'; 2773 let fpath = await getDistributedFilePath(tcNumber); 2774 console.info('fpath == ' + fpath); 2775 try { 2776 let fd = fileio.openSync(fpath, 0o100, 0o474); 2777 console.info('------------- create file success.'); 2778 fileio.accessSync(fpath, 0); 2779 2780 console.info('------ start check server... '); 2781 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2782 console.info("test_fileio_create_file_sync_006 getServerFileInfo serverFileCreate: " + serverFileCreate); 2783 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2784 }) 2785 2786 console.info('------------ start clean test environment.'); 2787 fileio.closeSync(fd); 2788 fileio.unlinkSync(fpath); 2789 } catch (e) { 2790 console.info('test_fileio_create_file_sync_006 has failed for : ' + e); 2791 expect(false).assertTrue(); 2792 } 2793 console.info("--------end test_fileio_create_file_sync_006--------"); 2794 }); 2795 2796 /** 2797 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0700 2798 * @tc.name test_fileio_create_file_sync_007 2799 * @tc.desc Function of API, flags=0o100. mode=0o447 2800 * @tc.level 3 2801 */ 2802 it('test_fileio_create_file_sync_007', 0, async function (done) { 2803 console.info("--------start test_fileio_create_file_sync_007--------"); 2804 let tcNumber = 'test_fileio_create_file_sync_007'; 2805 let fpath = await getDistributedFilePath(tcNumber); 2806 console.info('fpath == ' + fpath); 2807 try { 2808 let fd = fileio.openSync(fpath, 0o100, 0o447); 2809 console.info('------------- create file success.'); 2810 fileio.accessSync(fpath, 0); 2811 2812 console.info('------ start check server... '); 2813 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2814 console.info("test_fileio_create_file_sync_007 getServerFileInfo serverFileCreate: " + serverFileCreate); 2815 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2816 }) 2817 2818 console.info('------------ start clean test environment.'); 2819 fileio.closeSync(fd); 2820 fileio.unlinkSync(fpath); 2821 } catch (e) { 2822 console.info('test_fileio_create_file_sync_007 has failed for : ' + e); 2823 expect(false).assertTrue(); 2824 } 2825 console.info("--------end test_fileio_create_file_sync_007--------"); 2826 }); 2827 2828 /** 2829 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0800 2830 * @tc.name test_fileio_create_file_sync_008 2831 * @tc.desc Function of API, flags=0o100. mode=0o421 2832 * @tc.level 3 2833 */ 2834 it('test_fileio_create_file_sync_008', 0, async function (done) { 2835 console.info("--------start test_fileio_create_file_sync_008--------"); 2836 let tcNumber = 'test_fileio_create_file_sync_008'; 2837 let fpath = await getDistributedFilePath(tcNumber); 2838 console.info('fpath == ' + fpath); 2839 try { 2840 let fd = fileio.openSync(fpath, 0o100, 0o421); 2841 console.info('------------- create file success.'); 2842 fileio.accessSync(fpath, 0); 2843 2844 console.info('------ start check server... '); 2845 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2846 console.info("test_fileio_create_file_sync_008 getServerFileInfo serverFileCreate: " + serverFileCreate); 2847 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2848 }) 2849 2850 console.info('------------ start clean test environment.'); 2851 fileio.closeSync(fd); 2852 fileio.unlinkSync(fpath); 2853 } catch (e) { 2854 console.info('test_fileio_create_file_sync_008 has failed for : ' + e); 2855 expect(false).assertTrue(); 2856 } 2857 console.info("--------end test_fileio_create_file_sync_008--------"); 2858 }); 2859 2860 /** 2861 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_0900 2862 * @tc.name test_fileio_create_file_sync_009 2863 * @tc.desc Function of API, flags=0o100. mode=0o412 2864 * @tc.level 3 2865 */ 2866 it('test_fileio_create_file_sync_009', 0, async function (done) { 2867 console.info("--------start test_fileio_create_file_sync_009--------"); 2868 let tcNumber = 'test_fileio_create_file_sync_009'; 2869 let fpath = await getDistributedFilePath(tcNumber); 2870 console.info('fpath == ' + fpath); 2871 try { 2872 let fd = fileio.openSync(fpath, 0o100, 0o412); 2873 console.info('------------- create file success.'); 2874 fileio.accessSync(fpath, 0); 2875 2876 console.info('------ start check server... '); 2877 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2878 console.info("test_fileio_create_file_sync_009 getServerFileInfo serverFileCreate: " + serverFileCreate); 2879 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2880 }) 2881 2882 console.info('------------ start clean test environment.'); 2883 fileio.closeSync(fd); 2884 fileio.unlinkSync(fpath); 2885 } catch (e) { 2886 console.info('test_fileio_create_file_sync_009 has failed for : ' + e); 2887 expect(false).assertTrue(); 2888 } 2889 console.info("--------end test_fileio_create_file_sync_009--------"); 2890 }); 2891 2892 /** 2893 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1000 2894 * @tc.name test_fileio_create_file_sync_010 2895 * @tc.desc Function of API, flags=0o100. mode=0o272 2896 * @tc.level 3 2897 */ 2898 it('test_fileio_create_file_sync_010', 0, async function (done) { 2899 console.info("--------start test_fileio_create_file_sync_010--------"); 2900 let tcNumber = 'test_fileio_create_file_sync_010'; 2901 let fpath = await getDistributedFilePath(tcNumber); 2902 console.info('fpath == ' + fpath); 2903 try { 2904 let fd = fileio.openSync(fpath, 0o100, 0o272); 2905 console.info('------------- create file success.'); 2906 fileio.accessSync(fpath, 0); 2907 2908 console.info('------ start check server... '); 2909 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2910 console.info("test_fileio_create_file_sync_010 getServerFileInfo serverFileCreate: " + serverFileCreate); 2911 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2912 }) 2913 2914 console.info('------------ start clean test environment.'); 2915 fileio.closeSync(fd); 2916 fileio.unlinkSync(fpath); 2917 } catch (e) { 2918 console.info('test_fileio_create_file_sync_010 has failed for : ' + e); 2919 expect(false).assertTrue(); 2920 } 2921 console.info("--------end test_fileio_create_file_sync_010--------"); 2922 }); 2923 2924 /** 2925 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1100 2926 * @tc.name test_fileio_create_file_sync_011 2927 * @tc.desc Function of API, flags=0o100. mode=0o241 2928 * @tc.level 3 2929 */ 2930 it('test_fileio_create_file_sync_011', 0, async function (done) { 2931 console.info("--------start test_fileio_create_file_sync_011--------"); 2932 let tcNumber = 'test_fileio_create_file_sync_011'; 2933 let fpath = await getDistributedFilePath(tcNumber); 2934 console.info('fpath == ' + fpath); 2935 try { 2936 let fd = fileio.openSync(fpath, 0o100, 0o241); 2937 console.info('------------- create file success.'); 2938 fileio.accessSync(fpath, 0); 2939 2940 console.info('------ start check server... '); 2941 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2942 console.info("test_fileio_create_file_sync_011 getServerFileInfo serverFileCreate: " + serverFileCreate); 2943 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2944 }) 2945 2946 console.info('------------ start clean test environment.'); 2947 fileio.closeSync(fd); 2948 fileio.unlinkSync(fpath); 2949 } catch (e) { 2950 console.info('test_fileio_create_file_sync_011 has failed for : ' + e); 2951 expect(false).assertTrue(); 2952 } 2953 console.info("--------end test_fileio_create_file_sync_011--------"); 2954 }); 2955 2956 /** 2957 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1200 2958 * @tc.name test_fileio_create_file_sync_012 2959 * @tc.desc Function of API, flags=0o100. mode=0o227 2960 * @tc.level 3 2961 */ 2962 it('test_fileio_create_file_sync_012', 0, async function (done) { 2963 console.info("--------start test_fileio_create_file_sync_012--------"); 2964 let tcNumber = 'test_fileio_create_file_sync_012'; 2965 let fpath = await getDistributedFilePath(tcNumber); 2966 console.info('fpath == ' + fpath); 2967 try { 2968 let fd = fileio.openSync(fpath, 0o100, 0o227); 2969 console.info('------------- create file success.'); 2970 fileio.accessSync(fpath, 0); 2971 2972 console.info('------ start check server... '); 2973 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 2974 console.info("test_fileio_create_file_sync_012 getServerFileInfo serverFileCreate: " + serverFileCreate); 2975 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 2976 }) 2977 2978 console.info('------------ start clean test environment.'); 2979 fileio.closeSync(fd); 2980 fileio.unlinkSync(fpath); 2981 } catch (e) { 2982 console.info('test_fileio_create_file_sync_012 has failed for : ' + e); 2983 expect(false).assertTrue(); 2984 } 2985 console.info("--------end test_fileio_create_file_sync_012--------"); 2986 }); 2987 2988 /** 2989 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1300 2990 * @tc.name test_fileio_create_file_sync_013 2991 * @tc.desc Function of API, flags=0o100. mode=0o214 2992 * @tc.level 3 2993 */ 2994 it('test_fileio_create_file_sync_013', 0, async function (done) { 2995 console.info("--------start test_fileio_create_file_sync_013--------"); 2996 let tcNumber = 'test_fileio_create_file_sync_013'; 2997 let fpath = await getDistributedFilePath(tcNumber); 2998 console.info('fpath == ' + fpath); 2999 try { 3000 let fd = fileio.openSync(fpath, 0o100, 0o214); 3001 console.info('------------- create file success.'); 3002 fileio.accessSync(fpath, 0); 3003 3004 console.info('------ start check server... '); 3005 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 3006 console.info("test_fileio_create_file_sync_013 getServerFileInfo serverFileCreate: " + serverFileCreate); 3007 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3008 }) 3009 3010 console.info('------------ start clean test environment.'); 3011 fileio.closeSync(fd); 3012 fileio.unlinkSync(fpath); 3013 } catch (e) { 3014 console.info('test_fileio_create_file_sync_013 has failed for : ' + e); 3015 expect(false).assertTrue(); 3016 } 3017 console.info("--------end test_fileio_create_file_sync_013--------"); 3018 }); 3019 3020 /** 3021 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1400 3022 * @tc.name test_fileio_create_file_sync_014 3023 * @tc.desc Function of API, flags=0o100. mode=0o171 3024 * @tc.level 3 3025 */ 3026 it('test_fileio_create_file_sync_014', 0, async function (done) { 3027 console.info("--------start test_fileio_create_file_sync_014--------"); 3028 let tcNumber = 'test_fileio_create_file_sync_014'; 3029 let fpath = await getDistributedFilePath(tcNumber); 3030 console.info('fpath == ' + fpath); 3031 try { 3032 let fd = fileio.openSync(fpath, 0o100, 0o171); 3033 console.info('------------- create file success.'); 3034 fileio.accessSync(fpath, 0); 3035 3036 console.info('------ start check server... '); 3037 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 3038 console.info("test_fileio_create_file_sync_014 getServerFileInfo serverFileCreate: " + serverFileCreate); 3039 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3040 }) 3041 3042 console.info('------------ start clean test environment.'); 3043 fileio.closeSync(fd); 3044 fileio.unlinkSync(fpath); 3045 } catch (e) { 3046 console.info('test_fileio_create_file_sync_014 has failed for : ' + e); 3047 expect(false).assertTrue(); 3048 } 3049 console.info("--------end test_fileio_create_file_sync_014--------"); 3050 }); 3051 3052 /** 3053 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1500 3054 * @tc.name test_fileio_create_file_sync_015 3055 * @tc.desc Function of API, flags=0o100. mode=0o142 3056 * @tc.level 3 3057 */ 3058 it('test_fileio_create_file_sync_015', 0, async function (done) { 3059 console.info("--------start test_fileio_create_file_sync_015--------"); 3060 let tcNumber = 'test_fileio_create_file_sync_015'; 3061 let fpath = await getDistributedFilePath(tcNumber); 3062 console.info('fpath == ' + fpath); 3063 try { 3064 let fd = fileio.openSync(fpath, 0o100, 0o142); 3065 console.info('------------- create file success.'); 3066 fileio.accessSync(fpath, 0); 3067 3068 console.info('------ start check server... '); 3069 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 3070 console.info("test_fileio_create_file_sync_015 getServerFileInfo serverFileCreate: " + serverFileCreate); 3071 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3072 }) 3073 3074 console.info('------------ start clean test environment.'); 3075 fileio.closeSync(fd); 3076 fileio.unlinkSync(fpath); 3077 } catch (e) { 3078 console.info('test_fileio_create_file_sync_015 has failed for : ' + e); 3079 expect(false).assertTrue(); 3080 } 3081 console.info("--------end test_fileio_create_file_sync_015--------"); 3082 }); 3083 3084 /** 3085 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1600 3086 * @tc.name test_fileio_create_file_sync_016 3087 * @tc.desc Function of API, flags=0o100. mode=0o124 3088 * @tc.level 3 3089 */ 3090 it('test_fileio_create_file_sync_016', 0, async function (done) { 3091 console.info("--------start test_fileio_create_file_sync_016--------"); 3092 let tcNumber = 'test_fileio_create_file_sync_016'; 3093 let fpath = await getDistributedFilePath(tcNumber); 3094 console.info('fpath == ' + fpath); 3095 try { 3096 let fd = fileio.openSync(fpath, 0o100, 0o124); 3097 console.info('------------- create file success.'); 3098 fileio.accessSync(fpath, 0); 3099 3100 console.info('------ start check server... '); 3101 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 3102 console.info("test_fileio_create_file_sync_016 getServerFileInfo serverFileCreate: " + serverFileCreate); 3103 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3104 }) 3105 3106 console.info('------------ start clean test environment.'); 3107 fileio.closeSync(fd); 3108 fileio.unlinkSync(fpath); 3109 } catch (e) { 3110 console.info('test_fileio_create_file_sync_016 has failed for : ' + e); 3111 expect(false).assertTrue(); 3112 } 3113 console.info("--------end test_fileio_create_file_sync_016--------"); 3114 }); 3115 3116 /** 3117 * @tc.number SUB_STORAGE_Distributed_FileIO_OpenSync_1700 3118 * @tc.name test_fileio_create_file_sync_017 3119 * @tc.desc Function of API, flags=0o100. mode=0o117 3120 * @tc.level 3 3121 */ 3122 it('test_fileio_create_file_sync_017', 0, async function (done) { 3123 console.info("--------start test_fileio_create_file_sync_017--------"); 3124 let tcNumber = 'test_fileio_create_file_sync_017'; 3125 let fpath = await getDistributedFilePath(tcNumber); 3126 console.info('fpath == ' + fpath); 3127 try { 3128 let fd = fileio.openSync(fpath, 0o100, 0o117); 3129 console.info('------------- create file success.'); 3130 fileio.accessSync(fpath, 0); 3131 3132 console.info('------ start check server... '); 3133 await getServerFileInfo(tcNumber, fpath, CODE_CREATE_FILE, done, function (serverFileCreate) { 3134 console.info("test_fileio_create_file_sync_017 getServerFileInfo serverFileCreate: " + serverFileCreate); 3135 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3136 }) 3137 3138 console.info('------------ start clean test environment.'); 3139 fileio.closeSync(fd); 3140 fileio.unlinkSync(fpath); 3141 } catch (e) { 3142 console.info('test_fileio_create_file_sync_017 has failed for : ' + e); 3143 expect(false).assertTrue(); 3144 } 3145 console.info("--------end test_fileio_create_file_sync_017--------"); 3146 }); 3147 3148 /** 3149 * @tc.number SUB_STORAGE_Distributed_FileIO_UnlinkSync_0000 3150 * @tc.name test_fileio_delete_file_sync_000 3151 * @tc.desc Function of API, unlinkSync() 3152 * @tc.level 0 3153 */ 3154 it('test_fileio_delete_file_sync_000', 0, async function (done) { 3155 console.info("--------start test_fileio_delete_file_sync_000--------"); 3156 let tcNumber = 'test_fileio_delete_file_sync_000'; 3157 let fpath = await getDistributedFilePath(tcNumber); 3158 console.info('fpath == ' + fpath); 3159 try { 3160 let fd = fileio.openSync(fpath, 0o102, 0o777); 3161 console.info('------------ test_fileio_delete_file_sync_000 : create file ...'); 3162 3163 try { 3164 fileio.accessSync(fpath, 0); 3165 } catch (e) { 3166 console.info('------------ test_fileio_delete_file_sync_000 : create file failed!'); 3167 expect(false).assertTrue(); 3168 } 3169 fileio.closeSync(fd); 3170 3171 console.info('------ start check server first ... '); 3172 await getServerFileInfoFirst(tcNumber, fpath, CODE_CREATE_FILE, function (serverFileCreate) { 3173 console.info("test_fileio_delete_file_sync_000 getServerFileInfoFirst serverFileCreate: " + serverFileCreate); 3174 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3175 }) 3176 3177 fileio.unlinkSync(fpath); 3178 console.info('------------ test_fileio_delete_file_sync_000 : delete file ...'); 3179 try { 3180 fileio.accessSync(fpath, 0); 3181 console.info('------------ test_fileio_delete_file_sync_000 : delete file failed!'); 3182 expect(false).assertTrue(); 3183 } catch (e) { 3184 console.info('------------ test_fileio_delete_file_sync_000 : delete file success!'); 3185 3186 console.info('------ start check server second ... '); 3187 await getServerFileInfo(tcNumber, fpath, CODE_DELETE_FILE, done, function (serverFileDelete) { 3188 console.info("test_fileio_delete_file_sync_000 getServerFileInfo serverFileDelete: " + serverFileDelete); 3189 expect(serverFileDelete).assertEqual(SERVER_CHECK_SUCCESS); 3190 }) 3191 } 3192 } catch (e) { 3193 console.info('test_fileio_delete_file_sync_000 has failed for : ' + e); 3194 expect(false).assertTrue(); 3195 } 3196 console.info("--------end test_fileio_delete_file_sync_000--------"); 3197 }); 3198 3199 /** 3200 * @tc.number SUB_STORAGE_Distributed_FileIO_writeFile_0000 3201 * @tc.name test_fileio_write_file_000 3202 * @tc.desc Function of API,test writeSync() interface 3203 * @tc.level 0 3204 */ 3205 it('test_fileio_write_file_000', 0, async function (done) { 3206 console.info("---------------------start test_fileio_write_file_000---------------------------"); 3207 let tcNumber = 'test_fileio_write_file_000'; 3208 let fpath = await getDistributedFilePath(tcNumber); 3209 console.info('fpath == ' + fpath); 3210 try { 3211 let fd = fileio.openSync(fpath, 0o102, 0o777); 3212 securityLabel.setSecurityLabelSync(fpath, "s0"); 3213 fileio.writeSync(fd, DISTRIBUTED_FILE_CONTENT); 3214 console.info('-------------- test_fileio_write_file_000 : write file success.'); 3215 let fileContent = fileio.readTextSync(fpath); 3216 console.info("-------------- test_fileio_write_file_000 : fileContent =" + fileContent); 3217 expect(DISTRIBUTED_FILE_CONTENT === fileContent).assertTrue(); 3218 3219 console.info('------------------- start check server... '); 3220 sleep(1000); 3221 await getServerFileInfo(tcNumber, fpath, CODE_GET_FILE_CONTENT, done, function (serverFileContent) { 3222 console.info("-------------- test_fileio_write_file_000 : getServerFileInfo serverFileContent =" + serverFileContent); 3223 expect(serverFileContent).assertEqual(DISTRIBUTED_FILE_CONTENT); 3224 }) 3225 3226 console.info('-------------- start clean test environment.'); 3227 fileio.closeSync(fd); 3228 fileio.unlinkSync(fpath); 3229 } catch (e) { 3230 console.info('test_fileio_write_file_000 has failed for : ' + e); 3231 expect(false).assertTrue(); 3232 } 3233 console.info("---------------------end test_fileio_write_file_000---------------------------"); 3234 }); 3235 3236 /** 3237 * @tc.number SUB_STORAGE_Distributed_FileIO_RenameFileSync_0000 3238 * @tc.name test_fileio_rename_file_sync_000 3239 * @tc.desc Function of API, Test the renameSync interface, rename the file. 3240 * @tc.level 0 3241 */ 3242 it('test_fileio_rename_file_sync_000', 0, async function (done) { 3243 console.info("--------start test_fileio_rename_file_sync_000--------"); 3244 let tcNumber = 'test_fileio_rename_file_sync_000'; 3245 let fpath = await getDistributedFilePath(tcNumber); 3246 console.info('fpath == ' + fpath); 3247 try { 3248 let fd = fileio.openSync(fpath, 0o102, 0o777); 3249 fileio.accessSync(fpath, 0); 3250 console.info('------------- create file success.'); 3251 3252 console.info('------ start check server first... '); 3253 await getServerFileInfoFirst(tcNumber, fpath, CODE_CREATE_FILE, function (serverFileCreate) { 3254 console.info("test_fileio_rename_file_sync_000 getServerFileInfoFirst serverFileCreate: " + serverFileCreate); 3255 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3256 }) 3257 3258 let newPath = fpath + "_rename"; 3259 console.info('------------ test_fileio_rename_file_sync_000 : newPath = ' + newPath); 3260 fileio.renameSync(fpath, newPath); 3261 3262 try { 3263 fileio.accessSync(newPath, 0); 3264 console.info('------------ test_fileio_rename_file_sync_000 : rename file success!'); 3265 } catch (error) { 3266 console.info('------------ test_fileio_rename_file_sync_000 : rename file failed!'); 3267 console.info('test_fileio_rename_file_sync_000 has failed for : ' + error); 3268 expect(false).assertTrue(); 3269 } 3270 3271 console.info('------ start check server second... '); 3272 await getServerFileInfo(tcNumber, newPath, CODE_CREATE_FILE, done, function (serverFileRename) { 3273 console.info("test_fileio_rename_file_sync_000 getServerFileInfo serverFileRename: " + serverFileRename); 3274 expect(serverFileRename).assertEqual(SERVER_CHECK_SUCCESS); 3275 }) 3276 3277 fileio.closeSync(fd); 3278 fileio.unlinkSync(newPath); 3279 } catch (e) { 3280 console.info('test_fileio_rename_file_sync_000 has failed for : ' + e); 3281 expect(false).assertTrue(); 3282 } 3283 console.info("--------end test_fileio_rename_file_sync_000--------"); 3284 }); 3285 3286 /** 3287 * @tc.number SUB_STORAGE_Distributed_FileIO_RenameDirSync_0000 3288 * @tc.name test_fileio_rename_dir_sync_000 3289 * @tc.desc Function of API,Test the renameSync interface, rename the directory. 3290 * @tc.level 0 3291 */ 3292 it('test_fileio_rename_dir_sync_000', 0, async function (done) { 3293 console.info("--------start test_fileio_rename_dir_sync_000--------"); 3294 let tcNumber = 'test_fileio_rename_dir_sync_000'; 3295 let dpath = await getDistributedFilePath(tcNumber) + 'd'; 3296 try { 3297 fileio.mkdirSync(dpath); 3298 fileio.accessSync(dpath, 0); 3299 console.info('------------- create dir success.'); 3300 3301 console.info('------ start check server first... '); 3302 await getServerFileInfoFirst(tcNumber, dpath, CODE_MK_DIR, function (serverFileCreate) { 3303 sleep(1000); 3304 console.info("test_fileio_rename_dir_sync_000 getServerFileInfoFirst serverFileCreate: " + serverFileCreate); 3305 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3306 }) 3307 3308 let newPath = dpath + "_rename"; 3309 console.info('------------ test_fileio_rename_dir_sync_000 : newPath = ' + newPath); 3310 fileio.renameSync(dpath, newPath); 3311 3312 try { 3313 fileio.accessSync(newPath, 0); 3314 console.info('------------ test_fileio_rename_dir_sync_000 : rename file success!'); 3315 } catch (error) { 3316 console.info('------------ test_fileio_rename_dir_sync_000 : rename file failed!'); 3317 console.info('test_fileio_rename_dir_sync_000 has failed for : ' + error); 3318 expect(false).assertTrue(); 3319 } 3320 3321 console.info('------ start check server second... '); 3322 await getServerFileInfo(tcNumber, newPath, CODE_MK_DIR, done, function (serverDirRename) { 3323 sleep(1000); 3324 console.info("test_fileio_rename_dir_sync_000 getServerFileInfo serverDirRename: " + serverDirRename); 3325 expect(serverDirRename).assertEqual(SERVER_CHECK_SUCCESS); 3326 }) 3327 3328 fileio.rmdirSync(newPath); 3329 } catch (e) { 3330 console.info('test_fileio_rename_dir_sync_000 has failed for : ' + e); 3331 expect(false).assertTrue(); 3332 } 3333 console.info("--------end test_fileio_rename_dir_sync_000--------"); 3334 }); 3335 3336 /** 3337 * @tc.number SUB_STORAGE_Distributed_FileIO_CopyFileSync_0000 3338 * @tc.name test_fileio_copy_file_sync_000 3339 * @tc.desc Function of API, Test the copyFileSync interface, copy the file. 3340 * @tc.level 0 3341 */ 3342 it('test_fileio_copy_file_sync_000', 0, async function (done) { 3343 console.info("--------start test_fileio_copy_file_sync_000--------"); 3344 let tcNumber = 'test_fileio_copy_file_sync_000'; 3345 let fpath = await getDistributedFilePath(tcNumber); 3346 console.info('fpath == ' + fpath); 3347 try { 3348 let fd = fileio.openSync(fpath, 0o102, 0o777); 3349 fileio.accessSync(fpath, 0); 3350 console.info('------------- create file success.'); 3351 3352 console.info('------ start check server first... '); 3353 await getServerFileInfoFirst(tcNumber, fpath, CODE_CREATE_FILE, function (serverFileCreate) { 3354 console.info("test_fileio_copy_file_sync_000 getServerFileInfoFirst serverFileCreate: " + serverFileCreate); 3355 expect(serverFileCreate).assertEqual(SERVER_CHECK_SUCCESS); 3356 }) 3357 3358 let newPath = fpath + "_copy"; 3359 console.info('------------ test_fileio_copy_file_sync_000 : newPath = ' + newPath); 3360 fileio.copyFileSync(fpath, newPath); 3361 3362 try { 3363 fileio.accessSync(newPath, 0); 3364 console.info('------------ test_fileio_copy_file_sync_000 : copy file success!'); 3365 } catch (error) { 3366 console.info('------------ test_fileio_copy_file_sync_000 : copy file failed!'); 3367 console.info('test_fileio_copy_file_sync_000 has failed for : ' + error); 3368 expect(false).assertTrue(); 3369 } 3370 3371 console.info('------ start check server second... '); 3372 await getServerFileInfo(tcNumber, newPath, CODE_CREATE_FILE, done, function (serverFileCopy) { 3373 console.info("test_fileio_copy_file_sync_000 getServerFileInfo serverFileCopy: " + serverFileCopy); 3374 expect(serverFileCopy).assertEqual(SERVER_CHECK_SUCCESS); 3375 }) 3376 3377 fileio.closeSync(fd); 3378 fileio.unlinkSync(fpath); 3379 fileio.unlinkSync(newPath); 3380 } catch (e) { 3381 console.info('test_fileio_copy_file_sync_000 has failed for : ' + e); 3382 expect(false).assertTrue(); 3383 } 3384 console.info("--------end test_fileio_copy_file_sync_000--------"); 3385 }); 3386 3387 /** 3388 * @tc.number SUB_STORAGE_Distributed_FileIO_StatSync_0000 3389 * @tc.name test_fileio_file_statSync_000 3390 * @tc.desc Function of API,test statSync() interface 3391 * @tc.level 0 3392 */ 3393 it('test_fileio_file_statSync_000', 0, async function (done) { 3394 console.info("---------------------start test_fileio_file_statSync_000---------------------------"); 3395 let tcNumber = 'test_fileio_file_statSync_000' 3396 let fpath = await getDistributedFilePath(tcNumber); 3397 console.info('fpath == ' + fpath); 3398 try { 3399 let fd = fileio.openSync(fpath, 0o102, 0o660); 3400 let localStat = fileio.statSync(fpath); 3401 let localStatInfo = "localStat.size = " + localStat.size + ",localStat.mode = " + localStat.mode; 3402 console.info('------------------- test_fileio_file_statSync_000 localStatInfo = ' + localStatInfo); 3403 3404 await getServerFileInfo(tcNumber, fpath, CODE_GET_FILE_STAT, done, function (serverFileStat) { 3405 console.info("test_fileio_file_statSync_000 getServerFileInfo serverFileStat: " + serverFileStat); 3406 expect(serverFileStat).assertEqual(localStatInfo); 3407 }) 3408 3409 console.info('------------ start clean test environment.'); 3410 fileio.closeSync(fd); 3411 fileio.unlinkSync(fpath); 3412 } catch (e) { 3413 console.info('test_fileio_file_statSync_000 has failed for : ' + e); 3414 expect(false).assertTrue(); 3415 } 3416 console.info("---------------------end test_fileio_file_statSync_000---------------------------"); 3417 }); 3418 3419 /** 3420 * @tc.number SUB_STORAGE_Distributed_FileIO_fstatSync_0000 3421 * @tc.name test_fileio_file_fstatSync_000 3422 * @tc.desc Function of API,test fstatSync() interface 3423 * @tc.level 0 3424 */ 3425 it('test_fileio_file_fstatSync_000', 0, async function (done) { 3426 console.info("---------------------start test_fileio_file_fstatSync_000---------------------------"); 3427 let tcNumber = 'test_fileio_file_fstatSync_000' 3428 let fpath = await getDistributedFilePath(tcNumber); 3429 console.info('fpath == ' + fpath); 3430 try { 3431 let fd = fileio.openSync(fpath, 0o102, 0o660); 3432 let localStat = fileio.fstatSync(fd); 3433 let localStatInfo = "localStat.size = " + localStat.size + ",localStat.mode = " + localStat.mode; 3434 console.info('------------------- test_fileio_file_fstatSync_000 localStatInfo = ' + localStatInfo); 3435 3436 await getServerFileInfo(tcNumber, fpath, CODE_GET_FILE_STAT, done, function (serverFileStat) { 3437 console.info("test_fileio_file_fstatSync_000 getServerFileInfo serverFileStat: " + serverFileStat); 3438 expect(serverFileStat).assertEqual(localStatInfo); 3439 }) 3440 3441 console.info('------------ start clean test environment.'); 3442 fileio.closeSync(fd); 3443 fileio.unlinkSync(fpath); 3444 } catch (e) { 3445 console.info('test_fileio_file_fstatSync_000 has failed for : ' + e); 3446 expect(false).assertTrue(); 3447 } 3448 console.info("---------------------end test_fileio_file_fstatSync_000---------------------------"); 3449 }); 3450 3451 /** 3452 * @tc.number SUB_STORAGE_Distributed_FileIO_fsyncSync_0000 3453 * @tc.name test_fileio_file_fsyncSync_000 3454 * @tc.desc Function of API,test fsyncSync() interface 3455 * @tc.level 0 3456 */ 3457 it('test_fileio_file_fsyncSync_000', 0, async function (done) { 3458 console.info("---------------------start test_fileio_file_fsyncSync_000---------------------------"); 3459 let tcNumber = 'test_fileio_file_fsyncSync_000' 3460 let fpath = await getDistributedFilePath(tcNumber); 3461 try { 3462 let fd = fileio.openSync(fpath, 0o102, 0o777); 3463 securityLabel.setSecurityLabelSync(fpath, "s0"); 3464 await getServerFileInfo(tcNumber, fpath, CODE_FSYNC_FILE, done, function (serverFileSync) { 3465 sleep(2000); 3466 console.info("test_fileio_file_fsyncSync_000 getServerFileInfo serverFileSync: " + JSON.stringify(serverFileSync)); 3467 expect(serverFileSync == SERVER_CHECK_SUCCESS).assertTrue(); 3468 }); 3469 3470 console.info('------------ start clean test environment.'); 3471 fileio.closeSync(fd); 3472 fileio.unlinkSync(fpath); 3473 } catch (e) { 3474 console.info('test_fileio_file_fsyncSync_000 has failed for : ' + e); 3475 expect(false).assertTrue(); 3476 } 3477 console.info("---------------------end test_fileio_file_fsyncSync_000---------------------------"); 3478 }); 3479 3480 console.info("----------SUB_Storage_Fileio_Distributed JS Test is end----------"); 3481 }); 3482} 3483 3484