procps/testsuite/config/unix.exp

71 lines
1.9 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-30 17:41:35 +05:30
proc procps_v_version { tool } {
2011-11-23 17:18:49 +05:30
global topdir
2011-11-30 17:41:35 +05:30
set toolpath ${topdir}${tool}
send_user "$toolpath -V"
set tmp [ exec $toolpath -V ]
2011-11-23 16:14:51 +05:30
regexp "procps-ng version (\[0-9.\]*)" $tmp tmp version
2011-11-30 17:41:35 +05:30
clone_output "$toolpath version $version\n"
2011-11-23 17:18:49 +05:30
}
2011-11-30 17:41:35 +05:30
proc free_version {} { procps_v_version free }
proc kill_version {} { procps_v_version kill }
proc pgrep_version {} { procps_v_version pgrep }
proc pkill_version {} { procps_v_version pkill }
proc pmap_version {} { procps_v_version pmap }
proc pwdx_version {} { procps_v_version pwdx }
proc sysctl_version {} { procps_v_version sysctl }
proc uptime_version {} { procps_v_version uptime }
proc vmstat_version {} { procps_v_version vmstat }
proc w_version {} { procps_v_version w }
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 { } {
2011-11-30 17:41:35 +05:30
# Time to run the whole job
set sleep_time 300
2011-11-27 13:02:10 +05:30
global testproc_path testproc_comm testproc1_pid testproc2_pid
set testproc_path [ exec mktemp -u ]
exec ln -s "/bin/sleep" $testproc_path
set testproc_comm [ exec basename $testproc_path ]
2011-11-30 17:41:35 +05:30
2011-11-27 13:02:10 +05:30
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" }
}
2011-11-30 17:41:35 +05:30
set testproc1_pid [ exec $testproc_path $sleep_time & ]
set testproc2_pid [ exec $testproc_path $sleep_time & ]
2011-11-27 13:02:10 +05:30
}