Drop unused condition check
[pcp.git] / qa / 100
blobcb3ab1c9a8603cfaa1aef0566e7a826e907348aa
1 #! /bin/sh
2 # PCP QA Test No. 100
3 # exercise the logging state compatibility matrix for pmlc ...
4 # initial: singular metric request: different singular metric
6 # Copyright (c) 2014 Red Hat.
7 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 # get standard filters
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 trap "$sudo rm -f $tmp $tmp.*; exit" 0 1 2 3 15
20 _filter_pmlc()
22 sed \
23 -e '/connect /{
24 s/connect [0-9][0-9]*/connect PID/
25 s/@.*/@HOSTNAME/
26 }' \
27 -e '/Connected /{
28 s/ on port [0-9][0-9]*//
29 s/ pid [0-9][0-9]*//
30 s/ at .*/ at HOSTNAME/
31 }' \
32 -e 's/ nl / /' \
33 -e "/timed out/d" \
34 -e 's/Version [0-9].*/Version VERSION/' \
35 | $PCP_AWK_PROG '
36 /pmlc commands/ { skip = 1; print "[command summary deleted ...]" }
37 /metric-name/ { skip = 0; next }
38 skip == 1 { next }
39 { print }'
42 _filter_logger()
44 _filter_pmlogger_log \
45 | sed \
46 -e '/AF event queue/d'
49 _filter_dump()
51 _filter_pmdumplog \
52 | sed \
53 -e '/^$/d' \
54 -e '/pmResult/s/ .* numpmid/ ... numpmid/' \
55 -e '/inst /{
56 s/inst \[[0-9][0-9]* or "dks..."]/inst [DISK]/
57 s;inst \[[0-9][0-9]* or "/dev/[^"]*"];inst [DISK];
58 s;inst \[[0-9][0-9]* or ".*/dbs/.*\.dbf"];inst [FILE];
59 }' \
60 -e '/value /{
61 s/value [0-9][0-9]*\.[0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
62 s/value [0-9][0-9]*\.[0-9][0-9]*/value NUMBER/
63 s/value [0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
64 s/value [0-9][0-9]*/value NUMBER/
65 s/value \[.*]/value AGGREGATE/
66 s/value ".*"/value STRING/
67 }' \
68 -e "/pmcd\.pmlogger\./s/$logger_pid/LOGGER_PID/g" \
69 -e '/pmcd\.pmlogger\.port/s/value .*/value PORT/' \
70 -e '/pmcd\.pmlogger\.host/s/value ".*/value "HOST"/' \
71 -e '/pmcd\.pmlogger\.archive/s/value ".*/value "PATH"/'
74 _do_cmds()
76 for ctl in mandatory advisory
78 for state in "on once" maybe off
80 [ "$ctl $state" = "advisory maybe" ] && continue
81 for req_ctl in mandatory advisory
83 for req_state in "on once" maybe off
85 [ "$req_ctl $req_state" = "advisory maybe" ] && continue
86 ( echo "# setup"; \
87 echo "log mandatory maybe { sample.seconds sample.drift }"; \
88 echo "# $ctl $state -> $req_ctl $req_state"; \
89 echo "log $ctl $state sample.seconds"; \
90 ) | pmlc -ie $1
91 sleep 1
92 ( echo "log $req_ctl $req_state sample.drift"; \
93 echo "query { sample.seconds sample.drift }"; \
94 ) | pmlc -ie $1
95 sleep 1
96 # need sleeps to allow pmlogger to get a look in and
97 # to allow the pmlogger socket to be closed so the
98 # next pmlc invocation can get connected
99 done
100 done
101 done
102 done
107 # real QA test starts here
108 $sudo rm -f $tmp.0 $tmp.meta $tmp.index
110 # start pmlogger with the expected number of samples plus a few more
111 # to detect extra log output
113 _start_up_pmlogger -t 0.5sec -L -s 30 -c /dev/null -l $tmp.log $tmp >$tmp.err 2>&1
114 logger_pid=$pid
116 sleep 2
117 _do_cmds $logger_pid >$tmp.out 2>&1
119 # this chews up any remaining samples quickly so pmlogger terminates
121 echo "log mandatory on 25 msec sample.long.one" \
122 | pmlc -ie $logger_pid >>$tmp.out 2>&1
124 _filter_pmlc <$tmp.out
126 # wait for pmlogger to terminate
128 _wait_pmlogger_end $logger_pid
129 cat $tmp.err $tmp.log | _filter_logger
131 echo
132 if [ -s $tmp.0 ]
133 then
134 echo "Uniq filtered entries from pmdumplog ..."
135 pmdumplog $tmp \
136 | _filter_dump \
137 | sed -e 's/TIMESTAMP//' -e 's/^ *//' \
138 | LC_COLLATE=POSIX sort -u
139 pmdumplog $tmp >$seq.full 2>&1
140 else
141 echo "Archive log is empty"
144 exit