From e2a351d33408305101825cd1e3e13195b2d52e66 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Wed, 21 Sep 2011 21:18:35 +0000 Subject: Fix string attribute unit tests Wrap t_stringattr in a very minimal Python test script so that libkdb5 can find the DB2 module to allocate memory. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25223 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kdb/Makefile.in | 6 +++--- src/lib/kdb/t_stringattr.c | 8 +++++--- src/lib/kdb/t_stringattr.py | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/lib/kdb/t_stringattr.py (limited to 'src/lib') diff --git a/src/lib/kdb/Makefile.in b/src/lib/kdb/Makefile.in index e8f44ae2ff..f647bb166a 100644 --- a/src/lib/kdb/Makefile.in +++ b/src/lib/kdb/Makefile.in @@ -58,9 +58,9 @@ all-unix:: all-liblinks install-unix:: install-libs clean-unix:: clean-liblinks clean-libs clean-libobjs $(RM) adb_err.c adb_err.h t_stringattr.o t_stringattr -check-unix:: t_stringattr - KRB5_CONFIG=$(top_srcdir)/config-files/krb5.conf; export KRB5_CONFIG; \ - $(RUN_SETUP) $(VALGRIND) ./t_stringattr + +check-pytests:: t_stringattr + $(RUNPYTEST) $(srcdir)/t_stringattr.py $(PYTESTFLAGS) generate-files-mac: darwin.exports diff --git a/src/lib/kdb/t_stringattr.c b/src/lib/kdb/t_stringattr.c index 8b943124ce..a04486e87e 100644 --- a/src/lib/kdb/t_stringattr.c +++ b/src/lib/kdb/t_stringattr.c @@ -46,12 +46,14 @@ main() char *val; int count; - assert(krb5_init_context(&context) == 0); + assert(krb5int_init_context_kdc(&context) == 0); /* Start with an empty entry. */ ent = krb5_db_alloc(context, NULL, sizeof(*ent)); - if (ent == NULL) - return ENOMEM; + if (ent == NULL) { + fprintf(stderr, "Can't allocate memory for entry.\n"); + return 1; + } memset(ent, 0, sizeof(*ent)); /* Check that the entry has no strings to start. */ diff --git a/src/lib/kdb/t_stringattr.py b/src/lib/kdb/t_stringattr.py new file mode 100644 index 0000000000..210134c8bf --- /dev/null +++ b/src/lib/kdb/t_stringattr.py @@ -0,0 +1,6 @@ +#!/usr/bin/python +from k5test import * + +realm = K5Realm(create_kdb=False) +realm.run_as_master(['./t_stringattr']) +success('String attribute unit tests.') -- cgit