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

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/multiplex4.test

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. 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
OLDNEW
(Empty)
1 # 2014-09-25
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 # This file contains tests for the "truncate" option in the multiplexor.
13 #
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set ::testprefix multiplex4
18
19 db close
20 sqlite3_shutdown
21 sqlite3_multiplex_initialize {} 0
22
23 # delete all filesl with the base name of $basename
24 #
25 proc multiplex_delete_db {basename} {
26 foreach file [glob -nocomplain $basename.*] {
27 forcedelete $file
28 }
29 }
30
31 # Return a sorted list of all files with the base name of $basename.
32 # Except, delete all text from the end of $basename through the NNN
33 # suffix on the end of the filename.
34 #
35 proc multiplex_file_list {basename} {
36 set x {}
37 foreach file [glob -nocomplain $basename.*] {
38 regsub "^$basename\\..*(\\d\\d\\d)\$" $file $basename.\\1 file
39 lappend x $file
40 }
41 return [lsort $x]
42 }
43
44 do_test multiplex4-1.0 {
45 multiplex_delete_db mx4test
46 sqlite3 db {file:mx4test.db?chunksize=10&truncate=1} -uri 1 -vfs multiplex
47 db eval {
48 CREATE TABLE t1(x);
49 INSERT INTO t1(x) VALUES(randomblob(250000));
50 }
51 multiplex_file_list mx4test
52 } {mx4test.001 mx4test.db}
53
54 do_test multiplex4-1.1 {
55 db eval {
56 DELETE FROM t1;
57 VACUUM;
58 }
59 multiplex_file_list mx4test
60 } {mx4test.db}
61
62 do_test multiplex4-1.2 {
63 db eval {PRAGMA multiplex_truncate}
64 } {on}
65 do_test multiplex4-1.3 {
66 db eval {PRAGMA multiplex_truncate=off}
67 } {off}
68 do_test multiplex4-1.4 {
69 db eval {PRAGMA multiplex_truncate}
70 } {off}
71 do_test multiplex4-1.5 {
72 db eval {PRAGMA multiplex_truncate=on}
73 } {on}
74 do_test multiplex4-1.6 {
75 db eval {PRAGMA multiplex_truncate}
76 } {on}
77 do_test multiplex4-1.7 {
78 db eval {PRAGMA multiplex_truncate=0}
79 } {off}
80 do_test multiplex4-1.8 {
81 db eval {PRAGMA multiplex_truncate=1}
82 } {on}
83 do_test multiplex4-1.9 {
84 db eval {PRAGMA multiplex_truncate=0}
85 } {off}
86
87 do_test multiplex4-1.10 {
88 db eval {
89 INSERT INTO t1(x) VALUES(randomblob(250000));
90 }
91 multiplex_file_list mx4test
92 } {mx4test.001 mx4test.db}
93
94 do_test multiplex4-1.11 {
95 db eval {
96 DELETE FROM t1;
97 VACUUM;
98 }
99 multiplex_file_list mx4test
100 } {mx4test.001 mx4test.db}
101
102 do_test multiplex4-1.12 {
103 db eval {
104 PRAGMA multiplex_truncate=ON;
105 DROP TABLE t1;
106 VACUUM;
107 }
108 multiplex_file_list mx4test
109 } {mx4test.db}
110
111 catch { db close }
112 forcedelete mx4test.db
113 sqlite3_multiplex_shutdown
114 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/multiplex3.test ('k') | third_party/sqlite/sqlite-src-3080704/test/mutex1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698