File: stresstest

package info (click to toggle)
bibtool 2.57%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,424
  • sloc: ansic: 10,709; perl: 6,205; makefile: 477; sh: 352; tcl: 51
file content (84 lines) | stat: -rw-r--r-- 2,139 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
#! /bin/sh

if [ $# == 0 ] || [ $# == 1 ]
then
    cat <<EOF
Usage: $0 ( BIBFILE | AUXFILE ) ... DESTDIR
This script runs bibtool with many different arguments and is
intended to help comparing the behaviour of old and new bibtool
binaries when updating the package. Use at your own risk.
It produces a many files named DESTDIR/testout:*, and all such
files are removed if they already exist.
DESTDIR will be created if it does not already exist.
EOF
    exit 100
fi

: ${BIBTOOL='bibtool'}

AUXFILES=
BIBFILES=
IBIBFILES=
while [ $# != 1 ]
do
    case $1 in
     *.aux)
         AUXFILES="$AUXFILES $1"
         ;;
     *)  [ -r $1 ] || (echo $1: not found ; false) || exit 2
         BIBFILES="$BIBFILES $1"
         IBIBFILES="$IBIBFILES -i $1"
         ;;
    esac
    shift
done

DESTDIR=$1 ;
[ -d $DESTDIR ] || mkdir $DESTDIR || exit 1

rm -f $DESTDIR/testout:*
echo $AUXFILES > $DESTDIR/testout:context
echo $BIBFILES >> $DESTDIR/testout:context
export >> $DESTDIR/testout:context

[ "$BIBFILES" ] || (echo No bibfiles given ; false) || exit 2

iomode=a
for acode in : -h -k:-v -k:-A0 -K:-Aa -k:-AA -s -S:-q \
             -r:braces -r:check_y -r:improve -r:opt -r:sort_fld -r:tex_def \
             nosuchfile
do
    args=`echo $acode | tr : ' '`
    stdout=$DESTDIR/testout:$acode
    stderr=${stdout}@2
    case $iomode in
        a)
           cmd="$BIBTOOL $args -m ${stdout}@m"
           echo cat $BIBFILES "|" $cmd ">" $stdout
           cat $BIBFILES | $cmd > $stdout 2> $stderr
           ;;
        aa)
           echo $BIBTOOL $IBIBFILES $args ">" $stdout
           $BIBTOOL $IBIBFILES $args > $stdout 2> $stderr
           ;;
        *)
           iomode=
           cmd="$BIBTOOL $args -M - -o $stdout $BIBFILES"
           echo $cmd ">" ${stdout}@M
           $cmd > ${stdout}@M 2> $stderr
           ;;
    esac
    echo [exit code $?] >> $stderr
    iomode=a$iomode
done

for auxfile in $AUXFILES
do
    stdout=$DESTDIR/testout:-x`echo $auxfile | tr / :`
    stderr=${stdout}@2
    echo $BIBTOOL -x $auxfile ">" $stdout
    $BIBTOOL -x $auxfile > $stdout 2> $stderr
    echo [exit code $?] >> $stderr
done

exit 0