intckfault.test 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # 2024 February 24
  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. source [file join [file dirname [info script]] intck_common.tcl]
  13. set testprefix intckfault
  14. return_if_no_intck
  15. do_execsql_test 1.0 {
  16. CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
  17. INSERT INTO t1 VALUES(1, 2, 3);
  18. INSERT INTO t1 VALUES(2, 'two', 'three');
  19. INSERT INTO t1 VALUES(3, NULL, NULL);
  20. CREATE INDEX i1 ON t1(b, c);
  21. }
  22. do_faultsim_test 1 -faults oom-t* -prep {
  23. } -body {
  24. set ::ic [sqlite3_intck db main]
  25. set nStep 0
  26. while {"SQLITE_OK"==[$::ic step]} {
  27. incr nStep
  28. if {$nStep==3} { $::ic unlock }
  29. }
  30. set res [$::ic error]
  31. $::ic close
  32. set res
  33. } -test {
  34. catch { $::ic close }
  35. faultsim_test_result {0 {SQLITE_OK {}}} {0 {SQLITE_NOMEM {}}} {0 {SQLITE_NOMEM {out of memory}}}
  36. }
  37. finish_test