SQLite

Check-in [5589b9d395]
Login

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

Overview
Comment:Skip tests that require setting detailed unix permissions on files when running on filesystems such as AFP that do not support that capability. (CVS 4866)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5589b9d395fb8267a124d56dd5d7987e57505e3d
User & Date: drh 2008-03-15 14:53:05.000
Context
2008-03-17
09:36
Return an error when an xBestIndex() method indicates that it intends to use the value of an unusable constraint. Related to #2998. (CVS 4867) (check-in: ffd4702795 user: danielk1977 tags: trunk)
2008-03-15
14:53
Skip tests that require setting detailed unix permissions on files when running on filesystems such as AFP that do not support that capability. (CVS 4866) (check-in: 5589b9d395 user: drh tags: trunk)
02:09
Add tests to make sure the busy handler resets. (CVS 4865) (check-in: 5e4df44181 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.18 2008/01/23 12:52:41 drh Exp $

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

do_test misc7-1-misuse {
  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.19 2008/03/15 14:53:05 drh Exp $

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

do_test misc7-1-misuse {
  c_misuse_test
} {}
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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419

420
421
422
423
424
425
426
# 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 {
  # Note that the -readonly flag must be cleared before the -permissions
  # are set. Otherwise, when using tcl 8.5 on mac, the fact that the 
  # -readonly flag is set causes the attempt to set the permissions
  # to fail.
  catch {file attributes test.db-journal -readonly 0}
  catch {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 {
  db eval {
    pragma writable_schema = true;
    UPDATE sqlite_master 
      SET rootpage = $pending_byte_page
      WHERE type = 'table' AND name = 't3';
  }
  execsql {
    SELECT rootpage FROM sqlite_master WHERE type = 'table' AND name = 't3';
  }
} $::pending_byte_page

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

}

# Ticket #2470
#
do_test misc7-18.1 {
  execsql {
    CREATE TABLE table_1 (col_10);







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







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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# 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"} {

  # Some network filesystems (ex: AFP) do not support setting read-only
  # permissions.  Only run these tests if full unix permission setting
  # capabilities are supported.
  #
  file attributes test.db -permissions rw-r--r--
  if {[file attributes test.db -permissions]==0644} {

    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 {
      # Note that the -readonly flag must be cleared before the -permissions
      # are set. Otherwise, when using tcl 8.5 on mac, the fact that the 
      # -readonly flag is set causes the attempt to set the permissions
      # to fail.
      catch {file attributes test.db-journal -readonly 0}
      catch {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 {
      db eval {
        pragma writable_schema = true;
        UPDATE sqlite_master 
          SET rootpage = $pending_byte_page
          WHERE type = 'table' AND name = 't3';
      }
      execsql {
        SELECT rootpage FROM sqlite_master WHERE type = 'table' AND name = 't3';
      }
    } $::pending_byte_page
    
    do_test misc7-17.4 {
      db close
      sqlite3 db test.db
      catchsql {
        SELECT count(*) FROM t3;
      } 
    } {1 {database disk image is malformed}}
  }
}

# Ticket #2470
#
do_test misc7-18.1 {
  execsql {
    CREATE TABLE table_1 (col_10);