SQLite

Check-in [8565b7c665]
Login

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

Overview
Comment:Add some code to permutations.test to make sure no test file modifies the shared-cache setting. (CVS 5645)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8565b7c66525dc7808a2a266deb1a0d995c99917
User & Date: danielk1977 2008-08-30 13:25:11.000
Context
2008-08-30
16:07
Run permutation subtests in sorted order. (CVS 5646) (check-in: 4cd1bdf3ce user: drh tags: trunk)
13:25
Add some code to permutations.test to make sure no test file modifies the shared-cache setting. (CVS 5645) (check-in: 8565b7c665 user: danielk1977 tags: trunk)
09:10
Make sure thread003.test waits for all spawned threads to finish before continuing. (CVS 5644) (check-in: 87c7e82f54 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test1.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing all sorts of SQLite interfaces.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.321 2008/08/29 09:10:03 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include <stdlib.h>
#include <string.h>

/*







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Code for testing all sorts of SQLite interfaces.  This code
** is not included in the SQLite library.  It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.322 2008/08/30 13:25:11 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
#include <stdlib.h>
#include <string.h>

/*
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393





1394
1395
1396
1397

1398
1399
1400
1401
1402
1403
1404
  z = sqlite3_mprintf(argv[1], r);
  Tcl_AppendResult(interp, z, 0);
  sqlite3_free(z);
  return TCL_OK;
}

/*
** Usage: sqlite3_enable_shared_cache      BOOLEAN
**
*/
#if !defined(SQLITE_OMIT_SHARED_CACHE)
static int test_enable_shared(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  int rc;
  int enable;
  int ret = 0;
  extern int sqlite3SharedCacheEnabled;

  if( objc!=2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "BOOLEAN");
    return TCL_ERROR;
  }
  if( Tcl_GetBooleanFromObj(interp, objv[1], &enable) ){
    return TCL_ERROR;
  }
  ret = sqlite3SharedCacheEnabled;





  rc = sqlite3_enable_shared_cache(enable);
  if( rc!=SQLITE_OK ){
    Tcl_SetResult(interp, (char *)sqlite3ErrStr(rc), TCL_STATIC);
    return TCL_ERROR;

  }
  Tcl_SetObjResult(interp, Tcl_NewBooleanObj(ret));
  return TCL_OK;
}
#endif









|














|
|
<
<
<



>
>
>
>
>
|
|
|
|
>







1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387



1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
  z = sqlite3_mprintf(argv[1], r);
  Tcl_AppendResult(interp, z, 0);
  sqlite3_free(z);
  return TCL_OK;
}

/*
** Usage: sqlite3_enable_shared_cache ?BOOLEAN?
**
*/
#if !defined(SQLITE_OMIT_SHARED_CACHE)
static int test_enable_shared(
  ClientData clientData, /* Pointer to sqlite3_enable_XXX function */
  Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  int objc,              /* Number of arguments */
  Tcl_Obj *CONST objv[]  /* Command arguments */
){
  int rc;
  int enable;
  int ret = 0;
  extern int sqlite3SharedCacheEnabled;

  if( objc!=2 && objc!=1 ){
    Tcl_WrongNumArgs(interp, 1, objv, "?BOOLEAN?");



    return TCL_ERROR;
  }
  ret = sqlite3SharedCacheEnabled;

  if( objc==2 ){
    if( Tcl_GetBooleanFromObj(interp, objv[1], &enable) ){
      return TCL_ERROR;
    }
    rc = sqlite3_enable_shared_cache(enable);
    if( rc!=SQLITE_OK ){
      Tcl_SetResult(interp, (char *)sqlite3ErrStr(rc), TCL_STATIC);
      return TCL_ERROR;
    }
  }
  Tcl_SetObjResult(interp, Tcl_NewBooleanObj(ret));
  return TCL_OK;
}
#endif


Changes to test/permutations.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2008 June 21
#
# 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.
#
#***********************************************************************
#
# $Id: permutations.test,v 1.25 2008/08/29 12:00:20 danielk1977 Exp $

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

# Argument processing.
#
#puts "PERM-DEBUG: argv=$argv"











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 2008 June 21
#
# 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.
#
#***********************************************************************
#
# $Id: permutations.test,v 1.26 2008/08/30 13:25:11 danielk1977 Exp $

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

# Argument processing.
#
#puts "PERM-DEBUG: argv=$argv"
129
130
131
132
133
134
135
136
137
138
139
140
141

142



143
144
145
146
147
148
149








150
151
152
153
154
155
156
    puts "skipping permutation test $name..."
    return
  }

  uplevel $options(-initialize)
  set ::permutations_presql $options(-presql)

  foreach file $options(-include) {
    if {[lsearch $options(-exclude) $file] < 0 &&
       ( $::perm::testfile eq "" ||
         $::perm::testfile eq $file ||
        "$::perm::testfile.test" eq $file )
    } {

      uplevel source $::testdir/$file



    } else {
      # puts "skipping file $file"
    }
  }

  uplevel $options(-shutdown)
}









#############################################################################
# Start of tests

# Run some tests using pre-allocated page and scratch blocks.
#
run_tests "memsubsys1" -description {







|





>

>
>
>







>
>
>
>
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
    puts "skipping permutation test $name..."
    return
  }

  uplevel $options(-initialize)
  set ::permutations_presql $options(-presql)

  foreach file [lsort $options(-include)] {
    if {[lsearch $options(-exclude) $file] < 0 &&
       ( $::perm::testfile eq "" ||
         $::perm::testfile eq $file ||
        "$::perm::testfile.test" eq $file )
    } {
      set ::perm::shared_cache_setting [shared_cache_setting]
      uplevel source $::testdir/$file
      if {$::perm::shared_cache_setting ne [shared_cache_setting]} {
        error "File $::testdir/$file changed the shared cache setting from $::perm::shared_cache_setting to [shared_cache_setting]"
      }
    } else {
      # puts "skipping file $file"
    }
  }

  uplevel $options(-shutdown)
}

proc shared_cache_setting {} {
  set ret 0
  catch {
    set ret [sqlite3_enable_shared_cache]
  }
  return $ret
}

#############################################################################
# Start of tests

# Run some tests using pre-allocated page and scratch blocks.
#
run_tests "memsubsys1" -description {