/ Check-in [c273c171]
Login

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

Overview
Comment:In the mptester, add --glob and --notglob and --testcase. Make --exit work on the main thread. Enable the load_extension() SQL function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c273c171f511475045ef0aa68ecf8e22b8351996
User & Date: drh 2013-04-17 18:56:16
Context
2013-04-17
19:42
Fix the --match command in mptester so that it checks the entire result, not just a prefix of the result. check-in: 3e3ecad2 user: drh tags: trunk
18:56
In the mptester, add --glob and --notglob and --testcase. Make --exit work on the main thread. Enable the load_extension() SQL function. check-in: c273c171 user: drh tags: trunk
17:33
In the command-line shell, allow a dot-command to occur after a multi-line c-style comment. check-in: e2c94ab9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to mptest/mptest.c.

   894    894   
   895    895       /*
   896    896       **   --exit N
   897    897       **
   898    898       ** Exit this process.  If N>0 then exit without shutting down
   899    899       ** SQLite.  (In other words, simulate a crash.)
   900    900       */
   901         -    if( strcmp(zCmd, "exit")==0 && iClient>0 ){
          901  +    if( strcmp(zCmd, "exit")==0 ){
   902    902         int rc = atoi(azArg[0]);
   903    903         finishScript(iClient, taskId, 1);
   904    904         if( rc==0 ) sqlite3_close(g.db);
   905    905         exit(rc);
   906    906       }else
   907    907   
          908  +    /*
          909  +    **   --testcase NAME
          910  +    **
          911  +    ** Exit this process.  If N>0 then exit without shutting down
          912  +    ** SQLite.  (In other words, simulate a crash.)
          913  +    */
          914  +    if( strcmp(zCmd, "testcase")==0 ){
          915  +      if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii);
          916  +      stringReset(&sResult);
          917  +    }else
          918  +
   908    919       /*
   909    920       **   --finish
   910    921       **
   911    922       ** Mark the current task as having finished, even if it is not.
   912    923       ** This can be used in conjunction with --exit to simulate a crash.
   913    924       */
   914    925       if( strcmp(zCmd, "finish")==0 && iClient>0 ){
................................................................................
   934    945         char *zAns = zScript+ii;
   935    946         for(jj=7; jj<len-1 && isspace(zAns[jj]); jj++){}
   936    947         zAns += jj;
   937    948         if( strncmp(sResult.z, zAns, len-jj-1) ){
   938    949           errorMessage("line %d of %s:\nExpected [%.*s]\n     Got [%s]",
   939    950             prevLine, zFilename, len-jj-1, zAns, sResult.z);
   940    951         }
          952  +      g.nTest++;
          953  +      stringReset(&sResult);
          954  +    }else
          955  +
          956  +    /*
          957  +    **  --glob ANSWER...
          958  +    **  --notglob ANSWER....
          959  +    **
          960  +    ** Check to see if output does or does not match the glob pattern
          961  +    ** ANSWER.
          962  +    */
          963  +    if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){
          964  +      int jj;
          965  +      char *zAns = zScript+ii;
          966  +      char *zCopy;
          967  +      int isGlob = (zCmd[0]=='g');
          968  +      for(jj=9-3*isGlob; jj<len-1 && isspace(zAns[jj]); jj++){}
          969  +      zAns += jj;
          970  +      zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns);
          971  +      if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){
          972  +        errorMessage("line %d of %s:\nExpected [%s]\n     Got [%s]",
          973  +          prevLine, zFilename, zCopy, sResult.z);
          974  +      }
          975  +      sqlite3_free(zCopy);
   941    976         g.nTest++;
   942    977         stringReset(&sResult);
   943    978       }else
   944    979   
   945    980       /*
   946    981       **  --output
   947    982       **
................................................................................
  1232   1267       }
  1233   1268       iClient =  0;
  1234   1269       unlink(g.zDbFile);
  1235   1270       openFlags |= SQLITE_OPEN_CREATE;
  1236   1271     }
  1237   1272     rc = sqlite3_open_v2(g.zDbFile, &g.db, openFlags, g.zVfs);
  1238   1273     if( rc ) fatalError("cannot open [%s]", g.zDbFile);
         1274  +  sqlite3_enable_load_extension(g.db, 1);
  1239   1275     sqlite3_busy_handler(g.db, busyHandler, 0);
  1240   1276     sqlite3_create_function(g.db, "vfsname", 0, SQLITE_UTF8, 0,
  1241   1277                             vfsNameFunc, 0, 0);
  1242   1278     sqlite3_create_function(g.db, "eval", 1, SQLITE_UTF8, 0,
  1243   1279                             evalFunc, 0, 0);
  1244   1280     g.iTimeout = DEFAULT_TIMEOUT;
  1245   1281     if( g.bSqlTrace ) sqlite3_trace(g.db, sqlTraceCallback, 0);