blob: ac46704fbafe49e6400e9e56073debe63d62db9d [file] [log] [blame]
drhd13b2312015-05-11 17:46:14 +00001# 2015-05-11
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# Quick tests for the sqlite3_analyzer tool
13#
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
drh6582ae52015-05-12 12:24:50 +000016
17ifcapable !vtab {
18 finish_test
19 return
20}
21
drhd13b2312015-05-11 17:46:14 +000022if {$tcl_platform(platform)=="windows"} {
23 set PROG "sqlite3_analyzer.exe"
24} else {
25 set PROG "./sqlite3_analyzer"
26}
drh905da632015-06-10 18:53:09 +000027if {![file exe $PROG]} {
28 puts "analyzer1 cannot run because $PROG is not available"
29 finish_test
30 return
31}
drhd13b2312015-05-11 17:46:14 +000032db close
33forcedelete test.db test.db-journal test.db-wal
34sqlite3 db test.db
35
36do_test analyzer1-1.0 {
37 db eval {
38 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
39 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)
41 INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c;
42 INSERT INTO t2(a,b) SELECT a, b FROM t1;
43 }
44 set line "exec $PROG test.db"
45 unset -nocomplain ::MSG
46 catch {eval $line} ::MSG
47} {0}
48do_test analyzer1-1.1 {
49 regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG
50} {1}
drh8906b7d2015-05-11 18:48:52 +000051
52finish_test