[Pkg-shadow-commits] r600 - trunk/tests/su/02
Nicolas FRANCOIS
nekral-guest at costa.debian.org
Wed Oct 12 22:28:51 UTC 2005
Author: nekral-guest
Date: 2005-10-12 22:28:50 +0000 (Wed, 12 Oct 2005)
New Revision: 600
Modified:
trunk/tests/su/02/run.exp
Log:
Simplify this expect script, factorize the default values by using:
expect_after default {puts "\nFAIL"; exit 1}
Thanks to Alexander Gattin.
Modified: trunk/tests/su/02/run.exp
===================================================================
--- trunk/tests/su/02/run.exp 2005-10-12 21:17:57 UTC (rev 599)
+++ trunk/tests/su/02/run.exp 2005-10-12 22:28:50 UTC (rev 600)
@@ -1,25 +1,17 @@
#!/usr/bin/expect
set timeout 2
+expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/bash
expect "# "
send "id\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "uid=0(root) gid=0(root) groups=0(root)\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "uid=0(root) gid=0(root) groups=0(root)\r"
+expect "# "
send "export FOO=bar\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "# "
#=============================================================================
#
@@ -27,33 +19,18 @@
#
#=============================================================================
send "/bin/su myuser\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "$ "
send "id\n"
-expect {
- default {puts "\nFAIL"; exit 1}
- "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
+expect "$ "
send "echo \"FOO=\\\"\$FOO\\\"\"\r"
expect "FOO=\"bar\"\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "$ "
send "exit\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "# "
#=============================================================================
#
@@ -61,36 +38,18 @@
#
#=============================================================================
send "/bin/su - myuser\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "$ "
send "id\n"
-expect {
- default {puts "\nFAIL"; exit 1}
- "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
+expect "$ "
send "echo \"FOO=\\\"\$FOO\\\"\"\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "FOO=\"\"\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "FOO=\"\"\r"
+expect "$ "
send "exit\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "# "
#=============================================================================
#
@@ -98,36 +57,18 @@
#
#=============================================================================
send "/bin/su -m myuser\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "$ "
send "id\n"
-expect {
- default {puts "\nFAIL"; exit 1}
- "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
+expect "$ "
send "echo \"FOO=\\\"\$FOO\\\"\"\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "FOO=\"bar\"\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "FOO=\"bar\"\r"
+expect "$ "
send "exit\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "# "
#=============================================================================
@@ -136,36 +77,18 @@
#
#=============================================================================
send "/bin/su -p - myuser\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "$ "
send "id\n"
-expect {
- default {puts "\nFAIL"; exit 1}
- "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r"
+expect "$ "
send "echo \"FOO=\\\"\$FOO\\\"\"\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "FOO=\"bar\"\r"
-}
-expect {
- default {puts "\nFAIL"; exit 1}
- "$ "
-}
+expect "FOO=\"bar\"\r"
+expect "$ "
send "exit\r"
-expect {
- default {puts "\nFAIL"; exit 1}
- "# "
-}
+expect "# "
puts "\nPASS"
More information about the Pkg-shadow-commits
mailing list