[RISCV] Regenerate autogen test to remove spurious diff
[llvm-project.git] / llvm / utils / release / test-release.sh
blob544d4bfdd799ce83a98bb1799532e1d9bf19e039
1 #!/usr/bin/env bash
2 #===-- test-release.sh - Test the LLVM release candidates ------------------===#
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===------------------------------------------------------------------------===#
10 # Download, build, and test the release candidate for an LLVM release.
12 #===------------------------------------------------------------------------===#
14 System=`uname -s`
15 Machine=`uname -m`
16 if [ "$System" = "FreeBSD" ]; then
17 MAKE=gmake
18 else
19 MAKE=make
21 generator="Unix Makefiles"
23 Release=""
24 Release_no_dot=""
25 RC=""
26 Triple=""
27 use_gzip="no"
28 do_checkout="yes"
29 do_debug="no"
30 do_asserts="no"
31 do_compare="yes"
32 do_rt="yes"
33 do_clang_tools="yes"
34 do_libs="yes"
35 do_libcxxabi="yes"
36 do_libunwind="yes"
37 do_test_suite="yes"
38 do_openmp="yes"
39 do_lld="yes"
40 do_lldb="yes"
41 do_polly="yes"
42 do_mlir="yes"
43 do_flang="yes"
44 do_silent_log="no"
45 BuildDir="`pwd`"
46 ExtraConfigureFlags=""
47 ExportBranch=""
48 git_ref=""
49 do_cmake_cache="no"
50 do_bolt="no"
51 if [ "$System" = "Linux" ]; then
52 case $Machine in
53 x86_64 | arm64 | aarch64 )
54 do_bolt="yes"
56 esac
59 function usage() {
60 echo "usage: `basename $0` -release X.Y.Z -rc NUM [OPTIONS]"
61 echo ""
62 echo " -release X.Y.Z The release version to test."
63 echo " -rc NUM The pre-release candidate number."
64 echo " -final The final release candidate."
65 echo " -triple TRIPLE The target triple for this machine."
66 echo " -j NUM Number of compile jobs to run. [default: 3]"
67 echo " -build-dir DIR Directory to perform testing in. [default: pwd]"
68 echo " -no-checkout Don't checkout the sources from SVN."
69 echo " -test-debug Test the debug build. [default: no]"
70 echo " -test-asserts Test with asserts on. [default: no]"
71 echo " -no-compare-files Don't test that phase 2 and 3 files are identical."
72 echo " -use-gzip Use gzip instead of xz."
73 echo " -use-ninja Use ninja instead of make/gmake."
74 echo " -configure-flags FLAGS Extra flags to pass to the configure step."
75 echo " -git-ref sha Use the specified git ref for testing instead of a release."
76 echo " -no-rt Disable check-out & build Compiler-RT"
77 echo " -no-clang-tools Disable check-out & build clang-tools-extra"
78 echo " -no-libs Disable check-out & build libcxx/libcxxabi/libunwind"
79 echo " -no-libcxxabi Disable check-out & build libcxxabi"
80 echo " -no-libunwind Disable check-out & build libunwind"
81 echo " -no-test-suite Disable check-out & build test-suite"
82 echo " -no-openmp Disable check-out & build libomp"
83 echo " -no-lld Disable check-out & build lld"
84 echo " -lldb Enable check-out & build lldb"
85 echo " -no-lldb Disable check-out & build lldb (default)"
86 echo " -no-polly Disable check-out & build Polly"
87 echo " -no-mlir Disable check-out & build MLIR"
88 echo " -no-flang Disable check-out & build Flang"
89 echo " -silent-log Don't output build logs to stdout"
90 echo " -use-cmake-cache Build using a CMake cache file"
93 while [ $# -gt 0 ]; do
94 case $1 in
95 -release | --release )
96 shift
97 Release="$1"
98 Release_no_dot="`echo $1 | sed -e 's,\.,,g'`"
100 -rc | --rc | -RC | --RC )
101 shift
102 RC="rc$1"
104 -final | --final )
105 RC=final
107 -git-ref | --git-ref )
108 shift
109 Release="test"
110 Release_no_dot="test"
111 ExportBranch="$1"
112 RC="`echo $ExportBranch | sed -e 's,/,_,g'`"
113 git_ref="$1"
114 echo "WARNING: Using the ref $git_ref instead of a release tag"
115 echo " This is intended to aid new packagers in trialing "
116 echo " builds without requiring a tag to be created first"
118 -triple | --triple )
119 shift
120 Triple="$1"
122 -configure-flags | --configure-flags )
123 shift
124 ExtraConfigureFlags="$1"
126 -j* )
127 NumJobs="`echo $1 | sed -e 's,-j\([0-9]*\),\1,g'`"
128 if [ -z "$NumJobs" ]; then
129 shift
130 NumJobs="$1"
133 -use-ninja )
134 MAKE=ninja
135 generator=Ninja
137 -build-dir | --build-dir | -builddir | --builddir )
138 shift
139 BuildDir="$1"
141 -no-checkout | --no-checkout )
142 do_checkout="no"
144 -test-debug | --test-debug )
145 do_debug="yes"
147 -test-asserts | --test-asserts )
148 do_asserts="yes"
150 -no-compare-files | --no-compare-files )
151 do_compare="no"
153 -use-gzip | --use-gzip )
154 use_gzip="yes"
156 -no-rt )
157 do_rt="no"
159 -no-libs )
160 do_libs="no"
162 -no-clang-tools )
163 do_clang_tools="no"
165 -no-libcxxabi )
166 do_libcxxabi="no"
168 -no-libunwind )
169 do_libunwind="no"
171 -no-test-suite )
172 do_test_suite="no"
174 -no-openmp )
175 do_openmp="no"
177 -bolt )
178 do_bolt="yes"
180 -no-bolt )
181 do_bolt="no"
183 -no-lld )
184 do_lld="no"
186 -lldb )
187 do_lldb="yes"
189 -no-lldb )
190 do_lldb="no"
192 -no-polly )
193 do_polly="no"
195 -no-mlir )
196 do_mlir="no"
198 -no-flang )
199 do_flang="no"
201 -silent-log )
202 do_silent_log="yes"
204 -use-cmake-cache | --use-cmake-cache )
205 do_cmake_cache="yes"
207 -help | --help | -h | --h | -\? )
208 usage
209 exit 0
212 echo "unknown option: $1"
213 usage
214 exit 1
216 esac
217 shift
218 done
220 if [ $do_mlir = "no" ] && [ $do_flang = "yes" ]; then
221 echo "error: cannot build Flang without MLIR"
222 exit 1
225 # Check required arguments.
226 if [ -z "$Release" ]; then
227 echo "error: no release number specified"
228 exit 1
230 if [ -z "$RC" ]; then
231 echo "error: no release candidate number specified"
232 exit 1
234 if [ -z "$ExportBranch" ]; then
235 ExportBranch="tags/RELEASE_$Release_no_dot/$RC"
237 if [ -z "$Triple" ]; then
238 echo "error: no target triple specified"
239 exit 1
242 if [ "$Release" != "test" ]; then
243 if [ -n "$git_ref" ]; then
244 echo "error: can't specify both -release and -git-ref"
245 exit 1
247 git_ref=llvmorg-$Release
248 if [ "$RC" != "final" ]; then
249 git_ref="$git_ref-$RC"
253 UserNumJobs="$NumJobs"
255 # Figure out how many make processes to run.
256 if [ -z "$NumJobs" ]; then
257 NumJobs=`sysctl -n hw.activecpu 2> /dev/null || true`
259 if [ -z "$NumJobs" ]; then
260 NumJobs=`sysctl -n hw.ncpu 2> /dev/null || true`
262 if [ -z "$NumJobs" ]; then
263 NumJobs=`grep -c processor /proc/cpuinfo 2> /dev/null || true`
265 if [ -z "$NumJobs" ]; then
266 NumJobs=3
269 if [ "$MAKE" = "ninja" ] && [ -z "$UserNumJobs" ]; then
270 # Rely on default ninja job numbers
271 J_ARG=""
272 else
273 J_ARG="-j $NumJobs"
276 # Projects list
277 projects="llvm;clang"
278 if [ $do_clang_tools = "yes" ]; then
279 projects="${projects:+$projects;}clang-tools-extra"
281 runtimes=""
282 if [ $do_rt = "yes" ]; then
283 runtimes="${runtimes:+$runtimes;}compiler-rt"
285 if [ $do_libs = "yes" ]; then
286 runtimes="${runtimes:+$runtimes;}libcxx"
287 if [ $do_libcxxabi = "yes" ]; then
288 runtimes="${runtimes:+$runtimes;}libcxxabi"
290 if [ $do_libunwind = "yes" ]; then
291 runtimes="${runtimes:+$runtimes;}libunwind"
294 if [ $do_openmp = "yes" ]; then
295 projects="${projects:+$projects;}openmp"
297 if [ $do_bolt = "yes" ]; then
298 projects="${projects:+$projects;}bolt"
300 if [ $do_lld = "yes" ]; then
301 projects="${projects:+$projects;}lld"
303 if [ $do_lldb = "yes" ]; then
304 projects="${projects:+$projects;}lldb"
306 if [ $do_polly = "yes" ]; then
307 projects="${projects:+$projects;}polly"
309 if [ $do_mlir = "yes" ]; then
310 projects="${projects:+$projects;}mlir"
312 if [ $do_flang = "yes" ]; then
313 projects="${projects:+$projects;}flang"
316 # Go to the build directory (may be different from CWD)
317 BuildDir=$BuildDir/$RC
318 mkdir -p $BuildDir
319 cd $BuildDir
321 # Location of log files.
322 LogDir=$BuildDir/logs
323 mkdir -p $LogDir
325 # Final package name.
326 Package=clang+llvm-$Release
327 if [ $RC != "final" ]; then
328 Package=$Package-$RC
330 Package=$Package-$Triple
332 # Errors to be highlighted at the end are written to this file.
333 echo -n > $LogDir/deferred_errors.log
335 redir="/dev/stdout"
336 if [ $do_silent_log == "yes" ]; then
337 echo "# Silencing build logs because of -silent-log flag..."
338 redir="/dev/null"
342 function build_with_cmake_cache() {
344 CMakeBuildDir=$BuildDir/build
345 SrcDir=$BuildDir/llvm-project/
346 InstallDir=$BuildDir/install
348 rm -rf $CMakeBuildDir
350 # FIXME: Would be nice if the commands were echoed to the log file too.
351 set -x
353 env CC="$c_compiler" CXX="$cxx_compiler" \
354 cmake -G "$generator" -B $CMakeBuildDir -S $SrcDir/llvm \
355 -C $SrcDir/clang/cmake/caches/Release.cmake \
356 -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_POSITION_INDEPENDENT_CODE;LLVM_LIT_ARGS" \
357 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
358 -DLLVM_LIT_ARGS="-j $NumJobs $LitVerbose" \
359 $ExtraConfigureFlags
360 2>&1 | tee $LogDir/llvm.configure-$Flavor.log
362 ${MAKE} $J_ARG $Verbose -C $CMakeBuildDir stage3-check-all \
363 2>&1 | tee $LogDir/llvm.make-$Flavor.log > $redir
365 DESTDIR="${InstallDir}" \
366 ${MAKE} -C $CMakeBuildDir stage3-install \
367 2>&1 | tee $LogDir/llvm.install-$Flavor.log > $redir
369 mkdir -p $BuildDir/Release
370 pushd $BuildDir/Release
371 mv $InstallDir/usr/local $Package
372 if [ "$use_gzip" = "yes" ]; then
373 tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
374 else
375 tar cf - $Package | xz -9ce -T $NumJobs > $BuildDir/$Package.tar.xz
377 mv $Package $InstallDir/usr/local
378 popd
379 ) 2>&1 | tee $LogDir/testing.$Release-$RC.log
381 exit 0
384 function deferred_error() {
385 Phase="$1"
386 Flavor="$2"
387 Msg="$3"
388 echo "[${Flavor} Phase${Phase}] ${Msg}" | tee -a $LogDir/deferred_errors.log
391 # Make sure that a required program is available
392 function check_program_exists() {
393 local program="$1"
394 if ! type -P $program > /dev/null 2>&1 ; then
395 echo "program '$1' not found !"
396 exit 1
400 if [ "$System" != "Darwin" ] && [ "$System" != "SunOS" ] && [ "$System" != "AIX" ]; then
401 check_program_exists 'chrpath'
404 if [ "$System" != "Darwin" ]; then
405 check_program_exists 'file'
406 check_program_exists 'objdump'
409 check_program_exists ${MAKE}
411 # Export sources to the build directory.
412 function export_sources() {
413 SrcDir=$BuildDir/llvm-project
414 mkdir -p $SrcDir
415 echo "# Using git ref: $git_ref"
417 # GitHub allows you to download a tarball of any commit using the URL:
418 # https://github.com/$organization/$repo/archive/$ref.tar.gz
419 curl -L https://github.com/llvm/llvm-project/archive/$git_ref.tar.gz | \
420 tar -C $SrcDir --strip-components=1 -xzf -
422 if [ "$do_test_suite" = "yes" ]; then
423 TestSuiteSrcDir=$BuildDir/llvm-test-suite
424 mkdir -p $TestSuiteSrcDir
426 # We can only use named refs, like branches and tags, that exist in
427 # both the llvm-project and test-suite repos if we want to run the
428 # test suite.
429 # If the test-suite fails to download assume we are using a ref that
430 # doesn't exist in the test suite and disable it.
431 set +e
432 curl -L https://github.com/llvm/test-suite/archive/$git_ref.tar.gz | \
433 tar -C $TestSuiteSrcDir --strip-components=1 -xzf -
434 if [ $? -ne -0 ]; then
435 echo "$git_ref not found in test-suite repo, test-suite disabled."
436 do_test_suite="no"
438 set -e
441 cd $BuildDir
444 function configure_llvmCore() {
445 Phase="$1"
446 Flavor="$2"
447 ObjDir="$3"
449 case $Flavor in
450 Release )
451 BuildType="Release"
452 Assertions="OFF"
454 Release+Asserts )
455 BuildType="Release"
456 Assertions="ON"
458 Debug )
459 BuildType="Debug"
460 Assertions="ON"
463 echo "# Invalid flavor '$Flavor'"
464 echo ""
465 return
467 esac
469 # During the first two phases, there is no need to build any of the projects
470 # except clang, since these phases are only meant to produce a bootstrapped
471 # clang compiler, capable of building the third phase.
472 if [ "$Phase" -lt "3" ]; then
473 project_list="clang"
474 else
475 project_list="$projects"
477 # During the first phase, there is no need to build any of the runtimes,
478 # since this phase is only meant to get a clang compiler, capable of
479 # building itself and any selected runtimes in the second phase.
480 if [ "$Phase" -lt "2" ]; then
481 runtime_list=""
482 # compiler-rt builtins is needed on AIX to have a functional Phase 1 clang.
483 if [ "$System" = "AIX" ]; then
484 runtime_list="compiler-rt"
486 else
487 runtime_list="$runtimes"
490 echo "# Using C compiler: $c_compiler"
491 echo "# Using C++ compiler: $cxx_compiler"
493 cd $ObjDir
494 echo "# Configuring llvm $Release-$RC $Flavor"
496 echo "#" env CC="$c_compiler" CXX="$cxx_compiler" \
497 cmake -G "$generator" \
498 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
499 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
500 -DLLVM_ENABLE_PROJECTS="$project_list" \
501 -DLLVM_LIT_ARGS="-j $NumJobs $LitVerbose" \
502 -DLLVM_ENABLE_RUNTIMES="$runtime_list" \
503 $ExtraConfigureFlags $BuildDir/llvm-project/llvm \
504 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
505 env CC="$c_compiler" CXX="$cxx_compiler" \
506 cmake -G "$generator" \
507 -DCMAKE_BUILD_TYPE=$BuildType -DLLVM_ENABLE_ASSERTIONS=$Assertions \
508 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
509 -DLLVM_ENABLE_PROJECTS="$project_list" \
510 -DLLVM_LIT_ARGS="-j $NumJobs $LitVerbose" \
511 -DLLVM_ENABLE_RUNTIMES="$runtime_list" \
512 $ExtraConfigureFlags $BuildDir/llvm-project/llvm \
513 2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
515 cd $BuildDir
518 function build_llvmCore() {
519 Phase="$1"
520 Flavor="$2"
521 ObjDir="$3"
522 DestDir="$4"
524 Verbose="VERBOSE=1"
525 if [ ${MAKE} = 'ninja' ]; then
526 Verbose="-v"
528 LitVerbose="-v"
530 InstallTarget="install"
531 if [ "$Phase" -lt "3" ]; then
532 BuildTarget="clang"
533 InstallTarget="install-clang install-clang-resource-headers"
534 # compiler-rt builtins is needed on AIX to have a functional Phase 1 clang.
535 if [ "$System" = "AIX" -o "$Phase" != "1" ]; then
536 BuildTarget="$BuildTarget runtimes"
537 InstallTarget="$InstallTarget install-runtimes"
541 cd $ObjDir
542 echo "# Compiling llvm $Release-$RC $Flavor"
543 echo "# ${MAKE} $J_ARG $Verbose"
544 ${MAKE} $J_ARG $Verbose $BuildTarget \
545 2>&1 | tee $LogDir/llvm.make-Phase$Phase-$Flavor.log > $redir
547 echo "# Installing llvm $Release-$RC $Flavor"
548 echo "# ${MAKE} install"
549 DESTDIR="${DestDir}" ${MAKE} $InstallTarget \
550 2>&1 | tee $LogDir/llvm.install-Phase$Phase-$Flavor.log > $redir
551 cd $BuildDir
554 function test_llvmCore() {
555 Phase="$1"
556 Flavor="$2"
557 ObjDir="$3"
559 KeepGoing="-k"
560 if [ ${MAKE} = 'ninja' ]; then
561 # Ninja doesn't have a documented "keep-going-forever" mode, we need to
562 # set a limit on how many jobs can fail before we give up.
563 KeepGoing="-k 100"
566 cd $ObjDir
567 if ! ( ${MAKE} $J_ARG $KeepGoing $Verbose check-all \
568 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
569 deferred_error $Phase $Flavor "check-all failed"
572 if [ $do_test_suite = 'yes' ]; then
573 cd $TestSuiteBuildDir
574 env CC="$c_compiler" CXX="$cxx_compiler" \
575 cmake $TestSuiteSrcDir -G "$generator" -DTEST_SUITE_LIT=$Lit \
576 -DTEST_SUITE_HOST_CC=$build_compiler
578 if ! ( ${MAKE} $J_ARG $KeepGoing $Verbose check \
579 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
580 deferred_error $Phase $Flavor "test suite failed"
583 cd $BuildDir
586 # Clean RPATH. Libtool adds the build directory to the search path, which is
587 # not necessary --- and even harmful --- for the binary packages we release.
588 function clean_RPATH() {
589 if [ "$System" = "Darwin" ] || [ "$System" = "SunOS" ] || [ "$System" = "AIX" ]; then
590 return
592 local InstallPath="$1"
593 for Candidate in `find $InstallPath/{bin,lib} -type f`; do
594 if file $Candidate | grep ELF | egrep 'executable|shared object' > /dev/null 2>&1 ; then
595 if rpath=`objdump -x $Candidate | grep 'RPATH'` ; then
596 rpath=`echo $rpath | sed -e's/^ *RPATH *//'`
597 if [ -n "$rpath" ]; then
598 newrpath=`echo $rpath | sed -e's/.*\(\$ORIGIN[^:]*\).*/\1/'`
599 chrpath -r $newrpath $Candidate 2>&1 > /dev/null 2>&1
603 done
606 # Create a package of the release binaries.
607 function package_release() {
608 cwd=`pwd`
609 cd $BuildDir/Phase3/Release
610 mv llvmCore-$Release-$RC.install/usr/local $Package
611 if [ "$use_gzip" = "yes" ]; then
612 tar cf - $Package | gzip -9c > $BuildDir/$Package.tar.gz
613 else
614 tar cf - $Package | xz -9ce -T $NumJobs > $BuildDir/$Package.tar.xz
616 mv $Package llvmCore-$Release-$RC.install/usr/local
617 cd $cwd
620 # Exit if any command fails
621 # Note: pipefail is necessary for running build commands through
622 # a pipe (i.e. it changes the output of ``false | tee /dev/null ; echo $?``)
623 set -e
624 set -o pipefail
626 # Turn off core dumps, as some test cases can easily fill up even the largest
627 # file systems.
628 ulimit -c 0
630 if [ "$do_checkout" = "yes" ]; then
631 export_sources
634 # Setup the test-suite. Do this early so we can catch failures before
635 # we do the full 3 stage build.
636 if [ $do_test_suite = "yes" ]; then
637 check_program_exists 'python3'
638 venv="python3 -m venv"
640 SandboxDir="$BuildDir/sandbox"
641 Lit=$SandboxDir/bin/lit
642 TestSuiteBuildDir="$BuildDir/test-suite-build"
643 TestSuiteSrcDir="$BuildDir/llvm-test-suite"
645 ${venv} $SandboxDir
646 $SandboxDir/bin/python $BuildDir/llvm-project/llvm/utils/lit/setup.py install
647 mkdir -p $TestSuiteBuildDir
650 if [ "$do_cmake_cache" = "yes" ]; then
651 build_with_cmake_cache
652 exit 0
657 Flavors="Release"
658 if [ "$do_debug" = "yes" ]; then
659 Flavors="Debug $Flavors"
661 if [ "$do_asserts" = "yes" ]; then
662 Flavors="$Flavors Release+Asserts"
665 for Flavor in $Flavors ; do
666 echo ""
667 echo ""
668 echo "********************************************************************************"
669 echo " Release: $Release-$RC"
670 echo " Build: $Flavor"
671 echo " System Info: "
672 echo " `uname -a`"
673 echo "********************************************************************************"
674 echo ""
676 c_compiler="$CC"
677 cxx_compiler="$CXX"
678 build_compiler="$CC"
679 [[ -z "$build_compiler" ]] && build_compiler="cc"
680 llvmCore_phase1_objdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-$RC.obj
681 llvmCore_phase1_destdir=$BuildDir/Phase1/$Flavor/llvmCore-$Release-$RC.install
683 llvmCore_phase2_objdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-$RC.obj
684 llvmCore_phase2_destdir=$BuildDir/Phase2/$Flavor/llvmCore-$Release-$RC.install
686 llvmCore_phase3_objdir=$BuildDir/Phase3/$Flavor/llvmCore-$Release-$RC.obj
687 llvmCore_phase3_destdir=$BuildDir/Phase3/$Flavor/llvmCore-$Release-$RC.install
689 rm -rf $llvmCore_phase1_objdir
690 rm -rf $llvmCore_phase1_destdir
692 rm -rf $llvmCore_phase2_objdir
693 rm -rf $llvmCore_phase2_destdir
695 rm -rf $llvmCore_phase3_objdir
696 rm -rf $llvmCore_phase3_destdir
698 mkdir -p $llvmCore_phase1_objdir
699 mkdir -p $llvmCore_phase1_destdir
701 mkdir -p $llvmCore_phase2_objdir
702 mkdir -p $llvmCore_phase2_destdir
704 mkdir -p $llvmCore_phase3_objdir
705 mkdir -p $llvmCore_phase3_destdir
707 ############################################################################
708 # Phase 1: Build llvmCore and clang
709 echo "# Phase 1: Building llvmCore"
710 configure_llvmCore 1 $Flavor $llvmCore_phase1_objdir
711 build_llvmCore 1 $Flavor \
712 $llvmCore_phase1_objdir $llvmCore_phase1_destdir
713 clean_RPATH $llvmCore_phase1_destdir/usr/local
715 ########################################################################
716 # Phase 2: Build llvmCore with newly built clang from phase 1.
717 c_compiler=$llvmCore_phase1_destdir/usr/local/bin/clang
718 cxx_compiler=$llvmCore_phase1_destdir/usr/local/bin/clang++
719 echo "# Phase 2: Building llvmCore"
720 configure_llvmCore 2 $Flavor $llvmCore_phase2_objdir
721 build_llvmCore 2 $Flavor \
722 $llvmCore_phase2_objdir $llvmCore_phase2_destdir
723 clean_RPATH $llvmCore_phase2_destdir/usr/local
725 ########################################################################
726 # Phase 3: Build llvmCore with newly built clang from phase 2.
727 c_compiler=$llvmCore_phase2_destdir/usr/local/bin/clang
728 cxx_compiler=$llvmCore_phase2_destdir/usr/local/bin/clang++
729 echo "# Phase 3: Building llvmCore"
730 configure_llvmCore 3 $Flavor $llvmCore_phase3_objdir
731 build_llvmCore 3 $Flavor \
732 $llvmCore_phase3_objdir $llvmCore_phase3_destdir
733 clean_RPATH $llvmCore_phase3_destdir/usr/local
735 ########################################################################
736 # Testing: Test phase 3
737 c_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang
738 cxx_compiler=$llvmCore_phase3_destdir/usr/local/bin/clang++
739 echo "# Testing - built with clang"
740 test_llvmCore 3 $Flavor $llvmCore_phase3_objdir
742 ########################################################################
743 # Compare .o files between Phase2 and Phase3 and report which ones
744 # differ.
745 if [ "$do_compare" = "yes" ]; then
746 echo
747 echo "# Comparing Phase 2 and Phase 3 files"
748 for p2 in `find $llvmCore_phase2_objdir -name '*.o'` ; do
749 p3=`echo $p2 | sed -e 's,Phase2,Phase3,'`
750 # Substitute 'Phase2' for 'Phase3' in the Phase 2 object file in
751 # case there are build paths in the debug info. Do the same sub-
752 # stitution on both files in case the string occurrs naturally.
753 if ! cmp -s \
754 <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p2) \
755 <(env LC_CTYPE=C sed -e 's,Phase1,Phase2,g' -e 's,Phase2,Phase3,g' $p3) \
756 16 16; then
757 echo "file `basename $p2` differs between phase 2 and phase 3"
759 done
761 done
763 ) 2>&1 | tee $LogDir/testing.$Release-$RC.log
765 if [ "$use_gzip" = "yes" ]; then
766 echo "# Packaging the release as $Package.tar.gz"
767 else
768 echo "# Packaging the release as $Package.tar.xz"
770 package_release
772 set +e
774 # Woo hoo!
775 echo "### Testing Finished ###"
776 echo "### Logs: $LogDir"
778 echo "### Errors:"
779 if [ -s "$LogDir/deferred_errors.log" ]; then
780 cat "$LogDir/deferred_errors.log"
781 exit 1
782 else
783 echo "None."
786 exit 0