summaryrefslogtreecommitdiff
path: root/qa/106
diff options
context:
space:
mode:
Diffstat (limited to 'qa/106')
-rwxr-xr-xqa/106143
1 files changed, 143 insertions, 0 deletions
diff --git a/qa/106 b/qa/106
new file mode 100755
index 0000000..f05003a
--- /dev/null
+++ b/qa/106
@@ -0,0 +1,143 @@
+#! /bin/sh
+# PCP QA Test No. 106
+# exercise the logging state compatibility matrix for pmlc ...
+# initial: all instances for the same metric
+# request: some instances for a metric
+#
+# Copyright (c) 2014 Red Hat.
+# 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
+
+trap "$sudo rm -f $tmp $tmp.*; exit" 0 1 2 3 15
+
+_filter_pmlc()
+{
+ sed \
+ -e '/connect /{
+s/connect [0-9][0-9]*/connect PID/
+s/@.*/@HOSTNAME/
+}' \
+ -e '/Connected /{
+s/ on port [0-9][0-9]*//
+s/ pid [0-9][0-9]*//
+s/ at .*/ at HOSTNAME/
+}' \
+ -e 's/ nl / /' \
+ -e "/timed out/d" \
+ -e 's/Version [0-9].*/Version VERSION/' \
+ | $PCP_AWK_PROG '
+/pmlc commands/ { skip = 1; print "[command summary deleted ...]" }
+/metric-name/ { skip = 0; next }
+skip == 1 { next }
+ { print }'
+}
+
+_filter_logger()
+{
+ _filter_pmlogger_log \
+ | sed \
+ -e '/AF event queue/d'
+}
+
+_filter_dump()
+{
+ _filter_pmdumplog \
+ | sed \
+ -e '/^$/d' \
+ -e '/pmResult/s/ .* numpmid/ ... numpmid/' \
+ -e '/inst /{
+s/inst \[[0-9][0-9]* or "dks..."]/inst [DISK]/
+s;inst \[[0-9][0-9]* or "/dev/[^"]*"];inst [DISK];
+s;inst \[[0-9][0-9]* or ".*/dbs/.*\.dbf"];inst [FILE];
+}' \
+ -e '/value /{
+s/value [0-9][0-9]*\.[0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
+s/value [0-9][0-9]*\.[0-9][0-9]*/value NUMBER/
+s/value [0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
+s/value [0-9][0-9]*/value NUMBER/
+s/value \[.*]/value AGGREGATE/
+s/value ".*"/value STRING/
+}' \
+ -e "/pmcd\.pmlogger\./s/$logger_pid/LOGGER_PID/g" \
+ -e '/pmcd\.pmlogger\.port/s/value .*/value PORT/' \
+ -e '/pmcd\.pmlogger\.host/s/value ".*/value "HOST"/' \
+ -e '/pmcd\.pmlogger\.archive/s/value ".*/value "PATH"/'
+}
+
+_do_cmds()
+{
+ for ctl in mandatory advisory
+ do
+ for state in "on once" maybe off
+ do
+ [ "$ctl $state" = "advisory maybe" ] && continue
+ for req_ctl in mandatory advisory
+ do
+ for req_state in "on once" maybe off
+ do
+ [ "$req_ctl $req_state" = "advisory maybe" ] && continue
+ ( echo "# setup"; \
+ echo "log mandatory maybe sample.bin"; \
+ echo "# $ctl $state -> $req_ctl $req_state"; \
+ echo "log $ctl $state sample.bin "; \
+ ) | pmlc -ie $1
+ pmsleep 0.5
+ ( echo "log $req_ctl $req_state sample.bin"'[ "bin-100", "bin-200", "bin-300"]'; \
+ echo "query sample.bin"; \
+ ) | pmlc -ie $1
+ pmsleep 0.5
+ # need sleeps to allow pmlogger to get a look in and
+ # to allow the pmlogger socket to be closed so the
+ # next pmlc invocation can get connected
+ done
+ done
+ done
+ done
+}
+
+x=3
+
+# real QA test starts here
+$sudo rm -f $tmp.0 $tmp.meta $tmp.index
+
+# start pmlogger with the expected number of samples plus a few more
+# to detect extra log output
+#
+_start_up_pmlogger -t 0.5sec -L -s 30 -c /dev/null -l $tmp.log $tmp >$tmp.err 2>&1
+logger_pid=$pid
+
+pmsleep 1.1
+_do_cmds $logger_pid >$tmp.out 2>&1
+
+# this chews up any remaining samples quickly so pmlogger terminates
+#
+echo "log mandatory on 25 msec sample.long.one" \
+| pmlc -ie $logger_pid >>$tmp.out 2>&1
+
+_filter_pmlc <$tmp.out
+
+_wait_pmlogger_end $logger_pid
+cat $tmp.err $tmp.log | _filter_logger
+
+echo
+if [ -s $tmp.0 ]
+then
+ echo "Uniq filtered entries from pmdumplog ..."
+ pmdumplog $tmp \
+ | _filter_dump \
+ | sed -e 's/TIMESTAMP//' -e 's/^ *//' \
+ | LC_COLLATE=POSIX sort -u
+ pmdumplog $tmp >$seq.full 2>&1
+else
+ echo "Archive log is empty"
+fi
+
+exit