31 lines
666 B
Plaintext
31 lines
666 B
Plaintext
|
|
# 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" }
|
|
}
|
|
|
|
# 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" }
|
|
}
|
|
|
|
# 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" }
|
|
}
|
|
|