Support running the fstree tests in 'vtabH.test' on Windows when not using the system drive.
FossilOrigin-Name: 3680f95ff34fdcf6a18a99268678a56e4be5a023
This commit is contained in:
parent
f10122d535
commit
7dd7d98bbf
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\stypos\sin\s'vtabF.test'\sfile.\s\sNo\schanges\sto\scode.
|
||||
D 2016-08-25T23:24:09.049
|
||||
C Support\srunning\sthe\sfstree\stests\sin\s'vtabH.test'\son\sWindows\swhen\snot\susing\sthe\ssystem\sdrive.
|
||||
D 2016-08-26T01:17:12.349
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
|
||||
@ -412,7 +412,7 @@ F src/test_btree.c 8b2dc8b8848cf3a4db93f11578f075e82252a274
|
||||
F src/test_config.c 4d3d4a886416f369771d69a6dba926866deda788
|
||||
F src/test_demovfs.c a0c3bdd45ed044115c2c9f7779e56eafff18741e
|
||||
F src/test_devsym.c 4e58dec2602d8e139ca08659f62a62450587cb58
|
||||
F src/test_fs.c ac62ce7d5c0c23aa6932891cad5746945564c91c
|
||||
F src/test_fs.c e16cbe68d3b107e00a907c20a9a02629870eb69b
|
||||
F src/test_func.c a2b4993da973b0ea60dd5d51a7066238ede8c329
|
||||
F src/test_hexio.c 1d4469ca61ab202a1fcec6543f584d2407205e8d
|
||||
F src/test_init.c 4413c211a94b62157ca4c145b3f27c497f03c664
|
||||
@ -439,8 +439,8 @@ F src/test_tclvar.c df9fe1213c2634687a9ca0b0bec0d2119d359ae3
|
||||
F src/test_thread.c 911d15fb14e19c0c542bdc8aabf981c2f10a4858
|
||||
F src/test_vfs.c f0186261a24de2671d080bcd8050732f0cb64f6e
|
||||
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
F src/test_windirent.c 8f5fada630348558d5745b334702f301da1ffc61
|
||||
F src/test_windirent.h b12055cab6227f7be10f5c19296f67c60cc5e2a5
|
||||
F src/test_windirent.c 600398db0198ca1c77ca183831bf456746b6f5c4
|
||||
F src/test_windirent.h 7edc57e2faa727026dbd5d010dd0e2e665d5aa01
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
|
||||
F src/tokenize.c 78c8085bc7af1922aa687f0f4bbd716821330de5
|
||||
@ -1347,7 +1347,7 @@ F test/vtabC.test 4528f459a13136f982e75614d120aef165f17292
|
||||
F test/vtabD.test 05b3f1d77117271671089e48719524b676842e96
|
||||
F test/vtabE.test d5024aa42754962f6bb0afd261681686488e7afe
|
||||
F test/vtabF.test 1918844c7c902f6a16c8dacf1ec8f84886d6e78b
|
||||
F test/vtabH.test 5f5157a1501d9889ec35c1a1832f69612dd31444
|
||||
F test/vtabH.test c7a029dc54ee0e1f21f78c7a6c93a706703bea6d
|
||||
F test/vtabI.test 751b07636700dbdea328e4265b6077ccd6811a3f
|
||||
F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5
|
||||
F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
|
||||
@ -1511,7 +1511,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 37e6c54b1afc634844026b3fe874dd2d550c6558
|
||||
R 4cab9f7d7896757fe3fc8a8951123595
|
||||
P a8546feec9388d96934b16e516a165cd37d32ce9
|
||||
R 66d6b55dfecea97ee12f2bdebb86bb76
|
||||
U mistachkin
|
||||
Z 99aab80e5b18ffff2a9e94c7e8fbdfe4
|
||||
Z 5d798dae32bcc32e75e6cc95a57c626f
|
||||
|
@ -1 +1 @@
|
||||
a8546feec9388d96934b16e516a165cd37d32ce9
|
||||
3680f95ff34fdcf6a18a99268678a56e4be5a023
|
@ -499,9 +499,13 @@ static int fstreeFilter(
|
||||
char aWild[2] = { '\0', '\0' };
|
||||
|
||||
#if SQLITE_OS_WIN
|
||||
zRoot = sqlite3_mprintf("%s%c", getenv("SystemDrive"), '/');
|
||||
const char *zDrive = windirent_getenv("fstreeDrive");
|
||||
if( zDrive==0 ){
|
||||
zDrive = windirent_getenv("SystemDrive");
|
||||
}
|
||||
zRoot = sqlite3_mprintf("%s%c", zDrive, '/');
|
||||
nRoot = sqlite3Strlen30(zRoot);
|
||||
zPrefix = sqlite3_mprintf("%s", getenv("SystemDrive"));
|
||||
zPrefix = sqlite3_mprintf("%s", zDrive);
|
||||
nPrefix = sqlite3Strlen30(zPrefix);
|
||||
#else
|
||||
zRoot = "/";
|
||||
|
@ -17,6 +17,34 @@
|
||||
|
||||
#include "test_windirent.h"
|
||||
|
||||
/*
|
||||
** Implementation of the POSIX getenv() function using the Win32 API.
|
||||
** This function is not thread-safe.
|
||||
*/
|
||||
const char *windirent_getenv(
|
||||
const char *name
|
||||
){
|
||||
static char value[32768]; /* Maximum length, per MSDN */
|
||||
DWORD dwSize = sizeof(value) / sizeof(char); /* Size in chars */
|
||||
DWORD dwRet; /* Value returned by GetEnvironmentVariableA() */
|
||||
|
||||
memset(value, 0, sizeof(value));
|
||||
dwRet = GetEnvironmentVariableA(name, value, dwSize);
|
||||
if( dwRet==0 || dwRet>dwSize ){
|
||||
/*
|
||||
** The function call to GetEnvironmentVariableA() failed -OR-
|
||||
** the buffer is not large enough. Either way, return NULL.
|
||||
*/
|
||||
return 0;
|
||||
}else{
|
||||
/*
|
||||
** The function call to GetEnvironmentVariableA() succeeded
|
||||
** -AND- the buffer contains the entire value.
|
||||
*/
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of the POSIX opendir() function using the MSVCRT.
|
||||
*/
|
||||
@ -32,7 +60,7 @@ LPDIR opendir(
|
||||
|
||||
/* TODO: Remove this if Unix-style root paths are not used. */
|
||||
if( sqlite3_stricmp(dirname, "/")==0 ){
|
||||
dirname = getenv("SystemDrive");
|
||||
dirname = windirent_getenv("SystemDrive");
|
||||
}
|
||||
|
||||
_snprintf(data.name, namesize, "%s\\*", dirname);
|
||||
|
@ -92,6 +92,13 @@ struct DIR {
|
||||
DIRENT d_next; /* DIRENT constructed based on "_findnext". */
|
||||
};
|
||||
|
||||
/*
|
||||
** Provide the function prototype for the POSIX compatiable getenv()
|
||||
** function. This function is not thread-safe.
|
||||
*/
|
||||
|
||||
extern const char *windirent_getenv(const char *name);
|
||||
|
||||
/*
|
||||
** Finally, we can provide the function prototypes for the opendir(),
|
||||
** readdir(), readdir_r(), and closedir() POSIX functions.
|
||||
|
@ -108,7 +108,12 @@ foreach ::tclvar_set_omit {0 1} {
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
if {1} {
|
||||
if {$tcl_platform(platform)=="windows"} {
|
||||
set drive [string range [pwd] 0 1]
|
||||
set ::env(fstreeDrive) $drive
|
||||
}
|
||||
if {$tcl_platform(platform)!="windows" || \
|
||||
[regexp -nocase -- {^[A-Z]:} $drive]} {
|
||||
reset_db
|
||||
register_fs_module db
|
||||
do_execsql_test 3.0 {
|
||||
@ -119,7 +124,7 @@ if {1} {
|
||||
proc list_root_files {} {
|
||||
if {$::tcl_platform(platform) eq "windows"} {
|
||||
set res [list]
|
||||
foreach name [glob -directory $::env(SystemDrive)/ -- *] {
|
||||
foreach name [glob -directory $::env(fstreeDrive)/ -- *] {
|
||||
if {[string index [file tail $name] 0] eq "."} continue
|
||||
lappend res $name
|
||||
}
|
||||
@ -142,6 +147,22 @@ 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} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user