aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2009-03-26 14:48:07 +0000
committerdanielk1977 <danielk1977@noemail.net>2009-03-26 14:48:07 +0000
commit6d961009127f67dc72e721268866d2fac5db1365 (patch)
treebbe60b38df3f7a4ac5d5129869eb324a65c2db00
parent73cd27300ddc30f4c54944dbb6757b93486e592e (diff)
downloadsqlite-6d961009127f67dc72e721268866d2fac5db1365.tar.gz
sqlite-6d961009127f67dc72e721268866d2fac5db1365.zip
Prevent the tcl test suite from throwing an exception when a threadsafe SQLite is linked against a non-threadsafe Tcl for testing. Print a warning instead. Ticket #3753. (CVS 6389)
FossilOrigin-Name: a22e7c818b2227a4c80ad84b299d11f365e3b17d
-rw-r--r--manifest26
-rw-r--r--manifest.uuid2
-rw-r--r--test/notify2.test8
-rw-r--r--test/thread001.test10
-rw-r--r--test/thread002.test12
-rw-r--r--test/thread003.test12
-rw-r--r--test/thread004.test12
-rw-r--r--test/thread005.test11
-rw-r--r--test/thread_common.tcl41
9 files changed, 63 insertions, 71 deletions
diff --git a/manifest b/manifest
index 423e28f3b..2dd07b278 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Added\snew\stests\sof\sthe\sscratch\smemory\sallocator\sfor\sincreased\stest\scoverage.\s(CVS\s6388)
-D 2009-03-26T12:20:33
+C Prevent\sthe\stcl\stest\ssuite\sfrom\sthrowing\san\sexception\swhen\sa\sthreadsafe\sSQLite\sis\slinked\sagainst\sa\snon-threadsafe\sTcl\sfor\stesting.\sPrint\sa\swarning\sinstead.\sTicket\s#3753.\s(CVS\s6389)
+D 2009-03-26T14:48:07
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -479,7 +479,7 @@ F test/mutex1.test ebd54720401fafe854799dc86b7bf60b75631935
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
F test/nan.test c627d79b3d36ea892563fd67584b3e8a18f0618a
F test/notify1.test 099191b6f450a7cc3208bdf826532572bdd9a204
-F test/notify2.test f189304492fd9596a9465cfdfb7c8664fabb9643
+F test/notify2.test 7fc4a2ec7dc2d5a04eead01c7e11e6659808cfb9
F test/notnull.test 44d600f916b770def8b095a9962dbe3be5a70d82
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test f5dd6b23e4dce828eb211649b600763c42a668df
@@ -557,14 +557,14 @@ F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
F test/temptable.test 5d8ca46be28cc06c887c5a77df650843b7edbae1
F test/temptrigger.test 03093be9967942623232dfdf2a63b832d4e0e4fa
F test/tester.tcl 66546f6766029384360b24cacb3896376c5f5f69
-F test/thread001.test 06c45ed9597d478e7bbdc2a8937e1ebea2a20a32
-F test/thread002.test 4338c3d7c5f2f781adc3dba956dfd92722397408
-F test/thread003.test a8bc91af1d9d524148dd84e4d6a196ba17521e08
-F test/thread004.test 9d8ea6a9b0d62d35ad0b967e010d723ed99f614a
-F test/thread005.test 555f8a37bd552dbb01f2e3ecb20b2832afa5fa27
+F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
+F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
+F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
+F test/thread004.test deb3c07591d36d15c468904f6db89506858b3afa
+F test/thread005.test bf5c374ca65dd89fd56c8fe511ccfb46875bda5e
F test/thread1.test 862dd006d189e8b0946935db17399dcac2f8ef91
F test/thread2.test 91f105374f18a66e73a3254c28fe7c77af69bdea
-F test/thread_common.tcl bde5a0faa9fc57e24140483d512718d72bfc42e2
+F test/thread_common.tcl b65e6b1d1d90dc885e10ad080896c6c56eef0819
F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
@@ -709,7 +709,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 45ae830d5631afa5d994361f5122c2f0b6fbab4c
-R 8521a21fe65240700eb1d33418df1449
-U drh
-Z 4dc7df9ab0325fa37fcacdb293c3bd9a
+P e99e28efbbfff3e46eec0f90d566991de4406fd8
+R 1f72d75124ff1aa9ba3be363b671b72e
+U danielk1977
+Z 8663270a3bb5409566dc3bce815cb5b0
diff --git a/manifest.uuid b/manifest.uuid
index d05809e27..8bda3a8df 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-e99e28efbbfff3e46eec0f90d566991de4406fd8 \ No newline at end of file
+a22e7c818b2227a4c80ad84b299d11f365e3b17d \ No newline at end of file
diff --git a/test/notify2.test b/test/notify2.test
index 91c3e83e1..b02d3b42d 100644
--- a/test/notify2.test
+++ b/test/notify2.test
@@ -9,10 +9,11 @@
#
#***********************************************************************
#
-# $Id: notify2.test,v 1.4 2009/03/24 18:42:16 drh Exp $
+# $Id: notify2.test,v 1.5 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+if {[run_thread_tests]==0} { finish_test ; return }
# The tests in this file test the sqlite3_blocking_step() function in
# test_thread.c. sqlite3_blocking_step() is not an SQLite API function,
@@ -39,13 +40,8 @@ source $testdir/tester.tcl
# that sqlite3_blocking_step() resulted in higher transaction throughput.
#
-if {[info commands sqlite3_blocking_step] eq ""} {
- finish_test
- return
-}
db close
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
-source $testdir/thread_common.tcl
# Number of threads to run simultaneously.
#
diff --git a/test/thread001.test b/test/thread001.test
index 5236bbe44..9b788aafa 100644
--- a/test/thread001.test
+++ b/test/thread001.test
@@ -9,18 +9,12 @@
#
#***********************************************************************
#
-# $Id: thread001.test,v 1.9 2009/02/12 17:06:41 drh Exp $
+# $Id: thread001.test,v 1.10 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-ifcapable !mutex {
- return
-}
-source $testdir/thread_common.tcl
-if {[info commands sqlthread] eq ""} {
- return
-}
+if {[run_thread_tests]==0} { finish_test ; return }
set ::enable_shared_cache [sqlite3_enable_shared_cache]
diff --git a/test/thread002.test b/test/thread002.test
index a268bd411..b1e5f6368 100644
--- a/test/thread002.test
+++ b/test/thread002.test
@@ -12,20 +12,12 @@
# This test attempts to deadlock SQLite in shared-cache mode.
#
#
-# $Id: thread002.test,v 1.8 2009/03/17 15:39:31 drh Exp $
+# $Id: thread002.test,v 1.9 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-source $testdir/thread_common.tcl
-if {[info commands sqlthread] eq ""} {
- finish_test
- return
-}
-ifcapable !attach||!mutex {
- finish_test
- return
-}
+if {[run_thread_tests]==0} { finish_test ; return }
db close
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
diff --git a/test/thread003.test b/test/thread003.test
index 61841a01b..8aa513af1 100644
--- a/test/thread003.test
+++ b/test/thread003.test
@@ -12,20 +12,12 @@
# This file contains tests that attempt to break the pcache module
# by bombarding it with simultaneous requests from multiple threads.
#
-# $Id: thread003.test,v 1.7 2009/03/12 14:43:28 danielk1977 Exp $
+# $Id: thread003.test,v 1.8 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-source $testdir/thread_common.tcl
-if {[info commands sqlthread] eq ""} {
- finish_test
- return
-}
-ifcapable !mutex {
- finish_test
- return
-}
+if {[run_thread_tests]==0} { finish_test ; return }
# Set up a couple of different databases full of pseudo-randomly
# generated data.
diff --git a/test/thread004.test b/test/thread004.test
index 5931e4b8b..66b960767 100644
--- a/test/thread004.test
+++ b/test/thread004.test
@@ -9,18 +9,18 @@
#
#***********************************************************************
#
-# $Id: thread004.test,v 1.1 2009/02/26 07:15:59 danielk1977 Exp $
+# $Id: thread004.test,v 1.2 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-ifcapable !mutex||!shared_cache {
+if {[run_thread_tests]==0} { finish_test ; return }
+ifcapable !shared_cache {
+ finish_test
return
}
-source $testdir/thread_common.tcl
-if {[info commands sqlthread] eq ""
- || [info commands sqlite3_table_column_metadata] eq ""
-} {
+if { [info commands sqlite3_table_column_metadata] eq "" } {
+ finish_test
return
}
diff --git a/test/thread005.test b/test/thread005.test
index 644c1021f..9253287d9 100644
--- a/test/thread005.test
+++ b/test/thread005.test
@@ -11,18 +11,17 @@
#
# Test a race-condition that shows up in shared-cache mode.
#
-# $Id: thread005.test,v 1.4 2009/03/20 15:16:06 danielk1977 Exp $
+# $Id: thread005.test,v 1.5 2009/03/26 14:48:07 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-ifcapable !mutex||!shared_cache {
- return
-}
-source $testdir/thread_common.tcl
-if {[info commands sqlthread] eq ""} {
+if {[run_thread_tests]==0} { finish_test ; return }
+ifcapable !shared_cache {
+ finish_test
return
}
+
db close
# Use shared-cache mode for these tests.
diff --git a/test/thread_common.tcl b/test/thread_common.tcl
index 7e48479ce..bbd9389ea 100644
--- a/test/thread_common.tcl
+++ b/test/thread_common.tcl
@@ -9,18 +9,10 @@
#
#***********************************************************************
#
-# $Id: thread_common.tcl,v 1.4 2009/03/17 15:39:31 drh Exp $
+# $Id: thread_common.tcl,v 1.5 2009/03/26 14:48:07 danielk1977 Exp $
-set testdir [file dirname $argv0]
-source $testdir/tester.tcl
-
-if {[info commands sqlthread] eq ""} {
- puts -nonewline "Skipping thread-safety tests - "
- puts " not running a threadsafe sqlite/tcl build"
- puts -nonewline "Both SQLITE_THREADSAFE and TCL_THREADS must be defined when"
- puts " building testfixture"
- finish_test
- return
+if {[info exists ::thread_procs]} {
+ return 0
}
# The following script is sourced by every thread spawned using
@@ -91,4 +83,31 @@ proc thread_spawn {varname args} {
sqlthread spawn $varname [join $args ;]
}
+# Return true if this build can run the multi-threaded tests.
+#
+proc run_thread_tests {{print_warning 0}} {
+ ifcapable !mutex {
+ set zProblem "SQLite build is not threadsafe"
+ }
+ if {[info commands sqlthread] eq ""} {
+ set zProblem "SQLite build is not threadsafe"
+ }
+ if {![info exists ::tcl_platform(threaded)]} {
+ set zProblem "Linked against a non-threadsafe Tcl build"
+ }
+ if {[info exists zProblem]} {
+ if {$print_warning} {
+ if {[info exists ::run_thread_tests_failed]} {
+ puts "WARNING: Multi-threaded tests skipped: $zProblem"
+ }
+ } else {
+ puts "Skipping thread tests: $zProblem"
+ set ::run_thread_tests_failed 1
+ }
+ return 0
+ }
+ return 1;
+}
+
return 0
+