SQLite

Check-in [c13205d6]
Login

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

Overview
Comment:Do not run the tests in recovercorrupt4.test with the inmemory_journal permutation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c13205d66b8406cccfc937c88ac515fa758fe2ade8b3d30f0c1e79fe974e9600
User & Date: dan 2024-05-20 19:51:06
Context
2024-05-20
19:59
Omit a capi3 test from 2007 that depends upon undefined behavior (UAF). (check-in: a60a0b75 user: drh tags: trunk)
19:51
Do not run the tests in recovercorrupt4.test with the inmemory_journal permutation. (check-in: c13205d6 user: dan tags: trunk)
17:52
Improvements to the documentation of sqlite3_vtab_distinct(). Do not allow sqlite3_vtab_distinct() to return 2 or 3 if the rowid column of the virtual table is used, as doing so might lead to an incorrect answer. (check-in: 08058d66 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/recover/recovercorrupt4.test.

11
12
13
14
15
16
17





18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
#

source [file join [file dirname [info script]] recover_common.tcl]
set testprefix recovercorrupt4

database_may_be_corrupt






do_execsql_test 1.0 {
  CREATE TABLE rows(indexed INTEGER NOT NULL, unindexed INTEGER NOT NULL, filler BLOB NOT NULL DEFAULT 13);
  -- CREATE UNIQUE INDEX rows_index ON rows(indexed);
  INSERT INTO rows(indexed, unindexed, filler) VALUES(1, 1, x'31');
  INSERT INTO rows(indexed, unindexed, filler) VALUES(2, 2, x'32');
  INSERT INTO rows(indexed, unindexed, filler) VALUES(4, 4, x'34');
  INSERT INTO rows(indexed, unindexed, filler) VALUES(8, 8, randomblob(2048));
}

db close

do_test 1.1 {
  set sz [expr [file size test.db] - 1024]
  set fd [open test.db]
  fconfigure $fd -encoding binary -translation binary

  set data [read $fd $sz]
  set fd2 [open test.db2 w]
  fconfigure $fd2 -encoding binary -translation binary
  puts -nonewline $fd2 $data
  close $fd2
  set {} {}
} {}

do_test 1.2 {
  forcedelete test.db3
  sqlite3 db test.db2
  set R [sqlite3_recover_init db main test.db3]
  $R run
  $R finish
} {}

do_test 1.3 {
  sqlite3 db test.db3
  execsql {
    SELECT indexed, unindexed FROM rows
  }
} {1 1 2 2 4 4 8 8}


finish_test








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



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#

source [file join [file dirname [info script]] recover_common.tcl]
set testprefix recovercorrupt4

database_may_be_corrupt

if {[permutation]!="inmemory_journal"} {
  # This test cannot be run with the inmemory_journal permutation, as it
  # must open a truncated, corrupt, database file. With the inmemory_journal
  # permutation, this fails (SQLITE_CORRUPT error) when the [sqlite3] wrapper
  # executes "PRAGMA journal_mode = memory".
  do_execsql_test 1.0 {
    CREATE TABLE rows(indexed INTEGER NOT NULL, unindexed INTEGER NOT NULL, filler BLOB NOT NULL DEFAULT 13);
    -- CREATE UNIQUE INDEX rows_index ON rows(indexed);
    INSERT INTO rows(indexed, unindexed, filler) VALUES(1, 1, x'31');
    INSERT INTO rows(indexed, unindexed, filler) VALUES(2, 2, x'32');
    INSERT INTO rows(indexed, unindexed, filler) VALUES(4, 4, x'34');
    INSERT INTO rows(indexed, unindexed, filler) VALUES(8, 8, randomblob(2048));
  }
  
  db close
  
  do_test 1.1 {
    set sz [expr [file size test.db] - 1024]
    set fd [open test.db]
    fconfigure $fd -encoding binary -translation binary
  
    set data [read $fd $sz]
    set fd2 [open test.db2 w]
    fconfigure $fd2 -encoding binary -translation binary
    puts -nonewline $fd2 $data
    close $fd2
    set {} {}
  } {}
  
  do_test 1.2 {
    forcedelete test.db3
    sqlite3 db test.db2
    set R [sqlite3_recover_init db main test.db3]
    $R run
    $R finish
  } {}
  
  do_test 1.3 {
    sqlite3 db test.db3
    execsql {
      SELECT indexed, unindexed FROM rows
    }
  } {1 1 2 2 4 4 8 8}
}

finish_test