SQLite

Check-in [4b0ba23807]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Identify tests that depend on system load and processor speed. (CVS 192)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4b0ba23807a57eaa3649622cff3be66cd75e7561
User & Date: drh 2001-03-15 18:21:22.000
Context
2001-03-15
18:30
Version 1.0.25 (CVS 478) (check-in: 7564b223ab user: drh tags: trunk)
18:21
Identify tests that depend on system load and processor speed. (CVS 192) (check-in: 4b0ba23807 user: drh tags: trunk)
2001-03-14
13:00
Version 1.0.24 (CVS 479) (check-in: 34b17e6ce1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to VERSION.
1
1.0.24
|
1
1.0.25
Changes to test/lock.test.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is database locks.
#
# $Id: lock.test,v 1.5 2001/01/04 14:20:18 drh Exp $

if {$dbprefix=="gdbm:"} {

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Create a largish table
#
do_test lock-1.0 {
  execsql {CREATE TABLE big(f1 int, f2 int, f3 int)}
  set f [open ./testdata1.txt w]
  for {set i 1} {$i<=500} {incr i} {







|





<







19
20
21
22
23
24
25
26
27
28
29
30
31

32
33
34
35
36
37
38
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is database locks.
#
# $Id: lock.test,v 1.6 2001/03/15 18:21:22 drh Exp $

if {$dbprefix=="gdbm:"} {

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Create a largish table
#
do_test lock-1.0 {
  execsql {CREATE TABLE big(f1 int, f2 int, f3 int)}
  set f [open ./testdata1.txt w]
  for {set i 1} {$i<=500} {incr i} {
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  puts $f "WHERE a.f1+b.f1==0.5;"
  close $f
  set ::lock_pid [exec ./sqlite testdb <slow.sql &]
  after 250
  set v {}
} {}

do_test lock-1.2 {
  # Now try to update the database
  #
  set v [catch {execsql {UPDATE big SET f2='xyz' WHERE f1=11}} msg]
  lappend v $msg
} {5 {table big is locked}}

do_test lock-1.3 {
  # Try to update the database in a separate process
  #
  set f [open update.sql w]
  puts $f ".timeout 0"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f
  exec ./sqlite testdb <update.sql
} "UPDATE big SET f2='xyz' WHERE f1=11;\nSQL error: table big is locked\n22"

do_test lock-1.4 {
  # Try to update the database using a timeout
  #
  set f [open update.sql w]
  puts $f ".timeout 1000"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f
  exec ./sqlite testdb <update.sql
} "UPDATE big SET f2='xyz' WHERE f1=11;\nSQL error: table big is locked\n22"

do_test lock-1.5 {
  # Try to update the database using a timeout
  #
  set f [open update.sql w]
  puts $f ".timeout 10000"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f







|






|










|










|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  puts $f "WHERE a.f1+b.f1==0.5;"
  close $f
  set ::lock_pid [exec ./sqlite testdb <slow.sql &]
  after 250
  set v {}
} {}

do_probtest lock-1.2 {
  # Now try to update the database
  #
  set v [catch {execsql {UPDATE big SET f2='xyz' WHERE f1=11}} msg]
  lappend v $msg
} {5 {table big is locked}}

do_probtest lock-1.3 {
  # Try to update the database in a separate process
  #
  set f [open update.sql w]
  puts $f ".timeout 0"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f
  exec ./sqlite testdb <update.sql
} "UPDATE big SET f2='xyz' WHERE f1=11;\nSQL error: table big is locked\n22"

do_probtest lock-1.4 {
  # Try to update the database using a timeout
  #
  set f [open update.sql w]
  puts $f ".timeout 1000"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f
  exec ./sqlite testdb <update.sql
} "UPDATE big SET f2='xyz' WHERE f1=11;\nSQL error: table big is locked\n22"

do_probtest lock-1.5 {
  # Try to update the database using a timeout
  #
  set f [open update.sql w]
  puts $f ".timeout 10000"
  puts $f "UPDATE big SET f2='xyz' WHERE f1=11;"
  puts $f "SELECT f2 FROM big WHERE f1=11;"
  close $f
Changes to test/select2.test.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.9 2000/10/19 14:10:09 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table with some data
#
execsql {CREATE TABLE tbl1(f1 int, f2 int)}







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.10 2001/03/15 18:21:22 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table with some data
#
execsql {CREATE TABLE tbl1(f1 int, f2 int)}
105
106
107
108
109
110
111



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
} {500}
do_test select2-3.2d {
  execsql {SELECT fcnt() FROM tbl2 WHERE 1000=f2}
} {2}
do_test select2-3.2e {
  execsql {SELECT fcnt() FROM tbl2 WHERE f2=1000}
} {2}



testif gdbm:
do_test select2-3.2f {
  set t1 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}} 1] 0]
  set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2=1000}} 1] 0]
  expr {$t1*0.7<$t2 && $t2*0.7<$t1}
} {1}

# Make sure queries run faster with an index than without
#
do_test select2-3.3 {
  set t1 [lindex [time {execsql {SELECT f1 from tbl2 WHERE f2==2000}} 1] 0]
  execsql {DROP INDEX idx1}
  set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2==2000}} 1] 0]
  expr {$t1*10 < $t2}
} {1}
do_test select2-3.4 {
  expr {[execsql {SELECT fcnt() FROM tbl2 WHERE f2==2000}]>10}
} {1}

finish_test







>
>
>

|







|





|




105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
} {500}
do_test select2-3.2d {
  execsql {SELECT fcnt() FROM tbl2 WHERE 1000=f2}
} {2}
do_test select2-3.2e {
  execsql {SELECT fcnt() FROM tbl2 WHERE f2=1000}
} {2}

# omit the time-dependent tests
#
testif gdbm:
do_probtest select2-3.2f {
  set t1 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE 1000=f2}} 1] 0]
  set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2=1000}} 1] 0]
  expr {$t1*0.7<$t2 && $t2*0.7<$t1}
} {1}

# Make sure queries run faster with an index than without
#
do_probtest select2-3.3 {
  set t1 [lindex [time {execsql {SELECT f1 from tbl2 WHERE f2==2000}} 1] 0]
  execsql {DROP INDEX idx1}
  set t2 [lindex [time {execsql {SELECT f1 FROM tbl2 WHERE f2==2000}} 1] 0]
  expr {$t1*10 < $t2}
} {1}
do_probtest select2-3.4 {
  expr {[execsql {SELECT fcnt() FROM tbl2 WHERE f2==2000}]>10}
} {1}

finish_test
Changes to test/tester.tcl.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.10 2001/01/31 13:28:09 drh Exp $

# Create a test database
#
if {![info exists dbprefix]} {
  if {[info exists env(SQLITE_PREFIX)]} {
    set dbprefix $env(SQLITE_PREFIX):
  } else {







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.11 2001/03/15 18:21:22 drh Exp $

# Create a test database
#
if {![info exists dbprefix]} {
  if {[info exists env(SQLITE_PREFIX)]} {
    set dbprefix $env(SQLITE_PREFIX):
  } else {
51
52
53
54
55
56
57

58
59
60
61
62
63
64
#
if {[info exists nTest]} return

# Set the test counters to zero
#
set nErr 0
set nTest 0

set skip_test 0

# Invoke the do_test procedure to run a single test 
#
proc do_test {name cmd expected} {
  global argv nErr nTest skip_test
  if {$skip_test} {







>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
if {[info exists nTest]} return

# Set the test counters to zero
#
set nErr 0
set nTest 0
set nProb 0
set skip_test 0

# Invoke the do_test procedure to run a single test 
#
proc do_test {name cmd expected} {
  global argv nErr nTest skip_test
  if {$skip_test} {
86
87
88
89
90
91
92






































93
94
95
96
97
98
99
  } elseif {[string compare $result $expected]} {
    puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
    incr nErr
  } else {
    puts " Ok"
  }
}







































# Skip a test based on the dbprefix
#
proc skipif {args} {
  foreach a $args {
    if {$::dbprefix==$a} {
      set ::skip_test 1







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
  } elseif {[string compare $result $expected]} {
    puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
    incr nErr
  } else {
    puts " Ok"
  }
}

# Invoke this procedure on a test that is probabilistic
# and might fail sometimes.
#
proc do_probtest {name cmd expected} {
  global argv nProb nTest skip_test
  if {$skip_test} {
    set skip_test 0
    return
  }
  if {[llength $argv]==0} { 
    set go 1
  } else {
    set go 0
    foreach pattern $argv {
      if {[string match $pattern $name]} {
        set go 1
        break
      }
    }
  }
  if {!$go} return
  incr nTest
  puts -nonewline $::dbprefix$name...
  flush stdout
  if {[catch {uplevel #0 "$cmd;\n"} result]} {
    puts "\nError: $result"
    incr nErr
  } elseif {[string compare $result $expected]} {
    puts "\nExpected: \[$expected\]\n     Got: \[$result\]"
    puts "NOTE: The results of the previous test depend on system load"
    puts "and processor speed.  The test may sometimes fail even if the"
    puts "library is working correctly."
    incr nProb	
  } else {
    puts " Ok"
  }
}

# Skip a test based on the dbprefix
#
proc skipif {args} {
  foreach a $args {
    if {$::dbprefix==$a} {
      set ::skip_test 1
127
128
129
130
131
132
133
134
135
136
137




138
139
140
141
142
143
144
145
  set ::Leak [expr {[lindex $r 0]-[lindex $r 1]}]
  # puts "*** $::Leak mallocs have not been freed ***"
}

# Run this routine last
#
proc finish_test {} {
  global nTest nErr
  memleak_check
  catch {db close}
  puts "$nErr errors out of $nTest tests"




  exit $nErr
}

# A procedure to execute SQL
#
proc execsql {sql} {
  # puts "SQL = $sql"
  return [db eval $sql]







|



>
>
>
>
|







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
  set ::Leak [expr {[lindex $r 0]-[lindex $r 1]}]
  # puts "*** $::Leak mallocs have not been freed ***"
}

# Run this routine last
#
proc finish_test {} {
  global nTest nErr nProb
  memleak_check
  catch {db close}
  puts "$nErr errors out of $nTest tests"
  if {$nProb>0} {
    puts "$nProb probabilistic tests also failed, but this does"
    puts "not necessarily indicate a malfunction."
  }
  exit [expr {$nErr>0}]
}

# A procedure to execute SQL
#
proc execsql {sql} {
  # puts "SQL = $sql"
  return [db eval $sql]
Changes to www/changes.tcl.
13
14
15
16
17
18
19









20
21
22
23
24
25
26
27
28


proc chng {date desc} {
  puts "<DT><B>$date</B></DT>"
  puts "<DD><P><UL>$desc</UL></P></DD>"
}










chng {2001 Mar 14 19 (1.0.24)} {
<li>Fix a bug which was causing 
    the UPDATE command to fail on systems where "malloc(0)" returns
    NULL.  The problem does not appear Windows, Linux, or HPUX but does 
    cause the library to fail on QNX.
    </li>
}

chng {2001 Feb 19 (1.0.23)} {







>
>
>
>
>
>
>
>
>
|
|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37


proc chng {date desc} {
  puts "<DT><B>$date</B></DT>"
  puts "<DD><P><UL>$desc</UL></P></DD>"
}

chng {2001 Mar 15 (1.0.25)} {
<li>Modify the test scripts to identify tests that depend on system
    load and processor speed and
    to warn the user that a failure of one of those (rare) tests does
    not necessarily mean the library is malfunctioning.  No changes to
    code.
    </li>
}

chng {2001 Mar 14 (1.0.24)} {
<li>Fix a bug which was causing
    the UPDATE command to fail on systems where "malloc(0)" returns
    NULL.  The problem does not appear Windows, Linux, or HPUX but does 
    cause the library to fail on QNX.
    </li>
}

chng {2001 Feb 19 (1.0.23)} {
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268

chng {2000 June 6} {
<li>Added compound select operators: <B>UNION</b>, <b>UNION ALL</B>,
<b>INTERSECT</b>, and <b>EXCEPT</b></li>
<li>Added support for using <b>(SELECT ...)</b> within expressions</li>
<li>Added support for <b>IN</b> and <b>BETWEEN</b> operators</li>
<li>Added support for <b>GROUP BY</b> and <b>HAVING</b></li>
<li>NULL values are now reported ot the callback as a NULL pointer
    rather than an empty string.</li>
}

chng {2000 June 3} {
<li>Added support for default values on columns of a table.</li>
<li>Improved test coverage.  Fixed a few obscure bugs found by the
improved tests.</li>







|







263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

chng {2000 June 6} {
<li>Added compound select operators: <B>UNION</b>, <b>UNION ALL</B>,
<b>INTERSECT</b>, and <b>EXCEPT</b></li>
<li>Added support for using <b>(SELECT ...)</b> within expressions</li>
<li>Added support for <b>IN</b> and <b>BETWEEN</b> operators</li>
<li>Added support for <b>GROUP BY</b> and <b>HAVING</b></li>
<li>NULL values are now reported to the callback as a NULL pointer
    rather than an empty string.</li>
}

chng {2000 June 3} {
<li>Added support for default values on columns of a table.</li>
<li>Improved test coverage.  Fixed a few obscure bugs found by the
improved tests.</li>