[Lsb-messages] /var/www/bzr/lsb/devel/runtime-test r1294: fix passwd test typo, while cleaning up/commenting that test (bug 3980)

Mats Wichmann mats at linuxfoundation.org
Wed May 14 15:24:06 UTC 2014


------------------------------------------------------------
revno: 1294
committer: Mats Wichmann <mats at linuxfoundation.org>
branch nick: runtime-test
timestamp: Wed 2014-05-14 09:24:06 -0600
message:
  fix passwd test typo, while cleaning up/commenting that test (bug 3980)
modified:
  modules/usersgroups/tset/LSB.usersgroups/commands/misc/command_tests.sh
  modules/usersgroups/tset/LSB.usersgroups/commands/misc/cpt.c
  scripts/package/Makefile
-------------- next part --------------
=== modified file 'modules/usersgroups/tset/LSB.usersgroups/commands/misc/command_tests.sh'
--- a/modules/usersgroups/tset/LSB.usersgroups/commands/misc/command_tests.sh	2010-01-21 13:24:48 +0000
+++ b/modules/usersgroups/tset/LSB.usersgroups/commands/misc/command_tests.sh	2014-05-14 15:24:06 +0000
@@ -1643,9 +1643,9 @@
 # - Assumptions:
 # - 	1)Tester has super-user privilege.
 # -	2)All of the commands used in this script work.
-# - 
+# -  
 # - Strategy Statement:
-# - 	Execute passwd and test all its options.
+# - 	Execute passwd and test various options.
 # - 
 # - Expected Results:
 # -    	As specified in the spec. 
@@ -1665,40 +1665,43 @@
 tp40()
  {
     tpstart "passwd - change a user password.  - Reference the Commands and Utilities chapter in the Specification"
-    tet_infoline "Password for the user should be change."
+    tet_infoline "Password for the user should be changed."
     
-#Add a test user
+    # Add a test user 
     OTHER_USER=vsx21
     useradd $OTHER_USER > /dev/null 2>&1
     if [ $? -ne 0 ]; then
-	tet_infoline "Un-able to add a test user: useradd "
+	tet_infoline "Unable to add a test user: useradd "
 	tpresult UNRESOLVED	
     	return
     fi
-    
-#Test passwd with NO option: 
-	OLD_PASSWORD=$(./uberpass -S -p $OTHER_USER)
-
-   TestFile=test.passwd
-
-cat > $TestFile << EOF
-t3st1ng.
-t3st1ng.
+    OLD_PASSWORD=$(./uberpass -S -p $OTHER_USER)
+
+    # Prepare the password to change to.
+    # Note we expect feeding two identical lines from a file as stdin
+    # gives the desired result. We need to pick a password that will
+    # cause no complaints and especially not give additional prompts.
+
+    TestFile=test.passwd
+    cat > $TestFile << EOF
+,eJUQ7hVO
+,eJUQ7hVO
 EOF
 
+    # Test passwd with NO option:
     ./cpt passwd $OTHER_USER < $TestFile > /dev/null 2>&1 
-	if [ $? -eq 0 ]; then
-		NEW_PASSWORD=$(./uberpass -S -p $OTHER_USER)
-		if [ "$OLD_PASSWOR" = "$NEW_PASSWORD" ]; then
-			FAIL=Y
-			tet_infoline "user password did not change."
-		else
-			tet_infoline "passwd : PASS"	
-		fi
+    if [ $? -eq 0 ]; then
+	NEW_PASSWORD=$(./uberpass -S -p $OTHER_USER)
+	if [ "$OLD_PASSWORD" = "$NEW_PASSWORD" ]; then
+	    FAIL=Y
+	    tet_infoline "user password did not change."
 	else
-		tet_infoline "passwd : FAIL"	
-		FAIL=Y
+	    tet_infoline "passwd : PASS"	
 	fi
+    else
+	tet_infoline "passwd : FAIL"	
+	FAIL=Y
+    fi
 
     remove_user $OTHER_USER
     rm -f $TestFile > /dev/null 2>&1
@@ -1718,8 +1721,8 @@
 	tpresult UNRESOLVED	
     	return
     fi
-    
-#Test passwd with option: -x
+ 
+    #Test passwd with option: -x
     passwd -x 384 $OTHER_USER > /dev/null 2>&1 
     TC_EXIT_VALUE=$?
     if [ $TC_EXIT_VALUE -eq 0 ]; then

=== modified file 'modules/usersgroups/tset/LSB.usersgroups/commands/misc/cpt.c'
--- a/modules/usersgroups/tset/LSB.usersgroups/commands/misc/cpt.c	2012-06-10 17:20:53 +0000
+++ b/modules/usersgroups/tset/LSB.usersgroups/commands/misc/cpt.c	2014-05-14 15:24:06 +0000
@@ -1,185 +1,185 @@
-/*
-############################################################################
-# (C) Copyright 2001 The Free Standards Group  Inc
-# ./tset/LSB.usersgroups/usersgroups/commands/root_funcs.sh
-# root_funcs.sh : helper functions for paswd-tc.sh
-#
-# Log: root_funcs.sh,v 
-#
-# Revision 1.1  2001/07/05 11:22:05  cyeoh
-# 	Adds in passwd command tests
-#
-# Revision 1.2 2001/07/19 15:42:39 Apham
-#	Adds more descriptive comments
-#
-############################################################################
- * Sets up master/slave pseudo ttys. Forks and execs given
- * program and passes standard input of parent to child through
- * pseudo terminal. Attaches slave pty to child's stdin, stdout
- * and stderr before exec'ing.
- *
- * Probably has some problems if the exec'd program outputs
- * too much data after the parent has finished passing data to it.
- * Doesn't do anything with data passed back from child to parent.
- *
- * Chris Yeoh (yeohc at au1.ibm.com), IBM
- *
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/wait.h>
-#include <string.h>
-
-#define READBUFSIZE 500
-
-int main(int argc, char *argv[])
-/**************************************************************************
-* This functions allows interactive testing.
-**************************************************************************/
-{
-  int pt;
-  char *pttyname;
-  int slave;
-  pid_t cpid;
-
-  if (argc<2)
-  {
-    fprintf(stderr, "Must supply program name to exec\n");
-    exit(1);
-  }
-
-  /* Setup master/slave pseudo tty's */
-  pt = getpt();
-  pttyname = ptsname(pt);
-  unlockpt(pt);
-  slave = open(pttyname, O_RDWR);
-
-  if (slave==-1)
-  {
-    perror("Couldn't open pty");
-    exit(1);
-  }
-
-  fflush(NULL);
-  cpid = fork();
-
-  if (cpid==-1)
-  {
-    perror("fork failed");
-    exit(1);
-  }
-  else if (cpid!=0)
-  {
-    /* Parent */
-    char readbuf[READBUFSIZE];
-    int rd_count;
-    fd_set rds;
-    close(slave);
-
-
-    while (1)
-    {
-      /* Read from pt so it doesn't block up and cause
-         problems on the other end */
-      int stdin_exhausted = 0;
-      FD_ZERO(&rds);
-      if (!stdin_exhausted) FD_SET(0, &rds);
-      FD_SET(pt, &rds);
-
-      sleep(1); /* Magic sleep. Ick. */
-      if (select(pt+1, &rds, NULL, NULL, NULL)<-1)
-      {
-	perror("select failed");
-      }
-
-      if (FD_ISSET(pt, &rds))
-      {
-	rd_count = read(pt, readbuf, READBUFSIZE-1);
-	if (rd_count<=0)
-	{
-	  int status;
-	  waitpid(cpid, &status, 0);
-	  exit(WEXITSTATUS(status));
-	}
-	/* We just throw away any data from child */
-	/* Uncomment the next two lines to get data back
-	   from child. Note that data you send gets echoed
-	   back and may appear to be out of sync */
-/*  	readbuf[rd_count] = 0; */
-/*  	fprintf(stderr, "%s\n", readbuf); */
-      }
-      else if (FD_ISSET(0, &rds))
-      {
-	/* Read from stdin to get data to pass to child */
-	int num_read;
-	rd_count = 0;
-
-	while (rd_count<READBUFSIZE)
-	{
-	  num_read = read(0, readbuf+rd_count, 1);
-
-	  if (num_read==-1)
-	  {
-	    perror("Read on stdin failed");
-	    exit(1);
-	  }
-	  else if (num_read==0)
-	  {
-	    /* stdin has closed */
-	    stdin_exhausted = 1;
-	  }
-	  else
-	  {
-	    rd_count++;
-	    if (readbuf[rd_count-1]=='\n') break;
-	  }
-	}
-
-	{
-	  /* Pass data down to child */
-	  int count = 0;
-	  int wrote;
-
-	  readbuf[rd_count] = 0;
-	  while (count<rd_count)
-	  {
-	    wrote =  write(pt, readbuf+count, rd_count-count);
-	    if (wrote<-1)
-	    {
-	      perror("Write on pt failed");
-	      exit(1);
-	    }
-	    count += wrote;
-	  }
-
-	}
-      }
-
-    }
-  }
-  else
-  {
-    /* Child */
-    setsid(); /* Ensure /dev/tty gets set to us */
-    close(pt);
-
-    /* Reattach stdin, stdout, stderr */
-    dup2(slave,0);
-    dup2(slave,1);
-    dup2(slave,2);
-
-    execvp(argv[1], argv+1);
-    perror("exec failed");
-    exit(255);
-  }
-
-  /* Shouldn't get here */
-  exit(0);
-}
+/*
+############################################################################
+# (C) Copyright 2001 The Free Standards Group  Inc
+# ./tset/LSB.usersgroups/usersgroups/commands/root_funcs.sh
+# root_funcs.sh : helper functions for paswd-tc.sh
+#
+# Log: root_funcs.sh,v 
+#
+# Revision 1.1  2001/07/05 11:22:05  cyeoh
+# 	Adds in passwd command tests
+#
+# Revision 1.2 2001/07/19 15:42:39 Apham
+#	Adds more descriptive comments
+#
+############################################################################
+ * Sets up master/slave pseudo ttys. Forks and execs given
+ * program and passes standard input of parent to child through
+ * pseudo terminal. Attaches slave pty to child's stdin, stdout
+ * and stderr before exec'ing.
+ *
+ * Probably has some problems if the exec'd program outputs
+ * too much data after the parent has finished passing data to it.
+ * Doesn't do anything with data passed back from child to parent.
+ *
+ * Chris Yeoh (yeohc at au1.ibm.com), IBM
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/select.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <string.h>
+
+#define READBUFSIZE 500
+
+int main(int argc, char *argv[])
+/**************************************************************************
+* This functions allows interactive testing.
+**************************************************************************/
+{
+  int pt;
+  char *pttyname;
+  int slave;
+  pid_t cpid;
+
+  if (argc<2)
+  {
+    fprintf(stderr, "Must supply program name to exec\n");
+    exit(1);
+  }
+
+  /* Setup master/slave pseudo tty's */
+  pt = getpt();
+  pttyname = ptsname(pt);
+  unlockpt(pt);
+  slave = open(pttyname, O_RDWR);
+
+  if (slave==-1)
+  {
+    perror("Couldn't open pty");
+    exit(1);
+  }
+
+  fflush(NULL);
+  cpid = fork();
+
+  if (cpid==-1)
+  {
+    perror("fork failed");
+    exit(1);
+  }
+  else if (cpid!=0)
+  {
+    /* Parent */
+    char readbuf[READBUFSIZE];
+    int rd_count;
+    fd_set rds;
+    close(slave);
+
+
+    while (1)
+    {
+      /* Read from pt so it doesn't block up and cause
+         problems on the other end */
+      int stdin_exhausted = 0;
+      FD_ZERO(&rds);
+      if (!stdin_exhausted) FD_SET(0, &rds);
+      FD_SET(pt, &rds);
+
+      sleep(1); /* Magic sleep. Ick. */
+      if (select(pt+1, &rds, NULL, NULL, NULL)<-1)
+      {
+	perror("select failed");
+      }
+
+      if (FD_ISSET(pt, &rds))
+      {
+	rd_count = read(pt, readbuf, READBUFSIZE-1);
+	if (rd_count<=0)
+	{
+	  int status;
+	  waitpid(cpid, &status, 0);
+	  exit(WEXITSTATUS(status));
+	}
+	/* We just throw away any data from child */
+	/* Uncomment the next two lines to get data back
+	   from child. Note that data you send gets echoed
+	   back and may appear to be out of sync */
+/*  	readbuf[rd_count] = 0; */
+/*  	fprintf(stderr, "%s\n", readbuf); */
+      }
+      else if (FD_ISSET(0, &rds))
+      {
+	/* Read from stdin to get data to pass to child */
+	int num_read;
+	rd_count = 0;
+
+	while (rd_count<READBUFSIZE)
+	{
+	  num_read = read(0, readbuf+rd_count, 1);
+
+	  if (num_read==-1)
+	  {
+	    perror("Read on stdin failed");
+	    exit(1);
+	  }
+	  else if (num_read==0)
+	  {
+	    /* stdin has closed */
+	    stdin_exhausted = 1;
+	  }
+	  else
+	  {
+	    rd_count++;
+	    if (readbuf[rd_count-1]=='\n') break;
+	  }
+	}
+
+	{
+	  /* Pass data down to child */
+	  int count = 0;
+	  int wrote;
+
+	  readbuf[rd_count] = 0;
+	  while (count<rd_count)
+	  {
+	    wrote =  write(pt, readbuf+count, rd_count-count);
+	    if (wrote<-1)
+	    {
+	      perror("Write on pt failed");
+	      exit(1);
+	    }
+	    count += wrote;
+	  }
+
+	}
+      }
+
+    }
+  }
+  else
+  {
+    /* Child */
+    setsid(); /* Ensure /dev/tty gets set to us */
+    close(pt);
+
+    /* Reattach stdin, stdout, stderr */
+    dup2(slave,0);
+    dup2(slave,1);
+    dup2(slave,2);
+
+    execvp(argv[1], argv+1);
+    perror("exec failed");
+    exit(255);
+  }
+
+  /* Shouldn't get here */
+  exit(0);
+}

=== modified file 'scripts/package/Makefile'
--- a/scripts/package/Makefile	2014-04-26 15:24:06 +0000
+++ b/scripts/package/Makefile	2014-05-14 15:24:06 +0000
@@ -1,7 +1,7 @@
 # values used to populate .spec from .spec.sed
 PACKAGE=lsb-test-core
-VERSION=4.1.92
-BUILDNO=4
+VERSION=4.1.93
+BUILDNO=1
 # PAM Version
 PVERSION=0.99.8.1
 SYSLOGVER=1.4.2rh



More information about the lsb-messages mailing list