- added function skip_if_card to allow tests to be skipped for certain cards

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1174 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2003-05-28 20:52:46 +00:00
parent 48a61e95c0
commit 5b5e98e56a
2 changed files with 16 additions and 1 deletions

View File

@ -9,13 +9,14 @@ if [ -z "$__p15init__" ]; then
p15base=${P15_BASE:-../..}
p15temp=${P15_TEMP:-./test-data}
osctool=$p15base/tools/opensc-tool
p15crypt=$p15base/tools/pkcs15-crypt
p15tool=$p15base/tools/pkcs15-tool
p15init=$p15base/tools/pkcs15-init
p11tool=$p15base/tools/pkcs11-tool
p15log=$p15temp/test.log
for bin in $p15tool $p15crypt $p15init; do
for bin in $osctool $p15tool $p15crypt $p15init $p11tool; do
test -x $bin && continue
echo "*** Missing binary $bin" >&2
exit 1
@ -49,6 +50,7 @@ if [ -z "$__p15init__" ]; then
p15crypt="$p15crypt --reader $P15_READER"
p15tool="$p15tool --reader $P15_READER"
p15init="$p15init --reader $P15_READER"
osctool="$osctool --reader $P15_READER"
fi
# Get terminal control sequences
@ -171,6 +173,17 @@ function run_check_output {
esac
}
function skip_if_card {
name=`$osctool -q --name`
for __pat in "$@"; do
if expr "$name" : "${__pat}.*" >/dev/null; then
msg "Detected $name; skipping test"
exit 0
fi
done
}
##################################################################
#
# Common pkcs15 functions

View File

@ -6,6 +6,8 @@
. functions
skip_if_card Cryptoflex Cyberflex Multiflex
p15_init --so-pin 999999 --so-puk 88888888
p15_set_pin -a 27 --so-pin 999999
p15_gen_key rsa/1024 -a 27 --so-pin 999999 --key-usage sign,decrypt