/ Check-in [339941d8]
Login

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

Overview
Comment:Avoid using the "clock" command in test scripts since it is a proc in Tcl8.5 and is thus not available to testfixture. (CVS 3760)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 339941d83ae397d69084f41483afb1ea44d44967
User & Date: drh 2007-03-30 13:01:32
Context
2007-03-30
13:35
Make yypMinor available to the stack overflow callbacks in lemon generated parsers. This does not effect SQLite. (CVS 3761) check-in: 70c8c7e2 user: drh tags: trunk
13:01
Avoid using the "clock" command in test scripts since it is a proc in Tcl8.5 and is thus not available to testfixture. (CVS 3760) check-in: 339941d8 user: drh tags: trunk
11:29
Move the sqlite3_temp_directory global variable out of the OS porting layer and into main.c so that it is more accessible to non-standard OS porting layers. (CVS 3759) check-in: 23653f7a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/misc7.test.

     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13         -# $Id: misc7.test,v 1.4 2007/03/30 09:13:14 danielk1977 Exp $
           13  +# $Id: misc7.test,v 1.5 2007/03/30 13:01:32 drh Exp $
    14     14   
    15     15   set testdir [file dirname $argv0]
    16     16   source $testdir/tester.tcl
    17     17   
    18     18   do_test misc7-1 {
    19     19     c_misuse_test
    20     20   } {}
................................................................................
    96     96     close $fd
    97     97   }
    98     98   db close
    99     99   #
   100    100   # End of tests for out-of-file-descriptors condition.
   101    101   #--------------------------------------------------------------------
   102    102   
          103  +sqlite3 db test.db
   103    104   #--------------------------------------------------------------------
   104    105   # Test that the sqlite3_busy_timeout call seems to delay approximately
   105    106   # the right amount of time.
   106    107   #
   107    108   do_test misc7-6 {
   108    109     sqlite3 db2 test.db
   109         -  sqlite3 db test.db
   110    110     sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000
   111    111     execsql {
   112    112       BEGIN EXCLUSIVE;
   113    113     } db2
   114    114   
   115    115     # Now db2 has an exclusive lock on the database file, and db has
   116    116     # a busy-timeout of 2000 milliseconds. So check that trying to
   117    117     # access the database using connection db delays for at least 1500 ms.
   118    118     #
   119         -  set c1 [clock clicks -milliseconds]
   120         -  catchsql {
   121         -    SELECT * FROM sqlite_master;
   122         -  } db
   123         -  expr {([clock clicks -milliseconds]-$c1) > 1500 ? 1 : 0}
   124         -} {1}
          119  +  set tm [time {
          120  +    set result [catchsql {
          121  +        SELECT * FROM sqlite_master;
          122  +      } db]
          123  +  }]
          124  +  set delay [lindex $tm 0]  ;# In microseconds
          125  +  lappend result [expr {$delay>1500000 && $delay<3000000}]
          126  +} {1 {database is locked} 1}
   125    127   db2 close
          128  +
   126    129   
   127    130   #--------------------------------------------------------------------
   128    131   # Test that nothing goes horribly wrong when attaching a database
   129    132   # after the omit_readlock pragma has been exercised.
   130    133   #
   131    134   do_test misc7-7.1 {
   132    135     file delete -force test2.db
................................................................................
   162    165   
   163    166   #--------------------------------------------------------------------
   164    167   # Improve reported coverage by running some debugging code:
   165    168   #
   166    169   ifcapable vtab {
   167    170     do_test misc7-10 {
   168    171       register_echo_module [sqlite3_connection_pointer db]
   169         -    set sqlite_where_trace 1
   170    172       execsql {
   171    173         CREATE VIRTUAL TABLE t1 USING echo(abc);
   172    174         SELECT a FROM t1 WHERE a = 1 ORDER BY b;
   173    175       }
   174    176     } {1}
   175    177   }
   176    178   
   177    179   finish_test