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

Side by Side Diff: third_party/sqlite/src/test/tkt3457.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/tkt3442.test ('k') | third_party/sqlite/src/test/tkt3461.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 # 2008 October 29
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 # $Id: tkt3457.test,v 1.3 2009/06/26 07:12:07 danielk1977 Exp $
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17
18 if {$tcl_platform(platform) != "unix"} {
19 finish_test
20 return
21 }
22
23 #-----------------------------------------------------------------------
24 # To roll back a hot-journal file, the application needs read and write
25 # permission on the journal file in question. The following tests test
26 # the outcome of trying to rollback a hot-journal file when this is not
27 # the case.
28 #
29 # tkt3457-1.2: Application has neither read, nor write permission on
30 # the hot-journal file. Result: SQLITE_CANTOPEN.
31 #
32 # tkt3457-1.3: Application has write but not read permission on
33 # the hot-journal file. Result: SQLITE_CANTOPEN.
34 #
35 # tkt3457-1.4: Application has read but not write permission on
36 # the hot-journal file. Result: SQLITE_CANTOPEN.
37 #
38 # tkt3457-1.5: Application has read/write permission on the hot-journal
39 # file. Result: SQLITE_OK.
40 #
41 do_test tkt3457-1.1 {
42 execsql {
43 CREATE TABLE t1(a, b, c);
44 INSERT INTO t1 VALUES(1, 2, 3);
45 BEGIN;
46 INSERT INTO t1 VALUES(4, 5, 6);
47 }
48
49 file copy -force test.db bak.db
50 file copy -force test.db-journal bak.db-journal
51
52 # Fix the first journal-header in the journal-file. Because the
53 # journal file has not yet been synced, the 8-byte magic string at the
54 # start of the first journal-header has not been written by SQLite.
55 # So write it now.
56 set fd [open bak.db-journal a+]
57 fconfigure $fd -encoding binary -translation binary
58 seek $fd 0
59 puts -nonewline $fd "\xd9\xd5\x05\xf9\x20\xa1\x63\xd7"
60 close $fd
61
62 execsql COMMIT
63 } {}
64
65 do_test tkt3457-1.2 {
66 file copy -force bak.db-journal test.db-journal
67 file attributes test.db-journal -permissions ---------
68 catchsql { SELECT * FROM t1 }
69 } {1 {unable to open database file}}
70 do_test tkt3457-1.3 {
71 file copy -force bak.db-journal test.db-journal
72 file attributes test.db-journal -permissions -w--w--w-
73 catchsql { SELECT * FROM t1 }
74 } {1 {unable to open database file}}
75 do_test tkt3457-1.4 {
76 file copy -force bak.db-journal test.db-journal
77 file attributes test.db-journal -permissions r--r--r--
78 catchsql { SELECT * FROM t1 }
79 } {1 {unable to open database file}}
80
81 do_test tkt3457-1.5 {
82 file copy -force bak.db-journal test.db-journal
83 file attributes test.db-journal -permissions rw-rw-rw-
84 catchsql { SELECT * FROM t1 }
85 } {0 {1 2 3 4 5 6}}
86
87 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/tkt3442.test ('k') | third_party/sqlite/src/test/tkt3461.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698