diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-12-03 17:15:02 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-12-03 17:15:02 +0000 |
commit | 4828ee25a2db70acdb74adcc4d2075f657717a3c (patch) | |
tree | 2d816f4eca71263f98b422845807ff7b21c12261 /testsuites/psxtests/psxpasswd01 | |
parent | 2009-12-03 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-4828ee25a2db70acdb74adcc4d2075f657717a3c.tar.bz2 |
2009-12-03 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: New test to exercise getgrnam and getpwnam
families.
* psxpasswd01/.cvsignore, psxpasswd01/Makefile.am, psxpasswd01/init.c,
psxpasswd01/psxpasswd01.doc, psxpasswd01/psxpasswd01.scn: New files.
Diffstat (limited to 'testsuites/psxtests/psxpasswd01')
-rw-r--r-- | testsuites/psxtests/psxpasswd01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxpasswd01/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psxpasswd01/init.c | 104 | ||||
-rw-r--r-- | testsuites/psxtests/psxpasswd01/psxpasswd01.doc | 29 | ||||
-rw-r--r-- | testsuites/psxtests/psxpasswd01/psxpasswd01.scn | 28 |
5 files changed, 191 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxpasswd01/.cvsignore b/testsuites/psxtests/psxpasswd01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psxpasswd01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psxpasswd01/Makefile.am b/testsuites/psxtests/psxpasswd01/Makefile.am new file mode 100644 index 0000000000..ab990a2117 --- /dev/null +++ b/testsuites/psxtests/psxpasswd01/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxpasswd01 +psxpasswd01_SOURCES = init.c ../include/pmacros.h + +dist_rtems_tests_DATA = psxpasswd01.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxpasswd01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxpasswd01_OBJECTS) $(psxpasswd01_LDADD) +LINK_LIBS = $(psxpasswd01_LDLIBS) + +psxpasswd01$(EXEEXT): $(psxpasswd01_OBJECTS) $(psxpasswd01_DEPENDENCIES) + @rm -f psxpasswd01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxpasswd01/init.c b/testsuites/psxtests/psxpasswd01/init.c new file mode 100644 index 0000000000..6652681b63 --- /dev/null +++ b/testsuites/psxtests/psxpasswd01/init.c @@ -0,0 +1,104 @@ +/* + * COPYRIGHT (c) 1989-2009. + * 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 <bsp.h> +#include <pmacros.h> +#include <sys/types.h> +#include <pwd.h> +#include <grp.h> + +void print_passwd( + struct passwd *pw +) +{ + printf( + " username: %s\n" + " user password: %s\n" + " user ID: %d\n" + " group ID: %d\n" + " real name: %s\n" + " home directory: %s\n" + " shell program: %s\n", + pw->pw_name, + pw->pw_passwd, + pw->pw_uid, + pw->pw_gid, + pw->pw_gecos, + pw->pw_dir, + pw->pw_shell + ); +} + +void print_group( + struct group *gr +) +{ + printf( + " group name: %s\n" + " group password: %s\n" + " group ID: %d\n", + gr->gr_name, + gr->gr_passwd, + gr->gr_gid + ); + + /* TBD print users in group */ +} + +rtems_task Init( + rtems_task_argument ignored +) +{ + struct passwd *pw; + struct group *gr; + + puts( "*** PASSWORD/GROUP TEST ***" ); + + /* getpwnam */ + puts( "Init - getpwnam(\"root\") -- OK" ); + pw = getpwnam("root"); + rtems_test_assert( pw ); + print_passwd( pw ); + + puts( "Init - getpwnam(\"rtems\") -- OK" ); + pw = getpwnam("rtems"); + rtems_test_assert( pw ); + print_passwd( pw ); + + /* getgrnam */ + puts( "Init - getgrnam(\"root\") -- OK" ); + gr = getgrnam("root"); + rtems_test_assert( gr ); + print_group( gr ); + + puts( "Init - getgrnam(\"rtems\") -- OK" ); + gr = getgrnam("rtems"); + rtems_test_assert( gr ); + print_group( gr ); + + puts( "*** END OF PASSWORD/GROUP TEST ***" ); + rtems_test_exit( 0 ); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6 + +#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/psxpasswd01/psxpasswd01.doc b/testsuites/psxtests/psxpasswd01/psxpasswd01.doc new file mode 100644 index 0000000000..f35bac76a2 --- /dev/null +++ b/testsuites/psxtests/psxpasswd01/psxpasswd01.doc @@ -0,0 +1,29 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2009. +# 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: POSIX PASSWD/GROUP TEST + +directives: + getpwnam + getpwuid + getpwnam_r + getpwuid_r + + getgrnam + getgrgid + getgrnam_r + getgrgid_r + +concepts: + ++ Fully exercise services related to /etc/passwd and /etc/group. diff --git a/testsuites/psxtests/psxpasswd01/psxpasswd01.scn b/testsuites/psxtests/psxpasswd01/psxpasswd01.scn new file mode 100644 index 0000000000..80128cc6f1 --- /dev/null +++ b/testsuites/psxtests/psxpasswd01/psxpasswd01.scn @@ -0,0 +1,28 @@ +*** PASSWORD/GROUP TEST *** +Init - getpwnam("root") -- OK + username: root + user password: * + user ID: 0 + group ID: 0 + real name: + home directory: / + shell program: /bin/sh +Init - getpwnam("rtems") -- OK + username: rtems + user password: * + user ID: 1 + group ID: 1 + real name: + home directory: / + shell program: /bin/sh + +Init - getgrnam("root") -- OK + group name: root + group password: x + group ID: 0 +Init - getgrnam("rtems") -- OK + group name: rtems + group password: x + group ID: 1 +*** END OF PASSWORD/GROUP TEST *** + |