From 45cb91dde2b7c4d6226fb3ca8ba3eb679e750a55 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sun, 6 Sep 2009 18:38:23 -0700 Subject: [PATCH] switch to mostly configuration in setup-env for check-kdc --- tests/bin/Makefile.am | 19 +++++++++++++++++++ tests/bin/setup-env.in | 32 ++++++++++++++++++++++++++++++++ tests/db/Makefile.am | 1 + tests/db/have-db.in | 5 ++--- tests/kdc/Makefile.am | 1 + tests/kdc/check-kdc.in | 33 +++++++++++++++------------------ 6 files changed, 70 insertions(+), 21 deletions(-) create mode 100644 tests/bin/Makefile.am create mode 100644 tests/bin/setup-env.in diff --git a/tests/bin/Makefile.am b/tests/bin/Makefile.am new file mode 100644 index 000000000..5f3450e78 --- /dev/null +++ b/tests/bin/Makefile.am @@ -0,0 +1,19 @@ +include $(top_srcdir)/Makefile.am.common + +noinst_SCRIPTS = setup-env + +do_subst = \ + top_srcdir="$$(cd ${top_srcdir} && pwd)" ; \ + top_builddir="$$(cd ${top_builddir} && pwd)" ; \ + sed $(do_dlopen) \ + -e "s,[@]EGREP[@],$(EGREP),g" \ + -e "s,[@]top_srcdir[@],$${top_srcdir},g" \ + -e "s,[@]top_builddir[@],$${top_builddir},g" + +setup-env: setup-env.in Makefile + $(do_subst) < $(srcdir)/setup-env.in > setup-env.tmp + chmod +x setup-env.tmp + mv setup-env.tmp setup-env + +CLEANFILES = setup-env setup-env.tmp + diff --git a/tests/bin/setup-env.in b/tests/bin/setup-env.in new file mode 100644 index 000000000..864874632 --- /dev/null +++ b/tests/bin/setup-env.in @@ -0,0 +1,32 @@ +#!/bin/sh + +top_builddir="@top_builddir@" +top_srcdir="@top_srcdir@" +EGREP="@EGREP@" + +# Meant to be sourced (source or .) by the tester application, offers +# most commands in heimdal as variables + +# regular apps +kinit="${TESTS_ENVIRONMENT} ${top_builddir}/kuser/kinit" +klist="${TESTS_ENVIRONMENT} ${top_builddir}/kuser/klist" +kgetcred="${TESTS_ENVIRONMENT} ${top_builddir}/kuser/kgetcred" +kdestroy="${TESTS_ENVIRONMENT} ${top_builddir}/kuser/kdestroy" +kimpersonate="${TESTS_ENVIRONMENT} ${top_builddir}/kuser/kimpersonate" +ktutil="${TESTS_ENVIRONMENT} ${top_builddir}/admin/ktutil" +hxtool="${TESTS_ENVIRONMENT} ${top_builddir}/lib/hx509/hxtool" +kadmin="${TESTS_ENVIRONMENT} ${top_builddir}/kadmin/kadmin" +kdc="${TESTS_ENVIRONMENT} ${top_builddir}/kdc/kdc" + +# regression test tools +test_renew="${TESTS_ENVIRONMENT} ${top_builddir}/lib/krb5/test_renew" +test_ap_req="${TESTS_ENVIRONMENT} ${top_builddir}/lib/krb5/test_ap-req" +test_gic="${TESTS_ENVIRONMENT} ${top_builddir}/lib/krb5/test_gic" + +# misc apps +wait_kdc="${top_srcdir}/tests/kdc/wait-kdc.sh" +leaks_kill="${top_srcdir}/tests/kdc/leaks-kill.sh" +have_db="${top_builddir}/tests/db/have-db" + +# data +hx509_data="${top_srcdir}/../../lib/hx509/data" \ No newline at end of file diff --git a/tests/db/Makefile.am b/tests/db/Makefile.am index 9615ac95e..7d7cdc8d6 100644 --- a/tests/db/Makefile.am +++ b/tests/db/Makefile.am @@ -11,6 +11,7 @@ check_SCRIPTS = loaddump-db add-modify-delete check-dbinfo check-aliases TESTS = $(check_SCRIPTS) do_subst = sed -e 's,[@]srcdir[@],$(srcdir),g' \ + -e 's,[@]top_builddir[@],$(top_builddir),g' \ -e 's,[@]objdir[@],$(top_builddir)/tests/db,g' \ -e 's,[@]EGREP[@],$(EGREP),g' diff --git a/tests/db/have-db.in b/tests/db/have-db.in index 8aa3822bc..376372259 100644 --- a/tests/db/have-db.in +++ b/tests/db/have-db.in @@ -34,10 +34,9 @@ # $Id$ # -srcdir="@srcdir@" -base=`dirname "$0"` +top_builddir="@top_builddir@" -kdc="${base}/../../kdc/kdc" +. ${top_builddir}/tests/bin/setup-env list=`${kdc} --builtin-hdb | sed 's/^builtin hdb backends: //'` oldIFS="$IFS" diff --git a/tests/kdc/Makefile.am b/tests/kdc/Makefile.am index ef2322d84..f1c501cff 100644 --- a/tests/kdc/Makefile.am +++ b/tests/kdc/Makefile.am @@ -44,6 +44,7 @@ do_subst = sed $(do_dlopen) \ -e 's,[@]admport[@],$(admport),g' \ -e 's,[@]pwport[@],$(pwport),g' \ -e 's,[@]objdir[@],$(top_builddir)/tests/kdc,g' \ + -e 's,[@]top_builddir[@],$(top_builddir),g' \ -e 's,[@]EGREP[@],$(EGREP),g' LDADD = ../../lib/krb5/libkrb5.la $(LIB_roken) diff --git a/tests/kdc/check-kdc.in b/tests/kdc/check-kdc.in index ead3dde66..fee0c142d 100644 --- a/tests/kdc/check-kdc.in +++ b/tests/kdc/check-kdc.in @@ -34,22 +34,24 @@ # $Id$ # +top_builddir="@top_builddir@" srcdir="@srcdir@" objdir="@objdir@" -EGREP="@EGREP@" testfailed="echo test failed; cat messages.log; exit 1" +. ${top_builddir}/tests/bin/setup-env + # If there is no useful db support compile in, disable test -../db/have-db || exit 77 +${have_db} || exit 77 R=TEST.H5L.SE R2=TEST2.H5L.SE port=@port@ -kadmin="${TESTS_ENVIRONMENT} ../../kadmin/kadmin -l -r $R" -kdc="${TESTS_ENVIRONMENT} ../../kdc/kdc --addresses=localhost -P $port" +kadmin="${kadmin} -l -r $R" +kdc="${kdc} --addresses=localhost -P $port" server=host/datan.test.h5l.se server2=host/computer.example.com @@ -68,17 +70,12 @@ keytab="FILE:${keytabfile}" ps="proxy-service@${R}" aesenctype="aes256-cts-hmac-sha1-96" -kinit="${TESTS_ENVIRONMENT} ../../kuser/kinit -c $cache --no-afslog" -klist="${TESTS_ENVIRONMENT} ../../kuser/klist -c $cache" -kgetcred="${TESTS_ENVIRONMENT} ../../kuser/kgetcred -c $cache" -kgetcred_imp="${TESTS_ENVIRONMENT} ../../kuser/kgetcred -c $cache --out-cache=${ocache}" -kdestroy="${TESTS_ENVIRONMENT} ../../kuser/kdestroy -c $cache --no-unlog" -ktutil="${TESTS_ENVIRONMENT} ../../admin/ktutil" -hxtool="${TESTS_ENVIRONMENT} ../../lib/hx509/hxtool" -kimpersonate="${TESTS_ENVIRONMENT} ../../kuser/kimpersonate -k ${keytab} --ccache=${ocache}" -test_renew="${TESTS_ENVIRONMENT} ../../lib/krb5/test_renew" -test_ap_req="${TESTS_ENVIRONMENT} ../../lib/krb5/test_ap-req" -test_gic="${TESTS_ENVIRONMENT} ../../lib/krb5/test_gic" +kinit="${kinit} -c $cache --no-afslog" +klist="${klist} -c $cache" +kgetcred="${kgetcred} -c $cache" +kgetcred_imp="${kgetcred} -c $cache --out-cache=${ocache}" +kdestroy="${kdestroy} -c $cache --no-unlog" +kimpersonate="${kimpersonate} -k ${keytab} --ccache=${ocache}" KRB5_CONFIG="${objdir}/@KDCCONF@" export KRB5_CONFIG @@ -171,7 +168,7 @@ env MallocStackLogging=1 MallocStackLoggingNoCompact=1 MallocErrorAbort=1 Malloc ${kdc} & kdcpid=$! -sh ${srcdir}/wait-kdc.sh +sh ${wait_kdc} if [ "$?" != 0 ] ; then kill -9 ${kdcpid} exit 1 @@ -391,7 +388,7 @@ fi # If we support pkinit and have RSA, lets try that if test "$pkinit" = yes -a "$rsa" = yes ; then - base="${srcdir}/../../lib/hx509/data" + base="${hx509_data}" echo "try anonymous pkinit"; > messages.log ${kinit} --anonymous ${R} || \ @@ -539,7 +536,7 @@ echo " test_gic passes" ${kdestroy} echo "killing kdc (${kdcpid})" -sh ${srcdir}/leaks-kill.sh kdc $kdcpid || exit 1 +sh ${leaks_kill} kdc $kdcpid || exit 1 trap "" EXIT