new free commands

This commit is contained in:
Craig Small 2011-11-23 22:48:49 +11:00
parent 451f6e6111
commit 82eafe3fe8
6 changed files with 45 additions and 2 deletions

View File

@ -1,2 +1,4 @@
*.log
*.sum
site.bak
site.exp

View File

@ -2,4 +2,4 @@ AUTOMAKE_OPTIONS = dejagnu
export DEJAGNU
DEJATOOL = \
pwdx
procps-ng

View File

@ -1,8 +1,39 @@
regexp "(.*\/)testsuite" $objdir objdir topdir
proc pwdx_load { arg } { }
proc pwdx_exit {} {}
proc pwdx_version {} {
global topdir
set tmp [ exec pwdx -V ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "pwdx version $version\n"
clone_output "${topdir}pwdx version $version\n"
}
# free functions
proc free_load { arg } { }
proc free_exit {} {}
proc free_version {} {
set tmp [ exec free --version ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "free version $version\n"
}
#
#
# common utilities
proc expect_continue { testname reg } {
expect {
-re "$reg" { }
eof { fail "$testname" }
timeout { fail "$testname" }
}
}
proc expect_pass { testname reg } {
expect {
-re "$reg" { pass "$testname" }
eof { fail "$testname" }
timeout { fail "$testname" }
}
}

View File

View File

@ -0,0 +1,9 @@
#
# Testsuite for free program
#
set free "${topdir}free"
set test "free with no arguments"
spawn free
expect_pass "$test" "^\\s+total\\s+used\\s+free\\s+shared\\s+buffers\\s+cached\\s*Mem:\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+\\s*-\\/\\+ buffers\\/cache:\\s+\\d+\\s+\\d+\\s*Swap:\\s+\\d+\\s+\\d+\\s+\\d+"

View File

@ -1,4 +1,5 @@
set pwdx "${topdir}pwdx"
# Run pwdx with no arguments
set test "pwdx no args"
spawn pwdx