File: 506

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 (99 lines) | stat: -rwxr-xr-x 2,210 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
#!/bin/sh
# PCP QA Test No. 506
# check 2^31 volume switching for pmlogrewrite
#
# Copyright (c) 2011 Ken McDonell.  All Rights Reserved.
# Copyright (c) 2012 Red Hat.
#

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

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

rm -f tmparch/big2.*
./tmparch/mkbig1 > $seq_full 2>&1
[ $? -eq 0 ] || _notrun `cat $seq_full`

# 10GB should keep us out of trouble
free=`_check_freespace 10240`
[ -z "$free" ] || _notrun $free

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

_filter()
{
    sed \
	-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9]*[0-9]/TIMESTAMP/g'
}

_check()
{
    # expect 3 volumes, and all < 2^31 bytes in size
    #
    sts=0
    limit=2147483648
    nvol=`ls $1.? | wc -l | sed -e 's/ //g'`
    if [ $nvol -ne 3 ]
    then
	ls -l $1.?
	echo "Error: expecting 3 volumes, found $nvol"
	sts=1
    fi

    for vol in $1.?
    do
	size=`_filesize $vol`
	if [ -z "$size" ]
	then
	    stat $vol
	    echo "Error: cannot extract size for volume $vol"
	    sts=1
	elif [ "$size" -ge $limit ]
	then
	    ls -l $vol
	    echo "Error: size ($size) exceeds limit ($limit)"
	    sts=1
	fi
    done
    if [ $sts -eq 0 ]
    then
	echo "OK"
    else
	status=$sts
    fi
}

echo "metric sample.hordes.one { type -> 64 }" >$tmp.config
echo "metric sample.hordes.two { type -> 64 }" >>$tmp.config

# real QA test starts here
echo "rewrite and copy" | tee -a $seq_full
rm -f tmparch/big2*
ls -l tmparch/big1* >>$seq_full 2>&1
pminfo -d -a tmparch/big1 >>$seq_full
pmlogrewrite -w -c $tmp.config tmparch/big1 tmparch/big2 2>&1 | _filter
ls -l tmparch/big2* >>$seq_full 2>&1
pminfo -d -a tmparch/big2 >>$seq_full
_check tmparch/big2

echo | tee -a $seq_full
echo "rewrite in place" | tee -a $seq_full
rm -f tmparch/big2*
for file in tmparch/big1.*
do
    cp $file `echo $file | sed -e 's/big1/big2/'`
done
ls -l tmparch/big2* >>$seq_full 2>&1
pminfo -d -a tmparch/big2 >>$seq_full
pmlogrewrite -iw -c $tmp.config tmparch/big2 2>&1 | _filter
ls -l tmparch/big2* >>$seq_full 2>&1
pminfo -d -a tmparch/big2 >>$seq_full
_check tmparch/big2

# success, all done
exit