pmrep: fix archive end time reporting
[pcp.git] / qa / 477
blob04b3a71abd6751b79da8368075340768b824eeda
1 #!/bin/sh
2 # PCP QA Test No. 477
3 # Increase coverage and check malloc failure for event record routines.
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 src/check_fault_injection >/dev/null 2>&1 || \
17 _notrun "libpcp not built with fault injection enabled"
19 status=0 # success is the default!
20 $sudo rm -rf $tmp.* $seq.full
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
23 _filter()
25 echo "=== stdout ===" >>$seq.full
26 cat $tmp.out >>$seq.full
27 echo >>$seq.full
28 echo >>$seq.full
29 echo "=== stderr ===" >>$seq.full
30 cat $tmp.err >>$seq.full
31 echo >>$seq.full
32 echo >>$seq.full
33 ( cat $tmp.out; echo; cat $tmp.err ) \
34 | sed \
35 -e "s/\(host:[ ]*\)`hostname`/\1localhost/" \
36 -e '/__pmFaultInject(.*) not registered/d' \
37 -e 's/[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g' \
38 -e 's/Not enough space/Cannot allocate memory/'
41 export PM_FAULT_CONTROL=$tmp.control
42 export LD_PRELOAD=$PCP_LIB_DIR/libpcp_fault.so
44 # real QA test starts here
45 cat >$tmp.control <<End-of-File
46 libpcp/events.c:1 % 7
47 libpcp/events.c:2 % 11
48 libpcp/events.c:3 % 13
49 libpcp/events.c:4 % 9
50 End-of-File
51 pmstore sample.event.reset 0 >/dev/null 2>&1
52 pmevent -Dfault -t 0.2 -s 10 sample.event.records >$tmp.out 2>$tmp.err
53 _filter
55 # first pmRegisterAnon() fails
56 echo
57 cat >$tmp.control <<End-of-File
58 libpcp/derive.c:7 ==1
59 End-of-File
60 pmstore sample.event.reset 0 >/dev/null 2>&1
61 pmevent -Dfault -t 0.2 -s 2 sample.event.records >$tmp.out 2>$tmp.err
62 _filter
64 # second pmRegisterAnon() fails
65 echo
66 cat >$tmp.control <<End-of-File
67 libpcp/derive.c:8 ==1
68 End-of-File
69 pmstore sample.event.reset 0 >/dev/null 2>&1
70 pmevent -Dfault -t 0.2 -s 2 sample.event.records >$tmp.out 2>$tmp.err
71 _filter
73 # success, all done
74 exit