/ Check-in [232b7ef2]
Login

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

Overview
Comment:Update the misuse.test script so that it will work under Windows. Changes to the speed testing script to support version 2.4.12. (CVS 560)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:232b7ef2c8207eb6d2564a641446267d3dec97af
User & Date: drh 2002-05-10 14:37:31
Context
2002-05-10
14:41
Version 2.4.12 (CVS 561) check-in: 06cdaf1c user: drh tags: trunk
14:37
Update the misuse.test script so that it will work under Windows. Changes to the speed testing script to support version 2.4.12. (CVS 560) check-in: 232b7ef2 user: drh tags: trunk
13:14
Improvements to the SQLITE_MISUSE detection logic. Also added test cases for this logic, including the new test file "misuse.test". (CVS 559) check-in: f42907ce user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to test/misuse.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for the SQLITE_MISUSE detection logic.
    14     14   # This test file leaks memory and file descriptors.
    15     15   #
    16         -# $Id: misuse.test,v 1.1 2002/05/10 13:14:08 drh Exp $
           16  +# $Id: misuse.test,v 1.2 2002/05/10 14:37:31 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # Make sure the test logic works
    22     22   #
    23     23   do_test misuse-1.1 {
    24     24     db close
    25         -  set ::DB [sqlite db test.db]
           25  +  set ::DB [sqlite db test2.db]
    26     26     execsql {
    27     27       CREATE TABLE t1(a,b);
    28     28       INSERT INTO t1 VALUES(1,2);
    29     29     }
    30     30     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
    31     31   } {0 {a b 1 2}}
    32     32   do_test misuse-1.2 {
................................................................................
    54     54     }
    55     55   } {1 {library routine called out of sequence}}
    56     56   
    57     57   # Attempt to register a new SQL function while an sqlite_exec() is active.
    58     58   #
    59     59   do_test misuse-2.1 {
    60     60     db close
    61         -  set ::DB [sqlite db test.db]
           61  +  set ::DB [sqlite db test2.db]
    62     62     execsql {
    63     63       SELECT * FROM t1
    64     64     }
    65     65   } {1 2}
    66     66   do_test misuse-2.2 {
    67     67     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
    68     68   } {0 {a b 1 2}}
................................................................................
    83     83     }
    84     84   } {1 {library routine called out of sequence}}
    85     85   
    86     86   # Attempt to register a new SQL aggregate while an sqlite_exec() is active.
    87     87   #
    88     88   do_test misuse-3.1 {
    89     89     db close
    90         -  set ::DB [sqlite db test.db]
           90  +  set ::DB [sqlite db test2.db]
    91     91     execsql {
    92     92       SELECT * FROM t1
    93     93     }
    94     94   } {1 2}
    95     95   do_test misuse-3.2 {
    96     96     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
    97     97   } {0 {a b 1 2}}
................................................................................
   112    112     }
   113    113   } {1 {library routine called out of sequence}}
   114    114   
   115    115   # Attempt to close the database from an sqlite_exec callback.
   116    116   #
   117    117   do_test misuse-4.1 {
   118    118     db close
   119         -  set ::DB [sqlite db test.db]
          119  +  set ::DB [sqlite db test2.db]
   120    120     execsql {
   121    121       SELECT * FROM t1
   122    122     }
   123    123   } {1 2}
   124    124   do_test misuse-4.2 {
   125    125     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
   126    126   } {0 {a b 1 2}}
................................................................................
   141    141     }
   142    142   } {1 {library routine called out of sequence}}
   143    143   
   144    144   # Attempt to use a database after it has been closed.
   145    145   #
   146    146   do_test misuse-5.1 {
   147    147     db close
   148         -  set ::DB [sqlite db test.db]
          148  +  set ::DB [sqlite db test2.db]
   149    149     execsql {
   150    150       SELECT * FROM t1
   151    151     }
   152    152   } {1 2}
   153    153   do_test misuse-5.2 {
   154    154     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
   155    155   } {0 {a b 1 2}}
   156    156   do_test misuse-5.3 {
   157    157     db close
   158    158     sqlite_exec_printf $::DB {SELECT * FROM t1} {}
   159    159   } {21 {library routine called out of sequence}}
   160    160   
   161    161   finish_test

Changes to tool/speedtest.tcl.

    45     45   #  puts [format $format {SQLite 2.3.2:} $t]
    46     46   #  set t [time "exec ./sqlite-100 s100.db <$sqlfile" 1]
    47     47   #  set t [expr {[lindex $t 0]/1000000.0}]
    48     48   #  puts [format $format {SQLite 2.4 (cache=100):} $t]
    49     49     exec sync; after $delay;
    50     50     set t [time "exec ./sqlite248 s2k.db <$sqlfile" 1]
    51     51     set t [expr {[lindex $t 0]/1000000.0}]
    52         -  puts [format $format {SQLite 2.4:} $t]
           52  +  puts [format $format {SQLite 2.4.8:} $t]
    53     53     exec sync; after $delay;
    54     54     set t [time "exec ./sqlite248 sns.db <$sqlfile" 1]
    55     55     set t [expr {[lindex $t 0]/1000000.0}]
    56         -  puts [format $format {SQLite 2.4 (nosync):} $t]
           56  +  puts [format $format {SQLite 2.4.8 (nosync):} $t]
           57  +  exec sync; after $delay;
           58  +  set t [time "exec ./sqlite2412 s2kb.db <$sqlfile" 1]
           59  +  set t [expr {[lindex $t 0]/1000000.0}]
           60  +  puts [format $format {SQLite 2.4.12:} $t]
           61  +  exec sync; after $delay;
           62  +  set t [time "exec ./sqlite2412 snsb.db <$sqlfile" 1]
           63  +  set t [expr {[lindex $t 0]/1000000.0}]
           64  +  puts [format $format {SQLite 2.4.12 (nosync):} $t]
    57     65   #  set t [time "exec ./sqlite-t1 st1.db <$sqlfile" 1]
    58     66   #  set t [expr {[lindex $t 0]/1000000.0}]
    59     67   #  puts [format $format {SQLite 2.4 (test):} $t]
    60     68     puts "</table>"
    61     69   }
    62     70   
    63     71   # Initialize the environment
................................................................................
    75     83   set fd [open 2kinit.sql w]
    76     84   puts $fd {
    77     85     PRAGMA default_cache_size=2000;
    78     86     PRAGMA default_synchronous=on;
    79     87   }
    80     88   close $fd
    81     89   exec ./sqlite248 s2k.db <2kinit.sql
           90  +exec ./sqlite2412 s2kb.db <2kinit.sql
    82     91   set fd [open nosync-init.sql w]
    83     92   puts $fd {
    84     93     PRAGMA default_cache_size=2000;
    85     94     PRAGMA default_synchronous=off;
    86     95   }
    87     96   close $fd
    88     97   exec ./sqlite248 sns.db <nosync-init.sql
           98  +exec ./sqlite2412 snsb.db <nosync-init.sql
    89     99   set ones {zero one two three four five six seven eight nine
    90    100             ten eleven twelve thirteen fourteen fifteen sixteen seventeen
    91    101             eighteen nineteen}
    92    102   set tens {{} ten twenty thirty forty fifty sixty seventy eighty ninety}
    93    103   proc number_name {n} {
    94    104     if {$n>=1000} {
    95    105       set txt "[number_name [expr {$n/1000}]] thousand"