/ Check-in [54ff3a26]
Login

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

Overview
Comment:Enhance the MSVC makefile to enable building 'testfixture' fully from source code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | testFixtureSrc
Files: files | file ages | folders
SHA1:54ff3a26bc45a1c3c0690119e8fd00b02e2a16ba
User & Date: mistachkin 2016-02-11 21:28:16
Context
2016-02-11
21:38
Prevent 'expanded command line X too long' errors during the batch 'for' loops used for copying files. Closed-Leaf check-in: 67ee9b5a user: mistachkin tags: testFixtureSrc
21:28
Enhance the MSVC makefile to enable building 'testfixture' fully from source code. check-in: 54ff3a26 user: mistachkin tags: testFixtureSrc
18:18
Fix another unused variable warning in fts5 code. check-in: 61b4c120 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

  1001   1001   !IF $(USE_RC)!=0
  1002   1002   LIBRESOBJS = sqlite3res.lo
  1003   1003   !ELSE
  1004   1004   LIBRESOBJS =
  1005   1005   !ENDIF
  1006   1006   
  1007   1007   # <<mark>>
  1008         -# All of the source code files.
         1008  +# Core source code files, part 1.
  1009   1009   #
  1010         -SRC1 = \
         1010  +SRC00 = \
  1011   1011     $(TOP)\src\alter.c \
  1012   1012     $(TOP)\src\analyze.c \
  1013   1013     $(TOP)\src\attach.c \
  1014   1014     $(TOP)\src\auth.c \
  1015   1015     $(TOP)\src\backup.c \
  1016   1016     $(TOP)\src\bitvec.c \
  1017   1017     $(TOP)\src\btmutex.c \
  1018   1018     $(TOP)\src\btree.c \
  1019         -  $(TOP)\src\btree.h \
  1020         -  $(TOP)\src\btreeInt.h \
  1021   1019     $(TOP)\src\build.c \
  1022   1020     $(TOP)\src\callback.c \
  1023   1021     $(TOP)\src\complete.c \
  1024   1022     $(TOP)\src\ctime.c \
  1025   1023     $(TOP)\src\date.c \
  1026   1024     $(TOP)\src\dbstat.c \
  1027   1025     $(TOP)\src\delete.c \
  1028   1026     $(TOP)\src\expr.c \
  1029   1027     $(TOP)\src\fault.c \
  1030   1028     $(TOP)\src\fkey.c \
  1031   1029     $(TOP)\src\func.c \
  1032   1030     $(TOP)\src\global.c \
  1033   1031     $(TOP)\src\hash.c \
  1034         -  $(TOP)\src\hash.h \
  1035         -  $(TOP)\src\hwtime.h \
  1036   1032     $(TOP)\src\insert.c \
  1037   1033     $(TOP)\src\journal.c \
  1038   1034     $(TOP)\src\legacy.c \
  1039   1035     $(TOP)\src\loadext.c \
  1040   1036     $(TOP)\src\main.c \
  1041   1037     $(TOP)\src\malloc.c \
  1042   1038     $(TOP)\src\mem0.c \
  1043   1039     $(TOP)\src\mem1.c \
  1044   1040     $(TOP)\src\mem2.c \
  1045   1041     $(TOP)\src\mem3.c \
  1046   1042     $(TOP)\src\mem5.c \
  1047   1043     $(TOP)\src\memjournal.c \
  1048         -  $(TOP)\src\msvc.h \
  1049   1044     $(TOP)\src\mutex.c \
  1050         -  $(TOP)\src\mutex.h \
  1051   1045     $(TOP)\src\mutex_noop.c \
  1052   1046     $(TOP)\src\mutex_unix.c \
  1053   1047     $(TOP)\src\mutex_w32.c \
  1054   1048     $(TOP)\src\notify.c \
  1055   1049     $(TOP)\src\os.c \
  1056         -  $(TOP)\src\os.h \
  1057         -  $(TOP)\src\os_common.h \
  1058         -  $(TOP)\src\os_setup.h \
  1059   1050     $(TOP)\src\os_unix.c \
  1060         -  $(TOP)\src\os_win.c \
  1061         -  $(TOP)\src\os_win.h
  1062         -SRC2 = \
         1051  +  $(TOP)\src\os_win.c
         1052  +
         1053  +# Core source code files, part 2.
         1054  +#
         1055  +SRC01 = \
  1063   1056     $(TOP)\src\pager.c \
  1064         -  $(TOP)\src\pager.h \
  1065         -  $(TOP)\src\parse.y \
  1066   1057     $(TOP)\src\pcache.c \
  1067         -  $(TOP)\src\pcache.h \
  1068   1058     $(TOP)\src\pcache1.c \
  1069   1059     $(TOP)\src\pragma.c \
  1070         -  $(TOP)\src\pragma.h \
  1071   1060     $(TOP)\src\prepare.c \
  1072   1061     $(TOP)\src\printf.c \
  1073   1062     $(TOP)\src\random.c \
  1074   1063     $(TOP)\src\resolve.c \
  1075   1064     $(TOP)\src\rowset.c \
  1076   1065     $(TOP)\src\select.c \
  1077   1066     $(TOP)\src\status.c \
  1078         -  $(TOP)\src\shell.c \
  1079         -  $(TOP)\src\sqlite.h.in \
  1080         -  $(TOP)\src\sqlite3ext.h \
  1081         -  $(TOP)\src\sqliteInt.h \
  1082         -  $(TOP)\src\sqliteLimit.h \
  1083   1067     $(TOP)\src\table.c \
  1084   1068     $(TOP)\src\threads.c \
  1085   1069     $(TOP)\src\tclsqlite.c \
  1086   1070     $(TOP)\src\tokenize.c \
  1087   1071     $(TOP)\src\treeview.c \
  1088   1072     $(TOP)\src\trigger.c \
  1089   1073     $(TOP)\src\utf.c \
  1090   1074     $(TOP)\src\update.c \
  1091   1075     $(TOP)\src\util.c \
  1092   1076     $(TOP)\src\vacuum.c \
  1093   1077     $(TOP)\src\vdbe.c \
  1094         -  $(TOP)\src\vdbe.h \
  1095   1078     $(TOP)\src\vdbeapi.c \
  1096   1079     $(TOP)\src\vdbeaux.c \
  1097   1080     $(TOP)\src\vdbeblob.c \
  1098   1081     $(TOP)\src\vdbemem.c \
  1099   1082     $(TOP)\src\vdbesort.c \
  1100   1083     $(TOP)\src\vdbetrace.c \
  1101         -  $(TOP)\src\vdbeInt.h \
  1102   1084     $(TOP)\src\vtab.c \
  1103         -  $(TOP)\src\vxworks.h \
  1104   1085     $(TOP)\src\wal.c \
  1105         -  $(TOP)\src\wal.h \
  1106   1086     $(TOP)\src\walker.c \
  1107   1087     $(TOP)\src\where.c \
  1108   1088     $(TOP)\src\wherecode.c \
  1109         -  $(TOP)\src\whereexpr.c \
         1089  +  $(TOP)\src\whereexpr.c
         1090  +
         1091  +# Shell source code files.
         1092  +#
         1093  +SRC02 = \
         1094  +  $(TOP)\src\shell.c
         1095  +
         1096  +# Core miscellaneous files.
         1097  +#
         1098  +SRC03 = \
         1099  +  $(TOP)\src\parse.y
         1100  +
         1101  +# Core header files, part 1.
         1102  +#
         1103  +SRC04 = \
         1104  +  $(TOP)\src\btree.h \
         1105  +  $(TOP)\src\btreeInt.h \
         1106  +  $(TOP)\src\hash.h \
         1107  +  $(TOP)\src\hwtime.h \
         1108  +  $(TOP)\src\msvc.h \
         1109  +  $(TOP)\src\mutex.h \
         1110  +  $(TOP)\src\os.h \
         1111  +  $(TOP)\src\os_common.h \
         1112  +  $(TOP)\src\os_setup.h \
         1113  +  $(TOP)\src\os_win.h
         1114  +
         1115  +# Core header files, part 2.
         1116  +#
         1117  +SRC05 = \
         1118  +  $(TOP)\src\pager.h \
         1119  +  $(TOP)\src\pcache.h \
         1120  +  $(TOP)\src\pragma.h \
         1121  +  $(TOP)\src\sqlite.h.in \
         1122  +  $(TOP)\src\sqlite3ext.h \
         1123  +  $(TOP)\src\sqliteInt.h \
         1124  +  $(TOP)\src\sqliteLimit.h \
         1125  +  $(TOP)\src\vdbe.h \
         1126  +  $(TOP)\src\vdbeInt.h \
         1127  +  $(TOP)\src\vxworks.h \
         1128  +  $(TOP)\src\wal.h \
  1110   1129     $(TOP)\src\whereInt.h
  1111   1130   
  1112         -# Source code for extensions
         1131  +# Extension source code files, part 1.
  1113   1132   #
  1114         -SRC3 = \
         1133  +SRC06 = \
  1115   1134     $(TOP)\ext\fts1\fts1.c \
  1116         -  $(TOP)\ext\fts1\fts1.h \
  1117   1135     $(TOP)\ext\fts1\fts1_hash.c \
  1118         -  $(TOP)\ext\fts1\fts1_hash.h \
  1119   1136     $(TOP)\ext\fts1\fts1_porter.c \
  1120         -  $(TOP)\ext\fts1\fts1_tokenizer.h \
  1121   1137     $(TOP)\ext\fts1\fts1_tokenizer1.c \
  1122   1138     $(TOP)\ext\fts2\fts2.c \
  1123         -  $(TOP)\ext\fts2\fts2.h \
  1124   1139     $(TOP)\ext\fts2\fts2_hash.c \
  1125         -  $(TOP)\ext\fts2\fts2_hash.h \
  1126   1140     $(TOP)\ext\fts2\fts2_icu.c \
  1127   1141     $(TOP)\ext\fts2\fts2_porter.c \
  1128         -  $(TOP)\ext\fts2\fts2_tokenizer.h \
  1129   1142     $(TOP)\ext\fts2\fts2_tokenizer.c \
  1130   1143     $(TOP)\ext\fts2\fts2_tokenizer1.c
  1131         -SRC4 = \
         1144  +
         1145  +# Extension source code files, part 2.
         1146  +#
         1147  +SRC07 = \
  1132   1148     $(TOP)\ext\fts3\fts3.c \
  1133         -  $(TOP)\ext\fts3\fts3.h \
  1134         -  $(TOP)\ext\fts3\fts3Int.h \
  1135   1149     $(TOP)\ext\fts3\fts3_aux.c \
  1136   1150     $(TOP)\ext\fts3\fts3_expr.c \
  1137   1151     $(TOP)\ext\fts3\fts3_hash.c \
  1138         -  $(TOP)\ext\fts3\fts3_hash.h \
  1139   1152     $(TOP)\ext\fts3\fts3_icu.c \
  1140   1153     $(TOP)\ext\fts3\fts3_porter.c \
  1141   1154     $(TOP)\ext\fts3\fts3_snippet.c \
  1142         -  $(TOP)\ext\fts3\fts3_tokenizer.h \
  1143   1155     $(TOP)\ext\fts3\fts3_tokenizer.c \
  1144   1156     $(TOP)\ext\fts3\fts3_tokenizer1.c \
  1145   1157     $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
  1146   1158     $(TOP)\ext\fts3\fts3_unicode.c \
  1147   1159     $(TOP)\ext\fts3\fts3_unicode2.c \
  1148   1160     $(TOP)\ext\fts3\fts3_write.c \
  1149         -  $(TOP)\ext\icu\sqliteicu.h \
  1150   1161     $(TOP)\ext\icu\icu.c \
  1151         -  $(TOP)\ext\rtree\rtree.h \
  1152   1162     $(TOP)\ext\rtree\rtree.c \
  1153         -  $(TOP)\ext\rbu\sqlite3rbu.h \
  1154   1163     $(TOP)\ext\rbu\sqlite3rbu.c \
  1155   1164     $(TOP)\ext\misc\json1.c
  1156   1165   
         1166  +# Extension header files, part 1.
         1167  +#
         1168  +SRC08 = \
         1169  +  $(TOP)\ext\fts1\fts1.h \
         1170  +  $(TOP)\ext\fts1\fts1_hash.h \
         1171  +  $(TOP)\ext\fts1\fts1_tokenizer.h \
         1172  +  $(TOP)\ext\fts2\fts2.h \
         1173  +  $(TOP)\ext\fts2\fts2_hash.h \
         1174  +  $(TOP)\ext\fts2\fts2_tokenizer.h
         1175  +
         1176  +# Extension header files, part 2.
         1177  +#
         1178  +SRC09 = \
         1179  +  $(TOP)\ext\fts3\fts3.h \
         1180  +  $(TOP)\ext\fts3\fts3Int.h \
         1181  +  $(TOP)\ext\fts3\fts3_hash.h \
         1182  +  $(TOP)\ext\fts3\fts3_tokenizer.h \
         1183  +  $(TOP)\ext\icu\sqliteicu.h \
         1184  +  $(TOP)\ext\rtree\rtree.h \
         1185  +  $(TOP)\ext\rbu\sqlite3rbu.h
  1157   1186   
  1158   1187   # Generated source code files
  1159   1188   #
  1160         -SRC5 = \
  1161         -  keywordhash.h \
         1189  +SRC10 = \
  1162   1190     opcodes.c \
         1191  +  parse.c
         1192  +
         1193  +# Generated header files
         1194  +#
         1195  +SRC11 = \
         1196  +  keywordhash.h \
  1163   1197     opcodes.h \
  1164         -  parse.c \
  1165   1198     parse.h \
  1166   1199     $(SQLITE3H)
  1167   1200   
  1168   1201   # All source code files.
  1169   1202   #
  1170         -SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5)
         1203  +SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11)
  1171   1204   
  1172   1205   # Source code to the test files.
  1173   1206   #
  1174   1207   TESTSRC = \
  1175   1208     $(TOP)\src\test1.c \
  1176   1209     $(TOP)\src\test2.c \
  1177   1210     $(TOP)\src\test3.c \
................................................................................
  1212   1245     $(TOP)\src\test_vfs.c \
  1213   1246     $(TOP)\src\test_windirent.c \
  1214   1247     $(TOP)\src\test_wsd.c \
  1215   1248     $(TOP)\ext\fts3\fts3_term.c \
  1216   1249     $(TOP)\ext\fts3\fts3_test.c \
  1217   1250     $(TOP)\ext\rbu\test_rbu.c
  1218   1251   
  1219         -# Statically linked extensions
         1252  +# Statically linked extensions.
  1220   1253   #
  1221   1254   TESTEXT = \
  1222   1255     $(TOP)\ext\misc\amatch.c \
  1223   1256     $(TOP)\ext\misc\closure.c \
  1224   1257     $(TOP)\ext\misc\eval.c \
  1225   1258     $(TOP)\ext\misc\fileio.c \
  1226   1259     $(TOP)\ext\misc\fuzzer.c \
................................................................................
  1232   1265     $(TOP)\ext\misc\percentile.c \
  1233   1266     $(TOP)\ext\misc\regexp.c \
  1234   1267     $(TOP)\ext\misc\series.c \
  1235   1268     $(TOP)\ext\misc\spellfix.c \
  1236   1269     $(TOP)\ext\misc\totype.c \
  1237   1270     $(TOP)\ext\misc\wholenumber.c
  1238   1271   
  1239         -
  1240   1272   # Source code to the library files needed by the test fixture
  1241   1273   #
  1242   1274   TESTSRC2 = \
  1243         -  $(TOP)\src\attach.c \
  1244         -  $(TOP)\src\backup.c \
  1245         -  $(TOP)\src\bitvec.c \
  1246         -  $(TOP)\src\btree.c \
  1247         -  $(TOP)\src\build.c \
  1248         -  $(TOP)\src\ctime.c \
  1249         -  $(TOP)\src\date.c \
  1250         -  $(TOP)\src\dbstat.c \
  1251         -  $(TOP)\src\expr.c \
  1252         -  $(TOP)\src\func.c \
  1253         -  $(TOP)\src\insert.c \
  1254         -  $(TOP)\src\wal.c \
  1255         -  $(TOP)\src\main.c \
  1256         -  $(TOP)\src\mem5.c \
  1257         -  $(TOP)\src\os.c \
  1258         -  $(TOP)\src\os_unix.c \
  1259         -  $(TOP)\src\os_win.c \
  1260         -  $(TOP)\src\pager.c \
  1261         -  $(TOP)\src\pragma.c \
  1262         -  $(TOP)\src\prepare.c \
  1263         -  $(TOP)\src\printf.c \
  1264         -  $(TOP)\src\random.c \
  1265         -  $(TOP)\src\pcache.c \
  1266         -  $(TOP)\src\pcache1.c \
  1267         -  $(TOP)\src\select.c \
  1268         -  $(TOP)\src\tokenize.c \
  1269         -  $(TOP)\src\utf.c \
  1270         -  $(TOP)\src\util.c \
  1271         -  $(TOP)\src\vdbeapi.c \
  1272         -  $(TOP)\src\vdbeaux.c \
  1273         -  $(TOP)\src\vdbe.c \
  1274         -  $(TOP)\src\vdbemem.c \
  1275         -  $(TOP)\src\vdbesort.c \
  1276         -  $(TOP)\src\vdbetrace.c \
  1277         -  $(TOP)\src\where.c \
  1278         -  $(TOP)\src\wherecode.c \
  1279         -  $(TOP)\src\whereexpr.c \
  1280         -  parse.c \
  1281         -  $(TOP)\ext\fts3\fts3.c \
  1282         -  $(TOP)\ext\fts3\fts3_aux.c \
  1283         -  $(TOP)\ext\fts3\fts3_expr.c \
  1284         -  $(TOP)\ext\fts3\fts3_tokenizer.c \
  1285         -  $(TOP)\ext\fts3\fts3_tokenize_vtab.c \
  1286         -  $(TOP)\ext\fts3\fts3_unicode.c \
  1287         -  $(TOP)\ext\fts3\fts3_unicode2.c \
  1288         -  $(TOP)\ext\fts3\fts3_write.c \
         1275  +  $(SRC00) \
         1276  +  $(SRC01) \
         1277  +  $(SRC06) \
         1278  +  $(SRC07) \
         1279  +  $(SRC10) \
  1289   1280     $(TOP)\ext\async\sqlite3async.c
  1290   1281   
  1291   1282   # Header files used by all library source files.
  1292   1283   #
  1293   1284   HDR = \
  1294   1285      $(TOP)\src\btree.h \
  1295   1286      $(TOP)\src\btreeInt.h \
................................................................................
  1456   1447   # build on the target system.  Some of the C source code and header
  1457   1448   # files are automatically generated.  This target takes care of
  1458   1449   # all that automatic generation.
  1459   1450   #
  1460   1451   .target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c
  1461   1452   	-rmdir /Q/S tsrc 2>NUL
  1462   1453   	-mkdir tsrc
  1463         -	for %i in ($(SRC1)) do copy /Y %i tsrc
  1464         -	for %i in ($(SRC2)) do copy /Y %i tsrc
  1465         -	for %i in ($(SRC3)) do copy /Y %i tsrc
  1466         -	for %i in ($(SRC4)) do copy /Y %i tsrc
  1467         -	for %i in ($(SRC5)) do copy /Y %i tsrc
         1454  +	for %i in ($(SRC)) do copy /Y %i tsrc
  1468   1455   	copy /Y fts5.c tsrc
  1469   1456   	copy /Y fts5.h tsrc
  1470   1457   	del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
  1471   1458   	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
  1472   1459   	move vdbe.new tsrc\vdbe.c
  1473   1460   	echo > .target_source
  1474   1461   
................................................................................
  1905   1892   # necessary because the test fixture requires non-API symbols which are
  1906   1893   # hidden when the library is built via the amalgamation).
  1907   1894   #
  1908   1895   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1909   1896   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
  1910   1897   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  1911   1898   
  1912         -TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP)
         1899  +TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
  1913   1900   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  1914   1901   !IF $(USE_AMALGAMATION)==0
  1915   1902   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  1916   1903   !ELSE
  1917   1904   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
  1918   1905   !ENDIF
  1919   1906   

Changes to src/os.c.

    13     13   ** This file contains OS interface code that is common to all
    14     14   ** architectures.
    15     15   */
    16     16   #define _SQLITE_OS_C_ 1
    17     17   #include "sqliteInt.h"
    18     18   #undef _SQLITE_OS_C_
    19     19   
           20  +/*
           21  +** If we compile with the SQLITE_TEST macro set, then the following block
           22  +** of code will give us the ability to simulate a disk I/O error.  This
           23  +** is used for testing the I/O recovery logic.
           24  +*/
           25  +#if defined(SQLITE_TEST)
           26  +int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */
           27  +int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */
           28  +int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */
           29  +int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */
           30  +int sqlite3_io_error_benign = 0;         /* True if errors are benign */
           31  +int sqlite3_diskfull_pending = 0;
           32  +int sqlite3_diskfull = 0;
           33  +#endif /* defined(SQLITE_TEST) */
           34  +
           35  +/*
           36  +** When testing, also keep a count of the number of open files.
           37  +*/
           38  +#if defined(SQLITE_TEST)
           39  +int sqlite3_open_file_count = 0;
           40  +#endif /* defined(SQLITE_TEST) */
           41  +
    20     42   /*
    21     43   ** The default SQLite sqlite3_vfs implementations do not allocate
    22     44   ** memory (actually, os_unix.c allocates a small amount of memory
    23     45   ** from within OsOpen()), but some third-party implementations may.
    24     46   ** So we test the effects of a malloc() failing and the sqlite3OsXXX()
    25     47   ** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro.
    26     48   **
    27         -** The following functions are instrumented for malloc() failure 
           49  +** The following functions are instrumented for malloc() failure
    28     50   ** testing:
    29     51   **
    30     52   **     sqlite3OsRead()
    31     53   **     sqlite3OsWrite()
    32     54   **     sqlite3OsSync()
    33     55   **     sqlite3OsFileSize()
    34     56   **     sqlite3OsLock()
................................................................................
   106    128   ** is only a hint and can be safely ignored.  The sqlite3OsFileControlHint()
   107    129   ** routine has no return value since the return value would be meaningless.
   108    130   */
   109    131   int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
   110    132   #ifdef SQLITE_TEST
   111    133     if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){
   112    134       /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
   113         -    ** is using a regular VFS, it is called after the corresponding 
   114         -    ** transaction has been committed. Injecting a fault at this point 
          135  +    ** is using a regular VFS, it is called after the corresponding
          136  +    ** transaction has been committed. Injecting a fault at this point
   115    137       ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
   116    138       ** but the transaction is committed anyway.
   117    139       **
   118    140       ** The core must call OsFileControl() though, not OsFileControlHint(),
   119    141       ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
   120    142       ** means the commit really has failed and an error should be returned
   121    143       ** to the user.  */
................................................................................
   176    198   #endif
   177    199   
   178    200   /*
   179    201   ** The next group of routines are convenience wrappers around the
   180    202   ** VFS methods.
   181    203   */
   182    204   int sqlite3OsOpen(
   183         -  sqlite3_vfs *pVfs, 
   184         -  const char *zPath, 
   185         -  sqlite3_file *pFile, 
   186         -  int flags, 
          205  +  sqlite3_vfs *pVfs,
          206  +  const char *zPath,
          207  +  sqlite3_file *pFile,
          208  +  int flags,
   187    209     int *pFlagsOut
   188    210   ){
   189    211     int rc;
   190    212     DO_OS_MALLOC_TEST(0);
   191    213     /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed
   192    214     ** down into the VFS layer.  Some SQLITE_OPEN_ flags (for example,
   193    215     ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before
................................................................................
   198    220   }
   199    221   int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
   200    222     DO_OS_MALLOC_TEST(0);
   201    223     assert( dirSync==0 || dirSync==1 );
   202    224     return pVfs->xDelete(pVfs, zPath, dirSync);
   203    225   }
   204    226   int sqlite3OsAccess(
   205         -  sqlite3_vfs *pVfs, 
   206         -  const char *zPath, 
   207         -  int flags, 
          227  +  sqlite3_vfs *pVfs,
          228  +  const char *zPath,
          229  +  int flags,
   208    230     int *pResOut
   209    231   ){
   210    232     DO_OS_MALLOC_TEST(0);
   211    233     return pVfs->xAccess(pVfs, zPath, flags, pResOut);
   212    234   }
   213    235   int sqlite3OsFullPathname(
   214         -  sqlite3_vfs *pVfs, 
   215         -  const char *zPath, 
   216         -  int nPathOut, 
          236  +  sqlite3_vfs *pVfs,
          237  +  const char *zPath,
          238  +  int nPathOut,
   217    239     char *zPathOut
   218    240   ){
   219    241     DO_OS_MALLOC_TEST(0);
   220    242     zPathOut[0] = 0;
   221    243     return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
   222    244   }
   223    245   #ifndef SQLITE_OMIT_LOAD_EXTENSION
................................................................................
   255    277       rc = pVfs->xCurrentTime(pVfs, &r);
   256    278       *pTimeOut = (sqlite3_int64)(r*86400000.0);
   257    279     }
   258    280     return rc;
   259    281   }
   260    282   
   261    283   int sqlite3OsOpenMalloc(
   262         -  sqlite3_vfs *pVfs, 
   263         -  const char *zFile, 
   264         -  sqlite3_file **ppFile, 
          284  +  sqlite3_vfs *pVfs,
          285  +  const char *zFile,
          286  +  sqlite3_file **ppFile,
   265    287     int flags,
   266    288     int *pOutFlags
   267    289   ){
   268    290     int rc = SQLITE_NOMEM;
   269    291     sqlite3_file *pFile;
   270    292     pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
   271    293     if( pFile ){

Changes to src/os_common.h.

    31     31   
    32     32   /*
    33     33   ** Macros for performance tracing.  Normally turned off.  Only works
    34     34   ** on i486 hardware.
    35     35   */
    36     36   #ifdef SQLITE_PERFORMANCE_TRACE
    37     37   
    38         -/* 
    39         -** hwtime.h contains inline assembler code for implementing 
           38  +/*
           39  +** hwtime.h contains inline assembler code for implementing
    40     40   ** high-performance timing routines.
    41     41   */
    42     42   #include "hwtime.h"
    43     43   
    44     44   static sqlite_uint64 g_start;
    45     45   static sqlite_uint64 g_elapsed;
    46     46   #define TIMER_START       g_start=sqlite3Hwtime()
................................................................................
    53     53   #endif
    54     54   
    55     55   /*
    56     56   ** If we compile with the SQLITE_TEST macro set, then the following block
    57     57   ** of code will give us the ability to simulate a disk I/O error.  This
    58     58   ** is used for testing the I/O recovery logic.
    59     59   */
    60         -#ifdef SQLITE_TEST
    61         -int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */
    62         -int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */
    63         -int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */
    64         -int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */
    65         -int sqlite3_io_error_benign = 0;         /* True if errors are benign */
    66         -int sqlite3_diskfull_pending = 0;
    67         -int sqlite3_diskfull = 0;
           60  +#if defined(SQLITE_TEST)
           61  +extern int sqlite3_io_error_hit;
           62  +extern int sqlite3_io_error_hardhit;
           63  +extern int sqlite3_io_error_pending;
           64  +extern int sqlite3_io_error_persist;
           65  +extern int sqlite3_io_error_benign;
           66  +extern int sqlite3_diskfull_pending;
           67  +extern int sqlite3_diskfull;
    68     68   #define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)
    69     69   #define SimulateIOError(CODE)  \
    70     70     if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \
    71     71          || sqlite3_io_error_pending-- == 1 )  \
    72     72                 { local_ioerr(); CODE; }
    73     73   static void local_ioerr(){
    74     74     IOTRACE(("IOERR\n"));
................................................................................
    86     86          sqlite3_diskfull_pending--; \
    87     87        } \
    88     88      }
    89     89   #else
    90     90   #define SimulateIOErrorBenign(X)
    91     91   #define SimulateIOError(A)
    92     92   #define SimulateDiskfullError(A)
    93         -#endif
           93  +#endif /* defined(SQLITE_TEST) */
    94     94   
    95     95   /*
    96     96   ** When testing, keep a count of the number of open files.
    97     97   */
    98         -#ifdef SQLITE_TEST
    99         -int sqlite3_open_file_count = 0;
           98  +#if defined(SQLITE_TEST)
           99  +extern int sqlite3_open_file_count;
   100    100   #define OpenCounter(X)  sqlite3_open_file_count+=(X)
   101    101   #else
   102    102   #define OpenCounter(X)
   103         -#endif
          103  +#endif /* defined(SQLITE_TEST) */
   104    104   
   105    105   #endif /* !defined(_OS_COMMON_H_) */