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
This commit is contained in:
drh
2013-04-17 18:56:16 +00:00
parent 7a411f441b
commit 87f9caa85c
3 changed files with 44 additions and 8 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
C In\sthe\scommand-line\sshell,\sallow\sa\sdot-command\sto\soccur\safter\sa\nmulti-line\sc-style\scomment.
D 2013-04-17T17:33:17.457
C In\sthe\smptester,\sadd\s--glob\sand\s--notglob\sand\s--testcase.\s\sMake\s--exit\swork\non\sthe\smain\sthread.\s\sEnable\sthe\sload_extension()\sSQL\sfunction.
D 2013-04-17T18:56:16.833
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3dd3fcb87b70c78d99b2c8a03e44ec86d6ca9ce2
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -114,7 +114,7 @@ F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test a5f31998ed48de8267d6620e8af107ec148e5f12
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c 2a263e88f18762ac5d7fb56749d2d2ea8e22cb93
F mptest/mptest.c 36c511bf0b562ccadede7cd31208dc1ec75b7ce2
F mptest/multiwrite01.test 81fbc17657964889b60750bd7bbb1deffe8f4d42
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
@@ -1051,7 +1051,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 76f4e31245fd1676a4520a2f7488bca6eb981e4a
R 7329574a8fd763912288e6955296b961
P e2c94ab930f0e5a6dbe8cdd34ebb8cfeeedca56c
R d244e7c9ac86257619e9ec497e6803a5
U drh
Z d7a8232879b542fa4edbd90644b25d07
Z 0c9d37cd97d14173f04c5765259a70d1
+1 -1
View File
@@ -1 +1 @@
e2c94ab930f0e5a6dbe8cdd34ebb8cfeeedca56c
c273c171f511475045ef0aa68ecf8e22b8351996
+37 -1
View File
@@ -898,13 +898,24 @@ 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);
exit(rc);
}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
**
@@ -942,6 +953,30 @@ static void runScript(
stringReset(&sResult);
}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
**
@@ -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);