[Pkg-shadow-commits] r1690 - debian/trunk/tests/su/01
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sun Jan 6 19:55:54 UTC 2008
Author: nekral-guest
Date: 2008-01-06 19:55:54 +0000 (Sun, 06 Jan 2008)
New Revision: 1690
Modified:
debian/trunk/tests/su/01/run_su.exp
Log:
Added comments for the test log.
Modified: debian/trunk/tests/su/01/run_su.exp
===================================================================
--- debian/trunk/tests/su/01/run_su.exp 2008-01-06 19:53:47 UTC (rev 1689)
+++ debian/trunk/tests/su/01/run_su.exp 2008-01-06 19:55:54 UTC (rev 1690)
@@ -14,9 +14,17 @@
# 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"
@@ -25,16 +33,30 @@
"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\r" ;# Send the password
+send_user "\n# password '$password' sent\n\n"
+send_user "# expect prompt '$prompt'"
+
expect {
# Wait for the new prompt
"$prompt" {
+ send_user "\n\n# make sure we are '$user'\n"
+ send_user "# id should return '($user).*($user).*($user)"
+ send "\r" ;# restore the prompt for the logs
send "id\r" ;# Verify the id
+
expect {
-re "\\($user\\).*\\($user\\).*\\($user\\)" {
puts "PASS"
More information about the Pkg-shadow-commits
mailing list