Changeset c2f9b97 in rtems
- Timestamp:
- 12/03/98 22:41:57 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 0422a7a5
- Parents:
- 5b8e885d
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/tests/psxtests/psx13/psx13.scn
r5b8e885d rc2f9b97 1 2 Files initialized successfully. 3 Testing device_lseek()... Success. 4 Testing dup()............ Success. 5 Testing dup2()........... Success. 6 Testing fdatasync()...... Success. 7 Testing umask().......... Success. 8 Testing utime().......... Success. 9 Testing pipe()........... Success. 10 Testing fsync().......... Success. 11 Testing pathconf()....... Success. 12 Testing fpathconf()...... Success. 13 14 15 *** END OF TEST PSX13 *** -
c/src/tests/psxtests/psx13/test.c
r5b8e885d rc2f9b97 162 162 if (fd2 != -1) { 163 163 164 fcntl( F_SETFL, fd1, O_APPEND);165 flags = fcntl( F_GETFL, fd2);164 fcntl(fd1, F_SETFL, O_APPEND); 165 flags = fcntl(fd2, F_GETFL); 166 166 167 167 close (fd1); … … 215 215 if (error != -1) { 216 216 217 fcntl( F_SETFL, fd1, O_APPEND);218 flags = fcntl( F_GETFL, fd1);217 fcntl(fd1, F_SETFL, O_APPEND); 218 flags = fcntl(fd1, F_GETFL); 219 219 220 220 flags = (flags & O_APPEND); … … 601 601 { 602 602 if (InitFiles() == TRUE) { 603 p uts("\nFiles initialized successfully.\n");604 605 p uts ("Testing device_lseek()...");603 printf ("\nFiles initialized successfully.\n"); 604 605 printf ("Testing device_lseek()... "); 606 606 if (DeviceLSeekTest() == TRUE) 607 p uts("Success.\n");608 else 609 p uts("Failed!!!\n");610 611 p uts ("Testing dup()...");607 printf ("Success.\n"); 608 else 609 printf ("Failed!!!\n"); 610 611 printf ("Testing dup()............ "); 612 612 if (DupTest() == TRUE) 613 p uts("Success.\n");614 else 615 p uts("Failed!!!\n");613 printf ("Success.\n"); 614 else 615 printf ("Failed!!!\n"); 616 616 617 p uts ("Testing dup2()...");617 printf ("Testing dup2()........... "); 618 618 if (Dup2Test() == TRUE) 619 p uts("Success.\n");620 else 621 p uts("Failed!!!\n");622 623 p uts ("Testing fdatasync()...");619 printf ("Success.\n"); 620 else 621 printf ("Failed!!!\n"); 622 623 printf ("Testing fdatasync()...... "); 624 624 if (FDataSyncTest() == TRUE) 625 p uts("Success.\n");626 else 627 p uts("Failed!!!\n");628 629 p uts ("Testing umask()...");625 printf ("Success.\n"); 626 else 627 printf ("Failed!!!\n"); 628 629 printf ("Testing umask().......... "); 630 630 if (UMaskTest() == TRUE) 631 p uts("Success.\n");632 else 633 p uts("Failed!!!\n");634 635 p uts ("Testing utime()...");631 printf ("Success.\n"); 632 else 633 printf ("Failed!!!\n"); 634 635 printf ("Testing utime().......... "); 636 636 if (UTimeTest() == TRUE) 637 p uts("Success.\n");638 else 639 p uts("Failed!!!\n");640 641 p uts ("Testing pipe()...");637 printf ("Success.\n"); 638 else 639 printf ("Failed!!!\n"); 640 641 printf ("Testing pipe()........... "); 642 642 if (PipeTest() == TRUE) 643 p uts("Success.\n");644 else 645 p uts("Failed!!!\n");646 647 p uts ("Testing fsync()...");643 printf ("Success.\n"); 644 else 645 printf ("Failed!!!\n"); 646 647 printf ("Testing fsync().......... "); 648 648 if (FSyncTest() == TRUE) 649 p uts("Success.\n");650 else 651 p uts("Failed!!!\n");652 653 p uts ("Testing pathconf()...");649 printf ("Success.\n"); 650 else 651 printf ("Failed!!!\n"); 652 653 printf ("Testing pathconf()....... "); 654 654 if (PathConfTest() == TRUE) 655 p uts("Success.\n");656 else 657 p uts("Failed!!!\n");655 printf ("Success.\n"); 656 else 657 printf ("Failed!!!\n"); 658 658 659 p uts ("Testing fpathconf()...");659 printf ("Testing fpathconf()...... "); 660 660 if (FPathConfTest() == TRUE) 661 p uts("Success.\n");662 else 663 p uts("Failed!!!\n");661 printf ("Success.\n"); 662 else 663 printf ("Failed!!!\n"); 664 664 } 665 665 666 666 667 667 else 668 puts ("\n\nError opening files for write!!!!\n"); 669 670 puts( "\n\n*** XXX ***" ); 671 672 puts( "\n\n*** END OF TEST PSX13 ***" ); 668 printf ("\n\nError opening files for write!!!!\n"); 669 670 printf( "\n\n*** END OF TEST PSX13 ***" ); 673 671 exit(0); 674 672 } -
c/src/tests/psxtests/psxfile01/test.c
r5b8e885d rc2f9b97 239 239 status = rmdir ("/fred"); 240 240 assert (status == -1); 241 assert( errno == ENOENT ); 241 242 242 243 status = mknod( "/dev/test_console", S_IFCHR, 0LL ); -
c/src/tests/psxtests/psxmount/psxmount.scn
r5b8e885d rc2f9b97 1 2 3 *** MOUNT/UNMOUNT TEST *** 4 5 chdir to the root directory 6 chdir() status : 0 7 8 9 Creating a series of directories under / 10 Creating : a 0 0 Success 11 Creating : b 0 0 Success 12 Creating : c 0 0 Success 13 Creating : d 0 0 Success 14 Creating : e 0 0 Success 15 Creating : f 0 0 Success 16 Creating : c/y 0 0 Success 17 Creating : c/z 0 0 Success 18 Creating : c/x 0 0 Success 19 Creating : c/y/a3333 0 0 Success 20 Creating : c/y/j123 0 0 Success 21 Creating : c/y/my_mount_point 0 0 Success 22 Creating : c/y/my_mount_point/my_dir 0 0 Success 23 Creating : c/z/my_mount_point 0 0 Success 24 create /b/my_file 25 Verify /b/my_file 26 create c/y/my_mount_point/my_dir/d 27 Verify c/y/my_mount_point/my_dir/d 28 Attempting to mount IMFS file system at /c/z/my_mount_point 29 2nd file system successfully mounted at /c/z/my_mount_point 30 31 chdir to /c/z/my_mount_point. 32 chdir() status : 0 33 34 35 Creating a series of directories under /c/z/my_mount_point 36 Creating: a 0 2 Success 37 Creating: b 0 2 Success 38 Creating: c 0 2 Success 39 Creating: d 0 2 Success 40 Creating: e 0 2 Success 41 Creating: f 0 2 Success 42 Creating: c/y 0 2 Success 43 Creating: c/z 0 2 Success 44 Creating: c/x 0 2 Success 45 Creating: c/y/a3333 0 2 Success 46 Creating: c/y/j123 0 2 Success 47 Creating: c/y/my_mount_point 0 2 Success 48 Creating: c/y/my_mount_point/my_dir 0 2 Success 49 Creating: c/y/my_mount_point/my_dir/d 0 2 Success 50 Creating: c/z/my_mount_point 0 2 Success 51 Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g 0 2 Success 52 53 chdir to / 54 chdir() status : 0 55 56 Unmount status: 0 57 Mount a NULL file system and verify EINVAL 58 mount with option RA should fail with EINVAL 59 Mount a Read Only filesystem at /c/y/my_mount_point 60 Read only file system successfully mounted at /c/y/my_mount_point 61 create c/y/my_mount_point/../../y/my_mount_point/new_dir 62 Verify a mount point retruns EBUSY for another mount 63 Mount on a file should fail with ENOTDIR 64 Create and chdir to /c/y/my_mount_point/mydir 65 unmount of /c/y/my_mount_point should fail with EBUSY 66 chdir to / and verify we can unmount /c/y/my_mount_point 67 unmount /c/y/my_mount_point 68 unmount /b/mount_point should fail with EINVAL 69 Mount /c/y/my_mount_point 70 Create and open /c/y/my_mount_point/my_file 71 72 mkdir /c/y/my_mount_point/my_dir 73 Open /c/y/my_mount_point/my_dir 74 Unmount /c/y/my_mount_point should fail with EBUSY 75 Close /c/y/my_mount_point/my_dir 76 Unmount /c/y/my_mount_point/my_dir 77 Mount a file system at /c/y/my_mount_point/my_dir 78 unmount /c/y/my_mount_point should fail with EBUSY 79 Verify a hard link across filesystems fails with EXDEV 80 Verify a symbolic link across file systems works 81 unmount /c/y/my_mount_point/my_dir 82 Verify the symbolic link now fails 83 unmount /c/y/my_mount_point 84 85 86 *** END OF MOUNT/UNMOUNT TEST *** -
c/src/tests/psxtests/psxmount/test.c
r5b8e885d rc2f9b97 100 100 printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" ); 101 101 102 /* 103 * Change directory to the root and create files under 104 * the base file system. 105 */ 106 102 107 printf( "\nchdir to the root directory\n" ); 103 108 status = chdir( "/" ); … … 109 114 { 110 115 status = mkdir( dnames[i], 0777 ); 111 printf("Creating directory: %s%d %d ", dnames[i], status, errno );116 printf("Creating : %25s %d %d ", dnames[i], status, errno ); 112 117 if ( status == 0 ) 113 118 printf(" Success\n"); … … 118 123 } 119 124 125 /* 126 * Create a Files with all rwx for others group and user. Verify 127 * the created file. 128 */ 129 130 printf("create /b/my_file\n"); 120 131 fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 132 assert( fd != 0 ); 121 133 close (fd); 134 135 printf("Verify /b/my_file\n"); 122 136 fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO); 137 assert( fd != 0 ); 123 138 close( fd ); 124 139 140 141 printf("create c/y/my_mount_point/my_dir/d\n"); 125 142 fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 143 assert( fd != 0 ); 126 144 close (fd); 145 146 printf("Verify c/y/my_mount_point/my_dir/d\n"); 127 147 fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO); 148 assert( fd != 0 ); 128 149 close( fd ); 150 151 /* 152 * Mount an the IMFS file system on the base file system. 153 */ 129 154 130 155 printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n"); … … 143 168 } 144 169 145 printf( "\nchdir to /c/z/my_mount_point the mount point of the \n" ); 146 printf( "second file system \n" ); 170 /* 171 * Change directory to the mount point and create a group of files under 172 * the mounted file system. 173 */ 174 175 printf( "\nchdir to /c/z/my_mount_point.\n" ); 147 176 status = chdir( "/c/z/my_mount_point" ); 148 177 printf( "chdir() status : %d\n\n", status ); … … 153 182 { 154 183 status = mkdir( fnames[i], 0777 ); 155 printf("Creating directory: %s%d %d ", fnames[i], status, errno );184 printf("Creating: %46s %d %d ", fnames[i], status, errno ); 156 185 if ( status == 0 ) 157 186 printf(" Success\n"); … … 168 197 } 169 198 170 printf( "\nchdir to / the mount point of the first file system\n" );199 printf( "\nchdir to /\n" ); 171 200 status = chdir( "/" ); 172 201 printf( "chdir() status : %d\n\n", status ); … … 180 209 printf( " %d\n", status ); 181 210 182 /* 183 status = chmod( "c/y/j123", S_IRUSR ); 184 assert( status == 0 ); 185 186 printf("Attempting to mount IMFS file system at c/y/j123\n"); 187 status = mount( 188 &mt_entry, 189 &IMFS_ops, 190 "RO", 191 NULL, 192 "c/y/j123" ); 193 assert( status == 0 ); 194 195 status = mkdir( "c/y/j123/new_dir", S_IRUSR ); 196 assert( status == -1 ); 197 198 printf("Unmount c/y/j123\n"); 199 status = unmount( "c/y/j123" ); 200 assert( status == 0 ); 201 */ 202 203 printf(" File system type should be invalid.\n"); 211 212 /* 213 * Mount a NULL filesystem and verify it fails. 214 */ 215 216 printf("Mount a NULL file system and verify EINVAL\n"); 204 217 status = mount( 205 218 &mt_entry, … … 211 224 assert( errno == EINVAL ); 212 225 213 printf("Attempting to mount IMFS file system at /c/y/my_mount_point \n"); 226 /* 227 * Verify mount with option RA fails with EINVAL 228 */ 229 230 printf("mount with option RA should fail with EINVAL\n"); 231 status = mount( 232 &mt_entry, 233 &IMFS_ops, 234 "RA", 235 NULL, 236 "/c/y/my_mount_point" ); 237 assert( status == -1 ); 238 assert( errno == EINVAL ); 239 240 /* 241 * Mount a Read Only File system. 242 */ 243 244 printf("Mount a Read Only filesystem at /c/y/my_mount_point \n"); 214 245 status = mount( 215 246 &mt_entry, … … 223 254 } 224 255 else { 225 printf("3rd file system successfully mounted at /c/y/my_mount_point \n"); 226 } 227 256 printf("Read only file system successfully mounted at /c/y/my_mount_point \n"); 257 } 258 259 /* 260 * Create a directory that passes through the read only file system. 261 */ 262 263 printf("create c/y/my_mount_point/../../y/my_mount_point/new_dir\n"); 228 264 status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU ); 229 265 assert( status == 0 ); 230 231 266 status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf ); 232 267 assert( status == 0 ); … … 234 269 assert( status == 0 ); 235 270 236 printf("Mount another file system at /c/y/my_mount_point should fail with EBUSY\n"); 271 /* 272 * Attempt to mount a second file system at a used mount point. 273 */ 274 275 printf("Verify a mount point retruns EBUSY for another mount\n"); 237 276 status = mount( 238 277 &mt_entry, … … 244 283 assert( errno == EBUSY); 245 284 246 printf("Mount /b/my_file should fail in rtems_filesystem_evaluate_path\n"); 285 /* 286 * Attempt to mount at a file. 287 */ 288 289 printf("Mount on a file should fail with ENOTDIR\n"); 247 290 status = mount( 248 291 &mt_entry, … … 252 295 "/b/my_file" ); 253 296 assert( status == -1 ); 297 assert( errno == ENOTDIR ); 298 254 299 255 printf("Unmount /c/y/my_mount_point\n"); 256 status = unmount( "/c/y/my_mount_point" ); 257 assert( status == 0 ); 258 259 /* What's wrong with this? It should be causing failure at unmount.c:87, 260 * instead, it's returning a status of 0. 261 */ 262 263 printf("Mount /c/y/my_mount_point to cause error\n"); 264 status = mount( 265 &mt_entry, 266 &IMFS_ops, 267 "RO", 268 NULL, 269 "/c/y/my_mount_point" ); 270 271 assert( status == 0 ); 300 /* 301 * Verify we cannot unmount a file system while we are in it. 302 */ 303 304 printf("Create and chdir to /c/y/my_mount_point/mydir\n"); 272 305 status = mkdir( "/c/y/my_mount_point/mydir", 0777); 273 306 assert( status == 0 ); … … 281 314 assert( errno == EBUSY ); 282 315 316 /* 317 * Chdir to root and verify we can unmount the file system now. 318 */ 319 320 printf("chdir to / and verify we can unmount /c/y/my_mount_point\n"); 283 321 status = chdir( "/" ); 284 322 assert( status == 0 ); … … 288 326 assert( status == 0 ); 289 327 290 printf(" unmount /b/mount_point should fail\n"); 328 /* 329 * Attempt to unmount a directory that does not exist. 330 */ 331 332 printf(" unmount /b/mount_point should fail with EINVAL\n"); 291 333 status = unmount( "/b/mount_point" ); 292 334 assert( status == -1 ); 335 assert( errno == ENOENT ); 336 337 /* 338 * Remount the filesystem. 339 */ 293 340 294 341 printf("Mount /c/y/my_mount_point\n"); … … 301 348 assert( status == 0 ); 302 349 303 /* XXX - There is an error in open that calculates incorrect mode. */ 350 /* 351 * Create a file and directory then open the directory. 352 * Verify unmount will return EBUSY while directory is open. 353 */ 354 304 355 printf("Create and open /c/y/my_mount_point/my_file\n"); 305 fd = open( "/c/y/my_mount_point/my_file", O_CREAT );356 fd = open( "/c/y/my_mount_point/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 306 357 assert( fd != -1 ); 307 358 status = close( fd ); … … 317 368 status = unmount( "/c/y/my_mount_point" ); 318 369 assert( status == -1 ); 370 assert( errno == EBUSY ); 319 371 320 372 printf("Close /c/y/my_mount_point/my_dir\n"); … … 322 374 assert( status == 0 ); 323 375 324 printf("Unmount /c/y/my_mount_point/d should fail at 107\n"); 325 status = unmount( "/c/y/my_mount_point/d" ); 326 assert( status == -1 ); 376 /* 377 * Attempt to unmount a directory that is not a mount point. 378 */ 379 380 printf("Unmount /c/y/my_mount_point/my_dir\n"); 381 status = unmount( "/c/y/my_mount_point/my_dir" ); 382 assert( status == -1 ); 383 assert( errno == EACCES ); 384 385 /* 386 * Verify a file system can not be unmounted with a mounted file system 387 * in it. 388 */ 389 390 printf("Mount a file system at /c/y/my_mount_point/my_dir\n"); 391 status = mount( 392 &mt_entry, 393 &IMFS_ops, 394 "RW", 395 NULL, 396 "/c/y/my_mount_point/my_dir"); 397 assert( status == 0 ); 398 399 printf("unmount /c/y/my_mount_point should fail with EBUSY\n"); 400 status = unmount( "/c/y/my_mount_point" ); 401 assert( status == -1 ); 402 assert( errno == EBUSY ); 403 404 /* 405 * Verify you cannot create a hard link across mounted file systems. 406 */ 407 408 printf("Verify a hard link across filesystems fails with EXDEV\n"); 409 status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU ); 410 assert( status == 0 ); 411 412 status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); 413 assert( status == -1 ); 414 assert( errno == EXDEV ); 415 416 /* 417 * Create a symbolic link across mountpoints. 418 */ 419 420 printf("Verify a symbolic link across file systems works\n"); 421 status = symlink( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); 422 assert( status == 0 ); 423 status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf ); 424 assert( status == 0 ); 425 426 printf("unmount /c/y/my_mount_point/my_dir\n"); 427 status = unmount( "/c/y/my_mount_point/my_dir" ); 428 assert( status == 0 ); 429 430 /* 431 * Verify symblic link no longer works. 432 */ 433 434 printf("Verify the symbolic link now fails\n"); 435 status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf ); 436 assert( status != 0 ); 327 437 328 438 printf("unmount /c/y/my_mount_point\n"); 329 439 status = unmount( "/c/y/my_mount_point" ); 330 440 assert( status == 0 ); 331 332 printf("mount with option RA should fail with EINVAL\n");333 status = mount(334 &mt_entry,335 &IMFS_ops,336 "RA",337 NULL,338 "/c/y/my_mount_point" );339 assert( status == -1 );340 341 printf("Mount a file system at /c/y/my_mount_point/my_dir\n");342 status = mount(343 &mt_entry,344 &IMFS_ops,345 "RW",346 NULL,347 "/c/y/my_mount_point/my_dir");348 assert( status == 0 );349 350 printf("unmount /c/y/my_mount_point/my_dir should fail in ");351 printf("file_systems_below_this_mountpoint \n");352 status = unmount( "/c/y/my_mount_point/my_dir" );353 assert( status == 0 );354 355 printf("mount first filesystem /c/y/my_mount_point/\n");356 status = mount(357 &mt_entry,358 &IMFS_ops,359 "RW",360 NULL,361 "/c/y/my_mount_point" );362 assert( status == 0 );363 364 printf("\nmkdir /c/y/my_mount_point/my_dir\n");365 status = mkdir( "/c/y/my_mount_point/my_dir", S_IRWXU );366 assert( status == 0 );367 368 printf("Mount another filesystem at /c/y/my_mount_point/my_dir\n");369 status = mount(370 &mt_entry,371 &IMFS_ops,372 "RW",373 NULL,374 "/c/y/my_mount_point/my_dir");375 assert( status == 0 );376 377 status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU );378 assert( status != -1 );379 380 status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );381 assert( status == -1 );382 383 printf("unmount /c/y/my_mount_point\n");384 status = unmount( "/c/y/my_mount_point" );385 assert( status == -1 );386 387 printf("unmount /c/y/my_mount_point/my_dir\n");388 status = unmount( "/c/y/my_mount_point/my_dir" );389 assert( status == 0 );390 391 printf("unmount /c/y/my_mount_point\n");392 status = unmount( "/c/y/my_mount_point" );393 assert( status == 0 );394 395 /* printf("Mount /c/y/my_mount_point\n");396 status = mount(397 &mt_entry,398 &IMFS_ops,399 "RO",400 NULL,401 "/c/y/my_mount_point" );402 assert( status == 0 );403 */404 441 405 442 printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" ); -
c/src/tests/psxtests/psxreaddir/test.c
r5b8e885d rc2f9b97 206 206 } 207 207 208 /* 209 * Create files under many and open the directory. 210 */ 211 212 printf("Create a lot of files\n"); 208 213 status = mkdir( "/many", 0x1c0 ); 209 214 status = chdir( "/many" ); 210 for (i = 0; i<=44; i++) { 211 fd = open (many_files[i], O_CREAT); 215 for (i = 0; i<44; i++) { 216 printf(" Create %s\n", many_files[i]); 217 fd = open (many_files[i], O_CREAT, S_IRWXU); 212 218 close (fd); 213 219 } 220 printf("Open /many and print the directory\n"); 214 221 directory_not = opendir( "/many" ); 215 222 printdir ( directory_not ); 216 223 d_not = readdir( directory_not ); 217 224 218 fd = open ("/b/my_file", O_CREAT); 225 printf("open /b/myfile\n"); 226 fd = open ("/b/my_file", O_CREAT, S_IRWXU); 219 227 assert( fd != -1 ); 220 228 close (fd); 221 229 230 printf("scandir a file status: "); 222 231 status = scandir( 223 232 "/b/my_file", … … 226 235 NULL 227 236 ); 228 229 fd = open( "/b/new_file", O_CREAT ); 237 printf("%d\n", status); 238 239 printf("Open /b/new_file\n"); 240 fd = open( "/b/new_file", O_CREAT, S_IRWXU ); 230 241 assert( fd != -1 ); 231 242 243 printf("fcntl F_SETFD should return 0\n"); 232 244 status = fcntl( fd, F_SETFD, 1 ); 233 245 assert( status == 0 ); 246 247 printf("fcntl F_SETFD should return 1\n"); 234 248 status = fcntl( fd, F_GETFD, 1 ); 235 249 assert( status == 1 ); 236 250 237 status = fcntl( fd, F_DUPFD, 1 ); 238 assert ( status == -1 ); 239 251 printf("fcntl F_DUPFD should return 0\n"); 252 status = fcntl( fd, F_DUPFD, 0 ); 253 assert ( status == 0 ); 254 255 printf("fcntl F_GETFL should return -1\n"); 240 256 status = fcntl( fd, F_GETFL, 1 ); 241 257 assert ( status == -1 ); 242 258 259 printf("fcntl F_SETFL should return -1\n"); 243 260 status = fcntl( fd, F_SETFL, 1 ); 244 261 assert ( status == -1 ); 245 262 263 printf("fcntl F_GETLK should return -1\n"); 246 264 status = fcntl( fd, F_GETLK, 1 ); 247 265 assert ( status == -1 ); 248 266 267 printf("fcntl F_SETLK should return -1\n"); 249 268 status = fcntl( fd, F_SETLK, 1 ); 250 269 assert ( status == -1 ); 251 270 271 printf("fcntl F_SETLKW should return -1\n"); 252 272 status = fcntl( fd, F_SETLKW, 1 ); 253 273 assert ( status == -1 ); 254 274 275 printf("fcntl F_SETOWN should return -1\n"); 255 276 status = fcntl( fd, F_SETOWN, 1 ); 256 277 assert ( status == -1 ); 257 278 279 printf("fcntl F_GETOWN should return -1\n"); 258 280 status = fcntl( fd, F_GETOWN, 1 ); 259 281 assert ( status == -1 ); 260 282 283 printf("fcntl invalid argument should return -1\n"); 261 284 status = fcntl( fd, 0xb, 1 ); 285 printf("Status %d\n",status); 262 286 assert( status == -1 ); 263 287 288 printf("opendir and readdir /b/myfile\n"); 264 289 directory_not = opendir ("/b/my_file"); 265 290 d_not = readdir(directory_not); 266 291 292 printf("opendir and readdir\n"); 267 293 directory_not = opendir ("/a"); 268 294 d_not = readdir (directory_not); 269 295 296 printf("chdir to /b/myfile\n"); 270 297 status = chdir ("/b/my_file"); 271 298 assert (status == -1); … … 276 303 status,(int)s.st_size); 277 304 278 puts( "\nOpen ingdirectory /" );305 puts( "\nOpen and print directory /" ); 279 306 directory = opendir("/"); 280 281 307 assert( directory ); 282 283 308 printdir(directory); 284 309 … … 306 331 printf( "\nOpening directory /c/y\n" ); 307 332 directory3 = opendir("/c/y"); 308 309 333 assert( directory3 ); 310 311 334 printdir(directory3); 312 335 status = closedir( directory3 ); -
testsuites/psxtests/psx13/psx13.scn
r5b8e885d rc2f9b97 1 2 Files initialized successfully. 3 Testing device_lseek()... Success. 4 Testing dup()............ Success. 5 Testing dup2()........... Success. 6 Testing fdatasync()...... Success. 7 Testing umask().......... Success. 8 Testing utime().......... Success. 9 Testing pipe()........... Success. 10 Testing fsync().......... Success. 11 Testing pathconf()....... Success. 12 Testing fpathconf()...... Success. 13 14 15 *** END OF TEST PSX13 *** -
testsuites/psxtests/psx13/test.c
r5b8e885d rc2f9b97 162 162 if (fd2 != -1) { 163 163 164 fcntl( F_SETFL, fd1, O_APPEND);165 flags = fcntl( F_GETFL, fd2);164 fcntl(fd1, F_SETFL, O_APPEND); 165 flags = fcntl(fd2, F_GETFL); 166 166 167 167 close (fd1); … … 215 215 if (error != -1) { 216 216 217 fcntl( F_SETFL, fd1, O_APPEND);218 flags = fcntl( F_GETFL, fd1);217 fcntl(fd1, F_SETFL, O_APPEND); 218 flags = fcntl(fd1, F_GETFL); 219 219 220 220 flags = (flags & O_APPEND); … … 601 601 { 602 602 if (InitFiles() == TRUE) { 603 p uts("\nFiles initialized successfully.\n");604 605 p uts ("Testing device_lseek()...");603 printf ("\nFiles initialized successfully.\n"); 604 605 printf ("Testing device_lseek()... "); 606 606 if (DeviceLSeekTest() == TRUE) 607 p uts("Success.\n");608 else 609 p uts("Failed!!!\n");610 611 p uts ("Testing dup()...");607 printf ("Success.\n"); 608 else 609 printf ("Failed!!!\n"); 610 611 printf ("Testing dup()............ "); 612 612 if (DupTest() == TRUE) 613 p uts("Success.\n");614 else 615 p uts("Failed!!!\n");613 printf ("Success.\n"); 614 else 615 printf ("Failed!!!\n"); 616 616 617 p uts ("Testing dup2()...");617 printf ("Testing dup2()........... "); 618 618 if (Dup2Test() == TRUE) 619 p uts("Success.\n");620 else 621 p uts("Failed!!!\n");622 623 p uts ("Testing fdatasync()...");619 printf ("Success.\n"); 620 else 621 printf ("Failed!!!\n"); 622 623 printf ("Testing fdatasync()...... "); 624 624 if (FDataSyncTest() == TRUE) 625 p uts("Success.\n");626 else 627 p uts("Failed!!!\n");628 629 p uts ("Testing umask()...");625 printf ("Success.\n"); 626 else 627 printf ("Failed!!!\n"); 628 629 printf ("Testing umask().......... "); 630 630 if (UMaskTest() == TRUE) 631 p uts("Success.\n");632 else 633 p uts("Failed!!!\n");634 635 p uts ("Testing utime()...");631 printf ("Success.\n"); 632 else 633 printf ("Failed!!!\n"); 634 635 printf ("Testing utime().......... "); 636 636 if (UTimeTest() == TRUE) 637 p uts("Success.\n");638 else 639 p uts("Failed!!!\n");640 641 p uts ("Testing pipe()...");637 printf ("Success.\n"); 638 else 639 printf ("Failed!!!\n"); 640 641 printf ("Testing pipe()........... "); 642 642 if (PipeTest() == TRUE) 643 p uts("Success.\n");644 else 645 p uts("Failed!!!\n");646 647 p uts ("Testing fsync()...");643 printf ("Success.\n"); 644 else 645 printf ("Failed!!!\n"); 646 647 printf ("Testing fsync().......... "); 648 648 if (FSyncTest() == TRUE) 649 p uts("Success.\n");650 else 651 p uts("Failed!!!\n");652 653 p uts ("Testing pathconf()...");649 printf ("Success.\n"); 650 else 651 printf ("Failed!!!\n"); 652 653 printf ("Testing pathconf()....... "); 654 654 if (PathConfTest() == TRUE) 655 p uts("Success.\n");656 else 657 p uts("Failed!!!\n");655 printf ("Success.\n"); 656 else 657 printf ("Failed!!!\n"); 658 658 659 p uts ("Testing fpathconf()...");659 printf ("Testing fpathconf()...... "); 660 660 if (FPathConfTest() == TRUE) 661 p uts("Success.\n");662 else 663 p uts("Failed!!!\n");661 printf ("Success.\n"); 662 else 663 printf ("Failed!!!\n"); 664 664 } 665 665 666 666 667 667 else 668 puts ("\n\nError opening files for write!!!!\n"); 669 670 puts( "\n\n*** XXX ***" ); 671 672 puts( "\n\n*** END OF TEST PSX13 ***" ); 668 printf ("\n\nError opening files for write!!!!\n"); 669 670 printf( "\n\n*** END OF TEST PSX13 ***" ); 673 671 exit(0); 674 672 } -
testsuites/psxtests/psxfile01/test.c
r5b8e885d rc2f9b97 239 239 status = rmdir ("/fred"); 240 240 assert (status == -1); 241 assert( errno == ENOENT ); 241 242 242 243 status = mknod( "/dev/test_console", S_IFCHR, 0LL ); -
testsuites/psxtests/psxmount/psxmount.scn
r5b8e885d rc2f9b97 1 2 3 *** MOUNT/UNMOUNT TEST *** 4 5 chdir to the root directory 6 chdir() status : 0 7 8 9 Creating a series of directories under / 10 Creating : a 0 0 Success 11 Creating : b 0 0 Success 12 Creating : c 0 0 Success 13 Creating : d 0 0 Success 14 Creating : e 0 0 Success 15 Creating : f 0 0 Success 16 Creating : c/y 0 0 Success 17 Creating : c/z 0 0 Success 18 Creating : c/x 0 0 Success 19 Creating : c/y/a3333 0 0 Success 20 Creating : c/y/j123 0 0 Success 21 Creating : c/y/my_mount_point 0 0 Success 22 Creating : c/y/my_mount_point/my_dir 0 0 Success 23 Creating : c/z/my_mount_point 0 0 Success 24 create /b/my_file 25 Verify /b/my_file 26 create c/y/my_mount_point/my_dir/d 27 Verify c/y/my_mount_point/my_dir/d 28 Attempting to mount IMFS file system at /c/z/my_mount_point 29 2nd file system successfully mounted at /c/z/my_mount_point 30 31 chdir to /c/z/my_mount_point. 32 chdir() status : 0 33 34 35 Creating a series of directories under /c/z/my_mount_point 36 Creating: a 0 2 Success 37 Creating: b 0 2 Success 38 Creating: c 0 2 Success 39 Creating: d 0 2 Success 40 Creating: e 0 2 Success 41 Creating: f 0 2 Success 42 Creating: c/y 0 2 Success 43 Creating: c/z 0 2 Success 44 Creating: c/x 0 2 Success 45 Creating: c/y/a3333 0 2 Success 46 Creating: c/y/j123 0 2 Success 47 Creating: c/y/my_mount_point 0 2 Success 48 Creating: c/y/my_mount_point/my_dir 0 2 Success 49 Creating: c/y/my_mount_point/my_dir/d 0 2 Success 50 Creating: c/z/my_mount_point 0 2 Success 51 Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g 0 2 Success 52 53 chdir to / 54 chdir() status : 0 55 56 Unmount status: 0 57 Mount a NULL file system and verify EINVAL 58 mount with option RA should fail with EINVAL 59 Mount a Read Only filesystem at /c/y/my_mount_point 60 Read only file system successfully mounted at /c/y/my_mount_point 61 create c/y/my_mount_point/../../y/my_mount_point/new_dir 62 Verify a mount point retruns EBUSY for another mount 63 Mount on a file should fail with ENOTDIR 64 Create and chdir to /c/y/my_mount_point/mydir 65 unmount of /c/y/my_mount_point should fail with EBUSY 66 chdir to / and verify we can unmount /c/y/my_mount_point 67 unmount /c/y/my_mount_point 68 unmount /b/mount_point should fail with EINVAL 69 Mount /c/y/my_mount_point 70 Create and open /c/y/my_mount_point/my_file 71 72 mkdir /c/y/my_mount_point/my_dir 73 Open /c/y/my_mount_point/my_dir 74 Unmount /c/y/my_mount_point should fail with EBUSY 75 Close /c/y/my_mount_point/my_dir 76 Unmount /c/y/my_mount_point/my_dir 77 Mount a file system at /c/y/my_mount_point/my_dir 78 unmount /c/y/my_mount_point should fail with EBUSY 79 Verify a hard link across filesystems fails with EXDEV 80 Verify a symbolic link across file systems works 81 unmount /c/y/my_mount_point/my_dir 82 Verify the symbolic link now fails 83 unmount /c/y/my_mount_point 84 85 86 *** END OF MOUNT/UNMOUNT TEST *** -
testsuites/psxtests/psxmount/test.c
r5b8e885d rc2f9b97 100 100 printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" ); 101 101 102 /* 103 * Change directory to the root and create files under 104 * the base file system. 105 */ 106 102 107 printf( "\nchdir to the root directory\n" ); 103 108 status = chdir( "/" ); … … 109 114 { 110 115 status = mkdir( dnames[i], 0777 ); 111 printf("Creating directory: %s%d %d ", dnames[i], status, errno );116 printf("Creating : %25s %d %d ", dnames[i], status, errno ); 112 117 if ( status == 0 ) 113 118 printf(" Success\n"); … … 118 123 } 119 124 125 /* 126 * Create a Files with all rwx for others group and user. Verify 127 * the created file. 128 */ 129 130 printf("create /b/my_file\n"); 120 131 fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 132 assert( fd != 0 ); 121 133 close (fd); 134 135 printf("Verify /b/my_file\n"); 122 136 fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO); 137 assert( fd != 0 ); 123 138 close( fd ); 124 139 140 141 printf("create c/y/my_mount_point/my_dir/d\n"); 125 142 fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 143 assert( fd != 0 ); 126 144 close (fd); 145 146 printf("Verify c/y/my_mount_point/my_dir/d\n"); 127 147 fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO); 148 assert( fd != 0 ); 128 149 close( fd ); 150 151 /* 152 * Mount an the IMFS file system on the base file system. 153 */ 129 154 130 155 printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n"); … … 143 168 } 144 169 145 printf( "\nchdir to /c/z/my_mount_point the mount point of the \n" ); 146 printf( "second file system \n" ); 170 /* 171 * Change directory to the mount point and create a group of files under 172 * the mounted file system. 173 */ 174 175 printf( "\nchdir to /c/z/my_mount_point.\n" ); 147 176 status = chdir( "/c/z/my_mount_point" ); 148 177 printf( "chdir() status : %d\n\n", status ); … … 153 182 { 154 183 status = mkdir( fnames[i], 0777 ); 155 printf("Creating directory: %s%d %d ", fnames[i], status, errno );184 printf("Creating: %46s %d %d ", fnames[i], status, errno ); 156 185 if ( status == 0 ) 157 186 printf(" Success\n"); … … 168 197 } 169 198 170 printf( "\nchdir to / the mount point of the first file system\n" );199 printf( "\nchdir to /\n" ); 171 200 status = chdir( "/" ); 172 201 printf( "chdir() status : %d\n\n", status ); … … 180 209 printf( " %d\n", status ); 181 210 182 /* 183 status = chmod( "c/y/j123", S_IRUSR ); 184 assert( status == 0 ); 185 186 printf("Attempting to mount IMFS file system at c/y/j123\n"); 187 status = mount( 188 &mt_entry, 189 &IMFS_ops, 190 "RO", 191 NULL, 192 "c/y/j123" ); 193 assert( status == 0 ); 194 195 status = mkdir( "c/y/j123/new_dir", S_IRUSR ); 196 assert( status == -1 ); 197 198 printf("Unmount c/y/j123\n"); 199 status = unmount( "c/y/j123" ); 200 assert( status == 0 ); 201 */ 202 203 printf(" File system type should be invalid.\n"); 211 212 /* 213 * Mount a NULL filesystem and verify it fails. 214 */ 215 216 printf("Mount a NULL file system and verify EINVAL\n"); 204 217 status = mount( 205 218 &mt_entry, … … 211 224 assert( errno == EINVAL ); 212 225 213 printf("Attempting to mount IMFS file system at /c/y/my_mount_point \n"); 226 /* 227 * Verify mount with option RA fails with EINVAL 228 */ 229 230 printf("mount with option RA should fail with EINVAL\n"); 231 status = mount( 232 &mt_entry, 233 &IMFS_ops, 234 "RA", 235 NULL, 236 "/c/y/my_mount_point" ); 237 assert( status == -1 ); 238 assert( errno == EINVAL ); 239 240 /* 241 * Mount a Read Only File system. 242 */ 243 244 printf("Mount a Read Only filesystem at /c/y/my_mount_point \n"); 214 245 status = mount( 215 246 &mt_entry, … … 223 254 } 224 255 else { 225 printf("3rd file system successfully mounted at /c/y/my_mount_point \n"); 226 } 227 256 printf("Read only file system successfully mounted at /c/y/my_mount_point \n"); 257 } 258 259 /* 260 * Create a directory that passes through the read only file system. 261 */ 262 263 printf("create c/y/my_mount_point/../../y/my_mount_point/new_dir\n"); 228 264 status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU ); 229 265 assert( status == 0 ); 230 231 266 status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf ); 232 267 assert( status == 0 ); … … 234 269 assert( status == 0 ); 235 270 236 printf("Mount another file system at /c/y/my_mount_point should fail with EBUSY\n"); 271 /* 272 * Attempt to mount a second file system at a used mount point. 273 */ 274 275 printf("Verify a mount point retruns EBUSY for another mount\n"); 237 276 status = mount( 238 277 &mt_entry, … … 244 283 assert( errno == EBUSY); 245 284 246 printf("Mount /b/my_file should fail in rtems_filesystem_evaluate_path\n"); 285 /* 286 * Attempt to mount at a file. 287 */ 288 289 printf("Mount on a file should fail with ENOTDIR\n"); 247 290 status = mount( 248 291 &mt_entry, … … 252 295 "/b/my_file" ); 253 296 assert( status == -1 ); 297 assert( errno == ENOTDIR ); 298 254 299 255 printf("Unmount /c/y/my_mount_point\n"); 256 status = unmount( "/c/y/my_mount_point" ); 257 assert( status == 0 ); 258 259 /* What's wrong with this? It should be causing failure at unmount.c:87, 260 * instead, it's returning a status of 0. 261 */ 262 263 printf("Mount /c/y/my_mount_point to cause error\n"); 264 status = mount( 265 &mt_entry, 266 &IMFS_ops, 267 "RO", 268 NULL, 269 "/c/y/my_mount_point" ); 270 271 assert( status == 0 ); 300 /* 301 * Verify we cannot unmount a file system while we are in it. 302 */ 303 304 printf("Create and chdir to /c/y/my_mount_point/mydir\n"); 272 305 status = mkdir( "/c/y/my_mount_point/mydir", 0777); 273 306 assert( status == 0 ); … … 281 314 assert( errno == EBUSY ); 282 315 316 /* 317 * Chdir to root and verify we can unmount the file system now. 318 */ 319 320 printf("chdir to / and verify we can unmount /c/y/my_mount_point\n"); 283 321 status = chdir( "/" ); 284 322 assert( status == 0 ); … … 288 326 assert( status == 0 ); 289 327 290 printf(" unmount /b/mount_point should fail\n"); 328 /* 329 * Attempt to unmount a directory that does not exist. 330 */ 331 332 printf(" unmount /b/mount_point should fail with EINVAL\n"); 291 333 status = unmount( "/b/mount_point" ); 292 334 assert( status == -1 ); 335 assert( errno == ENOENT ); 336 337 /* 338 * Remount the filesystem. 339 */ 293 340 294 341 printf("Mount /c/y/my_mount_point\n"); … … 301 348 assert( status == 0 ); 302 349 303 /* XXX - There is an error in open that calculates incorrect mode. */ 350 /* 351 * Create a file and directory then open the directory. 352 * Verify unmount will return EBUSY while directory is open. 353 */ 354 304 355 printf("Create and open /c/y/my_mount_point/my_file\n"); 305 fd = open( "/c/y/my_mount_point/my_file", O_CREAT );356 fd = open( "/c/y/my_mount_point/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); 306 357 assert( fd != -1 ); 307 358 status = close( fd ); … … 317 368 status = unmount( "/c/y/my_mount_point" ); 318 369 assert( status == -1 ); 370 assert( errno == EBUSY ); 319 371 320 372 printf("Close /c/y/my_mount_point/my_dir\n"); … … 322 374 assert( status == 0 ); 323 375 324 printf("Unmount /c/y/my_mount_point/d should fail at 107\n"); 325 status = unmount( "/c/y/my_mount_point/d" ); 326 assert( status == -1 ); 376 /* 377 * Attempt to unmount a directory that is not a mount point. 378 */ 379 380 printf("Unmount /c/y/my_mount_point/my_dir\n"); 381 status = unmount( "/c/y/my_mount_point/my_dir" ); 382 assert( status == -1 ); 383 assert( errno == EACCES ); 384 385 /* 386 * Verify a file system can not be unmounted with a mounted file system 387 * in it. 388 */ 389 390 printf("Mount a file system at /c/y/my_mount_point/my_dir\n"); 391 status = mount( 392 &mt_entry, 393 &IMFS_ops, 394 "RW", 395 NULL, 396 "/c/y/my_mount_point/my_dir"); 397 assert( status == 0 ); 398 399 printf("unmount /c/y/my_mount_point should fail with EBUSY\n"); 400 status = unmount( "/c/y/my_mount_point" ); 401 assert( status == -1 ); 402 assert( errno == EBUSY ); 403 404 /* 405 * Verify you cannot create a hard link across mounted file systems. 406 */ 407 408 printf("Verify a hard link across filesystems fails with EXDEV\n"); 409 status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU ); 410 assert( status == 0 ); 411 412 status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); 413 assert( status == -1 ); 414 assert( errno == EXDEV ); 415 416 /* 417 * Create a symbolic link across mountpoints. 418 */ 419 420 printf("Verify a symbolic link across file systems works\n"); 421 status = symlink( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" ); 422 assert( status == 0 ); 423 status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf ); 424 assert( status == 0 ); 425 426 printf("unmount /c/y/my_mount_point/my_dir\n"); 427 status = unmount( "/c/y/my_mount_point/my_dir" ); 428 assert( status == 0 ); 429 430 /* 431 * Verify symblic link no longer works. 432 */ 433 434 printf("Verify the symbolic link now fails\n"); 435 status = stat( "/c/y/my_mount_point/my_dir/my_link", &statbuf ); 436 assert( status != 0 ); 327 437 328 438 printf("unmount /c/y/my_mount_point\n"); 329 439 status = unmount( "/c/y/my_mount_point" ); 330 440 assert( status == 0 ); 331 332 printf("mount with option RA should fail with EINVAL\n");333 status = mount(334 &mt_entry,335 &IMFS_ops,336 "RA",337 NULL,338 "/c/y/my_mount_point" );339 assert( status == -1 );340 341 printf("Mount a file system at /c/y/my_mount_point/my_dir\n");342 status = mount(343 &mt_entry,344 &IMFS_ops,345 "RW",346 NULL,347 "/c/y/my_mount_point/my_dir");348 assert( status == 0 );349 350 printf("unmount /c/y/my_mount_point/my_dir should fail in ");351 printf("file_systems_below_this_mountpoint \n");352 status = unmount( "/c/y/my_mount_point/my_dir" );353 assert( status == 0 );354 355 printf("mount first filesystem /c/y/my_mount_point/\n");356 status = mount(357 &mt_entry,358 &IMFS_ops,359 "RW",360 NULL,361 "/c/y/my_mount_point" );362 assert( status == 0 );363 364 printf("\nmkdir /c/y/my_mount_point/my_dir\n");365 status = mkdir( "/c/y/my_mount_point/my_dir", S_IRWXU );366 assert( status == 0 );367 368 printf("Mount another filesystem at /c/y/my_mount_point/my_dir\n");369 status = mount(370 &mt_entry,371 &IMFS_ops,372 "RW",373 NULL,374 "/c/y/my_mount_point/my_dir");375 assert( status == 0 );376 377 status = mkdir( "/c/y/my_mount_point/my_dir2", S_IRWXU );378 assert( status != -1 );379 380 status = link( "/c/y/my_mount_point/my_dir2", "/c/y/my_mount_point/my_dir/my_link" );381 assert( status == -1 );382 383 printf("unmount /c/y/my_mount_point\n");384 status = unmount( "/c/y/my_mount_point" );385 assert( status == -1 );386 387 printf("unmount /c/y/my_mount_point/my_dir\n");388 status = unmount( "/c/y/my_mount_point/my_dir" );389 assert( status == 0 );390 391 printf("unmount /c/y/my_mount_point\n");392 status = unmount( "/c/y/my_mount_point" );393 assert( status == 0 );394 395 /* printf("Mount /c/y/my_mount_point\n");396 status = mount(397 &mt_entry,398 &IMFS_ops,399 "RO",400 NULL,401 "/c/y/my_mount_point" );402 assert( status == 0 );403 */404 441 405 442 printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" ); -
testsuites/psxtests/psxreaddir/test.c
r5b8e885d rc2f9b97 206 206 } 207 207 208 /* 209 * Create files under many and open the directory. 210 */ 211 212 printf("Create a lot of files\n"); 208 213 status = mkdir( "/many", 0x1c0 ); 209 214 status = chdir( "/many" ); 210 for (i = 0; i<=44; i++) { 211 fd = open (many_files[i], O_CREAT); 215 for (i = 0; i<44; i++) { 216 printf(" Create %s\n", many_files[i]); 217 fd = open (many_files[i], O_CREAT, S_IRWXU); 212 218 close (fd); 213 219 } 220 printf("Open /many and print the directory\n"); 214 221 directory_not = opendir( "/many" ); 215 222 printdir ( directory_not ); 216 223 d_not = readdir( directory_not ); 217 224 218 fd = open ("/b/my_file", O_CREAT); 225 printf("open /b/myfile\n"); 226 fd = open ("/b/my_file", O_CREAT, S_IRWXU); 219 227 assert( fd != -1 ); 220 228 close (fd); 221 229 230 printf("scandir a file status: "); 222 231 status = scandir( 223 232 "/b/my_file", … … 226 235 NULL 227 236 ); 228 229 fd = open( "/b/new_file", O_CREAT ); 237 printf("%d\n", status); 238 239 printf("Open /b/new_file\n"); 240 fd = open( "/b/new_file", O_CREAT, S_IRWXU ); 230 241 assert( fd != -1 ); 231 242 243 printf("fcntl F_SETFD should return 0\n"); 232 244 status = fcntl( fd, F_SETFD, 1 ); 233 245 assert( status == 0 ); 246 247 printf("fcntl F_SETFD should return 1\n"); 234 248 status = fcntl( fd, F_GETFD, 1 ); 235 249 assert( status == 1 ); 236 250 237 status = fcntl( fd, F_DUPFD, 1 ); 238 assert ( status == -1 ); 239 251 printf("fcntl F_DUPFD should return 0\n"); 252 status = fcntl( fd, F_DUPFD, 0 ); 253 assert ( status == 0 ); 254 255 printf("fcntl F_GETFL should return -1\n"); 240 256 status = fcntl( fd, F_GETFL, 1 ); 241 257 assert ( status == -1 ); 242 258 259 printf("fcntl F_SETFL should return -1\n"); 243 260 status = fcntl( fd, F_SETFL, 1 ); 244 261 assert ( status == -1 ); 245 262 263 printf("fcntl F_GETLK should return -1\n"); 246 264 status = fcntl( fd, F_GETLK, 1 ); 247 265 assert ( status == -1 ); 248 266 267 printf("fcntl F_SETLK should return -1\n"); 249 268 status = fcntl( fd, F_SETLK, 1 ); 250 269 assert ( status == -1 ); 251 270 271 printf("fcntl F_SETLKW should return -1\n"); 252 272 status = fcntl( fd, F_SETLKW, 1 ); 253 273 assert ( status == -1 ); 254 274 275 printf("fcntl F_SETOWN should return -1\n"); 255 276 status = fcntl( fd, F_SETOWN, 1 ); 256 277 assert ( status == -1 ); 257 278 279 printf("fcntl F_GETOWN should return -1\n"); 258 280 status = fcntl( fd, F_GETOWN, 1 ); 259 281 assert ( status == -1 ); 260 282 283 printf("fcntl invalid argument should return -1\n"); 261 284 status = fcntl( fd, 0xb, 1 ); 285 printf("Status %d\n",status); 262 286 assert( status == -1 ); 263 287 288 printf("opendir and readdir /b/myfile\n"); 264 289 directory_not = opendir ("/b/my_file"); 265 290 d_not = readdir(directory_not); 266 291 292 printf("opendir and readdir\n"); 267 293 directory_not = opendir ("/a"); 268 294 d_not = readdir (directory_not); 269 295 296 printf("chdir to /b/myfile\n"); 270 297 status = chdir ("/b/my_file"); 271 298 assert (status == -1); … … 276 303 status,(int)s.st_size); 277 304 278 puts( "\nOpen ingdirectory /" );305 puts( "\nOpen and print directory /" ); 279 306 directory = opendir("/"); 280 281 307 assert( directory ); 282 283 308 printdir(directory); 284 309 … … 306 331 printf( "\nOpening directory /c/y\n" ); 307 332 directory3 = opendir("/c/y"); 308 309 333 assert( directory3 ); 310 311 334 printdir(directory3); 312 335 status = closedir( directory3 );
Note: See TracChangeset
for help on using the changeset viewer.