zsh completions: minor tweaks
[pcp.git] / qa / 304
blob1a20e17015bc6f0fe16e462efcbbf286224727e9
1 #! /bin/sh
2 # PCP QA Test No. 304
3 # exercise recording session control in pmlooger
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 signal=$PCP_BINADM_DIR/pmsignal
17 status=1 # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19 LOCALHOST=`hostname`
21 _do()
23 rm -f $tmp.0 $tmp.index $tmp.meta
24 cat $tmp.ctl \
25 | pmlogger -L -x 0 -c /dev/null -l $tmp.log -D appl2 $tmp &
26 logger_pid=$!
27 if [ -z "$logger_pid" ]
28 then
29 echo "Arrgh ... failed to start pmlogger!"
30 exit $status
32 sleep 3
33 alive=`ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == '"$logger_pid"' { print }'`
34 if [ ! -z "$alive" ]
35 then
36 if [ $1 = "alive" ]
37 then
38 echo "As expected, pmlogger is still running ... kill it off"
39 else
40 echo "$alive"
41 echo "-----------------"
42 echo "- Error: pmlogger is still running, kill it off"
43 echo "-----------------"
45 $signal -s TERM $!
46 sleep 2
47 else
48 if [ $1 = "alive" ]
49 then
50 echo "-----------------"
51 echo "- Error: pmlogger has died prematurely"
52 echo "-----------------"
56 sed <$tmp.log \
57 -e "s/$LOCALHOST/HOST/g" \
58 -e 's/[0-9][^ ]* [kmKM]*bytes/SOME bytes/g' \
59 -e 's/[0-9][^ ]* seconds/SOME seconds/g' \
60 -e 's/-s TERM [0-9][0-9]*/-s TERM PID/' \
61 | _filter_pmlogger_log
65 # NOT the default pmconfirm(1), please
67 cat <<'End-of-File' >$tmp.xconfirm
68 #!/bin/sh
69 # generate no output so pmlogger will report the message
70 exit 0
71 End-of-File
72 chmod 755 $tmp.xconfirm
73 export PCP_XCONFIRM_PROG=$tmp.xconfirm
75 # real QA test starts here
77 echo
78 echo "=== end-of-file, launcher exited =="
79 echo 'V0
80 Fmyfolio' >$tmp.ctl
81 _do die
83 echo
84 echo "=== Quit =="
85 echo 'V0
86 Fmyfolio
87 Q' >$tmp.ctl
88 _do die
90 echo
91 echo "=== Quit + can replay =="
92 echo 'V0
93 Fmyfolio
95 Q' >$tmp.ctl
96 _do die
98 echo
99 echo "=== Detach =="
100 echo 'V0
101 Fmyfolio
102 D' >$tmp.ctl
103 _do alive
105 echo
106 echo "=== Status =="
107 echo 'V0
108 Fmyfolio
109 ?' >$tmp.ctl
110 _do die
112 echo
113 echo "=== Bad control =="
114 echo 'V0
115 Fmyfolio
116 Junk' >$tmp.ctl
117 _do die
119 # success, all done
120 status=0
121 exit