tkt2686.test 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # 2007 Oct 3
  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 file is to test that ticket #2686 has been fixed.
  13. #
  14. # $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $
  15. #
  16. set testdir [file dirname $argv0]
  17. source $testdir/tester.tcl
  18. ifcapable !subquery {
  19. finish_test
  20. return
  21. }
  22. db eval {
  23. PRAGMA page_size=1024;
  24. PRAGMA max_page_count=50;
  25. PRAGMA auto_vacuum=0;
  26. CREATE TABLE filler (fill);
  27. }
  28. for {set i 1} {$i<2000} {incr i} {
  29. do_test tkt2686-$i.1 {
  30. db eval BEGIN
  31. set rc [catch {
  32. while 1 {
  33. db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
  34. }
  35. } msg]
  36. lappend rc $msg
  37. } {1 {database or disk is full}}
  38. do_test tkt2686-$i.2 {
  39. execsql {
  40. DELETE FROM filler
  41. WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
  42. }
  43. } {}
  44. integrity_check tkt2686-$i.3
  45. catch {db eval COMMIT}
  46. }
  47. db close
  48. forcedelete test.db test.db-journal
  49. sqlite3 db test.db
  50. db eval {
  51. PRAGMA page_size=1024;
  52. PRAGMA max_page_count=50;
  53. PRAGMA auto_vacuum=1;
  54. CREATE TABLE filler (fill);
  55. }
  56. for {set i 10000} {$i<12000} {incr i} {
  57. do_test tkt2686-$i.1 {
  58. db eval BEGIN
  59. set rc [catch {
  60. while 1 {
  61. db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
  62. }
  63. } msg]
  64. lappend rc $msg
  65. } {1 {database or disk is full}}
  66. do_test tkt2686-$i.2 {
  67. execsql {
  68. DELETE FROM filler
  69. WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
  70. }
  71. } {}
  72. integrity_check tkt2686-$i.3
  73. catch {db eval COMMIT}
  74. }
  75. finish_test