/ Check-in [2522ad1d]
Login

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

Overview
Comment:Updated for Windows compatibility. Test scripts only. (CVS 6285)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2522ad1df3599fa71cd1d929142adaefaf3a4d67
User & Date: shane 2009-02-11 16:06:19
Context
2009-02-12
09:11
Fix a case where during a rollback triggered by an IO or malloc error an unjournalled region of the database could be written to (with it's original data). This was causing an assert in test_journal.c to fail. Add a test case in ioerr2.test to trigger this case. (CVS 6286) check-in: 315a6692 user: danielk1977 tags: trunk
2009-02-11
16:06
Updated for Windows compatibility. Test scripts only. (CVS 6285) check-in: 2522ad1d user: shane tags: trunk
15:23
Continuing documentation refinements. Comment changes only. (CVS 6284) check-in: 83e83084 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/backup.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
557
558
559
560
561
562
563



564
565
566
567
568
569
570
...
592
593
594
595
596
597
598
599
600
601
602

603
604
605
606
607
608
609
...
645
646
647
648
649
650
651
652

653
654
655
656
657
658
659
#    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.  The
# focus of this file is testing the sqlite3_backup_XXX API.
#
# $Id: backup.test,v 1.6 2009/02/11 15:11:00 danielk1977 Exp $

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

#---------------------------------------------------------------------
# Test organization:
#
................................................................................
  } {SQLITE_DONE}
  do_test backup-5.$iTest.4.4 {
    B finish
  } {SQLITE_OK} 
  integrity_check backup-5.$iTest.4.5 db2
  test_contents backup-5.$iTest.4.6 db main db2 main




  catch { file delete bak.db }
  sqlite3 db2 bak.db
  catch { file delete $file }
  sqlite3 db $file
  sqlite3 db3 $file
  do_test backup-5.$iTest.5.1 {
    execsql {
................................................................................
    B step 50
  } {SQLITE_DONE}
  do_test backup-5.$iTest.5.4 {
    B finish
  } {SQLITE_OK} 
  integrity_check backup-5.$iTest.5.5 db2
  test_contents backup-5.$iTest.5.6 db main db2 main
}
catch {db close}
catch {db2 close}
catch {db3 close}

#
# End of backup-5.* tests.
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Test the sqlite3_backup_remaining() and backup_pagecount() APIs.
#
................................................................................
  list [B remaining] [B pagecount]
} [list [expr $nTotal-5] [expr $nTotal+2]]

do_test backup-6.X {
  B finish
} {SQLITE_OK}




#---------------------------------------------------------------------
# Test cases backup-7.* test that SQLITE_BUSY and SQLITE_LOCKED errors
# are returned correctly:
#
# backup-7.1.*: Source database is externally locked (return SQLITE_BUSY).
#







|







 







>
>
>







 







<
|
|
|
>







 







|
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
...
595
596
597
598
599
600
601

602
603
604
605
606
607
608
609
610
611
612
...
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
#    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.  The
# focus of this file is testing the sqlite3_backup_XXX API.
#
# $Id: backup.test,v 1.7 2009/02/11 16:06:19 shane Exp $

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

#---------------------------------------------------------------------
# Test organization:
#
................................................................................
  } {SQLITE_DONE}
  do_test backup-5.$iTest.4.4 {
    B finish
  } {SQLITE_OK} 
  integrity_check backup-5.$iTest.4.5 db2
  test_contents backup-5.$iTest.4.6 db main db2 main

  catch {db close}
  catch {db2 close}
  catch {db3 close}
  catch { file delete bak.db }
  sqlite3 db2 bak.db
  catch { file delete $file }
  sqlite3 db $file
  sqlite3 db3 $file
  do_test backup-5.$iTest.5.1 {
    execsql {
................................................................................
    B step 50
  } {SQLITE_DONE}
  do_test backup-5.$iTest.5.4 {
    B finish
  } {SQLITE_OK} 
  integrity_check backup-5.$iTest.5.5 db2
  test_contents backup-5.$iTest.5.6 db main db2 main

  catch {db close}
  catch {db2 close}
  catch {db3 close}
}
#
# End of backup-5.* tests.
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Test the sqlite3_backup_remaining() and backup_pagecount() APIs.
#
................................................................................
  list [B remaining] [B pagecount]
} [list [expr $nTotal-5] [expr $nTotal+2]]

do_test backup-6.X {
  B finish
} {SQLITE_OK}

catch {db close}
catch {db2 close}

#---------------------------------------------------------------------
# Test cases backup-7.* test that SQLITE_BUSY and SQLITE_LOCKED errors
# are returned correctly:
#
# backup-7.1.*: Source database is externally locked (return SQLITE_BUSY).
#

Changes to test/backup2.test.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
133
134
135
136
137
138
139

140
141
142
143
144








145

146
147
148
149
150
151
152
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the "backup" and "restore" methods
# of the TCL interface - methods which are based on the
# sqlite3_backup_XXX API.
#
# $Id: backup2.test,v 1.1 2009/02/04 22:46:47 drh Exp $

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

# Fill a database with test data.
#
do_test backup2-1 {
................................................................................
do_test backup2-9 {
  set rc [catch {db backup} res]
  lappend rc $res
} {1 {wrong # args: should be "db backup ?DATABASE? FILENAME"}}

# Try to restore from an unreadable file.
#

do_test backup2-10 {
  file delete -force bu3.db
  file mkdir bu3.db
  set rc [catch {db restore temp bu3.db} res]
  lappend rc $res








} {1 {cannot open source database: disk I/O error}}


# Try to restore from something that is not a database file.
#
do_test backup2-11 {
  set rc [catch {db restore temp bu2.db} res]
  lappend rc $res
} {1 {restore failed: file is encrypted or is not a database}}







|







 







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







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the "backup" and "restore" methods
# of the TCL interface - methods which are based on the
# sqlite3_backup_XXX API.
#
# $Id: backup2.test,v 1.2 2009/02/11 16:06:19 shane Exp $

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

# Fill a database with test data.
#
do_test backup2-1 {
................................................................................
do_test backup2-9 {
  set rc [catch {db backup} res]
  lappend rc $res
} {1 {wrong # args: should be "db backup ?DATABASE? FILENAME"}}

# Try to restore from an unreadable file.
#
if {$tcl_platform(platform)=="windows"} {
  do_test backup2-10 {
    file delete -force bu3.db
    file mkdir bu3.db
    set rc [catch {db restore temp bu3.db} res]
    lappend rc $res
  } {1 {cannot open source database: unable to open database file}}
}
if {$tcl_platform(platform)!="windows"} {
  do_test backup2-10 {
    file delete -force bu3.db
    file mkdir bu3.db
    set rc [catch {db restore temp bu3.db} res]
    lappend rc $res
  } {1 {cannot open source database: disk I/O error}}
}

# Try to restore from something that is not a database file.
#
do_test backup2-11 {
  set rc [catch {db restore temp bu2.db} res]
  lappend rc $res
} {1 {restore failed: file is encrypted or is not a database}}