2010-07-30 Bharath Suri <bharath.s.jois@gmail.com>

PR 1642/testing
	* psximfs02/init.c, psximfs02/psximfs02.scn,
	psximfs02/psximfs02.doc: Added test cases to exercise chmod(),
	chown() and routines in imfs_debug.c.
This commit is contained in:
Joel Sherrill
2010-08-02 18:19:35 +00:00
parent d0e825d0b9
commit 189b89efb3
4 changed files with 64 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2010-07-30 Bharath Suri <bharath.s.jois@gmail.com>
PR 1642/testing
* psximfs02/init.c, psximfs02/psximfs02.scn,
psximfs02/psximfs02.doc: Added test cases to exercise chmod(),
chown() and routines in imfs_debug.c.
2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>
PR 1642/testing

View File

@@ -20,7 +20,7 @@
#include <rtems/libio.h>
extern Heap_Control *RTEMS_Malloc_Heap;
void IMFS_dump( void );
rtems_task Init(
rtems_task_argument argument
)
@@ -129,11 +129,38 @@ rtems_task Init(
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOMEM );
puts( "Freeing allocated memory" );
free( alloc_ptr );
puts( "Attempt to stat a hardlink -- expect ENOTSUP" );
status = lstat( "/node-link", &stat_buf );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOTSUP );
puts( "Changing euid to 10" );
status = seteuid( 10 );
rtems_test_assert( status == 0 );
puts( "Attempt chmod on /node -- expect EPERM" );
status = chmod( "/node", S_IRUSR );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EPERM );
puts( "Attempt chown on /node -- expect EPERM" );
status = chown( "/node", 10, 10 );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EPERM );
puts( "Changing euid back to 0 [root]" );
status = seteuid( 0 );
rtems_test_assert( status == 0 );
puts( "Creating a fifo -- OK" );
status = mkfifo( "/fifo", S_IRWXU );
rtems_test_assert( status == 0 );
IMFS_dump();
puts( "*** END OF TEST IMFS 02 ***" );
rtems_test_exit(0);
}
@@ -149,5 +176,8 @@ rtems_task Init(
#define CONFIGURE_INIT
#define CONFIGURE_FIFOS_ENABLED
#define CONFIGURE_MAXIMUM_FIFOS 1
#include <rtems/confdefs.h>
/* end of file */

View File

@@ -22,6 +22,9 @@ directives:
+ symlink
+ mount
+ lstat
+ IMFS_dump
+ chmod
+ chown
concepts:

View File

@@ -33,5 +33,29 @@ Attempt to create /node-slink-2 for /node -- expect ENOMEM
Freeing allocated memory
Allocate most of heap
Attempt to create /node-slink-2 for /node -- expect ENOMEM
Freeing allocated memory
Attempt to stat a hardlink -- expect ENOTSUP
Changing euid to 10
Attempt chmod on /node -- expect EPERM
Attempt chown on /node -- expect EPERM
Changing euid back to 0 [root]
Creating a fifo -- OK
*************** Dump of Entire IMFS ***************
/
....dev/
........console (device 0, 0)
....dir00/
........dir01/
........dir01-link0 links not printed
........dir01-link1 links not printed
........dir01-link2 links not printed
........dir01-link3 links not printed
........dir01-link4 links not printed
........dir01-link5 links not printed
........dir01-link6 links not printed
....node (file 0)
....node-link links not printed
....node-slink links not printed
....fifo FIFO not printed
*************** End of Dump ***************
*** END OF TEST IMFS 02 ***