]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Prevent the tcl test suite from throwing an exception when a threadsafe SQLite is...
authordanielk1977 <danielk1977@noemail.net>
Thu, 26 Mar 2009 14:48:07 +0000 (14:48 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 26 Mar 2009 14:48:07 +0000 (14:48 +0000)
FossilOrigin-Name: a22e7c818b2227a4c80ad84b299d11f365e3b17d

manifest
manifest.uuid
test/notify2.test
test/thread001.test
test/thread002.test
test/thread003.test
test/thread004.test
test/thread005.test
test/thread_common.tcl

index 423e28f3ba28187e170183ba73583a6598a3a5cd..2dd07b2788f85846355934cc72f49af0d3069dbf 100644 (file)
--- 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
index d05809e27aa9c8340fa8c1420e9137feb52c84e8..8bda3a8dfe5df394738165daf97c2e548b71010f 100644 (file)
@@ -1 +1 @@
-e99e28efbbfff3e46eec0f90d566991de4406fd8
\ No newline at end of file
+a22e7c818b2227a4c80ad84b299d11f365e3b17d
\ No newline at end of file
index 91c3e83e1b2f5b70b452ca839ba4818e0a2413eb..b02d3b42d58308c3f43a1ac13e2145e5e6f5f57b 100644 (file)
@@ -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.
 #
index 5236bbe4416223f84572550b7616a007e3c24045..9b788aafaf18444bf112d545fee1f0655db32783 100644 (file)
@@ -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]
 
index a268bd411aa6d6542d752ba44ae91fe81d9e5513..b1e5f6368e87aedfc49e3cfac0954f04b784631c 100644 (file)
 #   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]
index 61841a01bdaf308e2482da53409960cc07445fd6..8aa513af1e9e66f87626f93b16a9e7c40b1b16d9 100644 (file)
 #   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.
index 5931e4b8ba1ee43349c5d94791bb9fa6405cb5c6..66b960767b8a098826441b7710ca0a7ca7dabc74 100644 (file)
@@ -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
 }
 
index 644c1021f8f729c7b757d4b53d7b729a0f9b55ce..9253287d9af7a4202f703a5229ff0b11007e474d 100644 (file)
 #
 # 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.
index 7e48479cedf5867e7659e59264c1823c46443f1e..bbd9389ea03cd656c01cc34357ec801078c4bf3b 100644 (file)
@@ -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
+