dan | 0f42f71 | 2022-01-01 19:29:50 +0000 | [diff] [blame] | 1 | # 2022 Jan 01 |
| 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 | # Tests focused on the in-memory journal. |
| 12 | # |
dan | cf2ad7a | 2022-07-18 19:32:30 +0000 | [diff] [blame] | 13 | # TESTRUNNER: slow |
dan | 0f42f71 | 2022-01-01 19:29:50 +0000 | [diff] [blame] | 14 | |
| 15 | set testdir [file dirname $argv0] |
| 16 | source $testdir/tester.tcl |
| 17 | source $testdir/malloc_common.tcl |
| 18 | set testprefix memjournal2 |
| 19 | |
| 20 | do_execsql_test 1.0 { |
| 21 | PRAGMA journal_mode = memory; |
| 22 | CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE); |
| 23 | } {memory} |
| 24 | |
| 25 | set nRow [expr 2000] |
| 26 | |
| 27 | do_execsql_test 1.1 { |
| 28 | BEGIN; |
| 29 | WITH s(i) AS ( |
| 30 | SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<$nRow |
| 31 | ) |
| 32 | INSERT INTO t1 SELECT NULL, randomblob(700) FROM s; |
| 33 | } |
| 34 | |
| 35 | for {set jj 200} {$jj <= 300} {incr jj} { |
| 36 | do_execsql_test 1.2.$jj.1 { |
| 37 | SAVEPOINT one; |
| 38 | UPDATE t1 SET b=randomblob(700) WHERE a<=$jj; |
| 39 | } |
| 40 | do_execsql_test 1.2.$jj.2 { |
| 41 | SAVEPOINT two; |
| 42 | UPDATE t1 SET b=randomblob(700) WHERE a==1; |
| 43 | ROLLBACK TO two; |
| 44 | RELEASE two; |
| 45 | } |
| 46 | do_execsql_test 1.2.$jj.3 { |
| 47 | SAVEPOINT two; |
| 48 | UPDATE t1 SET b=randomblob(700) WHERE a==1; |
| 49 | ROLLBACK TO two; |
| 50 | RELEASE two; |
| 51 | } |
| 52 | |
| 53 | do_execsql_test 1.2.$jj.4 { |
| 54 | PRAGMA integrity_check; |
| 55 | ROLLBACK TO one; |
| 56 | RELEASE one; |
| 57 | } {ok} |
| 58 | } |
| 59 | |
| 60 | |
| 61 | finish_test |
| 62 | |
| 63 | |