Drop unused condition check
[pcp.git] / qa / 757
blobce6312506992530d58a901d82c7e01fc3e3bb187
1 #!/bin/sh
2 # PCP QA Test No. 757
3 # Exercise the perfevent PMDA.
5 # Copyright (c) 2014 Joseph White.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 test -e $PCP_PMDAS_DIR/perfevent/pmdaperfevent || _notrun "Optional perfevent PMDA not present"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
21 perfevent_remove()
23 echo
24 echo "=== remove perfevent agent ==="
25 sudo ./Remove >$tmp.out 2>&1
26 _filter_pmda_remove <$tmp.out
29 perfevent_install()
31 # start from known starting points
32 cd $PCP_PMDAS_DIR/perfevent
33 $sudo ./Remove >/dev/null 2>&1
34 $sudo $PCP_RC_DIR/pmcd stop | _filter_pcp_stop
36 [ -f $PCP_PMDAS_DIR/perfevent/perfevent.conf ] && \
37 $sudo cp $PCP_PMDAS_DIR/perfevent/perfevent.conf $tmp.backup
38 $sudo cp $here/perfevent/perfevent.conf $PCP_PMDAS_DIR/perfevent
40 echo
41 echo "=== $iam agent installation ==="
42 $sudo ./Install </dev/null >$tmp.out 2>&1
43 # Check for warnings, we're going to considering these warnings
44 # indications that there is not perfevents on the current machine
45 grep "warnings" $tmp.out; if [ $? -eq 0 ]; then _notrun "perfevents not found"; fi
46 # Check perfevent metrics have appeared ... X metrics and Y values
47 _filter_pmda_install <$tmp.out \
48 | sed \
49 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
50 | $PCP_AWK_PROG '
51 /Check perfevent metrics have appeared/ {
52 if ($7 >= 8) $7 = "X"
53 if ($10 >= 8) $10 = "Y"
55 { print }'
58 perfevent_cleanup()
60 if [ -f $tmp.backup ]; then
61 $sudo cp $tmp.backup $PCP_PMDAS_DIR/perfevent/perfevent.conf
62 $sudo rm $tmp.backup
63 else
64 $sudo rm -f $PCP_PMDAS_DIR/perfevent/perfevent.conf
66 _cleanup_pmda perfevent
69 _prepare_pmda perfevent
70 trap "perfevent_cleanup; exit \$status" 0 1 2 3 15
72 _filter_perfevent()
74 # filter metric values for deterministic output
75 tee -a $here/$seq.full | sed \
76 -e 's/value [0-9][0-9]*/value NUMBER/'
79 # real QA test starts here
80 perfevent_install
82 # pmdaperfevent should have been started by the Install process - check
83 if pminfo -v perfevent > $tmp.info 2> $tmp.err
84 then
86 else
87 echo "... failed! ... here is the Install log ..."
88 cat $tmp.out
90 cat $tmp.info $tmp.err | _filter_perfevent
92 # Check that the correct metrics are present
93 pminfo perfevent
95 perfevent_remove
96 # success, all done
97 status=0
98 exit