From 15ab9418d9b220a826c033847e074529c2b22dd0 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 24 Feb 2014 14:24:01 +0000 Subject: [PATCH 1/4] Remove an unused variable from the VDBE_PROFILE compile-time option. Keep the opcode count in an u32 instead of an int. FossilOrigin-Name: 4df0ac9023d9261145a4425a508ba009a10276fc --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/vdbe.c | 6 ------ src/vdbe.h | 2 +- src/vdbeaux.c | 4 +++- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 419633cc87..349983f4f3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\stext\sof\sa\scomment\sused\sto\sgenerate\sVDBE\sopcode\sdocumentation\sso\sthat\nit\somits\ssymbols\sthat\scan\sbe\smistaken\sfor\sa\shyperlink\sby\sthe\sparser. -D 2014-02-20T19:42:00.531 +C Remove\san\sunused\svariable\sfrom\sthe\sVDBE_PROFILE\scompile-time\soption.\s\sKeep\sthe\nopcode\scount\sin\san\su32\sinstead\sof\san\sint. +D 2014-02-24T14:24:01.038 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -277,11 +277,11 @@ F src/update.c 5b3e74a03b3811e586b4f2b4cbd7c49f01c93115 F src/utf.c 6fc6c88d50448c469c5c196acf21617a24f90269 F src/util.c c46c90459ef9bdc0c6c73803cf4c55425b4771cf F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179 -F src/vdbe.c c5ff7b384ed108be747220d4c47fcea6a36b062b -F src/vdbe.h 6c703ccef97f4504bd0d79cc09180185a60ae8ad +F src/vdbe.c 6c8f28911e702151c8ef03c568db5a066d3a85d4 +F src/vdbe.h 147027d6e8e667a63e87177a38e2b42c71fdacf8 F src/vdbeInt.h 5286af9067cabdb8ba57b87c0c988a931be6c6c8 F src/vdbeapi.c 5bc41aaea448a7fc250902c418f1795859be3820 -F src/vdbeaux.c 0e01d6fda149c689039caadb8c89b20abb58e21d +F src/vdbeaux.c 8b8eeb3cd89e4b3d4f40186344915b49b7c1c0f7 F src/vdbeblob.c d939997de046b8fcc607cfee4248f3d33dbcca50 F src/vdbemem.c 06603e8e9d2f3247b68c6bbe4bd37fb6721b5bda F src/vdbesort.c 9d83601f9d6243fe70dd0169a2820c5ddfd48147 @@ -1151,7 +1151,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 824029090d1c4c4c608f67dd197961eba29c039d -R 819e2e4df777a2f59b5f5445b2831eb5 +P b46d4e8923e6e367412bba7aeac07039bbcbabd1 +R e5107e17f1549034e719556b6caa9337 U drh -Z c4d587ace814e560a6dc901fdec24d15 +Z 29723a7a1d524b99d64cf7ed14fa2052 diff --git a/manifest.uuid b/manifest.uuid index 32d13dfb30..2aabeadce3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b46d4e8923e6e367412bba7aeac07039bbcbabd1 \ No newline at end of file +4df0ac9023d9261145a4425a508ba009a10276fc \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 2253af4719..5ab0127658 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -492,7 +492,6 @@ int sqlite3VdbeExec( i64 lastRowid = db->lastRowid; /* Saved value of the last insert ROWID */ #ifdef VDBE_PROFILE u64 start; /* CPU clock count at start of opcode */ - int origPc; /* Program counter at start of opcode */ #endif /*** INSERT STACK UNION HERE ***/ @@ -554,7 +553,6 @@ int sqlite3VdbeExec( assert( pc>=0 && pcnOp ); if( db->mallocFailed ) goto no_mem; #ifdef VDBE_PROFILE - origPc = pc; start = sqlite3Hwtime(); #endif nVmStep++; @@ -6275,10 +6273,6 @@ default: { /* This is really OP_Noop and OP_Explain */ u64 elapsed = sqlite3Hwtime() - start; pOp->cycles += elapsed; pOp->cnt++; -#if 0 - fprintf(stdout, "%10llu ", elapsed); - sqlite3VdbePrintOp(stdout, origPc, &aOp[origPc]); -#endif } #endif diff --git a/src/vdbe.h b/src/vdbe.h index 44cd9123aa..66c69eec23 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -65,7 +65,7 @@ struct VdbeOp { char *zComment; /* Comment to improve readability */ #endif #ifdef VDBE_PROFILE - int cnt; /* Number of times this instruction was executed */ + u32 cnt; /* Number of times this instruction was executed */ u64 cycles; /* Total time spent executing this instruction */ #endif #ifdef SQLITE_VDBE_COVERAGE diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 89bb8975a5..ef70f8ae3f 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -2580,11 +2580,13 @@ int sqlite3VdbeReset(Vdbe *p){ if( pc!='\n' ) fprintf(out, "\n"); } for(i=0; inOp; i++){ - fprintf(out, "%6d %10lld %8lld ", + char zHdr[100]; + sqlite3_snprintf(sizeof(zHdr), zHdr, "%6u %12llu %8llu ", p->aOp[i].cnt, p->aOp[i].cycles, p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0 ); + fprintf(out, "%s", zHdr); sqlite3VdbePrintOp(out, i, &p->aOp[i]); } fclose(out); From 9d41bc105d1bc5da9431180f8295ce52bcc344e6 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 24 Feb 2014 19:07:51 +0000 Subject: [PATCH 2/4] In memsys5, initialize new allocations to non-zero bytes. Change the content of freed allocations to prevent use after free. These changes in SQLITE_DEBUG only. FossilOrigin-Name: ba5f0a5599dece6d8f3dfe652800c28875c74a24 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/mem5.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 349983f4f3..ea4b646be9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sunused\svariable\sfrom\sthe\sVDBE_PROFILE\scompile-time\soption.\s\sKeep\sthe\nopcode\scount\sin\san\su32\sinstead\sof\san\sint. -D 2014-02-24T14:24:01.038 +C In\smemsys5,\sinitialize\snew\sallocations\sto\snon-zero\sbytes.\s\sChange\sthe\scontent\nof\sfreed\sallocations\sto\sprevent\suse\safter\sfree.\s\sThese\schanges\sin\sSQLITE_DEBUG\nonly. +D 2014-02-24T19:07:51.519 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -191,7 +191,7 @@ F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b F src/mem2.c dce31758da87ec2cfa52ba4c5df1aed6e07d8e8f F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534 -F src/mem5.c 19d9271cb936742707b6118ed44d779657c7c511 +F src/mem5.c aeb019f271ea53de83d651ec526877e6ba863450 F src/memjournal.c 0683aac6cab6ec2b5374c0db37c0deb2436a3785 F src/mutex.c d3b66a569368015e0fcb1ac15f81c119f504d3bc F src/mutex.h 5bc526e19dccc412b7ff04642f6fdad3fdfdabea @@ -1151,7 +1151,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P b46d4e8923e6e367412bba7aeac07039bbcbabd1 -R e5107e17f1549034e719556b6caa9337 +P 4df0ac9023d9261145a4425a508ba009a10276fc +R d75bf2d1dc1afee51bd2a2b5f0c23dc4 U drh -Z 29723a7a1d524b99d64cf7ed14fa2052 +Z e260958c722bfd17d5ba07190b7e2529 diff --git a/manifest.uuid b/manifest.uuid index 2aabeadce3..99dcc1b1b7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4df0ac9023d9261145a4425a508ba009a10276fc \ No newline at end of file +ba5f0a5599dece6d8f3dfe652800c28875c74a24 \ No newline at end of file diff --git a/src/mem5.c b/src/mem5.c index 4674ec68f5..5d75611a32 100644 --- a/src/mem5.c +++ b/src/mem5.c @@ -275,6 +275,12 @@ static void *memsys5MallocUnsafe(int nByte){ if( mem5.maxCount Date: Mon, 24 Feb 2014 19:49:36 +0000 Subject: [PATCH 3/4] Close some stray connections in walro.test. FossilOrigin-Name: d6746cabaa22429644c956a4b5fd91896376de2d --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/walro.test | 14 ++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index ea4b646be9..916f53cc00 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\smemsys5,\sinitialize\snew\sallocations\sto\snon-zero\sbytes.\s\sChange\sthe\scontent\nof\sfreed\sallocations\sto\sprevent\suse\safter\sfree.\s\sThese\schanges\sin\sSQLITE_DEBUG\nonly. -D 2014-02-24T19:07:51.519 +C Close\ssome\sstray\sconnections\sin\swalro.test. +D 2014-02-24T19:49:36.852 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1064,7 +1064,7 @@ F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 F test/walmode.test 4022fe03ae6e830583672caa101f046438a0473c F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496 F test/walpersist.test 8c6b7e3ec1ba91b5e4dc4e0921d6d3f87cd356a6 -F test/walro.test 6cc247a0cc9b36aeea2057dd28a922a1cdfbd630 +F test/walro.test 34422d1d95aaff0388f0791ec20edb34e2a3ed57 F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417 F test/walslow.test e7be6d9888f83aa5d3d3c7c08aa9b5c28b93609a F test/walthread.test de8dbaf6d9e41481c460ba31ca61e163d7348f8e @@ -1151,7 +1151,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 4df0ac9023d9261145a4425a508ba009a10276fc -R d75bf2d1dc1afee51bd2a2b5f0c23dc4 -U drh -Z e260958c722bfd17d5ba07190b7e2529 +P ba5f0a5599dece6d8f3dfe652800c28875c74a24 +R 55b5056ebfab7e0aa95c7fc2968f106d +U dan +Z 43d53118dac35420ad2faa5a259188da diff --git a/manifest.uuid b/manifest.uuid index 99dcc1b1b7..62abb66e87 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba5f0a5599dece6d8f3dfe652800c28875c74a24 \ No newline at end of file +d6746cabaa22429644c956a4b5fd91896376de2d \ No newline at end of file diff --git a/test/walro.test b/test/walro.test index f1ed275a1d..6d920b1e24 100644 --- a/test/walro.test +++ b/test/walro.test @@ -32,9 +32,6 @@ ifcapable !wal { } do_multiclient_test tn { - # Do not run tests with the connections in the same process. - # - if {$tn==2} continue # Close all connections and delete the database. # @@ -43,6 +40,10 @@ do_multiclient_test tn { code3 { db3 close } forcedelete test.db forcedelete walro + + # Do not run tests with the connections in the same process. + # + if {$tn==2} continue foreach c {code1 code2 code3} { $c { @@ -232,9 +233,6 @@ forcedelete test.db # database file while a checkpoint operation is ongoing. # do_multiclient_test tn { - # Do not run tests with the connections in the same process. - # - if {$tn==2} continue # Close all connections and delete the database. # @@ -243,6 +241,10 @@ do_multiclient_test tn { code3 { db3 close } forcedelete test.db forcedelete walro + + # Do not run tests with the connections in the same process. + # + if {$tn==2} continue foreach c {code1 code2 code3} { $c { From 1925a2e6f88d288b38474053356cb399df5d410f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 24 Feb 2014 21:20:25 +0000 Subject: [PATCH 4/4] Enhance testing support for the Win32 VFS dynamic extension loading facilities. FossilOrigin-Name: 53081e7202fb55f792a78e73627466eb0200f11c --- Makefile.msc | 11 +++++++++++ manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/os_win.c | 13 ++++++++----- src/test_loadext.c | 6 ++++++ test/loadext.test | 21 +++++++++++++++++---- 6 files changed, 53 insertions(+), 20 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 61e5102607..119468a92d 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1319,6 +1319,10 @@ testfixture.exe: $(TESTFIXTURE_SRC) $(LIBRESOBJS) $(HDR) $(TESTFIXTURE_SRC) \ /link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) +extensiontest: testfixture.exe testloadext.dll + .\testfixture.exe $(TOP)\test\loadext.test + .\testfixture.exe $(TOP)\test\loadext2.test + fulltest: testfixture.exe sqlite3.exe .\testfixture.exe $(TOP)\test\all.test @@ -1345,6 +1349,12 @@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS) $(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) +testloadext.lo: $(TOP)\src\test_loadext.c + $(LTCOMPILE) -c $(TOP)\src\test_loadext.c + +testloadext.dll: testloadext.lo + $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo + showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ $(TOP)\tool\showdb.c $(SQLITE3C) @@ -1371,6 +1381,7 @@ clean: -rmdir /Q/S tsrc del /Q .target_source del /Q tclsqlite3.exe tclsqlite3.exp + del /Q testloadext.dll testloadext.exp del /Q testfixture.exe testfixture.exp test.db del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def del /Q sqlite3.c sqlite3-*.c diff --git a/manifest b/manifest index 916f53cc00..7b0e38f502 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Close\ssome\sstray\sconnections\sin\swalro.test. -D 2014-02-24T19:49:36.852 +C Enhance\stesting\ssupport\sfor\sthe\sWin32\sVFS\sdynamic\sextension\sloading\sfacilities. +D 2014-02-24T21:20:25.412 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 371a17ef9cd011b103cfa1964119a8528f5427c9 +F Makefile.msc 4b39e17eb244d2fd3fb825d896380b38b782e69a F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 0dc30ad5cf90736d5fd9e540c9f05c542658abe7 @@ -203,7 +203,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 18f7f95dc6bcb9cf4d4a238d8e2de96611bc2ae5 -F src/os_win.c d4284f003445054a26689f1264b1b9bf7261bd1b +F src/os_win.c 166d2f195ea0b7b4ea948229f727f0a293dd3c65 F src/pager.c 0ffa313a30ed6d061d9c6601b7b175cc50a1cab7 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 2613ca5d609c2f3d71dd297351f010bcec16e1e0 @@ -249,7 +249,7 @@ F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32 F src/test_intarray.c 87847c71c3c36889c0bcc9c4baf9d31881665d61 F src/test_intarray.h 2ece66438cfd177b78d1bfda7a4180cd3a10844d F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64 -F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e +F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4 F src/test_malloc.c 1ff5b1243d96124c9a180f3b89424820a1f337f3 F src/test_multiplex.c 9f304bf04170c91c0318238d512df2da039eb1c8 F src/test_multiplex.h 110a8c4d356e0aa464ca8730375608a9a0b61ae1 @@ -647,7 +647,7 @@ F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/like.test e191e536d0fcd722a6b965e7cd1ee0bfd12a5991 F test/like2.test 3b2ee13149ba4a8a60b59756f4e5d345573852da F test/limit.test cc0ab63385239b63c72452b0e93700bf5e8f0b99 -F test/loadext.test 92e6dfefd1229c3ef4aaabd87419efd8fa57a7a5 +F test/loadext.test 648cb95f324d1775c54a55c12271b2d1156b633b F test/loadext2.test 0408380b57adca04004247179837a18e866a74f7 F test/lock.test 87af515b0c4cf928576d0f89946d67d7c265dfb4 F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff @@ -1151,7 +1151,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P ba5f0a5599dece6d8f3dfe652800c28875c74a24 -R 55b5056ebfab7e0aa95c7fc2968f106d -U dan -Z 43d53118dac35420ad2faa5a259188da +P d6746cabaa22429644c956a4b5fd91896376de2d +R 92acab9fb5e448fe2bef6b9a7d9bb046 +U mistachkin +Z 2600b243b92aaa5b75c087148e5db2b4 diff --git a/manifest.uuid b/manifest.uuid index 62abb66e87..8331b56d75 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d6746cabaa22429644c956a4b5fd91896376de2d \ No newline at end of file +53081e7202fb55f792a78e73627466eb0200f11c \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index d393c0d016..ac5eb886e3 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -5135,15 +5135,12 @@ static int winFullPathname( ** Interfaces for opening a shared library, finding entry points ** within the shared library, and closing the shared library. */ -/* -** Interfaces for opening a shared library, finding entry points -** within the shared library, and closing the shared library. -*/ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ HANDLE h; void *zConverted = winConvertFromUtf8Filename(zFilename); UNUSED_PARAMETER(pVfs); if( zConverted==0 ){ + OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0)); return 0; } if( osIsNT() ){ @@ -5158,6 +5155,7 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ h = osLoadLibraryA((char*)zConverted); } #endif + OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)h)); sqlite3_free(zConverted); return (void*)h; } @@ -5166,12 +5164,17 @@ static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ winGetLastErrorMsg(osGetLastError(), nBuf, zBufOut); } static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){ + FARPROC pProc; UNUSED_PARAMETER(pVfs); - return (void(*)(void))osGetProcAddressA((HANDLE)pH, zSym); + pProc = osGetProcAddressA((HANDLE)pH, zSym); + OSTRACE(("DLSYM handle=%p, symbol=%s, proc=%p\n", + (void*)pH, zSym, (void*)pProc)); + return (void(*)(void))pProc; } static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ UNUSED_PARAMETER(pVfs); osFreeLibrary((HANDLE)pHandle); + OSTRACE(("DLCLOSE handle=%p\n", (void*)pHandle)); } #else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */ #define winDlOpen 0 diff --git a/src/test_loadext.c b/src/test_loadext.c index 1137e3a9aa..5a1f46da9c 100644 --- a/src/test_loadext.c +++ b/src/test_loadext.c @@ -91,6 +91,9 @@ static void statusFunc( /* ** Extension load function. */ +#ifdef _WIN32 +__declspec(dllexport) +#endif int testloadext_init( sqlite3 *db, char **pzErrMsg, @@ -109,6 +112,9 @@ int testloadext_init( /* ** Another extension entry point. This one always fails. */ +#ifdef _WIN32 +__declspec(dllexport) +#endif int testbrokenext_init( sqlite3 *db, char **pzErrMsg, diff --git a/test/loadext.test b/test/loadext.test index 0d5b841980..7ba4c0cf77 100644 --- a/test/loadext.test +++ b/test/loadext.test @@ -66,6 +66,12 @@ if {$::tcl_platform(os) eq "Darwin"} { set dlerror_nosymbol {dlsym(XXX, %2$s): symbol not found} } +if {$::tcl_platform(platform) eq "windows"} { + set dlerror_nosuchfile {The specified module could not be found.*} + set dlerror_notadll {%%1 is not a valid Win32 application.*} + set dlerror_nosymbol {The specified procedure could not be found.*} +} + # Make sure the test extension actually exists. If it does not # exist, try to create it. If unable to create it, then skip this # test file. @@ -167,7 +173,7 @@ do_test loadext-2.3 { regsub {0x[1234567890abcdefABCDEF]*} $msg XXX msg } list $rc $msg -} [list 1 [format $dlerror_nosymbol $testextension icecream]] +} /[list 1 [format $dlerror_nosymbol $testextension icecream]]/ # Try to load an extension for which the entry point fails (returns non-zero) # @@ -267,10 +273,17 @@ do_malloc_test loadext-5 -tclprep { } -tclbody { if {[autoinstall_test_functions]==7} {error "out of memory"} } -do_malloc_test loadext-6 -tclbody { - db enable_load_extension 1 - sqlite3_load_extension db $::testextension testloadext_init + +# On Windows, this malloc test must be skipped because the winDlOpen +# function itself can fail due to "out of memory" conditions. +# +if {$::tcl_platform(platform) ne "windows"} { + do_malloc_test loadext-6 -tclbody { + db enable_load_extension 1 + sqlite3_load_extension db $::testextension testloadext_init + } } + autoinstall_test_functions finish_test