Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sqlite/blob/master/test/vacuum6.test # sqlite [Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `sqlite / test / vacuum6.test` 113 lines ยท 2342 bytes Raw Blame History 1 # 2016-08-19 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 # This file implements a test for VACUUM on attached databases. 13 # 14 # TESTRUNNER: slow 15 16 set testdir [file dirname $argv0] 17 source $testdir/tester.tcl 18 set testprefix vacuum6 19 20 # If the VACUUM statement is disabled in the current build, skip all 21 # the tests in this file. 22 # 23 ifcapable !vacuum { 24 finish_test 25 return 26 } 27 28 29 do_execsql_test 1.0 { 30 CREATE TABLE t1(x INTEGER PRIMARY KEY, y); 31 INSERT INTO t1 VALUES(1, 1); 32 } {} 33 34 do_execsql_test 1.1 { 35 VACUUM 36 } 37 38 reset_db 39 do_execsql_test 1.2 { 40 CREATE TABLE t1(x,b); 41 CREATE INDEX x1 ON t1(x); 42 CREATE INDEX x2 ON t1(x); 43 CREATE INDEX x3 ON t1(x); 44 INSERT INTO t1 SELECT 2,''; 45 VACUUM; 46 } 47 48 #------------------------------------------------------------------------- 49 # 50 reset_db 51 foreach {tn sz} {1 400 2 4000 3 9999} { 52 reset_db 53 do_execsql_test 2.$tn.1 { 54 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); 55 WITH s(i) AS ( 56 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100 57 ) 58 INSERT INTO t1 SELECT i, randomblob($sz) FROM s; 59 } 60 61 do_execsql_test 2.$tn.2 { 62 vacuum; 63 } 64 65 do_execsql_test 2.$tn.3 { 66 PRAGMA integrity_check; 67 } {ok} 68 } 69 70 reset_db 71 do_execsql_test 3.0 { 72 PRAGMA page_size = 1024; 73 CREATE TABLE t1(x INTEGER PRIMARY KEY, y); 74 INSERT INTO t1 VALUES(2, randomblob(1200)); 75 } {} 76 do_execsql_test 3.1 { 77 PRAGMA page_size = 512; 78 VACUUM; 79 } 80 do_execsql_test 3.2 { 81 PRAGMA integrity_check 82 } {ok} 83 84 #------------------------------------------------------------------------- 85 # 86 reset_db 87 do_execsql_test 4.0 { 88 CREATE TABLE tx(a, b); 89 CREATE INDEX i1 ON tx(b); 90 WITH s(i) AS ( 91 SELECT 8000 UNION ALL SELECT i+1 FROM s WHERE i<10000 92 ) 93 INSERT INTO tx SELECT i, randomblob(i) FROM s; 94 95 SELECT sum(length(b)) FROM tx; 96 } {`18009000`} 97 foreach {tn pgsz av} { 98 1 2048 0 99 2 1024 1 100 3 65536 0 101 4 8192 1 102 5 512 0 103 6 4096 1 104 } { 105 do_execsql_test 4.1.$tn.1 " 106 PRAGMA page_size = $pgsz; 107 PRAGMA auto_vacuum = $av; 108 " 109 do_execsql_test 4.1.$tn.2 VACUUM 110 integrity_check 4.1.$tn.3 111 } 112 113 finish_test