# install::
# $(MAKE) $(MFLAGS) install.man
-fake-install:
+fake-install: runenv.py
$(RM) -r $(FAKEPREFIX)
@for i in $(INSTALLMKDIRS); do \
$(srcdir)/config/mkinstalldirs util/fakedest$$i; \
check-prerecurse: fake-install
# Create a test realm and spawn a shell in an environment pointing to it.
-testrealm: fake-install runenv.py
+testrealm: fake-install
PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util $(PYTHON) $(srcdir)/util/testrealm.py
# environment variable settings to propagate to Python-based tests
-check-pytests-yes: runenv.py
-
pyrunenv.vals: Makefile
$(KRB5_RUN_ENV) \
for i in $(KRB5_RUN_VARS); do \
##############################
# Python tests
-check-unix:: check-pytests
-
-# Makefile.in should add dependencies to check-pytests for test
-# programs that need to be built before scripts are run.
-
-check-pytests:: check-pytests-@HAVE_PYTHON@
-
-check-pytests-yes:
- @pytests="$(PYTESTS)"; \
- for t in $$pytests; do \
- echo PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
- VALGRIND="$(VALGRIND)" \
- $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS); \
- PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
- VALGRIND="$(VALGRIND)" \
- $(PYTHON) $(srcdir)/$$t $(PYTESTFLAGS) || exit 1; \
- done
-
-check-pytests-no:
- @if test -n "$(PYTESTS)"; then \
- echo "+++ Skipping because Python not available: $(PYTESTS)"; \
- fi
+check-unix:: check-pytests-@HAVE_PYTHON@
+
+# Makefile.in should add rules to check-pytests to execute Python tests.
+check-pytests-yes:: check-pytests
+check-pytests-no::
+check-pytests::
clean:: clean-$(WHAT)
DEJAFLAGS = --debug --srcdir $(srcdir) --host $(host)
RUNTEST = runtest $(DEJAFLAGS)
+RUNPYTEST = PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
+ VALGRIND="$(VALGRIND)" $(PYTHON)
+
START_SERVERS = $(STESTDIR)/scripts/start_servers $(TEST_SERVER) $(TEST_PATH)
START_SERVERS_LOCAL = $(STESTDIR)/scripts/start_servers_local
# something that looks like an FQDN, with an IPv4 address.
OFFLINE=no
-# Makefile.in should set PYTESTS to a list of Python test scripts to run.
-PYTESTS=
+# Used when running Python tests.
PYTESTFLAGS=
##
BUILDTOP=$(REL)..
SUBDIRS = resolve asn.1 create hammer verify gssapi dejagnu shlib \
gss-threads misc mkeystash_compat
-PYTESTS = t_general.py t_anonpkinit.py
RUN_SETUP = @KRB5_RUN_ENV@ KRB5_KDC_PROFILE=kdc.conf KRB5_CONFIG=krb5.conf
KRB5_RUN_ENV= @KRB5_RUN_ENV@
$(RUN_SETUP) $(VALGRIND) ../kadmin/dbutil/kdb5_util $(KADMIN_OPTS) destroy -f
$(RM) $(TEST_DB)* stash_file
+check-pytests::
+ $(RUNPYTEST) $(srcdir)/t_general.py $(PYTESTFLAGS)
+ $(RUNPYTEST) $(srcdir)/t_anonpkinit.py $(PYTESTFLAGS)
+
clean::
$(RM) kdc.conf
OBJS= t_imp_name.o t_s4u.o t_namingexts.o t_gssexts.o t_spnego.o
-PYTESTS= t_gssapi.py
-
all:: t_imp_name t_s4u t_namingexts t_gssexts t_spnego
check-pytests:: t_spnego
+ $(RUNPYTEST) $(srcdir)/t_gssapi.py $(PYTESTFLAGS)
t_imp_name: t_imp_name.o $(GSS_DEPLIBS) $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o t_imp_name t_imp_name.o $(GSS_LIBS) $(KRB5_BASE_LIBS)
"""A module for krb5 test scripts
-Put test script names in the PYTESTS make variable to get them run
-with the appropriate PYTHONPATH during "make check". Sample test
-script usage:
+To run test scripts during "make check" (if Python 2.4 or later is
+available), add rules like the following to Makeflie.in:
+
+ check-pytests::
+ $(RUNPYTEST) $(srcdir)/t_testname.py $(PYTESTFLAGS)
+
+A sample test script:
from k5test import *
import subprocess
import sys
-# runenv.py is built in each directory where tests are run, providing
-# the environment variable settings needed for running programs in the
-# build tree. These can vary by platform.
-import runenv
-
# Used when most things go wrong (other than programming errors) so
# that the user sees an error message rather than a Python traceback,
# without help from the test script. The on-exit handler will display
hostname = socket.getfqdn()
null_input = open(os.devnull, 'r')
+# runenv.py is built in the top level by "make fake-install". Import
+# it now (rather than at the beginning of the file) so that we get a
+# friendly error message from _find_plugins() if "make fake-install"
+# has not been run.
+import runenv
+
krb5kdc = os.path.join(buildtop, 'kdc', 'krb5kdc')
kadmind = os.path.join(buildtop, 'kadmin', 'server', 'kadmind')
kadmin = os.path.join(buildtop, 'kadmin', 'cli', 'kadmin')