pmrep: fix archive end time reporting
[pcp.git] / qa / 506
blob37206494094325eb06ccc3ce44d2dbca915b6a74
1 #!/bin/sh
2 # PCP QA Test No. 506
3 # check 2^31 volume switching for pmlogrewrite
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
6 # Copyright (c) 2012 Red Hat.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 rm -f tmparch/big2.*
18 rm -f $seq.full
19 ./tmparch/mkbig1 > $seq.full 2>&1
20 [ $? -eq 0 ] || _notrun `cat $seq.full`
22 # 10GB should keep us out of trouble
23 free=`_check_freespace 10240`
24 [ -z "$free" ] || _notrun $free
26 status=0 # success is the default!
27 $sudo rm -rf $tmp.* $seq.full
28 trap "rm -f $tmp.* tmparch/big2.*; exit \$status" 0 1 2 3 15
30 _filter()
32 sed \
33 -e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
36 _check()
38 # expect 3 volumes, and all < 2^31 bytes in size
40 sts=0
41 limit=2147483648
42 nvol=`ls $1.? | wc -l | sed -e 's/ //g'`
43 if [ $nvol -ne 3 ]
44 then
45 ls -l $1.?
46 echo "Error: expecting 3 volumes, found $nvol"
47 sts=1
50 for vol in $1.?
52 size=`_filesize $vol`
53 if [ -z "$size" ]
54 then
55 stat $vol
56 echo "Error: cannot extract size for volume $vol"
57 sts=1
58 elif [ "$size" -ge $limit ]
59 then
60 ls -l $vol
61 echo "Error: size ($size) exceeds limit ($limit)"
62 sts=1
64 done
65 if [ $sts -eq 0 ]
66 then
67 echo "OK"
68 else
69 status=$sts
73 echo "metric sample.hordes.one { type -> 64 }" >$tmp.config
74 echo "metric sample.hordes.two { type -> 64 }" >>$tmp.config
76 # real QA test starts here
77 echo "rewrite and copy" | tee -a $seq.full
78 rm -f tmparch/big2*
79 ls -l tmparch/big1* >>$seq.full 2>&1
80 pminfo -d -a tmparch/big1 >>$seq.full
81 pmlogrewrite -w -c $tmp.config tmparch/big1 tmparch/big2 2>&1 | _filter
82 ls -l tmparch/big2* >>$seq.full 2>&1
83 pminfo -d -a tmparch/big2 >>$seq.full
84 _check tmparch/big2
86 echo | tee -a $seq.full
87 echo "rewrite in place" | tee -a $seq.full
88 rm -f tmparch/big2*
89 for file in tmparch/big1.*
91 cp $file `echo $file | sed -e 's/big1/big2/'`
92 done
93 ls -l tmparch/big2* >>$seq.full 2>&1
94 pminfo -d -a tmparch/big2 >>$seq.full
95 pmlogrewrite -iw -c $tmp.config tmparch/big2 2>&1 | _filter
96 ls -l tmparch/big2* >>$seq.full 2>&1
97 pminfo -d -a tmparch/big2 >>$seq.full
98 _check tmparch/big2
100 # success, all done
101 exit