Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 512
blob4eb8b0f6e3ae318c4ad1dc11283cc904f1dc7349
1 #!/bin/sh
2 # PCP QA Test No. 512
3 # lock recursion depth for some pcp apps
5 # Copyright (c) 2012 Ken McDonell. All Rights Reserved.
8 # get standard filters
9 . ./common.product
10 . ./common.filter
11 . ./common.check
13 seq=`basename $0`
14 echo "QA output created by $seq"
16 src/check_fault_injection >/dev/null 2>&1 || \
17 _notrun "libpcp not built with fault injection & lock tracing enabled"
19 if [ -d ../src ]
20 then
21 SRC=../src
22 else
23 _notrun "PCP source not found at ../src"
26 status=0 # success is the default!
27 $sudo rm -rf $tmp.* $seq.full
28 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
30 # we need to run part of the make to get headers and libraries setup
31 # in $SRC
33 for dir in include libpcp/src
35 echo "$SRC/$dir ..." >>$seq.full
36 cd $SRC/$dir
37 if $PCP_MAKE_PROG 2>$tmp.err >>$here/$seq.full
38 then
39 cat $tmp.err >>$here/$seq.full
40 else
41 echo "Arrgh ... make failed in $SRC/$dir"
42 cat $tmp.err
43 status=1
44 exit
46 cd $here
47 done
49 _filter()
51 tee -a $seq.full \
52 | sed -n \
53 -e '/lock(/s/^[^ ][^ ]* //p' \
54 | LC_COLLATE=POSIX sort \
55 | uniq
58 _pre()
60 if [ ! -d $1 ]
61 then
62 echo "_pre: botch: $1 does not exist"
63 else
64 cd $1
65 $PCP_MAKE_PROG clean >/dev/null 2>&1
66 # This is a gross hack ...
67 # need to over-ride LDFLAGS from the PCP builddefs so we search for
68 # libpcp.so in the libpcp_fault directory
70 if LCFLAGS=-DPM_MULTI_THREAD_DEBUG=1 LDFLAGS="-L../../src/libpcp_fault/src" $PCP_MAKE_PROG $2 >$tmp.out 2>&1
71 then
72 mv $2 $2.debug
73 $PCP_MAKE_PROG clean >/dev/null 2>&1
74 else
75 echo "_pre: botch: make failed"
76 cat $tmp.out
78 cd $here
82 _post()
84 if [ ! -d $1 ]
85 then
86 echo "_post: botch: $1 does not exist"
87 else
88 cd $1
89 rm -f $2.debug
90 cd $here
94 # real QA test starts here
95 export LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so
98 echo "== pminfo ==" | tee -a $seq.full
99 _pre $SRC/pminfo pminfo
100 $SRC/pminfo/pminfo.debug -v -Dlock >/dev/null 2>$tmp.trace
101 _post $SRC/pminfo pminfo
102 _filter <$tmp.trace
104 echo | tee -a $seq.full
105 echo "== pmlogger ==" | tee -a $seq.full
106 sed -e 's/1 sec/50 msec/' <tmparch/config.foo >$tmp.config
107 _pre $SRC/pmlogger/src pmlogger
108 $SRC/pmlogger/src/pmlogger.debug -Dlock -c $tmp.config -s 20 -l $tmp.log $tmp
109 _post $SRC/pmlogger/src pmlogger
110 _filter <$tmp.log
112 echo | tee -a $seq.full
113 echo "== pmlogextract ==" | tee -a $seq.full
114 for arch in a b c
116 for i in 0 index meta
118 cp tmparch/foo.$i $tmp-$arch.$i
119 done
120 done
121 _pre $SRC/pmlogextract pmlogextract
122 $SRC/pmlogextract/pmlogextract.debug -Dlock $tmp-a $tmp-b $tmp-c $tmp-out 2>$tmp.trace
123 _post $SRC/pmlogextract pmlogextract
124 _filter <$tmp.trace
126 echo | tee -a $seq.full
127 echo "== pmdumplog ==" | tee -a $seq.full
128 _pre $SRC/pmdumplog pmdumplog
129 $SRC/pmdumplog/pmdumplog.debug -a -Dlock $tmp-out >$tmp.trace 2>&1
130 _post $SRC/pmdumplog pmdumplog
131 _filter <$tmp.trace
133 echo | tee -a $seq.full
134 echo "== dbpmda ==" | tee -a $seq.full
135 _pre $SRC/dbpmda/src dbpmda
136 # based on QA 137
137 $SRC/dbpmda/src/dbpmda.debug -Dlock -n $PCP_PMDAS_DIR/simple/root -ie >$tmp.trace 2>&1 <<End-of-File
138 open dso $PCP_PMDAS_DIR/simple/pmda_simple.$DSO_SUFFIX simple_init 253
139 getdesc on
140 desc simple.numfetch
141 fetch simple.numfetch
142 desc simple.color
143 fetch simple.color
144 instance 253.0
145 open pipe $PCP_PMDAS_DIR/simple/pmdasimple -d 253
146 desc simple.numfetch
147 fetch simple.numfetch
148 desc simple.color
149 fetch simple.color
150 instance 253.0
151 End-of-File
152 _post $SRC/dbpmda/src dbpmda
153 _filter <$tmp.trace
156 # success, all done
157 exit