summaryrefslogtreecommitdiff
path: root/qa/389
blob: 42bffa28ec5083553ce720aae663fb29a3a96549 (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
#! /bin/sh
# PCP QA Test No. 389
# pmlogger does not exit with -L when it loses pmcd connection?
# #528442
#
# 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

host=`hostname`
status=1	# failure is the default!

_filter()
{
    sed -e '/myFetch: End of File: PMCD exited/d' \
	-e '/pmlogger: Error: IPC protocol failure/d'
}

trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here
echo "=== empty config and _no_ -L, should exit immediately ==="
$sudo rm -f $tmp.*
pmlogger -c /dev/null -l $tmp.log $tmp &
sleep 2
echo "expect no pmlogger process ..."
ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == "'$!'" { print }'
_filter_pmlogger_log <$tmp.log | sed -e "s/$host/HOST/"

echo
echo "=== empty config and -L, should exit when pmcd restarted ==="
$sudo rm -f $tmp.*
_start_up_pmlogger -L -c /dev/null -l $tmp.log $tmp
_wait_for_pmlogger $pid $tmp.log 5
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
echo "expect no pmlogger process ..."
ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == "'$!'" { print }'
_filter_pmlogger_log <$tmp.log | sed -e "s/$host/HOST/"

echo
echo "=== non-empty config, should exit when pmcd restarted ==="
$sudo rm -f $tmp.*
echo "log mandatory on 1 sec pmcd.version" >$tmp.config
_start_up_pmlogger -c $tmp.config -l $tmp.log $tmp
_wait_for_pmlogger $pid $tmp.log 5
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
echo "expect no pmlogger process ..."
ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == "'$!'" { print }'
_filter_pmlogger_log <$tmp.log | _filter | sed -e "s/$host/HOST/"

# success, all done
status=0
exit