Move stack slot assignments into LiveRangeEdit.
[llvm.git] / utils / release / test-release.sh
blobe24638e714a35aca0062627a6213674aa9a187a2
1 #!/bin/bash
2 #===-- test-release.sh - Test the LLVM release candidates ------------------===#
4 # The LLVM Compiler Infrastructure
6 # This file is distributed under the University of Illinois Open Source
7 # License.
9 #===------------------------------------------------------------------------===#
11 # Download, build, and test the release candidate for an LLVM release.
13 #===------------------------------------------------------------------------===#
15 set -e
17 Release=""
18 Release_no_dot=""
19 RC=""
20 do_checkout="yes"
21 do_ada="no"
22 do_objc="yes"
23 do_fortran="yes"
24 do_64bit="yes"
25 BuildDir="`pwd`"
27 function usage() {
28 echo "usage: `basename $0` -release X.Y -rc NUM [OPTIONS]"
29 echo ""
30 echo " -release X.Y The release number to test."
31 echo " -rc NUM The pre-release candidate number."
32 echo " -j NUM Number of compile jobs to run. [default: 3]"
33 echo " -build-dir DIR Directory to perform testing in. [default: pwd]"
34 echo " -no-checkout Don't checkout the sources from SVN."
35 echo " -no-64bit Don't test the 64-bit version. [default: yes]"
36 echo " -ada Build Ada. [default: no]"
37 echo " -disable-objc Disable ObjC build. [default: build]"
38 echo " -disable-fortran Disable Fortran build. [default: build]"
41 while [ $# -gt 0 ]; do
42 case $1 in
43 -release | --release )
44 shift
45 Release="$1"
46 Release_no_dot="`echo $1 | sed -e 's,\.,,'`"
48 -rc | --rc | -RC | --RC )
49 shift
50 RC=$1
52 -j* )
53 NumJobs="`echo $1 | sed -e 's,-j\([0-9]*\),\1,g'`"
54 if [ -z "$NumJobs" ]; then
55 shift
56 NumJobs="$1"
59 -build-dir | --build-dir | -builddir | --builddir )
60 shift
61 BuildDir="$1"
63 -no-checkout | --no-checkout )
64 do_checkout="no"
66 -no-64bit | --no-64bit )
67 do_64bit="no"
69 -ada | --ada )
70 do_ada="yes"
72 -disable-objc | --disable-objc )
73 do_objc="no"
75 -disable-fortran | --disable-fortran )
76 echo "WARNING: Do you *really* need to disable Fortran?"
77 sleep 5
78 do_fortran="no"
80 -help | --help | -h | --h | -\? )
81 usage
82 exit 0
84 * )
85 echo "unknown option: $1"
86 usage
87 exit 1
89 esac
90 shift
91 done
93 # Check required arguments.
94 if [ -z "$Release" ]; then
95 echo "No release number specified!"
96 exit 1
98 if [ -z "$RC" ]; then
99 echo "No release candidate number specified!"
100 exit 1
103 # Figure out how many make processes to run.
104 if [ -z "$NumJobs" ]; then
105 NumJobs=`sysctl -n hw.activecpu 2> /dev/null || true`
107 if [ -z "$NumJobs" ]; then
108 NumJobs=`sysctl -n hw.ncpu 2> /dev/null || true`
110 if [ -z "$NumJobs" ]; then
111 NumJobs=`grep -c processor /proc/cpuinfo 2> /dev/null || true`
113 if [ -z "$NumJobs" ]; then
114 NumJobs=3
117 # Location of sources.
118 llvmCore_srcdir=$BuildDir/llvmCore-$Release-rc$RC.src
119 llvmgcc42_srcdir=$BuildDir/llvmgcc42-$Release-rc$RC.src
121 # Location of log files.
122 LogDirName="$Release-rc$RC.logs"
123 LogDir=$BuildDir/$LogDirName
124 mkdir -p $LogDir
126 # SVN URLs for the sources.
127 Base_url="http://llvm.org/svn/llvm-project"
128 llvmCore_RC_url="$Base_url/llvm/tags/RELEASE_$Release_no_dot/rc$RC"
129 llvmgcc42_RC_url="$Base_url/llvm-gcc-4.2/tags/RELEASE_$Release_no_dot/rc$RC"
130 clang_RC_url="$Base_url/cfe/tags/RELEASE_$Release_no_dot/rc$RC"
131 test_suite_RC_url="$Base_url/test-suite/tags/RELEASE_$Release_no_dot/rc$RC"
133 # Make sure that the URLs are valid.
134 function check_valid_urls() {
135 echo "# Validating SVN URLs"
136 if ! svn ls $llvmCore_RC_url > /dev/null 2>&1 ; then
137 echo "llvm $Release release candidate $RC doesn't exist!"
138 exit 1
140 if ! svn ls $llvmgcc42_RC_url > /dev/null 2>&1 ; then
141 echo "llvm-gcc-4.2 $Release release candidate $RC doesn't exist!"
142 exit 1
144 if ! svn ls $clang_RC_url > /dev/null 2>&1 ; then
145 echo "clang $Release release candidate $RC doesn't exist!"
146 exit 1
148 if ! svn ls $test_suite_RC_url > /dev/null 2>&1 ; then
149 echo "test-suite $Release release candidate $RC doesn't exist!"
150 exit 1
154 # Export sources to the the build directory.
155 function export_sources() {
156 check_valid_urls
158 echo "# Exporting llvm $Release-RC$RC sources"
159 svn export -q $llvmCore_RC_url $llvmCore_srcdir
160 echo "# Exporting llvm-gcc-4.2 $Release-rc$RC sources"
161 svn export -q $llvmgcc42_RC_url $llvmgcc42_srcdir
162 echo "# Exporting clang $Release-rc$RC sources"
163 svn export -q $clang_RC_url $llvmCore_srcdir/tools/clang
164 echo "# Exporting llvm test suite $Release-rc$RC sources"
165 svn export -q $test_suite_RC_url $llvmCore_srcdir/projects/llvm-test
168 function configure_llvmCore() {
169 Phase="$1"
170 Flavor="$2"
171 ObjDir="$3"
172 InstallDir="$4"
173 llvmgccDir="$5"
175 case $Flavor in
176 Release | Release-64 )
177 Optimized="yes"
178 Assertions="no"
180 Release+Asserts )
181 Optimized="yes"
182 Assertions="yes"
184 Debug )
185 Optimized="no"
186 Assertions="yes"
189 echo "# Invalid flavor $Flavor!"
190 echo ""
191 return
193 esac
195 cd $ObjDir
196 echo "# Configuring llvm $Release-rc$RC $Flavor"
197 echo "# $llvmCore_srcdir/configure --prefix=$InstallDir \
198 --enable-optimized=$Optimized \
199 --enable-assertions=$Assertions \
200 --with-llvmgccdir=$llvmgccDir"
201 $llvmCore_srcdir/configure --prefix=$InstallDir \
202 --enable-optimized=$Optimized \
203 --enable-assertions=$Assertions \
204 --with-llvmgccdir=$llvmgccDir \
205 > $LogDir/llvm.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
206 cd -
209 function build_llvmCore() {
210 Phase="$1"
211 Flavor="$2"
212 ObjDir="$3"
213 ExtraOpts=""
215 CompilerFlags=""
216 if [ "$Phase" = "2" ]; then
217 CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
219 if [ "$Flavor" = "Release-64" ]; then
220 ExtraOpts="EXTRA_OPTIONS=-m64"
223 cd $ObjDir
224 echo "# Compiling llvm $Release-rc$RC $Flavor"
225 echo "# make -j $NumJobs VERBOSE=1 $ExtraOpts"
226 make -j $NumJobs VERBOSE=1 $ExtraOpts $CompilerFlags \
227 > $LogDir/llvm.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
229 echo "# Installing llvm $Release-rc$RC $Flavor"
230 echo "# make install"
231 make install \
232 > $LogDir/llvm.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
233 cd -
236 function test_llvmCore() {
237 Phase="$1"
238 Flavor="$2"
239 ObjDir="$3"
241 cd $ObjDir
242 make check \
243 > $LogDir/llvm.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
244 make -C tools/clang test \
245 > $LogDir/clang.check.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
246 make unittests \
247 > $LogDir/llvm.unittests.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
248 cd -
251 function configure_llvm_gcc() {
252 Phase="$1"
253 Flavor="$2"
254 ObjDir="$3"
255 InstallDir="$4"
256 llvmObjDir="$5"
258 languages="c,c++"
259 if [ "$do_objc" = "yes" ]; then
260 languages="$languages,objc,obj-c++"
262 if [ "$do_fortran" = "yes" ]; then
263 languages="$languages,fortran"
265 if [ "$do_ada" = "yes" ]; then
266 languages="$languages,ada"
269 cd $ObjDir
270 echo "# Configuring llvm-gcc $Release-rc$RC $Flavor"
271 echo "# $llvmgcc42_srcdir/configure --prefix=$InstallDir \
272 --program-prefix=llvm- --enable-llvm=$llvmObjDir \
273 --enable-languages=$languages"
274 $llvmgcc42_srcdir/configure --prefix=$InstallDir \
275 --program-prefix=llvm- --enable-llvm=$llvmObjDir \
276 --enable-languages=$languages \
277 > $LogDir/llvm-gcc.configure.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
278 cd -
281 function build_llvm_gcc() {
282 Phase="$1"
283 Flavor="$2"
284 ObjDir="$3"
285 llvmgccDir="$4"
287 CompilerFlags=""
288 if [ "$Phase" = "2" ]; then
289 CompilerFlags="CC=$llvmgccDir/bin/llvm-gcc CXX=$llvmgccDir/bin/llvm-g++"
292 cd $ObjDir
293 echo "# Compiling llvm-gcc $Release-rc$RC $Flavor"
294 echo "# make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release"
295 make -j $NumJobs bootstrap LLVM_VERSION_INFO=$Release $CompilerFlags \
296 > $LogDir/llvm-gcc.make.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
298 echo "# Installing llvm-gcc $Release-rc$RC $Flavor"
299 echo "# make install"
300 make install \
301 > $LogDir/llvm-gcc.install.$Release-rc$RC-Phase$Phase-$Flavor.log 2>&1
302 cd -
305 if [ "$do_checkout" = "yes" ]; then
306 export_sources
310 Flavors="Debug Release Release+Asserts"
311 if [ "$do_64bit" = "yes" ]; then
312 Flavors="$Flavors Release-64"
315 for Flavor in $Flavors ; do
316 echo ""
317 echo ""
318 echo "********************************************************************************"
319 echo " Release: $Release-rc$RC"
320 echo " Build: $Flavor"
321 echo " System Info: "
322 echo " `uname -a`"
323 echo "********************************************************************************"
324 echo ""
326 llvmCore_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-rc$RC.obj
327 llvmCore_phase1_installdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-rc$RC.install
329 llvmCore_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-rc$RC.obj
330 llvmCore_phase2_installdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-rc$RC.install
332 rm -rf $llvmCore_phase1_objdir
333 rm -rf $llvmCore_phase1_installdir
334 rm -rf $llvmCore_phase2_objdir
335 rm -rf $llvmCore_phase2_installdir
337 mkdir -p $llvmCore_phase1_objdir
338 mkdir -p $llvmCore_phase1_installdir
339 mkdir -p $llvmCore_phase2_objdir
340 mkdir -p $llvmCore_phase2_installdir
342 llvmgcc42_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.obj
343 llvmgcc42_phase1_installdir=$BuildDir/Phase1/$Flavor/llvmgcc42-$Release-rc$RC.install
345 llvmgcc42_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.obj
346 llvmgcc42_phase2_installdir=$BuildDir/Phase2/$Flavor/llvmgcc42-$Release-rc$RC.install
348 rm -rf $llvmgcc42_phase1_objdir
349 rm -rf $llvmgcc42_phase1_installdir
350 rm -rf $llvmgcc42_phase2_objdir
351 rm -rf $llvmgcc42_phase2_installdir
353 mkdir -p $llvmgcc42_phase1_objdir
354 mkdir -p $llvmgcc42_phase1_installdir
355 mkdir -p $llvmgcc42_phase2_objdir
356 mkdir -p $llvmgcc42_phase2_installdir
358 ############################################################################
359 # Phase 1: Build llvmCore and llvmgcc42
360 echo "# Phase 1: Building llvmCore"
361 configure_llvmCore 1 $Flavor \
362 $llvmCore_phase1_objdir $llvmCore_phase1_installdir \
363 $llvmgcc42_phase1_installdir
364 build_llvmCore 1 $Flavor \
365 $llvmCore_phase1_objdir
367 echo "# Phase 1: Building llvmgcc42"
368 configure_llvm_gcc 1 $Flavor \
369 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir \
370 $llvmCore_phase1_objdir
371 build_llvm_gcc 1 $Flavor \
372 $llvmgcc42_phase1_objdir $llvmgcc42_phase1_installdir
374 ############################################################################
375 # Phase 2: Build llvmCore with newly built llvmgcc42 from phase 1.
376 echo "# Phase 2: Building llvmCore"
377 configure_llvmCore 2 $Flavor \
378 $llvmCore_phase2_objdir $llvmCore_phase2_installdir \
379 $llvmgcc42_phase1_installdir
380 build_llvmCore 2 $Flavor \
381 $llvmCore_phase2_objdir
383 echo "# Phase 2: Building llvmgcc42"
384 configure_llvm_gcc 2 $Flavor \
385 $llvmgcc42_phase2_objdir $llvmgcc42_phase2_installdir \
386 $llvmCore_phase2_objdir
387 build_llvm_gcc 2 $Flavor \
388 $llvmgcc42_phase2_objdir $llvmgcc42_phase1_installdir
390 echo "# Testing - built with llvmgcc42"
391 test_llvmCore 2 $Flavor $llvmCore_phase2_objdir
392 done
393 ) 2>&1 | tee $LogDir/testing.$Release-rc$RC.log
395 # Woo hoo!
396 echo "### Testing Finished ###"
397 echo "### Logs: $LogDir"
398 exit 0