2011-11-29 17:25:03 +05:30
|
|
|
#
|
|
|
|
# Dejagnu tests for ps (output options) - part of procps
|
|
|
|
#
|
2022-08-29 14:43:10 +05:30
|
|
|
set ps ${topdir}src/ps/pscommand
|
2011-11-29 17:25:03 +05:30
|
|
|
|
|
|
|
set mypid [pid]
|
|
|
|
set not_ppid [ expr { $mypid + 1 } ]
|
|
|
|
set uid [ exec id -u ]
|
|
|
|
set not_uid [ expr { $uid + 1 } ]
|
|
|
|
set gid [ exec id -g ]
|
|
|
|
set not_gid [ expr { $gid + 1 } ]
|
|
|
|
|
|
|
|
# All the fields
|
|
|
|
# Cannot do args,cmd,comm
|
|
|
|
set ps_digit "\\d+\\s*"
|
|
|
|
set ps_state "\[A-Z<sl+\]\\s*"
|
|
|
|
#set ps_pct "\\d{1,2}\\.\\d\\s*"
|
|
|
|
set ps_pct "\\d"
|
|
|
|
set ps_hex "\[0-9a-f\]\\s*"
|
|
|
|
set ps_time "\\d{1,3}:\\d{2}\\s*"
|
|
|
|
set ps_time "\(\d+-\)?\\\d{1,3}:\\d{2}\\s*"
|
|
|
|
set ps_class "\[A-Z?-\]\\s*"
|
|
|
|
|
|
|
|
set flag_match {
|
2022-03-22 14:50:53 +05:30
|
|
|
"%cpu,pcpu,%mem,pmem" "%CPU\\s+%CPU\\s+%MEM\\s+%MEM\\s+\(\(\\d+\.\\d+\\s*\){4}\)+$"
|
|
|
|
"blocked,sig_block,sigmask,caught,sigcatch,sig_catch" "\(BLOCKED\\s+\){3}\(CAUGHT\\s+\){2}CATCHED\\s+\(<?\[0-9a-f\]+\\s*\)+$"
|
2011-12-01 17:12:23 +05:30
|
|
|
"bsdstart,start,lstart" "\\s*START\\s+STARTED\\s+STARTED\\s+\(\\s*\(\[A-Z\]\[a-z\]{2} \\d+|\\d+:\\d{2}\)\\s+\(\[A-Z\]\[a-z\]{2} \\d+|\\d+:\\d{2}:\\d{2}\)\\s+\[A-Z\]\[a-z\]{2} \[A-Z\]\[a-z\]{2}\\s+\\d+ \\d{2}:\\d{2}:\\d{2} \\d{4}\\s*\)+$"
|
2018-04-10 17:39:40 +05:30
|
|
|
"bsdtime,cputime,etime,etimes" "\\s*TIME\\s+TIME\\s+ELAPSED\\s+ELAPSED\\s*\(\\s*\\d+:\\d{2}\\s+\\d{2}:\\d{2}:\\d{2}\\s+\(\\d{2}:\)?\\d{2}:\\d{2}\\s+\\d+\\s*\)+$"
|
2012-12-10 20:41:04 +05:30
|
|
|
"user,ruser,group,rgroup,uid,ruid,gid,rgid" "\\s*USER\\s+RUSER\\s+GROUP\\s+RGROUP\\s+UID\\s+RUID\\s+GID\\s+RGID\\s+\(\(\\s*\[A-Za-z0-9_+-\]+\\s+\){4}\(\\d+\\s+\){4}\\s*\)+$"
|
2018-03-02 16:37:46 +05:30
|
|
|
"cputimes,times" "\\s*TIME\\s+TIME\\s+\\d+\\s+\\d+\\s*"
|
2011-11-29 17:25:03 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
foreach { flag match } $flag_match {
|
|
|
|
set test "ps with output flag $flag"
|
|
|
|
spawn $ps -o $flag
|
|
|
|
expect_pass "$test" $match
|
|
|
|
}
|
2022-04-09 10:20:53 +05:30
|
|
|
|
|
|
|
set test "ps with correct AIX field"
|
|
|
|
spawn $ps -o "%p"
|
|
|
|
expect_pass "$test" "\\s*PID\\s+\(\\s*\\d+\\s+\)+$"
|
|
|
|
|
|
|
|
set test "ps with improper AIX field"
|
|
|
|
spawn $ps -o "%p %G{"
|
|
|
|
expect_pass "$test" "error: improper AIX field descriptor"
|
|
|
|
|
|
|
|
set test "ps with missing AIX field"
|
|
|
|
spawn $ps -o "%p %%a"
|
|
|
|
expect_pass "$test" "error: missing AIX field descriptor"
|
|
|
|
|
|
|
|
set test "ps with unknown AIX field"
|
|
|
|
spawn $ps -o "%p %Z"
|
|
|
|
expect_pass "$test" "error: unknown AIX field descriptor"
|
2022-12-19 11:20:12 +05:30
|
|
|
|
|
|
|
make_testproc
|
|
|
|
set test "ps with c option"
|
|
|
|
spawn $ps co command $testproc1_pid
|
|
|
|
expect_pass "$test" "^COMMAND\\s+spcorp\\s*$"
|
|
|
|
kill_testproc
|