[zorg] r306049 - [sanitizers] Add dedicated script for Android tests
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 13:22:35 PDT 2017
Author: vitalybuka
Date: Thu Jun 22 15:22:34 2017
New Revision: 306049
URL: http://llvm.org/viewvc/llvm-project?rev=306049&view=rev
Log:
[sanitizers] Add dedicated script for Android tests
Reviewers: eugenis, alekseyshl
Subscribers: srhines, mgorny
Differential Revision: https://reviews.llvm.org/D34519
Added:
zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh (with props)
Modified:
zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh
zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_cmake.sh
zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_selector.py
Added: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh?rev=306049&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh (added)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh Thu Jun 22 15:22:34 2017
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+set -x
+set -e
+set -u
+
+HERE="$(cd $(dirname $0) && pwd)"
+. ${HERE}/buildbot_functions.sh
+. ${HERE}/buildbot_android_functions.sh
+
+ROOT=`pwd`
+PLATFORM=`uname`
+export PATH="/usr/local/bin:$PATH"
+
+CHECK_LIBCXX=${CHECK_LIBCXX:-1}
+CHECK_LLD=${CHECK_LLD:-1}
+STAGE1_DIR=llvm_build0
+STAGE1_CLOBBER="llvm_build64 compiler_rt_build_android_* llvm_build_android_*"
+LLVM=$ROOT/llvm
+CMAKE_COMMON_OPTIONS="-GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_PARALLEL_LINK_JOBS=20"
+BUILD_TYPE=Release
+
+if [ "$BUILDBOT_CLOBBER" != "" ]; then
+ echo @@@BUILD_STEP clobber@@@
+ rm -rf llvm
+ rm -rf ${STAGE1_DIR}
+ rm -rf android_ndk
+ rm -rf platform-tools
+fi
+
+download_android_tools r15
+
+# Stage 1
+
+build_stage1_clang_at_revison 305968
+### From now on we use just-built Clang as a host compiler ###
+CLANG_PATH=${ROOT}/${STAGE1_DIR}/bin
+
+echo @@@BUILD_STEP update@@@
+buildbot_update
+
+CMAKE_COMMON_OPTIONS="$CMAKE_COMMON_OPTIONS -DLLVM_ENABLE_ASSERTIONS=ON"
+
+# Build self-hosted tree with fresh Clang and -Werror.
+CMAKE_OPTIONS="${CMAKE_COMMON_OPTIONS} -DLLVM_ENABLE_WERROR=ON -DCMAKE_C_COMPILER=${CLANG_PATH}/clang -DCMAKE_CXX_COMPILER=${CLANG_PATH}/clang++ -DCMAKE_C_FLAGS=-gmlt -DCMAKE_CXX_FLAGS=-gmlt"
+
+echo @@@BUILD_STEP bootstrap clang@@@
+if [ ! -d llvm_build64 ]; then
+ mkdir llvm_build64
+fi
+(cd llvm_build64 && cmake ${CMAKE_OPTIONS} -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON $LLVM && ninja) || echo @@@STEP_FAILURE@@
+
+CMAKE_COMMON_OPTIONS=-DLLVM_ENABLE_ASSERTIONS=ON
+
+build_android() {
+ CPU=$1
+ TRIPLE=$2
+ build_android_ndk $CPU
+ build_compiler_rt $CPU $TRIPLE
+ build_llvm_symbolizer $CPU $TRIPLE
+}
+
+# Testing armv7 instead of plain arm to work around
+# https://code.google.com/p/android/issues/detail?id=68779
+build_android arm armv7-linux-androideabi armeabi-v7a
+build_android x86 i686-linux-android x86
+build_android arm64 aarch64-linux-android arm64-v8a
+
+test_android arm armeabi-v7a @@@STEP_FAILURE@@@
+test_android x86 x86 @@@STEP_FAILURE@@@
+test_android arm64 arm64-v8a @@@STEP_FAILURE@@@
Propchange: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android.sh
------------------------------------------------------------------------------
svn:executable = *
Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh?rev=306049&r1=306048&r2=306049&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_android_functions.sh Thu Jun 22 15:22:34 2017
@@ -1,14 +1,51 @@
#!/usr/bin/env bash
+function download_android_tools {
+ local VERSION=android-ndk-$1
+ local FILE_NAME=${VERSION}-linux-x86_64.zip
+ local NDK_URL=https://dl.google.com/android/repository/${FILE_NAME}
+ local NDK_DIR=android_ndk
+ if [[ "$(cat ${NDK_DIR}/android_ndk_url)" != ${NDK_URL} ]] ; then
+ echo @@@BUILD_STEP downloading Android NDK@@@
+ [[ -d ${NDK_DIR} ]] && rm -rf ${NDK_DIR}
+ [[ -d ${VERSION} ]] && rm -rf ${VERSION}
+ [[ -f ${FILE_NAME} ]] && rm -f ${FILE_NAME}
+ wget ${NDK_URL}
+ unzip ${FILE_NAME} > /dev/null
+ mv ${VERSION} ${NDK_DIR}
+ echo ${NDK_URL} > ${NDK_DIR}/android_ndk_url
+ fi
+
+ if [[ ! -d platform-tools ]] ; then
+ echo @@@BUILD_STEP downloading Android Platform Tools@@@
+ local FILE_NAME=platform-tools-latest-linux.zip
+ [[ -f ${FILE_NAME} ]] && rm -f ${FILE_NAME}
+ wget https://dl.google.com/android/repository/${FILE_NAME}
+ unzip ${FILE_NAME} > /dev/null
+ fi
+ export PATH=$ROOT/platform-tools/:$PATH
+}
+
+function build_android_ndk {
+ local NDK_DIR=android_ndk
+ local _arch=$1
+ if [[ ! -d $NDK_DIR/standalone-$_arch ]] ; then
+ echo @@@BUILD_STEP building Android NDK for $_arch@@@
+ $NDK_DIR/build/tools/make_standalone_toolchain.py --api 24 --force --arch $_arch --install-dir $NDK_DIR/standalone-$_arch
+ fi
+}
+
function build_llvm_symbolizer { # ARCH triple
local _arch=$1
local _triple=$2
+
+ echo @@@BUILD_STEP build llvm-symbolizer android/$_arch@@@
rm -rf llvm_build_android_$_arch
mkdir llvm_build_android_$_arch
cd llvm_build_android_$_arch
- local ANDROID_TOOLCHAIN=$ROOT/../../../android-ndk/standalone-$_arch
+ local ANDROID_TOOLCHAIN=$ROOT/android_ndk/standalone-$_arch
local ANDROID_FLAGS="--target=$_triple --sysroot=$ANDROID_TOOLCHAIN/sysroot -B$ANDROID_TOOLCHAIN"
cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
@@ -19,7 +56,6 @@ function build_llvm_symbolizer { # ARCH
-DCMAKE_CXX_FLAGS="$ANDROID_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="-pie" \
-DCMAKE_SKIP_RPATH=ON \
- -DANDROID=1 \
-DLLVM_BUILD_RUNTIME=OFF \
-DLLVM_TABLEGEN=$ROOT/llvm_build64/bin/llvm-tblgen \
${CMAKE_COMMON_OPTIONS} \
@@ -33,7 +69,9 @@ function build_compiler_rt { # ARCH trip
local _arch=$1
local _triple=$2
- local ANDROID_TOOLCHAIN=$ROOT/../../../android-ndk/standalone-$_arch
+ echo @@@BUILD_STEP build compiler-rt android/$_arch@@@
+
+ local ANDROID_TOOLCHAIN=$ROOT/android_ndk/standalone-$_arch
local ANDROID_LIBRARY_OUTPUT_DIR=$(ls -d $ROOT/llvm_build64/lib/clang/* | tail -1)
local ANDROID_EXEC_OUTPUT_DIR=$ROOT/llvm_build64/bin
local ANDROID_FLAGS="--target=$_triple --sysroot=$ANDROID_TOOLCHAIN/sysroot -B$ANDROID_TOOLCHAIN"
@@ -83,13 +121,14 @@ function test_android { # ARCH ABI STEP_
local _arch=$1
local _abi=$2
local _step_failure=$3
- ANDROID_DEVICES=$(adb devices | grep 'device$' | awk '{print $1}')
+ ADB=adb
+ ANDROID_DEVICES=$(${ADB} devices | grep 'device$' | awk '{print $1}')
for SERIAL in $ANDROID_DEVICES; do
- ABILIST=$(adb -s $SERIAL shell getprop ro.product.cpu.abilist)
+ ABILIST=$(${ADB} -s $SERIAL shell getprop ro.product.cpu.abilist)
patch_abilist $ABILIST ABILIST
if [[ $ABILIST == *"$_abi"* ]]; then
- BUILD_ID=$(adb -s $SERIAL shell getprop ro.build.id | tr -d '\r')
- BUILD_FLAVOR=$(adb -s $SERIAL shell getprop ro.build.flavor | tr -d '\r')
+ BUILD_ID=$(${ADB} -s $SERIAL shell getprop ro.build.id | tr -d '\r')
+ BUILD_FLAVOR=$(${ADB} -s $SERIAL shell getprop ro.build.flavor | tr -d '\r')
test_android_on_device "$_arch" "$SERIAL" "$BUILD_ID" "$BUILD_FLAVOR" "$_step_failure"
fi
done
@@ -104,10 +143,9 @@ function test_android_on_device { # ARCH
DEVICE_DESCRIPTION=$_arch/$_build_flavor/$_build_id
- ANDROID_SDK=$ROOT/../../../android-sdk-linux/
SYMBOLIZER_BIN=$ROOT/llvm_build_android_$_arch/bin/llvm-symbolizer
COMPILER_RT_BUILD_DIR=$ROOT/compiler_rt_build_android_$_arch
- ADB=$ROOT/../../../bin/adb
+ ADB=adb
DEVICE_ROOT=/data/local/asan_test
export ANDROID_SERIAL=$_serial
@@ -120,7 +158,8 @@ function test_android_on_device { # ARCH
echo "Device is up"
$ADB devices
- sleep 2
+ ($ADB disable-verity | grep "already disabled") || $ADB reboot
+ $ADB wait-for-device
ADB=$ADB $ROOT/llvm_build64/bin/asan_device_setup
sleep 2
@@ -134,7 +173,7 @@ function test_android_on_device { # ARCH
fi
# Kill leftover symbolizers. TODO: figure out what's going on.
- $ADB shell ps | grep llvm-symbolizer | awk '{print $2}' | xargs $ADB shell kill
+ $ADB shell pkill llvm-symbolizer || true
$ADB push $SYMBOLIZER_BIN /system/bin/
$ADB shell rm -rf $DEVICE_ROOT
Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_cmake.sh
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_cmake.sh?rev=306049&r1=306048&r2=306049&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_cmake.sh (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_cmake.sh Thu Jun 22 15:22:34 2017
@@ -40,11 +40,6 @@ if [ -e /usr/include/plugin-api.h ]; the
CMAKE_COMMON_OPTIONS="${CMAKE_COMMON_OPTIONS} -DLLVM_BINUTILS_INCDIR=/usr/include"
fi
-BUILD_ANDROID=${BUILD_ANDROID:-0}
-RUN_ANDROID=${RUN_ANDROID:-0}
-if [ $BUILD_ANDROID == 1 -o $RUN_ANDROID == 1 ] ; then
- . ${HERE}/buildbot_android_functions.sh
-fi
CHECK_LIBCXX=${CHECK_LIBCXX:-1}
CHECK_SYMBOLIZER=${CHECK_SYMBOLIZER:-$CHECK_LIBCXX}
CHECK_LLD=${CHECK_LLD:-1}
@@ -305,27 +300,3 @@ if [ "$PLATFORM" == "Linux" -a $HAVE_NIN
check_ninja_with_symbolizer $CHECK_UBSAN ubsan
fi
fi
-
-if [ $BUILD_ANDROID == 1 ] ; then
- build_android() {
- CPU=$1
- TRIPLE=$2
- echo @@@BUILD_STEP build compiler-rt android/$CPU@@@
- build_compiler_rt $CPU $TRIPLE
-
- echo @@@BUILD_STEP build llvm-symbolizer android/$CPU@@@
- build_llvm_symbolizer $CPU $TRIPLE
- }
- # Testing armv7 instead of plain arm to work around
- # https://code.google.com/p/android/issues/detail?id=68779
- build_android arm armv7-linux-androideabi
- build_android x86 i686-linux-android
- build_android aarch64 aarch64-linux-android
-fi
-
-if [ $RUN_ANDROID == 1 ] ; then
- test_android arm armeabi-v7a @@@STEP_FAILURE@@@
- test_android x86 x86 @@@STEP_FAILURE@@@
- test_android aarch64 arm64-v8a @@@STEP_FAILURE@@@
-fi
-
Modified: zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_selector.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_selector.py?rev=306049&r1=306048&r2=306049&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_selector.py (original)
+++ zorg/trunk/zorg/buildbot/builders/sanitizers/buildbot_selector.py Thu Jun 22 15:22:34 2017
@@ -26,7 +26,7 @@ BOT_ASSIGNMENT = {
BOT_ADDITIONAL_ENV = {
'sanitizer-ppc64le-linux': { 'HAVE_NINJA': '1', 'CHECK_LIBCXX': '0', 'CHECK_LLD': '0' },
'sanitizer-ppc64be-linux': { 'HAVE_NINJA': '1', 'CHECK_LIBCXX': '0', 'CHECK_LLD': '0' },
- 'sanitizer-x86_64-linux': { 'HAVE_NINJA' : '1', 'BUILD_ANDROID' : '1', 'RUN_ANDROID' : '1' },
+ 'sanitizer-x86_64-linux': { 'HAVE_NINJA' : '1' },
'sanitizer-x86_64-linux-bootstrap': {},
'sanitizer-x86_64-linux-fast': {},
'sanitizer-x86_64-linux-autoconf': {},
More information about the llvm-commits
mailing list