procps/testsuite/config/unix.exp

85 lines
2.0 KiB
Plaintext
Raw Normal View History

2011-11-23 16:14:51 +05:30
2011-11-23 17:18:49 +05:30
regexp "(.*\/)testsuite" $objdir objdir topdir
2011-11-23 16:14:51 +05:30
proc pwdx_load { arg } { }
proc pwdx_exit {} {}
proc pwdx_version {} {
2011-11-23 17:18:49 +05:30
global topdir
2011-11-23 16:14:51 +05:30
set tmp [ exec pwdx -V ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
2011-11-23 17:18:49 +05:30
clone_output "${topdir}pwdx version $version\n"
}
# free functions
proc free_load { arg } { }
proc free_exit {} {}
proc free_version {} {
2011-11-27 13:02:10 +05:30
global topdir
set tmp [ exec ${topdir}free --version ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "${topdir}free version $version\n"
}
2011-11-27 13:42:56 +05:30
# uptime functions
proc uptime_load { arg } { }
proc uptime_exit {} {}
proc uptime_version {} {
global topdir
set tmp [ exec ${topdir}uptime -V ]
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
clone_output "${topdir}uptime version $version\n"
}
2011-11-27 13:02:10 +05:30
# w functions
proc w_load { arg } { }
proc w_exit {} {}
proc w_version {} {
global topdir
set tmp [ exec ${topdir}w -V ]
2011-11-23 17:18:49 +05:30
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
2011-11-27 13:02:10 +05:30
clone_output "${topdir}w version $version\n"
2011-11-23 17:18:49 +05:30
}
#
#
# 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" }
}
2011-11-23 16:14:51 +05:30
}
proc expect_blank { testname } {
expect {
-re "\\w" { fail "$testname" }
eof { pass "$testname" }
timeout { pass "$testname" }
}
}
2011-11-27 13:02:10 +05:30
proc make_testproc { } {
global testproc_path testproc_comm testproc1_pid testproc2_pid
set testproc_path [ exec mktemp -u ]
exec ln -s "/bin/sleep" $testproc_path
set testproc1_pid [ exec $testproc_path 600 & ]
set testproc2_pid [ exec $testproc_path 600 & ]
set testproc_comm [ exec basename $testproc_path ]
spawn readlink $testproc_path
expect {
-re "^/bin/sleep\\s*$" { }
timeout { perror "test proc does not link to sleep 1" }
eof { perror "test proc does not link to sleep 1" }
}
}