SQLite

Check-in [da660ea73a]
Login

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

Overview
Comment:Fix the backup.test script so that it works regardless of the value of SQLITE_TEMP_STORE and the initial contents of the file-system. (CVS 6283)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: da660ea73ac6627b4e71706b8cd464646ea66550
User & Date: danielk1977 2009-02-11 15:11:00.000
Context
2009-02-11
15:23
Continuing documentation refinements. Comment changes only. (CVS 6284) (check-in: 83e8308435 user: drh tags: trunk)
15:11
Fix the backup.test script so that it works regardless of the value of SQLITE_TEMP_STORE and the initial contents of the file-system. (CVS 6283) (check-in: da660ea73a user: danielk1977 tags: trunk)
15:04
Add hyperlinks from sqlite3_limit() documention to the limits.html page. Comment changes only - no changes to code. (CVS 6282) (check-in: f0189ec8c9 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/backup.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2009 January 30
#
# 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.  The
# focus of this file is testing the sqlite3_backup_XXX API.
#
# $Id: backup.test,v 1.5 2009/02/09 18:55:46 danielk1977 Exp $

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

#---------------------------------------------------------------------
# Test organization:
#













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 2009 January 30
#
# 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.  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:
#
164
165
166
167
168
169
170





171

172

173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
foreach nPagePerStep {1 200} {

  # Open the databases.
  catch { file delete test.db }
  catch { file delete test2.db }
  eval $zOpenScript






  if {$zDestFile ne ":memory:" || $pgsz_dest == 1024 } {



    if 0 {
      puts -nonewline "Test $iTest: src=$zSrcFile dest=$zDestFile"
      puts -nonewline " (as $db_dest.$file_dest)"
      puts -nonewline " rows_dest=$rows_dest pgsz_dest=$pgsz_dest"
      puts ""
    }

    # Set up the content of the source database.
    execsql {

      BEGIN;
      CREATE TABLE t1(a, b);
      CREATE INDEX i1 ON t1(a, b);
      INSERT INTO t1 VALUES(1, randstr(1000,1000));
      INSERT INTO t1 VALUES(2, randstr(1000,1000));
      INSERT INTO t1 VALUES(3, randstr(1000,1000));
      INSERT INTO t1 VALUES(4, randstr(1000,1000));







>
>
>
>
>
|
>

>









>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
foreach nPagePerStep {1 200} {

  # Open the databases.
  catch { file delete test.db }
  catch { file delete test2.db }
  eval $zOpenScript

  # Set to true if copying to an in-memory destination. Copying to an 
  # in-memory destination is only possible if the initial destination
  # page size is the same as the source page size (in this case 1024 bytes).
  #
  set isMemDest [expr {
    $zDestFile eq ":memory:" || $file_dest eq "temp" && $TEMP_STORE==3
  }]

  if { $isMemDest==0 || $pgsz_dest == 1024 } {
    if 0 {
      puts -nonewline "Test $iTest: src=$zSrcFile dest=$zDestFile"
      puts -nonewline " (as $db_dest.$file_dest)"
      puts -nonewline " rows_dest=$rows_dest pgsz_dest=$pgsz_dest"
      puts ""
    }

    # Set up the content of the source database.
    execsql {
      PRAGMA page_size = 1024;
      BEGIN;
      CREATE TABLE t1(a, b);
      CREATE INDEX i1 ON t1(a, b);
      INSERT INTO t1 VALUES(1, randstr(1000,1000));
      INSERT INTO t1 VALUES(2, randstr(1000,1000));
      INSERT INTO t1 VALUES(3, randstr(1000,1000));
      INSERT INTO t1 VALUES(4, randstr(1000,1000));
347
348
349
350
351
352
353



354



355


356
357
358
359
360
361

362
363
364
365
366
367
368
  catch { sqlite3_backup B db main db2 aux }
} {1}
do_test backup-4.1.4 {
  sqlite3_errmsg db
} {unknown database aux}

do_test backup-4.2.1 {



  execsql { ATTACH 'test3.db' AS aux1 }



  execsql { ATTACH 'test4.db' AS aux2 } db2


  sqlite3_backup B db aux1 db2 aux2
} {B}
do_test backup-4.2.2 {
  catchsql { DETACH aux2 } db2
} {1 {database aux2 is locked}}
do_test backup-4.2.3 {

  B step 50
} {SQLITE_DONE}
do_test backup-4.2.4 {
  B finish
} {SQLITE_OK}

do_test backup-4.3.1 {







>
>
>
|
>
>
>
|
>
>






>







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
  catch { sqlite3_backup B db main db2 aux }
} {1}
do_test backup-4.1.4 {
  sqlite3_errmsg db
} {unknown database aux}

do_test backup-4.2.1 {
  catch { file delete -force test3.db }
  catch { file delete -force test4.db }
  execsql { 
    ATTACH 'test3.db' AS aux1;
    CREATE TABLE aux1.t1(a, b);
  }
  execsql { 
    ATTACH 'test4.db' AS aux2;
    CREATE TABLE aux2.t2(a, b);
  } db2
  sqlite3_backup B db aux1 db2 aux2
} {B}
do_test backup-4.2.2 {
  catchsql { DETACH aux2 } db2
} {1 {database aux2 is locked}}
do_test backup-4.2.3 {
breakpoint
  B step 50
} {SQLITE_DONE}
do_test backup-4.2.4 {
  B finish
} {SQLITE_OK}

do_test backup-4.3.1 {