summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxpasswd01/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 17:26:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-01 17:26:37 +0000
commit1fe4042000bb5daea3b4914106869e53c79d3671 (patch)
treef6a016403b5621d3b7f39a4d63fddca4700b0218 /testsuites/psxtests/psxpasswd01/init.c
parent2010-07-01 Vinu Rajashekhar <vinutheraj@gmail.com> (diff)
downloadrtems-1fe4042000bb5daea3b4914106869e53c79d3671.tar.bz2
2010-07-01 Bharath Suri <bharath.s.jois@gmail.com>
PR 1598/testing * Makefile.am, configure.ac, psxpasswd01/init.c, psxpasswd01/psxpasswd01.doc, psxpasswd01/psxpasswd01.scn: Add testing for POSIX user database (e.g. /etc/group and /etc/passwd) access routines which are implemented in libcsupport/src/getpwent.c. * psxpasswd02/.cvsignore, psxpasswd02/Makefile.am, psxpasswd02/init.c, psxpasswd02/psxpasswd02.doc, psxpasswd02/psxpasswd02.scn: New files.
Diffstat (limited to 'testsuites/psxtests/psxpasswd01/init.c')
-rw-r--r--testsuites/psxtests/psxpasswd01/init.c112
1 files changed, 108 insertions, 4 deletions
diff --git a/testsuites/psxtests/psxpasswd01/init.c b/testsuites/psxtests/psxpasswd01/init.c
index 6652681b63..f11c3f469c 100644
--- a/testsuites/psxtests/psxpasswd01/init.c
+++ b/testsuites/psxtests/psxpasswd01/init.c
@@ -60,19 +60,100 @@ rtems_task Init(
struct passwd *pw;
struct group *gr;
- puts( "*** PASSWORD/GROUP TEST ***" );
+ puts( "*** PASSWORD/GROUP TEST - 01 ***" );
+
+ /* getpwent */
+ puts( "Init - getpwent() -- OK, result should be NULL" );
+ pw = getpwent();
+ rtems_test_assert( !pw );
+
+ /* getgrent */
+ puts( "Init - getgrent() -- OK, result should be NULL" );
+ gr = getgrent();
+ rtems_test_assert( !gr );
+
+ /* setpwent */
+
+ puts( "Init - setpwent() -- OK" );
+ setpwent();
+
+ /* setgrent */
+
+ puts( "Init - setgrent() -- OK" );
+ setgrent();
+
+ /* getpwent */
+
+ puts( "Init - getpwent() (1) -- OK" );
+ pw = getpwent();
+ rtems_test_assert( pw );
+ print_passwd( pw );
+
+ puts( "Init - getpwent() (2) -- OK" );
+ pw = getpwent();
+ rtems_test_assert( pw );
+ print_passwd( pw );
+
+ puts( "Init - getpwent() (3) -- OK" );
+ pw = getpwent();
+ rtems_test_assert( pw );
+ print_passwd( pw );
+
+ puts( "Init - getpwent() (4) -- result should be NULL" );
+ pw = getpwent();
+ rtems_test_assert( !pw );
+
+ /* getgrent */
+
+ puts( "Init - getgrent() (1) -- OK" );
+ gr = getgrent();
+ rtems_test_assert( gr );
+ print_group( gr );
+
+ puts( "Init - getgrent() (2) -- OK" );
+ gr = getgrent();
+ rtems_test_assert( gr );
+ print_group( gr );
+
+ puts( "Init - getgrent() (3) -- OK" );
+ gr = getgrent();
+ rtems_test_assert( gr );
+ print_group( gr );
+
+ puts( "Init - getgrent() (4) -- result should be NULL" );
+ gr = getgrent();
+ rtems_test_assert( !gr );
/* getpwnam */
puts( "Init - getpwnam(\"root\") -- OK" );
- pw = getpwnam("root");
+ pw = getpwnam( "root" );
rtems_test_assert( pw );
print_passwd( pw );
puts( "Init - getpwnam(\"rtems\") -- OK" );
- pw = getpwnam("rtems");
+ pw = getpwnam( "rtems" );
+ rtems_test_assert( pw );
+ print_passwd( pw );
+
+ puts( "Init - getpwnam(\"suser\") -- result should be NULL" );
+ pw = getpwnam( "suser" );
+ rtems_test_assert( !pw );
+
+ /* getpwuid */
+ puts( "Init - getpwuid(0) -- OK" );
+ pw = getpwuid( 0 );
+ rtems_test_assert( pw );
+ print_passwd( pw );
+
+ puts( "Init - getpwuid(1) -- OK" );
+ pw = getpwuid( 1 );
rtems_test_assert( pw );
print_passwd( pw );
+ puts( "Init - getpwuid(4) -- result should be NULL" );
+ pw = getpwuid( 4 );
+ rtems_test_assert( !pw );
+
/* getgrnam */
puts( "Init - getgrnam(\"root\") -- OK" );
gr = getgrnam("root");
@@ -84,7 +165,30 @@ rtems_task Init(
rtems_test_assert( gr );
print_group( gr );
- puts( "*** END OF PASSWORD/GROUP TEST ***" );
+ /* getgrgid */
+ puts( "Init - getgrgid(0) -- OK" );
+ gr = getgrgid(0);
+ rtems_test_assert( gr );
+ print_group( gr );
+
+ puts( "Init - getgrgid(1) -- OK" );
+ gr = getgrgid(1);
+ rtems_test_assert( gr );
+ print_group( gr );
+
+ puts( "Init - getgrgid(4) -- result should be NULL");
+ gr = getgrgid( 4 );
+ rtems_test_assert( !gr );
+
+ /* endpwent */
+ puts( "Init - endpwent() -- OK" );
+ endpwent();
+
+ /* endgrent */
+ puts( "Init - endgrent() -- OK" );
+ endgrent();
+
+ puts( "*** END OF PASSWORD/GROUP TEST - 01 ***" );
rtems_test_exit( 0 );
}