From 681fb9a54e8caeebbcda223617c4844e6a9ec799 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Thu, 3 Oct 1996 17:26:08 +0000 Subject: [PATCH] * env-setup.shin: Renamed env-setup.sh for autoconf use * init_db, start_servers, start_servers_local, stop_servers: Invoke scripts from source directory or build tree as needed. * configure.in, Makefile.in: generate env-setup.sh with proper paths already. (env-setup.shin was created - retaining the old history logs) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9138 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/testing/scripts/ChangeLog | 11 +++ src/kadmin/testing/scripts/Makefile.in | 14 +++- src/kadmin/testing/scripts/configure.in | 5 +- src/kadmin/testing/scripts/env-setup.sh | 79 ------------------- src/kadmin/testing/scripts/env-setup.shin | 15 ++-- src/kadmin/testing/scripts/init_db | 14 +++- src/kadmin/testing/scripts/start_servers | 7 +- .../testing/scripts/start_servers_local | 7 +- src/kadmin/testing/scripts/stop_servers | 3 +- 9 files changed, 54 insertions(+), 101 deletions(-) delete mode 100644 src/kadmin/testing/scripts/env-setup.sh diff --git a/src/kadmin/testing/scripts/ChangeLog b/src/kadmin/testing/scripts/ChangeLog index aab2e1e5a..8b71e4998 100644 --- a/src/kadmin/testing/scripts/ChangeLog +++ b/src/kadmin/testing/scripts/ChangeLog @@ -1,3 +1,14 @@ +Thu Oct 3 13:16:19 1996 Ezra Peisach + + * env-setup.shin: Renamed env-setup.sh for autoconf use. + + * init_db, start_servers, start_servers_local, stop_servers: + Invoke scripts from source directory or build tree as needed. + + * configure.in, Makefile.in: generate env-setup.sh with proper + paths already. + + Wed Oct 2 13:41:04 1996 Ezra Peisach * configure.in, Makefile.in: Let autoconf determine path to perl. diff --git a/src/kadmin/testing/scripts/Makefile.in b/src/kadmin/testing/scripts/Makefile.in index 33297520e..b354c401e 100644 --- a/src/kadmin/testing/scripts/Makefile.in +++ b/src/kadmin/testing/scripts/Makefile.in @@ -3,11 +3,19 @@ PERL=@PERL@ GEN_SCRIPTS = compare_dump.pl fixup-conf-files.pl make-host-keytab.pl \ simple_dump.pl verify_xrunner_report.pl qualname.pl -all:: $(GEN_SCRIPTS) restore_files.sh +all:: env-setup.sh $(GEN_SCRIPTS) restore_files.sh + +# Should only rebuild env_setup.sh here (use CONFIG_FILES=), but the weird krb5 +# makefile post-processing is unconditional and would trash the makefile. +env-setup.sh: env-setup.stamp +env-setup.stamp: $(srcdir)/env-setup.shin config.status + $(SHELL) config.status + chmod +x env-setup.sh + touch env-setup.stamp restore_files.sh: rm -f restore_files.sh - ln -s save_files.sh restore_files.sh + ln -s $(srcdir)/save_files.sh restore_files.sh %.pl: %.pl.in -rm -f $@.tmp @@ -17,4 +25,4 @@ restore_files.sh: mv $@.tmp $@ clean:: - -rm -f $(GEN_SCRIPTS) *.tmp + -rm -f $(GEN_SCRIPTS) *.tmp env-setup.sh env-setup.stamp restore_files.sh diff --git a/src/kadmin/testing/scripts/configure.in b/src/kadmin/testing/scripts/configure.in index c035622dd..def89da67 100644 --- a/src/kadmin/testing/scripts/configure.in +++ b/src/kadmin/testing/scripts/configure.in @@ -1,4 +1,7 @@ AC_INIT(init_db) CONFIG_RULES AC_PATH_PROG(PERL,perl) -V5_AC_OUTPUT_MAKEFILE +dnl The following are substituted into env-setup.sh +AC_SUBST(BUILDTOP) +AC_SUBST(SRCTOP) +V5_AC_OUTPUT_MAKEFILE( ,env-setup.sh:env-setup.shin) diff --git a/src/kadmin/testing/scripts/env-setup.sh b/src/kadmin/testing/scripts/env-setup.sh deleted file mode 100644 index 4ae11471e..000000000 --- a/src/kadmin/testing/scripts/env-setup.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# The KADM5 unit tests were developed to work under gmake. As a -# result, they expect to inherit a number of environment variables. -# Rather than rewrite the tests, we simply use this script as an -# execution wrapper that sets all the necessary environment variables -# before running the program specified on its command line. -# -# The variable settings all came from OV's config.mk. -# -# Usage: env-setup.sh -# - -if [ "$TOP" = "" ]; then - echo "Error! \$TOP is not set." - exit 1 -fi - -TESTDIR=$TOP/testing; export TESTDIR -if [ "$K5ROOT" = "" ]; then - K5ROOT="`cd $TESTDIR; pwd`/krb5-test-root" - export K5ROOT -fi - -REALM=SECURE-TEST.OV.COM; export REALM - -# XXX This should be detected by configure! -EXPECT=/mit/gnu/bin/expect; export EXPECT - -COMPARE_DUMP=$TESTDIR/scripts/compare_dump.pl; export COMPARE_DUMP -FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl -export FIX_CONF_FILES -INITDB=$TESTDIR/scripts/init_db; export INITDB -MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl; export MAKE_KEYTAB -LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl -export LOCAL_MAKE_KEYTAB -RESTORE_FILES=$TESTDIR/scripts/restore_files.sh; export RESTORE_FILES -SAVE_FILES=$TESTDIR/scripts/save_files.sh; export SAVE_FILES -SIMPLE_DUMP=$TESTDIR/scripts/simple_dump.pl; export SIMPLE_DUMP -TCLUTIL=$TESTDIR/tcl/util.t; export TCLUTIL -BSDDB_DUMP=$TESTDIR/util/bsddb_dump; export BSDDB_DUMP -CLNTTCL=$TESTDIR/util/ovsec_kadm_clnt_tcl; export CLNTTCL -SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl; export SRVTCL -QUALNAME=$TOP/inst-scripts/qualname.pl; export QUALNAME - -KRB5_CONFIG=$K5ROOT/krb5.conf; export KRB5_CONFIG -KRB5_KDC_PROFILE=$K5ROOT/kdc.conf; export KRB5_KDC_PROFILE -KRB5_KTNAME=$K5ROOT/ovsec_adm.srvtab; export KRB5_KTNAME - -if [ "$TEST_SERVER" != "" ]; then - MAKE_KEYTAB="$MAKE_KEYTAB -server $TEST_SERVER" -fi -if [ "$TEST_PATH" != "" ]; then - MAKE_KEYTAB="$MAKE_KEYTAB -top $TEST_PATH" -fi - -if [ "x$PS_ALL" = "x" ]; then - ps -axwwu >/dev/null 2>&1 - ps_bsd=$? - - ps -ef >/dev/null 2>&1 - ps_sysv=$? - - if [ $ps_bsd = 0 -a $ps_sysv = 1 ]; then - PS_ALL="ps -auxww" - PS_PID="ps -auxww" - elif [ $ps_bsd = 1 -a $ps_sysv = 0 ]; then - PS_ALL="ps -ef" - PS_PID="ps -fp" - else - PS_ALL="ps -auxww" - PS_PID="ps -auxww" - echo "WARNING! Cannot auto-detect ps type, assuming BSD." - fi - - export PS_ALL PS_PID -fi - -exec ${1+"$@"} diff --git a/src/kadmin/testing/scripts/env-setup.shin b/src/kadmin/testing/scripts/env-setup.shin index 4ae11471e..2c61cc428 100644 --- a/src/kadmin/testing/scripts/env-setup.shin +++ b/src/kadmin/testing/scripts/env-setup.shin @@ -11,12 +11,13 @@ # Usage: env-setup.sh # -if [ "$TOP" = "" ]; then - echo "Error! \$TOP is not set." - exit 1 -fi +TOP=@BUILDTOP@/kadmin +STOP=@SRCTOP@/kadmin +export TOP +export STOP TESTDIR=$TOP/testing; export TESTDIR +STESTDIR=$STOP/testing; export STESTDIR if [ "$K5ROOT" = "" ]; then K5ROOT="`cd $TESTDIR; pwd`/krb5-test-root" export K5ROOT @@ -30,14 +31,14 @@ EXPECT=/mit/gnu/bin/expect; export EXPECT COMPARE_DUMP=$TESTDIR/scripts/compare_dump.pl; export COMPARE_DUMP FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl export FIX_CONF_FILES -INITDB=$TESTDIR/scripts/init_db; export INITDB +INITDB=$STESTDIR/scripts/init_db; export INITDB MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl; export MAKE_KEYTAB LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl export LOCAL_MAKE_KEYTAB RESTORE_FILES=$TESTDIR/scripts/restore_files.sh; export RESTORE_FILES -SAVE_FILES=$TESTDIR/scripts/save_files.sh; export SAVE_FILES +SAVE_FILES=$STESTDIR/scripts/save_files.sh; export SAVE_FILES SIMPLE_DUMP=$TESTDIR/scripts/simple_dump.pl; export SIMPLE_DUMP -TCLUTIL=$TESTDIR/tcl/util.t; export TCLUTIL +TCLUTIL=$STESTDIR/tcl/util.t; export TCLUTIL BSDDB_DUMP=$TESTDIR/util/bsddb_dump; export BSDDB_DUMP CLNTTCL=$TESTDIR/util/ovsec_kadm_clnt_tcl; export CLNTTCL SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl; export SRVTCL diff --git a/src/kadmin/testing/scripts/init_db b/src/kadmin/testing/scripts/init_db index 4b4d95485..c44a9760a 100644 --- a/src/kadmin/testing/scripts/init_db +++ b/src/kadmin/testing/scripts/init_db @@ -18,6 +18,11 @@ if [ "$TOP" = "" ]; then exit 1 fi +if [ "$STOP" = "" ]; then + echo "init_db: Environment variable \$STOP must point to top of source tree" 1>&2 + exit 1 +fi + IROOT=$TOP/.. ADMIN=$TOP/dbutil BIN=$IROOT/bin @@ -26,8 +31,9 @@ SBIN=$TOP/keytab:$TOP/server DUMMY=${REALM=SECURE-TEST.OV.COM}; export REALM DUMMY=${TESTDIR=$TOP/testing}; export TESTDIR +DUMMY=${STESTDIR=$STOP/testing} DUMMY=${SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl}; export SRVTCL -DUMMY=${TCLUTIL=$TESTDIR/tcl/util.t}; export TCLUTIL +DUMMY=${TCLUTIL=$STESTDIR/tcl/util.t}; export TCLUTIL DUMMY=${LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl} PATH=$ADMIN:$BIN:$ETC:$SBIN:$PATH; export PATH @@ -52,13 +58,13 @@ fi sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \ -e "s/__KDCHOST__/localhost/g" \ - < $TESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf + < $STESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \ - < $TESTDIR/proto/kdc.conf.proto > $K5ROOT/kdc.conf + < $STESTDIR/proto/kdc.conf.proto > $K5ROOT/kdc.conf kdb5_util -r $REALM create -P mrroot -s $REDIRECT -cp $TESTDIR/proto/ovsec_adm.dict $K5ROOT/ovsec_adm.dict +cp $STESTDIR/proto/ovsec_adm.dict $K5ROOT/ovsec_adm.dict eval $SRVTCL <<'EOF' $REDIRECT source $env(TCLUTIL) diff --git a/src/kadmin/testing/scripts/start_servers b/src/kadmin/testing/scripts/start_servers index dc958d62c..26fef9150 100644 --- a/src/kadmin/testing/scripts/start_servers +++ b/src/kadmin/testing/scripts/start_servers @@ -10,9 +10,10 @@ # TOP is used. DUMMY=${TESTDIR=$TOP/testing} -DUMMY=${SAVE_FILES=$TESTDIR/scripts/save_files.sh} +DUMMY=${STESTDIR=$STOP/testing} +DUMMY=${SAVE_FILES=$STESTDIR/scripts/save_files.sh} DUMMY=${FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl} -DUMMY=${START_SERVERS_LOCAL=$TESTDIR/scripts/start_servers_local} +DUMMY=${START_SERVERS_LOCAL=$STESTDIR/scripts/start_servers_local} # This'll be wrong sometimes DUMMY=${RSH_CMD=rsh} @@ -43,7 +44,7 @@ if [ $local = 0 ]; then # Fix up the local krb5.conf to point to the remote sed -e "s/__REALM__/$REALM/g" -e "s#__K5ROOT__#$K5ROOT#g" \ -e "s/__KDCHOST__/$hostname/g" \ - < $TESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf + < $STESTDIR/proto/krb5.conf.proto > $K5ROOT/krb5.conf # Using /usr/ucb/rsh and getting rid of "-k $REALM" until we get # around to fixing the fact that Kerberos rsh doesn't strip out "-k diff --git a/src/kadmin/testing/scripts/start_servers_local b/src/kadmin/testing/scripts/start_servers_local index 249d3ffd0..70c642fc4 100644 --- a/src/kadmin/testing/scripts/start_servers_local +++ b/src/kadmin/testing/scripts/start_servers_local @@ -1,12 +1,13 @@ #!/bin/sh DUMMY=${TESTDIR=$TOP/testing} -DUMMY=${SAVE_FILES=$TESTDIR/scripts/save_files.sh} +DUMMY=${STESTDIR=$STOP/testing} +DUMMY=${SAVE_FILES=$STESTDIR/scripts/save_files.sh} DUMMY=${FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl} -DUMMY=${INITDB=$TESTDIR/scripts/init_db} +DUMMY=${INITDB=$STESTDIR/scripts/init_db} DUMMY=${SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl}; export SRVTCL DUMMY=${LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl} -DUMMY=${STOP_SERVERS_LOCAL=$TESTDIR/scripts/stop_servers_local} +DUMMY=${STOP_SERVERS_LOCAL=$STESTDIR/scripts/stop_servers_local} if [ -d /usr/tmp ]; then usrtmp=/usr/tmp diff --git a/src/kadmin/testing/scripts/stop_servers b/src/kadmin/testing/scripts/stop_servers index 563087e31..e8dcac838 100644 --- a/src/kadmin/testing/scripts/stop_servers +++ b/src/kadmin/testing/scripts/stop_servers @@ -10,8 +10,9 @@ # TOP is used. DUMMY=${TESTDIR=$TOP/testing} +DUMMY=${STESTDIR=$STOP/testing} DUMMY=${FIX_CONF_FILES=$TESTDIR/scripts/fixup-conf-files.pl} -DUMMY=${STOP_SERVERS_LOCAL=$TESTDIR/scripts/stop_servers_local} +DUMMY=${STOP_SERVERS_LOCAL=$STESTDIR/scripts/stop_servers_local} # This'll be wrong sometimes DUMMY=${RSH_CMD=rsh} DUMMY=${RESTORE_FILES=$TESTDIR/scripts/restore_files.sh} -- 2.26.2