SQLite

Check-in [5d0b247ca1]
Login

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

Overview
Comment:Add the start of the soak-test infrastructure. (CVS 4042)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5d0b247ca1667f5d773bda337cb6f58c3b14676a
User & Date: danielk1977 2007-05-30 08:18:04.000
Context
2007-05-30
10:36
Add some extra tests for malloc failure during expression parsing and execution using fuzzily generated SQL. (CVS 4043) (check-in: 7522d2fb32 user: danielk1977 tags: trunk)
08:18
Add the start of the soak-test infrastructure. (CVS 4042) (check-in: 5d0b247ca1 user: danielk1977 tags: trunk)
06:19
Fix a problem with zeroblob() and CAST(...) expressions that could cause an assert() to fail. (CVS 4041) (check-in: 03750a2a6b user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/all.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.42 2007/05/10 17:32:48 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test
proc finish_test {} {
  memleak_check
}












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 2001 September 15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.43 2007/05/30 08:18:04 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test
proc finish_test {} {
  memleak_check
}
57
58
59
60
61
62
63

64
65
66
67
68
69
70
  autovacuum_crash.test
  quick.test
  malloc.test
  misuse.test
  memleak.test
  sqllimits1.test
  fuzz.test

}

# Files to include in the test.  If this list is empty then everything
# that is not in the EXCLUDE list is run.
#
set INCLUDE {
}







>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  autovacuum_crash.test
  quick.test
  malloc.test
  misuse.test
  memleak.test
  sqllimits1.test
  fuzz.test
  soak.test
}

# Files to include in the test.  If this list is empty then everything
# that is not in the EXCLUDE list is run.
#
set INCLUDE {
}
Changes to test/fuzz.test.
15
16
17
18
19
20
21
22
23
24
25
26
27


28
29
30
31
32
33
34
#
# The tests in this file are really about testing fuzzily generated
# SQL parse-trees. The majority of the fuzzily generated SQL is 
# valid as far as the parser is concerned. 
#
# The most complicated trees are for SELECT statements.
#
# $Id: fuzz.test,v 1.12 2007/05/15 07:14:33 danielk1977 Exp $

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

set ::REPEATS 5000


if {[info exists ::ISQUICK]} {
  if {$::ISQUICK} { set ::REPEATS 20 }
}

proc fuzz {TemplateList} {
  set n [llength $TemplateList]
  set i [expr {int(rand()*$n)}]







|





>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#
# The tests in this file are really about testing fuzzily generated
# SQL parse-trees. The majority of the fuzzily generated SQL is 
# valid as far as the parser is concerned. 
#
# The most complicated trees are for SELECT statements.
#
# $Id: fuzz.test,v 1.13 2007/05/30 08:18:04 danielk1977 Exp $

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

set ::REPEATS 5000

# If running quick.test, don't do so many iterations.
if {[info exists ::ISQUICK]} {
  if {$::ISQUICK} { set ::REPEATS 20 }
}

proc fuzz {TemplateList} {
  set n [llength $TemplateList]
  set i [expr {int(rand()*$n)}]
Changes to test/quick.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: quick.test,v 1.56 2007/05/12 09:30:47 danielk1977 Exp $

proc lshift {lvar} {
  upvar $lvar l
  set ret [lindex $l 0]
  set l [lrange $l 1 end]
  return $ret
}








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: quick.test,v 1.57 2007/05/30 08:18:04 danielk1977 Exp $

proc lshift {lvar} {
  upvar $lvar l
  set ret [lindex $l 0]
  set l [lrange $l 1 end]
  return $ret
}
51
52
53
54
55
56
57

58
59
60
61
62
63
64
  malloc.test
  malloc2.test
  malloc3.test
  memleak.test
  misc7.test
  misuse.test
  quick.test

  speed1.test
  speed2.test
  sqllimits1.test

  incrvacuum_ioerr.test
  autovacuum_crash.test
  btree8.test







>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  malloc.test
  malloc2.test
  malloc3.test
  memleak.test
  misc7.test
  misuse.test
  quick.test
  soak.test
  speed1.test
  speed2.test
  sqllimits1.test

  incrvacuum_ioerr.test
  autovacuum_crash.test
  btree8.test
Added test/soak.test.


















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
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
38
39
40
41
42
43
44
45
46
47
48
49
50
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
# 2007 May 24
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file is the driver for the "soak" tests. It is a peer of the
# quick.test and all.test scripts.
#
# $Id: soak.test,v 1.1 2007/05/30 08:18:04 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test
proc finish_test {} {}

# By default, guarantee that the tests will run for at least 1 hour.
#
set TIMEOUT 3600

# Process command-line arguments. 
#
if {[llength $argv]>0} {
  foreach {name value} $argv {
    switch -- $name {
      -timeout {
        set TIMEOUT $value
      }
      default {
         puts stderr "Unknown option: $name"
         exit
      }
    }
  }
}
set argv [list]

# Test plan:
#
# The general principle is to run those SQLite tests that use
# pseudo-random data in some way over and over again for a very 
# long time. The number of tests run depends on the value of 
# global variable $TIMEOUT - tests are run for at least $TIMEOUT 
# seconds.
#
#   fuzz.test   (pseudo-random SQL statements)
#   trans.test  (pseudo-random changes to a database followed by rollbacks)
#
# fuzzy malloc?
#
# Many database changes maintaining some kind of invariant. 
# Storing checksums etc.
#

# List of test files that are run by this file.
#
set SOAKTESTS {
  fuzz.test
  trans.test
}

set ISQUICK 1

set soak_starttime  [clock seconds]
set soak_finishtime [expr {$soak_starttime + $TIMEOUT}]

# Loop until the timeout is reached or an error occurs.
#
for {set iRun 0} {[clock seconds] < $soak_finishtime && $nErr==0} {incr iRun} {

  set iIdx [expr {$iRun % [llength $SOAKTESTS]}]
  source [file join $testdir [lindex $SOAKTESTS $iIdx]]
  catch {db close}

  if {$sqlite_open_file_count>0} {
    puts "$tail did not close all files: $sqlite_open_file_count"
    incr nErr
    lappend ::failList $tail
    set sqlite_open_file_count 0
  }

}

really_finish_test