SQLite

Check-in [339941d83a]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 339941d83ae397d69084f41483afb1ea44d44967
User & Date: drh 2007-03-30 13:01:32.000
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: 70c8c7e2ce 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: 339941d83a 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: 23653f7aab user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to test/misc7.test.
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20












-
+







# 2006 September 4
#
# 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 implements regression tests for SQLite library.
#
# $Id: misc7.test,v 1.4 2007/03/30 09:13:14 danielk1977 Exp $
# $Id: misc7.test,v 1.5 2007/03/30 13:01:32 drh Exp $

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

do_test misc7-1 {
  c_misuse_test
} {}
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
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







+






-









-
-
-
-
-
-
+
+
+
+
+
+
+
+

+







  close $fd
}
db close
#
# End of tests for out-of-file-descriptors condition.
#--------------------------------------------------------------------

sqlite3 db test.db
#--------------------------------------------------------------------
# Test that the sqlite3_busy_timeout call seems to delay approximately
# the right amount of time.
#
do_test misc7-6 {
  sqlite3 db2 test.db
  sqlite3 db test.db
  sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000
  execsql {
    BEGIN EXCLUSIVE;
  } db2

  # Now db2 has an exclusive lock on the database file, and db has
  # a busy-timeout of 2000 milliseconds. So check that trying to
  # access the database using connection db delays for at least 1500 ms.
  #
  set c1 [clock clicks -milliseconds]
  catchsql {
    SELECT * FROM sqlite_master;
  } db
  expr {([clock clicks -milliseconds]-$c1) > 1500 ? 1 : 0}
} {1}
  set tm [time {
    set result [catchsql {
        SELECT * FROM sqlite_master;
      } db]
  }]
  set delay [lindex $tm 0]  ;# In microseconds
  lappend result [expr {$delay>1500000 && $delay<3000000}]
} {1 {database is locked} 1}
db2 close


#--------------------------------------------------------------------
# Test that nothing goes horribly wrong when attaching a database
# after the omit_readlock pragma has been exercised.
#
do_test misc7-7.1 {
  file delete -force test2.db
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179







-









#--------------------------------------------------------------------
# Improve reported coverage by running some debugging code:
#
ifcapable vtab {
  do_test misc7-10 {
    register_echo_module [sqlite3_connection_pointer db]
    set sqlite_where_trace 1
    execsql {
      CREATE VIRTUAL TABLE t1 USING echo(abc);
      SELECT a FROM t1 WHERE a = 1 ORDER BY b;
    }
  } {1}
}

finish_test