1
0

shortread1.test 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # 2007 Sep 13
  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 attempts to duplicate an error scenario seen on a
  13. # customer system using version 3.2.2. The problem appears to
  14. # have been fixed (perhaps by accident) with check-in [3503].
  15. # These tests will prevent an accidental recurrance.
  16. #
  17. # $Id: shortread1.test,v 1.1 2007/09/14 01:48:12 drh Exp $
  18. #
  19. set testdir [file dirname $argv0]
  20. source $testdir/tester.tcl
  21. do_test shortread1-1.1 {
  22. execsql {
  23. CREATE TABLE t1(a TEXT);
  24. BEGIN;
  25. INSERT INTO t1 VALUES(hex(randomblob(5000)));
  26. INSERT INTO t1 VALUES(hex(randomblob(100)));
  27. PRAGMA freelist_count;
  28. }
  29. } {0}
  30. do_test shortread1-1.2 {
  31. execsql {
  32. DELETE FROM t1 WHERE rowid=1;
  33. PRAGMA freelist_count;
  34. }
  35. } {11}
  36. do_test shortread1-1.3 {
  37. sqlite3_release_memory [expr {1024*9}]
  38. execsql {
  39. INSERT INTO t1 VALUES(hex(randomblob(5000)));
  40. PRAGMA freelist_count;
  41. }
  42. } {0}
  43. do_test shortread1-1.4 {
  44. execsql {
  45. COMMIT;
  46. SELECT count(*) FROM t1;
  47. }
  48. } {2}
  49. finish_test