There is no need to use expect for these tests.

Only check the stdout/stderr output.
This commit is contained in:
nekral-guest
2009-05-09 22:27:13 +00:00
parent 5520ea45cc
commit d6495cab07
62 changed files with 230 additions and 285 deletions
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
foo L 07/14/2005 0 99999 7 -1
@@ -1,14 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -S foo\r"
expect "foo L 07/14/2005 0 99999 7 -1"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Request password information for user foo (passwd -S foo)..."
passwd -S foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
foo P 07/13/2005 0 99999 7 -1
@@ -1,14 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -S foo\r"
expect "foo P 07/13/2005 0 99999 7 -1"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Request password information for user foo (passwd -S foo)..."
passwd -S foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
foo NP 07/24/2005 0 99998 8 -1
@@ -1,14 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -S foo\r"
expect "foo NP 07/24/2005 0 99998 8 -1"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Request password information for user foo (passwd -S foo)..."
passwd -S foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -1,14 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -S foo\r"
expect "foo P"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -20,7 +20,18 @@ echo -n "Remove /etc/shadow..."
rm -f /etc/shadow
echo "OK"
./passwd.exp
echo -n "Request password information for user foo (passwd -S foo)..."
passwd -S foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -1,14 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -S foo\r"
expect "foo L"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Request password information for user foo (passwd -S foo)..."
passwd -S foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -l foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can lock a password with passwd -l"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Lock foo's password (passwd -l foo)..."
passwd -l foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -l foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "passwd can lock a password in /etc/passwd"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Lock foo's password (passwd -l foo)..."
passwd -l foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl data/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -u foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can unlock a password with passwd -u"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "unlock foo's password (passwd -u foo)..."
passwd -u foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1,2 @@
passwd: unlocking the password would result in a passwordless account.
You should set a password with usermod -p to unlock the password of this account.
@@ -1,19 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -u foo\r"
expect "passwd: unlocking the password would result in a passwordless account."
expect "You should set a password with usermod -p to unlock the password of this account."
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "passwd -u cannot create a passwordless account"
save_config
@@ -16,7 +16,24 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Unlock foo's pasword (passwd -u foo)..."
passwd -u foo 2> tmp/passwd.err && exit 1 || {
status=$?
}
echo "OK"
echo -n "Check returned status ($status)..."
test "$status" = "3"
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.err
echo "======================================================================="
echo -n "Check the error message..."
diff -au data/passwd.err tmp/passwd.err
echo "error message OK."
rm -f tmp/passwd.err
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd -d foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
+13 -2
View File
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can delete a password with passwd -d"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Delete foo's password (passwd -d foo)..."
passwd -d foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd --mindays 10 foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can use passwd --mindays"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Change the min number of days for foo's password (passwd --mindays 10 foo)..."
passwd --mindays 10 foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd --maxdays 10 foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can use passwd --maxdays"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Change the max number of days for foo's password (passwd --maxdays 10 foo)..."
passwd --maxdays 10 foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd --warndays 10 foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can use passwd --warndays"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Change the number of warning days for foo's password (passwd --warndays 10 foo)..."
passwd --warndays 10 foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd --inactive 10 foo\r"
expect "Password changed."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can use passwd --inactive"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Change the number of inactive days for foo's password (passwd --inactive 10 foo)..."
passwd --inactive 10 foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
@@ -0,0 +1 @@
passwd: password expiry information changed.
@@ -1,17 +0,0 @@
#!/usr/bin/expect
set timeout 2
expect_after default {puts "\nFAIL"; exit 1}
spawn /bin/sh
expect "# "
send "passwd --expire foo\r"
expect "Password set to expire."
expect "# "
send "echo \$?\r"
expect "0"
expect "# "
send "exit\r"
puts "OK\n"
exit 0
@@ -7,7 +7,7 @@ cd $(dirname $0)
. ../../common/config.sh
. ../../common/log.sh
log_start "$0" "passwd can report the status of an account to root"
log_start "$0" "root can use passwd --expire"
save_config
@@ -16,7 +16,18 @@ trap 'log_status "$0" "FAILURE"; restore_config' 0
change_config
./passwd.exp
echo -n "Set foo's password as expired (passwd --expire foo)..."
passwd --expire foo > tmp/passwd.out
echo "OK"
echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."
../../common/compare_file.pl config/etc/passwd /etc/passwd
@@ -39,4 +39,4 @@ users:x:100:
nogroup:x:65534:
crontab:x:101:
Debian-exim:x:102:
foo:x
foo:x:1000:
+2 -2
View File
@@ -23,9 +23,9 @@ echo "passwd reported:"
echo "======================================================================="
cat tmp/passwd.out
echo "======================================================================="
echo -n "Check that there were a failure message..."
echo -n "Check the message..."
diff -au data/passwd.out tmp/passwd.out
echo "error message OK."
echo "message OK."
rm -f tmp/passwd.out
echo -n "Check the passwd file..."