tests: adapt dlopen_demo.sh to run also from tf-psa-crypto repo

Signed-off-by: Valerio Setti <[email protected]>
This commit is contained in:
Valerio Setti
2025-04-03 10:58:13 +02:00
parent 22d1df9159
commit e01486b644
+18 -4
View File
@@ -6,17 +6,31 @@
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
. "${0%/*}/../../scripts/demo_common.sh"
DEMO_COMMON_NEED_QUERY_COMPILE_TIME_CONFIG=0
SCRIPT_DIR=$(dirname "$0")
. "${SCRIPT_DIR}/../../scripts/project_detection.sh"
. "${SCRIPT_DIR}/../../scripts/demo_common.sh"
msg "Test the dynamic loading of libmbed*"
program="$programs_dir/test/dlopen"
library_dir="$root_dir/library"
# Once demo_common.sh is sourced we'll have the following variables set:
# - $root_dir points to the root path of Mbed TLS or TF-PSA-Crypto;
# - $programs_dir points to "$root_dir/programs" folder.
if is_mbedtls_root $root_dir; then
msg "Running in Mbed TLS repo"
program="$programs_dir/test/dlopen"
library_dir="$root_dir/library"
else
msg "Running in TF-PSA-Crypto repo"
program="$root_dir/programs/test/tfpsacrypto_dlopen"
library_dir="$root_dir/core"
fi
# Skip this test if we don't have a shared library build. Detect this
# through the absence of the demo program.
if [ ! -e "$program" ]; then
msg "$0: this demo requires a shared library build."
msg "Error: demo program $program not found."
# Exit with a success status so that this counts as a pass for run_demos.py.
exit
fi