qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / common.compress
blob17bc2b9b0f70bd5dc343f42635b2cad9d20e074a
2 # Common shell routines for testing archive (de)compression
4 # Copyright (c) 2014 Red Hat.
5 # Copyright (c) 2010 Ken McDonell.  All Rights Reserved.
8 # get standard environment, filters and checks
9 . ./common.product
10 . ./common.filter
11 . ./common.check
13 _filter_compression()
15     # Mac OS X, FreeBSD and Solaris strangeness
16     sed \
17         -e '/: Undefined error: 0/s//: Success/' \
18         -e '/: Error 0/s//: Success/' \
19         -e '/: No such file or directory/s//: Success/' \
20         -e '/^[         ]*$/d'
23 status=0        # success is the default!
24 deflate=none    # default compression mode (e.g. bzip2)
25 inflate=none    # default compression mode (e.g. unbzip2)
26 suffix=.huh     # default compression file suffix (e.g. bz2)
28 $sudo rm -rf $tmp $tmp.* $here/$seq.full
29 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
31 _prepare_compress()
33     deflate="$1"
34     inflate="$2"
35     suffix="$3"
37     mkdir $tmp
38     cp tmparch/mv-bigbin* $tmp
41 _run_tools()
43     base=`echo $1 | sed -e 's/\..*//'`
44     [ $# -eq 1 ] && echo "pmdumplog ..."
45     pmdumplog -a $base
46     [ $# -eq 1 ] && echo "pminfo ..."
47     pminfo -f -a $1 sample.colour
48     [ $# -eq 1 ] && echo "pmprobe in the middle ..."
49     pmprobe -v -O +10sec -a $1 sampledso.milliseconds
50     [ $# -eq 1 ] && echo "pmval & pmval -r ..."
51     pmval -f 4 -t 3sec -a $1 sample.milliseconds 2>&1
52     pmval -f 4 -r -a $1 sample.milliseconds 2>&1
53     [ $# -eq 1 ] && echo "pmie ..."
54     echo 'sample.milliseconds > 0 -> print "%v";' \
55     | pmie -t 4sec -a $1 2>&1 \
56     | grep -v 'Info: evaluator exiting'
59 _exercise_compression()
61     _run_tools tmparch/mv-bigbin n | tee $full >$tmp.orig
63     cd $tmp
64     echo "expect only a few lines of diff output ..."
65     echo
66     echo "--- $deflate first volume ---" | tee -a $here/$seq.full
67     eval $deflate mv-bigbin.0 | _filter_compression
68     ls -l >>$here/$seq.full
69     _run_tools mv-bigbin | tee -a $here/$seq.full >$tmp.new
70     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
71     eval $inflate mv-bigbin.0.$suffix | _filter_compression
73     echo
74     echo "--- $deflate last volume and use existing .9.$suffix in -a arg ---" \
75         | tee -a $here/$seq.full
76     eval $deflate mv-bigbin.9 | _filter_compression
77     ls -l >>$here/$seq.full
78     _run_tools mv-bigbin.9.$suffix | tee -a $here/$seq.full >$tmp.new
79     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
80     eval $inflate mv-bigbin.9.$suffix | _filter_compression
82     echo
83     echo "--- $deflate middle volume and used existing .1 in -a arg ---" \
84         | tee -a $here/$seq.full
85     eval $deflate mv-bigbin.5 | _filter_compression
86     ls -l >>$here/$seq.full
87     _run_tools mv-bigbin.1 | tee -a $here/$seq.full >$tmp.new
88     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
90     echo
91     echo "--- $deflate first, middle and last volume and use .meta in -a arg ---" \
92         | tee -a $here/$seq.full
93     eval $deflate mv-bigbin.0 | _filter_compression
94     eval $deflate mv-bigbin.9 | _filter_compression
95     ls -l >>$here/$seq.full
96     _run_tools mv-bigbin.meta | tee -a $here/$seq.full >$tmp.new
97     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
99     echo
100     echo "--- $deflate first few, middle and last few volumes and use existing .7.$suffix in -a arg ---" \
101         | tee -a $here/$seq.full
102     eval $deflate mv-bigbin.1 | _filter_compression
103     eval $deflate mv-bigbin.7 | _filter_compression
104     eval $deflate mv-bigbin.8 | _filter_compression
105     ls -l >>$here/$seq.full
106     _run_tools mv-bigbin.7.$suffix | tee -a $here/$seq.full >$tmp.new
107     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
109     echo
110     echo "--- some error cases ---"
111     for arch in mv-bigbin.10 mv-bigbin.10.$suffix
112     do
113         pminfo -a $arch
114         pmprobe -a $arch sample.bin
115         pmval -a $arch sample.milliseconds
116         pmie -a $arch </dev/null
117     done
118     touch null.0.$suffix null.meta null.index
119     pminfo -a null 2>&1 | _filter_compression