1 /* 2 * Copyright (c) 2020-2021 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 * limitations under the License. 13 */ 14 #include "FileSystemTest.h" 15 #include <stdio.h> 16 #include <string.h> 17 #include <stdlib.h> 18 19 #include <sys/stat.h> 20 #include <sys/types.h> 21 #include <fcntl.h> 22 #include <unistd.h> 23 #include <dirent.h> 24 #include <ftw.h> 25 #include <libgen.h> 26 27 #include <gtest/gtest.h> 28 29 #include "utils.h" 30 #include "log.h" 31 #include "KernelConstants.h" 32 #include "libfs.h" 33 34 using namespace testing::ext; 35 36 /** 37 * @tc.number SUB_KERNEL_FS_UNISTD_0100 38 * @tc.name basic function test : access check file exists. 39 * @tc.desc [C- SOFTWARE -0200] 40 */ 41 HWTEST_F(FileSystemTest, testAccess, Function | MediumTest | Level0) 42 { 43 int fd = 0; 44 fd = creat(FILE0, 0777); 45 EXPECT_NE(fd, -1) << "> creat faild errno = " << errno; 46 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 47 EXPECT_EQ(access(FILE0, F_OK), 0) << "> access F_OK errno = " << errno; 48 } 49 50 /** 51 * @tc.number SUB_KERNEL_FS_UNISTD_0110 52 * @tc.name basic function test : test access with ENOENT 53 * @tc.desc [C- SOFTWARE -0200] 54 */ 55 HWTEST_F(FileSystemTest, testAccessEnoent, Function | MediumTest | Level0) 56 { 57 EXPECT_EQ(access(FILE0, F_OK), -1) << "> access F_OK expect faild but success"; 58 EXPECT_EQ(errno, ENOENT); 59 } 60 61 #if defined(LITE_FS_JFFS2) 62 /** 63 * @tc.number SUB_KERNEL_FS_UNISTD_0120 64 * @tc.name basic function test : access check file R_OK. 65 * @tc.desc [C- SOFTWARE -0200] 66 */ 67 HWTEST_F(FileSystemTest, testAccessRok, Function | MediumTest | Level1) 68 { 69 int fd = 0; 70 fd = creat(FILE0, 0777); 71 EXPECT_NE(fd, -1) << "> creat faild errno = " << errno; 72 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 73 EXPECT_EQ(access(FILE0, R_OK), 0) << "> access F_OK errno = " << errno; 74 } 75 #endif 76 77 #if defined(LITE_FS_JFFS2) 78 /** 79 * @tc.number SUB_KERNEL_FS_UNISTD_0130 80 * @tc.name basic function test : access check file W_OK. 81 * @tc.desc [C- SOFTWARE -0200] 82 */ 83 HWTEST_F(FileSystemTest, testAccessWok, Function | MediumTest | Level1) 84 { 85 int fd = 0; 86 fd = creat(FILE0, 0777); 87 EXPECT_NE(fd, -1) << "> creat faild errno = " << errno; 88 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 89 EXPECT_EQ(access(FILE0, W_OK), 0) << "> access F_OK errno = " << errno; 90 } 91 #endif 92 93 #if defined(LITE_FS_JFFS2) 94 /** 95 * @tc.number SUB_KERNEL_FS_UNISTD_0140 96 * @tc.name basic function test : access check file X_OK 97 * @tc.desc [C- SOFTWARE -0200] 98 */ 99 HWTEST_F(FileSystemTest, testAccessXok, Function | MediumTest | Level1) 100 { 101 int fd = 0; 102 fd = creat(FILE0, 0777); 103 EXPECT_NE(fd, -1) << "> creat faild errno = " << errno; 104 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 105 EXPECT_EQ(access(FILE0, X_OK), 0) << "> access F_OK errno = " << errno; 106 } 107 #endif 108 109 /** 110 * @tc.number SUB_KERNEL_FS_UNISTD_0200 111 * @tc.name basic function test : switch to the current working directory. 112 * @tc.desc [C- SOFTWARE -0200] 113 */ 114 HWTEST_F(FileSystemTest, testChdir, Function | MediumTest | Level1) 115 { 116 char testDir[MAX_PATH_SIZE]; 117 const char *expectDirStandard = TOP_DIR "/" DIR0; 118 EXPECT_NE(mkdir(DIR0, 0777), -1) << "> mkdir errno = " << errno; 119 EXPECT_NE(chdir(DIR0), -1) << "> chdir errno = " << errno; 120 EXPECT_NE(getcwd(testDir, sizeof(testDir)), nullptr) << "> getcwd errno = " << errno; 121 EXPECT_NE(chdir(TOP_DIR), -1) << "> chdir errno = " << errno; 122 123 EXPECT_STREQ(testDir, expectDirStandard); 124 LOG("> expectDirStandard = %s", expectDirStandard); 125 LOG("> testDir = %s", testDir); 126 } 127 128 /** 129 * @tc.number SUB_KERNEL_FS_UNISTD_0210 130 * @tc.name basic function test : test chdir with ENOENT 131 * @tc.desc [C- SOFTWARE -0200] 132 */ 133 HWTEST_F(FileSystemTest, testChdirEnoent, Function | MediumTest | Level3) 134 { 135 const char *fileName = "not_exist_file"; 136 EXPECT_EQ(chdir(fileName), -1) << "> chdir errno = " << errno; 137 EXPECT_EQ(errno, ENOENT); 138 EXPECT_NE(chdir(TOP_DIR), -1) << "> chdir errno = " << errno; 139 } 140 141 /** 142 * @tc.number SUB_KERNEL_FS_UNISTD_0220 143 * @tc.name basic function test : test chdir with ENAMETOOLONG 144 * @tc.desc [C- SOFTWARE -0200] 145 */ 146 HWTEST_F(FileSystemTest, testChdirEnametoolong, Function | MediumTest | Level3) 147 { 148 const char *fileName = "12345678901234567890123456789012345678901234567890\ 149 12345678901234567890123456789012345678901234567890\ 150 12345678901234567890123456789012345678901234567890\ 151 12345678901234567890123456789012345678901234567890\ 152 12345678901234567890123456789012345678901234567890\ 153 12345678901234567890123456789012345678901234567890\ 154 12345678901234567890123456789012345678901234567890\ 155 12345678901234567890123456789012345678901234567890"; 156 EXPECT_EQ(chdir(fileName), -1) << "> chdir errno = " << errno; 157 EXPECT_EQ(errno, ENAMETOOLONG); 158 EXPECT_NE(chdir(TOP_DIR), -1) << "> chdir errno = " << errno; 159 } 160 161 /** 162 * @tc.number SUB_KERNEL_FS_UNISTD_0230 163 * @tc.name basic function test : test chdir with ENOTDIR 164 * @tc.desc [C- SOFTWARE -0200] 165 */ 166 HWTEST_F(FileSystemTest, testChdirEnotdir, Function | MediumTest | Level3) 167 { 168 int fd = 0; 169 const char *fileName = FILE0; 170 fd = creat(FILE0, 0777); 171 EXPECT_NE(fd, -1) << "> creat faild errno = " << errno; 172 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 173 EXPECT_EQ(chdir(fileName), -1) << "> chdir errno = " << errno; 174 EXPECT_EQ(errno, ENOTDIR); 175 EXPECT_NE(chdir(TOP_DIR), -1) << "> chdir errno = " << errno; 176 } 177 #if 0 178 #if defined(LITE_FS_NFS) || defined(LITE_FS_VFAT) 179 /** 180 * @tc.number SUB_KERNEL_FS_UNISTD_0300 181 * @tc.name basic function test : dup copy file description, then write and read 182 * @tc.desc [C- SOFTWARE -0200] 183 */ 184 HWTEST_F(FileSystemTest, testDup, Function | MediumTest | Level3) 185 { 186 int fd = 0; 187 int fdNew = 0; 188 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 189 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 190 WriteCloseTest(fd); 191 fd = open(FILE0, O_RDONLY, 0777); 192 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 193 fdNew = dup(fd); 194 #if defined(LITE_FS_NFS) 195 EXPECT_NE(fdNew, -1) << "> dup errno = " << errno; 196 #endif 197 // vfat not suuport, after support change to NE 198 #if defined(LITE_FS_VFAT) 199 EXPECT_EQ(fdNew, -1) << "> dup errno = " << errno; 200 #endif 201 if (fdNew != -1) { 202 ReadCloseTest(fdNew); 203 } 204 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 205 } 206 #endif 207 208 /** 209 * @tc.number SUB_KERNEL_FS_UNISTD_0400 210 * @tc.name basic function test : dup2 copy file description, then write and read 211 * @tc.desc [C- SOFTWARE -0200] 212 */ 213 HWTEST_F(FileSystemTest, testDup2, Function | MediumTest | Level3) 214 { 215 int fd = 0; 216 int fdNew = 0; 217 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 218 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 219 WriteCloseTest(fd); 220 fd = open(FILE0, O_RDONLY, 0777); 221 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 222 EXPECT_NE(dup2(fd, fdNew), -1) << "> dup2 errno = " << errno; 223 ReadCloseTest(fdNew); 224 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 225 } 226 #endif 227 #if defined(LITE_FS_VFAT) 228 /** 229 * @tc.number SUB_KERNEL_FS_UNISTD_0500 230 * @tc.name basic function test : using ftruncate to change the file size 231 * @tc.desc [C- SOFTWARE -0200] 232 */ 233 HWTEST_F(FileSystemTest, testFtruncate, Function | MediumTest | Level1) 234 { 235 struct stat statbuf; 236 char writeBuf[] = "this is a file"; 237 int fd = 0; 238 239 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 240 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 241 EXPECT_NE(write(fd, writeBuf, sizeof(writeBuf)), -1) << "> write errno = " << errno; 242 243 EXPECT_NE(ftruncate(fd, 1000), -1) << "truncate errno = " << errno; 244 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 245 246 EXPECT_NE(stat(FILE0, &statbuf), -1) << "> fstat errno = " << errno; 247 EXPECT_EQ(statbuf.st_size, 1000); 248 } 249 #endif 250 251 #if defined(LITE_FS_VFAT) 252 /** 253 * @tc.number SUB_KERNEL_FS_UNISTD_0501 254 * @tc.name basic function test : test ftruncate with EINVAL 255 * @tc.desc [C- SOFTWARE -0200] 256 */ 257 HWTEST_F(FileSystemTest, testFtruncateEinval, Function | MediumTest | Level3) 258 { 259 char writeBuf[] = "this is a file"; 260 int fd = 0; 261 262 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 263 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 264 EXPECT_NE(write(fd, writeBuf, sizeof(writeBuf)), -1) << "> write errno = " << errno; 265 266 EXPECT_EQ(ftruncate(fd, -1), -1); 267 EXPECT_EQ(errno, EINVAL); 268 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 269 } 270 #endif 271 272 #if defined(LITE_FS_VFAT) 273 /** 274 * @tc.number SUB_KERNEL_FS_UNISTD_0502 275 * @tc.name basic function test : test ftruncate with ENOSYS 276 * @tc.desc [C- SOFTWARE -0200] 277 */ 278 HWTEST_F(FileSystemTest, testFtruncateEacces, Function | MediumTest | Level3) 279 { 280 EXPECT_EQ(ftruncate(STDERR_FILENO, 10), -1); 281 EXPECT_EQ(errno, ENOSYS); 282 } 283 #endif 284 285 #if defined(LITE_FS_VFAT) 286 /** 287 * @tc.number SUB_KERNEL_FS_UNISTD_0503 288 * @tc.name basic function test : test ftruncate with EBADF 289 * @tc.desc [C- SOFTWARE -0200] 290 */ 291 HWTEST_F(FileSystemTest, testFtruncateEbadf, Function | MediumTest | Level3) 292 { 293 int invalidFd = 99999; 294 EXPECT_EQ(ftruncate(invalidFd, 10), -1); 295 EXPECT_EQ(errno, EBADF); 296 } 297 #endif 298 299 #if defined(LITE_FS_VFAT) 300 /** 301 * @tc.number SUB_KERNEL_FS_UNISTD_0510 302 * @tc.name basic function test : using truncate functions to change the file size 303 * @tc.desc [C- SOFTWARE -0200] 304 */ 305 HWTEST_F(FileSystemTest, testTruncate, Function | MediumTest | Level1) 306 { 307 struct stat statbuf; 308 char writeBuf[] = "this is a file"; 309 int fd = 0; 310 311 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 312 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 313 EXPECT_NE(write(fd, writeBuf, sizeof(writeBuf)), -1) << "> write errno = " << errno; 314 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 315 316 EXPECT_NE(truncate(FILE0, 100), -1) << "truncate errno = " << errno; 317 EXPECT_NE(stat(FILE0, &statbuf), -1) << "> fstat errno = " << errno; 318 EXPECT_EQ(statbuf.st_size, 100); 319 } 320 #endif 321 322 #if defined(LITE_FS_VFAT) 323 /** 324 * @tc.number SUB_KERNEL_FS_UNISTD_0511 325 * @tc.name basic function test : test truncate with EINVAL 326 * @tc.desc [C- SOFTWARE -0200] 327 */ 328 HWTEST_F(FileSystemTest, testTruncateEinval, Function | MediumTest | Level3) 329 { 330 char writeBuf[] = "this is a file"; 331 int fd = 0; 332 333 fd = open(FILE0, O_CREAT | O_RDWR, 0777); 334 EXPECT_NE(fd, -1) << "> open faild errno = " << errno; 335 EXPECT_NE(write(fd, writeBuf, sizeof(writeBuf)), -1) << "> write errno = " << errno; 336 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 337 338 EXPECT_EQ(truncate(FILE0, -1), -1); 339 EXPECT_EQ(errno, EINVAL); 340 } 341 #endif 342 343 #if defined(LITE_FS_VFAT) 344 /** 345 * @tc.number SUB_KERNEL_FS_UNISTD_0512 346 * @tc.name basic function test : test truncate with EACCES 347 * @tc.desc [C- SOFTWARE -0200] 348 */ 349 HWTEST_F(FileSystemTest, testTruncateEacces, Function | MediumTest | Level3) 350 { 351 EXPECT_EQ(truncate("/", 10), -1); 352 printf("errno = %d\n", errno); 353 EXPECT_EQ(errno, EISDIR); 354 } 355 #endif 356 357 #if defined(LITE_FS_VFAT) 358 /** 359 * @tc.number SUB_KERNEL_FS_UNISTD_0513 360 * @tc.name basic function test : test truncate with ENAMETOOLONG 361 * @tc.desc [C- SOFTWARE -0200] 362 */ 363 HWTEST_F(FileSystemTest, testTruncateEnametoolong, Function | MediumTest | Level3) 364 { 365 const char *fileName = "12345678901234567890123456789012345678901234567890\ 366 12345678901234567890123456789012345678901234567890\ 367 12345678901234567890123456789012345678901234567890\ 368 12345678901234567890123456789012345678901234567890\ 369 12345678901234567890123456789012345678901234567890\ 370 12345678901234567890123456789012345678901234567890\ 371 12345678901234567890123456789012345678901234567890\ 372 12345678901234567890123456789012345678901234567890"; 373 EXPECT_EQ(truncate(fileName, 10), -1); 374 EXPECT_EQ(errno, ENAMETOOLONG); 375 } 376 #endif 377 378 #if defined(LITE_FS_VFAT) 379 /** 380 * @tc.number SUB_KERNEL_FS_UNISTD_0514 381 * @tc.name basic function test : test truncate with ENOENT 382 * @tc.desc [C- SOFTWARE -0200] 383 */ 384 HWTEST_F(FileSystemTest, testTruncateEnoent, Function | MediumTest | Level3) 385 { 386 const char invalidPath[] = "noExit"; 387 EXPECT_EQ(truncate(invalidPath, 10), -1); 388 EXPECT_EQ(errno, ENOENT); 389 } 390 #endif 391 392 #ifdef LITE_FS_PATHCONF 393 /** 394 * @tc.number SUB_KERNEL_FS_UNISTD_0600 395 * @tc.name basic function test : Use the pathconf function to get the configuration value of the file 396 * @tc.desc [C- SOFTWARE -0200] 397 */ 398 HWTEST_F(FileSystemTest, testPathconf, Function | MediumTest | Level2) 399 { 400 const char filePath[] = TOP_DIR "/" DIR0 "/" DIR0_FILE0; 401 CreateTestFolder(); 402 403 // use correctly 404 int param[] = { 405 _PC_LINK_MAX, 406 _PC_MAX_CANON, 407 _PC_MAX_INPUT, 408 _PC_NAME_MAX, 409 _PC_PATH_MAX, 410 _PC_PIPE_BUF, 411 _PC_CHOWN_RESTRICTED, 412 _PC_NO_TRUNC, 413 _PC_VDISABLE, 414 _PC_SYNC_IO, 415 _PC_ASYNC_IO, 416 _PC_PRIO_IO, 417 _PC_SOCK_MAXBUF, 418 _PC_FILESIZEBITS, 419 _PC_REC_INCR_XFER_SIZE, 420 _PC_REC_MAX_XFER_SIZE, 421 _PC_REC_MIN_XFER_SIZE, 422 _PC_REC_XFER_ALIGN, 423 _PC_ALLOC_SIZE_MIN, 424 _PC_SYMLINK_MAX, 425 _PC_2_SYMLINKS 426 }; 427 int size = sizeof(param) / sizeof(int); 428 for (int i = 0; i < size; i++) { 429 errno = 0; 430 if (pathconf(filePath, param[i]) == -1) { 431 EXPECT_EQ(errno, 0) << "fpathconf i = " << i << " errno = " << errno; 432 } 433 } 434 } 435 #endif 436 437 #ifdef LITE_FS_PATHCONF 438 /** 439 * @tc.number SUB_KERNEL_FS_UNISTD_0610 440 * @tc.name basic function test : test pathconf function with error number EINVAL 441 * @tc.desc [C- SOFTWARE -0200] 442 */ 443 HWTEST_F(FileSystemTest, testPathconfEinval, Function | MediumTest | Level2) 444 { 445 const char filePath[] = TOP_DIR "/" DIR0 "/" DIR0_FILE0; 446 CreateTestFolder(); 447 448 // invalid name 449 EXPECT_EQ(pathconf(filePath, -100), -1); 450 EXPECT_EQ(errno, EINVAL) << "fpathconf invalidPath errno = " << errno; 451 } 452 #endif 453 454 #ifdef LITE_FS_PATHCONF 455 /** 456 * @tc.number SUB_KERNEL_FS_UNISTD_0620 457 * @tc.name basic function test : test pathconf function with error number EFAULT 458 * @tc.desc [C- SOFTWARE -0200] 459 */ 460 HWTEST_F(FileSystemTest, testPathconfEfault, Function | MediumTest | Level2) 461 { 462 // null path 463 EXPECT_EQ(pathconf(nullptr, _PC_LINK_MAX), -1); 464 EXPECT_EQ(errno, EFAULT) << "fpathconf invalidPath errno = " << errno; 465 } 466 #endif 467 468 #ifdef LITE_FS_PATHCONF 469 /** 470 * @tc.number SUB_KERNEL_FS_UNISTD_0630 471 * @tc.name basic function test : test pathconf function with error number ENOENT 472 * @tc.desc [C- SOFTWARE -0200] 473 */ 474 HWTEST_F(FileSystemTest, testPathconfEnoent, Function | MediumTest | Level2) 475 { 476 // path not exit 477 const char invalidPath[] = "noExit"; 478 EXPECT_EQ(pathconf(invalidPath, _PC_LINK_MAX), -1); 479 EXPECT_EQ(errno, ENOENT) << "fpathconf invalidPath errno = " << errno; 480 } 481 #endif 482 483 #ifdef LITE_FS_PATHCONF 484 /** 485 * @tc.number SUB_KERNEL_FS_UNISTD_0700 486 * @tc.name basic function test : Use the fpathconf function to get the configuration value of the file 487 * @tc.desc [C- SOFTWARE -0200] 488 */ 489 HWTEST_F(FileSystemTest, testFpathconf, Function | MediumTest | Level2) 490 { 491 int fd = open(FILE0, O_CREAT | O_RDWR, 0777); 492 EXPECT_NE(fd, -1) << "> open errno = " << errno; 493 494 // use correctly 495 int param[] = { 496 _PC_LINK_MAX, 497 _PC_MAX_CANON, 498 _PC_MAX_INPUT, 499 _PC_NAME_MAX, 500 _PC_PATH_MAX, 501 _PC_PIPE_BUF, 502 _PC_CHOWN_RESTRICTED, 503 _PC_NO_TRUNC, 504 _PC_VDISABLE, 505 _PC_SYNC_IO, 506 _PC_ASYNC_IO, 507 _PC_PRIO_IO, 508 _PC_SOCK_MAXBUF, 509 _PC_FILESIZEBITS, 510 _PC_REC_INCR_XFER_SIZE, 511 _PC_REC_MAX_XFER_SIZE, 512 _PC_REC_MIN_XFER_SIZE, 513 _PC_REC_XFER_ALIGN, 514 _PC_ALLOC_SIZE_MIN, 515 _PC_SYMLINK_MAX, 516 _PC_2_SYMLINKS 517 }; 518 int size = sizeof(param) / sizeof(int); 519 for (int i = 0; i < size; i++) { 520 errno = 0; 521 if (fpathconf(fd, param[i]) == -1) { 522 EXPECT_EQ(errno, 0) << "fpathconf i = " << i << " errno = " << errno; 523 } 524 } 525 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 526 } 527 #endif 528 529 #ifdef LITE_FS_PATHCONF 530 /** 531 * @tc.number SUB_KERNEL_FS_UNISTD_0710 532 * @tc.name basic function test : test fpathconf function with error number EINVAL 533 * @tc.desc [C- SOFTWARE -0200] 534 */ 535 HWTEST_F(FileSystemTest, testFpathconfEinval, Function | MediumTest | Level2) 536 { 537 int fd = open(FILE0, O_CREAT | O_RDWR, 0777); 538 EXPECT_NE(fd, -1) << "> open errno = " << errno; 539 540 // invalid name 541 errno = 0; 542 EXPECT_EQ(fpathconf(fd, -100), -1); 543 EXPECT_EQ(errno, EINVAL) << "fpathconf invalidPath errno = " << errno; 544 545 EXPECT_NE(close(fd), -1) << "> close errno = " << errno; 546 } 547 #endif 548 549 #ifdef LITE_FS_PATHCONF 550 /** 551 * @tc.number SUB_KERNEL_FS_UNISTD_0720 552 * @tc.name basic function test : test fpathconf function with error number EBADF 553 * @tc.desc [C- SOFTWARE -0200] 554 */ 555 HWTEST_F(FileSystemTest, testFpathconfEbadf, Function | MediumTest | Level2) 556 { 557 // invalid file description 558 EXPECT_EQ(fpathconf(-100, _PC_LINK_MAX), -1); 559 EXPECT_EQ(errno, EBADF) << "fpathconf invalidPath errno = " << errno; 560 } 561 #endif 562