From 97c3564f800bbf922f771f79bfb7e8e014fc9b77 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Tue, 7 Jun 2016 11:09:32 +0100 Subject: [PATCH] Pass config file name into test scripts 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. --- runtests | 2 +- t/all-020-get.t | 4 ++-- t/all-030-get-fail.t | 4 ++-- t/all-040-index-text.t | 6 +++--- t/all-050-get-hash.t | 6 +++--- t/all-060-get-fingerprint.t | 4 ++-- t/all-070-get-short.t | 4 ++-- t/all-080-get-subkey.t | 8 ++++---- t/all-090-get-subkey-short.t | 8 ++++---- t/db4-000-add.t | 2 +- t/file-000-add.t | 2 +- t/file-010-del.t | 4 ++-- t/fs-000-add.t | 2 +- t/fs-010-del.t | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/runtests b/runtests index 968cfc0..495e7b5 100755 --- a/runtests +++ b/runtests @@ -23,7 +23,7 @@ for t in libkeydb_*.so; do for t in t/$backend-*.t t/all-*.t; do total=`expr $total + 1` mkdir t/db/ - if ! $t $backend; then + if ! $t test.conf $backend; then echo "test $t failed" >&2 fail=`expr $fail + 1` fi diff --git a/t/all-020-get.t b/t/all-020-get.t index a96f896..7564928 100755 --- a/t/all-020-get.t +++ b/t/all-020-get.t @@ -4,8 +4,8 @@ set -e cd t -../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 diff --git a/t/all-030-get-fail.t b/t/all-030-get-fail.t index 0db2b28..8d1bea6 100755 --- a/t/all-030-get-fail.t +++ b/t/all-030-get-fail.t @@ -4,8 +4,8 @@ set -e cd t -../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 diff --git a/t/all-040-index-text.t b/t/all-040-index-text.t index f5b1c14..af82b9e 100755 --- a/t/all-040-index-text.t +++ b/t/all-040-index-text.t @@ -5,13 +5,13 @@ set -e # 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 exit 0 fi cd t -../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 diff --git a/t/all-050-get-hash.t b/t/all-050-get-hash.t index 4913134..ef83dc2 100755 --- a/t/all-050-get-hash.t +++ b/t/all-050-get-hash.t @@ -5,13 +5,13 @@ set -e # 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 exit 0 fi cd t -../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 diff --git a/t/all-060-get-fingerprint.t b/t/all-060-get-fingerprint.t index 920e9a3..e79c636 100755 --- a/t/all-060-get-fingerprint.t +++ b/t/all-060-get-fingerprint.t @@ -4,8 +4,8 @@ set -e cd t -../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 diff --git a/t/all-070-get-short.t b/t/all-070-get-short.t index 8adaa3f..b8431a6 100755 --- a/t/all-070-get-short.t +++ b/t/all-070-get-short.t @@ -4,8 +4,8 @@ set -e cd t -../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 diff --git a/t/all-080-get-subkey.t b/t/all-080-get-subkey.t index ecccdf4..449b568 100755 --- a/t/all-080-get-subkey.t +++ b/t/all-080-get-subkey.t @@ -5,18 +5,18 @@ set -e # 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 exit 0 fi cd t -../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 -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 diff --git a/t/all-090-get-subkey-short.t b/t/all-090-get-subkey-short.t index 891a566..d120598 100755 --- a/t/all-090-get-subkey-short.t +++ b/t/all-090-get-subkey-short.t @@ -5,18 +5,18 @@ set -e # 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 exit 0 fi cd t -../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 -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 diff --git a/t/db4-000-add.t b/t/db4-000-add.t index c69cabb..83bece6 100755 --- a/t/db4-000-add.t +++ b/t/db4-000-add.t @@ -4,7 +4,7 @@ set -e cd t -../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 diff --git a/t/file-000-add.t b/t/file-000-add.t index cd7a4c5..dbfb811 100755 --- a/t/file-000-add.t +++ b/t/file-000-add.t @@ -4,7 +4,7 @@ set -e cd t -../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 diff --git a/t/file-010-del.t b/t/file-010-del.t index 31acc5a..edceea1 100755 --- a/t/file-010-del.t +++ b/t/file-010-del.t @@ -4,8 +4,8 @@ set -e cd t -../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 diff --git a/t/fs-000-add.t b/t/fs-000-add.t index c20231e..1864417 100755 --- a/t/fs-000-add.t +++ b/t/fs-000-add.t @@ -4,7 +4,7 @@ set -e cd t -../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 diff --git a/t/fs-010-del.t b/t/fs-010-del.t index 43fa7b0..5ea794b 100755 --- a/t/fs-010-del.t +++ b/t/fs-010-del.t @@ -4,8 +4,8 @@ set -e cd t -../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 -- 2.39.2