SQLite

Check-in [66646d6fda]
Login

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

Overview
Comment:Disable tests in misc7 that do not work on windows due to limitations of the windows file system. (CVS 3873)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 66646d6fda067e19240808aef65fafd8fa177cdd
User & Date: drh 2007-04-25 15:42:26.000
Context
2007-04-25
18:23
Fix segfaults that can occur if a malloc failure happens just before a built-in function calls sqlite3_value_text(). (CVS 3874) (check-in: 9cb0ed6ee9 user: drh tags: trunk)
15:42
Disable tests in misc7 that do not work on windows due to limitations of the windows file system. (CVS 3873) (check-in: 66646d6fda user: drh tags: trunk)
12:07
Version 3.3.17 (CVS 3872) (check-in: 16979f4525 user: drh tags: trunk)
Changes
Unified 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
# 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.12 2007/04/02 12:28:28 danielk1977 Exp $

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

do_test misc7-1 {
  c_misuse_test
} {}












|







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.13 2007/04/25 15:42:26 drh Exp $

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

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

execsql { CREATE TABLE abc(a PRIMARY KEY, b, c); }
db close


do_fileopen_test misc7-6.1 {
  BEGIN;
  INSERT INTO abc VALUES(1, 2, 3);
  INSERT INTO abc VALUES(2, 3, 4);
  INSERT INTO abc SELECT a+2, b, c FROM abc;
  COMMIT;
}

do_fileopen_test misc7-6.2 {
  PRAGMA temp.cache_size = 1000;

}

#
# 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-7.0 {
  sqlite3 db2 test.db
  sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000







>
|
|
|
|
|
|
|
|
|
|
>







>
>
>
>
>
>
>
>







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
  }
  db close
}

execsql { CREATE TABLE abc(a PRIMARY KEY, b, c); }
db close

if {$tcl_platform(platform)!="windows"} {
  do_fileopen_test misc7-6.1 {
    BEGIN;
    INSERT INTO abc VALUES(1, 2, 3);
    INSERT INTO abc VALUES(2, 3, 4);
    INSERT INTO abc SELECT a+2, b, c FROM abc;
    COMMIT;
  }
  
  do_fileopen_test misc7-6.2 {
    PRAGMA temp.cache_size = 1000;
  }
}

#
# End of tests for out-of-file-descriptors condition.
#--------------------------------------------------------------------

sqlite3 db test.db
execsql {
  DELETE FROM abc;
  INSERT INTO abc VALUES(1, 2, 3);
  INSERT INTO abc VALUES(2, 3, 4);
  INSERT INTO abc SELECT a+2, b, c FROM abc;
}
  

#--------------------------------------------------------------------
# Test that the sqlite3_busy_timeout call seems to delay approximately
# the right amount of time.
#
do_test misc7-7.0 {
  sqlite3 db2 test.db
  sqlite3_busy_timeout [sqlite3_connection_pointer db] 2000
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  #
  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







|


<







139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
  #
  set tm [time {
    set result [catchsql {
        SELECT * FROM sqlite_master;
      } db]
  }]
  set delay [lindex $tm 0]  ;# In microseconds
  lappend result [expr {$delay>1500000 && $delay<4000000}]
} {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
346
347
348
349
350
351
352




353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

370
371
372
373
374
375

376
377
378
379
380
381
382
} {ok ok}
set sqlite_pager_n_sort_bucket 0

#----------------------------------------------------------------------
# Test the situation where a hot-journal is discovered but write-access
# to it is denied. This should return SQLITE_BUSY.
#




do_test misc7-17.1 {
  execsql {
    BEGIN;
    DELETE FROM t3 WHERE (oid%3)==0;
  }
  copy_file test.db bak.db
  copy_file test.db-journal bak.db-journal
  execsql {
    COMMIT;
  }

  db close
  copy_file bak.db test.db
  copy_file bak.db-journal test.db-journal
  sqlite3 db test.db

  file attributes test.db-journal -permissions r--------

  catchsql {
    SELECT count(*) FROM t3;
  }
} {1 {database is locked}}
do_test misc7-17.2 {
  file attributes test.db-journal -permissions rw-------

  catchsql {
    SELECT count(*) FROM t3;
  }
} {0 32}

set ::pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
do_test misc7-17.3 {







>
>
>
>
















|
>





|
>







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
} {ok ok}
set sqlite_pager_n_sort_bucket 0

#----------------------------------------------------------------------
# Test the situation where a hot-journal is discovered but write-access
# to it is denied. This should return SQLITE_BUSY.
#
# These tests do not work on windows due to restrictions in the
# windows file system.
#
if {$tcl_platform(platform)!="windows"} {
do_test misc7-17.1 {
  execsql {
    BEGIN;
    DELETE FROM t3 WHERE (oid%3)==0;
  }
  copy_file test.db bak.db
  copy_file test.db-journal bak.db-journal
  execsql {
    COMMIT;
  }

  db close
  copy_file bak.db test.db
  copy_file bak.db-journal test.db-journal
  sqlite3 db test.db

  catch {file attributes test.db-journal -permissions r--------}
  catch {file attributes test.db-journal -readonly 1}
  catchsql {
    SELECT count(*) FROM t3;
  }
} {1 {database is locked}}
do_test misc7-17.2 {
  catch {file attributes test.db-journal -permissions rw-------}
  catch {file attributes test.db-journal -readonly 0}
  catchsql {
    SELECT count(*) FROM t3;
  }
} {0 32}

set ::pending_byte_page [expr ($::sqlite_pending_byte / 1024) + 1]
do_test misc7-17.3 {
394
395
396
397
398
399
400

401
402
403
404
405
do_test misc7-17.4 {
  db close
  sqlite3 db test.db
  catchsql {
    SELECT count(*) FROM t3;
  } 
} {1 {database disk image is malformed}}


db close
file delete -force test.db

finish_test







>





409
410
411
412
413
414
415
416
417
418
419
420
421
do_test misc7-17.4 {
  db close
  sqlite3 db test.db
  catchsql {
    SELECT count(*) FROM t3;
  } 
} {1 {database disk image is malformed}}
}

db close
file delete -force test.db

finish_test