-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Simo Sorce <simo@redhat.com>
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash -e | ||
# Copyright (C) 2023 Simo Sorce <simo@redhat.com> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
source ${TESTSSRCDIR}/helpers.sh | ||
|
||
title PARA "Check that storeutl returns URIs" | ||
ossl 'storeutl -text pkcs11:' $helper_emit | ||
output="$helper_output" | ||
FAIL=0 | ||
echo "$output" | grep "URI pkcs11:" > /dev/null 2>&1 || FAIL=1 | ||
if [ $FAIL -ne 0 ]; then | ||
echo "no URIs returned by storeutl" | ||
exit 1 | ||
fi | ||
|
||
mapfile -t URIS < <(echo "$helper_output" | grep "^URI") | ||
|
||
title PARA "Check returned URIs work to find objects" | ||
for uri in "${URIS[@]#URI }"; do | ||
echo "\$uri=${uri}" | ||
ossl 'storeutl -text "$uri"' $helper_emit | ||
output="$helper_output" | ||
matchURI=`echo "$output" | grep "URI pkcs11:" | cut -d ' ' -f 2` | ||
if [[ "${uri}" != "${matchURI}" ]]; then | ||
echo "Unmatched URI returned by storeutl" | ||
echo "Expected $uri" | ||
echo "Received $matchURI" | ||
exit 1 | ||
fi | ||
done | ||
|
||
firstURI=${URIS[0]#URI pkcs11:} | ||
firstCMPS=(${firstURI//;/ }) | ||
|
||
title PARA "Check each URI component is tested" | ||
|
||
for cmp in "${firstCMPS[@]}"; do | ||
echo "\$cmp=${cmp}" | ||
ossl 'storeutl -text "pkcs11:${cmp}"' $helper_emit | ||
output="$helper_output" | ||
echo "$output" | grep "URI pkcs11:" > /dev/null 2>&1 || FAIL=1 | ||
if [ $FAIL -ne 0 ]; then | ||
echo "Failed to get an object with URI \"pkcs11:${cmp}\"" | ||
fi | ||
done |