3 # pmnewlog config save/restore checks
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # create our own tmpdir to ensure we can write to it
14 mkdir
-p $tmpdir/pmlogger
15 export PCP_TMP_DIR
=$tmpdir
17 # get standard filters
22 signal
=$PCP_BINADM_DIR/pmsignal
23 trap "$signal -a pmlogger >/dev/null 2>&1; cd; rm -rf $tmpdir; exit" 0 1 2 3 15
28 -e '/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/s//TIMESTAMP/' \
29 -e 's/^\(log started *\).*/\1DATESTAMP/' \
30 -e 's/^\(last log entry *\).*/\1DATESTAMP/' \
31 -e 's/^\(current time *\).*/\1DATESTAMP/' \
32 -e 's/^\( *commencing *\).*/\1DATESTAMP/' \
33 -e 's/^\( *ending *\).*/\1DATESTAMP/' \
34 -e '/^Performance metrics/s/host .*/host HOST/'
40 -e 's/pid [0-9][0-9]*/pid PID/' \
41 -e '/ \/usr\/pcp\/bin\/pmlogger /s/.*/-- ps line removed --/' \
42 -e '/^\/usr\/pcp\/bin\/pmlogger/s/[0-9][0-9]*/PID/g' \
43 -e '/configuration file saved as/s/[0-9][0-9]*/PID/g' \
44 -e 's/\[[0-9][0-9]*]/[PID]/' \
45 -e 's/ host [^ ]*/ host HOST/g' \
46 -e '/^Getting logged/s/host HOST/host name/' \
47 -e 's/ -h [^ ]*/ -h HOST/g' \
48 -e 's/ SIG.* done/ signal stuff ... done/' \
49 -e '/Error \[<stdin>,/d' \
50 -e '/Warning \[<stdin>,/d' \
51 -e '/Not connected to any/d' \
52 -e '/Logging statement ignored/d' \
53 -e '/Problem with lookup for metric/d' \
54 -e '/Reason: Unknown metric name/d' \
55 -e '/Try again. Information not currently available/d' \
56 -e '/Unknown or illegal metric identifier/d' \
57 -e '/Metric not supported by this version/d' \
58 -e '/^log size/s/[0-9][0-9]*/BYTES/' \
59 -e '/^Contacting pmlogger /d' \
60 -e '/^pmnewlog: Warning: errors from talking /d' \
61 -e '/^continuing .../d' \
62 -e '/New pmlogger configuration file saved /d' \
66 # real QA test starts here
67 cat <<End-of-File >$tmp.config
69 log mandatory off sample.control
70 log mandatory on 10 sec sample.load
71 log advisory on once sample.seconds
73 log mandatory off sample.colour
74 log mandatory on 20 sec sample.bin
75 log advisory on 1 min sample.bucket
78 pmlogger
-L -c $tmp.config
-l $tmp.log
$tmp.arch
&
83 echo "=== pmnewlog #1 =="
85 # ps $PCP_PS_ALL_FLAGS | grep pmlogger
87 pmnewlog
-C $tmp.config
.1 -p $pid $tmp.arch
.1 2>&1 >$tmp.out
88 _filter_newlog
<$tmp.out | _filter_dumplog
>$tmp.check
91 echo "Unexpected output!"
93 echo "Filtered residual ..."
96 echo "Unfiltered output from pmnewlog ..."
99 echo "Nothing unexpected in the pmnewlog output"
103 echo "=== config differences ==="
104 diff $tmp.config
$tmp.config
.1
107 echo "=== pmnewlog #2 =="
111 pid
=`ps $PCP_PS_ALL_FLAGS \
114 | $PCP_AWK_PROG "/pmlogger.*-h $hostname.*-c \/tmp\// "'{print $2}'`
115 # ps $PCP_PS_ALL_FLAGS | grep pmlogger
119 echo "Error: no pid matching \"pmlogger.*-h `hostname`.*-c /tmp/\" from ps!"
124 pmnewlog
-C $tmp.config
.2 -p $pid $tmp.arch
.2 2>&1 >$tmp.out
125 _filter_newlog
<$tmp.out | _filter_dumplog
>$tmp.check
128 echo "Unexpected output!"
130 echo "Filtered residual ..."
133 echo "Unfiltered output from pmnewlog ..."
136 echo "Nothing unexpected in the pmnewlog output"
140 echo "=== config differences (expect none!) ==="
141 diff $tmp.config
.1 $tmp.config
.2