File: 512

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 (163 lines) | stat: -rwxr-xr-x 3,841 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
#!/bin/sh
# PCP QA Test No. 512
# lock recursion depth for some pcp apps
#
# Copyright (c) 2012 Ken McDonell.  All Rights Reserved.
#

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

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so; export LD_PRELOAD
src/check_fault_injection >/dev/null 2>&1 || \
    _notrun "libpcp not built with fault injection & lock tracing enabled"
unset LD_PRELOAD

if [ -d ../src ]
then
    SRC=../src
else
    _notrun "PCP source not found at ../src"
fi

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

# we need to run part of the make to get headers and libraries setup
# in $SRC
#
for dir in include libpcp/src libpcp_archive/src
do
    echo "$SRC/$dir ..." >>$seq_full
    cd $SRC/$dir
    if $PCP_MAKE_PROG 2>$tmp.err >>$seq_full
    then
	cat $tmp.err >>$seq_full
    else
	echo "Arrgh ... make failed in $SRC/$dir"
	cat $tmp.err
	status=1
	exit
    fi
    cd $here
done

_filter()
{
    tee -a $seq_full \
    | sed -n \
	-e '/lock(/{
s/.* unlock(/unlock(/
s/.* lock(/lock(/
p
}' \
    | LC_COLLATE=POSIX sort \
    | uniq
}

_pre()
{
    if [ ! -d $1 ]
    then
	echo "_pre: botch: $1 does not exist"
    else
	cd $1
	$PCP_MAKE_PROG clean >/dev/null 2>&1
	# This is a gross hack ...
	# need to over-ride LDFLAGS from the PCP builddefs so we search for
	# libpcp.so in the libpcp_fault directory
	#
	if LCFLAGS=-DPM_MULTI_THREAD_DEBUG=1 LDFLAGS="-L../../src/libpcp_fault/src" $PCP_MAKE_PROG $2 >$tmp.out 2>&1
	then
	    mv $2 $2.debug
	    $PCP_MAKE_PROG clean >/dev/null 2>&1
	else
	    echo "_pre: botch: make failed"
	    cat $tmp.out
	fi
	cd $here
    fi
}

_post()
{
    if [ ! -d $1 ]
    then
	echo "_post: botch: $1 does not exist"
    else
	cd $1
	rm -f $2.debug
	cd $here
    fi
}

# real QA test starts here

echo "== pminfo ==" | tee -a $seq_full
_pre $SRC/pminfo pminfo
LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so $SRC/pminfo/pminfo.debug -v -Dlock >/dev/null 2>$tmp.trace
_post $SRC/pminfo pminfo
_filter <$tmp.trace

echo | tee -a $seq_full
echo "== pmlogger ==" | tee -a $seq_full
sed -e 's/1 sec/50 msec/' <tmparch/config.foo >$tmp.config
_pre $SRC/pmlogger/src pmlogger
LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so $SRC/pmlogger/src/pmlogger.debug -Dlock -c $tmp.config -s 20 -l $tmp.log $tmp
_post $SRC/pmlogger/src pmlogger
_filter <$tmp.log

echo | tee -a $seq_full
echo "== pmlogextract ==" | tee -a $seq_full
for arch in a b c
do
    for i in 0 index meta
    do
	cp tmparch/foo.$i $tmp-$arch.$i
    done
done
_pre $SRC/pmlogextract pmlogextract
LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so $SRC/pmlogextract/pmlogextract.debug -Dlock $tmp-a $tmp-b $tmp-c $tmp-out 2>$tmp.trace
_post $SRC/pmlogextract pmlogextract
_filter <$tmp.trace

echo | tee -a $seq_full
echo "== pmlogdump ==" | tee -a $seq_full
_pre $SRC/pmlogdump pmlogdump
LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so $SRC/pmlogdump/pmlogdump.debug -dilmst -Dlock $tmp-out >$tmp.err 2>$tmp.out
_post $SRC/pmlogdump pmlogdump
cat $tmp.out $tmp.err | _filter

echo | tee -a $seq_full
echo "== dbpmda ==" | tee -a $seq_full
_pre $SRC/dbpmda/src dbpmda
# based on QA 137
cat <<End-of-File >$tmp.in
open dso $PCP_PMDAS_DIR/simple/pmda_simple.$DSO_SUFFIX simple_init 253
getdesc on
desc simple.numfetch
fetch simple.numfetch
desc simple.color
fetch simple.color
instance 253.0
open pipe $PCP_PMDAS_DIR/simple/pmdasimple -d 253 -l $tmp.log
desc simple.numfetch
fetch simple.numfetch
desc simple.color
fetch simple.color
instance 253.0
End-of-File
$sudo -u $PCP_USER sh -c "LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so $SRC/dbpmda/src/dbpmda.debug -Dlock -n $PCP_PMDAS_DIR/simple/root -ie" <$tmp.in >$tmp.out 2>$tmp.err
_post $SRC/dbpmda/src dbpmda
_filter <$tmp.out
_filter <$tmp.err

cat $tmp.log >>$seq_full

# success, all done
exit