-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 OR ISC | ||
|
||
set -ex | ||
|
||
TARGET_CPU="${1}" | ||
TARGET_PLATFORM="${2}" | ||
BUILD_OPTIONS=("${@:3:5}") | ||
|
||
if [ "${#BUILD_OPTIONS[@]}" -lt 1 ]; then | ||
echo "Must pass build parameters" | ||
exit 1 | ||
fi | ||
|
||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
SCRIPT_DIR="$(readlink -f "${SCRIPT_DIR}")" | ||
|
||
source "${SCRIPT_DIR}/common_posix_setup.sh" | ||
source "${SCRIPT_DIR}/gtest_util.sh" | ||
|
||
# Assumes script is executed from the root of aws-lc directory | ||
SCRATCH_FOLDER="${SYS_ROOT}/SCRATCH_${TARGET_CPU}" | ||
|
||
if [ -e "${SCRATCH_FOLDER}" ]; then | ||
# Some directories in the archive lack write permission, preventing deletion of files | ||
chmod +w -R "${SCRATCH_FOLDER}" | ||
rm -rf "${SCRATCH_FOLDER:?}" | ||
fi | ||
mkdir -p "${SCRATCH_FOLDER}" | ||
|
||
pushd "${SCRATCH_FOLDER}" | ||
|
||
cat <<EOF > ${TARGET_CPU}-${TARGET_PLATFORM}.cmake | ||
# Specify the target system | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(CMAKE_SYSTEM_PROCESSOR ${TARGET_CPU}) | ||
# Specify the cross-compiler | ||
# Specify the cross-compiler | ||
set(CMAKE_C_COMPILER /usr/bin/${TARGET_CPU}-${TARGET_PLATFORM}-gcc-posix) | ||
set(CMAKE_CXX_COMPILER /usr/bin/${TARGET_CPU}-${TARGET_PLATFORM}-g++-posix) | ||
# Specify the sysroot for the target system | ||
set(CMAKE_SYSROOT /usr/lib/gcc/${TARGET_CPU}-${TARGET_PLATFORM}/10-posix/) | ||
set(CMAKE_SYSTEM_INCLUDE_PATH /usr/lib/gcc/${TARGET_CPU}-${TARGET_PLATFORM}/10-posix/include) | ||
set(CMAKE_FIND_ROOT_PATH /usr/lib/gcc/${TARGET_CPU}-${TARGET_PLATFORM}/10-posix/) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
set(CMAKE_C_FLAGS --static) | ||
set(CMAKE_CXX_FLAGS --static) | ||
set(CMAKE_GENERATOR Ninja) | ||
EOF | ||
|
||
cat ${TARGET_CPU}-${TARGET_PLATFORM}.cmake | ||
|
||
#export QEMU_LD_PREFIX="${SCRATCH_FOLDER}/${TARGET_PLATFORM}/${TARGET_PLATFORM}/sysroot" | ||
#export LD_LIBRARY_PATH="${SCRATCH_FOLDER}/${TARGET_PLATFORM}/${TARGET_PLATFORM}/sysroot/lib" | ||
|
||
echo "Testing AWS-LC static library for ${TARGET_CPU}." | ||
|
||
for BO in "${BUILD_OPTIONS[@]}"; do | ||
run_build -DCMAKE_TOOLCHAIN_FILE="${SCRATCH_FOLDER}/${TARGET_CPU}-${TARGET_PLATFORM}.cmake" ${BO} | ||
|
||
shard_gtest "${BUILD_ROOT}/crypto/crypto_test.exe --gtest_also_run_disabled_tests" | ||
shard_gtest ${BUILD_ROOT}/crypto/urandom_test.exe | ||
shard_gtest ${BUILD_ROOT}/crypto/mem_test.exe | ||
shard_gtest ${BUILD_ROOT}/crypto/mem_set_test.exe | ||
|
||
shard_gtest ${BUILD_ROOT}/ssl/ssl_test.exe | ||
shard_gtest ${BUILD_ROOT}/ssl/integration_test.exe | ||
|
||
# Due to its special linkage, this does not use GoogleTest | ||
${BUILD_ROOT}/crypto/dynamic_loading_test.exe | ||
done | ||
popd |