From: Greg Hudson Date: Wed, 21 Sep 2011 21:18:35 +0000 (+0000) Subject: Fix string attribute unit tests X-Git-Tag: krb5-1.10-alpha1~152 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e2a351d33408305101825cd1e3e13195b2d52e66;p=krb5.git 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 --- diff --git a/src/lib/kdb/Makefile.in b/src/lib/kdb/Makefile.in index e8f44ae2f..f647bb166 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 8b943124c..a04486e87 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 000000000..210134c8b --- /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.')