look up local hostname instead of using 'localhost'; pass RUNTESTFLAGS
authorKen Raeburn <raeburn@mit.edu>
Wed, 1 Sep 1999 21:46:13 +0000 (21:46 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 1 Sep 1999 21:46:13 +0000 (21:46 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11774 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/unit-test/ChangeLog
src/lib/kadm5/unit-test/Makefile.in
src/lib/kadm5/unit-test/api.2/init-v2.exp

index e4c000102aaa6b23b265a9d5b6d80a16f3a4047f..41c079143acc48ba9caaae5ec3b88856310cd85d 100644 (file)
@@ -1,3 +1,15 @@
+1999-09-01  Ken Raeburn  <raeburn@mit.edu>
+
+       * api.2/init-v2.exp (RESOLVE): New variable.
+       (get_hostname): New proc, taken from tests/dejagnu.
+       (test101): Use get_hostname, set a variable in the target process
+       to hold the result, and use that variable in the other commands
+       passed, instead of "localhost".
+
+       * Makefile.in (unit-test-client-body): Pass $(RUNTESTFLAGS) to
+       runtest, so the user can run subsets of the test suite.
+       (unit-test-server-body): Likewise.
+
 1998-11-13  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * Makefile.in: Set the myfulldir and mydir variables (which are
index 89ba1efd03cded3d6b54356e527b2a5f2a21948e..048173d0223c1a348b102997813bc331afca5c57 100644 (file)
@@ -115,14 +115,14 @@ unit-test-client-body: site.exp test-noauth test-destroy test-handle-client
        $(ENV_SETUP) $(RUNTEST) --tool api RPC=1 API=$(CLNTTCL) \
                KINIT=$(BUILDTOP)/clients/kinit/kinit \
                KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
-               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local 
+               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local $(RUNTESTFLAGS)
        -mv api.log capi.log
        -mv api.sum capi.sum
 
 unit-test-server-body: site.exp test-handle-server lock-test 
        $(ENV_SETUP) $(RUNTEST) --tool api RPC=0 API=$(SRVTCL) \
                LOCKTEST=./lock-test \
-               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local
+               KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local $(RUNTESTFLAGS)
        -mv api.log sapi.log
        -mv api.sum sapi.sum
 
index bf1a7df490e7925d0a30fa53a38268ad1ac92db8..fe0721494ae137e50021c5832e4b244745ebefa1 100644 (file)
@@ -19,21 +19,63 @@ proc test100 {} {
 }
 if {$RPC} test100
 
+if ![info exists RESOLVE] {
+    set RESOLVE [findfile $objdir/../../../tests/resolve/resolve]
+}
+proc get_hostname { } {
+    global RESOLVE
+    global hostname
+    global localhostname
+    global domain
+
+    if {[info exists hostname] && [info exists localhostname]} {
+       return 1
+    }
+
+    catch "exec $RESOLVE -q >myname" exec_output
+    if ![string match "" $exec_output] {
+       send_log "$exec_output\n"
+       verbose $exec_output
+       send_error "ERROR: can't get hostname\n"
+       return 0
+    }
+    set file [open myname r]
+    if { [ gets $file hostname ] == -1 } {
+       send_error "ERROR: no output from hostname\n"
+       return 0
+    }
+    close $file
+    catch "exec rm -f myname" exec_output
+    regexp "^(\[^.\]*)\.(.*)$" $hostname foo localhostname domain
+
+    set hostname [string tolower $hostname]
+    set localhostname [string tolower $localhostname]
+    set domain [string tolower $domain]
+    verbose "hostname: $hostname; localhostname: $localhostname; domain $domain"
+
+    return 1
+}
+
+
 test "init 101"
 proc test101 {} {
     global test
+    global hostname
+
+    get_hostname
+    tcl_cmd "set hostname $hostname"
 
     # XXX Fix to work with a remote TEST_SERVER.  For now, make sure
     # it fails in that case.
     one_line_succeed_test {
        kadm5_init admin admin $KADM5_ADMIN_SERVICE \
-               [config_params {KADM5_CONFIG_ADMIN_SERVER KADM5_CONFIG_KADMIND_PORT} {localhost 1751}] \
+               [config_params {KADM5_CONFIG_ADMIN_SERVER KADM5_CONFIG_KADMIND_PORT} [list $hostname 1751]] \
                $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
                server_handle
     }
     one_line_fail_test {
        kadm5_init admin admin $KADM5_ADMIN_SERVICE \
-               [config_params {KADM5_CONFIG_ADMIN_SERVER KADM5_CONFIG_KADMIND_PORT} {localhost 1}] \
+               [config_params {KADM5_CONFIG_ADMIN_SERVER KADM5_CONFIG_KADMIND_PORT} [list $hostname 1]] \
                $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
                server_handle
     } "RPC_ERROR"