Skip to content

Commit 9f8deaf

Browse files
olszomalmtrojnar
authored andcommitted
Simplified common.sh
1 parent 7f6eba0 commit 9f8deaf

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tests/common.sh

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,21 @@ OPENSSL_VERSION=$(./openssl_version | cut -d ' ' -f 2)
5555
# Restore settings
5656
export LD_LIBRARY_PATH=${TEMP_LD_LIBRARY_PATH}
5757

58-
LIBCRYPTO_VER=$(ldd "${MODULE}" | grep 'libcrypto' | awk '{print $1}')
59-
if [[ "$OPENSSL_VERSION" =~ ^0.* || "$OPENSSL_VERSION" =~ ^1\.0.* ]] \
60-
&& [[ "$LIBCRYPTO_VER" == "libcrypto.so.3" ]]; then
61-
echo -n "Skipping test: Module '${MODULE}' built with '${LIBCRYPTO_VER}'"
62-
echo "is incompatible with OpenSSL version '${OPENSSL_VERSION}'."
63-
exit 77
58+
# Check for ldd command
59+
if command -v ldd >/dev/null 2>&1; then
60+
LIBCRYPTO_VER=$(ldd "${MODULE}" | grep 'libcrypto' | awk '{print $1}')
61+
else
62+
echo "Warning: ldd command not found. Skipping library version detection."
63+
LIBCRYPTO_VER="unknown"
64+
fi
65+
66+
# Check OpenSSL version and library compatibility
67+
if [[ "$OPENSSL_VERSION" =~ ^0.* || "$OPENSSL_VERSION" =~ ^1\.0.* ]]; then
68+
if [[ "$LIBCRYPTO_VER" == "libcrypto.so.3" ]]; then
69+
echo -n "Skipping test: Module '${MODULE}' built with '${LIBCRYPTO_VER}'"
70+
echo "is incompatible with OpenSSL version '${OPENSSL_VERSION}'."
71+
exit 77
72+
fi
6473
fi
6574

6675
echo "Detected system: ${OSTYPE}"
@@ -214,7 +223,7 @@ import_objects () {
214223
# Import objects with different labels
215224
for param in "$@"; do
216225
if [[ -n "$param" ]]; then
217-
echo -n "* Importing the ${key_type^^} ${param} object id=${obj_id}"
226+
echo -n "* Importing the ${key_type} ${param} object id=${obj_id}"
218227
echo -n " into the token ${token_label} ... "
219228
pkcs11-tool --login --pin ${PIN} --module ${MODULE} \
220229
--token-label "${token_label}"\

0 commit comments

Comments
 (0)