/ Check-in [2eb79efb]
Login

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

Overview
Comment:Update the multiplex.test script to conform to that found in the "experimental" branch off of trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nx-devkit
Files: files | file ages | folders
SHA1:2eb79efbff9cdab843b172e9fa9fb400c542fab1
User & Date: drh 2011-12-13 15:25:06
Context
2011-12-13
16:40
Add extra tests for the multiplexor VFS. No changes to code. check-in: c7de6f68 user: dan tags: nx-devkit
15:37
Merge the nx-devkit changes into trunk. check-in: 03a70c3d user: drh tags: trunk
15:25
Update the multiplex.test script to conform to that found in the "experimental" branch off of trunk. check-in: 2eb79efb user: drh tags: nx-devkit
15:02
Move the multiplexor changes in the experimental branch (check-ins [255d21499b] and [199f52bced]) into the nx-devkit branch. check-in: eb95d2f7 user: drh tags: nx-devkit
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/multiplex.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   
    13     13   set testdir [file dirname $argv0]
    14     14   source $testdir/tester.tcl
    15     15   source $testdir/malloc_common.tcl
           16  +
           17  +# The tests in this file assume that SQLite is compiled without
           18  +# ENABLE_8_3_NAMES.
           19  +#
           20  +ifcapable 8_3_names {
           21  +  puts -nonewline "SQLite compiled with SQLITE_ENABLE_8_3_NAMES. "
           22  +  puts            "Skipping tests multiplex-*."
           23  +  finish_test
           24  +  return
           25  +}
    16     26   
    17     27   set g_chunk_size [ expr ($::SQLITE_MAX_PAGE_SIZE*16384) ]
    18     28   set g_max_chunks 32
    19     29   
    20     30   # This handles appending the chunk number
    21     31   # to the end of the filename.  if 
    22     32   # SQLITE_MULTIPLEX_EXT_OVWR is defined, then
    23     33   # it overwrites the last 2 bytes of the 
    24     34   # file name with the chunk number.
    25     35   proc multiplex_name {name chunk} {
    26     36     if {$chunk==0} { return $name }
    27         -  set num [format "%02d" $chunk]
           37  +  set num [format "%03d" $chunk]
    28     38     ifcapable {multiplex_ext_overwrite} {
    29     39       set name [string range $name 0 [expr [string length $name]-2-1]]
    30     40     }
    31     41     return $name$num
    32     42   }
    33     43   
    34     44   # This saves off the parameters and calls the 

Added test/multiplex3.test.

            1  +
            2  +# 2011 December 13
            3  +#
            4  +# The author disclaims copyright to this source code.  In place of
            5  +# a legal notice, here is a blessing:
            6  +#
            7  +#    May you do good and not evil.
            8  +#    May you find forgiveness for yourself and forgive others.
            9  +#    May you share freely, never taking more than you give.
           10  +#
           11  +#***********************************************************************
           12  +#
           13  +# This file contains tests for error (IO, OOM etc.) handling when using
           14  +# the multiplexor extension with 8.3 filenames.
           15  +#
           16  +
           17  +set testdir $env(SQLITE_TEST_DIR)
           18  +source $testdir/tester.tcl
           19  +source $testdir/malloc_common.tcl
           20  +set ::testprefix multiplex3
           21  +
           22  +ifcapable !8_3_names {
           23  +  puts -nonewline "SQLite compiled without SQLITE_ENABLE_8_3_NAMES. "
           24  +  puts            "Skipping tests zipvfsD-*."
           25  +  finish_test
           26  +  return
           27  +}
           28  +
           29  +db close
           30  +sqlite3_shutdown
           31  +sqlite3_config_uri 1
           32  +autoinstall_test_functions
           33  +
           34  +sqlite3_multiplex_initialize "" 1
           35  +
           36  +proc destroy_vfs_stack {} {
           37  +  generic_unregister stack
           38  +  sqlite3_multiplex_shutdown
           39  +}
           40  +
           41  +proc multiplex_delete_db {} {
           42  +  forcedelete test.db
           43  +  for {set i 1} {$i <= 1000} {incr i} {
           44  +    forcedelete test.[format %03d $i]
           45  +  }
           46  +}
           47  +
           48  +# Procs to save and restore the current muliplexed database.
           49  +#
           50  +proc multiplex_save_db {} {
           51  +  foreach f [glob -nocomplain sv_test.*] { forcedelete $f }
           52  +  foreach f [glob -nocomplain test.*]    { forcecopy $f "sv_$f" }
           53  +}
           54  +proc multiplex_restore_db {} {
           55  +  foreach f [glob -nocomplain test.*]    {forcedelete $f}
           56  +  foreach f [glob -nocomplain sv_test.*] {forcecopy $f [string range $f 3 end]} }
           57  +
           58  +
           59  +do_test 1.0 {
           60  +  multiplex_delete_db
           61  +  sqlite3 db file:test.db?8_3_names=1
           62  +  sqlite3_multiplex_control db main chunk_size [expr 256*1024]
           63  +  execsql {
           64  +    CREATE TABLE t1(a PRIMARY KEY, b);
           65  +    INSERT INTO t1 VALUES(randomblob(15), randomblob(2000));
           66  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --   2
           67  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --   4
           68  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --   8
           69  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --  16
           70  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --  32
           71  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    --  64
           72  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    -- 128
           73  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    -- 256
           74  +    INSERT INTO t1 SELECT randomblob(15), randomblob(2000) FROM t1;    -- 512
           75  +  }
           76  +  set ::cksum1 [execsql {SELECT md5sum(a, b) FROM t1 ORDER BY a}]
           77  +  db close
           78  +  multiplex_save_db
           79  +} {}
           80  +
           81  +do_faultsim_test 1 -prep {
           82  +  multiplex_restore_db
           83  +  sqlite3 db file:test.db?8_3_names=1
           84  +  sqlite3_multiplex_control db main chunk_size [expr 256*1024]
           85  +} -body {
           86  +  execsql "UPDATE t1 SET a=randomblob(12), b=randomblob(1500) WHERE (rowid%32)=0"
           87  +} -test {
           88  +  faultsim_test_result {0 {}}
           89  +  if {$testrc!=0} {
           90  +    set cksum2 [execsql {SELECT md5sum(a, b) FROM t1 ORDER BY a}]
           91  +    if {$cksum2 != $::cksum1} { error "data mismatch" }
           92  +  }
           93  +}
           94  +
           95  +catch { db close }
           96  +
           97  +sqlite3_multiplex_shutdown
           98  +finish_test
           99  +