ext-cryptopp/TestScripts/cryptest-android.sh

90 lines
2.4 KiB
Bash
Raw Normal View History

2016-09-23 16:04:33 +00:00
#!/usr/bin/env bash
2021-02-05 09:49:33 +00:00
#############################################################################
#
# This script tests the cryptopp-android gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
# in the compilation are all public domain.
2016-09-23 16:04:33 +00:00
#
# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details
2021-02-05 09:49:33 +00:00
#
2021-02-05 08:56:14 +00:00
#############################################################################
if [ -z "$(command -v ./setenv-android.sh)" ]; then
echo "Failed to locate setenv-android.sh"
2021-02-05 10:18:29 +00:00
exit 1
2018-07-30 19:32:53 +00:00
fi
# Temp directory
if [[ -z "$TMPDIR" ]]; then
TMPDIR="$HOME/tmp"
mkdir -p "$TMPDIR"
fi
2021-02-05 10:18:29 +00:00
# Sane default
if [[ -z "${MAKE_JOBS}" ]]; then
MAKE_JOBS=4
fi
# Cleanup old artifacts
rm -rf "$TMPDIR/build.failed" 2>/dev/null
rm -rf "$TMPDIR/build.log" 2>/dev/null
2021-02-05 10:18:29 +00:00
#############################################################################
PLATFORMS=(armv7a aarch64 x86 x86_64)
for platform in "${PLATFORMS[@]}"
2016-09-23 16:04:33 +00:00
do
2020-03-13 20:20:17 +00:00
# setenv-android.sh reads these two variables for configuration info.
2020-03-11 06:22:27 +00:00
export ANDROID_API="23"
export ANDROID_CPU="$platform"
make -f GNUmakefile-cross distclean > /dev/null 2>&1
echo
echo "===================================================================="
echo "Testing for Android support of $platform"
# Test if we can set the environment for the platform
if ! ./setenv-android.sh > /dev/null 2>&1;
then
echo
echo "There were problems testing $platform"
echo "$platform ==> SKIPPED" >> "$TMPDIR/build.log"
continue
fi
echo
2021-02-05 10:18:29 +00:00
echo "===================================================================="
echo "Building for $platform..."
# run in subshell to not keep any envars
(
2020-03-11 06:22:27 +00:00
source ./setenv-android.sh
if make -k -j "$MAKE_JOBS" -f GNUmakefile-cross static dynamic cryptest.exe;
then
echo "$platform ==> SUCCESS" >> "$TMPDIR/build.log"
else
echo "$platform ==> FAILURE" >> "$TMPDIR/build.log"
touch "$TMPDIR/build.failed"
fi
)
2016-09-23 16:04:33 +00:00
done
2021-02-05 10:18:29 +00:00
echo
echo "====================================================="
cat "$TMPDIR/build.log"
# let the script fail if any of the builds failed
if [ -f "$TMPDIR/build.failed" ]; then
2021-02-05 10:18:29 +00:00
exit 1
fi
2018-04-05 22:38:43 +00:00
2021-02-05 10:18:29 +00:00
exit 0