summaryrefslogtreecommitdiff
path: root/qa/456
blob: f61d68519233f3cf31ad1a8f9052f49a0f893826 (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
90
91
92
93
94
95
96
97
98
99
100
101
#! /bin/sh
# PCP QA Test No. 456
#
# Bug #591459: incomplete control file for cron.pm*
#
# 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
. ./localconfig

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
LOCALHOST=`hostname | sed -e 's/\..*//'`
FULLLOCALHOST=`hostname`

hostsfile="/etc/hosts"
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e 's/\.\.\.*/[dots]/' \
	-e "s/$FULLLOCALHOST/LOCALHOST/g" \
	-e "s/$LOCALHOST/LOCALHOST/g" \
	-e "s/localhost/LOCALHOST/g" \
	-e "s/local:/LOCALHOST/g" \
	-e 's/control:[0-9][0-9]*]/control:LINE]/' \
	-e 's;/usr/var;/var;g' \
	-e "s;$tmp;TMP;g" \
	-e '/Duplicate/d' \
    | _filter_cron_scripts
}

_stop_loggers()
{
    $sudo $signal -a -s TERM pmlogger
}

_cleanup()
{
    echo
    echo "Cleaning up"

    _stop_loggers >/dev/null 2>&1

    cd # get out of tmp directory so we can delete it
    $sudo rm -rf $tmp

    $sudo $PCP_BINADM_DIR/pmlogger_check
}

_setup()
{
    _stop_loggers
    cd
    rm -rf $tmp
    mkdir $tmp
}

# real QA test starts here

_setup

# control file
#
cat >$tmp/control <<EOF
\$version=1.1
# various error cases for the primary logger
#
LOCALHOSTNAME	y   n	$tmp/1
LOCALHOSTNAME	y   n
LOCALHOSTNAME	y
LOCALHOSTNAME
# various error cases for the non-primary logger
#
foo	n   n	$tmp/2
foo	n   n
foo	n
EOF

echo "--------------"
echo "PMLOGGER.CHECK"
echo "--------------"
$sudo $PCP_BINADM_DIR/pmlogger_check -V -c $tmp/control 2>&1 | _filter

echo
echo "--------------"
echo "PMLOGGER.DAILY"
echo "--------------"
$sudo $PCP_BINADM_DIR/pmlogger_daily -V -c $tmp/control 2>&1 | _filter

# success, all done
status=0
exit