[Pkg-shadow-commits] r3239 - in debian/trunk/tests/su: . 12_su_child_failure 13_su_child_success

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Aug 26 19:31:03 UTC 2010


Author: nekral-guest
Date: 2010-08-26 19:30:52 +0000 (Thu, 26 Aug 2010)
New Revision: 3239

Added:
   debian/trunk/tests/su/12_su_child_failure/
   debian/trunk/tests/su/13_su_child_success/
Removed:
   debian/trunk/tests/su/12_su_child_failure/data/
   debian/trunk/tests/su/12_su_child_failure/run_su.exp
   debian/trunk/tests/su/13_su_child_success/data/
   debian/trunk/tests/su/13_su_child_success/run_su.exp
Modified:
   debian/trunk/tests/su/12_su_child_failure/su.test
   debian/trunk/tests/su/13_su_child_success/su.test
Log:
Added 2 tests for su.



Property changes on: debian/trunk/tests/su/12_su_child_failure
___________________________________________________________________
Added: svn:ignore
   + su.test.log


Deleted: debian/trunk/tests/su/12_su_child_failure/run_su.exp
===================================================================
--- debian/trunk/tests/su/11_su_sulog_failure/run_su.exp	2009-05-22 11:50:26 UTC (rev 2993)
+++ debian/trunk/tests/su/12_su_child_failure/run_su.exp	2010-08-26 19:30:52 UTC (rev 3239)
@@ -1,67 +0,0 @@
-#!/usr/bin/expect
-
-set timeout 5
-expect_after default {puts "\nFAIL"; exit 1}
-
-if {$argc != 3} {
-	puts "usage: run_su.exp <user> <password> <prompt>"
-	exit 1
-}
-
-set user     [lindex $argv 0]
-set password [lindex $argv 1]
-set prompt   [lindex $argv 2]
-
-# First, switch to the testsuite user
-# (otherwise, no password will be asked)
-send_user "# switch to the passwordless 'testsuite' user\n"
-send_user "# and expect a '$ ' prompt\n"
-spawn /bin/su testsuite
-
-expect "$ "			;# Wait for the prompt
-
-send_user "\n# make sure we are now 'testsuite'"
-send_user "\n# id should return 'uid=424243(testsuite) gid=424243 groups=424243'"
-send "\r"			;# restore the prompt for the logs
-send "id\r"			;# Verify we are really testsuite
-
-expect {
-	timeout {
-		puts "\ntimeout...FAIL"
-		exit 1
-	}
-	"uid=424243(testsuite) gid=424243 groups=424243"
-}
-
-expect "$ "			;# Wait for the prompt
-
-send_user "\n\n"
-send_user "# now switch to user '$user'\n"
-send_user "# and expect a password prompt"
-send "\r"			;# restore the prompt for the logs
-send "su $user\r"		;# Switch to the user
-expect "Password: "		;# Wait for the Password: prompt
-# Wait a little bit more (su is not ready to receive the password)
-sleep 0.1
-
-send "$password wrong\r"	;# Send the password
-
-send_user "\n# password '$password wrong' sent\n\n"
-send_user "# expect prompt '$ '"
-
-expect {
-	# Wait for the new prompt
-	"$ " {
-		send_user "\n\n# make sure we are 'testsuite'\n"
-		send_user "\n# id should return 'uid=424243(testsuite) gid=424243 groups=424243'"
-		send "\r"	;# restore the prompt for the logs
-		send "id\r"	;# Verify the id
-		expect "uid=424243(testsuite) gid=424243 groups=424243"
-		send "exit\r"
-		puts "\nPASS"
-		exit 0
-	}
-}
-
-puts "\ntimeout...FAIL"
-exit 1

Modified: debian/trunk/tests/su/12_su_child_failure/su.test
===================================================================
--- debian/trunk/tests/su/11_su_sulog_failure/su.test	2009-05-22 11:50:26 UTC (rev 2993)
+++ debian/trunk/tests/su/12_su_child_failure/su.test	2010-08-26 19:30:52 UTC (rev 3239)
@@ -7,7 +7,7 @@
 . ../../common/config.sh
 . ../../common/log.sh
 
-log_start "$0" "su can be used to switch to a non-root user"
+log_start "$0" "su return failures of its child"
 
 
 # no testsuite password
@@ -21,19 +21,15 @@
 
 change_config
 
-./run_su.exp myuser myuserF00barbaz-wrong '$ '
+echo -n "Run su, execute false..."
+su -l myuser -c false && exit || {
+	status=$?
+}
+echo "OK"
 
-#date +"SU %m/%d %H:%M + $(tty) root-testsuite"    > tmp/sulog
-#date +"SU %m/%d %H:%M + $(tty) testsuite-myuser" >> tmp/sulog
-echo -n "Check /var/log/sulog..."
-wc -l /var/log/sulog > tmp/sulog
-cat /var/log/sulog | \
-    egrep -v "$(date +"SU %m/%d %H:%M \+ /dev/pts/[0-9]* root-testsuite")" | \
-    egrep -v "$(date +"SU %m/%d %H:%M - /dev/pts/[0-9]* testsuite-myuser")" \
-        >> tmp/sulog || true
-diff -au tmp/sulog data/sulog
+echo -n "Check the return status..."
+[ "$status" = "1" ]
 echo "OK"
-rm -f tmp/sulog
 
 log_status "$0" "SUCCESS"
 restore_config


Property changes on: debian/trunk/tests/su/13_su_child_success
___________________________________________________________________
Added: svn:ignore
   + su.test.log


Deleted: debian/trunk/tests/su/13_su_child_success/run_su.exp
===================================================================
--- debian/trunk/tests/su/11_su_sulog_failure/run_su.exp	2009-05-22 11:50:26 UTC (rev 2993)
+++ debian/trunk/tests/su/13_su_child_success/run_su.exp	2010-08-26 19:30:52 UTC (rev 3239)
@@ -1,67 +0,0 @@
-#!/usr/bin/expect
-
-set timeout 5
-expect_after default {puts "\nFAIL"; exit 1}
-
-if {$argc != 3} {
-	puts "usage: run_su.exp <user> <password> <prompt>"
-	exit 1
-}
-
-set user     [lindex $argv 0]
-set password [lindex $argv 1]
-set prompt   [lindex $argv 2]
-
-# First, switch to the testsuite user
-# (otherwise, no password will be asked)
-send_user "# switch to the passwordless 'testsuite' user\n"
-send_user "# and expect a '$ ' prompt\n"
-spawn /bin/su testsuite
-
-expect "$ "			;# Wait for the prompt
-
-send_user "\n# make sure we are now 'testsuite'"
-send_user "\n# id should return 'uid=424243(testsuite) gid=424243 groups=424243'"
-send "\r"			;# restore the prompt for the logs
-send "id\r"			;# Verify we are really testsuite
-
-expect {
-	timeout {
-		puts "\ntimeout...FAIL"
-		exit 1
-	}
-	"uid=424243(testsuite) gid=424243 groups=424243"
-}
-
-expect "$ "			;# Wait for the prompt
-
-send_user "\n\n"
-send_user "# now switch to user '$user'\n"
-send_user "# and expect a password prompt"
-send "\r"			;# restore the prompt for the logs
-send "su $user\r"		;# Switch to the user
-expect "Password: "		;# Wait for the Password: prompt
-# Wait a little bit more (su is not ready to receive the password)
-sleep 0.1
-
-send "$password wrong\r"	;# Send the password
-
-send_user "\n# password '$password wrong' sent\n\n"
-send_user "# expect prompt '$ '"
-
-expect {
-	# Wait for the new prompt
-	"$ " {
-		send_user "\n\n# make sure we are 'testsuite'\n"
-		send_user "\n# id should return 'uid=424243(testsuite) gid=424243 groups=424243'"
-		send "\r"	;# restore the prompt for the logs
-		send "id\r"	;# Verify the id
-		expect "uid=424243(testsuite) gid=424243 groups=424243"
-		send "exit\r"
-		puts "\nPASS"
-		exit 0
-	}
-}
-
-puts "\ntimeout...FAIL"
-exit 1

Modified: debian/trunk/tests/su/13_su_child_success/su.test
===================================================================
--- debian/trunk/tests/su/11_su_sulog_failure/su.test	2009-05-22 11:50:26 UTC (rev 2993)
+++ debian/trunk/tests/su/13_su_child_success/su.test	2010-08-26 19:30:52 UTC (rev 3239)
@@ -7,7 +7,7 @@
 . ../../common/config.sh
 . ../../common/log.sh
 
-log_start "$0" "su can be used to switch to a non-root user"
+log_start "$0" "su return failures of its child"
 
 
 # no testsuite password
@@ -21,19 +21,9 @@
 
 change_config
 
-./run_su.exp myuser myuserF00barbaz-wrong '$ '
-
-#date +"SU %m/%d %H:%M + $(tty) root-testsuite"    > tmp/sulog
-#date +"SU %m/%d %H:%M + $(tty) testsuite-myuser" >> tmp/sulog
-echo -n "Check /var/log/sulog..."
-wc -l /var/log/sulog > tmp/sulog
-cat /var/log/sulog | \
-    egrep -v "$(date +"SU %m/%d %H:%M \+ /dev/pts/[0-9]* root-testsuite")" | \
-    egrep -v "$(date +"SU %m/%d %H:%M - /dev/pts/[0-9]* testsuite-myuser")" \
-        >> tmp/sulog || true
-diff -au tmp/sulog data/sulog
+echo -n "Run su, execute false..."
+su -l myuser -c true
 echo "OK"
-rm -f tmp/sulog
 
 log_status "$0" "SUCCESS"
 restore_config




More information about the Pkg-shadow-commits mailing list