mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Add experimental unix-only file-control to grow and truncate the database file by a configurable chunk size.
FossilOrigin-Name: 7cf0e851d4c5e826ea22ed08291b7c91d7b1abc7
This commit is contained in:
56
test/fallocate.test
Normal file
56
test/fallocate.test
Normal file
@ -0,0 +1,56 @@
|
||||
# 2010 July 28
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {$::tcl_platform(platform)!="unix"} {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
file_control_chunksize_test db main [expr 1024*1024]
|
||||
|
||||
do_test fallocate-1.1 {
|
||||
execsql {
|
||||
PRAGMA page_size = 1024;
|
||||
PRAGMA auto_vacuum = 1;
|
||||
CREATE TABLE t1(a, b);
|
||||
}
|
||||
file size test.db
|
||||
} [expr 1*1024*1024]
|
||||
|
||||
do_test fallocate-1.2 {
|
||||
execsql { INSERT INTO t1 VALUES(1, zeroblob(1024*900)) }
|
||||
file size test.db
|
||||
} [expr 1*1024*1024]
|
||||
|
||||
do_test fallocate-1.3 {
|
||||
execsql { INSERT INTO t1 VALUES(2, zeroblob(1024*900)) }
|
||||
file size test.db
|
||||
} [expr 2*1024*1024]
|
||||
|
||||
do_test fallocate-1.4 {
|
||||
execsql { DELETE FROM t1 WHERE a = 1 }
|
||||
file size test.db
|
||||
} [expr 1*1024*1024]
|
||||
|
||||
do_test fallocate-1.5 {
|
||||
execsql { DELETE FROM t1 WHERE a = 2 }
|
||||
file size test.db
|
||||
} [expr 1*1024*1024]
|
||||
|
||||
do_test fallocate-1.6 {
|
||||
execsql { PRAGMA freelist_count }
|
||||
} {0}
|
||||
|
||||
finish_test
|
Reference in New Issue
Block a user