SQLite

Check-in [6bb5aa2be2]
Login

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

Overview
Comment:Fix a couple of test script problems on this branch. Both related to the fact that temp database page sizes can no longer be changed by VACUUM or the backup API after the temp db is populated.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tempfiles-25
Files: files | file ages | folders
SHA1: 6bb5aa2be2a6c5ca66a98a9387b2845507a6bdd2
User & Date: dan 2016-04-27 11:24:42.387
Context
2016-04-29
11:35
Merge latest trunk changes, including test case fixes, with this branch. (check-in: 99794aca7b user: dan tags: tempfiles-25)
2016-04-27
11:24
Fix a couple of test script problems on this branch. Both related to the fact that temp database page sizes can no longer be changed by VACUUM or the backup API after the temp db is populated. (check-in: 6bb5aa2be2 user: dan tags: tempfiles-25)
2016-04-26
17:10
Fix an issue in temptable2.test preventing it from working with SQLITE_DEFAULT_AUTOVACUUM=1 builds. (check-in: e790aac02e user: dan tags: tempfiles-25)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/backup.test.
160
161
162
163
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
} {
  sqlite3 db $zSrcFile
  sqlite3 db2 $zDestFile
  set db_dest db2
  set file_dest temp
}] {
foreach rows_dest {0 3 10} {
foreach pgsz_dest {512 1024 2048} {
foreach nPagePerStep {1 200} {

  # Open the databases.
  catch { delete_file test.db }
  catch { delete_file 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>=2
  }]

  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);







|











<
|
<

<
|
|
|
|
|
|
>
>







160
161
162
163
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
} {
  sqlite3 db $zSrcFile
  sqlite3 db2 $zDestFile
  set db_dest db2
  set file_dest temp
}] {
foreach rows_dest {0 3 10} {
foreach pgsz_dest {512 1024 2048 4096} {
foreach nPagePerStep {1 200} {

  # Open the databases.
  catch { delete_file test.db }
  catch { delete_file 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" }]



  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 ""
  }

  if { $isMemDest==0 || $pgsz_dest==1024 || $rows_dest==0 } {

    # 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);
Changes to test/pagerfault.test.
680
681
682
683
684
685
686
687


688
689
690
691
692
693
694
695
696
697
698
699
700

701
702
703
704
705
706
707
708
709
}

# If TEMP_STORE is 2 or greater, then the database [db2] will be created
# as an in-memory database. This test will not work in that case, as it
# is not possible to change the page-size of an in-memory database. Even
# using the backup API.
#
if {$TEMP_STORE<2} {


  do_faultsim_test pagerfault-14b -prep {
    catch { db2 close }
    faultsim_restore_and_reopen
    sqlite3 db2 ""
    db2 eval { PRAGMA page_size = 4096; CREATE TABLE xx(a) }
  } -body {
    sqlite3_backup B db2 main db main
    B step 200
    set rc [B finish]
    if {[string match SQLITE_IOERR_* $rc]} {set rc SQLITE_IOERR}
    if {$rc != "SQLITE_OK"} { error [sqlite3_test_errstr $rc] }
    set {} {}
  } -test {

    faultsim_test_result {0 {}} {1 {sqlite3_backup_init() failed}}
  }
}

do_faultsim_test pagerfault-14c -prep {
  catch { db2 close }
  faultsim_restore_and_reopen
  sqlite3 db2 test.db2
  db2 eval { 







|
>
>
|
|
|


|
|
|
|
|
|
|
|
>
|
<







680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704

705
706
707
708
709
710
711
}

# If TEMP_STORE is 2 or greater, then the database [db2] will be created
# as an in-memory database. This test will not work in that case, as it
# is not possible to change the page-size of an in-memory database. Even
# using the backup API.
#
# Update: It is no longer possible to change the page size of any temp
# database after it has been created.
#
do_faultsim_test pagerfault-14b -prep {
  catch { db2 close }
  faultsim_restore_and_reopen
    sqlite3 db2 ""
    db2 eval { PRAGMA page_size = 4096; CREATE TABLE xx(a) }
} -body {
  sqlite3_backup B db2 main db main
  B step 200
  set rc [B finish]
  if {[string match SQLITE_IOERR_* $rc]} {set rc SQLITE_IOERR}
  if {$rc != "SQLITE_OK"} { error [sqlite3_test_errstr $rc] }
  set {} {}
} -test {
  faultsim_test_result {1 {attempt to write a readonly database}} \
                       {1 {sqlite3_backup_init() failed}}

}

do_faultsim_test pagerfault-14c -prep {
  catch { db2 close }
  faultsim_restore_and_reopen
  sqlite3 db2 test.db2
  db2 eval {