pmrep: really drop non-ascii
[pcp.git] / qa / 345
blob21d88c3c07e3dba20e77ba3adb2a178e176cf8f2
1 #!/bin/sh
2 # PCP QA Test No. 345
4 # PM_CONTEXT_LOCAL and PMNS operations involving derived and dynamic
5 # metrics
7 # Copyright (c) 2010 Ken McDonell. All Rights Reserved.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 # get standard environment, filters and checks
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 grep 'pmRegisterDerived' $PCP_INC_DIR/pmapi.h >/dev/null ||
19 _notrun "No derived metric support"
20 grep __pmLocalPMDA $PCP_INC_DIR/impl.h >/dev/null ||
21 _notrun "No libpcp support for __pmLocalPMDA"
23 status=0 # success is the default!
24 $sudo rm -rf $tmp.* $seq.full
25 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
27 cat <<End-of-File >$tmp.derive
28 sampledso.secret.derived.eek.eight = 2 * sampledso.secret.foo.bar.four
29 End-of-File
31 # with -f need to remove "inst" lines for the metric
32 # sampledso.secret.foo.bar.max.redirect as we will never find these
33 # aliased pmcd metrics with -L
34 # also strip blank lines to reduce "diff noise" later
36 _filter()
38 $PCP_AWK_PROG '
39 $1 == "sampledso.secret.foo.bar.max.redirect" { print; skip = 1; next }
40 NF == 0 { skip = 0; next }
41 skip == 1 && $1 == "inst" { next }
42 { print }'
45 # real QA test starts here
46 for metric_args in \
47 "sampledso.secret.foo.bar.grunt.five sampledso.secret.derived.eek.eight sampledso.secret.foo.bar.grunt" \
48 sampledso.secret.foo \
49 sampledso.secret \
50 sampledso
52 for margs in '' -m -f
54 # -f for all of sampledso will never match ...
55 [ "$metric_args" = sampledso -a -n "$margs" ] && continue
56 for hargs in '' '-h localhost' '-L'
58 args="$hargs $margs"
59 if [ -z "$hargs" ]
60 then
61 echo | tee -a $seq.full
62 echo "=== $args $metric_args ===" | tee -a $seq.full
63 pminfo -c $tmp.derive $args $metric_args >$tmp.raw
64 cat $tmp.raw >>$seq.full
65 _filter <$tmp.raw \
66 | LC_COLLATE=POSIX sort >$tmp.base
67 else
68 $sudo pminfo -c $tmp.derive $args $metric_args >$tmp.raw
69 echo "=== $args $metric_args" >>$seq.full
70 cat $tmp.raw >>$seq.full
71 _filter <$tmp.raw \
72 | LC_COLLATE=POSIX sort >$tmp.tmp
73 echo "--- $args diffs against baseline ---" | tee -a $seq.full
74 diff -u $tmp.base $tmp.tmp \
75 | sed -e "/---/s/.*/- baseline output/" \
76 -e "/+++/s/.*/+ $args output/" \
77 | tee -a $seq.full
79 done
80 done
81 done
83 # success, all done
84 exit