1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#!/bin/sh
# PCP QA Test No. 1987
# Exercise various pcp-ps(1) command options.
#
# Copyright (c) 2022 Oracle and/or its affiliates.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.python
status=1 # failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
pcp_ps="$PCP_BINADM_DIR/pcp-ps"
test -x $pcp_ps || _notrun "No pcp-ps(1) installed"
pcp_ps="$python $pcp_ps"
samples=2
# real QA test starts here
echo && echo pcp-ps output : Display default output
PCP_ARCHIVE="archives/pcp-ps" PCP_HOSTZONE=1 PCP_ORIGIN=1 $pcp_ps
archive_first="-a archives/pcp-ps -z -O +1 -s$samples"
echo && echo pcp-ps output : Display all process and all archive data
pcp $archive_first ps -e
echo && echo pcp-ps output : Display the user oriented format
pcp $archive_first ps -u
echo && echo pcp-ps output : Display the colum pid,ppid,tty,uname,wchan
pcp $archive_first ps -o pid,ppid,tty,uname,wchan
echo && echo pcp-ps output : Display the selected process pid 1 and 2
pcp $archive_first ps -p 1,2
echo && echo pcp-ps output : Display the selected process ppid 1,2,3,4 and 5
pcp $archive_first ps -P 1,2,3,4,5
echo && echo pcp-ps output : Display only user selected process command
pcp $archive_first ps -c systemd
echo && echo pcp-ps output : Display only selected user process
pcp $archive_first ps -U root
echo && echo pcp-ps output : Display the begining 10 process to test broken pipe
pcp $archive_first ps -u | head -10
echo && echo pcp-ps output : Display the colum "args" in between of -o option colum list
pcp $archive_first ps -o pid,ppid,args,tty,wchan
echo && echo pcp-ps output : Display the colum "args" in the end of -o option colum list
pcp $archive_first ps -o pid,ppid,tty,args
echo && echo pcp-ps output : Display the value as per %cpu sorted
pcp $archive_first ps -u -O %cpu | head -10
echo && echo pcp-ps output : Display the value as per %mem sorted
pcp $archive_first ps -u -O %mem | head -10
echo && echo pcp-ps output : Display the value as per %mem in user selected format\(failure case\)
pcp $archive_first ps -o pid,ppid,tty,args -O %mem
echo && echo pcp-ps output : Display the value as per %mem in user selected format
pcp $archive_first ps -o pid,ppid,tty,args,%mem -O %mem | head -10
echo && echo pcp-ps output : Display the value as per %cpu in user selected format
pcp $archive_first ps -o ALL -O %cpu | head -10
echo && echo pcp-ps output : Display user format with sort by %cpu \(custom columns, positive test\)
pcp $archive_first ps -o pid,%cpu,args -O %cpu | head -10
echo && echo pcp-ps output : Display user format using --sort \(long option\)
pcp $archive_first ps -o pid,%mem,args --sort=%mem | head -10
echo && echo pcp-ps output : Display user format with --sort on missing column \(negative test, should error\)
pcp $archive_first ps -o pid,args --sort=%mem
status=0
exit
|