File: 571

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (176 lines) | stat: -rwxr-xr-x 2,996 bytes parent folder | download | duplicates (5)
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
#! /bin/sh
# PCP QA Test No. 571
#
# #676245 - dynamic indoms for pmlogger, uses sample.dynamic.*
# Check that when the instance domain changes for logged metrics
# the new indom is only added once. The bug was for pmlogger 
# adding the indom once for each metric using it.
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#
# check-group-include: pmlogger

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

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

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
control=$PCP_PMDAS_DIR/sample/dynamic.indom
logger_pid=-1

PMLOGGER=pmlogger
SLEEPY=5

_cleanup()
{
    if [ $logger_pid -gt 0 ]
    then
	$signal -s TERM $logger_pid
	logger_pid=-1
    fi
   
   $sudo rm -f $control

   pmdumplog -a $tmp.logfile >>$here/$seq.full

    [ -f $control.qa-$seq ] && $sudo mv $control.qa-$seq $control
    rm -f $tmp.*
}

$sudo rm -f $control.qa-$seq $seq.full

trap "_cleanup; exit \$status" 0 1 2 3 15

[ -f $control ] && $sudo mv $control $control.qa-$seq

# real QA test starts here

_start_logger()
{
    cat >$tmp.logconf <<End-of-File
log advisory on 2 sec {
    sample.dynamic
}
End-of-File

    $PMLOGGER -c $tmp.logconf -l $tmp.log $tmp.logfile &
    logger_pid=$!
}

# - replace timestamps by TIMESTAMP-n
# - skip InDom 2.1 (pmcd.pmlogger.* metrics) where instances are not
#   deterministic
#
_filter()
{
    cat >$tmp.tmp
    sed -n -e '/^[0-9]/p' <$tmp.tmp \
    | sort \
    | uniq >$tmp.stamps

    ( cat $tmp.stamps \
      ; echo "---" \
      ; cat $tmp.tmp \
    ) \
    | $PCP_AWK_PROG '
BEGIN		{ state = 0; i = 0 }
$1 == "---"	{ state = 1; next }
/InDom: 2.1/	{ skip = 2; next }
skip > 0	{ skip--; next }
state == 0	{ stamp[$1] = "TIMESTAMP-" i; i++; next }
/^[0-9]/	{ if ($0 ~ /^[0-9]/) {
		    if (stamp[$1] != "")
			$1 = stamp[$1]
		    else
			$1 = $1 "-BOTCHED-MATCH"
		  }
		  print
		  next
		}
		{ print }'
}

_dumplog()
{
    sleep $SLEEPY
    pmdumplog -i $tmp.logfile | _filter
    pmdumplog -im $tmp.logfile sample.dynamic.instant | _filter >>$here/$seq.full
}

# start the pmlogger
#
_start_logger

# do the first instance dump
#
_dumplog

# Change the instances
#
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
200 twenty
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control

# do the instance dump
#
_dumplog

# Add an instance
#
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
200 twenty
400 fourty
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control

# do the instance dump
#
_dumplog

# Change an instance
#
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
200 twenty
500 fifty
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control

# do the instance dump
#
_dumplog

# Remove some instances
#
cat >$tmp.indom <<End-of-File
10 one
20 two
30 three
End-of-File
$sudo rm -f $control
$sudo cp $tmp.indom $control

# do the instance dump
#
_dumplog

# success, all done
status=0
exit