remove some krb4 testing hooks
[krb5.git] / src / kadmin / testing / scripts / env-setup.shin
1 #!/bin/sh
2 #
3 # The KADM5 unit tests were developed to work under gmake.  As a
4 # result, they expect to inherit a number of environment variables.
5 # Rather than rewrite the tests, we simply use this script as an
6 # execution wrapper that sets all the necessary environment variables
7 # before running the program specified on its command line.
8 #
9 # The variable settings all came from OV's config.mk.
10 #
11 # Usage: env-setup.sh <command line>
12 #
13
14 TOP=@RBUILD@/kadmin
15 STOP=@S_TOP@/kadmin
16 export TOP
17 export STOP
18 # These two may be needed in case $libdir references them.
19 prefix=@prefix@
20 exec_prefix=@exec_prefix@
21 libdir=@libdir@ ; eval "libdir=$libdir"; export libdir
22
23 # The shared library run time setup
24 TOPLIBD=@RBUILD@/lib
25 PROG_LIBPATH=-L@RBUILD@/lib
26 BUILDTOP=@RBUILD@
27 # XXX kludge!
28 PROG_RPATH=@RBUILD@/lib
29 # XXX more kludge!
30 FAKEDEST=@RBUILD@/util/fakedest
31 # This converts $(TOPLIBD) to $TOPLIBD
32 cat > /tmp/env_setup$$ <<\EOF
33 @KRB5_RUN_ENV@
34 EOF
35
36 foo=`sed -e 's/(//g' -e 's/)//g' -e 's/\\\$\\\$/\$/g' /tmp/env_setup$$`
37 eval $foo
38
39 # This will get put in setup.csh for convenience
40 KRB5_RUN_ENV_CSH=`eval echo "$foo" | \
41         sed -e 's/\([^=]*\)=\(.*\)/setenv \1 \2/g' \
42         -e 's/export [^ ;]*;//g'`
43 export KRB5_RUN_ENV_CSH
44 rm /tmp/env_setup$$
45
46 TESTDIR=$TOP/testing; export TESTDIR
47 STESTDIR=$STOP/testing; export STESTDIR
48 if [ "$K5ROOT" = "" ]; then
49         K5ROOT="`cd $TESTDIR; pwd`/krb5-test-root"
50         export K5ROOT
51 fi
52
53 # If $VERBOSE_TEST is non-null, enter verbose mode.  Set $VERBOSE to
54 # true or false so its exit status identifies the mode.
55 if test x$VERBOSE_TEST = x; then
56         VERBOSE=false
57 else
58         VERBOSE=true
59 fi
60 export VERBOSE
61
62 REALM=SECURE-TEST.OV.COM; export REALM
63
64 if test x$EXPECT = x; then
65     EXPECT=@EXPECT@; export EXPECT
66 fi
67
68 COMPARE_DUMP=$TESTDIR/scripts/compare_dump.pl; export COMPARE_DUMP
69 INITDB=$STESTDIR/scripts/init_db; export INITDB
70 MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl; export MAKE_KEYTAB
71 LOCAL_MAKE_KEYTAB=$TESTDIR/scripts/make-host-keytab.pl
72 export LOCAL_MAKE_KEYTAB
73 SIMPLE_DUMP=$TESTDIR/scripts/simple_dump.pl; export SIMPLE_DUMP
74 QUALNAME=$TESTDIR/scripts/qualname.pl; export QUALNAME
75 TCLUTIL=$STESTDIR/tcl/util.t; export TCLUTIL
76 BSDDB_DUMP=$TESTDIR/util/bsddb_dump; export BSDDB_DUMP
77 CLNTTCL=$TESTDIR/util/ovsec_kadm_clnt_tcl; export CLNTTCL
78 SRVTCL=$TESTDIR/util/ovsec_kadm_srv_tcl; export SRVTCL
79
80 KRB5_CONFIG=$K5ROOT/krb5.conf; export KRB5_CONFIG
81 KRB5_KDC_PROFILE=$K5ROOT/kdc.conf; export KRB5_KDC_PROFILE
82 KRB5_KTNAME=$K5ROOT/ovsec_adm.srvtab; export KRB5_KTNAME
83 KRB5CCNAME=$K5ROOT/krb5cc_unit-test; export KRB5CCNAME
84
85 if [ "$TEST_SERVER" != "" ]; then
86         MAKE_KEYTAB="$MAKE_KEYTAB -server $TEST_SERVER"
87 fi
88 if [ "$TEST_PATH" != "" ]; then
89         MAKE_KEYTAB="$MAKE_KEYTAB -top $TEST_PATH"
90 fi
91
92 if [ "x$PS_ALL" = "x" ]; then
93         ps -axwwu >/dev/null 2>&1
94         ps_bsd=$?
95
96         ps -ef >/dev/null 2>&1
97         ps_sysv=$?
98
99         if [ $ps_bsd = 0 -a $ps_sysv = 1 ]; then
100                 PS_ALL="ps -auxww"
101                 PS_PID="ps -auxww"
102         elif [ $ps_bsd = 1 -a $ps_sysv = 0 ]; then
103                 PS_ALL="ps -ef"
104                 PS_PID="ps -fp"
105         else
106                 PS_ALL="ps -auxww"
107                 PS_PID="ps -auxww"
108                 echo "WARNING!  Cannot auto-detect ps type, assuming BSD."
109         fi
110
111         export PS_ALL PS_PID
112 fi
113
114 exec ${1+"$@"}