summaryrefslogtreecommitdiff
path: root/qa/439
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/439
downloadpcp-47e6e7c84f008a53061e661f31ae96629bc694ef.tar.gz
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/439')
-rwxr-xr-xqa/43989
1 files changed, 89 insertions, 0 deletions
diff --git a/qa/439 b/qa/439
new file mode 100755
index 0000000..af5e369
--- /dev/null
+++ b/qa/439
@@ -0,0 +1,89 @@
+#!/bin/sh
+# PCP QA Test No. 439
+# Additional coverage for __pmConnectLogger
+#
+# Copyright (c) 2011 Ken McDonell. All Rights Reserved.
+#
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+# get standard environment, filters and checks
+. ./common.product
+. ./common.filter
+. ./common.check
+
+status=0 # success is the default!
+$sudo rm -rf $tmp.* $seq.full
+trap "rm -f $tmp.*; $sudo rm -f $PCP_TMP_DIR/pmlogger/$$; exit \$status" 0 1 2 3 15
+primary_port=`sed -e 1q $PCP_TMP_DIR/pmlogger/primary`
+
+_filter()
+{
+ sed \
+ -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/' \
+ -e 's/logcontrol([0-9][0-9]*)/logcontrol(PID)/' \
+ -e "s/$$/MYPID/g" \
+ -e "s;$PCP_TMP_DIR;\$PCP_TMP_DIR;g" \
+ -e 's/TCP connection reset by peer/Connection refused/'
+}
+
+# real QA test starts here
+export PMLOGGER_REQUEST_TIMEOUT=10
+src/logcontrol -P $primary_port enquire sample.long.write_me
+
+echo
+export PMLOGGER_REQUEST_TIMEOUT=10ABC
+src/logcontrol -P$primary_port enquire sample.long.write_me 2>&1 \
+| _filter
+unset PMLOGGER_REQUEST_TIMEOUT
+
+echo
+# $PM_LOG_ALL_PIDS is not useful
+src/logcontrol -Dcontext -p-1 enquire sample.long.write_me 2>&1 \
+| egrep '(__pmConnectLogger)|(logcontrol)'
+
+echo
+# punt that pid 1 is not pmlogger!
+src/logcontrol -Dcontext -p1 enquire sample.long.write_me 2>&1 \
+| egrep '(__pmConnectLogger)|(logcontrol)' \
+| _filter
+
+# start playing with libpcp's mind by munging files in
+# $PCP_TMP_DIR/pmlogger
+touch $tmp.ctl
+$sudo cp $tmp.ctl $PCP_TMP_DIR/pmlogger/$$
+src/logcontrol -Dcontext,log -p$$ enquire sample.long.write_me 2>&1 \
+| egrep '(/__pmConnectLogger)|(__pmLog)|(logcontrol)' \
+| _filter
+echo "bad port" >$tmp.ctl
+$sudo cp $tmp.ctl $PCP_TMP_DIR/pmlogger/$$
+src/logcontrol -Dcontext,log -p$$ enquire sample.long.write_me 2>&1 \
+| egrep '(/__pmConnectLogger)|(__pmLog)|(logcontrol)' \
+| _filter
+echo "123456" >$tmp.ctl
+$sudo cp $tmp.ctl $PCP_TMP_DIR/pmlogger/$$
+src/logcontrol -Dcontext,log -p$$ enquire sample.long.write_me 2>&1 \
+| egrep '(/__pmConnectLogger)|(__pmLog)|(logcontrol)' \
+| _filter
+cat <<End-of-File >$tmp.ctl
+123456
+no-such-host
+End-of-File
+$sudo cp $tmp.ctl $PCP_TMP_DIR/pmlogger/$$
+src/logcontrol -Dcontext,log -p$$ enquire sample.long.write_me 2>&1 \
+| egrep '(/__pmConnectLogger)|(__pmLog)|(logcontrol)' \
+| _filter
+cat <<End-of-File >$tmp.ctl
+123456
+no-such-host
+/no/such/file
+End-of-File
+$sudo cp $tmp.ctl $PCP_TMP_DIR/pmlogger/$$
+src/logcontrol -Dcontext,log -p$$ enquire sample.long.write_me 2>&1 \
+| egrep '(/__pmConnectLogger)|(__pmLog)|(logcontrol)' \
+| _filter
+
+
+# success, all done
+exit