summaryrefslogtreecommitdiff
path: root/qa/439
blob: af5e369b05e3a0aa09f2ba143aed4f0031044d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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