File: 061

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 (164 lines) | stat: -rwxr-xr-x 4,811 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
#!/bin/sh
# PCP QA Test No. 061
# exercise the logging state compatibility matrix
#
# 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

trap "$sudo rm -f $tmp.*; exit" 0 1 2 3 15
signal=$PCP_BINADM_DIR/pmsignal

# Note1 - this line changed from msec to usec in 3.5.9:
# state: not in log, unavail, mand, on delta: 0 usec numpmid: 1
#
# Note2 - the first (posn=132) logputresult is the prologue
# and size of this result is influenced by hostname length.
#
# Note3 - check_local_creds lines are timing sensitive and have
# nothing much to do with logging state changes, so nuke 'em
#
# Note3 - lines like ...
# logputresult: pdubuf=ADDR input len=NNN output len=NNN posn=NNN
# __pmLogPutIndex: timestamp=NNN.NNNNNN vol=0 meta posn=NNN log posn=NNN
# from the pmlogger preamble writes are in a potential race with the
# pmlc connection, and the ordering of these lines may become
# non-deterministic ... since they are not key to the success of the
# test, cull 'em
_filter_pmlogger()
{
    _filter_pmlogger_log \
    | sed >$tmp.tmp \
	-e '/^logputresult: /d' \
	-e '/^__pmLogPutIndex: /d' \
	-e "s;$tmp;TMP;g" \
	-e '/[Ss]ignalled (signal=.*), exiting/d' \
	-e '/Warning: AF event queue is empty, nothing /d' \
	-e "/Warning /s/[0-9]*-[0-9]*\.config/SEQ-MYPID.config/" \
	-e 's/0x00000000/NULL/g' \
	-e 's/0x[0-9a-f]*/ADDR/g' \
	-e 's/(nil)/ADDR/g' \
	-e 's/value [0-9]*/value INT/g' \
	-e 's/[0-2][0-9]:00:00.00*0/TIME/' \
	-e '/logputresult/{
s/len=[0-9]*/len=NNN/g
s/posn=[0-9]*/posn=NNN/
}' \
	-e '/__pmLogPutIndex/{
s/stamp=[0-9][0-9]*\.[0-9][0-9]*/stamp=NNN.NNNNNN/
s/posn=[0-9]*/posn=NNN/g
}' \
	-e 's/msec numpmid/usec numpmid/' \
	-e '/^check_local_creds:/d' \
	-e '/connection accepted on/{
s/fd=[0-9][0-9]*/fd=N/
s/'`hostname`'/localhost/
s/'`hostname -s`'/localhost/
}' \
	-e 's/fd=[0-9][0-9]*/fd=N/' \
	-e 's/localhost\.[a-zA-Z0-9]*/localhost/' \
	-e "/^control_req:/s/`hostname`/localhost/" \
    # end
    # the check_local_creds: line's position in the output
    # is not deterministic, so deal with that ...
    # Ditto for the control_req: line
    #
    grep -E -v '^(check_local_creds|control_req):' <$tmp.tmp
    echo "..."
    grep -E '^(check_local_creds|control_req):' <$tmp.tmp \
    | LC_COLLATE=POSIX sort
}

_filter_dumplog()
{
    sed \
	-e '/pmResult/s/ .* numpmid/ ... numpmid/' \
	-e '/inst /{
s/inst \[[0-9][0-9]* or "dks..."]/inst [DISK]/
s;inst \[[0-9][0-9]* or "/dev/[^"]*"];inst [DISK];
s;inst \[[0-9][0-9]* or ".*/dbs/.*\.dbf"];inst [FILE];
}' \
	-e '/value /{
s/value [0-9][0-9]*\.[0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
s/value [0-9][0-9]*\.[0-9][0-9]*/value NUMBER/
s/value [0-9][0-9]*e.[0-9][0-9]*/value NUMBER/
s/value [0-9][0-9]*/value NUMBER/
s/value \[.*]/value AGGREGATE/
s/value ".*"/value STRING/
}' \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*[0-9]/s/[^ ]*/TIMESTAMP/' \
	-e "/pmcd\.pmlogger\./s/$logger_pid/LOGGER_PID/g" \
	-e '/pmcd\.pmlogger\.port/s/value .*/value PORT/' \
	-e '/pmcd\.pmlogger\.host/s/value ".*/value "HOST"/' \
	-e '/pmcd\.pmlogger\.archive/s/value ".*/value "PATH"/' \
	-e "/\"$logger_pid\"/s/$logger_pid/LOGGER_PID/g" \
    | $PCP_AWK_PROG '
$1 == "TIMESTAMP" && NF == 4	{ print "TIMESTAMP       0       OFFSET       OFFSET"; next }
				{ print }'
}

# real QA test starts here

TZ=GMT
export TZ

for ctl in mandatory advisory
do
    for state in "on once" maybe off
    do
	[ "$ctl $state" = "advisory maybe" ] && continue
	for req_ctl in mandatory advisory
	do
	    for req_state in "on once" maybe off
	    do
		[ "$req_ctl $req_state" = "advisory maybe" ] && continue
		echo ""
		echo "$ctl $state -> $req_ctl $req_state" | tee -a $seq_full
		cat >$tmp.config <<End-of-File
# with delayed preamble, need to force *something* into the archive
log mandatory on once sample.long.ten

log $ctl $state {
    sample.colour [ "blue" ]
}

log $req_ctl $req_state {
    sample.colour [ "blue" ]
}
End-of-File
		$sudo rm -f $tmp.0 $tmp.meta $tmp.index
		_start_up_pmlogger -L -D log,optfetch,pmlc -c $tmp.config -l $tmp.out $tmp >$tmp.err 2>&1
		logger_pid=$pid
		_wait_for_pmlogger $logger_pid $tmp.out || _exit 1
		pmsleep 0.5sec
		src/logcontrol -p $logger_pid enquire sample.colour
		# give pmlogger a chance to run the request before killing it
		#
		pmsleep 0.5sec
		$sudo $signal -s TERM $logger_pid
		_wait_pmlogger_end $logger_pid || _exit 1
		echo "--- tmp.out ---" >>$seq_full
		cat $tmp.out >>$seq_full
		echo "--- tmp.err ---" >>$seq_full
		cat $tmp.err >>$seq_full
		echo "--- end" >>$seq_full
		cat $tmp.err $tmp.out | _filter_pmlogger
		if [ -s $tmp.0 ]
		then
		    pmdumplog $tmp | _filter_dumplog
		else
		    echo "Archive is empty"
		fi
	    done
	done
    done
done

exit