OLD | NEW |
(Empty) | |
| 1 # 2013 August 27 |
| 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. The |
| 12 # focus of this script is testing the file name handling provided |
| 13 # by the "win32-longpath" VFS. |
| 14 # |
| 15 |
| 16 if {$tcl_platform(platform)!="windows"} return |
| 17 |
| 18 set testdir [file dirname $argv0] |
| 19 source $testdir/tester.tcl |
| 20 set testprefix win32longpath |
| 21 |
| 22 do_test 1.0 { |
| 23 file_control_vfsname db |
| 24 } win32 |
| 25 |
| 26 db close |
| 27 set path [file nativename [get_pwd]] |
| 28 sqlite3 db [file join $path test.db] -vfs win32-longpath |
| 29 |
| 30 do_test 1.1 { |
| 31 file_control_vfsname db |
| 32 } win32-longpath |
| 33 |
| 34 do_test 1.2 { |
| 35 db eval { |
| 36 BEGIN EXCLUSIVE; |
| 37 CREATE TABLE t1(x); |
| 38 INSERT INTO t1 VALUES(1); |
| 39 INSERT INTO t1 VALUES(2); |
| 40 INSERT INTO t1 VALUES(3); |
| 41 INSERT INTO t1 VALUES(4); |
| 42 SELECT x FROM t1 ORDER BY x; |
| 43 COMMIT; |
| 44 } |
| 45 } {1 2 3 4} |
| 46 |
| 47 set longPath(1) \\\\?\\$path\\[pid] |
| 48 make_win32_dir $longPath(1) |
| 49 |
| 50 set longPath(2) $longPath(1)\\[string repeat X 255] |
| 51 make_win32_dir $longPath(2) |
| 52 |
| 53 set longPath(3) $longPath(2)\\[string repeat Y 255] |
| 54 make_win32_dir $longPath(3) |
| 55 |
| 56 set fileName $longPath(3)\\test.db |
| 57 |
| 58 do_test 1.3 { |
| 59 list [catch {sqlite3 db2 [string range $fileName 4 end]} msg] $msg |
| 60 } {1 {unable to open database file}} |
| 61 |
| 62 sqlite3 db3 $fileName -vfs win32-longpath |
| 63 |
| 64 do_test 1.4 { |
| 65 db3 eval { |
| 66 BEGIN EXCLUSIVE; |
| 67 CREATE TABLE t1(x); |
| 68 INSERT INTO t1 VALUES(5); |
| 69 INSERT INTO t1 VALUES(6); |
| 70 INSERT INTO t1 VALUES(7); |
| 71 INSERT INTO t1 VALUES(8); |
| 72 SELECT x FROM t1 ORDER BY x; |
| 73 COMMIT; |
| 74 } |
| 75 } {5 6 7 8} |
| 76 |
| 77 db3 close |
| 78 # puts " Database exists \{[exists_win32_path $fileName]\}" |
| 79 |
| 80 sqlite3 db3 $fileName -vfs win32-longpath |
| 81 |
| 82 do_test 1.5 { |
| 83 db3 eval { |
| 84 PRAGMA journal_mode = WAL; |
| 85 } |
| 86 } {wal} |
| 87 |
| 88 do_test 1.6 { |
| 89 db3 eval { |
| 90 BEGIN EXCLUSIVE; |
| 91 INSERT INTO t1 VALUES(9); |
| 92 INSERT INTO t1 VALUES(10); |
| 93 INSERT INTO t1 VALUES(11); |
| 94 INSERT INTO t1 VALUES(12); |
| 95 SELECT x FROM t1 ORDER BY x; |
| 96 COMMIT; |
| 97 } |
| 98 } {5 6 7 8 9 10 11 12} |
| 99 |
| 100 db3 close |
| 101 # puts " Database exists \{[exists_win32_path $fileName]\}" |
| 102 |
| 103 do_delete_win32_file $fileName |
| 104 # puts " Files remaining \{[find_win32_file $longPath(3)\\*]\}" |
| 105 |
| 106 do_remove_win32_dir $longPath(3) |
| 107 do_remove_win32_dir $longPath(2) |
| 108 do_remove_win32_dir $longPath(1) |
| 109 |
| 110 finish_test |
OLD | NEW |