Debian Codegraph @

debian/tests/testsuite

raw
1 #!/bin/sh
2
3 env
4
5 set -e
6
7 if [ "$(whoami)" = root ]; then
8 if [ -n "$SUDO_USER" ] && getent passwd "$SUDO_USER" > /dev/null; then
9 su_user="$SUDO_USER"
10 else
11 su_user=nobody
12 fi
13
14 if [ -e /etc/default/apport ]; then
15 # stop apport
16 service apport stop 2>/dev/null || true
17 sed -i '/^enabled=/s/=.*/=0/' /etc/default/apport 2>/dev/null
18 fi
19 fi
20 tmphome=$AUTOPKGTEST_TMP/home
21 mkdir -p $tmphome
22 if [ -n "$su_user" ]; then
23 chmod go+rx $AUTOPKGTEST_TMP
24 chown $su_user:nogroup $tmphome
25 fi
26 ls -la $AUTOPKGTEST_TMP
27
28 debian_dir=$(dirname $(dirname $0))
29
30 # no root access needed after this point
31
32 TESTPYTHON="python3.14 -W default -bb -E -R -m test"
33 TESTEXCLUSIONS="-x"
34 TESTNEVERCOMPLETE=""
35
36 . $debian_dir/tests/test-common.sh
37 TESTEXCLUSIONS="$TESTEXCLUSIONS $TESTNEVERCOMPLETE"
38
39 if [ "$su_user" = nobody ]; then
40 log=/dev/null
41 else
42 log=testsuite.log
43 fi
44
45 # several tests fail with configured proxy; we don't need internet access, so
46 # unset proxy variables
47 EXTRAENV="env -u https_proxy -u http_proxy -u no_proxy HOME=$tmphome"
48
49 script=$debian_dir/script.py
50 if [ -f "$script" ]; then
51 cmd="$EXTRAENV python3.14 $script \"$log\" \"$TESTPYTHON $TESTOPTS $TESTEXCLUSIONS\""
52 else
53 cmd="$EXTRAENV $TESTPYTHON $TESTOPTS $TESTEXCLUSIONS"
54 fi
55
56 echo "Running the python testsuite with the standard interpreter:"
57 if [ "$(whoami)" = root ]; then
58 echo "su -s /bin/sh -c $cmd $su_user"
59 su -s /bin/sh -c "$cmd" $su_user
60 else
61 echo "$cmd"
62 eval $cmd
63 fi