blob: 6219248e3e3401c9c0c8388c2886d66f2a8aac39 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/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
9CORE=`grep "CPU part" /proc/cpuinfo | awk '{print $4}'`
10if [[ $CORE = '0xc08' ]]; then
11 CORE="-mcpu=cortex-a8"
12else if [[ $CORE = '0xc09' ]]; then
13 CORE="-mcpu=cortex-a9"
14else if [[ $CORE = '0xc0f' ]]; then
15 CORE="-mcpu=cortex-a15"
16else if [[ $CORE = '0xd03' ]]; then
17 CORE="-mcpu=cortex-a53"
18else if [[ $CORE = '0xd07' ]]; then
19 CORE="-mcpu=cortex-a57"
20else
21 CORE=''
22fi fi fi fi fi
23
24selfhost=false
25check=false
26cflags=$CORE
27full=false
28keepbuild=false
29while 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
57done
58
59flush() {
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
69build() {
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
89ROOT=`pwd`
90
91if $full; then
92 ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt
93else
94 rm -f `pwd`/llvm/projects/compiler-rt
95fi
96
97# Native build
98flush $ROOT/build
99build
100
101if $selfhost; then
102 # Self-hosting build
103 flush $ROOT/build2
104 build $ROOT/build
105fi
106
107if [[ $test != '' ]]; then
108 cd $ROOT
109 safe_run ./test.sh $test
110fi
111
112# SVN info
113cd $ROOT
114svn info llvm