testsuite fixes

This commit is contained in:
Craig Small
2011-11-23 21:44:51 +11:00
parent 618c52167b
commit 451f6e6111
6 changed files with 53 additions and 1 deletions

2
testsuite/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.log
*.sum

5
testsuite/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = dejagnu
export DEJAGNU
DEJATOOL = \
pwdx

View File

@ -0,0 +1,8 @@
proc pwdx_load { arg } { }
proc pwdx_exit {} {}
proc pwdx_version {} {
set tmp [ exec pwdx -V ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "pwdx version $version\n"
}

View File

@ -0,0 +1,30 @@
# 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" }
}