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

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

Issue 694353003: Get `gn gen` to succeed on Windows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove GYP_DEFINES code Created 6 years, 1 month 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/tkt3997.test ('k') | third_party/sqlite/src/test/tokenize.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 # 2009 August 20
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 # This file implements regression tests for SQLite library.
12 #
13 # This file implements tests to verify that ticket #4018 has been
14 # fixed.
15 #
16
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19
20 proc testsql {sql} {
21 set fd [open tf_main.tcl w]
22 puts $fd [subst -nocommands {
23 sqlite3_test_control_pending_byte 0x0010000
24 sqlite3 db test.db
25 set rc [catch { db eval {$sql} } msg]
26 puts -nonewline "[set rc] {[set msg]}"
27 flush stdout
28 exit
29 }]
30 close $fd
31 set fd [open "| [info nameofexec] ./tf_main.tcl" r]
32 set res [read $fd]
33 close $fd
34 return $res
35 }
36
37 do_test tkt4018-1.1 {
38 execsql {
39 CREATE TABLE t1(a, b);
40 BEGIN;
41 SELECT * FROM t1;
42 }
43 } {}
44
45 # The database is locked by connection [db]. Open and close a second
46 # connection to test.db 10000 times. If file-descriptors are not being
47 # reused, then the process will quickly exceed its maximum number of
48 # file descriptors (1024 by default on linux).
49 do_test tkt4018-1.2 {
50 for {set i 0} {$i < 10000} {incr i} {
51 sqlite3 db2 test.db
52 db2 close
53 }
54 } {}
55
56 # Now check that connection [db] is still holding a SHARED lock by
57 # having a second process try to write the db.
58 do_test tkt4018-1.3 {
59 testsql {INSERT INTO t1 VALUES(3, 4)}
60 } {1 {database is locked}}
61
62 # Sanity checking. Have [db] release the lock and then retry the
63 # INSERT from the previous test case.
64 do_test tkt4018-1.4 {
65 db eval COMMIT
66 testsql {INSERT INTO t1 VALUES(3, 4)}
67 } {0 {}}
68
69 # Check that reusing a file descriptor cannot change a read-only
70 # connection into a read-write connection.
71 do_test tkt4018-2.1 {
72 sqlite3 db2 test.db
73 execsql {INSERT INTO t1 VALUES(1, 2)} db2
74 } {}
75 do_test tkt4018-2.2 {
76 execsql {
77 BEGIN;
78 SELECT * FROM t1 ORDER BY a;
79 }
80 } {1 2 3 4}
81 do_test tkt4018-2.3 {
82 db2 close
83 sqlite3 db2 test.db -readonly 1
84 execsql COMMIT
85 catchsql {INSERT INTO t1 VALUES(5, 6)} db2
86 } {1 {attempt to write a readonly database}}
87 db2 close
88
89 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/tkt3997.test ('k') | third_party/sqlite/src/test/tokenize.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698