summaryrefslogtreecommitdiff
path: root/qa/116
blob: 18ccd3c2750b03b2a0817810fa8cac3fa684fc60 (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. 116
# Check hyphen in host name
#
# Copyright (c) 2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
. ./common.config

[ -z "$PCPQA_HYPHEN_HOST" -o "$PCPQA_HYPHEN_HOST" = "some-host" ] && \
    _notrun 'PCPQA_HYPHEN_HOST is not set in ./common.config'

status=0	# success is the default!
$sudo rm -rf $tmp.*
rm -f $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here

host=$PCPQA_HYPHEN_HOST
eval realhost=`pmprobe -v -h $PCPQA_HYPHEN_HOST pmcd.hostname | \
	$PCP_AWK_PROG '{ print $3 }'`
if [ -z "$realhost" ]
then
    _notrun "cannot connect to pmcd on $PCPQA_HYPHEN_HOST"
fi
[ "$realhost" = Unknown ] && realhost=`pmhostname $PCPQA_HYPHEN_HOST`

_filter_pmlc()
{
    sed \
	-e '/primary/d' \
	-e "s/$host/HYPHEN-HOST/" \
	-e "s/$realhost/HYPHEN-HOST/" \
	-e 's/HYPHEN-HOST\.localdomain/HYPHEN-HOST/' \
	-e 's/   *.*/	.../'
}

_filter()
{
    sed \
	-e "s/$host/HYPHEN-HOST/" \
	-e "s/$realhost/HYPHEN-HOST/" \
	-e 's/HYPHEN-HOST\.localdomain/HYPHEN-HOST/' \
	-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/'
}

# real QA test starts here

echo "pmie [hostname in config]"
cat <<End-of-File >$tmp.config
delta = 1;
// note have to quote hostname
2 * pmcd.control.sighup :'$host' - pmcd.control.sighup :'$host';
End-of-File
cat $tmp.config >$seq.full
pmie -T 2sec -v <$tmp.config >$tmp.out 2>$tmp.err
cat $tmp.out $tmp.err \
| tee -a $seq.full \
| sed -e 's/expr_1:  */expr_1: /' \
| _show_pmie_errors

echo
echo "pmval [metric spec on command line]"
pmval -t0.5 -s 1 $host:pmcd.control.sighup \
| tee -a $seq.full \
| _filter

echo
echo "pmlc [several uses]"
( echo "show loggers"; \
  echo "show loggers@$host";  \
  echo "connect primary@$host"; \
  echo "status" \
) \
| pmlc -h $host -P \
| tee -a $seq.full \
| _filter_pmlc

# success, all done
status=0
exit