Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/scripts/components-build-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,37 @@ component_tf_psa_crypto_build_config_name () {
rm -f include/psa/crypto_config_full.h
}

component_tf_psa_crypto_install_with_destdir () {
msg "install: cmake tf-psa-crypto with DESTDIR staging"
TF_PSA_CRYPTO_ROOT_DIR="$PWD"
cd "$OUT_OF_SOURCE_DIR"
cmake -DGEN_FILES=ON -DENABLE_PROGRAMS=ON -DENABLE_TESTING=OFF -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr "$TF_PSA_CRYPTO_ROOT_DIR"
make

DESTDIR="$OUT_OF_SOURCE_DIR/stage" make install

install_lib_subdir="$(sed -n 's/^CMAKE_INSTALL_LIBDIR:PATH=//p' CMakeCache.txt)"
[ -n "$install_lib_subdir" ] # Failed to read CMAKE_INSTALL_LIBDIR from CMakeCache.txt

install_lib_path="$OUT_OF_SOURCE_DIR/stage/usr/${install_lib_subdir}"

[ -f "$install_lib_path/libtfpsacrypto.a" ]
if [[ "$OSTYPE" == darwin* ]]; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we required/expecting to support windows here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long wait, after spend some time double check - No, not expected - only test component that has "_mingw" in its name will be checked on Windows.
https://github.com/Mbed-TLS/mbedtls-framework/blob/c6610dde67ffd2a3a81cc204a73572b9c31a5775/scripts/all-core.sh#L876-L877
Additionally cmake "desdir" functionality only exist on UNIX system https://cmake.org/cmake/help/latest/envvar/DESTDIR.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't try to run all.sh on Windows and I expect that a lot of things would break. It's not a problem to have one more place where Windows isn't supported.

We only run all.sh on Linux and FreeBSD in the CI, but some developers use macOS so it's better if the script also works on macOS.

Even the MinGW component doesn't run on Windows. It runs a cross-compiler on Linux that produces Windows binaries. We also do a MinGW build with a Windows host on the CI, but that doesn't use all.sh, it uses windows_testing.[y.

[ -e "$install_lib_path/libtfpsacrypto.dylib" ]
else
[ -L "$install_lib_path/libtfpsacrypto.so" ]
[ -e "$install_lib_path/libtfpsacrypto.so" ]

versioned=( "$install_lib_path/libtfpsacrypto.so".+([0-9]) )
if [ "$QUIET" -eq 0 ]; then
declare -p versioned
fi
[ "${#versioned[@]}" -eq 1 ]
[ -L "${versioned[0]}" ]
[ -e "${versioned[0]}" ]
fi
}

component_tf_psa_crypto_build_programs_no_testing () {
# Verify that the type of builds performed by oss-fuzz don't get accidentally broken
msg "build: cmake with -DENABLE_PROGRAMS=ON and -DENABLE_TESTING=OFF"
Expand Down