Lines Matching +full:local +full:- +full:pid

43 	# for regular expressions to match the text in left- or
44 # right-justified columns.
94 default_keywords='pid tty stat time command'
95 j_keywords='user pid ppid pgid sess jobc state tt time command'
96 l_keywords='uid pid ppid cpu pri nice vsz rss wchan state tt time command'
97 s_keywords='uid pid ppid cpu lid nlwp pri nice vsz rss wchan lstate tt ltime command'
98 u_keywords='user pid %cpu %mem vsz rss tt state start time command'
99 v_keywords='pid state time sl re pagein vsz rss lim tsiz %cpu %mem command'
102 # Convert a list of keywords like "pid comm" to a regexp
103 # like " *PID COMMAND *"
106 local keywords="$1"
107 local regexp
109 sed -E -e 's/\%/p_/g' -e 's/(^| )/\1\$head_regexp_/g')"
120 local id="$1" string="$2" regexp="$3"
129 # Run "ps $args -p $$"; check that only one line is printed,
134 local args="$1"
135 local output="$(eval "${TEST_PS} $args -p $$")"
138 local firstline="${output%%${nl}*}"
153 actual="$( eval "${TEST_PS} $args" | sed -e 1q )"
169 # Try several variations on "ps $flag", "ps -$flag", etc.,
176 for args in "$flag" "-$flag" "-$flag$flag -$flag"; do
185 "and also check that the columns printed by the -j," \
186 "-l, -s, -u and -v flags alone are correct"
202 atf_set "descr" "Checks that 'ps -O foo' inserts columns just after" \
203 "the pid column"
208 check_heading_keywords '-O %cpu,%mem' \
209 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
210 check_heading_keywords '-O %cpu -O %mem' \
211 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
212 check_heading_keywords '-O%cpu -O%mem' \
213 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')"
219 atf_set "descr" "Checks simple cases of 'ps -o foo' to control which" \
221 "overriding via 'ps -o foo=BAR'"
226 # Keywords for "-o name" override the default display
227 check_heading_keywords '-o pid,%cpu,%mem' \
228 "pid %cpu %mem"
229 check_heading_keywords '-o pid -o %cpu,%mem' \
230 "pid %cpu %mem"
231 check_heading_keywords '-opid -o %cpu,%mem' \
232 "pid %cpu %mem"
234 check_heading_keywords '-opid -o "%cpu %mem"' \
235 "pid %cpu %mem"
236 # Check missing pid
237 check_heading_keywords '-o comm' \
239 # Check pid present but not first
240 check_heading_keywords '-o comm,pid' \
241 "comm pid"
248 "'ps -o foo=BAR'. This does not test columns " \
255 check_heading_regexp '-o pid=PPP -o comm' \
257 check_heading_regexp '-o pid=PPP -o comm=CCC' \
259 check_heading_regexp '-o pid,comm=CCC' \
261 check_heading_regexp '-o pid -o comm=CCC' \
263 # Check missing pid
264 check_heading_regexp '-o comm=CCC' \
266 # Check pid present but not first
267 check_heading_regexp '-o comm=CCC -o pid=PPP' \
269 check_heading_regexp '-o comm,pid=PPP' \
284 check_heading_regexp '-o comm,pid==' \
286 check_heading_regexp '-o comm,pid=,' \
288 check_heading_regexp '-o pid=PPP,comm' \
289 '^ *PPP,comm$' # not like '-o pid=PPP -o comm'
290 check_heading_regexp '-o pid=PPP,comm=CCC' \
291 '^ *PPP,comm=CCC$' # not like '-o pid=PPP -o comm=CCC'
292 check_heading_regexp '-o comm,pid=PPP,QQQ' \
294 check_heading_regexp '-o comm,pid=ppid,tty=state' \
297 check_heading_regexp '-o comm,pid="PPP QQQ"' \
299 check_heading_regexp '-o comm,pid="PPP${tab}QQQ"' \
307 "overriding via 'ps -o foo=BAR -o baz='. This" \
314 check_heading_regexp '-o pid=PPP -o comm=' \
316 check_heading_regexp '-o pid= -o comm=CCC' \
318 check_heading_regexp '-o pid -o comm=' \
320 # Check missing pid
321 check_heading_regexp '-o ppid= -o comm=CCC' \
323 check_heading_regexp '-o ppid=PPP -o comm=' \
325 # Check pid present but not first
326 check_heading_regexp '-o comm= -o pid=PPP' \
328 check_heading_regexp '-o comm,pid=' \
332 # to a field with a very short (non-null) custom heading.
337 check_heading_regexp '-o holdcnt -o holdcnt -o holdcnt' \
339 check_heading_regexp '-o holdcnt -o holdcnt= -o holdcnt' \
341 check_heading_regexp '-o holdcnt -o holdcnt=HH -o holdcnt' \
348 atf_set "descr" "Tests the use of 'ps -o foo= -o bar=' (with a" \
357 check_heading_regexp '-o comm=" "' \
360 check_no_heading_line '-o pid= -o comm='
361 check_no_heading_line '-o pid= -o comm='
362 # Check missing pid
363 check_no_heading_line '-o ppid='
364 check_no_heading_line '-o comm='
365 check_no_heading_line '-o command='
366 check_no_heading_line '-o ppid= -o comm='
367 check_no_heading_line '-o comm= -o ppid='
368 # Check pid present but not first
369 check_no_heading_line '-o comm= -o pid='
370 check_no_heading_line '-o ppid= -o pid= -o command='
376 atf_set "descr" "Tests the use of -o options to display the" \
383 check_heading_regexp '-o pid=PPP -o pid=QQQ' \
386 check_heading_regexp '-o pid=PPP -o pid' \
388 check_heading_regexp '-o pid -o pid=QQQ' \
391 check_heading_regexp '-o pid=PPP -o pid -o pid=QQQ' \