Changeset efdc6987 in rtems


Ignore:
Timestamp:
Jul 19, 2010, 1:13:20 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
78da8ac3
Parents:
741343ad
Message:

2010-07-19 Bharath Suri <bharath.s.jois@…>

PR 1623/testing

  • psx13/test.c, psx13/psx13.scn: New cases to improve coverage of utime() and fpathconf().
  • psxfile01/test.c, psxfile01/psxfile01.scn: New cases to improve coverage of rmdir(), unlink(), mknod(), link(), open(), read(), write().
  • psxstat/test.c, psxstat/psxstat.scn: New case to improve coverage of readlink().
Location:
testsuites/psxtests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r741343ad refdc6987  
     12010-07-19      Bharath Suri <bharath.s.jois@gmail.com>
     2
     3        PR 1623/testing
     4        * psx13/test.c, psx13/psx13.scn: New cases to improve coverage of
     5        utime() and fpathconf().
     6        * psxfile01/test.c, psxfile01/psxfile01.scn: New cases to improve
     7        coverage of rmdir(), unlink(), mknod(), link(), open(), read(),
     8        write().
     9        * psxstat/test.c, psxstat/psxstat.scn: New case to improve
     10        coverage of readlink().
     11
    1122010-07-17      Bharath Suri <bharath.s.jois@gmail.com>
    213
  • testsuites/psxtests/psx13/psx13.scn

    r741343ad refdc6987  
    11
    2 ** POSIX TEST 13 ***
     2*** POSIX TEST 13 ***
    33
    44Files initialized successfully.
  • testsuites/psxtests/psx13/test.c

    r741343ad refdc6987  
    416416        retval = FALSE;
    417417    }
    418 
    419418    else
    420419      retval = FALSE;
     420
     421    error = utime("testfile1.tst", NULL );
     422    retval &= (error == 0) ? TRUE : FALSE;
    421423  }
    422424
     
    564566    error = fpathconf(fd, 255);
    565567
     568    close(fd);
     569
     570    fd = open("testfile1.tst", O_WRONLY);
     571   
     572    error = fpathconf(fd, _PC_LINK_MAX);
     573
    566574    retval = TRUE;
    567575  }
  • testsuites/psxtests/psxfile01/psxfile01.scn

    r741343ad refdc6987  
     1
    12*** FILE TEST 1 ***
    23*************** Dump of Entire IMFS ***************
     
    3132rmdir /dev
    3233rmdir /fred
     34rmdir /tmp/bha
     35unlink /dev/tty
    3336mknod /dev/test_console
    3437mknod /dev/tty/S3
     
    4952tcdrain /tmp/john
    5053Attempt to create a file, open in read-only mode and truncate it
    51 Exercise the reentrant version _link_r -- Expect EFAULT
     54Exercise the reentrant version _link_r -- Expect ENOENT
    5255Unlink /tmp/bha using the reentrant version -- OK
     56mknod with bad type - expect EINVAL
     57open /tmp/bha in write only mode -- OK
     58attempt to read from /tmp/bha - expect EINVAL
     59closing and unlinking /tmp/bha
     60open /tmp/bha in read only mode -- OK
     61attempt to read from /tmp/bha - expect EINVAL
     62closing and unlinking /tmp/bha
     63attempt to read from an unopened filedes - expect EBADF
     64attempt to write to an unopened filedes - expect EBADF
    5365mknod /tmp/joel
    5466(0)the first write!!!
     
    7486stat( /tmp/joel ) returned
    7587....st_dev     (0xfffe:0x0)
    76 ....st_ino     13  may vary by small amount
     88....st_ino     15  may vary by small amount
    7789....mode  = 00100700
    7890....nlink = 1
     
    107119stat( /tmp/joel ) returned
    108120....st_dev     (0xfffe:0x0)
    109 ....st_ino     14  may vary by small amount
     121....st_ino     16  may vary by small amount
    110122....mode  = 00100700
    111123....nlink = 1
     
    138150(5) 26 characters written to the file
    139151....st_dev     (0xfffe:0x0)
    140 ....st_ino     15  may vary by small amount
     152....st_ino     17  may vary by small amount
    141153....mode  = 00100644
    142154....nlink = 1
     
    154166This is call 5 to fprintf
    155167....st_dev     (0xfffe:0x0)
    156 ....st_ino     15  may vary by small amount
     168....st_ino     17  may vary by small amount
    157169....mode  = 00100644
    158170....nlink = 1
     
    184196truncate /tmp/j to length of 40
    185197....st_dev     (0xfffe:0x0)
    186 ....st_ino     15  may vary by small amount
     198....st_ino     17  may vary by small amount
    187199....mode  = 00100644
    188200....nlink = 1
  • testsuites/psxtests/psxfile01/test.c

    r741343ad refdc6987  
    245245  rtems_test_assert( errno == ENOENT );
    246246
     247  puts( "rmdir /tmp/bha" );
     248  status = rmdir( "/tmp/bha" );
     249  rtems_test_assert( status == -1 );
     250  rtems_test_assert( errno == ENOENT );
     251
     252  puts( "unlink /dev/tty" );
     253  status = unlink( "/dev/tty" );
     254  rtems_test_assert( status == -1 );
     255  rtems_test_assert( errno == EISDIR );
     256
    247257  puts( "mknod /dev/test_console" );
    248258  status = mknod( "/dev/test_console", S_IFCHR, 0LL );
     
    340350  rtems_test_assert( errno == EINVAL );
    341351
    342   puts( "Exercise the reentrant version _link_r -- Expect EEXIST" );
    343   status = _link_r( NULL, "", "" );
    344   rtems_test_assert( status == -1 );
    345   rtems_test_assert( errno == EEXIST );
     352  puts( "Exercise the reentrant version _link_r -- Expect ENOENT" );
     353  status = _link_r( NULL, "/tmp/notexist", "/tmp/cannotexist" );
     354  rtems_test_assert( status == -1 );
     355  rtems_test_assert( errno == ENOENT );
    346356
    347357  puts( "Unlink /tmp/bha using the reentrant version -- OK" );
    348358  status = _unlink_r( NULL, "/tmp/bha" );
    349359  rtems_test_assert( status == 0 );
     360
     361  /*
     362   * Simple test case for mknod
     363   */
     364
     365  puts( "mknod with bad type - expect EINVAL" );
     366  status = mknod( "/tmp/bha", 0, 0LL );
     367  rtems_test_assert( status == -1 );
     368  rtems_test_assert( errno == EINVAL );
     369
     370  /*
     371   * Read from filedes opened for write
     372   */
     373
     374  puts( "open /tmp/bha in write only mode -- OK" );
     375  fd = open( "/tmp/bha", O_CREAT | O_WRONLY, S_IRWXU|S_IRWXG|S_IRWXO );
     376  rtems_test_assert( fd != -1 );
     377 
     378  puts( "attempt to read from /tmp/bha - expect EINVAL" );
     379  status = read( fd, buffer, 10 );
     380  rtems_test_assert( status == -1 );
     381  rtems_test_assert( errno == EINVAL );
     382
     383  puts( "closing and unlinking /tmp/bha" );
     384  status = close( fd );
     385  status |= unlink( "/tmp/bha" );
     386  rtems_test_assert( status == 0 );
     387
     388  puts( "open /tmp/bha in read only mode -- OK" );
     389  fd = open( "/tmp/bha", O_CREAT | O_RDONLY, S_IRWXU|S_IRWXG|S_IRWXO );
     390  rtems_test_assert( fd != -1 );
     391 
     392  puts( "attempt to read from /tmp/bha - expect EINVAL" );
     393  status = write( fd, buffer, 10 );
     394  rtems_test_assert( status == -1 );
     395  rtems_test_assert( errno == EINVAL );
     396
     397  puts( "closing and unlinking /tmp/bha" );
     398  status = close( fd );
     399  status |= unlink( "/tmp/bha" );
     400  rtems_test_assert( status == 0 );
     401
     402  /*
     403   * Read/write from an unopened filedes
     404   */
     405  puts( "attempt to read from an unopened filedes - expect EBADF" );
     406  status = read( 5, buffer, 10 );
     407  rtems_test_assert( status == -1 );
     408  rtems_test_assert( errno == EBADF );
     409
     410  puts( "attempt to write to an unopened filedes - expect EBADF" );
     411  status = write( 5, buffer, 10 );
     412  rtems_test_assert( status == -1 );
     413  rtems_test_assert( errno == EBADF );
    350414
    351415  /*
  • testsuites/psxtests/psxstat/psxstat.scn

    r741343ad refdc6987  
    17051705...st_blksize 0
    17061706...st_blocks  0
    1707 statvfs, with invalid path - expect EFAULT
     1707statvfs, with invalid path - expect ENOTSUP
    17081708create /tmp -- OK
    17091709statvfs, with valid path - expect ENOTSUP
     
    17111711Exercise the reentrant version - _stat_r - expect EFAULT
    17121712Exercise the reentrant version - _lstat_r - expect EFAULT
     1713Try readlink with a bad buffer - expect EFAULT
    17131714
    17141715
  • testsuites/psxtests/psxstat/test.c

    r741343ad refdc6987  
    940940  rtems_test_assert( errno == EFAULT );
    941941
     942  puts( "Try readlink with a bad buffer - expect EFAULT" );
     943  status = readlink( "/tmp", NULL, 0 );
     944  rtems_test_assert( status == -1 );
     945  rtems_test_assert( errno == EFAULT );
     946
    942947  puts( "\n\n*** END OF STAT TEST 01 ***" );
    943948  rtems_test_exit(0);
Note: See TracChangeset for help on using the changeset viewer.