Files
TheRock/rocm-systems/projects/rocprofiler-sdk/external/sqlite/test/walsetlk.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

200 lines
4.0 KiB
Plaintext

# 2020 May 06
#
# 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.
#
#***********************************************************************
#
# TESTRUNNER: slow
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
set testprefix walsetlk
ifcapable !wal {finish_test ; return }
db timeout 1000
#-------------------------------------------------------------------------
# 1.*: Test that nothing goes wrong if recovery is forced while opening
# a write transaction or performing a checkpoint with blocking locks.
#
do_execsql_test 1.0 {
CREATE TABLE t1(x, y);
PRAGMA journal_mode = wal;
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
INSERT INTO t1 VALUES(5, 6);
INSERT INTO t1 VALUES(7, 8);
} {wal}
sqlite3 db2 test.db
db2 timeout 1000
do_execsql_test -db db2 1.1 {
SELECT * FROM t1
} {1 2 3 4 5 6 7 8}
set fd [open test.db-shm r+]
puts $fd "blahblahblahblah"
flush $fd
do_execsql_test 1.2 {
BEGIN;
INSERT INTO t1 VALUES(9, 10);
}
do_execsql_test -db db2 1.3 {
SELECT * FROM t1
} {1 2 3 4 5 6 7 8}
do_test 1.4 {
list [catch {db2 eval { BEGIN EXCLUSIVE }} msg] $msg
} {1 {database is locked}}
do_execsql_test 1.5 { COMMIT }
do_execsql_test -db db2 1.6 {
SELECT * FROM t1
} {1 2 3 4 5 6 7 8 9 10}
puts $fd "blahblahblahblah"
flush $fd
do_execsql_test -db db2 1.7 {
PRAGMA wal_checkpoint = TRUNCATE
} {0 0 0}
do_test 1.8 {
file size test.db-wal
} 0
close $fd
db close
db2 close
#-------------------------------------------------------------------------
do_multiclient_test tn {
do_test 2.$tn.1 {
sql1 {
PRAGMA journal_mode = wal;
CREATE TABLE t1(s, v);
INSERT INTO t1 VALUES(1, 2);
INSERT INTO t1 VALUES(3, 4);
INSERT INTO t1 VALUES(5, 6);
}
code1 { db timeout 1100 }
} {}
do_test 2.$tn.2 {
sql2 {
BEGIN;
INSERT INTO t1 VALUES(7, 8);
}
} {}
do_test 2.$tn.3 {
set us [lindex [time { catch {db eval "BEGIN EXCLUSIVE"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
do_test 2.$tn.4 {
sql2 { COMMIT }
sql1 { SELECT * FROM t1 }
} {1 2 3 4 5 6 7 8}
do_test 2.$tn.5 {
sql2 {
BEGIN;
INSERT INTO t1 VALUES(9, 10);
}
} {}
do_test 2.$tn.6 {
set us [lindex [time { catch {db eval "PRAGMA wal_checkpoint=RESTART"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
do_test 2.$tn.7 {
sql2 {
COMMIT;
BEGIN;
SELECT * FROM t1;
}
} {1 2 3 4 5 6 7 8 9 10}
do_test 2.$tn.8 {
set us [lindex [time { catch {db eval "PRAGMA wal_checkpoint=RESTART"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
do_test 2.$tn.9 {
sql3 {
INSERT INTO t1 VALUES(11, 12);
}
sql2 {
COMMIT;
BEGIN;
SELECT * FROM t1;
}
sql3 {
INSERT INTO t1 VALUES(13, 14);
}
} {}
do_test 2.$tn.10 {
set us [lindex [time { catch {db eval "PRAGMA wal_checkpoint=RESTART"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
do_test 2.$tn.11 {
sql3 {
BEGIN;
SELECT * FROM t1;
}
sql1 { INSERT INTO t1 VALUES(15, 16); }
} {}
do_test 2.$tn.12 {
set us [lindex [time { catch {db eval "PRAGMA wal_checkpoint=RESTART"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
do_test 2.$tn.13 {
sql2 {
COMMIT;
BEGIN;
SELECT * FROM t1;
}
sql1 { INSERT INTO t1 VALUES(17, 18); }
} {}
do_test 2.$tn.14 {
set us [lindex [time { catch {db eval "PRAGMA wal_checkpoint=RESTART"} }] 0]
expr $us>1000000 && $us<4000000
} {1}
}
#-------------------------------------------------------------------------
reset_db
sqlite3 db2 test.db
db2 timeout 1000
do_execsql_test 3.0 {
PRAGMA journal_mode = wal;
CREATE TABLE x1(x, y);
BEGIN;
INSERT INTO x1 VALUES(1, 2);
} {wal}
do_test 3.1 {
list [catch { db2 eval {BEGIN EXCLUSIVE} } msg] $msg
} {1 {database is locked}}
finish_test