8000 Adjust path to test databases for tests · magic-coder/sqlcipher@26ac02e · GitHub
[go: up one dir, main page]

Skip to content

Commit 26ac02e

Browse files
Adjust path to test databases for tests
1 parent 939c83a commit 26ac02e

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

test/crypto.test

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ file delete -force test.db
3939
file delete -force test2.db
4040
file delete -force test3.db
4141
file delete -force test4.db
42-
42+
4343
set testdir [file dirname $argv0]
4444
source $testdir/tester.tcl
45+
set sampleDir [file normalize [file dirname [file dirname $argv0]]]
4546
set old_pending_byte [sqlite3_test_control_pending_byte 0x40000000]
4647

4748
# If the library is not compiled with has_codec support then
@@ -991,7 +992,7 @@ file delete -force test.db
991992

992993
# open a 1.1.8 database using the new code, HMAC disabled
993994
do_test open-1.1.8-database {
994-
file copy -force sqlcipher-1.1.8-testkey.db test.db
995+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db test.db
995996
sqlite_orig db test.db
996997
execsql {
997998
PRAGMA key = 'testkey';
@@ -1006,8 +1007,8 @@ file delete -force test.db
10061007

10071008
# open a 1.1.8 database without hmac, then copy the data
10081009
do_test attach-and-copy-1.1.8 {
1009-
sqlite_orig db sqlcipher-1.1.8-testkey.db
1010-
1010+
sqlite_orig db $sampleDir/sqlcipher-1.1.8-testkey.db
1011+
10111012
execsql {
10121013
PRAGMA key = 'testkey';
10131014
PRAGMA cipher_use_hmac = OFF;
@@ -1474,7 +1475,8 @@ file delete -force test.db
14741475
# attached database should have the same hmac
14751476
# setting as the original
14761477
do_test default-hmac-kdf-attach {
1477-
file copy -force sqlcipher-1.1.8-testkey.db test.db
1478+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db test.db
1479+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db sqlcipher-1.1.8-testkey.db;
14781480
sqlite_orig db test.db
14791481
execsql {
14801482
PRAGMA cipher_default_use_hmac = OFF;
@@ -1489,12 +1491,14 @@ do_test default-hmac-kdf-attach {
14891491
} {75709 75709}
14901492
db close
14911493
file delete -force test.db
1494+
file delete -force sqlcipher-1.1.8-testkey.db
14921495

14931496
# open a 2.0 database (with HMAC), then
14941497
# try to a 1.1.8 database. this should
14951498
# fail because the hmac setting for the
14961499
# attached database is not compatible
14971500
do_test attach-1.1.8-database-from-2.0-fails {
1501+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db sqlcipher-1.1.8-testkey.db;
14981502
sqlite_orig db test.db
14991503
catchsql {
15001504
PRAGMA key = 'testkey';
@@ -1504,13 +1508,15 @@ do_test attach-1.1.8-database-from-2.0-fails {
15041508
} {1 {file is encrypted or is not a database}}
15051509
db close
15061510
file delete -force test.db
1511+
file delete -force sqlcipher-1.1.8-testkey.db
15071512

15081513
# open a 2.0 database (with HMAC, 4k iter), then
15091514
# set the default hmac setting to OFF.
15101515
# try to a 1.1.8 database. this should
15111516
# succeed now that hmac is off by default
15121517
# before the attach
15131518
do_test change-default-hmac-kdf-attach {
1519+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db sqlcipher-1.1.8-testkey.db;
15141520
sqlite_orig db test.db
15151521
execsql {
15161522
PRAGMA key = 'testkey';
@@ -1532,6 +1538,7 @@ do_test change-default-hmac-kdf-attach {
15321538
} {1 75709}
15331539
db close
15341540
file delete -force test.db
1541+
file delete -force sqlcipher-1.1.8-testkey.db
15351542

15361543
# verify the pragma cipher_version
15371544
# returns the currently configured
@@ -1706,7 +1713,7 @@ file delete -force test.db
17061713
# open a 3.0 database with little endian hmac page numbers (default)
17071714
# verify it can be opened
17081715
do_test open-3.0-le-database {
1709-
sqlite_orig db sqlcipher-3.0-testkey.db
1716+
sqlite_orig db $sampleDir/sqlcipher-3.0-testkey.db
17101717
execsql {
17111718
PRAGMA key = 'testkey';
17121719
SELECT count(*) FROM t1;
@@ -1718,7 +1725,7 @@ db close
17181725
# open a 2.0 database with little endian hmac page numbers (default)
17191726
# verify it can be opened
17201727
do_test open-2.0-le-database {
1721-
sqlite_orig db sqlcipher-2.0-le-testkey.db
1728+
sqlite_orig db $sampleDir/sqlcipher-2.0-le-testkey.db
17221729
execsql {
17231730
PRAGMA key = 'testkey';
17241731
PRAGMA kdf_iter = 4000;
@@ -1731,7 +1738,7 @@ db close
17311738
# open a 2.0 database with big-endian hmac page numbers
17321739
# verify it can be opened
17331740
do_test open-2.0-be-database {
1734-
sqlite_orig db sqlcipher-2.0-be-testkey.db
1741+
sqlite_orig db $sampleDir/sqlcipher-2.0-be-testkey.db
17351742
execsql {
17361743
PRAGMA key = 'testkey';
17371744
PRAGMA cipher_hmac_pgno = be;
@@ -1747,7 +1754,7 @@ db close
17471754
# copy schema between the two, and verify the latter
17481755
# can be opened
17491756
do_test be-to-le-migration {
1750-
sqlite_orig db sqlcipher-2.0-be-testkey.db
1757+
sqlite_orig db $sampleDir/sqlcipher-2.0-be-testkey.db
17511758

17521759
execsql {
17531760
PRAGMA key = 'testkey';
@@ -2015,7 +2022,7 @@ file delete -force test.db
20152022
# hmac salt mask
20162023
# verify it can be opened
20172024
do_test open-2.0-beta-database {
2018-
sqlite_orig db sqlcipher-2.0-beta-testkey.db
2025+
sqlite_orig db $sampleDir/sqlcipher-2.0-beta-testkey.db
20192026
execsql {
20202027
PRAGMA key = 'testkey';
20212028
PRAGMA kdf_iter = 4000;
@@ -2032,7 +2039,7 @@ db close
20322039
# copy schema between the two, and verify the latter
20332040
# can be opened
20342041
do_test 2.0-beta-to-2.0-migration {
2035-
sqlite_orig db sqlcipher-2.0-beta-testkey.db
2042+
sqlite_orig db $sampleDir/sqlcipher-2.0-beta-testkey.db
20362043

20372044
execsql {
20382045
PRAGMA key = 'testkey';
@@ -2080,7 +2087,7 @@ db close
20802087
file delete -force test.db
20812088

20822089
do_test migrate-1.1.8-database-to-3x-format {
2083-
file copy -force sqlcipher-1.1.8-testkey.db test.db
2090+
file copy -force $sampleDir/sqlcipher-1.1.8-testkey.db test.db
20842091
sqlite_orig db test.db
20852092
execsql {
20862093
PRAGMA key = 'testkey';
@@ -2098,7 +2105,7 @@ db close
20982105
file delete -force test.db
20992106

21002107
do_test migrate-2-0-le-database-to-3x-format {
2101-
file copy -force sqlcipher-2.0-le-testkey.db test.db
2108+
file copy -force $sampleDir/sqlcipher-2.0-le-testkey.db test.db
21022109
sqlite_orig db test.db
21032110
execsql {
21042111
PRAGMA key = 'testkey';

0 commit comments

Comments
 (0)
0