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
|
|
|
#############################################################################
|
|
|
|
|
2019-10-16 11:30:40 +00:00
|
|
|
if [ -z "$(command -v ./setenv-android.sh)" ]; then
|
2020-03-10 01:53:08 +00:00
|
|
|
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
|
|
|
|
|
2019-10-16 11:30:40 +00:00
|
|
|
# Temp directory
|
2019-10-15 22:05:54 +00:00
|
|
|
if [[ -z "$TMPDIR" ]]; then
|
2020-03-10 01:53:08 +00:00
|
|
|
TMPDIR="$HOME/tmp"
|
|
|
|
mkdir -p "$TMPDIR"
|
2018-01-21 14:05:34 +00:00
|
|
|
fi
|
2019-10-15 22:05:54 +00:00
|
|
|
|
2021-02-05 10:18:29 +00:00
|
|
|
# Sane default
|
|
|
|
if [[ -z "${MAKE_JOBS}" ]]; then
|
|
|
|
MAKE_JOBS=4
|
|
|
|
fi
|
2019-10-16 11:30:40 +00:00
|
|
|
|
|
|
|
# Cleanup old artifacts
|
2019-10-15 22:05:54 +00:00
|
|
|
rm -rf "$TMPDIR/build.failed" 2>/dev/null
|
|
|
|
rm -rf "$TMPDIR/build.log" 2>/dev/null
|
Add ARMv8.4 cpu feature detection support (GH #685) (#687)
This PR adds ARMv8.4 cpu feature detection support. Previously we only needed ARMv8.1 and things were much easier. For example, ARMv8.1 `__ARM_FEATURE_CRYPTO` meant PMULL, AES, SHA-1 and SHA-256 were available. ARMv8.4 `__ARM_FEATURE_CRYPTO` means PMULL, AES, SHA-1, SHA-256, SHA-512, SHA-3, SM3 and SM4 are available.
We still use the same pattern as before. We make something available based on compiler version and/or preprocessor macros. But this time around we had to tighten things up a bit to ensure ARMv8.4 did not cross-pollinate down into ARMv8.1.
ARMv8.4 is largely untested at the moment. There is no hardware in the field and CI lacks QEMU with the relevant patches/support. We will probably have to revisit some of this stuff in the future.
Since this update applies to ARM gadgets we took the time to expand Android and iOS testing on Travis. Travis now tests more platforms, and includes Autotools and CMake builds, too.
2018-07-15 12:35:14 +00:00
|
|
|
|
2021-02-05 10:18:29 +00:00
|
|
|
#############################################################################
|
|
|
|
|
2020-03-10 01:53:08 +00:00
|
|
|
PLATFORMS=(armv7a aarch64 x86 x86_64)
|
2019-10-16 11:30:40 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2020-03-10 01:53:08 +00:00
|
|
|
make -f GNUmakefile-cross distclean > /dev/null 2>&1
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "===================================================================="
|
|
|
|
echo "Testing for Android support of $platform"
|
|
|
|
|
2020-03-10 15:50:33 +00:00
|
|
|
# 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"
|
2020-03-10 01:53:08 +00:00
|
|
|
|
2020-03-10 15:50:33 +00:00
|
|
|
continue
|
|
|
|
fi
|
2020-03-10 01:53:08 +00:00
|
|
|
|
|
|
|
echo
|
2021-02-05 10:18:29 +00:00
|
|
|
echo "===================================================================="
|
2020-03-10 01:53:08 +00:00
|
|
|
echo "Building for $platform..."
|
|
|
|
|
|
|
|
# run in subshell to not keep any envars
|
|
|
|
(
|
2020-03-11 06:22:27 +00:00
|
|
|
source ./setenv-android.sh
|
2020-03-10 01:53:08 +00:00
|
|
|
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
|
2018-01-21 14:05:34 +00:00
|
|
|
|
2021-02-05 10:18:29 +00:00
|
|
|
echo
|
2020-03-10 01:53:08 +00:00
|
|
|
echo "====================================================="
|
2019-10-15 22:05:54 +00:00
|
|
|
cat "$TMPDIR/build.log"
|
2018-04-01 06:37:32 +00:00
|
|
|
|
2018-01-21 14:05:34 +00:00
|
|
|
# let the script fail if any of the builds failed
|
2019-10-15 22:05:54 +00:00
|
|
|
if [ -f "$TMPDIR/build.failed" ]; then
|
2021-02-05 10:18:29 +00:00
|
|
|
exit 1
|
2018-01-21 14:05:34 +00:00
|
|
|
fi
|
2018-04-05 22:38:43 +00:00
|
|
|
|
2021-02-05 10:18:29 +00:00
|
|
|
exit 0
|