Changeset c2f9b97 in rtems


Ignore:
Timestamp:
Dec 3, 1998, 10:41:57 PM (21 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
0422a7a5
Parents:
5b8e885d
Message:

Cleaned up test.
Updated scn files to match present expected test output.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/psxtests/psx13/psx13.scn

    r5b8e885d rc2f9b97  
     1
     2Files initialized successfully.
     3Testing device_lseek()... Success.
     4Testing dup()............ Success.
     5Testing dup2()........... Success.
     6Testing fdatasync()...... Success.
     7Testing umask().......... Success.
     8Testing utime().......... Success.
     9Testing pipe()........... Success.
     10Testing fsync().......... Success.
     11Testing pathconf()....... Success.
     12Testing fpathconf()...... Success.
     13
     14
     15*** END OF TEST PSX13 ***
  • c/src/tests/psxtests/psx13/test.c

    r5b8e885d rc2f9b97  
    162162  if (fd2 != -1) {
    163163
    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);
    166166
    167167    close (fd1);
     
    215215  if (error != -1) {
    216216
    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);
    219219
    220220    flags = (flags & O_APPEND);
     
    601601{
    602602  if (InitFiles() == TRUE) {
    603     puts ("\nFiles initialized successfully.\n");
    604 
    605     puts ("Testing device_lseek()...");
     603    printf ("\nFiles initialized successfully.\n");
     604
     605    printf ("Testing device_lseek()... ");
    606606    if (DeviceLSeekTest() == TRUE)
    607       puts ("Success.\n");
    608     else
    609       puts ("Failed!!!\n");
    610 
    611     puts ("Testing dup()...");
     607      printf ("Success.\n");
     608    else
     609      printf ("Failed!!!\n");
     610
     611    printf ("Testing dup()............ ");
    612612    if (DupTest() == TRUE)
    613       puts ("Success.\n");
    614     else
    615       puts ("Failed!!!\n");
     613      printf ("Success.\n");
     614    else
     615      printf ("Failed!!!\n");
    616616   
    617     puts ("Testing dup2()...");
     617    printf ("Testing dup2()........... ");
    618618    if (Dup2Test() == TRUE)
    619       puts ("Success.\n");
    620     else
    621       puts ("Failed!!!\n");
    622 
    623     puts ("Testing fdatasync()...");
     619      printf ("Success.\n");
     620    else
     621      printf ("Failed!!!\n");
     622
     623    printf ("Testing fdatasync()...... ");
    624624    if (FDataSyncTest() == TRUE)
    625       puts ("Success.\n");
    626     else
    627       puts ("Failed!!!\n");
    628 
    629     puts ("Testing umask()...");
     625      printf ("Success.\n");
     626    else
     627      printf ("Failed!!!\n");
     628
     629    printf ("Testing umask().......... ");
    630630    if (UMaskTest() == TRUE)
    631       puts ("Success.\n");
    632     else
    633       puts ("Failed!!!\n");
    634 
    635    puts ("Testing utime()...");
     631      printf ("Success.\n");
     632    else
     633      printf ("Failed!!!\n");
     634
     635   printf ("Testing utime().......... ");
    636636    if (UTimeTest() == TRUE)
    637       puts ("Success.\n");
    638     else
    639       puts ("Failed!!!\n");
    640 
    641    puts ("Testing pipe()...");
     637      printf ("Success.\n");
     638    else
     639      printf ("Failed!!!\n");
     640
     641   printf ("Testing pipe()........... ");
    642642    if (PipeTest() == TRUE)
    643       puts ("Success.\n");
    644     else
    645       puts ("Failed!!!\n");
    646 
    647    puts ("Testing fsync()...");
     643      printf ("Success.\n");
     644    else
     645      printf ("Failed!!!\n");
     646
     647   printf ("Testing fsync().......... ");
    648648    if (FSyncTest() == TRUE)
    649       puts ("Success.\n");
    650     else
    651       puts ("Failed!!!\n");
    652 
    653    puts ("Testing pathconf()...");
     649      printf ("Success.\n");
     650    else
     651      printf ("Failed!!!\n");
     652
     653   printf ("Testing pathconf()....... ");
    654654    if (PathConfTest() == TRUE)
    655       puts ("Success.\n");
    656     else
    657       puts ("Failed!!!\n");
     655      printf ("Success.\n");
     656    else
     657      printf ("Failed!!!\n");
    658658 
    659    puts ("Testing fpathconf()...");
     659   printf ("Testing fpathconf()...... ");
    660660    if (FPathConfTest() == TRUE)
    661       puts ("Success.\n");
    662     else
    663       puts ("Failed!!!\n");
     661      printf ("Success.\n");
     662    else
     663      printf ("Failed!!!\n");
    664664  }
    665665
    666666
    667667  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 ***" );
    673671  exit(0);
    674672}
  • c/src/tests/psxtests/psxfile01/test.c

    r5b8e885d rc2f9b97  
    239239  status = rmdir ("/fred");
    240240  assert (status == -1);
     241  assert( errno == ENOENT );
    241242
    242243  status = mknod( "/dev/test_console", S_IFCHR, 0LL );
  • c/src/tests/psxtests/psxmount/psxmount.scn

    r5b8e885d rc2f9b97  
     1
     2
     3*** MOUNT/UNMOUNT TEST ***
     4
     5chdir to the root directory
     6chdir() status : 0
     7
     8
     9Creating a series of directories under /
     10Creating :                         a  0 0    Success
     11Creating :                         b  0 0    Success
     12Creating :                         c  0 0    Success
     13Creating :                         d  0 0    Success
     14Creating :                         e  0 0    Success
     15Creating :                         f  0 0    Success
     16Creating :                       c/y  0 0    Success
     17Creating :                       c/z  0 0    Success
     18Creating :                       c/x  0 0    Success
     19Creating :                 c/y/a3333  0 0    Success
     20Creating :                  c/y/j123  0 0    Success
     21Creating :        c/y/my_mount_point  0 0    Success
     22Creating : c/y/my_mount_point/my_dir  0 0    Success
     23Creating :        c/z/my_mount_point  0 0    Success
     24create /b/my_file
     25Verify /b/my_file
     26create c/y/my_mount_point/my_dir/d
     27Verify c/y/my_mount_point/my_dir/d
     28Attempting to mount IMFS file system at /c/z/my_mount_point
     292nd file system successfully mounted at /c/z/my_mount_point
     30
     31chdir to /c/z/my_mount_point.
     32chdir() status : 0
     33
     34
     35Creating a series of directories under /c/z/my_mount_point
     36Creating:                                              a   0 2    Success
     37Creating:                                              b   0 2    Success
     38Creating:                                              c   0 2    Success
     39Creating:                                              d   0 2    Success
     40Creating:                                              e   0 2    Success
     41Creating:                                              f   0 2    Success
     42Creating:                                            c/y   0 2    Success
     43Creating:                                            c/z   0 2    Success
     44Creating:                                            c/x   0 2    Success
     45Creating:                                      c/y/a3333   0 2    Success
     46Creating:                                       c/y/j123   0 2    Success
     47Creating:                             c/y/my_mount_point   0 2    Success
     48Creating:                      c/y/my_mount_point/my_dir   0 2    Success
     49Creating:                    c/y/my_mount_point/my_dir/d   0 2    Success
     50Creating:                             c/z/my_mount_point   0 2    Success
     51Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g   0 2    Success
     52
     53chdir to /
     54chdir() status : 0
     55
     56Unmount status: 0
     57Mount a NULL file system and verify EINVAL
     58mount with option RA should fail with EINVAL
     59Mount a Read Only filesystem at /c/y/my_mount_point
     60Read only file system successfully mounted at /c/y/my_mount_point
     61create c/y/my_mount_point/../../y/my_mount_point/new_dir
     62Verify a mount point retruns EBUSY for another mount
     63Mount on a file should fail with ENOTDIR
     64Create and chdir to /c/y/my_mount_point/mydir
     65 unmount of /c/y/my_mount_point should fail with EBUSY
     66chdir 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
     69Mount /c/y/my_mount_point
     70Create and open /c/y/my_mount_point/my_file
     71
     72mkdir /c/y/my_mount_point/my_dir
     73Open /c/y/my_mount_point/my_dir
     74Unmount /c/y/my_mount_point should fail with EBUSY
     75Close /c/y/my_mount_point/my_dir
     76Unmount /c/y/my_mount_point/my_dir
     77Mount a file system at /c/y/my_mount_point/my_dir
     78unmount /c/y/my_mount_point should fail with EBUSY
     79Verify a hard link across filesystems fails with EXDEV
     80Verify a symbolic link across file systems works
     81unmount /c/y/my_mount_point/my_dir
     82Verify the symbolic link now fails
     83unmount /c/y/my_mount_point
     84
     85
     86*** END OF MOUNT/UNMOUNT TEST ***
  • c/src/tests/psxtests/psxmount/test.c

    r5b8e885d rc2f9b97  
    100100  printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" );
    101101
     102  /*
     103   * Change directory to the root and create files under
     104   * the base file system.
     105   */
     106
    102107  printf( "\nchdir to the root directory\n" );
    103108  status = chdir( "/" );
     
    109114  {
    110115     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 );
    112117     if ( status == 0 )
    113118        printf(" Success\n");
     
    118123  }
    119124
     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");
    120131  fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
     132  assert( fd != 0 );
    121133  close (fd);
     134
     135  printf("Verify /b/my_file\n");
    122136  fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO);
     137  assert( fd != 0 );
    123138  close( fd );
    124139
     140
     141  printf("create c/y/my_mount_point/my_dir/d\n");
    125142  fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
     143  assert( fd != 0 );
    126144  close (fd);
     145 
     146  printf("Verify c/y/my_mount_point/my_dir/d\n");
    127147  fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO);
     148  assert( fd != 0 );
    128149  close( fd );
     150
     151  /*
     152   *  Mount an the IMFS file system on the base file system.
     153   */
    129154
    130155  printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n");
     
    143168  }
    144169
    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" );
    147176  status = chdir( "/c/z/my_mount_point" );
    148177  printf( "chdir() status : %d\n\n", status );
     
    153182  {
    154183     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 );
    156185     if ( status == 0 )
    157186        printf(" Success\n");
     
    168197  }
    169198
    170   printf( "\nchdir to / the mount point of the first file system \n" );
     199  printf( "\nchdir to /\n" );
    171200  status = chdir( "/" );
    172201  printf( "chdir() status : %d\n\n", status );
     
    180209  printf( " %d\n", status );
    181210
    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");
    204217  status = mount(
    205218   &mt_entry,
     
    211224  assert( errno == EINVAL );
    212225
    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");
    214245  status = mount(
    215246     &mt_entry,
     
    223254  }
    224255  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");
    228264  status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU );
    229265  assert( status == 0 );
    230 
    231266  status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf );
    232267  assert( status == 0 );
     
    234269  assert( status == 0 );
    235270
    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");
    237276  status = mount(
    238277     &mt_entry,
     
    244283  assert( errno == EBUSY);
    245284
    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");
    247290  status = mount(
    248291     &mt_entry,
     
    252295     "/b/my_file" );
    253296  assert( status == -1 );
     297  assert( errno == ENOTDIR );
     298
    254299 
    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");
    272305  status = mkdir( "/c/y/my_mount_point/mydir", 0777);
    273306  assert( status == 0 );
     
    281314  assert( errno == EBUSY );
    282315
     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");
    283321  status = chdir( "/" );
    284322  assert( status == 0 );
     
    288326  assert( status == 0 );
    289327
    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");
    291333  status = unmount( "/b/mount_point" );
    292334  assert( status == -1 );
     335  assert( errno == ENOENT );
     336 
     337  /*
     338   * Remount the filesystem.
     339   */
    293340
    294341  printf("Mount /c/y/my_mount_point\n");
     
    301348  assert( status == 0 );
    302349
    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
    304355  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);
    306357  assert( fd != -1 );
    307358  status = close( fd );
     
    317368  status = unmount( "/c/y/my_mount_point" );
    318369  assert( status == -1 );
     370  assert( errno == EBUSY );
    319371
    320372  printf("Close /c/y/my_mount_point/my_dir\n");
     
    322374  assert( status == 0 );
    323375
    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 );
    327437
    328438  printf("unmount /c/y/my_mount_point\n");
    329439  status = unmount( "/c/y/my_mount_point" );
    330440  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 */
    404441
    405442  printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" );
  • c/src/tests/psxtests/psxreaddir/test.c

    r5b8e885d rc2f9b97  
    206206  }
    207207
     208  /*
     209   * Create files under many and open the directory.
     210   */
     211
     212  printf("Create a lot of files\n");
    208213  status = mkdir( "/many", 0x1c0 );
    209214  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);
    212218    close (fd);
    213219  }
     220  printf("Open /many and print the directory\n");
    214221  directory_not = opendir( "/many" );
    215222  printdir ( directory_not );
    216223  d_not = readdir( directory_not );
    217224
    218   fd = open ("/b/my_file", O_CREAT);
     225  printf("open /b/myfile\n");
     226  fd = open ("/b/my_file", O_CREAT, S_IRWXU);
    219227  assert( fd != -1 );
    220228  close (fd);
    221229
     230  printf("scandir a file status: ");
    222231  status = scandir(
    223232     "/b/my_file",
     
    226235     NULL
    227236  );
    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 );
    230241  assert( fd != -1 );
    231242
     243  printf("fcntl F_SETFD should return 0\n");
    232244  status = fcntl( fd, F_SETFD, 1 );
    233245  assert( status == 0 );
     246
     247  printf("fcntl F_SETFD should return 1\n");
    234248  status = fcntl( fd, F_GETFD, 1 );
    235249  assert( status == 1 );
    236250
    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");
    240256  status = fcntl( fd, F_GETFL, 1 );
    241257  assert ( status == -1 );
    242258
     259  printf("fcntl F_SETFL should return -1\n");
    243260  status = fcntl( fd, F_SETFL, 1 );
    244261  assert ( status == -1 );
    245262
     263  printf("fcntl F_GETLK should return -1\n");
    246264  status = fcntl( fd, F_GETLK, 1 );
    247265  assert ( status == -1 );
    248266
     267  printf("fcntl F_SETLK should return -1\n");
    249268  status = fcntl( fd, F_SETLK, 1 );
    250269  assert ( status == -1 );
    251270
     271  printf("fcntl F_SETLKW should return -1\n");
    252272  status = fcntl( fd, F_SETLKW, 1 );
    253273  assert ( status == -1 );
    254274
     275  printf("fcntl F_SETOWN should return -1\n");
    255276  status = fcntl( fd, F_SETOWN, 1 );
    256277  assert ( status == -1 );
    257278
     279  printf("fcntl F_GETOWN should return -1\n");
    258280  status = fcntl( fd, F_GETOWN, 1 );
    259281  assert ( status == -1 );
    260282
     283  printf("fcntl invalid argument should return -1\n");
    261284  status = fcntl( fd, 0xb, 1 );
     285  printf("Status %d\n",status);
    262286  assert( status == -1 );
    263287
     288  printf("opendir and readdir /b/myfile\n");
    264289  directory_not = opendir ("/b/my_file");
    265290  d_not = readdir(directory_not);
    266291
     292  printf("opendir and readdir\n");
    267293  directory_not = opendir ("/a");
    268294  d_not = readdir (directory_not);
    269295
     296  printf("chdir to /b/myfile\n");
    270297  status = chdir ("/b/my_file");
    271298  assert (status == -1);
     
    276303         status,(int)s.st_size);
    277304
    278   puts( "\nOpening directory /" );
     305  puts( "\nOpen and print directory /" );
    279306  directory = opendir("/");
    280 
    281307  assert( directory );
    282 
    283308  printdir(directory);
    284309
     
    306331  printf( "\nOpening directory /c/y\n" );
    307332  directory3 = opendir("/c/y");
    308 
    309333  assert( directory3 );
    310 
    311334  printdir(directory3);
    312335  status = closedir( directory3 );
  • testsuites/psxtests/psx13/psx13.scn

    r5b8e885d rc2f9b97  
     1
     2Files initialized successfully.
     3Testing device_lseek()... Success.
     4Testing dup()............ Success.
     5Testing dup2()........... Success.
     6Testing fdatasync()...... Success.
     7Testing umask().......... Success.
     8Testing utime().......... Success.
     9Testing pipe()........... Success.
     10Testing fsync().......... Success.
     11Testing pathconf()....... Success.
     12Testing fpathconf()...... Success.
     13
     14
     15*** END OF TEST PSX13 ***
  • testsuites/psxtests/psx13/test.c

    r5b8e885d rc2f9b97  
    162162  if (fd2 != -1) {
    163163
    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);
    166166
    167167    close (fd1);
     
    215215  if (error != -1) {
    216216
    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);
    219219
    220220    flags = (flags & O_APPEND);
     
    601601{
    602602  if (InitFiles() == TRUE) {
    603     puts ("\nFiles initialized successfully.\n");
    604 
    605     puts ("Testing device_lseek()...");
     603    printf ("\nFiles initialized successfully.\n");
     604
     605    printf ("Testing device_lseek()... ");
    606606    if (DeviceLSeekTest() == TRUE)
    607       puts ("Success.\n");
    608     else
    609       puts ("Failed!!!\n");
    610 
    611     puts ("Testing dup()...");
     607      printf ("Success.\n");
     608    else
     609      printf ("Failed!!!\n");
     610
     611    printf ("Testing dup()............ ");
    612612    if (DupTest() == TRUE)
    613       puts ("Success.\n");
    614     else
    615       puts ("Failed!!!\n");
     613      printf ("Success.\n");
     614    else
     615      printf ("Failed!!!\n");
    616616   
    617     puts ("Testing dup2()...");
     617    printf ("Testing dup2()........... ");
    618618    if (Dup2Test() == TRUE)
    619       puts ("Success.\n");
    620     else
    621       puts ("Failed!!!\n");
    622 
    623     puts ("Testing fdatasync()...");
     619      printf ("Success.\n");
     620    else
     621      printf ("Failed!!!\n");
     622
     623    printf ("Testing fdatasync()...... ");
    624624    if (FDataSyncTest() == TRUE)
    625       puts ("Success.\n");
    626     else
    627       puts ("Failed!!!\n");
    628 
    629     puts ("Testing umask()...");
     625      printf ("Success.\n");
     626    else
     627      printf ("Failed!!!\n");
     628
     629    printf ("Testing umask().......... ");
    630630    if (UMaskTest() == TRUE)
    631       puts ("Success.\n");
    632     else
    633       puts ("Failed!!!\n");
    634 
    635    puts ("Testing utime()...");
     631      printf ("Success.\n");
     632    else
     633      printf ("Failed!!!\n");
     634
     635   printf ("Testing utime().......... ");
    636636    if (UTimeTest() == TRUE)
    637       puts ("Success.\n");
    638     else
    639       puts ("Failed!!!\n");
    640 
    641    puts ("Testing pipe()...");
     637      printf ("Success.\n");
     638    else
     639      printf ("Failed!!!\n");
     640
     641   printf ("Testing pipe()........... ");
    642642    if (PipeTest() == TRUE)
    643       puts ("Success.\n");
    644     else
    645       puts ("Failed!!!\n");
    646 
    647    puts ("Testing fsync()...");
     643      printf ("Success.\n");
     644    else
     645      printf ("Failed!!!\n");
     646
     647   printf ("Testing fsync().......... ");
    648648    if (FSyncTest() == TRUE)
    649       puts ("Success.\n");
    650     else
    651       puts ("Failed!!!\n");
    652 
    653    puts ("Testing pathconf()...");
     649      printf ("Success.\n");
     650    else
     651      printf ("Failed!!!\n");
     652
     653   printf ("Testing pathconf()....... ");
    654654    if (PathConfTest() == TRUE)
    655       puts ("Success.\n");
    656     else
    657       puts ("Failed!!!\n");
     655      printf ("Success.\n");
     656    else
     657      printf ("Failed!!!\n");
    658658 
    659    puts ("Testing fpathconf()...");
     659   printf ("Testing fpathconf()...... ");
    660660    if (FPathConfTest() == TRUE)
    661       puts ("Success.\n");
    662     else
    663       puts ("Failed!!!\n");
     661      printf ("Success.\n");
     662    else
     663      printf ("Failed!!!\n");
    664664  }
    665665
    666666
    667667  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 ***" );
    673671  exit(0);
    674672}
  • testsuites/psxtests/psxfile01/test.c

    r5b8e885d rc2f9b97  
    239239  status = rmdir ("/fred");
    240240  assert (status == -1);
     241  assert( errno == ENOENT );
    241242
    242243  status = mknod( "/dev/test_console", S_IFCHR, 0LL );
  • testsuites/psxtests/psxmount/psxmount.scn

    r5b8e885d rc2f9b97  
     1
     2
     3*** MOUNT/UNMOUNT TEST ***
     4
     5chdir to the root directory
     6chdir() status : 0
     7
     8
     9Creating a series of directories under /
     10Creating :                         a  0 0    Success
     11Creating :                         b  0 0    Success
     12Creating :                         c  0 0    Success
     13Creating :                         d  0 0    Success
     14Creating :                         e  0 0    Success
     15Creating :                         f  0 0    Success
     16Creating :                       c/y  0 0    Success
     17Creating :                       c/z  0 0    Success
     18Creating :                       c/x  0 0    Success
     19Creating :                 c/y/a3333  0 0    Success
     20Creating :                  c/y/j123  0 0    Success
     21Creating :        c/y/my_mount_point  0 0    Success
     22Creating : c/y/my_mount_point/my_dir  0 0    Success
     23Creating :        c/z/my_mount_point  0 0    Success
     24create /b/my_file
     25Verify /b/my_file
     26create c/y/my_mount_point/my_dir/d
     27Verify c/y/my_mount_point/my_dir/d
     28Attempting to mount IMFS file system at /c/z/my_mount_point
     292nd file system successfully mounted at /c/z/my_mount_point
     30
     31chdir to /c/z/my_mount_point.
     32chdir() status : 0
     33
     34
     35Creating a series of directories under /c/z/my_mount_point
     36Creating:                                              a   0 2    Success
     37Creating:                                              b   0 2    Success
     38Creating:                                              c   0 2    Success
     39Creating:                                              d   0 2    Success
     40Creating:                                              e   0 2    Success
     41Creating:                                              f   0 2    Success
     42Creating:                                            c/y   0 2    Success
     43Creating:                                            c/z   0 2    Success
     44Creating:                                            c/x   0 2    Success
     45Creating:                                      c/y/a3333   0 2    Success
     46Creating:                                       c/y/j123   0 2    Success
     47Creating:                             c/y/my_mount_point   0 2    Success
     48Creating:                      c/y/my_mount_point/my_dir   0 2    Success
     49Creating:                    c/y/my_mount_point/my_dir/d   0 2    Success
     50Creating:                             c/z/my_mount_point   0 2    Success
     51Creating: /c/z/my_mount_point/a/../../my_mount_point/a/g   0 2    Success
     52
     53chdir to /
     54chdir() status : 0
     55
     56Unmount status: 0
     57Mount a NULL file system and verify EINVAL
     58mount with option RA should fail with EINVAL
     59Mount a Read Only filesystem at /c/y/my_mount_point
     60Read only file system successfully mounted at /c/y/my_mount_point
     61create c/y/my_mount_point/../../y/my_mount_point/new_dir
     62Verify a mount point retruns EBUSY for another mount
     63Mount on a file should fail with ENOTDIR
     64Create and chdir to /c/y/my_mount_point/mydir
     65 unmount of /c/y/my_mount_point should fail with EBUSY
     66chdir 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
     69Mount /c/y/my_mount_point
     70Create and open /c/y/my_mount_point/my_file
     71
     72mkdir /c/y/my_mount_point/my_dir
     73Open /c/y/my_mount_point/my_dir
     74Unmount /c/y/my_mount_point should fail with EBUSY
     75Close /c/y/my_mount_point/my_dir
     76Unmount /c/y/my_mount_point/my_dir
     77Mount a file system at /c/y/my_mount_point/my_dir
     78unmount /c/y/my_mount_point should fail with EBUSY
     79Verify a hard link across filesystems fails with EXDEV
     80Verify a symbolic link across file systems works
     81unmount /c/y/my_mount_point/my_dir
     82Verify the symbolic link now fails
     83unmount /c/y/my_mount_point
     84
     85
     86*** END OF MOUNT/UNMOUNT TEST ***
  • testsuites/psxtests/psxmount/test.c

    r5b8e885d rc2f9b97  
    100100  printf( "\n\n*** MOUNT/UNMOUNT TEST ***\n" );
    101101
     102  /*
     103   * Change directory to the root and create files under
     104   * the base file system.
     105   */
     106
    102107  printf( "\nchdir to the root directory\n" );
    103108  status = chdir( "/" );
     
    109114  {
    110115     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 );
    112117     if ( status == 0 )
    113118        printf(" Success\n");
     
    118123  }
    119124
     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");
    120131  fd = open ("/b/my_file", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
     132  assert( fd != 0 );
    121133  close (fd);
     134
     135  printf("Verify /b/my_file\n");
    122136  fd = open("/b/my_file", S_IRWXU|S_IRWXG|S_IRWXO);
     137  assert( fd != 0 );
    123138  close( fd );
    124139
     140
     141  printf("create c/y/my_mount_point/my_dir/d\n");
    125142  fd = open ("c/y/my_mount_point/my_dir/d", O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
     143  assert( fd != 0 );
    126144  close (fd);
     145 
     146  printf("Verify c/y/my_mount_point/my_dir/d\n");
    127147  fd = open("c/y/my_mount_point/my_dir/d", S_IRWXU|S_IRWXG|S_IRWXO);
     148  assert( fd != 0 );
    128149  close( fd );
     150
     151  /*
     152   *  Mount an the IMFS file system on the base file system.
     153   */
    129154
    130155  printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n");
     
    143168  }
    144169
    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" );
    147176  status = chdir( "/c/z/my_mount_point" );
    148177  printf( "chdir() status : %d\n\n", status );
     
    153182  {
    154183     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 );
    156185     if ( status == 0 )
    157186        printf(" Success\n");
     
    168197  }
    169198
    170   printf( "\nchdir to / the mount point of the first file system \n" );
     199  printf( "\nchdir to /\n" );
    171200  status = chdir( "/" );
    172201  printf( "chdir() status : %d\n\n", status );
     
    180209  printf( " %d\n", status );
    181210
    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");
    204217  status = mount(
    205218   &mt_entry,
     
    211224  assert( errno == EINVAL );
    212225
    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");
    214245  status = mount(
    215246     &mt_entry,
     
    223254  }
    224255  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");
    228264  status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU );
    229265  assert( status == 0 );
    230 
    231266  status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf );
    232267  assert( status == 0 );
     
    234269  assert( status == 0 );
    235270
    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");
    237276  status = mount(
    238277     &mt_entry,
     
    244283  assert( errno == EBUSY);
    245284
    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");
    247290  status = mount(
    248291     &mt_entry,
     
    252295     "/b/my_file" );
    253296  assert( status == -1 );
     297  assert( errno == ENOTDIR );
     298
    254299 
    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");
    272305  status = mkdir( "/c/y/my_mount_point/mydir", 0777);
    273306  assert( status == 0 );
     
    281314  assert( errno == EBUSY );
    282315
     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");
    283321  status = chdir( "/" );
    284322  assert( status == 0 );
     
    288326  assert( status == 0 );
    289327
    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");
    291333  status = unmount( "/b/mount_point" );
    292334  assert( status == -1 );
     335  assert( errno == ENOENT );
     336 
     337  /*
     338   * Remount the filesystem.
     339   */
    293340
    294341  printf("Mount /c/y/my_mount_point\n");
     
    301348  assert( status == 0 );
    302349
    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
    304355  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);
    306357  assert( fd != -1 );
    307358  status = close( fd );
     
    317368  status = unmount( "/c/y/my_mount_point" );
    318369  assert( status == -1 );
     370  assert( errno == EBUSY );
    319371
    320372  printf("Close /c/y/my_mount_point/my_dir\n");
     
    322374  assert( status == 0 );
    323375
    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 );
    327437
    328438  printf("unmount /c/y/my_mount_point\n");
    329439  status = unmount( "/c/y/my_mount_point" );
    330440  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 */
    404441
    405442  printf( "\n\n*** END OF MOUNT/UNMOUNT TEST ***\n" );
  • testsuites/psxtests/psxreaddir/test.c

    r5b8e885d rc2f9b97  
    206206  }
    207207
     208  /*
     209   * Create files under many and open the directory.
     210   */
     211
     212  printf("Create a lot of files\n");
    208213  status = mkdir( "/many", 0x1c0 );
    209214  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);
    212218    close (fd);
    213219  }
     220  printf("Open /many and print the directory\n");
    214221  directory_not = opendir( "/many" );
    215222  printdir ( directory_not );
    216223  d_not = readdir( directory_not );
    217224
    218   fd = open ("/b/my_file", O_CREAT);
     225  printf("open /b/myfile\n");
     226  fd = open ("/b/my_file", O_CREAT, S_IRWXU);
    219227  assert( fd != -1 );
    220228  close (fd);
    221229
     230  printf("scandir a file status: ");
    222231  status = scandir(
    223232     "/b/my_file",
     
    226235     NULL
    227236  );
    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 );
    230241  assert( fd != -1 );
    231242
     243  printf("fcntl F_SETFD should return 0\n");
    232244  status = fcntl( fd, F_SETFD, 1 );
    233245  assert( status == 0 );
     246
     247  printf("fcntl F_SETFD should return 1\n");
    234248  status = fcntl( fd, F_GETFD, 1 );
    235249  assert( status == 1 );
    236250
    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");
    240256  status = fcntl( fd, F_GETFL, 1 );
    241257  assert ( status == -1 );
    242258
     259  printf("fcntl F_SETFL should return -1\n");
    243260  status = fcntl( fd, F_SETFL, 1 );
    244261  assert ( status == -1 );
    245262
     263  printf("fcntl F_GETLK should return -1\n");
    246264  status = fcntl( fd, F_GETLK, 1 );
    247265  assert ( status == -1 );
    248266
     267  printf("fcntl F_SETLK should return -1\n");
    249268  status = fcntl( fd, F_SETLK, 1 );
    250269  assert ( status == -1 );
    251270
     271  printf("fcntl F_SETLKW should return -1\n");
    252272  status = fcntl( fd, F_SETLKW, 1 );
    253273  assert ( status == -1 );
    254274
     275  printf("fcntl F_SETOWN should return -1\n");
    255276  status = fcntl( fd, F_SETOWN, 1 );
    256277  assert ( status == -1 );
    257278
     279  printf("fcntl F_GETOWN should return -1\n");
    258280  status = fcntl( fd, F_GETOWN, 1 );
    259281  assert ( status == -1 );
    260282
     283  printf("fcntl invalid argument should return -1\n");
    261284  status = fcntl( fd, 0xb, 1 );
     285  printf("Status %d\n",status);
    262286  assert( status == -1 );
    263287
     288  printf("opendir and readdir /b/myfile\n");
    264289  directory_not = opendir ("/b/my_file");
    265290  d_not = readdir(directory_not);
    266291
     292  printf("opendir and readdir\n");
    267293  directory_not = opendir ("/a");
    268294  d_not = readdir (directory_not);
    269295
     296  printf("chdir to /b/myfile\n");
    270297  status = chdir ("/b/my_file");
    271298  assert (status == -1);
     
    276303         status,(int)s.st_size);
    277304
    278   puts( "\nOpening directory /" );
     305  puts( "\nOpen and print directory /" );
    279306  directory = opendir("/");
    280 
    281307  assert( directory );
    282 
    283308  printdir(directory);
    284309
     
    306331  printf( "\nOpening directory /c/y\n" );
    307332  directory3 = opendir("/c/y");
    308 
    309333  assert( directory3 );
    310 
    311334  printdir(directory3);
    312335  status = closedir( directory3 );
Note: See TracChangeset for help on using the changeset viewer.