blob: fa7f8fa2984943b62db0d85660bc215e34405a9c (
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#!/bin/sh
# PCP QA Test No. 497
# pmlogconf - error handling in pmlogconf-setup
#
# Copyright (c) 2014 Red Hat.
# 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
[ -f $PCP_BINADM_DIR/pmlogconf-setup ] || \
_notrun "pmlogconf version 2.0 not installed"
rm -f $seq.out
if [ $PCP_VER -ge 3901 ]
then
suffix=2
else
suffix=1
fi
ln $seq.out.$suffix $seq.out || exit 1
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
mkdir $tmp
# need to handle diff-c lines like this
# *** TMP.conf 2010-06-17 06:36:00.000000000 +1000
# --- /var/tmp/26102.ctl 2010-06-17 06:36:01.000000000 +1000
#
_filter()
{
sed \
-e "s;$tmp;TMP;g" \
-e '/^\*\*\* TMP\.conf/s/\.conf.*/.orig .../' \
-e '/^--- .*\.ctl/s/ .*/ TMP.new .../'
}
cat <<End-of-File >$tmp/01
#pmlogconf-setup 2.0
probe sample.long.ten ? include : exclude
ident qa group one
ident this one contains no errors
sample.long.million
End-of-File
# real QA test starts here
pmlogconf -d $tmp $tmp.conf \
| _filter
echo "--- start initial config file ---"
cat $tmp.conf | _filter
echo "--- end initial config file ---"
echo
echo "=== bad condition in probe clause ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten bozo ? include : exclude
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== missing val in probe condition ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten == ? include : exclude
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== bad keyword in probe state rule ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten exists ? include : foo
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== missing : probe state rule ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten exists ? include exclude
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== bad probe state rule ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten exists ? include ! exclude
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== extra text in probe state rule ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
probe sample.ulong.ten exists ? include : exclude foo
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo
echo "=== bad force clause ==="
cat <<End-of-File >$tmp/02
#pmlogconf-setup 2.0
force foo
ident foo
sample.ulong.ten
End-of-File
( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
| _filter
echo "--- start final config file ---"
cat $tmp.conf | _filter
echo "--- end final config file ---"
# success, all done
exit
|