More testing added for procps

This commit is contained in:
Craig Small
2011-11-30 23:11:35 +11:00
parent 261a3fae83
commit f05e15e830
8 changed files with 246 additions and 108 deletions

View File

@ -2,30 +2,19 @@
set pwdx "${topdir}pwdx"
# Run pwdx with no arguments
set test "pwdx no args"
spawn pwdx
expect {
-re "^Usage: pwdx pid\.\.\." { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}
spawn $pwdx
expect_pass "$test" "^Usage: pwdx pid\.\.\."
# Run pwdx with pid 1 which is not reachable
set test "pwdx pid 1 should give permission denied"
spawn pwdx 1
expect {
-re "^1: Permission denied" { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}
spawn $pwdx 1
expect_pass "$test" "^1: Permission denied"
# Run pwdx with existing pid
set test "pwdx finds sleep in cwd"
set sleep_pid [ exec sleep 600 & ]
set sleep_pwd [ pwd ]
spawn pwdx $sleep_pid
expect {
-re "^$sleep_pid: $sleep_pwd" { pass "$test" }
eof { fail "$test" }
timeout { fail "$test" }
}
spawn $pwdx $sleep_pid
expect_pass "$test" "^$sleep_pid: $sleep_pwd"
exec kill $sleep_pid