pull up r18308 from trunk
authorTom Yu <tlyu@mit.edu>
Fri, 30 Jun 2006 23:34:40 +0000 (23:34 +0000)
committerTom Yu <tlyu@mit.edu>
Fri, 30 Jun 2006 23:34:40 +0000 (23:34 +0000)
 r18308@cathode-dark-space:  raeburn | 2006-06-30 19:22:32 -0400
 ticket: new
 subject: test kdb5_util dump/load functionality in dejagnu
 target_version: 1.5
 tags: pullup

 This new test just dumps and reloads the database.  It doesn't examine
 the resulting database, but kinit and other tests are run after it,
 using the reloaded database.

 * standalone.exp (dump_and_reload): New proc.
 (doit): Invoke it.

ticket: 3970
version_fixed: 1.5

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-5@18309 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/dejagnu/krb-standalone/standalone.exp

index 554906e4462da8764c3d593ab7a96008f746a8c5..3799a51abe0a28e9fc8d2bd2d2ebb221b792d548 100644 (file)
@@ -19,6 +19,61 @@ if ![setup_kerberos_db 1] {
 # the rest of the tests inside a proc, so that we can easily kill the
 # processes when the procedure ends.
 
+proc dump_and_reload {} {
+    global KDB5_UTIL
+    global tmppwd
+
+    set dumpfile $tmppwd/dump-file
+    set dumpokfile $dumpfile.dump_ok
+
+    set test1name "kdb5_util dump"
+    set test2name "kdb5_util load"
+
+    if [file exists $dumpfile] { file delete $dumpfile }
+    if [file exists $dumpokfile] { file delete $dumpokfile }
+
+    spawn $KDB5_UTIL dump $dumpfile
+    expect {
+       -re "..*" {
+           fail $test1name
+           untested $test2name
+           return
+       }
+       timeout {
+           fail $test1name
+           untested $test2name
+           return
+       }
+       eof { }
+    }
+    if ![check_exit_status $test1name] {
+       untested $test2name
+       return
+    }
+    if ![file exists $dumpfile]||![file exists $dumpokfile] {
+       fail $test1name
+       untested $test2name
+       return
+    }
+    pass $test1name
+
+    spawn $KDB5_UTIL load $dumpfile
+    expect {
+       -re "..*" {
+           fail $test2name
+           return
+       }
+       timeout {
+           fail $test2name
+           return
+       }
+       eof { }
+    }
+    if [check_exit_status $test2name] {
+       pass $test2name
+    }
+}
+
 proc doit { } {
     global REALMNAME
     global KLIST
@@ -49,6 +104,9 @@ proc doit { } {
        return
     }
 
+    # Test dump and load.  Continue on, whatever the result.
+    dump_and_reload
+
     # Use kinit to get a ticket.
     if ![kinit krbtest/admin adminpass$KEY 1] {
        return