File: 292

package info (click to toggle)
pcp 7.0.5-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,916 kB
  • sloc: ansic: 1,478,844; sh: 177,285; xml: 160,462; cpp: 83,809; python: 24,349; perl: 18,303; yacc: 6,877; lex: 2,864; makefile: 2,694; awk: 165; fortran: 60; java: 52
file content (138 lines) | stat: -rwxr-xr-x 2,952 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
#! /bin/sh
# PCP QA Test No. 292
# duplicate/alias base name resolution by pmlogger_check
#
# 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

_filter()
{
    sed \
	-e '/host:/s/ [^ ].*/ HOST/' \
	-e '/start:/s/ [^ ].*/ DATE/' \
	-e '/end:/s/ [^ ].*/ DATE/' \
	-e 's/^..:..:..\..../TIMESTAMP   /' \
	-e "s/^TIMESTAMP *$debug$/TIMESTAMP     DEBUG/g"
}

_cleanup()
{
    if [ ! -f $tmp.cleanup ]
    then
	_kill_my_pmloggers
	touch $tmp.cleanup
    fi
}

_kill_my_pmloggers()
{
    $PCP_PS_PROG $PCP_PS_ALL_FLAGS \
    | grep '/[p]mlogger .*-c ./config' \
    | $PCP_AWK_PROG '{ print $2 }' \
    | while read pid
    do
	sudo kill -TERM $pid
    done
}

signal="$sudo $PCP_BINADM_DIR/pmsignal"
status=0	# success is the default!
trap "_cleanup; cd $here; $sudo rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15

debug=`pmprobe -v pmcd.control.debug | $PCP_AWK_PROG '{ print $3 }'`

mkdir $tmp || _exit 1
chmod ugo+w $tmp
cd $tmp

echo >control '# PCP archive logging configuration/control - for qa/'$seq'
#
$version=1.1
LOCALHOSTNAME	n   n	'`pwd`'	-s 1 -c ./config'

echo "log mandatory on once pmcd.control.debug" >config

touch pmcheck.log
chmod ugo+w pmcheck.log

# real QA test starts here
_kill_my_pmloggers
echo "start pmlogger ..."
$sudo -u $PCP_USER -g $PCP_GROUP $PCP_BINADM_DIR/pmlogger_check -V -c control >>pmcheck.log 2>&1

for i in 0 1 2 3 4
do
    rm -f $tmp.done $tmp.wait_log
    wait=0
    while [ $wait -lt 20 ]
    do
	check=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '/[p]mlogger .*-c ./config'`
	echo "$i:$wait:$check" >>$tmp.wait_log
	if [ -z "$check" ]
	then
	    echo $wait >$tmp.done
	    break
	fi
	pmsleep 0.05
	wait=`expr $wait + 1`
    done
    if [ ! -f $tmp.done ]
    then
	cat $tmp.wait_log
	ls -l
	[ -f pmcheck.log ] && cat pmcheck.log
	[ -f pmlogger.log.prev ] && cat pmlogger.log.prev
	[ -f pmlogger.log ] && cat pmlogger.log
	echo "Arrgh: failed to see pmlogger exit at iteration $i"
	status=1
	exit
    fi
    echo "iter $i: pmlogger exited after `cat $tmp.done` pmsleep delays" >>$seq_full
    [ $i -eq 4 ] && break
    echo "restart pmlogger ..."
    _kill_my_pmloggers
    $sudo -u $PCP_USER -g $PCP_GROUP $PCP_BINADM_DIR/pmlogger_check -V -c control >>pmcheck.log 2>&1
done
_kill_my_pmloggers

echo
echo "Checking ..."
for sn in 00 01
do
    if [ "`echo *-$sn.index`" != "*-$sn.index" ]
    then
	echo "Found at least one \"-$sn\" suffix"
    else
	echo "No \"-$sn\" suffix found!"
	status=1
    fi
done

if [ $status = 1 ]
then
    echo
    echo "Hmm ... this is what we got"
    ls -l
    echo "=== pmlogger.log==="
    cat pmlogger.log
    echo "=== pmcheck.log==="
    cat pmcheck.log
fi

echo
echo "merge 'em together ..."
ls -l >>$seq_full
$sudo $PCP_BINADM_DIR/pmlogextract *.meta* out
pmval -U out pmcd.control.debug \
| tee -a $seq_full \
| _filter

exit