all.test 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # 2001 September 15
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. # This file runs all tests.
  12. #
  13. # $Id: all.test,v 1.14 2002/05/10 13:14:08 drh Exp $
  14. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. rename finish_test really_finish_test
  17. proc finish_test {} {memleak_check}
  18. if {[file exists ./sqlite_test_count]} {
  19. set COUNT [exec cat ./sqlite_test_count]
  20. } else {
  21. set COUNT 3
  22. }
  23. # LeakList will hold a list of the number of unfreed mallocs after
  24. # each round of the test. This number should be constant. If it
  25. # grows, it may mean there is a memory leak in the library.
  26. #
  27. set LeakList {}
  28. set EXCLUDE {
  29. all.test
  30. quick.test
  31. malloc.test
  32. misuse.test
  33. btree2.test
  34. }
  35. for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
  36. if {$Counter%2} {
  37. set ::SETUP_SQL {PRAGMA default_synchronous=off;}
  38. } else {
  39. catch {unset ::SETUP_SQL}
  40. }
  41. foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
  42. set tail [file tail $testfile]
  43. if {[lsearch -exact $EXCLUDE $tail]>=0} continue
  44. source $testfile
  45. }
  46. if {[info exists Leak]} {
  47. lappend LeakList $Leak
  48. }
  49. }
  50. # Do one last test to look for a memory leak in the library. This will
  51. # only work if SQLite is compiled with the -DMEMORY_DEBUG=1 flag.
  52. #
  53. if {$LeakList!=""} {
  54. puts -nonewline memory-leak-test...
  55. incr ::nTest
  56. foreach x $LeakList {
  57. if {$x!=[lindex $LeakList 0]} {
  58. puts " failed!"
  59. puts "Expected: all values to be the same"
  60. puts " Got: $LeakList"
  61. incr ::nErr
  62. lappend ::failList memory-leak-test
  63. break
  64. }
  65. }
  66. puts " Ok"
  67. }
  68. # Run the malloc tests and the misuse test after memory leak detection.
  69. # Both tests leak memory.
  70. #
  71. catch {source $testdir/misuse.test}
  72. catch {source $testdir/malloc.test}
  73. really_finish_test