If an error occurs in PagerSetPagesize(), set the output variable to the unmodified page-size before returning.
FossilOrigin-Name: 02def8f92588b8a45dff3976d1e7f9e3f0359b3b
diff --git a/test/pagerfault.test b/test/pagerfault.test
index 521e76b..be92661 100644
--- a/test/pagerfault.test
+++ b/test/pagerfault.test
@@ -28,8 +28,6 @@
}
db func a_string a_string
-if 1 {
-
#-------------------------------------------------------------------------
# Test fault-injection while rolling back a hot-journal file.
#
@@ -1125,8 +1123,6 @@
if {$ic != "ok"} { error "Integrity check: $ic" }
}
-}
-
proc lockrows {n} {
if {$n==0} { return "" }
db eval { SELECT * FROM t1 WHERE oid = $n } {
@@ -1134,6 +1130,7 @@
}
}
+
do_test pagerfault-25-pre1 {
faultsim_delete_and_reopen
db func a_string a_string
@@ -1150,7 +1147,7 @@
}
faultsim_save_and_close
} {}
-do_faultsim_test pagerfault-25 -faults full -prep {
+do_faultsim_test pagerfault-25 -prep {
faultsim_restore_and_reopen
db func a_string a_string
set ::channel [db incrblob -readonly t1 a 1]
@@ -1164,9 +1161,40 @@
lockrows 30
} -test {
catch { lockrows 30 }
+ catch { db eval COMMIT }
close $::channel
faultsim_test_result {0 {}}
}
+do_faultsim_test pagerfault-26 -prep {
+ faultsim_delete_and_reopen
+ execsql {
+ PRAGMA page_size = 1024;
+ PRAGMA journal_mode = truncate;
+ PRAGMA auto_vacuum = full;
+ PRAGMA locking_mode=exclusive;
+ CREATE TABLE t1(a, b);
+ INSERT INTO t1 VALUES(1, 2);
+ PRAGMA page_size = 4096;
+ }
+} -body {
+ execsql {
+ VACUUM;
+ }
+} -test {
+ faultsim_test_result {0 {}}
+
+ set contents [db eval {SELECT * FROM t1}]
+ if {$contents != "1 2"} { error "Bad database contents ($contents)" }
+
+ set sz [file size test.db]
+ if {$testrc!=0 && $sz!=1024*3 && $sz!=4096*3} {
+ error "Expected file size to be 3072 or 12288 bytes - actual size $sz bytes"
+ }
+ if {$testrc==0 && $sz!=4096*3} {
+ error "Expected file size to be 12288 bytes - actual size $sz bytes"
+ }
+}
+
finish_test