Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: third_party/sqlite/src/test/mmapfault.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/mmap3.test ('k') | third_party/sqlite/src/test/multiplex.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # 2013-05-23
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
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 source $testdir/malloc_common.tcl
16 ifcapable !mmap {
17 finish_test
18 return
19 }
20 set testprefix mmapfault
21
22 set a_string_counter 1
23 proc a_string {n} {
24 global a_string_counter
25 incr a_string_counter
26 string range [string repeat "${a_string_counter}." $n] 1 $n
27 }
28 db func a_string a_string
29
30 do_test 1-pre {
31 execsql {
32 CREATE TABLE t1(a UNIQUE, b UNIQUE);
33 INSERT INTO t1 VALUES(a_string(200), a_string(300));
34 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
35 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
36 }
37 faultsim_save_and_close
38 } {}
39
40
41 do_faultsim_test 1 -prep {
42 faultsim_restore_and_reopen
43 db func a_string a_string
44 execsql {
45 PRAGMA mmap_size = 1000000;
46 PRAGMA cache_size = 5;
47 BEGIN;
48 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
49 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
50 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
51 INSERT INTO t1 SELECT a_string(200), a_string(300) FROM t1;
52 }
53 } -body {
54 execsql { INSERT INTO t1 VALUES(a_string(200), a_string(300)) }
55 } -test {
56 faultsim_test_result {0 {}}
57
58 if {[sqlite3_get_autocommit db]} {
59 sqlite3 db2 test.db
60 set nRow [db2 one {SELECT count(*) FROM t1}]
61 if {$nRow!=4} { error "Database content appears incorrect (1)" }
62 db2 close
63 }
64
65 execsql { INSERT INTO t1 VALUES(a_string(201), a_string(301)) }
66 set nRow [db one {SELECT count(*) FROM t1}]
67 if {$nRow!=5 && $nRow!=66 && $nRow!=65} {
68 error "Database content appears incorrect (2) ($nRow)"
69 }
70
71 catch { execsql COMMIT }
72 }
73
74
75
76 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/mmap3.test ('k') | third_party/sqlite/src/test/multiplex.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698