Drop unused condition check
[pcp.git] / qa / common.compress
blobb4dd3db433dd4b8459a89ea2e47603e04cf10bc7
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, OpenBSD and Solaris strangeness
16     sed \
17         -e '/: Undefined error: 0/s//: Success/' \
18         -e '/: Error 0/s//: Success/' \
19         -e '/: No error: 0/s//: Success/' \
20         -e '/: No such file or directory/s//: Success/' \
21         -e '/null.0.gz/s/unrecognized file format/unexpected end of file/' \
22         -e '/^[         ]*$/d'
25 status=0        # success is the default!
26 deflate=none    # default compression mode (e.g. bzip2)
27 inflate=none    # default compression mode (e.g. unbzip2)
28 suffix=.huh     # default compression file suffix (e.g. bz2)
30 $sudo rm -rf $tmp $tmp.* $here/$seq.full
31 trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
33 _prepare_compress()
35     deflate="$1"
36     inflate="$2"
37     suffix="$3"
39     mkdir $tmp
40     cp tmparch/mv-bigbin* $tmp
43 _run_tools()
45     base=`echo $1 | sed -e 's/\..*//'`
46     [ $# -eq 1 ] && echo "pmdumplog ..."
47     pmdumplog -a $base
48     [ $# -eq 1 ] && echo "pminfo ..."
49     pminfo -f -a $1 sample.colour
50     [ $# -eq 1 ] && echo "pmprobe in the middle ..."
51     pmprobe -v -O +10sec -a $1 sampledso.milliseconds
52     [ $# -eq 1 ] && echo "pmval & pmval -r ..."
53     pmval -f 4 -t 3sec -a $1 sample.milliseconds 2>&1
54     pmval -f 4 -r -a $1 sample.milliseconds 2>&1
55     [ $# -eq 1 ] && echo "pmie ..."
56     echo 'sample.milliseconds > 0 -> print "%v";' \
57     | pmie -t 4sec -a $1 2>&1 \
58     | grep -v 'Info: evaluator exiting'
61 _exercise_compression()
63     _run_tools tmparch/mv-bigbin n | tee $full >$tmp.orig
65     cd $tmp
66     echo "expect only a few lines of diff output ..."
67     echo
68     echo "--- $deflate first volume ---" | tee -a $here/$seq.full
69     eval $deflate mv-bigbin.0 | _filter_compression
70     ls -l >>$here/$seq.full
71     _run_tools mv-bigbin | tee -a $here/$seq.full >$tmp.new
72     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
73     eval $inflate mv-bigbin.0.$suffix | _filter_compression
75     echo
76     echo "--- $deflate last volume and use existing .9.$suffix in -a arg ---" \
77         | tee -a $here/$seq.full
78     eval $deflate mv-bigbin.9 | _filter_compression
79     ls -l >>$here/$seq.full
80     _run_tools mv-bigbin.9.$suffix | tee -a $here/$seq.full >$tmp.new
81     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
82     eval $inflate mv-bigbin.9.$suffix | _filter_compression
84     echo
85     echo "--- $deflate middle volume and used existing .1 in -a arg ---" \
86         | tee -a $here/$seq.full
87     eval $deflate mv-bigbin.5 | _filter_compression
88     ls -l >>$here/$seq.full
89     _run_tools mv-bigbin.1 | tee -a $here/$seq.full >$tmp.new
90     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
92     echo
93     echo "--- $deflate first, middle and last volume and use .meta in -a arg ---" \
94         | tee -a $here/$seq.full
95     eval $deflate mv-bigbin.0 | _filter_compression
96     eval $deflate mv-bigbin.9 | _filter_compression
97     ls -l >>$here/$seq.full
98     _run_tools mv-bigbin.meta | tee -a $here/$seq.full >$tmp.new
99     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
101     echo
102     echo "--- $deflate first few, middle and last few volumes and use existing .7.$suffix in -a arg ---" \
103         | tee -a $here/$seq.full
104     eval $deflate mv-bigbin.1 | _filter_compression
105     eval $deflate mv-bigbin.7 | _filter_compression
106     eval $deflate mv-bigbin.8 | _filter_compression
107     ls -l >>$here/$seq.full
108     _run_tools mv-bigbin.7.$suffix | tee -a $here/$seq.full >$tmp.new
109     diff $tmp.orig $tmp.new | sed -e '/^[0-9]/d'
111     echo
112     echo "--- some error cases ---"
113     for arch in mv-bigbin.10 mv-bigbin.10.$suffix
114     do
115         pminfo -a $arch
116         pmprobe -a $arch sample.bin
117         pmval -a $arch sample.milliseconds
118         pmie -a $arch </dev/null
119     done
120     touch null.0.$suffix null.meta null.index
121     pminfo -a null 2>&1 | _filter_compression