diff options
Diffstat (limited to 'bisect/run.sh')
-rwxr-xr-x | bisect/run.sh | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/bisect/run.sh b/bisect/run.sh new file mode 100755 index 0000000..6219248 --- /dev/null +++ b/bisect/run.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash + +# This script run one cycle of the bisect, by building (or self-hosting) +# LLVM+Clang, running the compiler tests and the test-suite, if required. +# Please, use the sequential.sh script to drive this one. + +. common.sh + +CORE=`grep "CPU part" /proc/cpuinfo | awk '{print $4}'` +if [[ $CORE = '0xc08' ]]; then + CORE="-mcpu=cortex-a8" +else if [[ $CORE = '0xc09' ]]; then + CORE="-mcpu=cortex-a9" +else if [[ $CORE = '0xc0f' ]]; then + CORE="-mcpu=cortex-a15" +else if [[ $CORE = '0xd03' ]]; then + CORE="-mcpu=cortex-a53" +else if [[ $CORE = '0xd07' ]]; then + CORE="-mcpu=cortex-a57" +else + CORE='' +fi fi fi fi fi + +selfhost=false +check=false +cflags=$CORE +full=false +keepbuild=false +while getopts "sct:hfvk" opt; do + case $opt in + s) + selfhost=true + ;; + c) + check=true + ;; + t) + test=$OPTARG + ;; + h) + cflags="$cflags -mthumb" + ;; + v) + cflags="$cflags -mfpu=vfpv3" + ;; + f) + full=true + ;; + k) + keepbuild=true + ;; + *) + echo "Syntax: $0 [-(s)elfhost | -(c)heck-all | -(t)est <test-suite-name>] | -T(h)umb | -(v)fp3 | -(f)ull-with-RT | -(k)eep build dir" + exit 1 + ;; + esac +done + +flush() { + if ! $keepbuild; then + if [[ -d $1 && $1 != '/' ]]; then + rm -rf $1 + fi + fi + mkdir -p $1 + cd $1 +} + +build() { + CC=gcc + CXX=g++ + if [[ $1 != '' ]]; then + CC=$1/bin/clang + CXX=$1/bin/clang++ + fi + CC=$CC CXX=$CXX \ + cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_FLAGS="$cflags" \ + -DCMAKE_CXX_FLAGS="$cflags" \ + -DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \ + -DLLVM_BUILD_TESTS=True \ + -DLLVM_ENABLE_ASSERTIONS=True + safe_run ninja + if $check; then + safe_run ninja check-all + fi +} + +ROOT=`pwd` + +if $full; then + ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt +else + rm -f `pwd`/llvm/projects/compiler-rt +fi + +# Native build +flush $ROOT/build +build + +if $selfhost; then + # Self-hosting build + flush $ROOT/build2 + build $ROOT/build +fi + +if [[ $test != '' ]]; then + cd $ROOT + safe_run ./test.sh $test +fi + +# SVN info +cd $ROOT +svn info llvm |