Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 443
bloba3a3db41d0d78362c3ddbac37d8eef2cc35a8ca8
1 #!/bin/sh
2 # PCP QA Test No. 443
3 # error handling and basic functionality for pmevent
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
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
17 status=0 # success is the default!
18 $sudo rm -rf $tmp.* $seq.full
19 trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15
21 host=`hostname`
23 _filter_usage()
25 sed \
26 -e '/^first=/s/=.*/=.../' \
27 -e '/^now=/s/=.*/=.../' \
28 -e '/^last=/s/=.*/=.../' \
29 -e '/Usage/q' \
30 -e '/illegal option/{
31 s/illegal/invalid/
32 s/.$/'"'&'"'/
33 }' \
34 -e '/invalid option/s/[^'"'"']$/'"'&'"'/'
37 _filter()
39 sed \
40 -e "s/host: $host/host: localhost/g" \
41 -e 's/[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
44 _run()
46 echo "=== $* ==="
47 pmevent $* 2>&1 | _filter_usage
50 _run_sudo()
52 echo "=== $* ==="
53 $sudo_local_ctx pmevent $* 2>&1 | _filter_usage
56 _run_ok()
58 echo "=== $* ==="
59 pmstore sample.event.reset 0 >/dev/null 2>&1
60 pmstore sampledso.event.reset 0 >/dev/null 2>&1
61 pmevent $* 2>&1 | _filter
64 _run_arch()
66 echo "=== $* ==="
67 pmevent $* 2>&1
70 # real QA test starts here
72 # command line arg syntax and semantic checks
74 _run -a foo -a bar
75 _run -h foo -h bar
76 _run -a foo -h bar
77 _run -h foo -a bar
78 _run -D blah
79 _run -g -p 1234
80 _run -p 1234 -g
81 _run -p 123foo
82 _run_sudo -K blah,a,/no/such/file,no_init
83 _run -s 456bar
84 _run -s 3 -T+5min
85 _run -T+5min -s 10
86 _run -t 10foobars
87 _run -Z GMT -z
88 _run -z -Z EST
89 _run -q
90 _run -a foo
92 # metric spec syntax and semantic checks
94 echo
95 echo "--- bad metric spec ---"
96 _run /some/path/no/metric/
97 _run somehost_and_no_metric:
99 echo
100 echo "--- illegal mixed sources ---"
101 _run archives/eventrec-old/sample.event.records foo/bar
102 _run -a /some/path foo:bar
103 _run -a archives/eventrec-old archives/eventrec-old/sample.event.records foo/bar
104 _run localhost:sample.event.records foo:bar
105 _run -h somehost foo/bar
106 _run -h localhost localhost:sample.event.records foo:bar
107 _run_sudo @:sampledso.event.records foo:bar
109 echo
110 echo "--- problems at source of metrics ---"
111 _run -h no.such.host.pcp.io sample.event.records
112 _run -a /no/such/archive sample.event.records
113 _run_sudo -L sample.event.records
114 _run -Dappl0 "sample.event.no_indom_records[red]"
116 echo
117 echo "--- should be ok ---"
118 _run_ok -t 10msec -s 1 sample.event.records
119 _run_ok -t 10msec -s 8 sample.event.records
120 _run_ok -t 10msec -s 3 'sample.event.records[bogus]'
122 echo
123 echo "--- archive exercises ---"
124 _run_arch -z archives/eventrec-old/sample.event.records
125 _run_arch -z -S@15:26:11.073 -s 2 -a archives/eventrec-old sample.event.records
126 _run_arch -z -O+2.5 -T+4.5 -a archives/eventrec-old sample.event.records
128 echo
129 echo "--- highres events ---"
130 _run_arch -z archives/eventrec/sample.event.highres_records
132 # success, all done
133 exit