mallocD.test 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # 2007 Aug 29
  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. # $Id: mallocD.test,v 1.6 2008/02/18 22:24:58 drh Exp $
  13. set testdir [file dirname $argv0]
  14. source $testdir/tester.tcl
  15. source $testdir/malloc_common.tcl
  16. # Only run these tests if memory debugging is turned on.
  17. #
  18. if {!$MEMDEBUG} {
  19. puts "Skipping mallocD tests: not compiled with -DSQLITE_MEMDEBUG..."
  20. finish_test
  21. return
  22. }
  23. db close
  24. sqlite3_simulate_device -char atomic
  25. sqlite3 db test.db -vfs devsym
  26. set PREP {
  27. PRAGMA page_size = 1024;
  28. CREATE TABLE abc(a, b, c);
  29. }
  30. do_malloc_test mallocD-1 -sqlprep $PREP -sqlbody {
  31. INSERT INTO abc VALUES(1, 2, 3);
  32. }
  33. do_malloc_test mallocD-2 -sqlprep $PREP -sqlbody {
  34. BEGIN;
  35. INSERT INTO abc VALUES(1, 2, 3);
  36. INSERT INTO abc VALUES(4, 5, 6);
  37. ROLLBACK;
  38. }
  39. do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody {
  40. BEGIN;
  41. INSERT INTO abc VALUES(1, 2, 3);
  42. INSERT INTO abc VALUES(4, 5, randstr(1500,1500));
  43. COMMIT;
  44. }
  45. ifcapable attach {
  46. do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
  47. ATTACH 'test2.db' AS aux;
  48. BEGIN;
  49. CREATE TABLE aux.def(d, e, f);
  50. INSERT INTO abc VALUES(4, 5, 6);
  51. COMMIT;
  52. }
  53. }
  54. sqlite3_simulate_device -char {}
  55. finish_test