aboutsummaryrefslogtreecommitdiff
path: root/mptest/mptest.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-04-17 18:56:16 +0000
committerdrh <drh@noemail.net>2013-04-17 18:56:16 +0000
commit87f9caa85ca7249d13d814993ac6e375d16b8535 (patch)
treeba1d5d7ffab84c8a0370afb7dde5ab6a7dcaa550 /mptest/mptest.c
parent7a411f441bd10739266df96fb029b0c1068e2278 (diff)
downloadsqlite-87f9caa85ca7249d13d814993ac6e375d16b8535.tar.gz
sqlite-87f9caa85ca7249d13d814993ac6e375d16b8535.zip
In the mptester, add --glob and --notglob and --testcase. Make --exit work
on the main thread. Enable the load_extension() SQL function. FossilOrigin-Name: c273c171f511475045ef0aa68ecf8e22b8351996
Diffstat (limited to 'mptest/mptest.c')
-rw-r--r--mptest/mptest.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/mptest/mptest.c b/mptest/mptest.c
index e47be5ae6..8dc95be7b 100644
--- a/mptest/mptest.c
+++ b/mptest/mptest.c
@@ -898,7 +898,7 @@ static void runScript(
** Exit this process. If N>0 then exit without shutting down
** SQLite. (In other words, simulate a crash.)
*/
- if( strcmp(zCmd, "exit")==0 && iClient>0 ){
+ if( strcmp(zCmd, "exit")==0 ){
int rc = atoi(azArg[0]);
finishScript(iClient, taskId, 1);
if( rc==0 ) sqlite3_close(g.db);
@@ -906,6 +906,17 @@ static void runScript(
}else
/*
+ ** --testcase NAME
+ **
+ ** Exit this process. If N>0 then exit without shutting down
+ ** SQLite. (In other words, simulate a crash.)
+ */
+ if( strcmp(zCmd, "testcase")==0 ){
+ if( g.iTrace==1 ) logMessage("%.*s", len - 1, zScript+ii);
+ stringReset(&sResult);
+ }else
+
+ /*
** --finish
**
** Mark the current task as having finished, even if it is not.
@@ -943,6 +954,30 @@ static void runScript(
}else
/*
+ ** --glob ANSWER...
+ ** --notglob ANSWER....
+ **
+ ** Check to see if output does or does not match the glob pattern
+ ** ANSWER.
+ */
+ if( strcmp(zCmd, "glob")==0 || strcmp(zCmd, "notglob")==0 ){
+ int jj;
+ char *zAns = zScript+ii;
+ char *zCopy;
+ int isGlob = (zCmd[0]=='g');
+ for(jj=9-3*isGlob; jj<len-1 && isspace(zAns[jj]); jj++){}
+ zAns += jj;
+ zCopy = sqlite3_mprintf("%.*s", len-jj-1, zAns);
+ if( (sqlite3_strglob(zCopy, sResult.z)==0)^isGlob ){
+ errorMessage("line %d of %s:\nExpected [%s]\n Got [%s]",
+ prevLine, zFilename, zCopy, sResult.z);
+ }
+ sqlite3_free(zCopy);
+ g.nTest++;
+ stringReset(&sResult);
+ }else
+
+ /*
** --output
**
** Output the result of the previous SQL.
@@ -1236,6 +1271,7 @@ int main(int argc, char **argv){
}
rc = sqlite3_open_v2(g.zDbFile, &g.db, openFlags, g.zVfs);
if( rc ) fatalError("cannot open [%s]", g.zDbFile);
+ sqlite3_enable_load_extension(g.db, 1);
sqlite3_busy_handler(g.db, busyHandler, 0);
sqlite3_create_function(g.db, "vfsname", 0, SQLITE_UTF8, 0,
vfsNameFunc, 0, 0);