File: 499

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (199 lines) | stat: -rwxr-xr-x 4,554 bytes parent folder | download
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/sh
# PCP QA Test No. 499
# pmlogrewrite - -q option
#
# 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

which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"

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

_filter()
{
    tee -a $seq_full \
    | sed \
	-e "s;$tmp;TMP;g" \
	-e "s;/$$\.;/PID.;g" \
	-e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
	-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}

# on amd64 FreeBSD 15.0 (vm10), the freebsd diff(1) -u produces
# different output to GNU diff(1) -u ... the differences in the
# files are the same, but the reporting is different!
#
diff=''
for prog in diff gdiff
do
    if which $prog >/dev/null 2>&1
    then
	if $prog --help 2>&1 | grep -q 'Report bugs to: .*@gnu.org'
	then
	    diff=$prog
	    break
	fi
    fi
done
[ -n "$diff" ] || _notrun "cannot find GNU diff(1)"

_cmp()
{
    ok=true
    for ext in 0 index meta
    do
	if [ ! -f "$1.$ext" ]
	then
	    echo "Arrgh ... $1.$ext missing" | _filter
	    ok=false
	fi
	if [ ! -f "$2.$ext" ]
	then
	    echo "Warning: $2.$ext missing" | _filter
	    ok=false
	fi
    done
    $ok || return
    pmdumplog -z -dilmst $1 | tee -a $seq_full >$tmp.in
    pmdumplog -z -dilmst $2 | tee -a $seq_full >$tmp.out
    $diff -u $tmp.in $tmp.out | _filter
}

mkdir $tmp.conf.dir
i=0

# real QA test starts here

echo "=== metric not in archive ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric kernel.all.load { pmid -> 1.2.3 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + indom not in archive ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
indom 1.2 { inst 0 -> 1 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + empty global clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + no-change global hostname clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { hostname -> bozo-laptop }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + no-change global time clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { time -> 00:00:00.000000 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + no-change global timezone clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { tz -> "EST-10" }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + no-change indom clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
indom 29.2 {
    # no change ones
    indom -> 29.2
    iname "bin-300" -> "bin-300"
    inst 800 -> 800
    # no match ones
    iname "bin-999" -> "bin-998"
    inst 123 -> 456
}
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + no-change metric clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric sample.ulonglong.hundred {
    indom -> NULL
    name -> sample.ulonglong.hundred
    pmid -> 29.0.100
    sem -> instant
    type -> u64
    units -> 0,0,0,0,0,0
}
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

echo
echo "=== + change pmid clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric sample.longlong.bin_ctr { pmid -> 1.2.3 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new

# success, all done
exit