From: mistachkin Date: Tue, 5 Jan 2016 01:48:29 +0000 (+0000) Subject: Permit the 'test_fs' test module to be compiled and used on MinGW. X-Git-Tag: version-3.10.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98486c046f1d245b5ffa1df8a850e349e4e25154;p=thirdparty%2Fsqlite.git Permit the 'test_fs' test module to be compiled and used on MinGW. FossilOrigin-Name: ac27f38eef7a241d56124c263d9f8c91f372a77f --- diff --git a/manifest b/manifest index ac0852705f..40d0611359 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\scorner\scase\sin\sthe\sopcode-array\sreuse\slogic\swhere\sthe\snumber\sof\sbytes\sof\nreusable\sspace\smight\sbe\scomputed\sto\sbe\sa\snegative\snumber,\sdue\sto\sunusual\nsystem\salignment\srestrictions\sand\srounding\serror. -D 2016-01-04T23:43:47.141 +C Permit\sthe\s'test_fs'\stest\smodule\sto\sbe\scompiled\sand\sused\son\sMinGW. +D 2016-01-05T01:48:29.005 F Makefile.in 28bcd6149e050dff35d4dcfd97e890cd387a499d F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 5fff077fcc46de7714ed6eebb6159a4c00eab751 @@ -360,7 +360,7 @@ F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f F src/test_config.c 0dee90328e3dedf8ba002ee94b6a7e7ea7726fe4 F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc -F src/test_fs.c 993c7eab65bed6add4bb48cca29775e963f710cf +F src/test_fs.c a61f54247fdb843761d709879c3bcd1989b2050c F src/test_func.c 0d9c25956152adefee8881c6fadc8354793764d0 F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32 @@ -1274,7 +1274,7 @@ F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292 F test/vtabD.test 05b3f1d77117271671089e48719524b676842e96 F test/vtabE.test d5024aa42754962f6bb0afd261681686488e7afe F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e -F test/vtabH.test 7a21f18546cb9ab38df009e718300c40b552bb2b +F test/vtabH.test 492ba03dcb7bb8fedcc53f258c410d04013adbc9 F test/vtabI.test 751b07636700dbdea328e4265b6077ccd6811a3f F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 @@ -1406,7 +1406,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b779ca8a7580e2a0bb1176316c4540867b635229 -R 3b3e1e83b8e4867e299c87ba108024a8 -U drh -Z b5772777614dc8e4c77919f902a0659c +P 1aa530144643582658c8c1dd66548662f950efe3 +R 6490ec858048a3d7899751e10a44fa21 +U mistachkin +Z b205e33bbbedd23793ff52ce1287fb1d diff --git a/manifest.uuid b/manifest.uuid index bc138403e1..515a791f4f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1aa530144643582658c8c1dd66548662f950efe3 \ No newline at end of file +ac27f38eef7a241d56124c263d9f8c91f372a77f \ No newline at end of file diff --git a/src/test_fs.c b/src/test_fs.c index ab6bed8a95..45db0b53b8 100644 --- a/src/test_fs.c +++ b/src/test_fs.c @@ -70,7 +70,7 @@ #include #include -#if SQLITE_OS_UNIX +#if SQLITE_OS_UNIX || defined(__MINGW_H) # include # include # ifndef DIRENT @@ -79,7 +79,9 @@ #endif #if SQLITE_OS_WIN # include -# include "test_windirent.h" +# if !defined(__MINGW_H) +# include "test_windirent.h" +# endif # ifndef S_ISREG # define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) # endif @@ -231,7 +233,14 @@ static int fsdirNext(sqlite3_vtab_cursor *cur){ if( pCsr->pDir ){ struct DIRENT *pRes = 0; +#if defined(__MINGW_H) + pRes = readdir(pCsr->pDir); + if( pRes!=0 ){ + memcpy(&pCsr->entry, pRes, sizeof(struct DIRENT)); + } +#else readdir_r(pCsr->pDir, &pCsr->entry, &pRes); +#endif if( pRes==0 ){ closedir(pCsr->pDir); pCsr->pDir = 0; diff --git a/test/vtabH.test b/test/vtabH.test index c15ab87de8..7bd542e05b 100644 --- a/test/vtabH.test +++ b/test/vtabH.test @@ -32,12 +32,12 @@ do_execsql_test 1.0 { foreach {tn sql expect} { 1 "SELECT * FROM e6 WHERE b LIKE 'abc'" { - xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b like ?} + xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b like ?} xFilter {SELECT rowid, a, b FROM 't6' WHERE b like ?} abc } 2 "SELECT * FROM e6 WHERE b GLOB 'abc'" { - xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b glob ?} + xBestIndex {SELECT rowid, a, b FROM 't6' WHERE b glob ?} xFilter {SELECT rowid, a, b FROM 't6' WHERE b glob ?} abc } } { @@ -115,7 +115,7 @@ if {1} { SELECT name FROM fsdir WHERE dir = '.' AND name = 'test.db'; SELECT name FROM fsdir WHERE dir = '.' AND name = '.' } {test.db .} - + proc list_root_files {} { if {$::tcl_platform(platform) eq "windows"} { set res [list] @@ -142,22 +142,6 @@ if {1} { } } - # Read the first 5 entries from the root directory. Except, ignore - # files that contain the "$" character in their names as these are - # special files on some Windows platforms. - # - set res [list] - foreach p [lrange [list_root_files] 0 4] { - if {$::tcl_platform(platform) eq "windows"} { - if {![regexp {\$} $p]} {lappend res $p} - } else { - lappend res "/$p" - } - } - do_execsql_test 3.1 { - SELECT path FROM fstree WHERE path NOT GLOB '*$*' LIMIT 5; - } $res - # Read all entries in the current directory. # proc contents {pattern} { @@ -175,7 +159,7 @@ if {1} { do_execsql_test 3.2 { SELECT path FROM fstree WHERE path GLOB $pwd ORDER BY 1 } [lsort $res] - + # Add some sub-directories and files to the current directory. # do_test 3.3 { @@ -183,7 +167,7 @@ if {1} { foreach {path sz} { subdir/x1.txt 143 subdir/x2.txt 153 - } { + } { set dir [file dirname $path] catch { file mkdir $dir } set fd [open $path w] @@ -191,7 +175,7 @@ if {1} { close $fd } } {} - + set pwd [pwd] do_execsql_test 3.5 { SELECT path, size FROM fstree WHERE path GLOB $pwd || '/subdir/*' ORDER BY 1