Index: third_party/sqlite/src/test/loadext.test |
diff --git a/third_party/sqlite/src/test/loadext.test b/third_party/sqlite/src/test/loadext.test |
index db5745b45c183e8e6fd940f100640b9a8c42b352..7ba4c0cf77476fe98a6e9ba3ab0f5f6876879c75 100644 |
--- a/third_party/sqlite/src/test/loadext.test |
+++ b/third_party/sqlite/src/test/loadext.test |
@@ -23,7 +23,7 @@ ifcapable !load_ext { |
# The name of the test extension varies by operating system. |
# |
-if {$::tcl_platform(platform) eq "windows" || $::tcl_platform(platform) eq "os2"} { |
+if {$::tcl_platform(platform) eq "windows"} { |
set testextension ./testloadext.dll |
} else { |
set testextension ./libtestloadext.so |
@@ -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. |
@@ -134,25 +140,27 @@ sqlite3_enable_load_extension db 1 |
# Try to load an extension for which the file does not exist. |
# |
do_test loadext-2.1 { |
- file delete -force ${testextension}xx |
+ forcedelete ${testextension}xx |
set rc [catch { |
sqlite3_load_extension db "${testextension}xx" |
} msg] |
list $rc $msg |
-} [list 1 [format $dlerror_nosuchfile ${testextension}xx]] |
+} /[list 1 [format $dlerror_nosuchfile ${testextension}xx.*]]/ |
# Try to load an extension for which the file is not a shared object |
# |
do_test loadext-2.2 { |
- set fd [open "${testextension}xx" w] |
+ set fd [open "./notasharedlib.so" w] |
+ puts $fd blah |
+ close $fd |
+ set fd [open "./notasharedlib.dll" w] |
puts $fd blah |
close $fd |
set rc [catch { |
- sqlite3_load_extension db "${testextension}xx" |
+ sqlite3_load_extension db "./notasharedlib" |
} msg] |
- set expected_error_pattern [format $dlerror_notadll ${testextension}xx] |
- list $rc [string match $expected_error_pattern $msg] |
-} [list 1 1] |
+ list $rc $msg |
+} /[list 1 [format $dlerror_notadll ./notasharedlib.*]]/ |
# Try to load an extension for which the file is present but the |
# entry point is not. |
@@ -165,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) |
# |
@@ -196,7 +204,7 @@ do_test loadext-3.2 { |
regsub {0x[1234567890abcdefABCDEF]*} $res XXX res |
} |
set res |
-} [list 1 [format $dlerror_nosymbol $testextension sqlite3_extension_init]] |
+} /[list 1 [format $dlerror_nosymbol $testextension sqlite3_.*_init]]/ |
do_test loadext-3.3 { |
catchsql { |
SELECT load_extension($::testextension,'testloadext_init') |
@@ -265,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 |