Add a test case to verify that "PRAGMA data_version" works as expected when an OTA client writes to the database.
FossilOrigin-Name: 6441f2dc9e7f53de64bc15b1d766c885b2635112
This commit is contained in:
parent
b2fe306a2e
commit
01233d3e54
@ -168,5 +168,68 @@ do_multiclient_test tn {
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that "PRAGMA data_version" works when an OTA client writes the
|
||||
# database.
|
||||
#
|
||||
do_multiclient_test tn {
|
||||
|
||||
# Initialize a target (test.db) and ota (ota.db) database.
|
||||
#
|
||||
forcedelete ota.db
|
||||
sql1 $setup_sql
|
||||
|
||||
# Check the initial database contains table "xx" with a single row.
|
||||
# Also save the current values of "PRAGMA data-version" for [db1]
|
||||
# and [db2].
|
||||
#
|
||||
do_test 2.$tn.1 {
|
||||
list [sql1 { SELECT count(*) FROM xx }] [sql2 { SELECT count(*) FROM xx }]
|
||||
} {1 1}
|
||||
set V1 [sql1 {PRAGMA data_version}]
|
||||
set V2 [sql2 {PRAGMA data_version}]
|
||||
|
||||
# Check the values of data-version have not magically changed.
|
||||
#
|
||||
do_test 2.$tn.2 {
|
||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
||||
} [list $V1 $V2]
|
||||
|
||||
# Start stepping the OTA. From the point of view of [db1] and [db2], the
|
||||
# data-version values remain unchanged until the database contents are
|
||||
# modified. At which point the values are incremented.
|
||||
#
|
||||
sqlite3ota ota test.db ota.db
|
||||
set x 0
|
||||
while {[db one {SELECT count(*) FROM xx}]==1} {
|
||||
do_test 2.$tn.3.[incr x] {
|
||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
||||
} [list $V1 $V2]
|
||||
ota step
|
||||
}
|
||||
do_test 2.$tn.5.1 { expr {$V1 < [sql1 {PRAGMA data_version}]} } 1
|
||||
do_test 2.$tn.5.2 { expr {$V2 < [sql2 {PRAGMA data_version}]} } 1
|
||||
|
||||
# Check the db contents is as expected.
|
||||
#
|
||||
do_test 2.$tn.4 {
|
||||
list [sql1 {SELECT count(*) FROM xx}] [sql2 {SELECT count(*) FROM xx}]
|
||||
} {3 3}
|
||||
|
||||
set V1 [sql1 {PRAGMA data_version}]
|
||||
set V2 [sql2 {PRAGMA data_version}]
|
||||
|
||||
# Finish applying the OTA (i.e. do the incremental checkpoint). Check that
|
||||
# this does not cause the data-version values to change.
|
||||
#
|
||||
while {[ota step]=="SQLITE_OK"} { }
|
||||
ota close
|
||||
|
||||
do_test 2.$tn.6 {
|
||||
list [sql1 {PRAGMA data_version}] [sql2 {PRAGMA data_version}]
|
||||
} [list $V1 $V2]
|
||||
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Further\soptimizations\sfor\sfts5\sb-tree\sseeks.
|
||||
D 2015-07-07T08:29:32.749
|
||||
C Add\sa\stest\scase\sto\sverify\sthat\s"PRAGMA\sdata_version"\sworks\sas\sexpected\swhen\san\sOTA\sclient\swrites\sto\sthe\sdatabase.
|
||||
D 2015-07-07T19:07:30.099
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 017bf0511d1b2dd1db5e16488fbf75a17b526cbc
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -204,7 +204,7 @@ F ext/ota/ota.c 3a849c3b0a4ad6e63125668be9f67be03621216e
|
||||
F ext/ota/ota1.test abdcbe746db4c7f7b51e842b576cacb33eef28f5
|
||||
F ext/ota/ota10.test 85e0f6e7964db5007590c1b299e75211ed4240d4
|
||||
F ext/ota/ota11.test 2f606cd2b4af260a86b549e91b9f395450fc75cb
|
||||
F ext/ota/ota12.test 0dff44474de448fb4b0b28c20da63273a4149abb
|
||||
F ext/ota/ota12.test e4c0b9a14255ffbe04d241fc15da2c65b3c06846
|
||||
F ext/ota/ota13.test f7a3d73fa5d3fabf2755b569f125fce7390a874c
|
||||
F ext/ota/ota3.test 3fe3521fbdce32d0e4e116a60999c3cba47712c5
|
||||
F ext/ota/ota5.test ad0799daf8923ddebffe75ae8c5504ca90b7fadb
|
||||
@ -1364,7 +1364,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 7b7da1eb435d321fc4283f6aa2161fa1e16f2cf3
|
||||
R 24874c7422a967bb097e1a3642b88228
|
||||
P f37899686c032145f431f81c1072738536c61c7e
|
||||
R f128084ba3d886029accf1024856382b
|
||||
U dan
|
||||
Z f8ef7d272cb32b051f2a236ea6d3cc77
|
||||
Z ea7265b2d9c52b49db7f82cb72c0c2d5
|
||||
|
@ -1 +1 @@
|
||||
f37899686c032145f431f81c1072738536c61c7e
|
||||
6441f2dc9e7f53de64bc15b1d766c885b2635112
|
Loading…
x
Reference in New Issue
Block a user