Annotation of embedaddon/sqlite3/test/multiplex2.test, revision 1.1

1.1     ! misho       1: # 2010 October 29
        !             2: #
        !             3: # The author disclaims copyright to this source code.  In place of
        !             4: # a legal notice, here is a blessing:
        !             5: #
        !             6: #    May you do good and not evil.
        !             7: #    May you find forgiveness for yourself and forgive others.
        !             8: #    May you share freely, never taking more than you give.
        !             9: #
        !            10: #***********************************************************************
        !            11: #
        !            12: 
        !            13: set testdir [file dirname $argv0]
        !            14: source $testdir/tester.tcl
        !            15: source $testdir/malloc_common.tcl
        !            16: source $testdir/lock_common.tcl
        !            17: 
        !            18: 
        !            19: do_multiclient_test tn {
        !            20:   code1 { catch { sqlite3_multiplex_initialize "" 0 } }
        !            21:   code2 { catch { sqlite3_multiplex_initialize "" 0 } }
        !            22: 
        !            23:   code1 { db close }
        !            24:   code2 { db2 close }
        !            25: 
        !            26:   code1 { sqlite3 db test.db -vfs multiplex }
        !            27:   code2 { sqlite3 db2 test.db -vfs multiplex }
        !            28: 
        !            29:   code1 { sqlite3_multiplex_control db main chunk_size [expr 1024*1024] }
        !            30:   code2 { sqlite3_multiplex_control db2 main chunk_size [expr 1024*1024] }
        !            31: 
        !            32:   sql1 {
        !            33:     CREATE TABLE t1(a, b);
        !            34:     INSERT INTO t1 VALUES(randomblob(10), randomblob(4000));          --    1
        !            35:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    2
        !            36:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    4
        !            37:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    8
        !            38:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   16
        !            39:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   32
        !            40:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   64
        !            41:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  128
        !            42:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  256
        !            43:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  512
        !            44:     SELECT count(*) FROM t1;
        !            45:   } 
        !            46: 
        !            47:   do_test multiplex-1.$tn.1 { sql1 { SELECT count(*) FROM t1 } } 512
        !            48:   do_test multiplex-1.$tn.2 { sql2 { SELECT count(*) FROM t1 } } 512
        !            49:   sql2 { DELETE FROM t1 ; VACUUM }
        !            50:   do_test multiplex-1.$tn.3 { sql1 { SELECT count(*) FROM t1 } } 0
        !            51: 
        !            52:   sql1 {
        !            53:     INSERT INTO t1 VALUES(randomblob(10), randomblob(4000));          --    1
        !            54:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    2
        !            55:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    4
        !            56:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --    8
        !            57:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   16
        !            58:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   32
        !            59:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --   64
        !            60:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  128
        !            61:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  256
        !            62:     INSERT INTO t1 SELECT randomblob(10), randomblob(4000) FROM t1;   --  512
        !            63:     SELECT count(*) FROM t1;
        !            64:   }
        !            65: 
        !            66:   do_test multiplex-1.$tn.4 { sql2 { SELECT count(*) FROM t1 } } 512
        !            67: }
        !            68: 
        !            69: catch { sqlite3_multiplex_shutdown }
        !            70: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>