New test procedures can check cipher provider name

if_built_with_openssl and if_built_with_libtomcrypt act as replacements
for do_test, only performing the test when the current sqlcipher
testfixture binary was compiled with the specific crypto library.
This commit is contained in:
Nick Parker 2013-06-05 15:20:27 -05:00
parent 4ded3fceb9
commit b4bb526dcb

View File

@ -62,6 +62,26 @@ proc setup {file key} {
db close
}
proc get_cipher_provider {} {
sqlite_orig db test.db
return [execsql {
PRAGMA key = 'test';
PRAGMA cipher_provider;
}];
}
proc if_built_with_openssl {name cmd expected} {
if {[get_cipher_provider] == "openssl"} {
do_test $name $cmd $expected
}
}
proc if_built_with_libtomcrypt {name cmd expected} {
if {[get_cipher_provider] == "libtomcrypt"} {
do_test $name $cmd $expected
}
}
# The database is initially empty.
# set an hex key create some basic data
# create table and insert operations should work
@ -1735,7 +1755,7 @@ file delete -force test.db
# verify the pragma cipher
# reports the default value
do_test verify-pragma-cipher-default {
if_built_with_openssl verify-pragma-cipher-default {
sqlite_orig db test.db
execsql {
PRAGMA key = 'test';
@ -1747,7 +1767,7 @@ file delete -force test.db
# verify the pragma cipher
# reports a change in value
do_test verify-pragma-cipher-changed {
if_built_with_openssl verify-pragma-cipher-changed {
sqlite_orig db test.db
execsql {
PRAGMA key = 'test';
@ -1856,4 +1876,14 @@ do_test 2.0-beta-to-2.0-migration {
db close
file delete -force test.db
if_built_with_libtomcrypt verify-default-cipher {
sqlite_orig db test.db
execsql {
PRAGMA key='test';
PRAGMA cipher;
}
} {rijndael}
db close
file delete -force test.db
finish_test