svn rev #23938: branches/iakerb/src/ appl/gss-sample/ appl/simple/server/ config/ ...
ghudson@MIT.EDU
ghudson at MIT.EDU
Sat Apr 24 18:20:58 EDT 2010
http://src.mit.edu/fisheye/changelog/krb5/?cs=23938
Commit By: ghudson
Log Message:
Merge trunk changes from r23929 to r23937 to iakerb branch.
Changed Files:
U branches/iakerb/src/Makefile.in
U branches/iakerb/src/appl/gss-sample/Makefile.in
U branches/iakerb/src/appl/gss-sample/gss-server.c
A branches/iakerb/src/appl/gss-sample/t_gss_sample.py
U branches/iakerb/src/appl/simple/server/sim_server.c
U branches/iakerb/src/config/post.in
U branches/iakerb/src/config/pre.in
U branches/iakerb/src/tests/Makefile.in
U branches/iakerb/src/tests/dejagnu/config/default.exp
U branches/iakerb/src/tests/dejagnu/krb-standalone/gssapi.exp
U branches/iakerb/src/tests/dejagnu/krb-standalone/simple.exp
U branches/iakerb/src/tests/gssapi/Makefile.in
U branches/iakerb/src/util/k5test.py
Modified: branches/iakerb/src/Makefile.in
===================================================================
--- branches/iakerb/src/Makefile.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/Makefile.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -106,7 +106,7 @@
# 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; \
@@ -627,13 +627,11 @@
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 \
Modified: branches/iakerb/src/appl/gss-sample/Makefile.in
===================================================================
--- branches/iakerb/src/appl/gss-sample/Makefile.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/appl/gss-sample/Makefile.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -44,6 +44,9 @@
clean-unix::
$(RM) gss-server gss-client
+check-pytests::
+ $(RUNPYTEST) $(srcdir)/t_gss_sample.py $(PYTESTFLAGS)
+
install-unix::
$(INSTALL_PROGRAM) gss-client $(DESTDIR)$(CLIENT_BINDIR)/gss-client
$(INSTALL_PROGRAM) gss-server $(DESTDIR)$(SERVER_BINDIR)/gss-server
Modified: branches/iakerb/src/appl/gss-sample/gss-server.c
===================================================================
--- branches/iakerb/src/appl/gss-sample/gss-server.c 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/appl/gss-sample/gss-server.c 2010-04-24 22:20:58 UTC (rev 23938)
@@ -742,6 +742,7 @@
if ((stmp = create_socket(port)) >= 0) {
if (listen(stmp, max_threads == 1 ? 0 : max_threads) < 0)
perror("listening on socket");
+ fprintf(stderr, "starting...\n");
do {
struct _work_plan *work = malloc(sizeof(struct _work_plan));
Copied: branches/iakerb/src/appl/gss-sample/t_gss_sample.py (from rev 23937, trunk/src/appl/gss-sample/t_gss_sample.py)
===================================================================
--- branches/iakerb/src/appl/gss-sample/t_gss_sample.py (rev 0)
+++ branches/iakerb/src/appl/gss-sample/t_gss_sample.py 2010-04-24 22:20:58 UTC (rev 23938)
@@ -0,0 +1,40 @@
+# Copyright (C) 2010 by the Massachusetts Institute of Technology.
+# All rights reserved.
+#
+# Export of this software from the United States of America may
+# require a specific license from the United States Government.
+# It is the responsibility of any person or organization contemplating
+# export to obtain such a license before exporting.
+#
+# WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+# distribute this software and its documentation for any purpose and
+# without fee is hereby granted, provided that the above copyright
+# notice appear in all copies and that both that copyright notice and
+# this permission notice appear in supporting documentation, and that
+# the name of M.I.T. not be used in advertising or publicity pertaining
+# to distribution of the software without specific, written prior
+# permission. Furthermore if you modify this software you must label
+# your software as modified software and not distribute it in such a
+# fashion that it might be confused with the original M.I.T. software.
+# M.I.T. makes no representations about the suitability of
+# this software for any purpose. It is provided "as is" without express
+# or implied warranty.
+
+#!/usr/bin/python
+from k5test import *
+
+appdir = os.path.join(buildtop, 'appl', 'gss-sample')
+gss_client = os.path.join(appdir, 'gss-client')
+gss_server = os.path.join(appdir, 'gss-server')
+
+for realm in multipass_realms():
+ portstr = str(realm.server_port())
+ server = realm.start_server([gss_server, '-port', portstr, 'host'],
+ 'starting...')
+ output = realm.run_as_client([gss_client, '-port', portstr,
+ hostname, 'host', 'testmsg'])
+ if 'Signature verified.' not in output:
+ fail('Expected message not seen in gss-client output')
+ stop_daemon(server)
+
+success('GSS sample application')
Modified: branches/iakerb/src/appl/simple/server/sim_server.c
===================================================================
--- branches/iakerb/src/appl/simple/server/sim_server.c 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/appl/simple/server/sim_server.c 2010-04-24 22:20:58 UTC (rev 23938)
@@ -172,6 +172,8 @@
exit(1);
}
+ printf("starting...\n");
+
#ifdef DEBUG
printf("socket has port # %d\n", ntohs(s_sock.sin_port));
#endif
Modified: branches/iakerb/src/config/post.in
===================================================================
--- branches/iakerb/src/config/post.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/config/post.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -129,27 +129,13 @@
##############################
# Python tests
-check-unix:: check-pytests
+check-unix:: check-pytests- at HAVE_PYTHON@
-# Makefile.in should add dependencies to check-pytests for test
-# programs that need to be built before scripts are run.
+# Makefile.in should add rules to check-pytests to execute Python tests.
+check-pytests-yes:: check-pytests
+check-pytests-no::
+check-pytests::
-check-pytests:: check-pytests- at 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=`pwd`:$(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
-
clean:: clean-$(WHAT)
clean-unix::
Modified: branches/iakerb/src/config/pre.in
===================================================================
--- branches/iakerb/src/config/pre.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/config/pre.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -244,6 +244,9 @@
DEJAFLAGS = --debug --srcdir $(srcdir) --host $(host)
RUNTEST = runtest $(DEJAFLAGS)
+RUNPYTEST = PYTHONPATH=$(top_srcdir)/util VALGRIND="$(VALGRIND)" \
+ $(PYTHON)
+
START_SERVERS = $(STESTDIR)/scripts/start_servers $(TEST_SERVER) $(TEST_PATH)
START_SERVERS_LOCAL = $(STESTDIR)/scripts/start_servers_local
@@ -572,8 +575,7 @@
# 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=
##
Modified: branches/iakerb/src/tests/Makefile.in
===================================================================
--- branches/iakerb/src/tests/Makefile.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/tests/Makefile.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -2,7 +2,6 @@
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@
@@ -61,6 +60,10 @@
$(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
Modified: branches/iakerb/src/tests/dejagnu/config/default.exp
===================================================================
--- branches/iakerb/src/tests/dejagnu/config/default.exp 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/tests/dejagnu/config/default.exp 2010-04-24 22:20:58 UTC (rev 23938)
@@ -1489,69 +1489,6 @@
envstack_pop
}
-proc start_tail { fname spawnid_var pid_var which standalone } {
- upvar $spawnid_var spawnid
- upvar $pid_var pid
- global timeout
-
- set f [open $fname a]
-
- spawn tail -f $fname
- set spawnid $spawn_id
- set pid [exp_pid]
-
- set markstr "===MARK $pid [clock format [clock seconds]] ==="
- puts $f $markstr
- flush $f
-
- set p 0
- set otimeout $timeout
- set timeout 3
- set ok 0
- while { $ok == 0 && $p < 3 } {
- expect {
- -i $spawn_id
- -ex "$markstr" { set ok 1 }
- -re "\[^\r\n\]*\r\n" { exp_continue }
- timeout {
- # Some versions of GNU tail had a race condition where
- # the first batch of data would be read from the end
- # of the file, and then there was a brief window
- # before calling stat and recording the size of the
- # file. If the marker is written during that window,
- # then yet another file modification is needed to get
- # the first one noticed.
- if { $p < 3 } {
- verbose -log "no tail output yet, prodding with a blank line"
- incr p
- puts $f ""
- flush $f
- exp_continue
- } else {
- close $f
- verbose -log "tail $fname output:"
- verbose -log [exec tail $fname]
- if {$standalone} {
- verbose -log "tail -f timed out ($timeout sec) looking for mark in $which log"
- fail "$which"
- } else {
- perror "$which tail -f timed out ($timeout sec) looking for mark in $which log"
- }
- stop_kerberos_daemons
- exec kill $pid
- expect -i $spawn_id eof
- wait -i $spawn_id
- set timeout $otimeout
- return 0
- }
- }
- }
- }
- close $f
- set timeout $otimeout
- return 1
-}
-
# start_kerberos_daemons
# A procedure to build a Kerberos database and start up the kerberos
# and kadmind daemons. This sets the global variables kdc_pid,
@@ -1595,10 +1532,6 @@
set kdc_pidfile $tmppwd/kdc.pid
set kadmind_pidfile $tmppwd/kadmind.pid
- if ![start_tail $kdc_lfile tailf_spawn_id tailf_pid krb5kdc $standalone] {
- return 0
- }
-
envstack_push
setup_kerberos_env kdc
# Nuke pid file - to test if setup
@@ -1609,42 +1542,18 @@
set kdc_spawn_id $spawn_id
expect {
- -i $tailf_spawn_id
- -re "commencing operation\r\n" { }
- -re "krb5kdc: \[a-zA-Z\]* - Cannot bind server socket to \[ 0-9a-fA-F:.\]*\r\n" {
- verbose -log "warning: $expect_out(0,string)"
- exp_continue
- }
- "no sockets set up?" {
+ "starting" { }
+ eof {
if {$standalone} {
- verbose -log "krb5kdc startup failed to bind listening sockets"
+ verbose -log "krb5kdc failed to start"
fail "krb5kdc"
} else {
- perror "krb5kdc startup failed to bind listening sockets"
+ perror "krb5kdc failed to start"
}
stop_kerberos_daemons
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
return 0
}
- timeout {
- if {$standalone} {
- verbose -log "krb5kdc startup timed out"
- fail "krb5kdc"
- } else {
- perror "krb5kdc startup timed out"
- }
- stop_kerberos_daemons
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
- return 0
- }
}
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
if (![file exists $kdc_pidfile]) {
fail "krb5kdc pidfile"
@@ -1677,17 +1586,11 @@
}
catch "unset env(KRB5_KTNAME)"
- if ![start_tail $kadmind_lfile tailf_spawn_id tailf_pid kadmind $standalone] {
- return 0
- }
-
# Start up the kadmind daemon
- # XXXX kadmind uses stderr a lot. the sh -c and redirect can be
- # removed when this is fixed
envstack_push
setup_kerberos_env kdc
file delete $kadmind_pidfile
- spawn $BINSH -c "exec $KADMIND -r $REALMNAME -W -nofork -P $kadmind_pidfile 2>>$kadmind_lfile"
+ spawn $BINSH -c "exec $KADMIND -r $REALMNAME -W -nofork -P $kadmind_pidfile"
envstack_pop
set kadmind_pid [exp_pid]
set kadmind_spawn_id $spawn_id
@@ -1699,58 +1602,23 @@
}
expect {
- -i $tailf_spawn_id
"Seeding random number" exp_continue
- "cannot initialize network" {
- if {$standalone} {
- verbose -log "kadmind failed network init"
- fail "kadmind"
- } else {
- perror "kadmind failed network init"
- }
- stop_kerberos_daemons
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
- return 0
- }
- "cannot bind to network address" {
- if {$standalone} {
- verbose -log "kadmind failed to bind socket"
- fail "kadmind"
- } else {
- perror "kadmind failed to bind socket"
- }
- stop_kerberos_daemons
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
- return 0
- }
"No principal in keytab matches desired name" {
dump_db
exp_continue
}
"starting" { }
- timeout {
+ eof {
+ verbose -log "kadmind failed to start"
if {$standalone} {
- verbose -log "kadmind failed to start"
fail "kadmind"
} else {
- verbose -log "kadmind failed to start"
perror "kadmind failed to start"
}
-#sleep 10
stop_kerberos_daemons
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
return 0
}
}
- exec kill $tailf_pid
- expect -i $tailf_spawn_id eof
- wait -i $tailf_spawn_id
if (![file exists $kadmind_pidfile]) {
fail "kadmind pidfile"
Modified: branches/iakerb/src/tests/dejagnu/krb-standalone/gssapi.exp
===================================================================
--- branches/iakerb/src/tests/dejagnu/krb-standalone/gssapi.exp 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/tests/dejagnu/krb-standalone/gssapi.exp 2010-04-24 22:20:58 UTC (rev 23938)
@@ -285,8 +285,12 @@
spawn $GSSSERVER -export -logfile $tmppwd/gss-server.log -verbose -port [expr 8 + $portbase] gssservice@$hostname
set gss_server_pid [exp_pid]
set gss_server_spawn_id $spawn_id
- sleep 2
+ expect {
+ "starting" { }
+ eof { perror "gss-server failed to start" }
+ }
+
run_client gssclient0 $tmppwd/gss_tk_0 gssclient0
run_client gssclient1 $tmppwd/gss_tk_1 gssclient1
run_client gssclient2 $tmppwd/gss_tk_2 gssclient2
Modified: branches/iakerb/src/tests/dejagnu/krb-standalone/simple.exp
===================================================================
--- branches/iakerb/src/tests/dejagnu/krb-standalone/simple.exp 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/tests/dejagnu/krb-standalone/simple.exp 2010-04-24 22:20:58 UTC (rev 23938)
@@ -46,8 +46,10 @@
verbose "sim_server_spawn is $sim_server_spawn_id" 1
- # Give sim_server some time to start
- sleep 2
+ expect {
+ "starting" { }
+ eof { perror "sim_server failed to start" }
+ }
return 1
}
Modified: branches/iakerb/src/tests/gssapi/Makefile.in
===================================================================
--- branches/iakerb/src/tests/gssapi/Makefile.in 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/tests/gssapi/Makefile.in 2010-04-24 22:20:58 UTC (rev 23938)
@@ -8,11 +8,10 @@
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)
Modified: branches/iakerb/src/util/k5test.py
===================================================================
--- branches/iakerb/src/util/k5test.py 2010-04-24 19:33:33 UTC (rev 23937)
+++ branches/iakerb/src/util/k5test.py 2010-04-24 22:20:58 UTC (rev 23938)
@@ -22,10 +22,14 @@
"""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 *
# Run a test program under a variety of configurations:
@@ -303,12 +307,8 @@
import string
import subprocess
import sys
+import imp
-# 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
@@ -467,15 +467,25 @@
# Return an environment suitable for running programs in the build
# tree. It is safe to modify the result.
def _build_env():
- global buildtop
+ global buildtop, _runenv
env = os.environ.copy()
- for (k, v) in runenv.env.iteritems():
+ for (k, v) in _runenv.iteritems():
if v.find('./') == 0:
env[k] = os.path.join(buildtop, v)
else:
env[k] = v
return env
+
+def _import_runenv():
+ global buildtop
+ runenv_py = os.path.join(buildtop, 'runenv.py')
+ if not os.path.exists(runenv_py):
+ fail('You must run "make fake-install" in %s first.' % buildtop)
+ module = imp.load_source('runenv', runenv_py)
+ return module.env
+
+
# Merge the nested dictionaries cfg1 and cfg2 into a new dictionary.
# cfg1 or cfg2 may be None, in which case the other is returned. If
# cfg2 contains keys mapped to None, the corresponding keys will be
@@ -1019,6 +1029,7 @@
buildtop = _find_buildtop()
srctop = _find_srctop()
plugins = _find_plugins()
+_runenv = _import_runenv()
hostname = socket.getfqdn()
null_input = open(os.devnull, 'r')
More information about the cvs-krb5
mailing list