procps/testsuite/ps.test/ps_output.exp
Craig Small 898e3cc3cf testsuite: fix ps signals test
On some setups the signals count can change and be truncated. You
will notice this because the number will have "<" prepended. The
testsuite didn't handle this.
You could either get:
         BLOCKED          BLOCKED          BLOCKED           CAUGHT
CAUGHT          CATCHED
0000000000000000 0000000000000000 0000000000000000 00000001f3d1fef9 00000001f3d1fef9 00000001f3d1fef9

or
  BLOCKED   BLOCKED   BLOCKED    CAUGHT    CAUGHT   CATCHED
 00000000  00000000  00000000 <f3d1fef9 <f3d1fef9 <f3d1fef9
2015-06-14 15:20:48 +10:00

37 lines
1.5 KiB
Plaintext

#
# Dejagnu tests for ps (output options) - part of procps
#
set ps ${topdir}ps/pscommand
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 {
"%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*\){6}$"
"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*\)+$"
"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*\)$"
"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*\)+$"
}
foreach { flag match } $flag_match {
set test "ps with output flag $flag"
spawn $ps -o $flag
expect_pass "$test" $match
}