pmrep: fix archive end time reporting
[pcp.git] / qa / 442
blob62568e09f8c861781b003f2570ac74b43e2a9e65
1 #!/bin/sh
2 # PCP QA Test No. 442
3 # check 2^31 volume switching for pmlogextract
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 $seq.full tmparch/big2.* tmparch/big3.*
18 ./tmparch/mkbig1 > $seq.full 2>&1
19 [ $? -eq 0 ] || _notrun `cat $seq.full`
21 # 10GB should keep us out of trouble
22 free=`_check_freespace 10240`
23 [ -z "$free" ] || _notrun $free
25 status=1 # failure is the default!
26 trap "rm -f $tmp.* tmparch/big2.* tmparch/big3.*; exit \$status" 0 1 2 3 15
28 for file in tmparch/big1.*
30 ln $file `echo $file | sed -e 's/big1/big2/'`
32 done
33 ls -l tmparch/big1* tmparch/big2* >$seq.full 2>&1
35 _filter()
37 sed \
38 -e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
41 # real QA test starts here
42 pmlogextract tmparch/big1 tmparch/big2 tmparch/big3 2>&1 | _filter
43 ls -l tmparch/big3* >>$seq.full 2>&1
45 # expect 3 volumes, and all < 2^31 bytes in size
47 limit=2147483648
48 nvol=`ls tmparch/big3.? | wc -l | sed -e 's/ //g'`
49 if [ $nvol -ne 3 ]
50 then
51 ls -l tmparch/big3.?
52 echo "Error: expecting 3 volumes, found $nvol"
53 status=1
56 echo "0" >$tmp.bc
57 for vol in tmparch/big1.?
59 size=`_filesize $vol`
60 echo "+2*$size" >>$tmp.bc
61 done
63 for vol in tmparch/big3.?
65 size=`_filesize $vol`
66 if [ -z "$size" ]
67 then
68 stat $vol
69 echo "Error: cannot extract size for volume $vol"
70 status=1
71 elif [ "$size" -ge $limit ]
72 then
73 ls -l $vol
74 echo "Error: size ($size) exceeds limit ($limit)"
75 status=1
77 echo "-$size" >>$tmp.bc
78 done
80 cat $tmp.bc >>$seq.full
81 echo
82 echo "sum(input data volume sizes) - sum(output data volume sizes)"
83 ( tr '\012' ' ' <$tmp.bc ; echo ) | bc
85 echo
86 echo "Temporal Index Entries ..."
87 for arch in tmparch/big1 tmparch/big2 tmparch/big3
89 log=`echo $arch | sed -e 's/tmparch\///g'`
90 echo "$log: `pmdumplog -t $arch | grep '^[0-9]' | wc -l | sed -e 's/ //g'`"
91 done
93 # success, all done
94 status=0
95 exit