diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-01 14:40:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-01 14:40:14 +0000 |
commit | 98e16aad39d676f9430aeb2b999bbfd334b07c12 (patch) | |
tree | fa16004c7dc820dab0fbe0315c660c5cef04e908 /testsuites | |
parent | 2010-07-01 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-98e16aad39d676f9430aeb2b999bbfd334b07c12.tar.bz2 |
2010-07-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add tests for file lock stubs as well as
various POSIX methods that access UID, PID, and GID.
* psxfilelock01/.cvsignore, psxfilelock01/Makefile.am,
psxfilelock01/init.c, psxfilelock01/psxfilelock01.doc,
psxfilelock01/psxfilelock01.scn, psxid01/.cvsignore,
psxid01/Makefile.am, psxid01/init.c, psxid01/psxid01.doc,
psxid01/psxid01.scn: New files.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/psxtests/ChangeLog | 10 | ||||
-rw-r--r-- | testsuites/psxtests/Makefile.am | 4 | ||||
-rw-r--r-- | testsuites/psxtests/configure.ac | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxfilelock01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxfilelock01/Makefile.am | 26 | ||||
-rw-r--r-- | testsuites/psxtests/psxfilelock01/init.c | 60 | ||||
-rw-r--r-- | testsuites/psxtests/psxfilelock01/psxfilelock01.doc | 22 | ||||
-rw-r--r-- | testsuites/psxtests/psxfilelock01/psxfilelock01.scn | 7 | ||||
-rw-r--r-- | testsuites/psxtests/psxid01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxid01/Makefile.am | 26 | ||||
-rw-r--r-- | testsuites/psxtests/psxid01/init.c | 126 | ||||
-rw-r--r-- | testsuites/psxtests/psxid01/psxid01.doc | 34 | ||||
-rw-r--r-- | testsuites/psxtests/psxid01/psxid01.scn | 20 |
13 files changed, 339 insertions, 2 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 7b2a974269..441fd1cd65 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,13 @@ +2010-07-01 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, configure.ac: Add tests for file lock stubs as well as + various POSIX methods that access UID, PID, and GID. + * psxfilelock01/.cvsignore, psxfilelock01/Makefile.am, + psxfilelock01/init.c, psxfilelock01/psxfilelock01.doc, + psxfilelock01/psxfilelock01.scn, psxid01/.cvsignore, + psxid01/Makefile.am, psxid01/init.c, psxid01/psxid01.doc, + psxid01/psxid01.scn: New files. + 2010-06-30 Joel Sherrill <joel.sherrilL@OARcorp.com> * psximfs01/init.c: Fix warning introduced. diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 66dfacbca6..46aea8d8db 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -19,8 +19,8 @@ SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \ endif ## File IO tests -SUBDIRS += psxfile01 psxfile02 psximfs01 psxreaddir psxstat psxmount psx13 \ - psxchroot01 psxpasswd01 +SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxid01 psximfs01 psxreaddir \ + psxstat psxmount psx13 psxchroot01 psxpasswd01 ## Until sys/uio.h is moved to libcsupport, we have to have networking ## enabled to support readv and writev. Hopefully this is a temporary diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac index d264d6d303..ef5c35911d 100644 --- a/testsuites/psxtests/configure.ac +++ b/testsuites/psxtests/configure.ac @@ -88,7 +88,9 @@ psxfatal01/Makefile psxfatal02/Makefile psxfile01/Makefile psxfile02/Makefile +psxfilelock01/Makefile psxhdrs/Makefile +psxid01/Makefile psximfs01/Makefile psxintrcritical01/Makefile psxitimer/Makefile diff --git a/testsuites/psxtests/psxfilelock01/.cvsignore b/testsuites/psxtests/psxfilelock01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psxfilelock01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psxfilelock01/Makefile.am b/testsuites/psxtests/psxfilelock01/Makefile.am new file mode 100644 index 0000000000..44552b8733 --- /dev/null +++ b/testsuites/psxtests/psxfilelock01/Makefile.am @@ -0,0 +1,26 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxfilelock01 +psxfilelock01_SOURCES = init.c + +dist_rtems_tests_DATA = psxfilelock01.scn +dist_rtems_tests_DATA += psxfilelock01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxfilelock01_OBJECTS) $(psxfilelock01_LDADD) +LINK_LIBS = $(psxfilelock01_LDLIBS) + +psxfilelock01$(EXEEXT): $(psxfilelock01_OBJECTS) $(psxfilelock01_DEPENDENCIES) + @rm -f psxfilelock01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxfilelock01/init.c b/testsuites/psxtests/psxfilelock01/init.c new file mode 100644 index 0000000000..8c8677e8ae --- /dev/null +++ b/testsuites/psxtests/psxfilelock01/init.c @@ -0,0 +1,60 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <tmacros.h> +#include "test_support.h" +#include <errno.h> + +rtems_task Init( + rtems_task_argument argument +) +{ + FILE *fd; + int sc; + + puts( "\n\n*** TEST FILE LOCK 01 ***" ); + + puts( "Open /testfile" ); + fd = fopen( "/testfile", "w+" ); + rtems_test_assert( fd ); + + puts( "flockfile /testfile" ); + flockfile( fd ); + + puts( "ftrylockfile /testfile" ); + sc = ftrylockfile( fd ); + rtems_test_assert( sc == -1 ); + rtems_test_assert( errno == ENOTSUP ); + + puts( "flockfile /testfile" ); + flockfile( fd ); + + puts( "funlockfile /testfile" ); + funlockfile( fd ); + + puts( "*** END OF TEST FILE LOCK 01 ***" ); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/psxtests/psxfilelock01/psxfilelock01.doc b/testsuites/psxtests/psxfilelock01/psxfilelock01.doc new file mode 100644 index 0000000000..c639d119a0 --- /dev/null +++ b/testsuites/psxtests/psxfilelock01/psxfilelock01.doc @@ -0,0 +1,22 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This file describes the directives and concepts tested by this test set. + +test set name: psxfilelock01 + +directives: + + XXX list them + +concepts: + ++ XXX list them diff --git a/testsuites/psxtests/psxfilelock01/psxfilelock01.scn b/testsuites/psxtests/psxfilelock01/psxfilelock01.scn new file mode 100644 index 0000000000..de44a07881 --- /dev/null +++ b/testsuites/psxtests/psxfilelock01/psxfilelock01.scn @@ -0,0 +1,7 @@ +*** TEST FILE LOCK 01 *** +Open /testfile +flockfile /testfile +ftrylockfile /testfile +flockfile /testfile +funlockfile /testfile +*** END OF TEST FILE LOCK 01 *** diff --git a/testsuites/psxtests/psxid01/.cvsignore b/testsuites/psxtests/psxid01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psxid01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psxid01/Makefile.am b/testsuites/psxtests/psxid01/Makefile.am new file mode 100644 index 0000000000..7fb3e5263e --- /dev/null +++ b/testsuites/psxtests/psxid01/Makefile.am @@ -0,0 +1,26 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxid01 +psxid01_SOURCES = init.c + +dist_rtems_tests_DATA = psxid01.scn +dist_rtems_tests_DATA += psxid01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxid01_OBJECTS) $(psxid01_LDADD) +LINK_LIBS = $(psxid01_LDLIBS) + +psxid01$(EXEEXT): $(psxid01_OBJECTS) $(psxid01_DEPENDENCIES) + @rm -f psxid01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxid01/init.c b/testsuites/psxtests/psxid01/init.c new file mode 100644 index 0000000000..3428929ff8 --- /dev/null +++ b/testsuites/psxtests/psxid01/init.c @@ -0,0 +1,126 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <tmacros.h> +#include "test_support.h" + +#include <unistd.h> +#include <errno.h> +#include <sys/types.h> + +void test_gid(void) +{ + gid_t gid; + int sc; + + gid = getegid(); + printf( "getegid = %d\n", gid ); + + gid = getgid(); + printf( "getgid = %d\n", gid ); + + puts( "setgid(5)" ); + sc = setgid(5); + rtems_test_assert( sc == 0 ); + + gid = getegid(); + printf( "getegid = %d\n", gid ); + + gid = getgid(); + printf( "getgid = %d\n", gid ); + + puts( "setpgid(getpid(), 10) - ENOSYS" ); + sc = setpgid( getpid(), 10 ); + rtems_test_assert( sc == -1 ); + rtems_test_assert( errno == ENOSYS ); +} + +void test_uid(void) +{ + uid_t uid; + int sc; + + uid = geteuid(); + printf( "geteuid = %d\n", uid ); + + uid = getuid(); + printf( "getuid = %d\n", uid ); + + puts( "setuid(5)" ); + sc = setuid(5); + rtems_test_assert( sc == 0 ); + + uid = geteuid(); + printf( "geteuid = %d\n", uid ); + + uid = getuid(); + printf( "getuid = %d\n", uid ); + +} + +pid_t __getpid(void); +int issetugid(void); + +void test_pid(void) +{ + pid_t pid; + int sc; + + pid = getpid(); + printf( "getpid = %d\n", pid ); + + pid = __getpid(); + printf( "__getpid = %d\n", pid ); + + pid = getppid(); + printf( "getppid = %d\n", pid ); + + puts( "setsid - EPERM" ); + pid = setsid(); + rtems_test_assert( pid == -1 ); + rtems_test_assert( errno == EPERM ); + + sc = issetugid(); + rtems_test_assert( sc == 0 ); +} + +rtems_task Init( + rtems_task_argument argument +) +{ + puts( "\n\n*** TEST ID 01 ***" ); + + test_gid(); + puts( "" ); + + test_uid(); + puts( "" ); + + test_pid(); + puts( "" ); + + puts( "*** END OF TEST ID 01 ***" ); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/psxtests/psxid01/psxid01.doc b/testsuites/psxtests/psxid01/psxid01.doc new file mode 100644 index 0000000000..6726cff814 --- /dev/null +++ b/testsuites/psxtests/psxid01/psxid01.doc @@ -0,0 +1,34 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This file describes the directives and concepts tested by this test set. + +test set name: psxid01 + +directives: + + getegid + getgid + setgid + setpgid + geteuid + getuid + setuid + geteuid + getuid + getpid + __getpid + getppid + setsid + +concepts: + ++ Fully exercise the above listed methods diff --git a/testsuites/psxtests/psxid01/psxid01.scn b/testsuites/psxtests/psxid01/psxid01.scn new file mode 100644 index 0000000000..663f683e76 --- /dev/null +++ b/testsuites/psxtests/psxid01/psxid01.scn @@ -0,0 +1,20 @@ +*** TEST ID 01 *** +getegid = 0 +getgid = 0 +setgid(5) +getegid = 0 +getgid = 5 +setpgid(getpid(), 10) - ENOSYS + +geteuid = 0 +getuid = 0 +setuid(5) +geteuid = 0 +getuid = 5 + +getpid = 1 +__getpid = 1 +getppid = 0 +setsid - EPERM + +*** END OF TEST ID 01 *** |