summaryrefslogtreecommitdiffstats
path: root/test/memjournal2.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
commit63847496f14c813a5d80efd5b7de0f1294ffe1e3 (patch)
tree01c7571c7c762ceee70638549a99834fdd7c411b /test/memjournal2.test
parentInitial commit. (diff)
downloadsqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.tar.xz
sqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.zip
Adding upstream version 3.45.1.upstream/3.45.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/memjournal2.test')
-rw-r--r--test/memjournal2.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/memjournal2.test b/test/memjournal2.test
new file mode 100644
index 0000000..d08bcb5
--- /dev/null
+++ b/test/memjournal2.test
@@ -0,0 +1,61 @@
+# 2022 Jan 01
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# Tests focused on the in-memory journal.
+#
+# TESTRUNNER: slow
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/malloc_common.tcl
+set testprefix memjournal2
+
+do_execsql_test 1.0 {
+ PRAGMA journal_mode = memory;
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE);
+} {memory}
+
+set nRow [expr 2000]
+
+do_execsql_test 1.1 {
+ BEGIN;
+ WITH s(i) AS (
+ SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<$nRow
+ )
+ INSERT INTO t1 SELECT NULL, randomblob(700) FROM s;
+}
+
+for {set jj 200} {$jj <= 300} {incr jj} {
+ do_execsql_test 1.2.$jj.1 {
+ SAVEPOINT one;
+ UPDATE t1 SET b=randomblob(700) WHERE a<=$jj;
+ }
+ do_execsql_test 1.2.$jj.2 {
+ SAVEPOINT two;
+ UPDATE t1 SET b=randomblob(700) WHERE a==1;
+ ROLLBACK TO two;
+ RELEASE two;
+ }
+ do_execsql_test 1.2.$jj.3 {
+ SAVEPOINT two;
+ UPDATE t1 SET b=randomblob(700) WHERE a==1;
+ ROLLBACK TO two;
+ RELEASE two;
+ }
+
+ do_execsql_test 1.2.$jj.4 {
+ PRAGMA integrity_check;
+ ROLLBACK TO one;
+ RELEASE one;
+ } {ok}
+}
+
+
+finish_test