python api: fix syntax error in recent context changes
[pcp.git] / qa / 973
blobcfe6b9a3aae48bc96a02f1c29794e311a6509af7
1 #!/bin/sh
2 # PCP QA Test No. 973
3 # Exercise the zswap PMDA using the running kernel.
5 # Copyright (c) 2014,2016 Red Hat.
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 [ -f $PCP_PMDAS_DIR/zswap/pmdazswap.python ] || _notrun "zswap pmda not installed"
17 $sudo test -d /sys/kernel/debug/zswap || _notrun "No kernel support for zswap"
19 status=1 # failure is the default!
20 $sudo rm -f $tmp.* $seq.full
22 _filter_zswap()
24 # filter metric values for deterministic output
25 tee -a $here/$seq.full | sed \
26 -e 's/value [0-9][0-9]*/value NUMBER/'
29 pmdazswap_remove()
31 echo
32 echo "=== remove $iam agent ==="
33 $sudo ./Remove >$tmp.out 2>&1
34 _filter_pmda_remove <$tmp.out
37 pmdazswap_install()
39 # start from a known starting point
40 cd $PCP_PMDAS_DIR/zswap
41 $sudo ./Remove >/dev/null 2>&1
42 $sudo $PCP_RC_DIR/pmcd stop | _filter_pcp_stop
44 echo
45 echo "=== $iam agent installation ==="
46 $sudo ./Install </dev/null >$tmp.out 2>&1
47 # Check zswap metrics have appeared ... X metrics and Y values
48 _filter_pmda_install <$tmp.out \
49 | sed \
50 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
51 -e 's/[0-9][0-9]* warnings, //' \
52 | $PCP_AWK_PROG '
53 /Check zswap metrics have appeared/ { if ($7 >= 8 && $7 <= 20) $7 = "X"
54 if ($10 >= 8 && $10 <= 20) $10 = "Y"
56 { print }'
59 _prepare_pmda zswap
60 trap "_cleanup_pmda zswap; exit \$status" 0 1 2 3 15
62 # real QA test starts here
63 pmdazswap_install
65 # pmcd should have been started by the Install process - check
66 if pminfo -v zswap > $tmp.info 2> $tmp.err
67 then
69 else
70 echo "... failed! ... here is the Install log ..."
71 cat $tmp.out
73 cat $tmp.info $tmp.err | _filter_zswap
75 pmdazswap_remove
76 status=0
77 exit