OLD | NEW |
1 # 2015-05-11 | 1 # 2015-05-11 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 # Quick tests for the sqlite3_analyzer tool | 12 # Quick tests for the sqlite3_analyzer tool |
13 # | 13 # |
14 set testdir [file dirname $argv0] | 14 set testdir [file dirname $argv0] |
15 source $testdir/tester.tcl | 15 source $testdir/tester.tcl |
16 | 16 |
17 ifcapable !vtab { | 17 ifcapable !vtab { |
18 finish_test | 18 finish_test |
19 return | 19 return |
20 } | 20 } |
21 | 21 |
22 if {$tcl_platform(platform)=="windows"} { | 22 if {$tcl_platform(platform)=="windows"} { |
23 set PROG "sqlite3_analyzer.exe" | 23 set PROG "sqlite3_analyzer.exe" |
24 } else { | 24 } else { |
25 set PROG "./sqlite3_analyzer" | 25 set PROG "./sqlite3_analyzer" |
26 } | 26 } |
27 if {![file exe $PROG]} { | 27 if {![file exe $PROG]} { |
28 puts "analyzer1 cannot run because $PROG is not available" | 28 set PROG [file normalize [file join $::cmdlinearg(TESTFIXTURE_HOME) $PROG]] |
29 finish_test | 29 if {![file exe $PROG]} { |
30 return | 30 puts "analyzer1 cannot run because $PROG is not available" |
| 31 finish_test |
| 32 return |
| 33 } |
31 } | 34 } |
32 db close | 35 db close |
33 forcedelete test.db test.db-journal test.db-wal | 36 forcedelete test.db test.db-journal test.db-wal |
34 sqlite3 db test.db | 37 sqlite3 db test.db |
35 | 38 |
36 do_test analyzer1-1.0 { | 39 do_test analyzer1-1.0 { |
37 db eval { | 40 db eval { |
38 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); | 41 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); |
39 CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID; | 42 CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID; |
40 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250) | 43 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250) |
41 INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c; | 44 INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c; |
42 INSERT INTO t2(a,b) SELECT a, b FROM t1; | 45 INSERT INTO t2(a,b) SELECT a, b FROM t1; |
43 } | 46 } |
44 set line "exec $PROG test.db" | 47 set line "exec $PROG test.db" |
45 unset -nocomplain ::MSG | 48 unset -nocomplain ::MSG |
46 catch {eval $line} ::MSG | 49 catch {eval $line} ::MSG |
47 } {0} | 50 } {0} |
48 do_test analyzer1-1.1 { | 51 do_test analyzer1-1.1 { |
49 regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG | 52 regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG |
50 } {1} | 53 } {1} |
51 | 54 |
52 finish_test | 55 finish_test |
OLD | NEW |