summaryrefslogtreecommitdiff
path: root/mptest/crash01.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
commit9f67c0520ea0d5f11a190197cdf746c512db4ce4 (patch)
treec88a33f01f20a3d13a09594f114fffacebd0d1a4 /mptest/crash01.test
parentee20336e9c78d2e3782c8d096b9ab4f6ca8ce95f (diff)
parent569c6676a6ddb0ff73821d7693b5e18ddef809b9 (diff)
Merge tag 'upstream/3.2.0'
Upstream version 3.2.0 # gpg: Signature made Thu 16 Oct 2014 10:51:39 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]"
Diffstat (limited to 'mptest/crash01.test')
-rw-r--r--mptest/crash01.test102
1 files changed, 102 insertions, 0 deletions
diff --git a/mptest/crash01.test b/mptest/crash01.test
new file mode 100644
index 0000000..46f170c
--- /dev/null
+++ b/mptest/crash01.test
@@ -0,0 +1,102 @@
+/* Test cases involving incomplete transactions that must be rolled back.
+*/
+--task 1
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ --sleep 1
+ INSERT INTO t1 VALUES(1, randomblob(2000));
+ INSERT INTO t1 VALUES(2, randomblob(1000));
+ --sleep 1
+ INSERT INTO t1 SELECT a+2, randomblob(1500) FROM t1;
+ INSERT INTO t1 SELECT a+4, randomblob(1500) FROM t1;
+ INSERT INTO t1 SELECT a+8, randomblob(1500) FROM t1;
+ --sleep 1
+ INSERT INTO t1 SELECT a+16, randomblob(1500) FROM t1;
+ --sleep 1
+ INSERT INTO t1 SELECT a+32, randomblob(1500) FROM t1;
+ SELECT count(*) FROM t1;
+ --match 64
+ SELECT avg(length(b)) FROM t1;
+ --match 1500.0
+ --sleep 2
+ UPDATE t1 SET b='x'||a||'y';
+ SELECT sum(length(b)) FROM t1;
+ --match 247
+ SELECT a FROM t1 WHERE b='x17y';
+ --match 17
+ CREATE INDEX t1b ON t1(b);
+ SELECT a FROM t1 WHERE b='x17y';
+ --match 17
+ SELECT a FROM t1 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
+ --match 29 28 27 26 25
+--end
+--wait 1
+--task 2
+ CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t2 SELECT a, b FROM t1;
+ UPDATE t1 SET b='x'||a||'y';
+ SELECT sum(length(b)) FROM t2;
+ --match 247
+ SELECT a FROM t2 WHERE b='x17y';
+ --match 17
+ CREATE INDEX t2b ON t2(b);
+ SELECT a FROM t2 WHERE b='x17y';
+ --match 17
+ SELECT a FROM t2 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
+ --match 29 28 27 26 25
+--end
+--task 3
+ CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t3 SELECT a, b FROM t1;
+ UPDATE t1 SET b='x'||a||'y';
+ SELECT sum(length(b)) FROM t3;
+ --match 247
+ SELECT a FROM t3 WHERE b='x17y';
+ --match 17
+ CREATE INDEX t3b ON t3(b);
+ SELECT a FROM t3 WHERE b='x17y';
+ --match 17
+ SELECT a FROM t3 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
+ --match 29 28 27 26 25
+--end
+--task 4
+ CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t4 SELECT a, b FROM t1;
+ UPDATE t1 SET b='x'||a||'y';
+ SELECT sum(length(b)) FROM t4;
+ --match 247
+ SELECT a FROM t4 WHERE b='x17y';
+ --match 17
+ CREATE INDEX t4b ON t4(b);
+ SELECT a FROM t4 WHERE b='x17y';
+ --match 17
+ SELECT a FROM t4 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
+ --match 29 28 27 26 25
+--end
+--task 5
+ CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
+ INSERT INTO t5 SELECT a, b FROM t1;
+ UPDATE t1 SET b='x'||a||'y';
+ SELECT sum(length(b)) FROM t5;
+ --match 247
+ SELECT a FROM t5 WHERE b='x17y';
+ --match 17
+ CREATE INDEX t5b ON t5(b);
+ SELECT a FROM t5 WHERE b='x17y';
+ --match 17
+ SELECT a FROM t5 WHERE b GLOB 'x2?y' ORDER BY b DESC LIMIT 5;
+ --match 29 28 27 26 25
+--end
+
+--wait all
+/* After the database file has been set up, run the crash2 subscript
+** multiple times. */
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest
+--source crash02.subtest