Files
TheRock/rocm-systems/projects/rocprofiler-systems/external/sqlite/test/busy.test
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

140 lines
2.6 KiB
Plaintext

# 2005 july 8
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file test the busy handler
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix busy
do_test busy-1.1 {
sqlite3 db2 test.db
execsql {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
SELECT * FROM t1
}
} 1
proc busy x {
lappend ::busyargs $x
if {$x>2} {return 1}
return 0
}
set busyargs {}
do_test busy-1.2 {
db busy busy
db2 eval {BEGIN EXCLUSIVE}
catchsql {BEGIN IMMEDIATE}
} {1 {database is locked}}
do_test busy-1.3 {
set busyargs
} {0 1 2 3}
do_test busy-1.4 {
set busyargs {}
catchsql {BEGIN IMMEDIATE}
set busyargs
} {0 1 2 3}
do_test busy-2.1 {
db2 eval {COMMIT}
db eval {BEGIN; INSERT INTO t1 VALUES(5)}
db2 eval {BEGIN; SELECT * FROM t1}
set busyargs {}
catchsql COMMIT
} {1 {database is locked}}
do_test busy-2.2 {
set busyargs
} {0 1 2 3}
db2 close
#-------------------------------------------------------------------------
# Test that the busy-handler is invoked correctly for "PRAGMA optimize"
# and ANALYZE commnds.
ifcapable pragma&&analyze&&!stat4 {
reset_db
do_execsql_test 3.1 {
CREATE TABLE t1(x);
CREATE TABLE t2(y);
CREATE TABLE t3(z);
CREATE INDEX i1 ON t1(x);
CREATE INDEX i2 ON t2(y);
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
ANALYZE;
SELECT * FROM t1 WHERE x=1;
SELECT * FROM t2 WHERE y=1;
} {1 1}
do_test 3.2 {
sqlite3 db2 test.db
execsql { BEGIN EXCLUSIVE } db2
catchsql { PRAGMA optimize }
} {1 {database is locked}}
proc busy_handler {n} {
if {$n>1000} { execsql { COMMIT } db2 }
return 0
}
db busy busy_handler
do_test 3.3 {
catchsql { PRAGMA optimize }
} {0 {}}
do_test 3.4 {
execsql {
BEGIN;
SELECT count(*) FROM sqlite_master;
} db2
} {6}
proc busy_handler {n} { return 1 }
do_test 3.5 {
catchsql { PRAGMA optimize }
} {1 {database is locked}}
do_test 3.6 {
execsql { COMMIT } db2
execsql {
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
)
INSERT INTO t1 SELECT i FROM s;
}
execsql {
BEGIN;
SELECT count(*) FROM sqlite_master;
} db2
} {6}
do_test 3.7 {
catchsql { PRAGMA optimize }
} {1 {database is locked}}
proc busy_handler {n} {
if {$n>1000} { execsql { COMMIT } db2 }
return 0
}
do_test 3.8 {
catchsql { PRAGMA optimize }
} {0 {}}
}
finish_test