qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 184
blobf8c05e86a135dbd07371041eefde1cf14b3d7e17
1 #! /bin/sh
2 # PCP QA Test No. 184
3 # simplest possible case for pmnewlog
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 _cleanup()
18 if [ ! -f $tmp.cleanup ]
19 then
20 $sudo $signal -a pmlogger >/dev/null 2>&1
21 $sudo $PCP_BINADM_DIR/pmlogger_check
22 _wait_for_pmlogger
23 touch $tmp.cleanup
27 signal=$PCP_BINADM_DIR/pmsignal
28 newlog=$PCP_BINADM_DIR/pmnewlog
29 trap "_cleanup; cd $here; $sudo rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
31 _filter_dumplog()
33 sed \
34 -e '/\[[0-9][0-9]* bytes\]/d' \
35 -e '/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/s//TIMESTAMP/' \
36 -e 's/^\(log started *\).*/\1DATESTAMP/' \
37 -e 's/^\(last log entry *\).*/\1DATESTAMP/' \
38 -e 's/^\(current time *\).*/\1DATESTAMP/' \
39 -e 's/^\( *commencing *\).*/\1DATESTAMP/' \
40 -e 's/^\( *ending *\).*/\1DATESTAMP/' \
41 -e '/^Performance metrics/s/host .*/host HOST/' \
42 -e '/(pmcd.control.register)/s/value [0-9][0-9]*/value INTEGER/' \
43 -e '/^InDom: 2.1/,/^$/s/[0-9][0-9]* or "[0-9][0-9]*"/LOGGER_PID or "LOGGER_PID"/g' \
44 -e '/pmcd.pmlogger.*inst/s/[0-9][0-9]* or "[0-9][0-9]*"/LOGGER_PID or "LOGGER_PID"/' \
45 -e '/pmcd.pmlogger.port/s/value .*/value PORT/' \
46 -e '/pmcd.pmlogger.host/s/value ".*/value "HOST"/' \
47 -e '/pmcd.pmlogger.archive/s/value ".*/value "PATH"/' \
48 | $PCP_AWK_PROG '
49 $1 == "TIMESTAMP" && NF == 4 { print "TIMESTAMP 0 OFFSET OFFSET"; next }
50 { print }'
53 _filter_newlog()
55 sed \
56 -e 's/process [0-9][0-9]*/process PID/' \
57 -e '/pmlogger -L/s/.*/-- ps line removed --/' \
58 -e '/ \/usr\/pcp\/bin\/pmlogger /s/.*/-- ps line removed --/' \
59 -e 's/^\/usr\/pcp\/bin\/pmlogger/pmlogger/' \
60 -e "/^pmlogger/s/$seq-[0-9][0-9]*/SEQ-PID/g" \
61 -e '/configuration file saved as/s/[0-9][0-9]*/PID/g' \
62 -e 's/\[[0-9][0-9]*]/[PID]/' \
63 -e '/PMCD host/d' \
64 -e 's/ host [^ ]*/ host HOST/g' \
65 -e '/^Getting logged/s/host HOST/host name/' \
66 -e 's/ -h [^ ]*/ -h HOST/g' \
67 -e 's/ -c [^ ]*/ -c CONF/g' \
68 -e 's/ SIG.* done/ signal stuff ... done/' \
69 -e '/Error \[<stdin>,/d' \
70 -e '/Warning \[<stdin>,/d' \
71 -e '/Not connected to any/d' \
72 -e '/Logging statement ignored/d' \
73 -e '/Problem with lookup for metric/d' \
74 -e '/Reason: Unknown metric name/d' \
75 -e '/Try again. Information not currently available/d' \
76 -e '/Unknown or illegal metric identifier/d' \
77 -e '/Unknown or illegal instance domain identifier/d' \
78 -e '/Metric not supported by this version/d' \
79 -e '/^log size/s/[0-9][0-9]*/BYTES/' \
80 -e '/^Contacting pmlogger /d' \
81 -e '/^pmnewlog: Warning: errors from talking /d' \
82 -e '/^continuing .../d' \
83 -e '/New pmlogger configuration file saved /d' \
84 -e '/^[ ]*$/d' \
85 -e 's;/tmp/PID/pcp;/tmp/PID;g'
88 # real QA test starts here
90 # Note:
91 # Logging a metric with an instance domain so that the record will be flushed.
92 cat <<End-of-File >$tmp.config
93 log mandatory on once pmcd.control.register["0"]
94 End-of-File
95 $sudo rm -f $tmp.arch.*
96 _start_up_pmlogger -L -c $tmp.config -l $tmp.log $tmp.arch >$tmp.err 2>&1
97 logger_pid=$pid
98 _wait_for_pmlogger $logger_pid $tmp.log
100 echo "=== old log ===" | tee $seq.full
101 pmdumplog -a $tmp.arch | tee -a $seq.full | _filter_dumplog
103 echo | tee -a $seq.full
104 echo "=== pmnewlog ==" | tee -a $seq.full
105 $sudo $newlog -V -p $logger_pid -l $tmp.log $tmp.newarch 2>&1 >$tmp.out
106 cat $tmp.out >>$seq.full
107 _filter_newlog <$tmp.out | _filter_dumplog
109 # Cleanup after youself
110 $sudo rm -f `dirname $tmp`/Latest
112 echo
113 echo "=== check old pmlogger has gone ==="
114 ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == '$logger_pid' { print }'
116 echo | tee -a $seq.full
117 echo "=== check what's in the new log ===" | tee -a $seq.full
118 sleep 1
119 pmdumplog -a $tmp.newarch | tee -a $seq.full | _filter_dumplog