view tests/run-tests @ 1187:120aa5fc7ced

From mercurial-bounces@selenic.com Thu Sep 1 07:01:32 2005 Return-Path: <mercurial-bounces@selenic.com> X-Original-To: bos@serpentine.com Delivered-To: bos@serpentine.com Received: from waste.org (waste.org [216.27.176.166]) by demesne.serpentine.com (Postfix) with ESMTP id 3616A20B571 for <bos@serpentine.com>; Thu, 1 Sep 2005 07:01:32 -0700 (PDT) Received: from waste.org (localhost [127.0.0.1]) by waste.org (8.13.4/8.13.4/Debian-3) with ESMTP id j81DxodQ028829; Thu, 1 Sep 2005 08:59:51 -0500 Received: from web32904.mail.mud.yahoo.com (web32904.mail.mud.yahoo.com [68.142.206.51]) by waste.org (8.13.4/8.13.4/Debian-3) with SMTP id j81DxnNA028824 for <mercurial@selenic.com>; Thu, 1 Sep 2005 08:59:49 -0500 Received: (qmail 25859 invoked by uid 60001); 1 Sep 2005 13:59:17 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=O6sELrlCknW3M/gKVqijWs82e/CbDEum1sEitcuLKXaP9dHU175PszOqMgcSKykMY+BVXtcH3NeaXLM3FyBmqNkoPAvesezyFbgQsHSM1S028oOexybCKMvtGQJmz66hzd1fDb0QoPj1gCcGU2VDevQaOesSmo1xF9jJwy2LlLE= ; Message-ID: <20050901135917.25856.qmail@web32904.mail.mud.yahoo.com> Received: from [60.48.222.94] by web32904.mail.mud.yahoo.com via HTTP; Thu, 01 Sep 2005 06:59:17 PDT Date: Thu, 1 Sep 2005 06:59:17 -0700 (PDT) From: TK Soh <teekaysoh@yahoo.com> To: mercurial@selenic.com In-Reply-To: <20050828075808.GO27787@waste.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: by amavisd-new Subject: Re: add -p to hg tip X-BeenThere: mercurial@selenic.com X-Mailman-Version: 2.1.5 Precedence: list List-Id: mercurial.selenic.com List-Unsubscribe: <http://selenic.com/mailman/listinfo/mercurial>, <mailto:mercurial-request@selenic.com?subject=unsubscribe> List-Archive: <http://www.selenic.com/pipermail/mercurial> List-Post: <mailto:mercurial@selenic.com> List-Help: <mailto:mercurial-request@selenic.com?subject=help> List-Subscribe: <http://selenic.com/mailman/listinfo/mercurial>, <mailto:mercurial-request@selenic.com?subject=subscribe> Sender: mercurial-bounces@selenic.com Errors-To: mercurial-bounces@selenic.com X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on demesne.serpentine.com X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 X-Evolution-Source: imap://bos@www.serpentine.com/ Content-Transfer-Encoding: 8bit
author bos@serpentine.internal.keyresearch.com
date Thu, 01 Sep 2005 07:47:26 -0700
parents 5a034646e472
children 8ab1c07d4e0b
line wrap: on
line source

#!/bin/sh -e

LANG="C"; export LANG
LC_CTYPE="C"; export LC_CTYPE
LC_NUMERIC="C"; export LC_NUMERIC
LC_TIME="C"; export LC_TIME
LC_COLLATE="C"; export LC_COLLATE
LC_MONETARY="C"; export LC_MONETARY
LC_MESSAGES="C"; export LC_MESSAGES
LC_PAPER="C"; export LC_PAPER
LC_NAME="C"; export LC_NAME
LC_ADDRESS="C"; export LC_ADDRESS
LC_TELEPHONE="C"; export LC_TELEPHONE
LC_MEASUREMENT="C"; export LC_MEASUREMENT
LC_IDENTIFICATION="C"; export LC_IDENTIFICATION
LC_ALL=""; export LC_ALL
TZ=GMT; export TZ
HGEDITOR=true; export HGEDITOR
HGMERGE=true; export HGMERGE
HGUSER="test"; export HGUSER

umask 022

tests=0
failed=0

HGTMP=""
cleanup_exit() {
    rm -rf "$HGTMP"
}

# Remove temporary files even if we get interrupted
trap "cleanup_exit" 0 # normal exit
trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM

HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$"
(umask 077 && mkdir "$HGTMP") || {
    echo "Could not create temporary directory! Exiting." 1>&2
    exit 1
}

TESTDIR="$PWD"

if [ -d /usr/lib64 ]; then
    lib=lib64
else
    lib=lib
fi

INST="$HGTMP/install"
cd ..
if ${PYTHON-python} setup.py install --home="$INST" > tests/install.err 2>&1
then
    rm tests/install.err
else
    cat tests/install.err
    exit 1
fi
cd "$TESTDIR"

PATH="$INST/bin:$PATH"; export PATH
PYTHONPATH="$INST/$lib/python"; export PYTHONPATH


run_one() {
    rm -f "$1.err"

    mkdir "$HGTMP/$1"
    cd "$HGTMP/$1"
    fail=0
    HOME="$HGTMP/$1"; export HOME
    OUT="$HGTMP/$1.out"
    OUTOK="$TESTDIR/$1.out"
    ERR="$TESTDIR/$1.err"

    if "$TESTDIR/$1" > "$OUT" 2>&1; then
	: no error
    else
	echo "$1 failed with error code $?"
	fail=1
    fi

    if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then
	cp "$OUT" "$ERR"
	echo
	echo "$1 generated unexpected output:"
	cat "$ERR"
	fail=1
    elif [ -r "$OUTOK" ]; then
	if diff -u "$OUTOK" "$OUT" > /dev/null; then
	    : no differences
	else
	    cp "$OUT" "$ERR"
	    echo
	    echo "$1 output changed:"
	    diff -u "$OUTOK" "$ERR" || true
	    fail=1
	fi
    fi

    cd "$TESTDIR"
    rm -f "$HGTMP/$1.out"
    rm -rf "$HGTMP/$1"
    return $fail
}

TESTS="$*"
if [ -z "$TESTS" ] ; then
    TESTS=`ls test-* | grep -v "[.~]"`
fi

for f in $TESTS ; do
    echo -n "."
    run_one $f || failed=`expr $failed + 1`
    tests=`expr $tests + 1`
done

echo
echo "Ran $tests tests, $failed failed."

if [ $failed -gt 0 ] ; then
    exit 1
fi
exit 0