From: mistachkin Date: Thu, 11 Feb 2016 21:28:16 +0000 (+0000) Subject: Enhance the MSVC makefile to enable building 'testfixture' fully from source code. X-Git-Tag: version-3.11.0~10^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c04c54b8420ac11408ef4565936db6a17dbfc814;p=thirdparty%2Fsqlite.git Enhance the MSVC makefile to enable building 'testfixture' fully from source code. FossilOrigin-Name: 54ff3a26bc45a1c3c0690119e8fd00b02e2a16ba --- diff --git a/Makefile.msc b/Makefile.msc index 07319eac94..6f9262b689 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1005,9 +1005,9 @@ LIBRESOBJS = !ENDIF # <> -# All of the source code files. +# Core source code files, part 1. # -SRC1 = \ +SRC00 = \ $(TOP)\src\alter.c \ $(TOP)\src\analyze.c \ $(TOP)\src\attach.c \ @@ -1016,8 +1016,6 @@ SRC1 = \ $(TOP)\src\bitvec.c \ $(TOP)\src\btmutex.c \ $(TOP)\src\btree.c \ - $(TOP)\src\btree.h \ - $(TOP)\src\btreeInt.h \ $(TOP)\src\build.c \ $(TOP)\src\callback.c \ $(TOP)\src\complete.c \ @@ -1031,8 +1029,6 @@ SRC1 = \ $(TOP)\src\func.c \ $(TOP)\src\global.c \ $(TOP)\src\hash.c \ - $(TOP)\src\hash.h \ - $(TOP)\src\hwtime.h \ $(TOP)\src\insert.c \ $(TOP)\src\journal.c \ $(TOP)\src\legacy.c \ @@ -1045,29 +1041,22 @@ SRC1 = \ $(TOP)\src\mem3.c \ $(TOP)\src\mem5.c \ $(TOP)\src\memjournal.c \ - $(TOP)\src\msvc.h \ $(TOP)\src\mutex.c \ - $(TOP)\src\mutex.h \ $(TOP)\src\mutex_noop.c \ $(TOP)\src\mutex_unix.c \ $(TOP)\src\mutex_w32.c \ $(TOP)\src\notify.c \ $(TOP)\src\os.c \ - $(TOP)\src\os.h \ - $(TOP)\src\os_common.h \ - $(TOP)\src\os_setup.h \ $(TOP)\src\os_unix.c \ - $(TOP)\src\os_win.c \ - $(TOP)\src\os_win.h -SRC2 = \ + $(TOP)\src\os_win.c + +# Core source code files, part 2. +# +SRC01 = \ $(TOP)\src\pager.c \ - $(TOP)\src\pager.h \ - $(TOP)\src\parse.y \ $(TOP)\src\pcache.c \ - $(TOP)\src\pcache.h \ $(TOP)\src\pcache1.c \ $(TOP)\src\pragma.c \ - $(TOP)\src\pragma.h \ $(TOP)\src\prepare.c \ $(TOP)\src\printf.c \ $(TOP)\src\random.c \ @@ -1075,11 +1064,6 @@ SRC2 = \ $(TOP)\src\rowset.c \ $(TOP)\src\select.c \ $(TOP)\src\status.c \ - $(TOP)\src\shell.c \ - $(TOP)\src\sqlite.h.in \ - $(TOP)\src\sqlite3ext.h \ - $(TOP)\src\sqliteInt.h \ - $(TOP)\src\sqliteLimit.h \ $(TOP)\src\table.c \ $(TOP)\src\threads.c \ $(TOP)\src\tclsqlite.c \ @@ -1091,83 +1075,132 @@ SRC2 = \ $(TOP)\src\util.c \ $(TOP)\src\vacuum.c \ $(TOP)\src\vdbe.c \ - $(TOP)\src\vdbe.h \ $(TOP)\src\vdbeapi.c \ $(TOP)\src\vdbeaux.c \ $(TOP)\src\vdbeblob.c \ $(TOP)\src\vdbemem.c \ $(TOP)\src\vdbesort.c \ $(TOP)\src\vdbetrace.c \ - $(TOP)\src\vdbeInt.h \ $(TOP)\src\vtab.c \ - $(TOP)\src\vxworks.h \ $(TOP)\src\wal.c \ - $(TOP)\src\wal.h \ $(TOP)\src\walker.c \ $(TOP)\src\where.c \ $(TOP)\src\wherecode.c \ - $(TOP)\src\whereexpr.c \ + $(TOP)\src\whereexpr.c + +# Shell source code files. +# +SRC02 = \ + $(TOP)\src\shell.c + +# Core miscellaneous files. +# +SRC03 = \ + $(TOP)\src\parse.y + +# Core header files, part 1. +# +SRC04 = \ + $(TOP)\src\btree.h \ + $(TOP)\src\btreeInt.h \ + $(TOP)\src\hash.h \ + $(TOP)\src\hwtime.h \ + $(TOP)\src\msvc.h \ + $(TOP)\src\mutex.h \ + $(TOP)\src\os.h \ + $(TOP)\src\os_common.h \ + $(TOP)\src\os_setup.h \ + $(TOP)\src\os_win.h + +# Core header files, part 2. +# +SRC05 = \ + $(TOP)\src\pager.h \ + $(TOP)\src\pcache.h \ + $(TOP)\src\pragma.h \ + $(TOP)\src\sqlite.h.in \ + $(TOP)\src\sqlite3ext.h \ + $(TOP)\src\sqliteInt.h \ + $(TOP)\src\sqliteLimit.h \ + $(TOP)\src\vdbe.h \ + $(TOP)\src\vdbeInt.h \ + $(TOP)\src\vxworks.h \ + $(TOP)\src\wal.h \ $(TOP)\src\whereInt.h -# Source code for extensions +# Extension source code files, part 1. # -SRC3 = \ +SRC06 = \ $(TOP)\ext\fts1\fts1.c \ - $(TOP)\ext\fts1\fts1.h \ $(TOP)\ext\fts1\fts1_hash.c \ - $(TOP)\ext\fts1\fts1_hash.h \ $(TOP)\ext\fts1\fts1_porter.c \ - $(TOP)\ext\fts1\fts1_tokenizer.h \ $(TOP)\ext\fts1\fts1_tokenizer1.c \ $(TOP)\ext\fts2\fts2.c \ - $(TOP)\ext\fts2\fts2.h \ $(TOP)\ext\fts2\fts2_hash.c \ - $(TOP)\ext\fts2\fts2_hash.h \ $(TOP)\ext\fts2\fts2_icu.c \ $(TOP)\ext\fts2\fts2_porter.c \ - $(TOP)\ext\fts2\fts2_tokenizer.h \ $(TOP)\ext\fts2\fts2_tokenizer.c \ $(TOP)\ext\fts2\fts2_tokenizer1.c -SRC4 = \ + +# Extension source code files, part 2. +# +SRC07 = \ $(TOP)\ext\fts3\fts3.c \ - $(TOP)\ext\fts3\fts3.h \ - $(TOP)\ext\fts3\fts3Int.h \ $(TOP)\ext\fts3\fts3_aux.c \ $(TOP)\ext\fts3\fts3_expr.c \ $(TOP)\ext\fts3\fts3_hash.c \ - $(TOP)\ext\fts3\fts3_hash.h \ $(TOP)\ext\fts3\fts3_icu.c \ $(TOP)\ext\fts3\fts3_porter.c \ $(TOP)\ext\fts3\fts3_snippet.c \ - $(TOP)\ext\fts3\fts3_tokenizer.h \ $(TOP)\ext\fts3\fts3_tokenizer.c \ $(TOP)\ext\fts3\fts3_tokenizer1.c \ $(TOP)\ext\fts3\fts3_tokenize_vtab.c \ $(TOP)\ext\fts3\fts3_unicode.c \ $(TOP)\ext\fts3\fts3_unicode2.c \ $(TOP)\ext\fts3\fts3_write.c \ - $(TOP)\ext\icu\sqliteicu.h \ $(TOP)\ext\icu\icu.c \ - $(TOP)\ext\rtree\rtree.h \ $(TOP)\ext\rtree\rtree.c \ - $(TOP)\ext\rbu\sqlite3rbu.h \ $(TOP)\ext\rbu\sqlite3rbu.c \ $(TOP)\ext\misc\json1.c +# Extension header files, part 1. +# +SRC08 = \ + $(TOP)\ext\fts1\fts1.h \ + $(TOP)\ext\fts1\fts1_hash.h \ + $(TOP)\ext\fts1\fts1_tokenizer.h \ + $(TOP)\ext\fts2\fts2.h \ + $(TOP)\ext\fts2\fts2_hash.h \ + $(TOP)\ext\fts2\fts2_tokenizer.h + +# Extension header files, part 2. +# +SRC09 = \ + $(TOP)\ext\fts3\fts3.h \ + $(TOP)\ext\fts3\fts3Int.h \ + $(TOP)\ext\fts3\fts3_hash.h \ + $(TOP)\ext\fts3\fts3_tokenizer.h \ + $(TOP)\ext\icu\sqliteicu.h \ + $(TOP)\ext\rtree\rtree.h \ + $(TOP)\ext\rbu\sqlite3rbu.h # Generated source code files # -SRC5 = \ - keywordhash.h \ +SRC10 = \ opcodes.c \ + parse.c + +# Generated header files +# +SRC11 = \ + keywordhash.h \ opcodes.h \ - parse.c \ parse.h \ $(SQLITE3H) # All source code files. # -SRC = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) +SRC = $(SRC00) $(SRC01) $(SRC02) $(SRC03) $(SRC04) $(SRC05) $(SRC06) $(SRC07) $(SRC08) $(SRC09) $(SRC10) $(SRC11) # Source code to the test files. # @@ -1216,7 +1249,7 @@ TESTSRC = \ $(TOP)\ext\fts3\fts3_test.c \ $(TOP)\ext\rbu\test_rbu.c -# Statically linked extensions +# Statically linked extensions. # TESTEXT = \ $(TOP)\ext\misc\amatch.c \ @@ -1236,56 +1269,14 @@ TESTEXT = \ $(TOP)\ext\misc\totype.c \ $(TOP)\ext\misc\wholenumber.c - # Source code to the library files needed by the test fixture # TESTSRC2 = \ - $(TOP)\src\attach.c \ - $(TOP)\src\backup.c \ - $(TOP)\src\bitvec.c \ - $(TOP)\src\btree.c \ - $(TOP)\src\build.c \ - $(TOP)\src\ctime.c \ - $(TOP)\src\date.c \ - $(TOP)\src\dbstat.c \ - $(TOP)\src\expr.c \ - $(TOP)\src\func.c \ - $(TOP)\src\insert.c \ - $(TOP)\src\wal.c \ - $(TOP)\src\main.c \ - $(TOP)\src\mem5.c \ - $(TOP)\src\os.c \ - $(TOP)\src\os_unix.c \ - $(TOP)\src\os_win.c \ - $(TOP)\src\pager.c \ - $(TOP)\src\pragma.c \ - $(TOP)\src\prepare.c \ - $(TOP)\src\printf.c \ - $(TOP)\src\random.c \ - $(TOP)\src\pcache.c \ - $(TOP)\src\pcache1.c \ - $(TOP)\src\select.c \ - $(TOP)\src\tokenize.c \ - $(TOP)\src\utf.c \ - $(TOP)\src\util.c \ - $(TOP)\src\vdbeapi.c \ - $(TOP)\src\vdbeaux.c \ - $(TOP)\src\vdbe.c \ - $(TOP)\src\vdbemem.c \ - $(TOP)\src\vdbesort.c \ - $(TOP)\src\vdbetrace.c \ - $(TOP)\src\where.c \ - $(TOP)\src\wherecode.c \ - $(TOP)\src\whereexpr.c \ - parse.c \ - $(TOP)\ext\fts3\fts3.c \ - $(TOP)\ext\fts3\fts3_aux.c \ - $(TOP)\ext\fts3\fts3_expr.c \ - $(TOP)\ext\fts3\fts3_tokenizer.c \ - $(TOP)\ext\fts3\fts3_tokenize_vtab.c \ - $(TOP)\ext\fts3\fts3_unicode.c \ - $(TOP)\ext\fts3\fts3_unicode2.c \ - $(TOP)\ext\fts3\fts3_write.c \ + $(SRC00) \ + $(SRC01) \ + $(SRC06) \ + $(SRC07) \ + $(SRC10) \ $(TOP)\ext\async\sqlite3async.c # Header files used by all library source files. @@ -1460,11 +1451,7 @@ mptest: mptester.exe .target_source: $(SRC) $(TOP)\tool\vdbe-compress.tcl fts5.c -rmdir /Q/S tsrc 2>NUL -mkdir tsrc - for %i in ($(SRC1)) do copy /Y %i tsrc - for %i in ($(SRC2)) do copy /Y %i tsrc - for %i in ($(SRC3)) do copy /Y %i tsrc - for %i in ($(SRC4)) do copy /Y %i tsrc - for %i in ($(SRC5)) do copy /Y %i tsrc + for %i in ($(SRC)) do copy /Y %i tsrc copy /Y fts5.c tsrc copy /Y fts5.h tsrc del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL @@ -1909,7 +1896,7 @@ TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN) -TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP) +TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C) !IF $(USE_AMALGAMATION)==0 TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0) diff --git a/manifest b/manifest index f261f4db04..9da855416e 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -C Fix\sanother\sunused\svariable\swarning\sin\sfts5\scode. -D 2016-02-11T18:18:33.214 +C Enhance\sthe\sMSVC\smakefile\sto\senable\sbuilding\s'testfixture'\sfully\sfrom\ssource\scode. +D 2016-02-11T21:28:16.615 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 -F Makefile.msc 463edfba5c6fccebc61d8c094ccd463a6a55becb +F Makefile.msc 5e216ab1a9d71888cd18f759edc37742b22ab88a F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 F VERSION 866588d1edf0ccb5b0d33896974338f97564f719 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -328,9 +328,9 @@ F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4 F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23 F src/mutex_w32.c 5e6fe1c298fb5a8a15aaed4161d5759311431c17 F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7 -F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 +F src/os.c 205fa2bad945a0dc7cad48f9f95ea3e8dc5408ff F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf -F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e +F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c 821ed110197175165cf2f50b0930c7ff9a24504c F src/os_win.c ccf29ddded3e41e506b6bd98c1171aa0963b23f2 @@ -1427,7 +1427,10 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh ef6ebc6fd8d2dc35db3b622015c16a023d4fef4f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P facbc424e555061135aced7b134bf6c19f54e484 -R 36e010c0ed746dc7878f2a118cec7bdd -U dan -Z 6610f3f01094a7b96f8ca1dff6e9ec45 +P 61b4c120540afd80a4021b0d3990f13acc38a059 +R b57cf2985771e3ae41eb2414d99c4601 +T *branch * testFixtureSrc +T *sym-testFixtureSrc * +T -sym-trunk * +U mistachkin +Z 5a46bf6df8254b3a0e184f4d03ced4bc diff --git a/manifest.uuid b/manifest.uuid index 5eb5758b92..25c4002fdb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -61b4c120540afd80a4021b0d3990f13acc38a059 \ No newline at end of file +54ff3a26bc45a1c3c0690119e8fd00b02e2a16ba \ No newline at end of file diff --git a/src/os.c b/src/os.c index 2a2cf13c5e..90130d0eb7 100644 --- a/src/os.c +++ b/src/os.c @@ -17,6 +17,28 @@ #include "sqliteInt.h" #undef _SQLITE_OS_C_ +/* +** If we compile with the SQLITE_TEST macro set, then the following block +** of code will give us the ability to simulate a disk I/O error. This +** is used for testing the I/O recovery logic. +*/ +#if defined(SQLITE_TEST) +int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */ +int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ +int sqlite3_io_error_pending = 0; /* Count down to first I/O error */ +int sqlite3_io_error_persist = 0; /* True if I/O errors persist */ +int sqlite3_io_error_benign = 0; /* True if errors are benign */ +int sqlite3_diskfull_pending = 0; +int sqlite3_diskfull = 0; +#endif /* defined(SQLITE_TEST) */ + +/* +** When testing, also keep a count of the number of open files. +*/ +#if defined(SQLITE_TEST) +int sqlite3_open_file_count = 0; +#endif /* defined(SQLITE_TEST) */ + /* ** The default SQLite sqlite3_vfs implementations do not allocate ** memory (actually, os_unix.c allocates a small amount of memory @@ -24,7 +46,7 @@ ** So we test the effects of a malloc() failing and the sqlite3OsXXX() ** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro. ** -** The following functions are instrumented for malloc() failure +** The following functions are instrumented for malloc() failure ** testing: ** ** sqlite3OsRead() @@ -110,8 +132,8 @@ int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){ #ifdef SQLITE_TEST if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){ /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite - ** is using a regular VFS, it is called after the corresponding - ** transaction has been committed. Injecting a fault at this point + ** is using a regular VFS, it is called after the corresponding + ** transaction has been committed. Injecting a fault at this point ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM ** but the transaction is committed anyway. ** @@ -180,10 +202,10 @@ int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ ** VFS methods. */ int sqlite3OsOpen( - sqlite3_vfs *pVfs, - const char *zPath, - sqlite3_file *pFile, - int flags, + sqlite3_vfs *pVfs, + const char *zPath, + sqlite3_file *pFile, + int flags, int *pFlagsOut ){ int rc; @@ -202,18 +224,18 @@ int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ return pVfs->xDelete(pVfs, zPath, dirSync); } int sqlite3OsAccess( - sqlite3_vfs *pVfs, - const char *zPath, - int flags, + sqlite3_vfs *pVfs, + const char *zPath, + int flags, int *pResOut ){ DO_OS_MALLOC_TEST(0); return pVfs->xAccess(pVfs, zPath, flags, pResOut); } int sqlite3OsFullPathname( - sqlite3_vfs *pVfs, - const char *zPath, - int nPathOut, + sqlite3_vfs *pVfs, + const char *zPath, + int nPathOut, char *zPathOut ){ DO_OS_MALLOC_TEST(0); @@ -259,9 +281,9 @@ int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){ } int sqlite3OsOpenMalloc( - sqlite3_vfs *pVfs, - const char *zFile, - sqlite3_file **ppFile, + sqlite3_vfs *pVfs, + const char *zFile, + sqlite3_file **ppFile, int flags, int *pOutFlags ){ diff --git a/src/os_common.h b/src/os_common.h index d18b95a5ff..1ed4d7a8e1 100644 --- a/src/os_common.h +++ b/src/os_common.h @@ -35,8 +35,8 @@ */ #ifdef SQLITE_PERFORMANCE_TRACE -/* -** hwtime.h contains inline assembler code for implementing +/* +** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. */ #include "hwtime.h" @@ -57,14 +57,14 @@ static sqlite_uint64 g_elapsed; ** of code will give us the ability to simulate a disk I/O error. This ** is used for testing the I/O recovery logic. */ -#ifdef SQLITE_TEST -int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */ -int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ -int sqlite3_io_error_pending = 0; /* Count down to first I/O error */ -int sqlite3_io_error_persist = 0; /* True if I/O errors persist */ -int sqlite3_io_error_benign = 0; /* True if errors are benign */ -int sqlite3_diskfull_pending = 0; -int sqlite3_diskfull = 0; +#if defined(SQLITE_TEST) +extern int sqlite3_io_error_hit; +extern int sqlite3_io_error_hardhit; +extern int sqlite3_io_error_pending; +extern int sqlite3_io_error_persist; +extern int sqlite3_io_error_benign; +extern int sqlite3_diskfull_pending; +extern int sqlite3_diskfull; #define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) #define SimulateIOError(CODE) \ if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ @@ -90,16 +90,16 @@ static void local_ioerr(){ #define SimulateIOErrorBenign(X) #define SimulateIOError(A) #define SimulateDiskfullError(A) -#endif +#endif /* defined(SQLITE_TEST) */ /* ** When testing, keep a count of the number of open files. */ -#ifdef SQLITE_TEST -int sqlite3_open_file_count = 0; +#if defined(SQLITE_TEST) +extern int sqlite3_open_file_count; #define OpenCounter(X) sqlite3_open_file_count+=(X) #else #define OpenCounter(X) -#endif +#endif /* defined(SQLITE_TEST) */ #endif /* !defined(_OS_COMMON_H_) */