tests/run-tests
author mpm@selenic.com
Sun, 03 Jul 2005 20:33:35 -0800
changeset 602 56d81b303656
parent 547 4fc63e22b1fe
child 608 d2994b5298fb
permissions -rwxr-xr-x
Various HTML cleanups -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Various HTML cleanups From: Edouard Gomez <ed.gomez@free.fr> Cleaned up the changeset summary table differentiating title cells from data cells using th and td. Added semantic classes. Changed the big pre tag into a div that mimics pre tag style (that is monospace font and white space preformated). This is required because pre is an inline element, and thus cannot be the parent of block elements as div (diffblock). I replaced all these div blocks by a series ul lists as patches can be seen as lists of changes in versioned files. If someone has a better semantic to propose, i'd be pleased he drops me an email about this patch. - -- Cleaned up the filediff summary table differentiating title cells from data cells using th and td. Added semantic classes. - -- Keep style unchanged for changeset template As promised no changes in style. This one got through my eyes + brain checking... sorry. manifest hash: 68dd5c1ac71aa6a5932fb209d48df5fc0c78643b -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyLwfywK+sNU5EO8RAtE9AJ0cxl80eF3zpBWLn8OkoSs7dkZOTgCgtYto j7T/iRk0Hq4Q0mjdos7FvYU= =KOP2 -----END PGP SIGNATURE-----
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 495
diff changeset
     1
#!/bin/sh -e
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
     2
488
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     3
export LANG=C
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     4
export LC_CTYPE="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     5
export LC_NUMERIC="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     6
export LC_TIME="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     7
export LC_COLLATE="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     8
export LC_MONETARY="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
     9
export LC_MESSAGES="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    10
export LC_PAPER="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    11
export LC_NAME="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    12
export LC_ADDRESS="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    13
export LC_TELEPHONE="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    14
export LC_MEASUREMENT="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    15
export LC_IDENTIFICATION="C"
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    16
export LC_ALL=""
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
    17
489
a636f7d2cd5b [PATCH] umask for run-tests
mpm@selenic.com
parents: 488
diff changeset
    18
umask 022
a636f7d2cd5b [PATCH] umask for run-tests
mpm@selenic.com
parents: 488
diff changeset
    19
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    20
tests=0
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    21
failed=0
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    22
H=$PWD
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    23
473
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    24
if [ -d /usr/lib64 ]; then
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    25
    lib=lib64
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    26
else
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    27
    lib=lib
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    28
fi
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    29
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    30
TESTPATH=$PWD/install/bin
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    31
export PATH=$TESTPATH:$PATH
473
5914e27dc717 [PATCH] Get run-tests working on 64-bit machines.
mpm@selenic.com
parents: 429
diff changeset
    32
export PYTHONPATH=$PWD/install/$lib/python
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    33
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    34
rm -rf install
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    35
cd ..
398
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
    36
${PYTHON:-python} setup.py install --home=tests/install > tests/install.err
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
    37
if [ $? != 0 ] ; then
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
    38
    cat tests/install.err
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
    39
fi
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    40
cd $H
398
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
    41
rm install.err
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    42
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    43
function run_one
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    44
{
399
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    45
    rm -f $1.err
382
37249c522770 test suite: fix timezone problems and port collision problem
mpm@selenic.com
parents: 362
diff changeset
    46
    export TZ=GMT
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    47
    D=`mktemp -d`
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 495
diff changeset
    48
    if [ "$D" = "" ] ; then
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    49
	echo mktemp failed!
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    50
    fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    51
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    52
    cd $D
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    53
    fail=0
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    54
399
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    55
    if ! $H/$1 > .out 2>&1 ; then
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    56
	echo $1 failed with error code $?
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    57
	fail=1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    58
    fi
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    59
399
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    60
    if [ -s .out -a ! -r $H/$1.out ] ; then
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    61
	echo $1 generated unexpected output:
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    62
	cat .out
399
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    63
	cp .out $H/$1.err
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    64
	fail=1
399
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    65
    elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    66
	echo $1 output changed:
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    67
	diff -u $H/$1.out .out && true
f060d728fe54 Delete error logs one test at a time
mpm@selenic.com
parents: 398
diff changeset
    68
	cp .out $H/$1.err
341
c0deea64ce64 run-tests: actually mark changed output as failure
mpm@selenic.com
parents: 331
diff changeset
    69
	fail=1
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    70
    fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    71
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    72
    cd $H
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    73
    rm -r $D
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    74
    return $fail
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    75
}
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    76
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    77
TESTS=$@
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 495
diff changeset
    78
if [ "$TESTS" = "" ] ; then
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    79
    TESTS=`ls test-* | grep -Ev "\.|~"`
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    80
fi
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    81
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    82
for f in $TESTS ; do
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    83
    echo -n "."
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    84
    if ! run_one $f ; then
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    85
	failed=$[$failed + 1]
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
    86
    fi
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    87
    tests=$[$tests + 1]
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    88
done
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    89
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    90
rm -rf install
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
    91
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    92
echo
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    93
echo Ran $tests tests, $failed failed
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    94
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    95
if [ $failed -gt 0 ] ; then
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    96
    exit 1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    97
fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
    98