/ Check-in [c8694657]
Login

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

Overview
Comment:Path portability enhancements for mptester.exe.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winTest
Files: files | file ages | folders
SHA1: c8694657bdc5d0917d8fe78fd3937d8e9cd9d04b
User & Date: drh 2015-03-31 18:18:53
Context
2015-03-31
19:06
Build fixes for OSTRACE enhancements. check-in: f79c236f user: mistachkin tags: winTest
18:18
Path portability enhancements for mptester.exe. check-in: c8694657 user: drh tags: winTest
18:05
Add the "mptest" target to main.mk. Change TRUNCATE and PERSIST to DELETE for mptest.c on Windows because of problems trying to delete the journal. check-in: ea697e6d user: drh tags: trunk
17:58
Path handling portability enhancements for mptester. check-in: da49634b user: mistachkin tags: winTest
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

   476    476   
   477    477   !IF $(DEBUG)>2
   478    478   TCC = $(TCC) -DSQLITE_DEBUG
   479    479   RCC = $(RCC) -DSQLITE_DEBUG
   480    480   !ENDIF
   481    481   
   482    482   !IF $(DEBUG)>4
   483         -TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1
   484         -RCC = $(RCC) -DSQLITE_DEBUG_OS_TRACE=1
          483  +TCC = $(TCC) -DSQLITE_DEBUG_OS_TRACE=1 -DSQLITE_FORCE_OS_TRACE=1
          484  +RCC = $(RCC) -DSQLITE_DEBUG_OS_TRACE=1 -DSQLITE_FORCE_OS_TRACE=1
   485    485   !ENDIF
   486    486   
   487    487   !IF $(DEBUG)>5
   488    488   TCC = $(TCC) -DSQLITE_ENABLE_IOTRACE
   489    489   RCC = $(RCC) -DSQLITE_ENABLE_IOTRACE
   490    490   !ENDIF
   491    491   
................................................................................
  1154   1154   	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c \
  1155   1155   		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1156   1156   
  1157   1157   mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
  1158   1158   	$(LTLINK) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
  1159   1159   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1160   1160   
  1161         -MPTEST1 = mptester mptest.db $(TOP)/mptest/crash01.test --repeat 20
  1162         -MPTEST2 = mptester mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20
         1161  +MPTEST1 = mptester mptest.db $(TOP)\mptest\crash01.test --repeat 20
         1162  +MPTEST2 = mptester mptest.db $(TOP)\mptest\multiwrite01.test --repeat 20
  1163   1163   
  1164   1164   mptest:	mptester.exe
  1165   1165   	del /Q mptest.db 2>NUL
  1166   1166   	$(MPTEST1) --journalmode DELETE
  1167   1167   	$(MPTEST2) --journalmode WAL
  1168   1168   	$(MPTEST1) --journalmode WAL
  1169   1169   	$(MPTEST2) --journalmode PERSIST

Changes to mptest/mptest.c.

    48     48   
    49     49   /* The suffix to append to the child command lines, if any */
    50     50   #if defined(_WIN32)
    51     51   # define GETPID (int)GetCurrentProcessId
    52     52   #else
    53     53   # define GETPID getpid
    54     54   #endif
           55  +
           56  +/* The directory separator character(s) */
           57  +#if defined(_WIN32)
           58  +# define isDirSep(c) (((c) == '/') || ((c) == '\\'))
           59  +#else
           60  +# define isDirSep(c) ((c) == '/')
           61  +#endif
    55     62   
    56     63   /* Mark a parameter as unused to suppress compiler warnings */
    57     64   #define UNUSED_PARAMETER(x)  (void)x
    58     65   
    59     66   /* Global data
    60     67   */
    61     68   static struct Global {
................................................................................
   820    827     }
   821    828   }
   822    829   
   823    830   /* Return a pointer to the tail of a filename
   824    831   */
   825    832   static char *filenameTail(char *z){
   826    833     int i, j;
   827         -  for(i=j=0; z[i]; i++) if( z[i]=='/' ) j = i+1;
          834  +  for(i=j=0; z[i]; i++) if( isDirSep(z[i]) ) j = i+1;
   828    835     return z+j;
   829    836   }
   830    837   
   831    838   /*
   832    839   ** Interpret zArg as a boolean value.  Return either 0 or 1.
   833    840   */
   834    841   static int booleanValue(char *zArg){
................................................................................
  1017   1024       **
  1018   1025       ** Run a subscript from a separate file.
  1019   1026       */
  1020   1027       if( strcmp(zCmd, "source")==0 ){
  1021   1028         char *zNewFile, *zNewScript;
  1022   1029         char *zToDel = 0;
  1023   1030         zNewFile = azArg[0];
  1024         -      if( zNewFile[0]!='/' ){
         1031  +      if( !isDirSep(zNewFile[0]) ){
  1025   1032           int k;
  1026         -        for(k=(int)strlen(zFilename)-1; k>=0 && zFilename[k]!='/'; k--){}
         1033  +        for(k=(int)strlen(zFilename)-1; k>=0 && !isDirSep(zFilename[k]); k--){}
  1027   1034           if( k>0 ){
  1028   1035             zNewFile = zToDel = sqlite3_mprintf("%.*s/%s", k,zFilename,zNewFile);
  1029   1036           }
  1030   1037         }
  1031   1038         zNewScript = readFile(zNewFile);
  1032   1039         if( g.iTrace ) logMessage("begin script [%s]\n", zNewFile);
  1033   1040         runScript(0, 0, zNewScript, zNewFile);
................................................................................
  1227   1234   }
  1228   1235   
  1229   1236   /* Print a usage message for the program and exit */
  1230   1237   static void usage(const char *argv0){
  1231   1238     int i;
  1232   1239     const char *zTail = argv0;
  1233   1240     for(i=0; argv0[i]; i++){
  1234         -    if( argv0[i]=='/' ) zTail = argv0+i+1;
         1241  +    if( isDirSep(argv0[i]) ) zTail = argv0+i+1;
  1235   1242     }
  1236   1243     fprintf(stderr,"Usage: %s DATABASE ?OPTIONS? ?SCRIPT?\n", zTail);
  1237   1244     exit(1);
  1238   1245   }
  1239   1246   
  1240   1247   /* Report on unrecognized arguments */
  1241   1248   static void unrecognizedArguments(
................................................................................
  1334   1341       ){
  1335   1342         printf("Changing journal mode to DELETE from %s", zJMode);
  1336   1343         zJMode = "DELETE";
  1337   1344       }
  1338   1345   #endif
  1339   1346       runSql("PRAGMA journal_mode=%Q;", zJMode);
  1340   1347     }
         1348  +  if( !g.bSync ) trySql("PRAGMA synchronous=OFF");
  1341   1349     sqlite3_enable_load_extension(g.db, 1);
  1342   1350     sqlite3_busy_handler(g.db, busyHandler, 0);
  1343   1351     sqlite3_create_function(g.db, "vfsname", 0, SQLITE_UTF8, 0,
  1344   1352                             vfsNameFunc, 0, 0);
  1345   1353     sqlite3_create_function(g.db, "eval", 1, SQLITE_UTF8, 0,
  1346   1354                             evalFunc, 0, 0);
  1347   1355     g.iTimeout = DEFAULT_TIMEOUT;
  1348   1356     if( g.bSqlTrace ) sqlite3_trace(g.db, sqlTraceCallback, 0);
  1349         -  if( !g.bSync ) trySql("PRAGMA synchronous=OFF");
  1350   1357     if( iClient>0 ){
  1351   1358       if( n>0 ) unrecognizedArguments(argv[0], n, argv+2);
  1352   1359       if( g.iTrace ) logMessage("start-client");
  1353   1360       while(1){
  1354   1361         char *zTaskName = 0;
  1355   1362         rc = startScript(iClient, &zScript, &taskId, &zTaskName);
  1356   1363         if( rc==SQLITE_DONE ) break;

Changes to src/main.c.

  1190   1190     }
  1191   1191   }
  1192   1192   
  1193   1193   /*
  1194   1194   ** Return a static string containing the name corresponding to the error code
  1195   1195   ** specified in the argument.
  1196   1196   */
  1197         -#if (defined(SQLITE_DEBUG) && SQLITE_OS_WIN) || defined(SQLITE_TEST)
         1197  +#if defined(SQLITE_DEBUG) && \
         1198  +    (defined(SQLITE_TEST) || defined(SQLITE_FORCE_OS_TRACE))
  1198   1199   const char *sqlite3ErrName(int rc){
  1199   1200     const char *zName = 0;
  1200   1201     int i, origRc = rc;
  1201   1202     for(i=0; i<2 && zName==0; i++, rc &= 0xff){
  1202   1203       switch( rc ){
  1203   1204         case SQLITE_OK:                 zName = "SQLITE_OK";                break;
  1204   1205         case SQLITE_ERROR:              zName = "SQLITE_ERROR";             break;

Changes to src/os_common.h.

    25     25   ** macro to SQLITE_DEBUG and some older makefiles have not yet made the
    26     26   ** switch.  The following code should catch this problem at compile-time.
    27     27   */
    28     28   #ifdef MEMORY_DEBUG
    29     29   # error "The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead."
    30     30   #endif
    31     31   
    32         -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
           32  +#if defined(SQLITE_DEBUG) && \
           33  +    (defined(SQLITE_TEST) || defined(SQLITE_FORCE_OS_TRACE))
    33     34   # ifndef SQLITE_DEBUG_OS_TRACE
    34     35   #   define SQLITE_DEBUG_OS_TRACE 0
    35     36   # endif
    36     37     int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;
    37     38   # define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X
    38     39   #else
    39     40   # define OSTRACE(X)

Changes to src/sqliteInt.h.

  3487   3487   int sqlite3DecOrHexToI64(const char*, i64*);
  3488   3488   void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
  3489   3489   void sqlite3Error(sqlite3*,int);
  3490   3490   void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
  3491   3491   u8 sqlite3HexToInt(int h);
  3492   3492   int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
  3493   3493   
  3494         -#if defined(SQLITE_TEST) 
         3494  +#if defined(SQLITE_DEBUG) && \
         3495  +    (defined(SQLITE_TEST) || defined(SQLITE_FORCE_OS_TRACE))
  3495   3496   const char *sqlite3ErrName(int);
  3496   3497   #endif
  3497   3498   
  3498   3499   const char *sqlite3ErrStr(int);
  3499   3500   int sqlite3ReadSchema(Parse *pParse);
  3500   3501   CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
  3501   3502   CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);