sapling/tests/run-tests
mpm@selenic.com 8c48a798fe [PATCH] Set locale before run-tests does anything
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[PATCH] Set locale before run-tests does anything

From: Bryan O'Sullivan <bos@serpentine.com>

On Mon, 2005-06-27 at 11:58 -0700, Bryan O'Sullivan wrote:

> I'm in en_us.UTF-8.

This discrepancy between my locale and Matt's broke several tests for
me, by the way.  I think that the run-tests script should forcibly set
the locale to either "C" or "en_us.UTF-8" before it runs anything.

Since "C" is likely to be more portable, it's probably the right choice.
Here's the patch.

manifest hash: 1bf3291eafbde0cdeb1222bb72295c0e2974f236
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwOyVywK+sNU5EO8RAk18AJ4pYmvvJMZfFIR39NqvquXhhWPUTQCcDhhg
Ce12AHU8o+m/aFToyRaaQL8=
=5nRs
-----END PGP SIGNATURE-----
2005-06-27 22:22:13 -08:00

99 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
export LANG=C
export LC_CTYPE="C"
export LC_NUMERIC="C"
export LC_TIME="C"
export LC_COLLATE="C"
export LC_MONETARY="C"
export LC_MESSAGES="C"
export LC_PAPER="C"
export LC_NAME="C"
export LC_ADDRESS="C"
export LC_TELEPHONE="C"
export LC_MEASUREMENT="C"
export LC_IDENTIFICATION="C"
export LC_ALL=""
tests=0
failed=0
H=$PWD
if [ -d /usr/lib64 ]; then
lib=lib64
else
lib=lib
fi
TESTPATH=$PWD/install/bin
export PATH=$TESTPATH:$PATH
export PYTHONPATH=$PWD/install/$lib/python
rm -rf install
cd ..
${PYTHON:-python} setup.py install --home=tests/install > tests/install.err
if [ $? != 0 ] ; then
cat tests/install.err
fi
cd $H
rm install.err
function run_one
{
rm -f $1.err
export TZ=GMT
D=`mktemp -d`
if [ "$D" == "" ] ; then
echo mktemp failed!
fi
cd $D
fail=0
if ! $H/$1 > .out 2>&1 ; then
echo $1 failed with error code $?
fail=1
fi
if [ -s .out -a ! -r $H/$1.out ] ; then
echo $1 generated unexpected output:
cat .out
cp .out $H/$1.err
fail=1
elif [ -r $H/$1.out ] && ! diff -u $H/$1.out .out > /dev/null ; then
echo $1 output changed:
diff -u $H/$1.out .out && true
cp .out $H/$1.err
fail=1
fi
cd $H
rm -r $D
return $fail
}
TESTS=$@
if [ "$TESTS" == "" ] ; then
TESTS=`ls test-* | grep -Ev "\.|~"`
fi
for f in $TESTS ; do
echo -n "."
if ! run_one $f ; then
failed=$[$failed + 1]
fi
tests=$[$tests + 1]
done
rm -rf install
echo
echo Ran $tests tests, $failed failed
if [ $failed -gt 0 ] ; then
exit 1
fi