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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
#!/bin/sh
set -e
env
if [ "$(whoami)" = root ]; then
if [ -n "$SUDO_USER" ] && getent passwd "$SUDO_USER" > /dev/null; then
su_user="$SUDO_USER"
else
su_user=nobody
fi
if [ -e /etc/default/apport ]; then
# stop apport
service apport stop 2>/dev/null || true
sed -i '/^enabled=/s/=.*/=0/' /etc/default/apport 2>/dev/null
fi
fi
tmphome=$ADTTMP/home
mkdir -p $tmphome
if [ -n "$su_user" ]; then
chmod go+rx $ADTTMP
chown $su_user:nogroup $tmphome
fi
ls -la $ADTTMP
# no root access needed after this point
debian_dir=$(dirname $(dirname $0))
export OPENSSL_CONF=$debian_dir/openssl.cnf
export LOCPATH=$(pwd)/locales
sh $debian_dir/locale-gen
export LANG=C
arch=$(dpkg --print-architecture)
vendor=$(dpkg-vendor --query Vendor)
TESTPYTHON="python2.7 -E -Wd -3 -tt /usr/lib/python2.7/test/regrtest.py"
TESTOPTS="-w -uall,-network,-urlfetch,-gui,-xpickle"
TESTEXCLUSIONS="-x"
# test_cpickle: starts to fail with 2.7.11, see http://bugs.python.org/issue25698
TESTEXCLUSIONS="$TESTEXCLUSIONS test_cpickle"
# test_curses: error: copywin() returned ERR
TESTEXCLUSIONS="$TESTEXCLUSIONS test_curses"
# test_distutils: failing tests test_parse_makefile_base, test_parse_makefile_literal_dollar
TESTEXCLUSIONS="$TESTEXCLUSIONS test_distutils"
# test_ensurepip: module disabled in Debian
TESTEXCLUSIONS="$TESTEXCLUSIONS test_ensurepip"
# test_gdb: not run for the optimized build
TESTEXCLUSIONS="$TESTEXCLUSIONS test_gdb"
# test_threading_local: fails in the Debian CI environment, but even
# succeeds there when re-run. See
# http://ci.debian.net/data/packages/unstable/amd64/p/python2.7/20141121_061940.autopkgtest.log.gz
case "$vendor" in Debian)
TESTEXCLUSIONS="$TESTEXCLUSIONS test_threading_local"
esac
# test_zipfile: Issue 17753, requires write access to test and email.test
TESTEXCLUSIONS="$TESTEXCLUSIONS test_zipfile"
# for some reason, this fails on s390x only, starting in 2.7.14rc1 ...
case "$(uname -m)" in s390*)
TESTEXCLUSIONS="$TESTEXCLUSIONS test_regrtest"
esac
# test_site: site-/dist-packages mismatches
TESTEXCLUSIONS="$TESTEXCLUSIONS test_site"
# FIXME: Fails with Ubuntu's autopkg test infrastructure
if [ "$vendor" = Ubuntu ]; then
if [ "$(dpkg --print-architecture)" = arm64 ]; then
TESTEXCLUSIONS="$TESTEXCLUSIONS test_io"
fi
fi
if [ "$su_user" = nobody ]; then
log=/dev/null
else
log=testsuite.log
fi
# run some tests separately in it's own run. These succeed locally,
# but fail on the test setup.
SEPARATE_TESTS=
case "$arch" in
amd64)
;;
i386)
SEPARATE_TESTS="$SEPARATE_TESTS test_io"
;;
esac
# several tests fail with configured proxy; we don't need internet access, so
# unset proxy variables
EXTRAENV="env -u https_proxy -u http_proxy -u no_proxy HOME=$tmphome"
script=$debian_dir/script.py
if [ -f "$script" ]; then
cmd1="$EXTRAENV python2.7 $script \"$log\" \"$TESTPYTHON $TESTOPTS $TESTEXCLUSIONS $SEPARATE_TESTS\""
cmd2="$EXTRAENV python2.7 $script \"$log\" \"$TESTPYTHON $TESTOPTS $SEPARATE_TESTS\""
else
cmd1="$EXTRAENV $TESTPYTHON $TESTOPTS $TESTEXCLUSIONS $SEPARATE_TESTS"
cmd2="$EXTRAENV $TESTPYTHON $TESTOPTS $SEPARATE_TESTS"
fi
echo "Running the python testsuite with the standard interpreter:"
if [ "$(whoami)" = root ]; then
echo "su -s /bin/sh -c $cmd1 $su_user"
su -s /bin/sh -c "$cmd1" $su_user
if [ -n "$SEPARATE_TESTS" ]; then
echo "su -s /bin/sh -c $cmd2 $su_user"
su -s /bin/sh -c "$cmd2" $su_user
fi
else
echo "$cmd1"
eval $cmd1
if [ -n "$SEPARATE_TESTS" ]; then
echo "$cmd2"
eval $cmd2
fi
fi
|