diff --git a/tests/programs/dlopen_demo.sh b/tests/programs/dlopen_demo.sh index 6e1e8f12b..5b3135853 100755 --- a/tests/programs/dlopen_demo.sh +++ b/tests/programs/dlopen_demo.sh @@ -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