File: testfiles.sh

package info (click to toggle)
rzip 2.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze, wheezy
  • size: 320 kB
  • ctags: 249
  • sloc: ansic: 1,888; sh: 575; makefile: 86
file content (43 lines) | stat: -rwxr-xr-x 732 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

tdir=/tmp/rzip.$$

mkdir $tdir || exit 1

failed() {
    f=$1
    echo "Failed on $f"
    exit 1
}

ratio() {
    echo $2 $1 | awk '{printf "%5.2f\n", $2/$1}'
}

ts1=0
ts2=0

for f in $*; do
    if [ ! -r $f -o ! -f $f ]; then
	continue;
    fi
    bname=`basename $f`
    ./rzip -k $f -o $tdir/$bname || failed $f
    s1=`stat -L -c '%s' $f`
    s2=`stat -L -c '%s' $tdir/$bname`
    r=`ratio $s1 $s2`
    echo $f $s1 $s2 $r
    ./rzip -k -d $tdir/$bname -o $tdir/$bname.2 || failed $f
    if ! cmp $f $tdir/$bname.2; then
	echo "Failed on $f!!"
	exit 1
    fi
    ts1=`expr $ts1 + $s1`
    ts2=`expr $ts2 + $s2`
    rm -f $tdir/$bname.2 $tdir/$bname
done

echo ALL OK
r=`ratio $ts1 $ts2`
echo $ts1 $ts2 $r
rm -rf $tdir