mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Fix some edge cases with backing up databases that are exactly PENDING_BYTE bytes in size, or just slightly larger. (CVS 6288)
FossilOrigin-Name: 2fc450e8e60248d6111d0b0d2b8f2344f5b89bca
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# 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 $
|
||||
# $Id: backup.test,v 1.8 2009/02/12 17:01:50 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -320,6 +320,35 @@ foreach nDestPgsz {512 1024 2048 4096} {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
do_test backup-3.$iTest.1 {
|
||||
catch { file delete -force test.db }
|
||||
catch { file delete -force test2.db }
|
||||
sqlite3 db test.db
|
||||
set iTab 1
|
||||
|
||||
db eval { PRAGMA page_size = 512 }
|
||||
while {[file size test.db] <= $::sqlite_pending_byte} {
|
||||
db eval "CREATE TABLE t${iTab}(a, b, c)"
|
||||
incr iTab
|
||||
}
|
||||
|
||||
sqlite3 db2 test2.db
|
||||
db2 eval { PRAGMA page_size = 4096 }
|
||||
while {[file size test2.db] < $::sqlite_pending_byte} {
|
||||
db2 eval "CREATE TABLE t${iTab}(a, b, c)"
|
||||
incr iTab
|
||||
}
|
||||
|
||||
sqlite3_backup B db2 main db main
|
||||
B step -1
|
||||
} {SQLITE_DONE}
|
||||
|
||||
do_test backup-3.$iTest.2 {
|
||||
B finish
|
||||
} {SQLITE_OK}
|
||||
|
||||
#
|
||||
# End of backup-3.* tests.
|
||||
#---------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user