| OLD | NEW |
| 1 # 2010 July 28 | 1 # 2010 July 28 |
| 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 # The focus of this file is testing the CLI shell tool. | 12 # The focus of this file is testing the CLI shell tool. |
| 13 # These tests are specific to the .stats command. | 13 # These tests are specific to the .stats command. |
| 14 # | 14 # |
| 15 # $Id: shell4.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ | 15 # 2015-03-19: Added tests for .trace |
| 16 # | |
| 17 | 16 |
| 18 # Test plan: | 17 # Test plan: |
| 19 # | 18 # |
| 20 # shell4-1.*: Basic tests specific to the "stats" command. | 19 # shell4-1.*: Basic tests specific to the "stats" command. |
| 20 # shell4-2.*: Basic tests for ".trace" |
| 21 # | 21 # |
| 22 set testdir [file dirname $argv0] | 22 set testdir [file dirname $argv0] |
| 23 source $testdir/tester.tcl | 23 source $testdir/tester.tcl |
| 24 if {$tcl_platform(platform)=="windows"} { | 24 if {$tcl_platform(platform)=="windows"} { |
| 25 set CLI "sqlite3.exe" | 25 set CLI "sqlite3.exe" |
| 26 } else { | 26 } else { |
| 27 set CLI "./sqlite3" | 27 set CLI "./sqlite3" |
| 28 } | 28 } |
| 29 if {![file executable $CLI]} { | 29 if {![file executable $CLI]} { |
| 30 finish_test | 30 finish_test |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 # make sure stats are present when on | 106 # make sure stats are present when on |
| 107 do_test shell4-1.5.2 { | 107 do_test shell4-1.5.2 { |
| 108 set res [catchcmd "test.db" {.stats ON | 108 set res [catchcmd "test.db" {.stats ON |
| 109 SELECT 1; | 109 SELECT 1; |
| 110 }] | 110 }] |
| 111 list [regexp {Memory Used} $res] \ | 111 list [regexp {Memory Used} $res] \ |
| 112 [regexp {Heap Usage} $res] \ | 112 [regexp {Heap Usage} $res] \ |
| 113 [regexp {Autoindex Inserts} $res] | 113 [regexp {Autoindex Inserts} $res] |
| 114 } {1 1 1} | 114 } {1 1 1} |
| 115 | 115 |
| 116 do_test shell4-2.1 { |
| 117 catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace" |
| 118 } {1 {Usage: .trace FILE|off}} |
| 119 do_test shell4-2.2 { |
| 120 catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace off\n.trace off\n" |
| 121 } {0 {}} |
| 122 do_test shell4-2.3 { |
| 123 catchcmd ":memory:" ".trace stdout\n.trace\n.trace off\n.dump\n" |
| 124 } {/^1 {PRAGMA.*Usage:.*}$/} |
| 125 ifcapable trace { |
| 126 do_test shell4-2.4 { |
| 127 catchcmd ":memory:" ".trace stdout\nCREATE TABLE t1(x);SELECT * FROM t1;" |
| 128 } {0 {CREATE TABLE t1(x); |
| 129 SELECT * FROM t1;}} |
| 130 do_test shell4-2.5 { |
| 131 catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace stdout\nSELECT * FROM t1;" |
| 132 } {0 {SELECT * FROM t1;}} |
| 133 } |
| 134 |
| 135 |
| 116 finish_test | 136 finish_test |
| OLD | NEW |