mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 06:08:20 +00:00
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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
||||
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
PR 1460/cpukit
|
||||
|
||||
@@ -19,7 +19,8 @@ SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
|
||||
endif
|
||||
|
||||
## File IO tests
|
||||
SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01
|
||||
SUBDIRS += psxfile01 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
|
||||
|
||||
@@ -97,6 +97,7 @@ psxmsgq03/Makefile
|
||||
psxmsgq04/Makefile
|
||||
psxmutexattr01/Makefile
|
||||
psxobj01/Makefile
|
||||
psxpasswd01/Makefile
|
||||
psxreaddir/Makefile
|
||||
psxrdwrv/Makefile
|
||||
psxrwlock01/Makefile
|
||||
|
||||
2
testsuites/psxtests/psxpasswd01/.cvsignore
Normal file
2
testsuites/psxtests/psxpasswd01/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
28
testsuites/psxtests/psxpasswd01/Makefile.am
Normal file
28
testsuites/psxtests/psxpasswd01/Makefile.am
Normal file
@@ -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
|
||||
104
testsuites/psxtests/psxpasswd01/init.c
Normal file
104
testsuites/psxtests/psxpasswd01/init.c
Normal file
@@ -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 */
|
||||
29
testsuites/psxtests/psxpasswd01/psxpasswd01.doc
Normal file
29
testsuites/psxtests/psxpasswd01/psxpasswd01.doc
Normal file
@@ -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.
|
||||
28
testsuites/psxtests/psxpasswd01/psxpasswd01.scn
Normal file
28
testsuites/psxtests/psxpasswd01/psxpasswd01.scn
Normal file
@@ -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 ***
|
||||
|
||||
Reference in New Issue
Block a user