summaryrefslogtreecommitdiff
path: root/qa/184
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
commit47e6e7c84f008a53061e661f31ae96629bc694ef (patch)
tree648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/184
downloadpcp-debian.tar.gz
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/184')
-rwxr-xr-xqa/184108
1 files changed, 108 insertions, 0 deletions
diff --git a/qa/184 b/qa/184
new file mode 100755
index 0000000..79bcad1
--- /dev/null
+++ b/qa/184
@@ -0,0 +1,108 @@
+#! /bin/sh
+# PCP QA Test No. 184
+# simplest possible case for pmnewlog
+#
+# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
+#
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+# get standard filters
+. ./common.product
+. ./common.filter
+. ./common.check
+
+signal=$PCP_BINADM_DIR/pmsignal
+newlog=$PCP_BINADM_DIR/pmnewlog
+trap "$sudo $signal -a pmlogger >/dev/null 2>&1; $sudo rm -f $tmp.*; exit" 0 1 2 3 15
+
+_filter_dumplog()
+{
+ sed \
+ -e '/\[[0-9][0-9]* bytes\]/d' \
+ -e '/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/s//TIMESTAMP/' \
+ -e 's/^\(log started *\).*/\1DATESTAMP/' \
+ -e 's/^\(last log entry *\).*/\1DATESTAMP/' \
+ -e 's/^\(current time *\).*/\1DATESTAMP/' \
+ -e 's/^\( *commencing *\).*/\1DATESTAMP/' \
+ -e 's/^\( *ending *\).*/\1DATESTAMP/' \
+ -e '/^Performance metrics/s/host .*/host HOST/' \
+ -e '/(pmcd.control.register)/s/value [0-9][0-9]*/value INTEGER/' \
+ -e '/^InDom: 2.1/,/^$/s/[0-9][0-9]* or "[0-9][0-9]*"/LOGGER_PID or "LOGGER_PID"/g' \
+ -e '/pmcd.pmlogger.*inst/s/[0-9][0-9]* or "[0-9][0-9]*"/LOGGER_PID or "LOGGER_PID"/' \
+ -e '/pmcd.pmlogger.port/s/value .*/value PORT/' \
+ -e '/pmcd.pmlogger.host/s/value ".*/value "HOST"/' \
+ -e '/pmcd.pmlogger.archive/s/value ".*/value "PATH"/' \
+ | $PCP_AWK_PROG '
+$1 == "TIMESTAMP" && NF == 4 { print "TIMESTAMP 0 OFFSET OFFSET"; next }
+ { print }'
+}
+
+_filter_newlog()
+{
+ sed \
+ -e 's/process [0-9][0-9]*/process PID/' \
+ -e '/pmlogger -L/s/.*/-- ps line removed --/' \
+ -e '/ \/usr\/pcp\/bin\/pmlogger /s/.*/-- ps line removed --/' \
+ -e 's/^\/usr\/pcp\/bin\/pmlogger/pmlogger/' \
+ -e "/^pmlogger/s/$seq-[0-9][0-9]*/SEQ-PID/g" \
+ -e '/configuration file saved as/s/[0-9][0-9]*/PID/g' \
+ -e 's/\[[0-9][0-9]*]/[PID]/' \
+ -e '/PMCD host/d' \
+ -e 's/ host [^ ]*/ host HOST/g' \
+ -e '/^Getting logged/s/host HOST/host name/' \
+ -e 's/ -h [^ ]*/ -h HOST/g' \
+ -e 's/ -c [^ ]*/ -c CONF/g' \
+ -e 's/ SIG.* done/ signal stuff ... done/' \
+ -e '/Error \[<stdin>,/d' \
+ -e '/Warning \[<stdin>,/d' \
+ -e '/Not connected to any/d' \
+ -e '/Logging statement ignored/d' \
+ -e '/Problem with lookup for metric/d' \
+ -e '/Reason: Unknown metric name/d' \
+ -e '/Try again. Information not currently available/d' \
+ -e '/Unknown or illegal metric identifier/d' \
+ -e '/Unknown or illegal instance domain identifier/d' \
+ -e '/Metric not supported by this version/d' \
+ -e '/^log size/s/[0-9][0-9]*/BYTES/' \
+ -e '/^Contacting pmlogger /d' \
+ -e '/^pmnewlog: Warning: errors from talking /d' \
+ -e '/^continuing .../d' \
+ -e '/New pmlogger configuration file saved /d' \
+ -e '/^[ ]*$/d' \
+ -e 's;/tmp/PID/pcp;/tmp/PID;g'
+}
+
+# real QA test starts here
+
+# Note:
+# Logging a metric with an instance domain so that the record will be flushed.
+cat <<End-of-File >$tmp.config
+log mandatory on once pmcd.control.register["0"]
+End-of-File
+$sudo rm -f $tmp.arch.*
+_start_up_pmlogger -L -c $tmp.config -l $tmp.log $tmp.arch >$tmp.err 2>&1
+logger_pid=$pid
+_wait_for_pmlogger $logger_pid $tmp.log
+
+echo "=== old log ===" | tee $seq.full
+pmdumplog -a $tmp.arch | tee -a $seq.full | _filter_dumplog
+
+echo | tee -a $seq.full
+echo "=== pmnewlog ==" | tee -a $seq.full
+$sudo $newlog -V -p $logger_pid -l $tmp.log $tmp.newarch 2>&1 >$tmp.out
+cat $tmp.out >>$seq.full
+_filter_newlog <$tmp.out | _filter_dumplog
+
+# Cleanup after youself
+$sudo rm -f `dirname $tmp`/Latest
+
+echo
+echo "=== check old pmlogger has gone ==="
+ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == '$logger_pid' { print }'
+
+echo | tee -a $seq.full
+echo "=== check what's in the new log ===" | tee -a $seq.full
+sleep 1
+pmdumplog -a $tmp.newarch | tee -a $seq.full | _filter_dumplog