Rather than having each test script hard code the config file that
should be use, have the top level runtests script pass the filename
to use as the config in as a command line parameter.
14 files changed:
for t in t/$backend-*.t t/all-*.t; do
total=`expr $total + 1`
mkdir t/db/
for t in t/$backend-*.t t/all-*.t; do
total=`expr $total + 1`
mkdir t/db/
+ if ! $t test.conf $backend; then
echo "test $t failed" >&2
fail=`expr $fail + 1`
fi
echo "test $t failed" >&2
fail=`expr $fail + 1`
fi
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0x94FA372B2DA8B985 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0x94FA372B2DA8B985 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0x12345678 2>&1 | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0x12345678 2>&1 | \
grep -q 'Key not found'; then
echo "* Did not correctly error on non-existent key"
exit 1
grep -q 'Key not found'; then
echo "* Did not correctly error on non-existent key"
exit 1
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
-if [ "$1" = "file" ]; then
+if [ "$2" = "file" ]; then
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf index noodles 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 index noodles 2> /dev/null | \
grep -q -- 'pub 4096R/2DA8B985 2008/06/03 Jonathan McDowell'; then
echo "* Did not correctly retrieve key by text"
exit 1
grep -q -- 'pub 4096R/2DA8B985 2008/06/03 Jonathan McDowell'; then
echo "* Did not correctly retrieve key by text"
exit 1
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
-if [ "$1" = "file" ]; then
+if [ "$2" = "file" ]; then
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf hget 81929DAE08B8F80888DA524923B93067 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 hget 81929DAE08B8F80888DA524923B93067 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by text"
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by text"
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0x0E3A94C3E83002DAB88CCA1694FA372B2DA8B985 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0x0E3A94C3E83002DAB88CCA1694FA372B2DA8B985 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0x2DA8B985 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0x2DA8B985 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by keyid."
exit 1
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
-if [ "$1" = "file" ]; then
+if [ "$2" = "file" ]; then
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0x045281F1B9A66E35 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0x045281F1B9A66E35 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
fi
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
fi
-if ! ../onak -c test.conf get 0xFF162FC5CF3FBAD1 2> /dev/null | \
+if ! ../onak -c $1 get 0xFF162FC5CF3FBAD1 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
# Backends should really support this, but the file one is as simple as
# possible, so doesn't. Skip the test for it.
-if [ "$1" = "file" ]; then
+if [ "$2" = "file" ]; then
-../onak -b -c test.conf add < ../keys/noodles.key
-if ! ../onak -c test.conf get 0xB9A66E35 2> /dev/null | \
+../onak -b -c $1 add < ../keys/noodles.key
+if ! ../onak -c $1 get 0xB9A66E35 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
fi
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
fi
-if ! ../onak -c test.conf get 0xCF3FBAD1 2> /dev/null | \
+if ! ../onak -c $1 get 0xCF3FBAD1 2> /dev/null | \
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then
echo "* Did not correctly retrieve key by subkey id."
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
+../onak -b -c $1 add < ../keys/noodles.key
if [ ! -e db/worddb -o ! -e db/id32db -o ! -e db/keydb.0.db ]; then
echo Did not correctly add key using db4 backend.
exit 1
if [ ! -e db/worddb -o ! -e db/id32db -o ! -e db/keydb.0.db ]; then
echo Did not correctly add key using db4 backend.
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
+../onak -b -c $1 add < ../keys/noodles.key
if [ ! -e db/0x2DA8B985 ]; then
echo Did not correctly add key using file backend.
exit 1
if [ ! -e db/0x2DA8B985 ]; then
echo Did not correctly add key using file backend.
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
-../onak -b -c test.conf delete 0x2DA8B985
+../onak -b -c $1 add < ../keys/noodles.key
+../onak -b -c $1 delete 0x2DA8B985
if [ -e db/0x2DA8B985 ]; then
echo "* Did not correctly delete key using file backend"
exit 1
if [ -e db/0x2DA8B985 ]; then
echo "* Did not correctly delete key using file backend"
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
+../onak -b -c $1 add < ../keys/noodles.key
if [ ! -e db/key/2D/A8/2DA8B985/94FA372B2DA8B985 ]; then
echo Did not correctly add key using fs backend.
exit 1
if [ ! -e db/key/2D/A8/2DA8B985/94FA372B2DA8B985 ]; then
echo Did not correctly add key using fs backend.
exit 1
-../onak -b -c test.conf add < ../keys/noodles.key
-../onak -b -c test.conf delete 0x2DA8B985
+../onak -b -c $1 add < ../keys/noodles.key
+../onak -b -c $1 delete 0x2DA8B985
if [ -e db/key/2D/A8/2DA8B985/94FA372B2DA8B985 ]; then
echo "* Did not correctly delete key using fs backend"
exit 1
if [ -e db/key/2D/A8/2DA8B985/94FA372B2DA8B985 ]; then
echo "* Did not correctly delete key using fs backend"
exit 1