summaryrefslogtreecommitdiff
path: root/qa/510
blob: 834928aecddf17fafebf3287fe30599b7773aa01 (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
#!/bin/sh
# PCP QA Test No. 510
# pmlogger -Dall calls __pmDumpResult() which fails for usage with
# pmlc control requests
#
# Copyright (c) 2012 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=1
$sudo rm -rf $tmp.* $seq.full
trap "_cleanup" 0 1 2 3 15
needclean=true

_cleanup()
{
    if $needclean
    then
	if [ -s $PCP_PMLOGGERCONTROL_PATH.$seq ]
	then
	    $sudo rm -f $PCP_PMLOGGERCONTROL_PATH
	    $sudo mv $PCP_PMLOGGERCONTROL_PATH.$seq $PCP_PMLOGGERCONTROL_PATH
	fi
	needclean=false
	_restore_primary_logger
	$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
	_wait_for_pmcd
    fi
    $sudo rm -f $tmp.*
    exit $status
}

_filter()
{
    sed \
	-e 's/Version [0-9].*/Version VERSION/'
}

# stop primary logger, add -Dall to config file and restart pmlogger
$sudo $PCP_RC_DIR/pcp stop >/dev/null 2>&1
sed -e '/^LOCALHOSTNAME/s/$/ -Dall/' <$PCP_PMLOGGERCONTROL_PATH >$tmp.control
$sudo mv $PCP_PMLOGGERCONTROL_PATH $PCP_PMLOGGERCONTROL_PATH.$seq
$sudo mv $tmp.control $PCP_PMLOGGERCONTROL_PATH
_writable_primary_logger
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd

# real QA test starts here
pmlc -ie <<End-of-File | _filter
connect primary
query sample.event
log mandatory on once sample.event.records
query sample.event
End-of-File

# success, all done
status=0
exit