From e348fc7fe8433fe5f8dcb36317cf0e3661bb7f19 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 6 Apr 2013 18:35:07 +0000 Subject: [PATCH] Fix the --source command so that its argument is relative to the script. Verify that the SQLite header and library match. Print SQLite version and compile-time configuration information on startup. FossilOrigin-Name: 15cb0db7583c3a24cbea0c72576047a93fba0801 --- manifest | 12 ++++++------ manifest.uuid | 2 +- mptest/mptest.c | 33 +++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index bfff919823..36209600bd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk\schanges\sinto\sthe\smptest\sbranch.\s\sThe\smptest\sneeds\sthe\nSQLITE_MAX_SCHEMA_RETRY\sfix\sin\sparticular. -D 2013-04-06T18:10:27.166 +C Fix\sthe\s--source\scommand\sso\sthat\sits\sargument\sis\srelative\sto\sthe\sscript.\nVerify\sthat\sthe\sSQLite\sheader\sand\slibrary\smatch.\s\sPrint\sSQLite\sversion\nand\scompile-time\sconfiguration\sinformation\son\sstartup. +D 2013-04-06T18:35:07.098 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in aafa71d66bab7e87fb2f348152340645f79f0244 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -111,7 +111,7 @@ F mkopcodec.awk f6fccee29e68493bfd90a2e0466ede5fa94dd2fc F mkopcodeh.awk 29b84656502eee5f444c3147f331ee686956ab0e F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 F mptest/config01.test 058a9bc2b0db710d36003ab06dc1618566f27b52 -F mptest/mptest.c 4f1a7ad2b9d089fb1bfbbac8cd9f6fe840575f10 +F mptest/mptest.c 6e23dade7b4cde4801b7a6df29f52a492d82d450 F mptest/multiwrite01.test aef0af17f1ce1beacd158e403a45a21008d7a70c F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b @@ -1047,7 +1047,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 716c25bd125c8934499c1fb59a60d7e844c0691c c1d7304c80c4a6244c8a9f6fad1eebd0f339c724 -R 865d94cb53d70dd89436e58ffa63ebac +P fb7a7773965697855c12193408cb75300decc23c +R 22a5a5addda1bdaa7f5e87ce6cbfc935 U drh -Z 83b40ff56b301adcba03b758b3b36603 +Z 9527a4645b09957de5c779d28c3eb994 diff --git a/manifest.uuid b/manifest.uuid index 284652c9b5..aa637d58c4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fb7a7773965697855c12193408cb75300decc23c \ No newline at end of file +15cb0db7583c3a24cbea0c72576047a93fba0801 \ No newline at end of file diff --git a/mptest/mptest.c b/mptest/mptest.c index 768a73ed72..d2fdb64396 100644 --- a/mptest/mptest.c +++ b/mptest/mptest.c @@ -22,7 +22,6 @@ ** Recommended options: ** ** -DHAVE_USLEEP -** -DSQLITE_MAX_SCHEMA_RETRY=100 ** -DSQLITE_NO_SYNC ** -DSQLITE_THREADSAFE=0 ** -DSQLITE_OMIT_LOAD_EXTENSION @@ -824,11 +823,21 @@ static void runScript( ** Run a subscript from a separate file. */ if( strcmp(zCmd, "source")==0 ){ - char *zNewFile = azArg[0]; - char *zNewScript = readFile(zNewFile); + char *zNewFile, *zNewScript; + char *zToDel = 0; + zNewFile = azArg[0]; + if( zNewFile[0]!='/' ){ + int k; + for(k=(int)strlen(zFilename)-1; k>=0 && zFilename[k]!='/'; k--){} + if( k>0 ){ + zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile); + } + } + zNewScript = readFile(zNewFile); if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile); runScript(0, 0, zNewScript, zNewFile); sqlite3_free(zNewScript); + sqlite3_free(zToDel); if( g.iTrace ) logMessage("end script [%s]\n", zNewFile); }else @@ -987,17 +996,26 @@ static void unrecognizedArguments( int main(int argc, char **argv){ const char *zClient; int iClient; - int n; + int n, i; int openFlags = SQLITE_OPEN_READWRITE; int rc; char *zScript; int taskId; const char *zTrace; + const char *zCOption; g.argv0 = argv[0]; g.iTrace = 1; if( argc<2 ) usage(argv[0]); g.zDbFile = argv[1]; + if( strglob("*.test", g.zDbFile) ) usage(argv[0]); + if( strcmp(sqlite3_sourceid(), SQLITE_SOURCE_ID)!=0 ){ + fprintf(stderr, "SQLite library and header mismatch\n" + "Library: %s\n" + "Header: %s\n", + sqlite3_sourceid(), SQLITE_SOURCE_ID); + exit(1); + } n = argc-2; sqlite3_snprintf(sizeof(g.zName), g.zName, "mptest"); g.zVfs = findOption(argv+2, &n, "vfs", 1); @@ -1024,6 +1042,13 @@ int main(int argc, char **argv){ if( iClient<1 ) fatalError("illegal client number: %d\n", iClient); sqlite3_snprintf(sizeof(g.zName), g.zName, "client%02d", iClient); }else{ + if( g.iTrace>0 ){ + printf("With SQLite " SQLITE_VERSION " " SQLITE_SOURCE_ID "\n" ); + for(i=0; (zCOption = sqlite3_compileoption_get(i))!=0; i++){ + printf("-DSQLITE_%s\n", zCOption); + } + fflush(stdout); + } iClient = 0; unlink(g.zDbFile); openFlags |= SQLITE_OPEN_CREATE;