diff options
author | Enrico Zini <enrico@enricozini.org> | 2015-09-10 11:23:57 +0200 |
---|---|---|
committer | Enrico Zini <enrico@enricozini.org> | 2015-09-10 11:23:57 +0200 |
commit | c4dce3d9e4331b9f2fdbef5517a054ebf20c7d3d (patch) | |
tree | 5521e7e7aa8c10baf406520ca4953019fa57aa80 /run-check | |
parent | fb21a4dfe2c81640379f64855509fb7613530887 (diff) | |
download | libept-c4dce3d9e4331b9f2fdbef5517a054ebf20c7d3d.tar.gz |
Use build-in test framework instead of wibble
Diffstat (limited to 'run-check')
-rwxr-xr-x | run-check | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/run-check b/run-check new file mode 100755 index 0000000..ea05d69 --- /dev/null +++ b/run-check @@ -0,0 +1,59 @@ +#!/bin/sh -e + +TOP_SRCDIR=$(readlink -f $(dirname "$0")) +CMD=$(readlink -f "$1") + +## Set up the test environment +datadir="${TOP_SRCDIR}/ept/test-data" +TESTDIR="`mktemp -d`" +cd "$TESTDIR" + +## Clean up the test environment at exit unless asked otherwise +cleanup() { + test -z "$PRESERVE" && rm -rf "$TESTDIR" +} +trap cleanup EXIT + +ARCH=$(dpkg --print-architecture) +listfile=wherever_debian_._Packages +mkdir -p etc state/lists/partial cache debtags cache/archives/partial desktop +sed -e s,i386,${ARCH}, < ${datadir}/packagelist > state/lists/${listfile} +cp -a ${datadir}/etc/sources.list etc/ +sed -e s,i386,${ARCH}, < ${datadir}/dpkg-status > dpkg-status +cp -a ${datadir}/desktop/*.desktop desktop/ +cp ${datadir}/debtags/package-tags debtags/package-tags +cp ${datadir}/debtags/vocabulary debtags/vocabulary +mkdir -p debtags/empty +mkdir -p debtags/user +mkdir -p xapian/ + +# Try to debug the libtool executable, if present +DIR=`dirname $CMD` +BASE=`basename $CMD` +if [ ! -z "$DEBUGGER" ] +then + echo "Running $DEBUGGER $CMD $ARGS" + RES=0 + if ! $DEBUGGER $CMD $ARGS + then + RES=$? + echo "Failed with result $RES" + fi +else + echo "Running $CMD $ARGS" + RES=0 + if ! $CMD $ARGS + then + RES=$? + echo "Failed with result $RES" + fi +fi + +if [ ! -z "$PAUSE" ] +then + echo "Post-test inspection requested." + echo "Exit this shell to cleanup the test environment." + bash +fi + +exit $RES |