File: bdb_vacuum.test

package info (click to toggle)
db5.3 5.3.28%2Bdfsg2-9
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 158,620 kB
  • sloc: ansic: 448,573; java: 111,824; tcl: 80,544; sh: 44,264; cs: 33,697; cpp: 21,600; perl: 14,557; xml: 10,799; makefile: 4,028; javascript: 1,998; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (100 lines) | stat: -rw-r--r-- 2,015 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
#    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.
#
#***********************************************************************
# This file implements tests for some Berkeley DB specific
# vacuum pragmas.
#


set testdir [file dirname $argv0]/../../lang/sql/sqlite/test
source $testdir/tester.tcl
reset_db

# Test that bdbsql_vacuum_pragmas pragma works as expected.
#

# Test that bdbsql_vacuum_fillpercent pragma works as expected.
#
do_test bdb_vacuum_pragmas-1.1 {
  execsql {
    PRAGMA bdbsql_vacuum_fillpercent;
  }
} {90}

do_test bdb_vacuum_pragmas-1.2 {
  execsql {
    PRAGMA bdbsql_vacuum_fillpercent=80;
  }
} {80}

# Test boundary
do_test bdb_vacuum_pragmas-1.3 {
  catchsql {
    PRAGMA bdbsql_vacuum_fillpercent=0;
  }
} {1 {Invalid value bdbsql_vacuum_fillpercent 0}}

# Test boundary
do_test bdb_vacuum_pragmas-1.4 {
  execsql {
    PRAGMA bdbsql_vacuum_fillpercent=100;
  }
} {100}

# Test invalid values
do_test bdb_vacuum_pragmas-1.5 {
  catchsql {
    PRAGMA bdbsql_vacuum_fillpercent=-1;
  }
} {1 {Invalid value bdbsql_vacuum_fillpercent -1}}

do_test bdb_vacuum_pragmas-1.6 {
  execsql {
    PRAGMA bdbsql_vacuum_fillpercent;
  }
} {100}

do_test bdb_vacuum_pragmas-1.7 {
  execsql {
    PRAGMA bdbsql_vacuum_fillpercent=90;
  }
} {90}

# Test that pragma bdb_vacuum_pages works as expected.
#
do_test bdb_vacuum_pragmas-2.1 {
  execsql {
    PRAGMA bdbsql_vacuum_pages;
  }
} {128}

do_test bdb_vacuum_pragmas-2.2 {
  execsql {
    PRAGMA bdbsql_vacuum_pages=256;
  }
} {256}

# Test invalid values
do_test bdb_vacuum_pragmas-2.3 {
  catchsql {
    PRAGMA bdbsql_vacuum_pages=0;
  }
} {1 {Invalid value bdbsql_vacuum_pages 0}}

# Test invalid values
do_test bdb_vacuum_pragmas-2.3 {
  catchsql {
    PRAGMA bdbsql_vacuum_pages=-1;
  }
} {1 {Invalid value bdbsql_vacuum_pages -1}}

do_test bdb_vacuum_pragmas-2.4 {
  execsql {
    PRAGMA bdbsql_vacuum_pages;
  }
} {256}

finish_test