Skip to content

Commit

Permalink
Allow make distcheck to complete successfully
Browse files Browse the repository at this point in the history
Add an override path option for distcheck so that the shared object can
be installed in a user controlled directory instead of the system
defined apxs one.

make distcheck marks the source directory as read only, this requires
passing some parameters to the tests so that they create the tests
directory in a writable path.
Also add rule to remove these files once done.

Signed-off-by: Simo Sorce <simo@redhat.com>
  • Loading branch information
simo5 committed Mar 9, 2017
1 parent d61862b commit 53006c9
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
10 changes: 8 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS=--with-installpath=`pwd`/apxs_modules

SUBDIRS = src/asn1c src
SUBDIRS = src/asn1c src tests

TESTSDIR=$(abs_builddir)/testsdir

distclean-local:
rm -fr $(TESTSDIR)

check: all
$(srcdir)/tests/magtests.py
cd $(srcdir) && ./tests/magtests.py --path $(TESTSDIR) --so-dir=$(abs_builddir)/src/.libs

test: check
15 changes: 11 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,22 @@ AC_TYPE_UINT32_T
# Checks for library functions.
AC_CHECK_FUNCS([strcasecmp])

AC_ARG_WITH([installpath],
[AS_HELP_STRING([--with-installpath=PATH],
[alternative install path])],
[AC_SUBST(INSTALLPATH, $with_installpath)])

AC_ARG_WITH([apxs],
[AS_HELP_STRING([--with-apxs=PATH/NAME],[path to the apxs binary [[apxs]]])],
[AC_SUBST(APXS, $with_apxs)],
[AC_PATH_PROGS(APXS, [apxs2 apxs])])

AS_IF([test "x${APXS}" != "x" -a -x "${APXS}"],
[AC_MSG_NOTICE([apxs found at $APXS])
APXS_LIBEXECDIR=`${APXS} -q LIBEXECDIR`
AS_IF([test "x${INSTALLPATH}" != "x"],
[AC_MSG_NOTICE([installpath set at $INSTALLPATH])
APXS_LIBEXECDIR=`echo ${INSTALLPATH}`],
[APXS_LIBEXECDIR=`${APXS} -q LIBEXECDIR`])
AC_SUBST(APXS_LIBEXECDIR)],
[AC_MSG_FAILURE(["apxs not found. Use --with-apxs"])])

Expand Down Expand Up @@ -77,13 +86,11 @@ AC_SUBST([GSSAPI_LIBS])
MAG_CFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CPPFLAGS` `${APR} --cflags` ${GSSAPI_CFLAGS} ${OPENSSL_CFLAGS} -I`${APXS} -q INCLUDEDIR` `${APR} --includes`"
MAG_LIBS="`${APR} --libs` ${GSSAPI_LIBS} ${OPENSSL_LIBS}"
LIBTOOL="`${APXS} -q LIBTOOL`"
MAG_LIBDIR="`${APXS} -q libexecdir`"

AC_SUBST([MAG_CFLAGS])
AC_SUBST([MAG_LIBS])
AC_SUBST([LIBTOOL])
AC_SUBST([MAG_LIBDIR])

AC_CONFIG_FILES([Makefile src/Makefile src/asn1c/Makefile])
AC_CONFIG_FILES([Makefile src/Makefile src/asn1c/Makefile tests/Makefile])

AC_OUTPUT
2 changes: 1 addition & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AM_CPPFLAGS = -I $(srcdir)/asn1c

magdir = $(MAG_LIBDIR)
magdir = $(APXS_LIBEXECDIR)
mag_LTLIBRARIES = \
mod_auth_gssapi.la

Expand Down
16 changes: 16 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
EXTRA_DIST = \
401.html \
httpd.conf \
index.html \
magtests.py \
t_bad_acceptor_name.py \
t_basic_k5_fail_second.py \
t_basic_k5.py \
t_basic_k5_two_users.py \
t_basic_proxy.py \
t_spnego_negotiate_once.py \
t_spnego_no_auth.py \
t_spnego_proxy.py \
t_spnego.py \
t_spnego_rewrite.py \
$(NULL)
9 changes: 6 additions & 3 deletions tests/magtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Mod Auth GSSAPI Tests Environment')
parser.add_argument('--path', default='%s/scratchdir' % os.getcwd(),
help="Directory in which tests are run")
parser.add_argument('--so-dir', default='%s/src/.libs' % os.getcwd(),
help="mod_auth_gssapi shared object dirpath")

return vars(parser.parse_args())

Expand Down Expand Up @@ -207,7 +209,7 @@ def setup_keys(tesdir, env):
return keys_env


def setup_http(testdir, wrapenv):
def setup_http(testdir, so_dir, wrapenv):

httpdir = os.path.join(testdir, 'httpd')
if os.path.exists(httpdir):
Expand All @@ -226,7 +228,7 @@ def setup_http(testdir, wrapenv):
raise ValueError("Could not find Apache module directory!")
os.symlink(moddir, os.path.join(httpdir, 'modules'))

shutil.copy('src/.libs/mod_auth_gssapi.so', httpdir)
shutil.copy('%s/mod_auth_gssapi.so' % so_dir, httpdir)

with open('tests/httpd.conf') as f:
t = Template(f.read())
Expand Down Expand Up @@ -413,6 +415,7 @@ def test_bad_acceptor_name(testdir, testenv, testlog):
args = parse_args()

testdir = args['path']
so_dir = args['so_dir']
if os.path.exists(testdir):
shutil.rmtree(testdir)
os.makedirs(testdir)
Expand All @@ -427,7 +430,7 @@ def test_bad_acceptor_name(testdir, testenv, testlog):
kdcproc, kdcenv = setup_kdc(testdir, wrapenv)
processes['KDC(%d)' % kdcproc.pid] = kdcproc

httpproc = setup_http(testdir, kdcenv)
httpproc = setup_http(testdir, so_dir, kdcenv)
processes['HTTPD(%d)' % httpproc.pid] = httpproc

keysenv = setup_keys(testdir, kdcenv)
Expand Down

0 comments on commit 53006c9

Please sign in to comment.