PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/src/sqlite/test/mem5.test

#
Unknown | 66 lines | 58 code | 8 blank | 0 comment | 0 complexity | cfe0cd49c3a8f0626aa4ece6d28978f4 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # 2011 March 9
  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 contains tests of the mem5 allocation subsystem.
  13. #
  14. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. ifcapable !mem5 {
  17. finish_test
  18. return
  19. }
  20. # The tests in this file configure the lookaside allocator after a
  21. # connection is opened. This will not work if there is any "presql"
  22. # configured (SQL run within the [sqlite3] wrapper in tester.tcl).
  23. if {[info exists ::G(perm:presql)]} {
  24. finish_test
  25. return
  26. }
  27. do_test mem5-1.1 {
  28. catch {db close}
  29. sqlite3_shutdown
  30. sqlite3_config_heap 25000000 0
  31. sqlite3_config_lookaside 0 0
  32. sqlite3_initialize
  33. } {SQLITE_OK}
  34. # try with min request size = 2^30
  35. do_test mem5-1.2 {
  36. catch {db close}
  37. sqlite3_shutdown
  38. sqlite3_config_heap 1 1073741824
  39. sqlite3_config_lookaside 0 0
  40. sqlite3_initialize
  41. } {SQLITE_NOMEM}
  42. # try with min request size = 2^30+1
  43. # previously this was causing the memsys5Log() func to infinitely loop.
  44. do_test mem5-1.3 {
  45. catch {db close}
  46. sqlite3_shutdown
  47. sqlite3_config_heap 1 1073741825
  48. sqlite3_config_lookaside 0 0
  49. sqlite3_initialize
  50. } {SQLITE_NOMEM}
  51. do_test mem5-1.4 {
  52. catch {db close}
  53. sqlite3_shutdown
  54. sqlite3_config_heap 0 0
  55. sqlite3_config_lookaside 0 0
  56. sqlite3_initialize
  57. } {SQLITE_OK}
  58. finish_test