1#! /bin/sh
2set -e
3
4#
5# usage: util/check.sh [directory]
6#
7# This script runs lzotest with all algorithms on a complete directory tree.
8# It is not suitable for accurate timings.
9#
10# Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
11#
12
13LZOTEST="lzotest"
14test -x ./lzotest/lzotest && LZOTEST="./lzotest/lzotest"
15test -x ./lzotest.exe && LZOTEST="./lzotest.exe"
16test -x ./lzotest.out && LZOTEST="./lzotest.out"
17
18dir="${*-.}"
19
20TMPFILE="/tmp/lzo_$$.tmp"
21rm -f $TMPFILE
22(find $dir/ -type f -print > $TMPFILE) || true
23
24## methods=`$LZOTEST -m | sed -n 's/^ *-m\([0-9]*\).*/\1/p'`
25## methods="9721 9722 9723 9724 9725 9726 9727 9728 9729"
26methods="21 31 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 61 71 81"
27methods="$methods 111 112 115"
28methods="$methods 921 931 901 911"
29methods="$methods 902 912 942 962 972 982 992"
30##methods="71 972"
31##methods="1101 1102 1103 1104 1105 1106 1107"
32
33LFLAGS="-q -T -n2 -S"
34LFLAGS="-q -T -n2"
35
36for i in $methods; do
37    cat $TMPFILE | $LZOTEST -m${i} -@ $LFLAGS
38done
39
40rm -f $TMPFILE
41echo "Done."
42exit 0
43
44