krb5 commit: Note skipped tests
Greg Hudson
ghudson at mit.edu
Thu Jan 22 19:59:33 EST 2015
https://github.com/krb5/krb5/commit/f3891f071b6dc6572c927556b6a0117ac6de50af
commit f3891f071b6dc6572c927556b6a0117ac6de50af
Author: Greg Hudson <ghudson at mit.edu>
Date: Sat Jan 3 20:14:31 2015 -0500
Note skipped tests
In Python test scripts, use skipped() or skip_rest() as appropriate
when skipping tests. For Makefile-conditionalized tests, append to
$(SKIPTESTS) when skipping.
src/kadmin/testing/util/Makefile.in | 1 +
src/lib/krb5/ccache/t_cccol.py | 2 ++
src/lib/krb5/os/Makefile.in | 2 ++
src/lib/rpc/unit-test/Makefile.in | 1 +
src/tests/dejagnu/Makefile.in | 1 +
src/tests/t_ccache.py | 2 ++
src/tests/t_kdb.py | 15 +++++----------
src/tests/t_otp.py | 10 +++++-----
src/tests/t_pkinit.py | 5 ++---
src/tests/t_proxy.py | 11 +++--------
src/tests/t_sn2princ.py | 16 +++++++---------
11 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/src/kadmin/testing/util/Makefile.in b/src/kadmin/testing/util/Makefile.in
index 6bb6f60..3d60177 100644
--- a/src/kadmin/testing/util/Makefile.in
+++ b/src/kadmin/testing/util/Makefile.in
@@ -23,6 +23,7 @@ all-::
@echo "+++"
@echo "+++ WARNING: Tcl not available. The kadm5 tests will not be run."
@echo "+++"
+ @echo 'Skipped kadm5 tests: Tcl not found' >> $(SKIPTESTS)
all-tcl:: $(CLNTPROG) $(SRVPROG)
diff --git a/src/lib/krb5/ccache/t_cccol.py b/src/lib/krb5/ccache/t_cccol.py
index e6d715c..f7f1785 100644
--- a/src/lib/krb5/ccache/t_cccol.py
+++ b/src/lib/krb5/ccache/t_cccol.py
@@ -7,6 +7,8 @@ keyctl = which('keyctl')
out = realm.run([klist, '-c', 'KEYRING:process:abcd'], expected_code=1)
test_keyring = (keyctl is not None and
'Unknown credential cache type' not in out)
+if not test_keyring:
+ skipped('keyring collection tests', 'keyring support not built')
# Run the collection test program against each collection-enabled type.
realm.run(['./t_cccol', 'DIR:' + os.path.join(realm.testdir, 'cc')])
diff --git a/src/lib/krb5/os/Makefile.in b/src/lib/krb5/os/Makefile.in
index e8155be..42f4a75 100644
--- a/src/lib/krb5/os/Makefile.in
+++ b/src/lib/krb5/os/Makefile.in
@@ -220,9 +220,11 @@ check-unix-locate:: t_locate_kdc
$(RUN_SETUP) $(VALGRIND) ./t_locate_kdc $(LOCREALM); \
else \
echo '*** WARNING: skipped t_locate_kdc test: known DNS name not found'; \
+ echo 'Skipped t_locate_kdc test: known DNS name found' >> $(SKIPTESTS); \
fi; \
else \
echo '*** WARNING: skipped t_locate_kdc test: OFFLINE'; \
+ echo 'Skipped t_locate_kdc test: OFFINE' >> $(SKIPTESTS); \
fi
check-unix-trace:: t_trace
diff --git a/src/lib/rpc/unit-test/Makefile.in b/src/lib/rpc/unit-test/Makefile.in
index b72487c..0ba9984 100644
--- a/src/lib/rpc/unit-test/Makefile.in
+++ b/src/lib/rpc/unit-test/Makefile.in
@@ -37,6 +37,7 @@ unit-test-:
@echo "+++ WARNING: lib/rpc unit tests not run."
@echo "+++ Either tcl, runtest, or Perl is unavailable."
@echo "+++"
+ @echo 'Skipped rpc tests: runtest or Perl not found' >> $(SKIPTESTS)
unit-test-ok:: unit-test-body
diff --git a/src/tests/dejagnu/Makefile.in b/src/tests/dejagnu/Makefile.in
index 2dd831d..81df574 100644
--- a/src/tests/dejagnu/Makefile.in
+++ b/src/tests/dejagnu/Makefile.in
@@ -16,6 +16,7 @@ check-runtest-no::
@echo "+++ WARNING: tests/dejagnu tests not run."
@echo "+++ runtest is unavailable."
@echo "+++"
+ @echo 'Skipped dejagnu tests: runtest not found' >> $(SKIPTESTS)
# Set VALGRIND at run time, that may be changed when running 'make'.
check-runtest-yes:: t_inetd site.exp
diff --git a/src/tests/t_ccache.py b/src/tests/t_ccache.py
index b33026e..b1b53f7 100644
--- a/src/tests/t_ccache.py
+++ b/src/tests/t_ccache.py
@@ -29,6 +29,8 @@ keyctl = which('keyctl')
out = realm.run([klist, '-c', 'KEYRING:process:abcd'], expected_code=1)
test_keyring = (keyctl is not None and
'Unknown credential cache type' not in out)
+if not test_keyring:
+ skipped('keyring ccache tests', 'keyring support not built')
# Test kdestroy and klist of a non-existent ccache.
realm.run([kdestroy])
diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index a0bc096..a52a49d 100644
--- a/src/tests/t_kdb.py
+++ b/src/tests/t_kdb.py
@@ -10,13 +10,11 @@ realm.run(['./kdbtest'])
if (not os.path.exists(os.path.join(plugins, 'kdb', 'kldap.so')) and
not os.path.exists(os.path.join(buildtop, 'lib', 'libkdb_ldap.a'))):
- success('Warning: not testing LDAP back end because it is not built')
- exit(0)
+ skip_rest('LDAP KDB tests', 'LDAP KDB module not built')
system_slapd = which('slapd')
if not system_slapd:
- success('Warning: not testing LDAP module because slapd not found')
- exit(0)
+ skip_rest('LDAP KDB tests', 'slapd not found')
ldapdir = os.path.abspath('ldap')
slapd = os.path.join(ldapdir, 'slapd')
@@ -114,8 +112,7 @@ kldaputil(['destroy', '-f'])
ldapmodify = which('ldapmodify')
if not ldapmodify:
- success('Warning: skipping some LDAP tests because ldapmodify not found')
- exit(0)
+ skip_rest('some LDAP KDB tests', 'ldapmodify not found')
def ldap_modify(ldif, args=[]):
proc = subprocess.Popen([ldapmodify, '-H', ldap_uri, '-D', admin_dn,
@@ -363,12 +360,10 @@ if out:
fail('Unexpected kdb5_ldap_util list output after destroy')
if not core_schema:
- success('Warning: skipping some LDAP tests because core schema not found')
- sys.exit(0)
+ skip_rest('LDAP SASL tests', 'core schema not found')
if runenv.have_sasl != 'yes':
- success('Warning: skipping some LDAP tests because SASL support not built')
- sys.exit(0)
+ skip_rest('LDAP SASL tests', 'SASL support not built')
# Test SASL EXTERNAL auth. Remove the DNs and service password file
# from the DB module config.
diff --git a/src/tests/t_otp.py b/src/tests/t_otp.py
index c2ec48d..defe5c7 100644
--- a/src/tests/t_otp.py
+++ b/src/tests/t_otp.py
@@ -37,10 +37,12 @@ import struct
try:
from pyrad import packet, dictionary
+except ImportError:
+ skip_rest('OTP tests', 'Python pyrad module not found')
+try:
from multiprocessing import Process, Queue
except ImportError:
- success('Warning: skipping OTP tests due to missing pyrad or old Python')
- exit(0)
+ skip_rest('OTP tests', 'Python version 2.6 required')
# We could use a dictionary file, but since we need so few attributes,
# we'll just include them here.
@@ -198,9 +200,7 @@ try:
auth = packet.Packet.CreateAuthenticator()
packet.Packet(authenticator=auth, secret="").ReplyPacket()
except AssertionError:
- success('Warning: skipping UNIX domain socket tests because of pyrad '
- 'assertion bug')
- exit(0)
+ skip_rest('OTP UNIX domain socket tests', 'pyrad assertion bug detected')
## Test Unix fail / custom username
daemon = UnixRadiusDaemon(args=(socket_file, '', 'accept', queue))
diff --git a/src/tests/t_pkinit.py b/src/tests/t_pkinit.py
index 762e322..23889c4 100644
--- a/src/tests/t_pkinit.py
+++ b/src/tests/t_pkinit.py
@@ -3,8 +3,7 @@ from k5test import *
# Skip this test if pkinit wasn't built.
if not os.path.exists(os.path.join(plugins, 'preauth', 'pkinit.so')):
- success('Warning: not testing pkinit because it is not built')
- exit(0)
+ skip_rest('PKINIT tests', 'PKINIT module not built')
# Check if soft-pkcs11.so is available.
try:
@@ -316,6 +315,6 @@ if have_soft_pkcs11:
realm.klist('user@%s' % realm.realm)
realm.run([kvno, realm.host_princ])
else:
- output('soft-pkcs11.so not found: skipping tests with PKCS11 identities\n')
+ skipped('PKINIT PKCS11 tests', 'soft-pkcs11.so not found')
success('Authenticated PKINIT')
diff --git a/src/tests/t_proxy.py b/src/tests/t_proxy.py
index a9ba67e..4e86fce 100644
--- a/src/tests/t_proxy.py
+++ b/src/tests/t_proxy.py
@@ -3,20 +3,15 @@ from k5test import *
# Skip this test if we're missing proxy functionality or parts of the proxy.
if runenv.tls_impl == 'no':
- success('Warning: not testing proxy support because TLS was not enabled')
- exit(0)
+ skip_rest('HTTP proxy tests', 'TLS build support not enabled')
try:
from paste import httpserver
except:
- success('Warning: not testing proxy support because python ' +
- 'paste.httpserver module not found')
- exit(0)
+ skip_rest('HTTP proxy tests', 'Python paste module not found')
try:
import kdcproxy
except:
- success('Warning: not testing proxy support because python ' +
- 'kdcproxy module not found')
- exit(0)
+ skip_rest('HTTP proxy tests', 'Python kdcproxy module not found')
# Construct a krb5.conf fragment configuring the client to use a local proxy
# server.
diff --git a/src/tests/t_sn2princ.py b/src/tests/t_sn2princ.py
index de6bb0e..4d27c6f 100644
--- a/src/tests/t_sn2princ.py
+++ b/src/tests/t_sn2princ.py
@@ -62,12 +62,8 @@ testnc('example.com.:123', 'example.com:123', 'R2')
testnc('Example.COM:xyZ', 'example.com:xyZ', 'R2')
testnc('example.com.::123', 'example.com.::123', '')
-def skip_rest(msg):
- success('Warning: skipping online krb5_sname_to_principal tests: %s' % msg)
- sys.exit(0)
-
if offline:
- skip_rest('offline mode requested')
+ skip_rest('sn2princ tests', 'offline mode requested')
# For the online tests, we rely on ptr-mismatch.kerberos.org forward
# and reverse resolving to these names.
@@ -79,10 +75,11 @@ rname = 'kerberos-org.mit.edu'
try:
ai = socket.getaddrinfo(oname, None, 0, 0, 0, socket.AI_CANONNAME)
except socket.gaierror:
- skip_rest('cannot forward resolve %s' % oname)
+ skip_rest('sn2princ tests', 'cannot forward resolve %s' % oname)
(family, socktype, proto, canonname, sockaddr) = ai[0]
if canonname.lower() != fname:
- skip_rest('%s forward resolves to %s, not %s' % (oname, canonname, fname))
+ skip_rest('sn2princ tests',
+ '%s forward resolves to %s, not %s' % (oname, canonname, fname))
# Test forward-only canonicalization (rdns=false).
testnr(oname, fname, 'R1')
@@ -93,9 +90,10 @@ testnr(oname + ':xyZ', fname + ':xyZ', 'R1')
try:
names = socket.getnameinfo(sockaddr, socket.NI_NAMEREQD)
except socket.gaierror:
- skip_rest('cannot reverse resolve %s' % oname)
+ skip_rest('reverse sn2princ tests', 'cannot reverse resolve %s' % oname)
if names[0].lower() != rname:
- skip_rest('%s reverse resolves to %s, not %s' % (oname, names[0], rname))
+ skip_rest('reverse sn2princ tests',
+ '%s reverse resolves to %s, not %s' % (oname, names[0], rname))
# Test default canonicalization (forward and reverse lookup).
test(oname, rname, 'R3')
More information about the cvs-krb5
mailing list