Index: third_party/sqlite/src/test/thread2.test |
diff --git a/third_party/sqlite/src/test/thread2.test b/third_party/sqlite/src/test/thread2.test |
index 2ec75a24cd19d0fd0a9e3f67641bf3e0174b5713..dad2bf2c5f4b1881af82362c11818b8093e9f762 100644 |
--- a/third_party/sqlite/src/test/thread2.test |
+++ b/third_party/sqlite/src/test/thread2.test |
@@ -17,11 +17,7 @@ |
set testdir [file dirname $argv0] |
source $testdir/tester.tcl |
-ifcapable !mutex { |
- finish_test |
- return |
-} |
- |
+if {[run_thread_tests]==0} { finish_test ; return } |
# Skip this whole file if the thread testing code is not enabled |
# |
@@ -29,10 +25,6 @@ if {[llength [info command thread_step]]==0 || [sqlite3 -has-codec]} { |
finish_test |
return |
} |
-if {![info exists threadsOverrideEachOthersLocks]} { |
- finish_test |
- return |
-} |
# Create some data to work with |
# |
@@ -121,118 +113,6 @@ do_test thread2-2.9 { |
thread_halt A |
thread_halt B |
-# Save the original (correct) value of threadsOverrideEachOthersLocks |
-# so that it can be restored. If this value is left set incorrectly, lots |
-# of things will go wrong in future tests. |
-# |
-set orig_threadOverride $threadsOverrideEachOthersLocks |
- |
-# Pretend we are on a system (like RedHat9) were threads do not |
-# override each others locks. |
-# |
-set threadsOverrideEachOthersLocks 0 |
- |
-# Verify that we can move database connections between threads as |
-# long as no locks are held. |
-# |
-do_test thread2-3.1 { |
- thread_create A test.db |
- set DB [thread_db_get A] |
- thread_halt A |
-} {} |
-do_test thread2-3.2 { |
- set STMT [sqlite3_prepare $DB {SELECT a FROM t1 LIMIT 1} -1 TAIL] |
- sqlite3_step $STMT |
-} SQLITE_ROW |
-do_test thread2-3.3 { |
- sqlite3_column_int $STMT 0 |
-} 1 |
-do_test thread2-3.4 { |
- sqlite3_finalize $STMT |
-} SQLITE_OK |
-do_test thread2-3.5 { |
- set STMT [sqlite3_prepare $DB {SELECT max(a) FROM t1} -1 TAIL] |
- sqlite3_step $STMT |
-} SQLITE_ROW |
-do_test thread2-3.6 { |
- sqlite3_column_int $STMT 0 |
-} 8 |
-do_test thread2-3.7 { |
- sqlite3_finalize $STMT |
-} SQLITE_OK |
-do_test thread2-3.8 { |
- sqlite3_close $DB |
-} {SQLITE_OK} |
- |
-do_test thread2-3.10 { |
- thread_create A test.db |
- thread_compile A {SELECT a FROM t1 LIMIT 1} |
- thread_step A |
- thread_finalize A |
- set DB [thread_db_get A] |
- thread_halt A |
-} {} |
-do_test thread2-3.11 { |
- set STMT [sqlite3_prepare $DB {SELECT a FROM t1 LIMIT 1} -1 TAIL] |
- sqlite3_step $STMT |
-} SQLITE_ROW |
-do_test thread2-3.12 { |
- sqlite3_column_int $STMT 0 |
-} 1 |
-do_test thread2-3.13 { |
- sqlite3_finalize $STMT |
-} SQLITE_OK |
-do_test thread2-3.14 { |
- sqlite3_close $DB |
-} SQLITE_OK |
- |
-do_test thread2-3.20 { |
- thread_create A test.db |
- thread_compile A {SELECT a FROM t1 LIMIT 3} |
- thread_step A |
- set STMT [thread_stmt_get A] |
- set DB [thread_db_get A] |
- sqlite3_step $STMT |
-} SQLITE_ROW |
-do_test thread2-3.22 { |
- sqlite3_column_int $STMT 0 |
-} 2 |
-do_test thread2-3.23 { |
- # The unlock fails here. But because we never check the return |
- # code from sqlite3OsUnlock (because we cannot do anything about it |
- # if it fails) we do not realize that an error has occurred. |
- breakpoint |
- sqlite3_finalize $STMT |
-} SQLITE_OK |
-do_test thread2-3.25 { |
- thread_db_put A $DB |
- thread_halt A |
-} {} |
- |
-do_test thread2-3.30 { |
- thread_create A test.db |
- thread_compile A {BEGIN} |
- thread_step A |
- thread_finalize A |
- thread_compile A {SELECT a FROM t1 LIMIT 1} |
- thread_step A |
- thread_finalize A |
- set DB [thread_db_get A] |
- set STMT [sqlite3_prepare $DB {INSERT INTO t1 VALUES(99,'error')} -1 TAIL] |
- sqlite3_step $STMT |
-} SQLITE_ERROR |
-do_test thread2-3.32 { |
- sqlite3_finalize $STMT |
-} SQLITE_MISUSE |
-do_test thread2-3.33 { |
- thread_db_put A $DB |
- thread_halt A |
-} {} |
- |
-# VERY important to set the override flag back to its true value. |
-# |
-set threadsOverrideEachOthersLocks $orig_threadOverride |
- |
# Also important to halt the worker threads, which are using spin |
# locks and eating away CPU cycles. |
# |