Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This script run one cycle of the bisect, by building (or self-hosting) |
| 4 | # LLVM+Clang, running the compiler tests and the test-suite, if required. |
| 5 | # Please, use the sequential.sh script to drive this one. |
| 6 | |
| 7 | . common.sh |
| 8 | |
| 9 | CORE=`grep "CPU part" /proc/cpuinfo | awk '{print $4}'` |
| 10 | if [[ $CORE = '0xc08' ]]; then |
| 11 | CORE="-mcpu=cortex-a8" |
| 12 | else if [[ $CORE = '0xc09' ]]; then |
| 13 | CORE="-mcpu=cortex-a9" |
| 14 | else if [[ $CORE = '0xc0f' ]]; then |
| 15 | CORE="-mcpu=cortex-a15" |
| 16 | else if [[ $CORE = '0xd03' ]]; then |
| 17 | CORE="-mcpu=cortex-a53" |
| 18 | else if [[ $CORE = '0xd07' ]]; then |
| 19 | CORE="-mcpu=cortex-a57" |
| 20 | else |
| 21 | CORE='' |
| 22 | fi fi fi fi fi |
| 23 | |
| 24 | selfhost=false |
| 25 | check=false |
| 26 | cflags=$CORE |
| 27 | full=false |
| 28 | keepbuild=false |
| 29 | while getopts "sct:hfvk" opt; do |
| 30 | case $opt in |
| 31 | s) |
| 32 | selfhost=true |
| 33 | ;; |
| 34 | c) |
| 35 | check=true |
| 36 | ;; |
| 37 | t) |
| 38 | test=$OPTARG |
| 39 | ;; |
| 40 | h) |
| 41 | cflags="$cflags -mthumb" |
| 42 | ;; |
| 43 | v) |
| 44 | cflags="$cflags -mfpu=vfpv3" |
| 45 | ;; |
| 46 | f) |
| 47 | full=true |
| 48 | ;; |
| 49 | k) |
| 50 | keepbuild=true |
| 51 | ;; |
| 52 | *) |
| 53 | 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" |
| 54 | exit 1 |
| 55 | ;; |
| 56 | esac |
| 57 | done |
| 58 | |
| 59 | flush() { |
| 60 | if ! $keepbuild; then |
| 61 | if [[ -d $1 && $1 != '/' ]]; then |
| 62 | rm -rf $1 |
| 63 | fi |
| 64 | fi |
| 65 | mkdir -p $1 |
| 66 | cd $1 |
| 67 | } |
| 68 | |
| 69 | build() { |
| 70 | CC=gcc |
| 71 | CXX=g++ |
| 72 | if [[ $1 != '' ]]; then |
| 73 | CC=$1/bin/clang |
| 74 | CXX=$1/bin/clang++ |
| 75 | fi |
| 76 | CC=$CC CXX=$CXX \ |
| 77 | cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release \ |
| 78 | -DCMAKE_C_FLAGS="$cflags" \ |
| 79 | -DCMAKE_CXX_FLAGS="$cflags" \ |
| 80 | -DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \ |
| 81 | -DLLVM_BUILD_TESTS=True \ |
| 82 | -DLLVM_ENABLE_ASSERTIONS=True |
| 83 | safe_run ninja |
| 84 | if $check; then |
| 85 | safe_run ninja check-all |
| 86 | fi |
| 87 | } |
| 88 | |
| 89 | ROOT=`pwd` |
| 90 | |
| 91 | if $full; then |
| 92 | ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt |
| 93 | else |
| 94 | rm -f `pwd`/llvm/projects/compiler-rt |
| 95 | fi |
| 96 | |
| 97 | # Native build |
| 98 | flush $ROOT/build |
| 99 | build |
| 100 | |
| 101 | if $selfhost; then |
| 102 | # Self-hosting build |
| 103 | flush $ROOT/build2 |
| 104 | build $ROOT/build |
| 105 | fi |
| 106 | |
| 107 | if [[ $test != '' ]]; then |
| 108 | cd $ROOT |
| 109 | safe_run ./test.sh $test |
| 110 | fi |
| 111 | |
| 112 | # SVN info |
| 113 | cd $ROOT |
| 114 | svn info llvm |