1
0

softheap1.test 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # 2007 Aug 10
  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. #
  12. # This test script reproduces the problem reported by ticket #2565,
  13. # A database corruption bug that occurs in auto_vacuum mode when
  14. # the soft_heap_limit is set low enough to be triggered.
  15. #
  16. # $Id: softheap1.test,v 1.5 2008/07/08 17:13:59 danielk1977 Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. ifcapable !integrityck {
  20. finish_test
  21. return
  22. }
  23. do_test softheap1-1.0 {
  24. execsql {PRAGMA soft_heap_limit}
  25. } [sqlite3_soft_heap_limit -1]
  26. do_test softheap1-1.1 {
  27. execsql {PRAGMA soft_heap_limit=123456; PRAGMA soft_heap_limit;}
  28. } {123456 123456}
  29. do_test softheap1-1.2 {
  30. sqlite3_soft_heap_limit -1
  31. } {123456}
  32. do_test softheap1-1.3 {
  33. execsql {PRAGMA soft_heap_limit(-1); PRAGMA soft_heap_limit;}
  34. } {123456 123456}
  35. do_test softheap1-1.4 {
  36. execsql {PRAGMA soft_heap_limit(0); PRAGMA soft_heap_limit;}
  37. } {0 0}
  38. sqlite3_soft_heap_limit 5000
  39. do_test softheap1-2.0 {
  40. execsql {PRAGMA soft_heap_limit}
  41. } {5000}
  42. do_test softheap1-2.1 {
  43. execsql {
  44. PRAGMA auto_vacuum=1;
  45. CREATE TABLE t1(x);
  46. INSERT INTO t1 VALUES(hex(randomblob(1000)));
  47. BEGIN;
  48. }
  49. execsql {
  50. CREATE TABLE t2 AS SELECT * FROM t1;
  51. }
  52. execsql {
  53. ROLLBACK;
  54. }
  55. execsql {
  56. PRAGMA integrity_check;
  57. }
  58. } {ok}
  59. sqlite3_soft_heap_limit $cmdlinearg(soft-heap-limit)
  60. finish_test