From 189b89efb39e047185c4189991a1bbfa792ba05c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 2 Aug 2010 18:19:35 +0000 Subject: 2010-07-30 Bharath Suri 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. --- testsuites/psxtests/ChangeLog | 6 ++++++ testsuites/psxtests/psximfs02/init.c | 32 ++++++++++++++++++++++++++++- testsuites/psxtests/psximfs02/psximfs02.doc | 3 +++ testsuites/psxtests/psximfs02/psximfs02.scn | 24 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 76e1b7963b..eee4ba7deb 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,9 @@ +2010-07-30 Bharath Suri + + 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 PR 1642/testing diff --git a/testsuites/psxtests/psximfs02/init.c b/testsuites/psxtests/psximfs02/init.c index 1454cd1a3e..132e546c86 100644 --- a/testsuites/psxtests/psximfs02/init.c +++ b/testsuites/psxtests/psximfs02/init.c @@ -20,7 +20,7 @@ #include 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 /* end of file */ diff --git a/testsuites/psxtests/psximfs02/psximfs02.doc b/testsuites/psxtests/psximfs02/psximfs02.doc index 7596b68908..59586af6a5 100644 --- a/testsuites/psxtests/psximfs02/psximfs02.doc +++ b/testsuites/psxtests/psximfs02/psximfs02.doc @@ -22,6 +22,9 @@ directives: + symlink + mount + lstat + + IMFS_dump + + chmod + + chown concepts: diff --git a/testsuites/psxtests/psximfs02/psximfs02.scn b/testsuites/psxtests/psximfs02/psximfs02.scn index c225d5cc49..60fda98a4d 100644 --- a/testsuites/psxtests/psximfs02/psximfs02.scn +++ b/testsuites/psxtests/psximfs02/psximfs02.scn @@ -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 *** -- cgit v1.2.3