You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.6 KiB

25 years ago
  1. # See the file LICENSE for redistribution information.
  2. #
  3. # Copyright (c) 1999, 2000
  4. # Sleepycat Software. All rights reserved.
  5. #
  6. # $Id: update.tcl,v 11.9 2000/10/27 13:23:56 sue Exp $
  7. source ./include.tcl
  8. global update_dir
  9. set update_dir "$test_path/update_test"
  10. proc update { } {
  11. source ./include.tcl
  12. global update_dir
  13. foreach version [glob $update_dir/*] {
  14. regexp \[^\/\]*$ $version version
  15. foreach method [glob $update_dir/$version/*] {
  16. regexp \[^\/\]*$ $method method
  17. foreach file [glob $update_dir/$version/$method/*] {
  18. regexp (\[^\/\]*)\.tar\.gz$ $file dummy name
  19. foreach endianness {"le" "be"} {
  20. puts "Update:\
  21. $version $method $name $endianness"
  22. set ret [catch {_update $update_dir $testdir $version $method $name $endianness 1 1} message]
  23. if { $ret != 0 } {
  24. puts $message
  25. }
  26. }
  27. }
  28. }
  29. }
  30. }
  31. proc _update { source_dir temp_dir \
  32. version method file endianness do_db_load_test do_update_test } {
  33. source include.tcl
  34. global errorInfo
  35. cleanup $temp_dir NULL
  36. exec sh -c \
  37. "gzcat $source_dir/$version/$method/$file.tar.gz | (cd $temp_dir && tar xf -)"
  38. if { $do_db_load_test } {
  39. set ret [catch \
  40. {exec $util_path/db_load -f "$temp_dir/$file.dump" \
  41. "$temp_dir/update.db"} message]
  42. error_check_good \
  43. "Update load: $version $method $file $message" $ret 0
  44. set ret [catch \
  45. {exec $util_path/db_dump -f "$temp_dir/update.dump" \
  46. "$temp_dir/update.db"} message]
  47. error_check_good \
  48. "Update dump: $version $method $file $message" $ret 0
  49. error_check_good "Update diff.1.1: $version $method $file" \
  50. [filecmp "$temp_dir/$file.dump" "$temp_dir/update.dump"] 0
  51. error_check_good \
  52. "Update diff.1.2: $version $method $file" $ret ""
  53. }
  54. if { $do_update_test } {
  55. set ret [catch \
  56. {berkdb open -update "$temp_dir/$file-$endianness.db"} db]
  57. if { $ret == 1 } {
  58. if { ![is_substr $errorInfo "version upgrade"] } {
  59. set fnl [string first "\n" $errorInfo]
  60. set theError \
  61. [string range $errorInfo 0 [expr $fnl - 1]]
  62. error $theError
  63. }
  64. } else {
  65. error_check_good dbopen [is_valid_db $db] TRUE
  66. error_check_good dbclose [$db close] 0
  67. set ret [catch \
  68. {exec $util_path/db_dump -f \
  69. "$temp_dir/update.dump" \
  70. "$temp_dir/$file-$endianness.db"} message]
  71. error_check_good "Update\
  72. dump: $version $method $file $message" $ret 0
  73. error_check_good \
  74. "Update diff.2: $version $method $file" \
  75. [filecmp "$temp_dir/$file.dump" \
  76. "$temp_dir/update.dump"] 0
  77. error_check_good \
  78. "Update diff.2: $version $method $file" $ret ""
  79. }
  80. }
  81. }