/ Check-in [5201fa4f]
Login

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

Overview
Comment:Fix a bug in test_server.c that resulted from the change in semantics of sqlite3_enable_shared_cache(). All quick tests now pass. (CVS 4326)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5201fa4f8310ffc8b6881d96b152581d74e2df6b
User & Date: drh 2007-08-29 18:20:17
Context
2007-08-29
19:15
Fix minor problems on various tests. This is a snapshot prior to possible major changes in order to fix the sqlite3AbortOtherActiveVdbes problem. (CVS 4327) check-in: 35cb63ec user: drh tags: trunk
18:20
Fix a bug in test_server.c that resulted from the change in semantics of sqlite3_enable_shared_cache(). All quick tests now pass. (CVS 4326) check-in: 5201fa4f user: drh tags: trunk
17:59
Disable tests that require SQLITE_ENABLE_ATOMIC_WRITE if that feature is not enabled. (CVS 4325) check-in: 48744993 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_server.c.

   382    382   ** This routine implements the server.  To start the server, first
   383    383   ** make sure g.serverHalt is false, then create a new detached thread
   384    384   ** on this procedure.  See the sqlite3_server_start() routine below
   385    385   ** for an example.  This procedure loops until g.serverHalt becomes
   386    386   ** true.
   387    387   */
   388    388   void *sqlite3_server(void *NotUsed){
   389         -  sqlite3_enable_shared_cache(1);
   390    389     if( pthread_mutex_trylock(&g.serverMutex) ){
   391         -    sqlite3_enable_shared_cache(0);
   392    390       return 0;  /* Another server is already running */
   393    391     }
          392  +  sqlite3_enable_shared_cache(1);
   394    393     while( !g.serverHalt ){
   395    394       SqlMessage *pMsg;
   396    395   
   397    396       /* Remove the last message from the message queue.
   398    397       */
   399    398       pthread_mutex_lock(&g.queueMutex);
   400    399       while( g.pQueueTail==0 && g.serverHalt==0 ){

Changes to test/server1.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the server mode of SQLite.
    13     13   #
    14     14   # This file is derived from thread1.test
    15     15   #
    16         -# $Id: server1.test,v 1.4 2006/01/15 00:13:16 drh Exp $
           16  +# $Id: server1.test,v 1.5 2007/08/29 18:20:17 drh Exp $
    17     17   
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22     22   # Skip this whole file if the server testing code is not enabled
    23     23   #
................................................................................
   121    121     client_create B test.db
   122    122     client_compile B {SELECT b FROM t1}
   123    123     client_step B
   124    124     client_result B
   125    125   } SQLITE_ROW
   126    126   
   127    127   # Write to a different table from another thread.  This is allowed
   128         -# becaus in server mode with a shared cache we have table-level locking.
          128  +# because in server mode with a shared cache we have table-level locking.
   129    129   #
   130    130   do_test server1-2.3 {
   131    131     client_create C test.db
   132    132     client_compile C {INSERT INTO t2 VALUES(98,99)}
   133    133     client_step C
   134    134     client_result C
   135    135     client_finalize C
................................................................................
   163    163     client_step C
   164    164     client_result C
   165    165     client_finalize C
   166    166     client_result C
   167    167   } SQLITE_OK
   168    168   
   169    169   client_halt *   
          170  +sqlite3_enable_shared_cache 0
   170    171   finish_test