shadow/tests/chsh/08_chsh_myuser_to_restricted_shell/run.exp
Serge Hallyn b999d48941 Add tests from the old svn tree
We're losing the svn history (which we could probably keep if we tried
hard enough) but don't consider that worthwhile.

Note these tests are destructive, so run them only in a throwaway
environment like a chroot, container, or vm.

The tests/run.all script should be the one which launches all the tests.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-09-17 14:42:55 -05:00

42 lines
712 B
Plaintext
Executable File

#!/usr/bin/expect
set timeout 5
if {$argc < 1} {
puts "usage: run.exp \[shell] \[user]"
exit 1
}
set shell [lindex $argv 0]
if {$argc == 2} {
spawn /usr/bin/chsh [lindex $argv 1]
} else {
spawn /usr/bin/chsh
}
expect "Password: "
send "myuserF00barbaz\r"
expect "Changing the login shell for myuser"
expect "Enter the new value, or press ENTER for the default"
expect -re "Login Shell .*\]: "
send "$shell\r"
expect "$shell\r\n"
expect "chsh: $shell is an invalid shell\r\n"
expect {
eof {
if ([string compare $expect_out(buffer) ""]) {
set fp [open "tmp/out" w]
puts $fp "$expect_out(buffer)"
puts "\nFAIL"
exit 1
}
} default {
puts "\nFAIL"
exit 1
}
}
puts "\nPASS"
exit 0