Skip to content

Commit 6aa0a5b

Browse files
[tests] Test suite fixes for virtualenv and clang
- Typo fix - VIRTUAL_ENV in magtests.py - testenv object manipulation fix in magtests.py - Work around -fstack-clash-protection problems in clang Signed-off-by: Robbie Harwood <[email protected]>
1 parent 4f44208 commit 6aa0a5b

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

.travis.sh

+44-25
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,67 @@
11
#!/bin/bash -ex
22

3-
CFLAGS="-Werror"
4-
if [ x$COMPILER == xclang ]; then
5-
CFLAGS+=" -Wno-missing-field-initializers"
6-
CFLAGS+=" -Wno-missing-braces -Wno-cast-align"
7-
fi
8-
93
if [ -f /etc/debian_version ]; then
4+
PYTHON=python3
5+
export DEBIAN_FRONTEND=noninteractive
6+
107
apt-get update
11-
DEBIAN_FRONTEND=noninteractive apt-get -y install $COMPILER pkg-config \
12-
apache2-bin {apache2,libkrb5,libssl,gss-ntlmssp}-dev \
13-
python3-{dev,requests,gssapi} lib{socket,nss}-wrapper \
14-
flex bison krb5-{kdc,admin-server,pkinit} \
15-
flake8 virtualenv
16-
flake8
178

18-
# remove when python-requests-gssapi is packaged in Debian
19-
virtualenv -p python3 --system-site-packages .venv
20-
source .venv/bin/activate
21-
pip install requests-gssapi
9+
apt-get -y install $COMPILER pkg-config flake8 virtualenv \
10+
apache2-bin {apache2,libkrb5,libssl,gss-ntlmssp}-dev \
11+
$PYTHON{,-dev,-requests} lib{socket,nss}-wrapper \
12+
flex bison krb5-{kdc,admin-server,pkinit}
13+
14+
apt-get -y install $PYTHON-requests-gssapi || true
15+
16+
flake8
2217
elif [ -f /etc/redhat-release ]; then
2318
DY=yum
2419
PYTHON=python2
2520
if [ -f /etc/fedora-release ]; then
2621
DY=dnf
2722
PYTHON=python3
2823
fi
29-
$DY -y install $COMPILER python-gssapi krb5-{server,workstation,pkinit} \
24+
25+
$DY -y install $COMPILER $PYTHON-{gssapi,requests} \
26+
krb5-{server,workstation,pkinit} \
3027
{httpd,krb5,openssl,gssntlmssp}-devel {socket,nss}_wrapper \
3128
autoconf automake libtool which bison make $PYTHON \
3229
flex mod_session redhat-rpm-config /usr/bin/virtualenv
3330

34-
# remove when we're using f28+
35-
virtualenv -p $PYTHON .venv
36-
source .venv/bin/activate
37-
pip install requests{,-gssapi}
38-
if [ x$COMPILER == xclang ]; then
39-
CFLAGS+=" -Wno-unused-command-line-argument"
40-
fi
31+
$DY -y install python-requests-gssapi || true
4132
else
4233
echo "Distro not found!"
4334
false
4435
fi
4536

37+
CFLAGS="-Werror"
38+
if [ x$COMPILER == xclang ]; then
39+
CFLAGS+=" -Wno-missing-field-initializers"
40+
CFLAGS+=" -Wno-missing-braces -Wno-cast-align"
41+
42+
# So this is just a sad hack to get around:
43+
# clang-7: error: unknown argument: '-fstack-clash-protection'
44+
# which doesn't seem to have a solution right now.
45+
cp=$(which clang)
46+
mv $cp $cp.real
47+
cat > $cp <<EOF
48+
#!/usr/bin/env python
49+
import os
50+
import sys
51+
argv = [a for a in sys.argv if a != "-fstack-clash-protection" \
52+
and not a.startswith("-specs")]
53+
argv[0] = "${cp}.real"
54+
os.execve(argv[0], argv, {})
55+
EOF
56+
chmod +x $cp
57+
fi
58+
59+
virtualenv --system-site-packages -p $(which $PYTHON) .venv
60+
source .venv/bin/activate
61+
pip install requests{,-gssapi}
62+
63+
scratch=/tmp/build/mod_auth_gssapi-*/_build/sub/testsdir
64+
4665
autoreconf -fiv
4766
./configure # overridden by below, but needs to generate Makefile
48-
make distcheck DISTCHECK_CONFIGURE_FLAGS="CFLAGS=\"$CFLAGS\" CC=$(which $COMPILER)"
67+
make distcheck DISTCHECK_CONFIGURE_FLAGS="CFLAGS=\"$CFLAGS\" CC=$(which $COMPILER)" || (cat $scratch/tests.log $scratch/httpd/logs/error_log; exit -1)

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
sudo: required
2+
dist: xenial
23

34
# not required, but less confusing if defined
45
language: C

tests/magtests.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ def test_hostname_acceptor(testdir, testenv, logfile):
686686

687687
# support virtualenv
688688
testenv['PATH'] = os.environ.get('PATH', '')
689-
testenv['ViRTUAL_ENV'] = os.environ.get('VIRTUAL_ENV', '')
689+
testenv['VIRTUAL_ENV'] = os.environ.get('VIRTUAL_ENV', '')
690690

691691
testenv['DELEGCCACHE'] = os.path.join(testdir, 'httpd',
692692
USR_NAME + '@' + TESTREALM)
@@ -715,6 +715,9 @@ def test_hostname_acceptor(testdir, testenv, logfile):
715715
'MAG_USER_NAME_2': USR_NAME_2,
716716
'MAG_USER_PASSWORD_2': USR_PWD_2}
717717
testenv.update(kdcenv)
718+
testenv['PATH'] = os.environ.get('PATH', '')
719+
testenv['VIRTUAL_ENV'] = os.environ.get('VIRTUAL_ENV', '')
720+
718721
errs += test_basic_auth_krb5(testdir, testenv, logfile)
719722

720723
errs += test_no_negotiate(testdir, testenv, logfile)

0 commit comments

Comments
 (0)