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 | |
Diana Picus | 0df0001 | 2016-09-15 16:10:44 +0300 | [diff] [blame] | 24 | PARALLEL=-j`grep -c proc /proc/cpuinfo` |
| 25 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 26 | selfhost=false |
| 27 | check=false |
| 28 | cflags=$CORE |
| 29 | full=false |
| 30 | keepbuild=false |
| 31 | while getopts "sct:hfvk" opt; do |
| 32 | case $opt in |
| 33 | s) |
| 34 | selfhost=true |
| 35 | ;; |
| 36 | c) |
| 37 | check=true |
| 38 | ;; |
| 39 | t) |
| 40 | test=$OPTARG |
| 41 | ;; |
| 42 | h) |
| 43 | cflags="$cflags -mthumb" |
| 44 | ;; |
| 45 | v) |
| 46 | cflags="$cflags -mfpu=vfpv3" |
| 47 | ;; |
| 48 | f) |
| 49 | full=true |
| 50 | ;; |
| 51 | k) |
| 52 | keepbuild=true |
| 53 | ;; |
| 54 | *) |
| 55 | 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" |
| 56 | exit 1 |
| 57 | ;; |
| 58 | esac |
| 59 | done |
| 60 | |
| 61 | flush() { |
| 62 | if ! $keepbuild; then |
| 63 | if [[ -d $1 && $1 != '/' ]]; then |
| 64 | rm -rf $1 |
| 65 | fi |
| 66 | fi |
| 67 | mkdir -p $1 |
| 68 | cd $1 |
| 69 | } |
| 70 | |
| 71 | build() { |
| 72 | CC=gcc |
| 73 | CXX=g++ |
| 74 | if [[ $1 != '' ]]; then |
| 75 | CC=$1/bin/clang |
| 76 | CXX=$1/bin/clang++ |
| 77 | fi |
| 78 | CC=$CC CXX=$CXX \ |
| 79 | cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release \ |
| 80 | -DCMAKE_C_FLAGS="$cflags" \ |
| 81 | -DCMAKE_CXX_FLAGS="$cflags" \ |
| 82 | -DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \ |
| 83 | -DLLVM_BUILD_TESTS=True \ |
Diana Picus | 0df0001 | 2016-09-15 16:10:44 +0300 | [diff] [blame] | 84 | -DLLVM_ENABLE_ASSERTIONS=True \ |
| 85 | -DLLVM_LIT_ARGS="-sv $PARALLEL" |
| 86 | safe_run ninja $PARALLEL |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 87 | if $check; then |
| 88 | safe_run ninja check-all |
| 89 | fi |
| 90 | } |
| 91 | |
| 92 | ROOT=`pwd` |
| 93 | |
| 94 | if $full; then |
| 95 | ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt |
| 96 | else |
| 97 | rm -f `pwd`/llvm/projects/compiler-rt |
| 98 | fi |
| 99 | |
| 100 | # Native build |
| 101 | flush $ROOT/build |
| 102 | build |
| 103 | |
| 104 | if $selfhost; then |
| 105 | # Self-hosting build |
| 106 | flush $ROOT/build2 |
| 107 | build $ROOT/build |
| 108 | fi |
| 109 | |
| 110 | if [[ $test != '' ]]; then |
| 111 | cd $ROOT |
| 112 | safe_run ./test.sh $test |
| 113 | fi |
| 114 | |
| 115 | # SVN info |
| 116 | cd $ROOT |
| 117 | svn info llvm |