fts5faultG.test 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # 2010 June 15
  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]] fts5_common.tcl]
  13. source $testdir/malloc_common.tcl
  14. set testprefix fts5faultG
  15. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  16. ifcapable !fts5 {
  17. finish_test
  18. return
  19. }
  20. set ::testprefix fts5faultG
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE t1 USING fts5(a);
  23. INSERT INTO t1 VALUES('test renaming the table');
  24. INSERT INTO t1 VALUES(' after it has been written');
  25. INSERT INTO t1 VALUES(' actually other stuff instead');
  26. }
  27. faultsim_save_and_close
  28. do_faultsim_test 1 -faults oom* -prep {
  29. faultsim_restore_and_reopen
  30. execsql {
  31. BEGIN;
  32. DELETE FROM t1 WHERE rowid=2;
  33. }
  34. } -body {
  35. execsql {
  36. DELETE FROM t1;
  37. }
  38. } -test {
  39. catchsql { COMMIT }
  40. faultsim_integrity_check
  41. faultsim_test_result {0 {}}
  42. }
  43. reset_db
  44. do_execsql_test 2.0 {
  45. CREATE VIRTUAL TABLE t1 USING fts5(a, content=, contentless_delete=1);
  46. BEGIN;
  47. INSERT INTO t1 VALUES('here''s some text');
  48. INSERT INTO t1 VALUES('useful stuff, text');
  49. INSERT INTO t1 VALUES('what would we do without text!');
  50. COMMIT;
  51. }
  52. faultsim_save_and_close
  53. do_faultsim_test 2 -faults oom* -prep {
  54. faultsim_restore_and_reopen
  55. execsql {
  56. BEGIN;
  57. DELETE FROM t1 WHERE rowid=2;
  58. }
  59. } -body {
  60. execsql {
  61. INSERT INTO t1(t1) VALUES('optimize');
  62. }
  63. } -test {
  64. faultsim_integrity_check
  65. faultsim_test_result {0 {}}
  66. }
  67. finish_test