Skip to content

Commit 804dfb3

Browse files
committed
remove randomization from rekey-delete tests to avoid unpredictable test failures
1 parent cb71f53 commit 804dfb3

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

test/sqlcipher-rekey.test

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,16 @@ do_test rekey-delete-and-query-1 {
208208
}
209209

210210
for {set i 1} {$i<1000} {incr i} {
211-
set r [expr {int(rand()*32767)}]
212211
set r1 [expr {int(rand()*32767)}]
213-
execsql "INSERT INTO t1 VALUES($r,$r1);"
212+
execsql "INSERT INTO t1 VALUES($i,$r1);"
214213
}
215-
set r [expr {int(rand()*32767)}]
216-
set r1 [expr {int(rand()*32767)}]
217-
execsql "UPDATE t1 SET b = $r WHERE a < $r1;"
218214

219-
set r [expr {int(rand()*32767)}]
215+
execsql "DELETE FROM t1 WHERE a < 500;"
216+
217+
set r1 [expr {int(rand()*32767)}]
218+
execsql "UPDATE t1 SET b = $r1 WHERE a < 750;"
220219

221-
execsql "DELETE FROM t1 WHERE a < $r;"
220+
execsql "DELETE FROM t1 WHERE a > 750;"
222221

223222
execsql {
224223
COMMIT;
@@ -262,17 +261,16 @@ do_test rekey-delete-and-query-wal-1 {
262261
}
263262

264263
for {set i 1} {$i<1000} {incr i} {
265-
set r [expr {int(rand()*32767)}]
266264
set r1 [expr {int(rand()*32767)}]
267-
execsql "INSERT INTO t1 VALUES($r,$r1);"
265+
execsql "INSERT INTO t1 VALUES($i,$r1);"
268266
}
269-
set r [expr {int(rand()*32767)}]
270-
set r1 [expr {int(rand()*32767)}]
271-
execsql "UPDATE t1 SET b = $r WHERE a < $r1;"
272267

273-
set r [expr {int(rand()*32767)}]
268+
execsql "DELETE FROM t1 WHERE a < 500;"
269+
270+
set r1 [expr {int(rand()*32767)}]
271+
execsql "UPDATE t1 SET b = $r1 WHERE a < 750;"
274272

275-
execsql "DELETE FROM t1 WHERE a < $r;"
273+
execsql "DELETE FROM t1 WHERE a > 750;"
276274

277275
execsql {
278276
COMMIT;

0 commit comments

Comments
 (0)