malloc6.test 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # 2006 June 25
  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 attempts to check the library in an out-of-memory situation.
  12. #
  13. # $Id: malloc6.test,v 1.5 2008/02/18 22:24:58 drh Exp $
  14. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. source $testdir/malloc_common.tcl
  17. # Only run these tests if memory debugging is turned on.
  18. #
  19. if {!$MEMDEBUG} {
  20. puts "Skipping malloc6 tests: not compiled with -DSQLITE_MEMDEBUG..."
  21. finish_test
  22. return
  23. }
  24. set sqlite_os_trace 0
  25. do_malloc_test malloc6-1 -tclprep {
  26. db close
  27. } -tclbody {
  28. if {[catch {sqlite3 db test.db}]} {
  29. error "out of memory"
  30. }
  31. sqlite3_extended_result_codes db 1
  32. } -sqlbody {
  33. DROP TABLE IF EXISTS t1;
  34. CREATE TABLE IF NOT EXISTS t1(
  35. a int, b float, c double, d text, e varchar(20),
  36. primary key(a,b,c)
  37. );
  38. CREATE TABLE IF NOT EXISTS t1(
  39. a int, b float, c double, d text, e varchar(20),
  40. primary key(a,b,c)
  41. );
  42. DROP TABLE IF EXISTS t1;
  43. }
  44. # Ensure that no file descriptors were leaked.
  45. do_test malloc6-1.X {
  46. catch {db close}
  47. set sqlite_open_file_count
  48. } {0}
  49. finish_test