/ Check-in [0747b558]
Login

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

Overview
Comment:Ensure the test suite can run with either SQLITE_OMIT_AUTOVACUUM or SQLITE_DEFAULT_AUTOVACUUM=1 defined. (CVS 2087)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0747b55882cf218c03b443e1eadec9eb19889554
User & Date: danielk1977 2004-11-10 15:27:38
Context
2004-11-11
01:50
Add documentation for DEFAULT CURRENT_TIME & co. (CVS 2088) check-in: c85f13f8 user: danielk1977 tags: trunk
2004-11-10
15:27
Ensure the test suite can run with either SQLITE_OMIT_AUTOVACUUM or SQLITE_DEFAULT_AUTOVACUUM=1 defined. (CVS 2087) check-in: 0747b558 user: danielk1977 tags: trunk
12:34
Fix expr.test so that it works when the date-time functions are compiled out of the library. (CVS 2086) check-in: 540ce7de user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
3327
3328
3329
3330
3331
3332
3333


3334
3335
3336
3337
3338
3339
3340
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.176 2004/11/08 09:26:10 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include "pager.h"
#include <assert.h>
#include <string.h>

................................................................................
  */
  pPgOld = pager_lookup(pPager, pgno);
  if( pPgOld ){
    assert( pPgOld->nRef==0 );
    unlinkHashChain(pPager, pPgOld);
    pPgOld->dirty = 0;
    if( pPgOld->needSync ){


      pPg->needSync = 1;
    }
  }

  /* Change the page number for pPg and insert it into the new hash-chain. */
  pPg->pgno = pgno;
  h = pager_hash(pgno);







|







 







>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.177 2004/11/10 15:27:38 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include "pager.h"
#include <assert.h>
#include <string.h>

................................................................................
  */
  pPgOld = pager_lookup(pPager, pgno);
  if( pPgOld ){
    assert( pPgOld->nRef==0 );
    unlinkHashChain(pPager, pPgOld);
    pPgOld->dirty = 0;
    if( pPgOld->needSync ){
      assert( pPgOld->inJournal );
      pPg->inJournal = 1;
      pPg->needSync = 1;
    }
  }

  /* Change the page number for pPg and insert it into the new hash-chain. */
  pPg->pgno = pgno;
  h = pager_hash(pgno);

Changes to src/sqliteInt.h.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
102
103
104
105
106
107
108

109
110
111
112
113
114
115
**    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.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.336 2004/11/09 12:44:39 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
................................................................................
** a minimum.
*/
/* #define SQLITE_OMIT_AUTHORIZATION  1 */
/* #define SQLITE_OMIT_INMEMORYDB     1 */
/* #define SQLITE_OMIT_VACUUM         1 */
/* #define SQLITE_OMIT_DATETIME_FUNCS 1 */
/* #define SQLITE_OMIT_PROGRESS_CALLBACK 1 */


/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
*/
#ifndef offsetof
#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))







|







 







>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
**    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.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.337 2004/11/10 15:27:38 danielk1977 Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
................................................................................
** a minimum.
*/
/* #define SQLITE_OMIT_AUTHORIZATION  1 */
/* #define SQLITE_OMIT_INMEMORYDB     1 */
/* #define SQLITE_OMIT_VACUUM         1 */
/* #define SQLITE_OMIT_DATETIME_FUNCS 1 */
/* #define SQLITE_OMIT_PROGRESS_CALLBACK 1 */
/* #define SQLITE_OMIT_AUTOVACUUM */

/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
*/
#ifndef offsetof
#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))

Changes to src/test1.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
....
2559
2560
2561
2562
2563
2564
2565











2566
2567
2568
2569
2570
2571
2572
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the printf() interface to SQLite.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.108 2004/11/05 23:46:15 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>

................................................................................
  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_REINDEX
  Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
#endif











}

/*
** Register commands with the TCL interpreter.
*/
int Sqlitetest1_Init(Tcl_Interp *interp){
  extern int sqlite3_search_count;







|







 







>
>
>
>
>
>
>
>
>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
....
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing the printf() interface to SQLite.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.109 2004/11/10 15:27:38 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include "os.h"
#include <stdlib.h>
#include <string.h>

................................................................................
  Tcl_SetVar2(interp, "sqlite_options", "bloblit", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_OMIT_REINDEX
  Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY);
#endif

#ifdef SQLITE_OMIT_AUTOVACUUM
  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "0", TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp, "sqlite_options", "autovacuum", "1", TCL_GLOBAL_ONLY);
#if SQLITE_DEFAULT_AUTOVACUUM==0
  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","0",TCL_GLOBAL_ONLY);
#else
  Tcl_SetVar2(interp,"sqlite_options","default_autovacuum","1",TCL_GLOBAL_ONLY);
#endif
#endif /* SQLITE_OMIT_AUTOVACUUM */
}

/*
** Register commands with the TCL interpreter.
*/
int Sqlitetest1_Init(Tcl_Interp *interp){
  extern int sqlite3_search_count;

Changes to test/attach3.test.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
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
101
102
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the ATTACH and DETACH commands
# and schema changes to attached databases.
#
# $Id: attach3.test,v 1.12 2004/11/05 05:20:40 drh Exp $
#


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create tables t1 and t2 in the main database
................................................................................
    SELECT * FROM sqlite_master WHERE name = 't3';
  }
} {}
do_test attach3-1.4 {
  execsql {
    SELECT * FROM aux.sqlite_master WHERE name = 't3';
  }
} {table t3 t3 4 {CREATE TABLE t3(e, f)}}
do_test attach3-1.5 {
  execsql {
    INSERT INTO t3 VALUES(1, 2);
    SELECT * FROM t3;
  }
} {1 2}

................................................................................
    SELECT * FROM sqlite_master WHERE name = 'i1';
  }
} {}
do_test attach3-2.3 {
  execsql {
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {index i1 t3 5 {CREATE INDEX i1 on t3(e)}}

# Drop the index on the aux database table.
do_test attach3-3.1 {
  execsql {
    DROP INDEX aux.i1;
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {}
do_test attach3-3.2 {
  execsql {
    CREATE INDEX aux.i1 on t3(e);
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {index i1 t3 5 {CREATE INDEX i1 on t3(e)}}
do_test attach3-3.3 {
  execsql {
    DROP INDEX i1;
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {}








|







 







|







 







|













|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
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
101
102
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the ATTACH and DETACH commands
# and schema changes to attached databases.
#
# $Id: attach3.test,v 1.13 2004/11/10 15:27:38 danielk1977 Exp $
#


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create tables t1 and t2 in the main database
................................................................................
    SELECT * FROM sqlite_master WHERE name = 't3';
  }
} {}
do_test attach3-1.4 {
  execsql {
    SELECT * FROM aux.sqlite_master WHERE name = 't3';
  }
} "table t3 t3 [expr $AUTOVACUUM?5:4] {CREATE TABLE t3(e, f)}"
do_test attach3-1.5 {
  execsql {
    INSERT INTO t3 VALUES(1, 2);
    SELECT * FROM t3;
  }
} {1 2}

................................................................................
    SELECT * FROM sqlite_master WHERE name = 'i1';
  }
} {}
do_test attach3-2.3 {
  execsql {
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} "index i1 t3 [expr $AUTOVACUUM?6:5] {CREATE INDEX i1 on t3(e)}"

# Drop the index on the aux database table.
do_test attach3-3.1 {
  execsql {
    DROP INDEX aux.i1;
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {}
do_test attach3-3.2 {
  execsql {
    CREATE INDEX aux.i1 on t3(e);
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} "index i1 t3 [expr $AUTOVACUUM?6:5] {CREATE INDEX i1 on t3(e)}"
do_test attach3-3.3 {
  execsql {
    DROP INDEX i1;
    SELECT * FROM aux.sqlite_master WHERE name = 'i1';
  }
} {}

Changes to test/autovacuum.test.

7
8
9
10
11
12
13
14
15
16
17







18
19
20
21
22
23
24
...
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: autovacuum.test,v 1.10 2004/11/08 12:32:50 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl








# Return a string $len characters long. The returned string is $char repeated
# over and over. For example, [make_str abc 8] returns "abcabcab".
proc make_str {char len} {
  set str [string repeat $char. $len]
  return [string range $str 0 [expr $len-1]]
}
................................................................................
do_test autovacuum-3.4 {
  db close
  file delete -force test.db
  sqlite3 db test.db
  execsql {
    PRAGMA auto_vacuum;
  }
} {0}
do_test autovacuum-3.5 {
  execsql {
    CREATE TABLE av1(x);
    PRAGMA auto_vacuum;
  }
} {0}
do_test autovacuum-3.6 {
  execsql {
    PRAGMA auto_vacuum = 1;
    PRAGMA auto_vacuum;
  }
} {0}
do_test autovacuum-3.7 {
  execsql {
    DROP TABLE av1;
  }
  file_pages
} {2}

finish_test








|



>
>
>
>
>
>
>







 







|





|





|





|



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
...
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: autovacuum.test,v 1.11 2004/11/10 15:27:38 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# If this build of the library does not support auto-vacuum, omit this
# whole file.
ifcapable {!autovacuum} {
  finish_test
  return
}

# Return a string $len characters long. The returned string is $char repeated
# over and over. For example, [make_str abc 8] returns "abcabcab".
proc make_str {char len} {
  set str [string repeat $char. $len]
  return [string range $str 0 [expr $len-1]]
}
................................................................................
do_test autovacuum-3.4 {
  db close
  file delete -force test.db
  sqlite3 db test.db
  execsql {
    PRAGMA auto_vacuum;
  }
} $AUTOVACUUM
do_test autovacuum-3.5 {
  execsql {
    CREATE TABLE av1(x);
    PRAGMA auto_vacuum;
  }
} $AUTOVACUUM
do_test autovacuum-3.6 {
  execsql {
    PRAGMA auto_vacuum = 1;
    PRAGMA auto_vacuum;
  }
} $AUTOVACUUM
do_test autovacuum-3.7 {
  execsql {
    DROP TABLE av1;
  }
  file_pages
} [expr $AUTOVACUUM?1:2]

finish_test

Changes to test/btree.test.

7
8
9
10
11
12
13
14
15
16
17
18





19
20
21
22
23
24
25
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is btree database backend
#
# $Id: btree.test,v 1.32 2004/11/10 11:55:14 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl






# Basic functionality.  Open and close a database.
#
do_test btree-1.1 {
  file delete -force test1.bt
  file delete -force test1.bt-journal
  set rc [catch {btree_open test1.bt 2000 0} ::b1]







|




>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is btree database backend
#
# $Id: btree.test,v 1.33 2004/11/10 15:27:38 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable default_autovacuum {
  finish_test
  return
}

# Basic functionality.  Open and close a database.
#
do_test btree-1.1 {
  file delete -force test1.bt
  file delete -force test1.bt-journal
  set rc [catch {btree_open test1.bt 2000 0} ::b1]

Changes to test/enc2.test.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The focus of
# this file is testing the SQLite routines used for converting between the
# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
# UTF-16be).
#
# $Id: enc2.test,v 1.17 2004/06/30 08:20:16 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# The rough organisation of tests in this file is:
#
# enc2.1.*: Simple tests with a UTF-8 db.
................................................................................
    CREATE TABLE abc(a, b, c);
  } db2
} {}
do_test enc2-7.4 {
  execsql {
    SELECT * FROM sqlite_master;
  }
} {table abc abc 2 {CREATE TABLE abc(a, b, c)}}
do_test enc2-7.5 {
  execsql {
    PRAGMA encoding;
  }
} {UTF-8}

db close







|







 







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The focus of
# this file is testing the SQLite routines used for converting between the
# various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
# UTF-16be).
#
# $Id: enc2.test,v 1.18 2004/11/10 15:27:38 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# The rough organisation of tests in this file is:
#
# enc2.1.*: Simple tests with a UTF-8 db.
................................................................................
    CREATE TABLE abc(a, b, c);
  } db2
} {}
do_test enc2-7.4 {
  execsql {
    SELECT * FROM sqlite_master;
  }
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test enc2-7.5 {
  execsql {
    PRAGMA encoding;
  }
} {UTF-8}

db close

Changes to test/insert.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the INSERT statement.
#
# $Id: insert.test,v 1.20 2004/11/07 13:01:50 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Try to insert into a non-existant table.
#
do_test insert-1.1 {
................................................................................
  # Verify that table "test1" begins on page 3.  This should be the same
  # page number used by "t4" above.
  #
  # Update for v3 - the first table now begins on page 2 of each file, not 3.
  execsql {
    SELECT rootpage FROM sqlite_master WHERE name='test1';
  }
} {2}
do_test insert-5.5 {
  # Verify that "t4" begins on page 3.
  #
  # Update for v3 - the first table now begins on page 2 of each file, not 3.
  execsql {
    SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
  }







|







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the INSERT statement.
#
# $Id: insert.test,v 1.21 2004/11/10 15:27:38 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Try to insert into a non-existant table.
#
do_test insert-1.1 {
................................................................................
  # Verify that table "test1" begins on page 3.  This should be the same
  # page number used by "t4" above.
  #
  # Update for v3 - the first table now begins on page 2 of each file, not 3.
  execsql {
    SELECT rootpage FROM sqlite_master WHERE name='test1';
  }
} [expr $AUTOVACUUM?3:2]
do_test insert-5.5 {
  # Verify that "t4" begins on page 3.
  #
  # Update for v3 - the first table now begins on page 2 of each file, not 3.
  execsql {
    SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
  }

Changes to test/interrupt.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is the sqlite_interrupt() API.
#
# $Id: interrupt.test,v 1.6 2004/11/04 04:42:28 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Compute a checksum on the entire database.
#
................................................................................
  interrupt_test interrupt-2.2 {VACUUM} {} 100
}
do_test interrupt-2.3 {
  execsql {
    SELECT md5sum(a || b) FROM t1;
  }
} $cksum
ifcapable vacuum {
  do_test interrupt-2.4 {
    expr {$::origsize>[file size test.db]}
  } 1
}
integrity_check interrupt-2.5

# Ticket #594.  If an interrupt occurs in the middle of a transaction







|







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is the sqlite_interrupt() API.
#
# $Id: interrupt.test,v 1.7 2004/11/10 15:27:38 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Compute a checksum on the entire database.
#
................................................................................
  interrupt_test interrupt-2.2 {VACUUM} {} 100
}
do_test interrupt-2.3 {
  execsql {
    SELECT md5sum(a || b) FROM t1;
  }
} $cksum
ifcapable vacuum&&!$AUTOVACUUM {
  do_test interrupt-2.4 {
    expr {$::origsize>[file size test.db]}
  } 1
}
integrity_check interrupt-2.5

# Ticket #594.  If an interrupt occurs in the middle of a transaction

Changes to test/lock2.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is database locks between competing processes.
#
# $Id: lock2.test,v 1.3 2004/07/22 15:02:26 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Launch another testfixture process to be controlled by this one. A
# channel name is returned that may be passed as the first argument to proc
................................................................................
    COMMIT;
  }
} {0 {}}
do_test lock2-1.9 {
  execsql {
    SELECT * FROM sqlite_master;
  }
} {table abc abc 2 {CREATE TABLE abc(a, b, c)}}
do_test lock2-1.10 {
  testfixture $::tf1 {
    db eval {
      SELECT * FROM sqlite_master;
    }
  }
} {table abc abc 2 {CREATE TABLE abc(a, b, c)}}

catch {testfixture $::tf1 {db close}}
catch {close $::tf1}

finish_test







|







 







|






|





7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is database locks between competing processes.
#
# $Id: lock2.test,v 1.4 2004/11/10 15:27:38 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Launch another testfixture process to be controlled by this one. A
# channel name is returned that may be passed as the first argument to proc
................................................................................
    COMMIT;
  }
} {0 {}}
do_test lock2-1.9 {
  execsql {
    SELECT * FROM sqlite_master;
  }
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"
do_test lock2-1.10 {
  testfixture $::tf1 {
    db eval {
      SELECT * FROM sqlite_master;
    }
  }
} "table abc abc [expr $AUTOVACUUM?3:2] {CREATE TABLE abc(a, b, c)}"

catch {testfixture $::tf1 {db close}}
catch {close $::tf1}

finish_test

Changes to test/pagesize.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.7 2004/11/04 04:42:28 drh Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test pagesize-1.1 {
  execsql {PRAGMA page_size}
................................................................................
    sqlite3 db test.db
    execsql {
      PRAGMA page_size
    }
  } $PGSZ
  do_test pagesize-2.$PGSZ.3 {
    file size test.db
  } [expr {$PGSZ*2}]
  ifcapable {vacuum} {
    do_test pagesize-2.$PGSZ.4 {
      execsql {VACUUM}
    } {}
  }
  integrity_check pagesize-2.$PGSZ.5
  do_test pagesize-2.$PGSZ.6 {







|







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
# This file implements tests for the page_size PRAGMA.
#
# $Id: pagesize.test,v 1.8 2004/11/10 15:27:38 danielk1977 Exp $


set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test pagesize-1.1 {
  execsql {PRAGMA page_size}
................................................................................
    sqlite3 db test.db
    execsql {
      PRAGMA page_size
    }
  } $PGSZ
  do_test pagesize-2.$PGSZ.3 {
    file size test.db
  } [expr {$PGSZ*($AUTOVACUUM?3:2)}]
  ifcapable {vacuum} {
    do_test pagesize-2.$PGSZ.4 {
      execsql {VACUUM}
    } {}
  }
  integrity_check pagesize-2.$PGSZ.5
  do_test pagesize-2.$PGSZ.6 {

Changes to test/tester.tcl.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
237
238
239
240
241
242
243
244
245
246
247





#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.40 2004/11/03 13:59:06 drh Exp $

# Make sure tclsqlite3 was compiled correctly.  Abort now with an
# error message if not.
#
if {[sqlite3 -tcl-uses-utf]} {
  if {"\u1234"=="u1234"} {
    puts stderr "***** BUILD PROBLEM *****"
................................................................................
  }
}

# Evaluate a boolean expression of capabilities.  If true, execute the
# code.  Omit the code if false.
#
proc ifcapable {expr code} {
  regsub -all {[a-z]+} $expr {$::sqlite_options(&)} e2
  if !($e2) return
  return -code [catch {uplevel 1 $code}]
}












|







 







|



>
>
>
>
>
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.41 2004/11/10 15:27:38 danielk1977 Exp $

# Make sure tclsqlite3 was compiled correctly.  Abort now with an
# error message if not.
#
if {[sqlite3 -tcl-uses-utf]} {
  if {"\u1234"=="u1234"} {
    puts stderr "***** BUILD PROBLEM *****"
................................................................................
  }
}

# Evaluate a boolean expression of capabilities.  If true, execute the
# code.  Omit the code if false.
#
proc ifcapable {expr code} {
  regsub -all {[a-z_]+} $expr {$::sqlite_options(&)} e2
  if !($e2) return
  return -code [catch {uplevel 1 $code}]
}

# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)

Changes to test/vacuum.test.

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
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the VACUUM statement.
#
# $Id: vacuum.test,v 1.28 2004/11/04 04:42:28 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# If the VACUUM statement is disabled in the current build, skip all
# the tests in this file.
#
ifcapable {!vacuum} {
  finish_test
  return




}

set fcnt 1
proc cksum {{db db}} {
  set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type"
  set txt [$db eval $sql]\n
  set sql "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"







|










>
>
>
>







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
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the VACUUM statement.
#
# $Id: vacuum.test,v 1.29 2004/11/10 15:27:38 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# If the VACUUM statement is disabled in the current build, skip all
# the tests in this file.
#
ifcapable {!vacuum} {
  finish_test
  return
}
if $AUTOVACUUM {
  finish_test
  return
}

set fcnt 1
proc cksum {{db db}} {
  set sql "SELECT name, type, sql FROM sqlite_master ORDER BY name, type"
  set txt [$db eval $sql]\n
  set sql "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"